assume_associative=False,
category=None,
rank=None,
- natural_basis=None):
+ natural_basis=None,
+ inner_product=None):
n = len(mult_table)
mult_table = [b.base_extend(field) for b in mult_table]
for b in mult_table:
names=names,
category=cat,
rank=rank,
- natural_basis=natural_basis)
+ natural_basis=natural_basis,
+ inner_product=inner_product)
def __init__(self, field,
assume_associative=False,
category=None,
rank=None,
- natural_basis=None):
+ natural_basis=None,
+ inner_product=None):
"""
EXAMPLES:
"""
self._rank = rank
self._natural_basis = natural_basis
+ self._inner_product = inner_product
fda = super(FiniteDimensionalEuclideanJordanAlgebra, self)
fda.__init__(field,
mult_table,
return fmt.format(self.degree(), self.base_ring())
+ def inner_product(self, x, y):
+ """
+ The inner product associated with this Euclidean Jordan algebra.
+
+ Will default to the trace inner product if nothing else.
+ """
+ if (not x in self) or (not y in self):
+ raise ArgumentError("arguments must live in this algebra")
+ if self._inner_product is None:
+ return x.trace_inner_product(y)
+ else:
+ return self._inner_product(x,y)
+
+
def natural_basis(self):
"""
Return a more-natural representation of this algebra's basis.
raise NotImplementedError('irregular element')
+ def inner_product(self, other):
+ """
+ Return the parent algebra's inner product of myself and ``other``.
+
+ EXAMPLES:
+
+ The inner product in the Jordan spin algebra is the usual
+ inner product on `R^n` (this example only works because the
+ basis for the Jordan algebra is the standard basis in `R^n`)::
+
+ sage: J = JordanSpinSimpleEJA(3)
+ sage: x = vector(QQ,[1,2,3])
+ sage: y = vector(QQ,[4,5,6])
+ sage: x.inner_product(y)
+ 32
+ sage: J(x).inner_product(J(y))
+ 32
+
+ TESTS:
+
+ Ensure that we can always compute an inner product, and that
+ it gives us back a real number::
+
+ sage: set_random_seed()
+ sage: J = random_eja()
+ sage: x = J.random_element()
+ sage: y = J.random_element()
+ sage: x.inner_product(y) in RR
+ True
+
+ """
+ P = self.parent()
+ if not other in P:
+ raise ArgumentError("'other' must live in the same algebra")
+
+ return P.inner_product(self, other)
+
+
def operator_commutes_with(self, other):
"""
Return whether or not this element operator-commutes
Qs = [ matrix(field, dimension, dimension, lambda k,j: 1*(k == j == i))
for i in xrange(dimension) ]
- return FiniteDimensionalEuclideanJordanAlgebra(field,Qs,rank=dimension)
+ # The usual inner product on R^n.
+ ip = lambda x, y: x.vector().inner_product(y.vector())
+
+ return FiniteDimensionalEuclideanJordanAlgebra(field,
+ Qs,
+ rank=dimension,
+ inner_product=ip)
sage: e2*e3
0
- In one dimension, this is the reals under multiplication::
-
- sage: J1 = JordanSpinSimpleEJA(1)
- sage: J2 = eja_rn(1)
- sage: J1 == J2
- True
-
"""
Qs = []
id_matrix = identity_matrix(field, n)
Qi[0,0] = Qi[0,0] * ~field(2)
Qs.append(Qi)
+ # The usual inner product on R^n.
+ ip = lambda x, y: x.vector().inner_product(y.vector())
+
# The rank of the spin factor algebra is two, UNLESS we're in a
# one-dimensional ambient space (the rank is bounded by the
# ambient dimension).
- return FiniteDimensionalEuclideanJordanAlgebra(field, Qs, rank=min(n,2))
+ return FiniteDimensionalEuclideanJordanAlgebra(field,
+ Qs,
+ rank=min(n,2),
+ inner_product=ip)