]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: minor improvement to the algebra one() method.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 21 Nov 2020 18:57:32 +0000 (13:57 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 21 Nov 2020 18:57:32 +0000 (13:57 -0500)
mjo/eja/eja_algebra.py

index 7089c50ab81c222b5be8ddca3c6667da9699cf98..222b12c9ea0074792c807471eb546d1c45282e71 100644 (file)
@@ -599,19 +599,20 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
         # appeal to the "long vectors" isometry.
         oper_vecs = [ _mat2vec(g.operator().matrix()) for g in self.gens() ]
 
-        # Now we use basis linear algebra to find the coefficients,
+        # Now we use basic linear algebra to find the coefficients,
         # of the matrices-as-vectors-linear-combination, which should
         # work for the original algebra basis too.
-        A = matrix.column(self.base_ring(), oper_vecs)
+        A = matrix(self.base_ring(), oper_vecs)
 
         # We used the isometry on the left-hand side already, but we
         # still need to do it for the right-hand side. Recall that we
         # wanted something that summed to the identity matrix.
         b = _mat2vec( matrix.identity(self.base_ring(), self.dimension()) )
 
-        # Now if there's an identity element in the algebra, this should work.
-        coeffs = A.solve_right(b)
-        return self.linear_combination(zip(self.gens(), coeffs))
+        # Now if there's an identity element in the algebra, this
+        # should work. We solve on the left to avoid having to
+        # transpose the matrix "A".
+        return self.from_vector(A.solve_left(b))
 
 
     def peirce_decomposition(self, c):