X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feja_algebra.py;h=698aa37e2d6698c680ec51d3db1b272e16b6df4d;hb=e803d4ed910a8220535b713fde852f2111ebc947;hp=d0e7b074ce41a00f66d6f6dcd487653f3a8b1674;hpb=11e681d6320f0b7ddbb834931845b6f4a745da93;p=sage.d.git diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index d0e7b07..698aa37 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -60,6 +60,9 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule): self._rank = rank self._natural_basis = natural_basis + # TODO: HACK for the charpoly.. needs redesign badly. + self._basis_normalizers = None + if category is None: category = MagmaticAlgebras(field).FiniteDimensional() category = category.WithBasis().Unital() @@ -224,6 +227,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule): return V.span_of_basis(b) + @cached_method def _charpoly_coeff(self, i): """ @@ -234,6 +238,19 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule): store the trace/determinant (a_{r-1} and a_{0} respectively) separate from the entire characteristic polynomial. """ + if self._basis_normalizers is not None: + # Must be a matrix class? + # WARNING/TODO: this whole mess is mis-designed. + n = self.natural_basis_space().nrows() + field = self.base_ring().base_ring() # yeeeeaaaahhh + J = self.__class__(n, field, False) + (_,x,_,_) = J._charpoly_matrix_system() + p = J._charpoly_coeff(i) + # p might be missing some vars, have to substitute "optionally" + pairs = zip(x.base_ring().gens(), self._basis_normalizers) + substitutions = { v: v*c for (v,c) in pairs } + return p.subs(substitutions) + (A_of_x, x, xr, detA) = self._charpoly_matrix_system() R = A_of_x.base_ring() if i >= self.rank(): @@ -1339,10 +1356,10 @@ class RealSymmetricEJA(FiniteDimensionalEuclideanJordanAlgebra): if p.is_irreducible(): field = NumberField(p, 'sqrt2', embedding=RLF(2).sqrt()) S = [ s.change_ring(field) for s in S ] - self._basis_denormalizers = tuple( - self.__class__.natural_inner_product(s,s).sqrt() + self._basis_normalizers = tuple( + ~(self.__class__.natural_inner_product(s,s).sqrt()) for s in S ) - S = tuple( s/c for (s,c) in zip(S,self._basis_denormalizers) ) + S = tuple( s*c for (s,c) in zip(S,self._basis_normalizers) ) Qs = _multiplication_table_from_matrix_basis(S) @@ -1439,10 +1456,10 @@ class ComplexHermitianEJA(FiniteDimensionalEuclideanJordanAlgebra): if p.is_irreducible(): field = NumberField(p, 'sqrt2', embedding=RLF(2).sqrt()) S = [ s.change_ring(field) for s in S ] - self._basis_denormalizers = tuple( - self.__class__.natural_inner_product(s,s).sqrt() + self._basis_normalizers = tuple( + ~(self.__class__.natural_inner_product(s,s).sqrt()) for s in S ) - S = tuple( s/c for (s,c) in zip(S,self._basis_denormalizers) ) + S = tuple( s*c for (s,c) in zip(S,self._basis_normalizers) ) Qs = _multiplication_table_from_matrix_basis(S)