]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/eja/eja_subalgebra.py
eja: fix sub-subalgebra element construction.
[sage.d.git] / mjo / eja / eja_subalgebra.py
index 0be85616678d4f7f7ffa276ddcd13ab907c6e116..4355e9f20e40d1a396f42a686d474c77e18f1b47 100644 (file)
@@ -95,9 +95,9 @@ class FiniteDimensionalEuclideanJordanSubalgebra(FiniteDimensionalEuclideanJorda
     matrices do not contain the superalgebra's identity element::
 
         sage: J = RealSymmetricEJA(2)
-        sage: E11 = matrix(QQ, [ [1,0],
+        sage: E11 = matrix(AA, [ [1,0],
         ....:                    [0,0] ])
-        sage: E22 = matrix(QQ, [ [0,0],
+        sage: E22 = matrix(AA, [ [0,0],
         ....:                    [0,1] ])
         sage: K1 = FiniteDimensionalEuclideanJordanSubalgebra(J, (J(E11),))
         sage: K1.one().natural_representation()
@@ -198,7 +198,7 @@ class FiniteDimensionalEuclideanJordanSubalgebra(FiniteDimensionalEuclideanJorda
         EXAMPLES::
 
             sage: J = RealSymmetricEJA(3)
-            sage: X = matrix(QQ, [ [0,0,1],
+            sage: X = matrix(AA, [ [0,0,1],
             ....:                  [0,1,0],
             ....:                  [1,0,0] ])
             sage: x = J(X)
@@ -215,8 +215,12 @@ class FiniteDimensionalEuclideanJordanSubalgebra(FiniteDimensionalEuclideanJorda
         if elt not in self.superalgebra():
             raise ValueError("not an element of this subalgebra")
 
-        coords = self.vector_space().coordinate_vector(elt.to_vector())
-        return self.from_vector(coords)
+        # The extra hackery is because foo.to_vector() might not
+        # live in foo.parent().vector_space()!
+        coords = sum( a*b for (a,b)
+                          in zip(elt.to_vector(),
+                                 self.superalgebra().vector_space().basis()) )
+        return self.from_vector(self.vector_space().coordinate_vector(coords))
 
 
 
@@ -249,10 +253,10 @@ class FiniteDimensionalEuclideanJordanSubalgebra(FiniteDimensionalEuclideanJorda
         EXAMPLES::
 
             sage: J = RealSymmetricEJA(3)
-            sage: E11 = matrix(QQ, [ [1,0,0],
+            sage: E11 = matrix(ZZ, [ [1,0,0],
             ....:                    [0,0,0],
             ....:                    [0,0,0] ])
-            sage: E22 = matrix(QQ, [ [0,0,0],
+            sage: E22 = matrix(ZZ, [ [0,0,0],
             ....:                    [0,1,0],
             ....:                    [0,0,0] ])
             sage: b1 = J(E11)