From 93e79713c42e59cbbf907ca5b1bb34528e471ffa Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 4 Feb 2008 12:58:15 -0500 Subject: [PATCH] Add outer_product to arithmetic_container. --- src/arithmetic_container.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/arithmetic_container.py b/src/arithmetic_container.py index e81d805..0c8fa99 100644 --- a/src/arithmetic_container.py +++ b/src/arithmetic_container.py @@ -235,6 +235,14 @@ def work_with_arithmetic_containers(f, *args, **kwargs): +def outer_product(al1, al2): + return ArithmeticListMatrix( + [[al1i*al2i for al2i in al2] for al1i in al1] + ) + + + + class ArithmeticListMatrix: """A matrix type that operates on L{ArithmeticLists}.""" def __init__(self, matrix): -- GitLab