X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feja_element.py;h=81c2b54fca757f0696468b5c450a6dda674a0f7a;hb=78bee5c30c1cd2828d9834fc7d652db21331d4fe;hp=9044860b8b8674c4110bde49edc2d46e9c999bfa;hpb=667e0df9c07589c03616ad8cf42eebe5c86de50b;p=sage.d.git diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index 9044860..81c2b54 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -4,7 +4,7 @@ from sage.modules.free_module import VectorSpace from sage.modules.with_basis.indexed_element import IndexedFreeModuleElement from mjo.eja.eja_operator import FiniteDimensionalEJAOperator -from mjo.eja.eja_utils import _mat2vec +from mjo.eja.eja_utils import _mat2vec, _scale class FiniteDimensionalEJAElement(IndexedFreeModuleElement): """ @@ -664,7 +664,7 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): element should always be in terms of minimal idempotents:: sage: J = JordanSpinEJA(4) - sage: x = sum( i*J.gens()[i] for i in range(len(J.gens())) ) + sage: x = sum( i*J.monomial(i) for i in range(len(J.gens())) ) sage: x.is_regular() True sage: [ c.is_primitive_idempotent() @@ -910,7 +910,7 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): M = matrix([(self.parent().one()).to_vector()]) old_rank = 1 - # Specifying the row-reduction algorithm can e.g. help over + # Specifying the row-reduction algorithm can e.g. help over # AA because it avoids the RecursionError that gets thrown # when we have to look too hard for a root. # @@ -1077,7 +1077,9 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): SETUP:: sage: from mjo.eja.eja_algebra import (ComplexHermitianEJA, - ....: QuaternionHermitianEJA) + ....: HadamardEJA, + ....: QuaternionHermitianEJA, + ....: RealSymmetricEJA) EXAMPLES:: @@ -1123,14 +1125,13 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): B = self.parent().matrix_basis() W = self.parent().matrix_space() - if self.parent()._matrix_basis_is_cartesian: + if hasattr(W, 'cartesian_factors'): # Aaaaand linear combinations don't work in Cartesian - # product spaces, even though they provide a method - # with that name. + # product spaces, even though they provide a method with + # that name. This is hidden behind an "if" because the + # _scale() function is slow. pairs = zip(B, self.to_vector()) - return sum( ( W(tuple(alpha*b_i for b_i in b)) - for (b,alpha) in pairs ), - W.zero()) + return W.sum( _scale(b, alpha) for (b,alpha) in pairs ) else: # This is just a manual "from_vector()", but of course # matrix spaces aren't vector spaces in sage, so they @@ -1401,7 +1402,20 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): SETUP:: - sage: from mjo.eja.eja_algebra import random_eja + sage: from mjo.eja.eja_algebra import (random_eja, + ....: HadamardEJA, + ....: RealSymmetricEJA) + + EXAMPLES: + + We can create subalgebras of Cartesian product EJAs that are not + themselves Cartesian product EJAs (they're just "regular" EJAs):: + + sage: J1 = HadamardEJA(3) + sage: J2 = RealSymmetricEJA(2) + sage: J = cartesian_product([J1,J2]) + sage: J.one().subalgebra_generated_by() + Euclidean Jordan algebra of dimension 1 over Algebraic Real Field TESTS: @@ -1435,7 +1449,11 @@ class FiniteDimensionalEJAElement(IndexedFreeModuleElement): """ powers = tuple( self**k for k in range(self.degree()) ) - A = self.parent().subalgebra(powers, associative=True, **kwargs) + A = self.parent().subalgebra(powers, + associative=True, + check_field=False, + check_axioms=False, + **kwargs) A.one.set_cache(A(self.parent().one())) return A