True
"""
- def __init__(self, A, elt):
- """
- SETUP::
-
- sage: from mjo.eja.eja_algebra import RealSymmetricEJA
- sage: from mjo.eja.eja_subalgebra import FiniteDimensionalEuclideanJordanElementSubalgebra
-
- EXAMPLES::
-
- sage: J = RealSymmetricEJA(3)
- sage: x = sum( i*J.gens()[i] for i in range(6) )
- sage: K = FiniteDimensionalEuclideanJordanElementSubalgebra(x)
- sage: [ K.element_class(K,x^k) for k in range(J.rank()) ]
- [f0, f1, f2]
-
- ::
-
- """
- if elt in A.superalgebra():
- # Try to convert a parent algebra element into a
- # subalgebra element...
- try:
- coords = A.vector_space().coordinate_vector(elt.to_vector())
- elt = A.from_vector(coords).monomial_coefficients()
- except AttributeError:
- # Catches a missing method in elt.to_vector()
- pass
-
- s = super(FiniteDimensionalEuclideanJordanElementSubalgebraElement,
- self)
-
- s.__init__(A, elt)
-
def superalgebra_element(self):
"""
sage: x
e0 + e1 + e2 + e3 + e4 + e5
sage: A = x.subalgebra_generated_by()
- sage: A.element_class(A,x)
+ sage: A(x)
f1
- sage: A.element_class(A,x).superalgebra_element()
+ sage: A(x).superalgebra_element()
e0 + e1 + e2 + e3 + e4 + e5
TESTS:
sage: J = random_eja()
sage: x = J.random_element()
sage: A = x.subalgebra_generated_by()
- sage: A.element_class(A,x).superalgebra_element() == x
+ sage: A(x).superalgebra_element() == x
True
sage: y = A.random_element()
- sage: A.element_class(A,y.superalgebra_element()) == y
+ sage: A(y.superalgebra_element()) == y
True
"""
# matrix for the successive basis elements b0, b1,... of
# that subspace.
field = superalgebra.base_ring()
- mult_table = []
- for b_right in superalgebra_basis:
- b_right_rows = []
- # The first row of the right-multiplication matrix by
- # b1 is what we get if we apply that matrix to b1. The
- # second row of the right multiplication matrix by b1
- # is what we get when we apply that matrix to b2...
- #
- # IMPORTANT: this assumes that all vectors are COLUMN
- # vectors, unlike our superclass (which uses row vectors).
- for b_left in superalgebra_basis:
- # Multiply in the original EJA, but then get the
- # coordinates from the subalgebra in terms of its
- # basis.
- this_row = W.coordinates((b_left*b_right).to_vector())
- b_right_rows.append(this_row)
- b_right_matrix = matrix(field, b_right_rows)
- mult_table.append(b_right_matrix)
-
- for m in mult_table:
- m.set_immutable()
- mult_table = tuple(mult_table)
+ n = len(superalgebra_basis)
+ mult_table = [[W.zero() for i in range(n)] for j in range(n)]
+ for i in range(n):
+ for j in range(n):
+ product = superalgebra_basis[i]*superalgebra_basis[j]
+ mult_table[i][j] = W.coordinate_vector(product.to_vector())
# TODO: We'll have to redo this and make it unique again...
prefix = 'f'
natural_basis=natural_basis)
+ def _element_constructor_(self, elt):
+ """
+ Construct an element of this subalgebra from the given one.
+ The only valid arguments are elements of the parent algebra
+ that happen to live in this subalgebra.
+
+ SETUP::
+
+ sage: from mjo.eja.eja_algebra import RealSymmetricEJA
+ sage: from mjo.eja.eja_subalgebra import FiniteDimensionalEuclideanJordanElementSubalgebra
+
+ EXAMPLES::
+
+ sage: J = RealSymmetricEJA(3)
+ sage: x = sum( i*J.gens()[i] for i in range(6) )
+ sage: K = FiniteDimensionalEuclideanJordanElementSubalgebra(x)
+ sage: [ K(x^k) for k in range(J.rank()) ]
+ [f0, f1, f2]
+
+ ::
+
+ """
+ if elt in self.superalgebra():
+ coords = self.vector_space().coordinate_vector(elt.to_vector())
+ return self.from_vector(coords)
+
def superalgebra(self):
"""
sage: K.vector_space()
Vector space of degree 6 and dimension 3 over Rational Field
User basis matrix:
- [ 1 0 0 1 0 1]
+ [ 1 0 1 0 0 1]
[ 0 1 2 3 4 5]
- [ 5 11 14 26 34 45]
+ [10 14 21 19 31 50]
sage: (x^0).to_vector()
- (1, 0, 0, 1, 0, 1)
+ (1, 0, 1, 0, 0, 1)
sage: (x^1).to_vector()
(0, 1, 2, 3, 4, 5)
sage: (x^2).to_vector()
- (5, 11, 14, 26, 34, 45)
+ (10, 14, 21, 19, 31, 50)
"""
return self._vector_space