]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: fix a bug in the charpoly fast path for complex/quaternion matrices.
authorMichael Orlitzky <michael@orlitzky.com>
Sat, 24 Aug 2019 04:06:56 +0000 (00:06 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Sat, 24 Aug 2019 04:06:56 +0000 (00:06 -0400)
mjo/eja/eja_algebra.py

index 2a5e624cf4730e8296373d5fe542bbc78d31666e..8ab1381665711ee3c09f1a0e3387c9e4dd85bcf3 100644 (file)
@@ -930,7 +930,9 @@ class MatrixEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebra):
             # with had entries in a nice field.
             return super(MatrixEuclideanJordanAlgebra, self)._charpoly_coeff(i)
         else:
-            n = self.natural_basis_space().nrows()
+            # If we didn't unembed first, this number would be wrong
+            # by a power-of-two factor for complex/quaternion matrices.
+            n = self.real_unembed(self.natural_basis_space().zero()).nrows()
             field = self.base_ring().base_ring() # yeeeeaaaahhh
             J = self.__class__(n, field, False)
             (_,x,_,_) = J._charpoly_matrix_system()