return eja_class.random_instance(*args, **kwargs)
-class MatrixEJA:
+class MatrixEJA(FiniteDimensionalEJA):
@staticmethod
def _denormalized_basis(A):
"""
return tr.real()
+ def __init__(self, matrix_space, **kwargs):
+ # We know this is a valid EJA, but will double-check
+ # if the user passes check_axioms=True.
+ if "check_axioms" not in kwargs: kwargs["check_axioms"] = False
+
+
+ super().__init__(self._denormalized_basis(matrix_space),
+ self.jordan_product,
+ self.trace_inner_product,
+ field=matrix_space.base_ring(),
+ matrix_space=matrix_space,
+ **kwargs)
+
+ self.rank.set_cache(matrix_space.nrows())
+ self.one.set_cache( self(matrix_space.one()) )
-class RealSymmetricEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA):
+class RealSymmetricEJA(MatrixEJA, RationalBasisEJA, ConcreteEJA):
"""
The rank-n simple EJA consisting of real symmetric n-by-n
matrices, the usual symmetric Jordan product, and the trace inner
if "check_axioms" not in kwargs: kwargs["check_axioms"] = False
A = MatrixSpace(field, n)
- super().__init__(self._denormalized_basis(A),
- self.jordan_product,
- self.trace_inner_product,
- field=field,
- matrix_space=A,
- **kwargs)
-
- # TODO: this could be factored out somehow, but is left here
- # because the MatrixEJA is not presently a subclass of the
- # FDEJA class that defines rank() and one().
- self.rank.set_cache(n)
- self.one.set_cache( self(A.one()) )
+ super().__init__(A, **kwargs)
-class ComplexHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA):
+class ComplexHermitianEJA(MatrixEJA, RationalBasisEJA, ConcreteEJA):
"""
The rank-n simple EJA consisting of complex Hermitian n-by-n
matrices over the real numbers, the usual symmetric Jordan product,
from mjo.hurwitz import ComplexMatrixAlgebra
A = ComplexMatrixAlgebra(n, scalars=field)
- super().__init__(self._denormalized_basis(A),
- self.jordan_product,
- self.trace_inner_product,
- field=field,
- matrix_space=A,
- **kwargs)
-
- # TODO: this could be factored out somehow, but is left here
- # because the MatrixEJA is not presently a subclass of the
- # FDEJA class that defines rank() and one().
- self.rank.set_cache(n)
- self.one.set_cache( self(A.one()) )
+ super().__init__(A, **kwargs)
@staticmethod
return cls(n, **kwargs)
-class QuaternionHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA):
+class QuaternionHermitianEJA(MatrixEJA, RationalBasisEJA, ConcreteEJA):
r"""
The rank-n simple EJA consisting of self-adjoint n-by-n quaternion
matrices, the usual symmetric Jordan product, and the
from mjo.hurwitz import QuaternionMatrixAlgebra
A = QuaternionMatrixAlgebra(n, scalars=field)
- super().__init__(self._denormalized_basis(A),
- self.jordan_product,
- self.trace_inner_product,
- field=field,
- matrix_space=A,
- **kwargs)
-
- # TODO: this could be factored out somehow, but is left here
- # because the MatrixEJA is not presently a subclass of the
- # FDEJA class that defines rank() and one().
- self.rank.set_cache(n)
- self.one.set_cache( self(A.one()) )
+ super().__init__(A, **kwargs)
@staticmethod
n = ZZ.random_element(cls._max_random_instance_size() + 1)
return cls(n, **kwargs)
-class OctonionHermitianEJA(RationalBasisEJA, ConcreteEJA, MatrixEJA):
+class OctonionHermitianEJA(MatrixEJA, RationalBasisEJA, ConcreteEJA):
r"""
SETUP::
from mjo.hurwitz import OctonionMatrixAlgebra
A = OctonionMatrixAlgebra(n, scalars=field)
- super().__init__(self._denormalized_basis(A),
- self.jordan_product,
- self.trace_inner_product,
- field=field,
- matrix_space=A,
- **kwargs)
-
- # TODO: this could be factored out somehow, but is left here
- # because the MatrixEJA is not presently a subclass of the
- # FDEJA class that defines rank() and one().
- self.rank.set_cache(n)
- self.one.set_cache( self(A.one()) )
+ super().__init__(A, **kwargs)
class AlbertEJA(OctonionHermitianEJA):
sage: (x*y).det() == x.det()*y.det()
True
- The determinant in matrix algebras is just the usual determinant::
+ The determinant in real matrix algebras is the usual determinant::
sage: set_random_seed()
sage: X = matrix.random(QQ,3)
sage: actual2 == expected
True
- ::
-
- sage: set_random_seed()
- sage: J1 = ComplexHermitianEJA(2)
- sage: J2 = ComplexHermitianEJA(2,field=QQ,orthonormalize=False)
- sage: X = matrix.random(GaussianIntegers(), 2)
- sage: X = X + X.H
- sage: expected = AA(X.det())
- sage: actual1 = J1(J1.real_embed(X)).det()
- sage: actual2 = J2(J2.real_embed(X)).det()
- sage: expected == actual1
- True
- sage: expected == actual2
- True
-
"""
P = self.parent()
r = P.rank()
sage: J.one()
b0 + b3 + b8
sage: J.one().to_matrix()
- [1 0 0 0 0 0]
- [0 1 0 0 0 0]
- [0 0 1 0 0 0]
- [0 0 0 1 0 0]
- [0 0 0 0 1 0]
- [0 0 0 0 0 1]
+ +---+---+---+
+ | 1 | 0 | 0 |
+ +---+---+---+
+ | 0 | 1 | 0 |
+ +---+---+---+
+ | 0 | 0 | 1 |
+ +---+---+---+
::