X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feja_element_subalgebra.py;h=7bc4b3a9a79c5cae8dbd60db3f63d581d215fc23;hb=d96de12813f0403a0ca7ca1c57c75c732cf13612;hp=3936ac1fe5c7709165b91114b9e52bd8f47ab683;hpb=fe2af66b109e9487a59f21d5b67bb5c4aafdc98d;p=sage.d.git diff --git a/mjo/eja/eja_element_subalgebra.py b/mjo/eja/eja_element_subalgebra.py index 3936ac1..7bc4b3a 100644 --- a/mjo/eja/eja_element_subalgebra.py +++ b/mjo/eja/eja_element_subalgebra.py @@ -1,4 +1,5 @@ from sage.matrix.constructor import matrix +from sage.misc.cachefunc import cached_method from sage.rings.all import QQ from mjo.eja.eja_subalgebra import FiniteDimensionalEuclideanJordanSubalgebra @@ -71,6 +72,7 @@ class FiniteDimensionalEuclideanJordanElementSubalgebra(FiniteDimensionalEuclide self.rank.set_cache(self.dimension()) + @cached_method def one(self): """ Return the multiplicative identity element of this algebra. @@ -78,7 +80,7 @@ class FiniteDimensionalEuclideanJordanElementSubalgebra(FiniteDimensionalEuclide The superclass method computes the identity element, which is beyond overkill in this case: the superalgebra identity restricted to this algebra is its identity. Note that we can't - count on the first basis element being the identity -- it migth + count on the first basis element being the identity -- it might have been scaled if we orthonormalized the basis. SETUP:: @@ -144,12 +146,6 @@ class FiniteDimensionalEuclideanJordanElementSubalgebra(FiniteDimensionalEuclide """ if self.dimension() == 0: return self.zero() - else: - sa_one = self.superalgebra().one().to_vector() - # 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(sa_one, - self.superalgebra().vector_space().basis()) ) - return self.from_vector(self.vector_space().coordinate_vector(coords)) + + return self(self.superalgebra().one())