]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: use the standard basis in characteristic_polynomial().
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 23 Jul 2019 03:17:04 +0000 (23:17 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 29 Jul 2019 03:19:01 +0000 (23:19 -0400)
I couldn't see a reason why we needed to do a change-of-basis in the
characteristic_polynomial() function (a la Faraut and Koranyi), so I
tried it with the standard basis. And, everything seems to work? Cool.

mjo/eja/euclidean_jordan_algebra.py

index 421c70bfa42d1e0ae8f837086437c491a9ab98f9..2c496cd3ed893b3fd34f82f6e3ce730c757e0926 100644 (file)
@@ -110,31 +110,12 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
         r = self.rank()
         n = self.dimension()
 
-        # First, compute the basis B...
-        x0 = self.zero()
-        c = 1
-        for g in self.gens():
-            x0 += c*g
-            c +=1
-        if not x0.is_regular():
-            raise ValueError("don't know a regular element")
-
-        V = x0.vector().parent().ambient_vector_space()
-        V1 = V.span_of_basis( (x0**k).vector() for k in range(self.rank()) )
-        B =  (V1.basis() + V1.complement().basis())
-
         # Now switch to the polynomial rings.
-
         names = ['X' + str(i) for i in range(1,n+1)]
         R = PolynomialRing(self.base_ring(), names)
         J = FiniteDimensionalEuclideanJordanAlgebra(R,
                                                     self._multiplication_table,
                                                     rank=r)
-        B = [ b.change_ring(R.fraction_field()) for b in B ]
-        # Get the vector space (as opposed to module) so that
-        # span_of_basis() works.
-        V = J.zero().vector().parent().ambient_vector_space()
-        W = V.span_of_basis(B)
 
         def e(k):
             # The coordinates of e_k with respect to the basis B.
@@ -143,10 +124,10 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
 
         # A matrix implementation 1
         x = J(vector(R, R.gens()))
-        l1 = [column_matrix(W.coordinates((x**k).vector())) for k in range(r)]
+        l1 = [column_matrix((x**k).vector()) for k in range(r)]
         l2 = [e(k) for k in range(r+1, n+1)]
         A_of_x = block_matrix(1, n, (l1 + l2))
-        xr = W.coordinates((x**r).vector())
+        xr = (x**r).vector()
         a = []
         denominator = A_of_x.det() # This is constant
         for i in range(n):