]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: simplify to_matrix() for elements.
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 24 Feb 2021 02:24:56 +0000 (21:24 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 24 Feb 2021 02:24:56 +0000 (21:24 -0500)
mjo/eja/eja_element.py

index 7388e963ceaf42c0bdf41851e2b8019de5e69b3a..347aa3c211278a15a691944c9a559076c5817acf 100644 (file)
@@ -1651,8 +1651,7 @@ class CartesianProductEJAElement(FiniteDimensionalEJAElement):
         # product spaces, even though they provide a method
         # with that name.
         pairs = zip(B, self.to_vector())
-        sigma = W.zero()
-        for (b,alpha) in pairs:
-            # sum(...) ALSO doesn't work on Cartesian products.
-            sigma += W(tuple(alpha*b_i for b_i in b))
-        return sigma
+        return sum( ( W(tuple(alpha*b_i for b_i in b))
+                      for (b,alpha) in pairs ),
+                    W.zero())
+