]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/eja/eja_element.py
eja: start fixing Cartesian products of Cartesian products.
[sage.d.git] / mjo / eja / eja_element.py
index b5f661bf037667d4d9210b6af65a3c1f95120732..9a770ae5f68b3e19f3946ca7716f299a3ff82685 100644 (file)
@@ -4,7 +4,7 @@ from sage.modules.free_module import VectorSpace
 from sage.modules.with_basis.indexed_element import IndexedFreeModuleElement
 
 from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
-from mjo.eja.eja_utils import _mat2vec
+from mjo.eja.eja_utils import _mat2vec, _scale
 
 class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
     """
@@ -1128,10 +1128,10 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
         if self.parent()._matrix_basis_is_cartesian:
             # Aaaaand linear combinations don't work in Cartesian
             # product spaces, even though they provide a method
-            # with that name.
+            # with that name. This is special-cased because the
+            # _scale() function is slow.
             pairs = zip(B, self.to_vector())
-            return sum( ( W(tuple(alpha*b_i for b_i in b))
-                          for (b,alpha) in pairs ),
+            return sum( ( _scale(b, alpha) for (b,alpha) in pairs ),
                         W.zero())
         else:
             # This is just a manual "from_vector()", but of course