TESTS::
sage: set_random_seed()
- sage: J = eja_rn(5)
+ sage: J = RealCartesianProductEJA(5)
sage: c = J.random_element().subalgebra_idempotent()
sage: c^2 == c
True
return (self*other).trace()
-def eja_rn(dimension, field=QQ):
+class RealCartesianProductEJA(FiniteDimensionalEuclideanJordanAlgebra):
"""
Return the Euclidean Jordan Algebra corresponding to the set
`R^n` under the Hadamard product.
+ Note: this is nothing more than the Cartesian product of ``n``
+ copies of the spin algebra. Once Cartesian product algebras
+ are implemented, this can go.
+
EXAMPLES:
This multiplication table can be verified by hand::
- sage: J = eja_rn(3)
+ sage: J = RealCartesianProductEJA(3)
sage: e0,e1,e2 = J.gens()
sage: e0*e0
e0
e2
"""
- # The FiniteDimensionalAlgebra constructor takes a list of
- # matrices, the ith representing right multiplication by the ith
- # basis element in the vector space. So if e_1 = (1,0,0), then
- # right (Hadamard) multiplication of x by e_1 picks out the first
- # component of x; and likewise for the ith basis element e_i.
- Qs = [ matrix(field, dimension, dimension, lambda k,j: 1*(k == j == i))
- for i in xrange(dimension) ]
+ @staticmethod
+ def __classcall_private__(cls, n, field=QQ):
+ # The FiniteDimensionalAlgebra constructor takes a list of
+ # matrices, the ith representing right multiplication by the ith
+ # basis element in the vector space. So if e_1 = (1,0,0), then
+ # right (Hadamard) multiplication of x by e_1 picks out the first
+ # component of x; and likewise for the ith basis element e_i.
+ Qs = [ matrix(field, n, n, lambda k,j: 1*(k == j == i))
+ for i in xrange(n) ]
- return FiniteDimensionalEuclideanJordanAlgebra(field,
- Qs,
- rank=dimension)
+ fdeja = super(RealCartesianProductEJA, cls)
+ return fdeja.__classcall_private__(cls, field, Qs, rank=n)
+ def inner_product(self, x, y):
+ return _usual_ip(x,y)
def random_eja():
"""
n = ZZ.random_element(1,5)
- constructor = choice([eja_rn,
+ constructor = choice([RealCartesianProductEJA,
JordanSpinEJA,
RealSymmetricEJA,
ComplexHermitianEJA,
Qi[0,0] = Qi[0,0] * ~field(2)
Qs.append(Qi)
+ # The rank of the spin algebra is two, unless we're in a
+ # one-dimensional ambient space (because the rank is bounded by
+ # the ambient dimension).
fdeja = super(JordanSpinEJA, cls)
- return fdeja.__classcall_private__(cls, field, Qs)
-
- def rank(self):
- """
- Return the rank of this Jordan Spin Algebra.
-
- The rank of the spin algebra is two, unless we're in a
- one-dimensional ambient space (because the rank is bounded by
- the ambient dimension).
- """
- return min(self.dimension(),2)
+ return fdeja.__classcall_private__(cls, field, Qs, rank=min(n,2))
def inner_product(self, x, y):
return _usual_ip(x,y)