sage: F = J.base_ring()
sage: a0 = (1/4)*X[4]**2*X[6]**2 - (1/2)*X[2]*X[5]*X[6]**2 - (1/2)*X[3]*X[4]*X[6]*X[7] + (F(2).sqrt()/2)*X[1]*X[5]*X[6]*X[7] + (1/4)*X[3]**2*X[7]**2 - (1/2)*X[0]*X[5]*X[7]**2 + (F(2).sqrt()/2)*X[2]*X[3]*X[6]*X[8] - (1/2)*X[1]*X[4]*X[6*X[8] - (1/2)*X[1]*X[3]*X[7]*X[8] + (F(2).sqrt()/2)*X[0]*X[4]*X[7]*X[8] + (1/4)*X[1]**2*X[8]**2 - (1/2)*X[0]*X[2]*X[8]**2 - (1/2)*X[2]*X[3]**2*X[9] + (F(2).sqrt()/2)*X[1]*X[3]*X[4]*X[9] - (1/2)*X[0]*X[4]**2*X[9] - (1/2)*X[1]**2*X[5]*X[9] + X[0]*X[2]*X[5]*X[9]
-5. The main EJA element constructor is happy to convert between
- e.g. HadamardEJA(3) and JordanSpinEJA(3).
-
-6. Profile the construction of "large" matrix algebras (like the
+5. Profile the construction of "large" matrix algebras (like the
15-dimensional QuaternionHermitianAlgebra(3)) to find out why
they're so slow.
sage: J(x.to_vector().column()) == x
True
+ We cannot coerce elements between algebras just because their
+ matrix representations are compatible::
+
+ sage: J1 = HadamardEJA(3)
+ sage: J2 = JordanSpinEJA(3)
+ sage: J2(J1.one())
+ Traceback (most recent call last):
+ ...
+ ValueError: not an element of this algebra
+ sage: J1(J2.zero())
+ Traceback (most recent call last):
+ ...
+ ValueError: not an element of this algebra
+
"""
msg = "not an element of this algebra"
- if elt == 0:
- # The superclass implementation of random_element()
- # needs to be able to coerce "0" into the algebra.
- return self.zero()
- elif elt in self.base_ring():
+ if elt in self.base_ring():
# Ensure that no base ring -> algebra coercion is performed
# by this method. There's some stupidity in sage that would
# otherwise propagate to this method; for example, sage thinks
raise ValueError(msg)
try:
+ # Try to convert a vector into a column-matrix...
elt = elt.column()
except (AttributeError, TypeError):
- # Try to convert a vector into a column-matrix
+ # and ignore failure, because we weren't really expecting
+ # a vector as an argument anyway.
pass
if elt not in self.matrix_space():
# could be QQ instead of QQbar.
#
# And, we also have to handle Cartesian product bases (when
- # the matric basis consists of tuples) here. The "good news"
+ # the matrix basis consists of tuples) here. The "good news"
# is that we're already converting everything to long vectors,
# and that strategy works for tuples as well.
#