5. The rational_algebra() stuff doesn't really belong in classes that
don't derive from RationalBasisEJA or its as-yet-nonexistent
element class.
-
-6. Drop "FiniteDimensional" everywhere.
the one-by-one matrices is of course the set consisting of a single
matrix with its sole entry non-zero::
- sage: from mjo.eja.eja_algebra import FiniteDimensionalEJA
+ sage: from mjo.eja.eja_algebra import EJA
sage: jp = lambda X,Y: X*Y
sage: ip = lambda X,Y: X[0,0]*Y[0,0]
sage: b1 = matrix(AA, [[1]])
- sage: J1 = FiniteDimensionalEJA((b1,), jp, ip)
+ sage: J1 = EJA((b1,), jp, ip)
sage: J1
Euclidean Jordan algebra of dimension 1 over Algebraic Real Field
In fact, any positive scalar multiple of that inner-product would work::
sage: ip2 = lambda X,Y: 16*ip(X,Y)
- sage: J2 = FiniteDimensionalEJA((b1,), jp, ip2)
+ sage: J2 = EJA((b1,), jp, ip2)
sage: J2
Euclidean Jordan algebra of dimension 1 over Algebraic Real Field
given inner-product_ unless you pass ``orthonormalize=False`` to the
constructor. For example::
- sage: J3 = FiniteDimensionalEJA((b1,), jp, ip2, orthonormalize=False)
+ sage: J3 = EJA((b1,), jp, ip2, orthonormalize=False)
sage: J3
Euclidean Jordan algebra of dimension 1 over Algebraic Real Field
sage: from mjo.matrix_algebra import MatrixAlgebra
sage: A = MatrixAlgebra(1,AA,AA)
- sage: J4 = FiniteDimensionalEJA(A.gens(), jp, ip)
+ sage: J4 = EJA(A.gens(), jp, ip)
sage: J4
Euclidean Jordan algebra of dimension 1 over Algebraic Real Field
sage: J4.basis()[0].to_matrix()
PolynomialRing,
QuadraticField)
from mjo.eja.eja_element import (CartesianProductEJAElement,
- FiniteDimensionalEJAElement)
-from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ EJAElement)
+from mjo.eja.eja_operator import EJAOperator
from mjo.eja.eja_utils import _all2list
def EuclideanJordanAlgebras(field):
category = category.WithBasis().Unital().Commutative()
return category
-class FiniteDimensionalEJA(CombinatorialFreeModule):
+class EJA(CombinatorialFreeModule):
r"""
A finite-dimensional Euclidean Jordan algebra.
sage: J.subalgebra(basis, orthonormalize=False).is_associative()
True
"""
- Element = FiniteDimensionalEJAElement
+ Element = EJAElement
@staticmethod
def _check_input_field(field):
r"""
Create a subalgebra of this algebra from the given basis.
"""
- from mjo.eja.eja_subalgebra import FiniteDimensionalEJASubalgebra
- return FiniteDimensionalEJASubalgebra(self, basis, **kwargs)
+ from mjo.eja.eja_subalgebra import EJASubalgebra
+ return EJASubalgebra(self, basis, **kwargs)
def vector_space(self):
-class RationalBasisEJA(FiniteDimensionalEJA):
+class RationalBasisEJA(EJA):
r"""
Algebras whose supplied basis elements have all rational entries.
# Note: the same Jordan and inner-products work here,
# because they are necessarily defined with respect to
# ambient coordinates and not any particular basis.
- self._rational_algebra = FiniteDimensionalEJA(
+ self._rational_algebra = EJA(
basis,
jordan_product,
inner_product,
subs_dict = { X[i]: BX[i] for i in range(len(X)) }
return tuple( a_i.subs(subs_dict) for a_i in a )
-class ConcreteEJA(FiniteDimensionalEJA):
+class ConcreteEJA(EJA):
r"""
A class for the Euclidean Jordan algebras that we know by name.
return eja_class.random_instance(max_dimension, *args, **kwargs)
-class HermitianMatrixEJA(FiniteDimensionalEJA):
+class HermitianMatrixEJA(EJA):
@staticmethod
def _denormalized_basis(A):
"""
r"""
SETUP::
- sage: from mjo.eja.eja_algebra import (FiniteDimensionalEJA,
+ sage: from mjo.eja.eja_algebra import (EJA,
....: OctonionHermitianEJA)
sage: from mjo.hurwitz import Octonions, OctonionMatrixAlgebra
sage: basis = (b[0] + b[9],) + b[1:9] + (b[0] - b[9],)
sage: jp = OctonionHermitianEJA.jordan_product
sage: ip = OctonionHermitianEJA.trace_inner_product
- sage: J = FiniteDimensionalEJA(basis,
+ sage: J = EJA(basis,
....: jp,
....: ip,
....: field=QQ,
return cls(**kwargs)
-class CartesianProductEJA(FiniteDimensionalEJA):
+class CartesianProductEJA(EJA):
r"""
The external (orthogonal) direct sum of two or more Euclidean
Jordan algebras. Every Euclidean Jordan algebra decomposes into an
Pi = self._module_morphism(lambda j: Ji.monomial(j - offset),
codomain=Ji)
- return FiniteDimensionalEJAOperator(self,Ji,Pi.matrix())
+ return EJAOperator(self,Ji,Pi.matrix())
@cached_method
def cartesian_embedding(self, i):
Ji = self.cartesian_factor(i)
Ei = Ji._module_morphism(lambda j: self.monomial(j + offset),
codomain=self)
- return FiniteDimensionalEJAOperator(Ji,self,Ei.matrix())
+ return EJAOperator(Ji,self,Ei.matrix())
def subalgebra(self, basis, **kwargs):
False
"""
- from mjo.eja.eja_subalgebra import FiniteDimensionalCartesianProductEJASubalgebra
- return FiniteDimensionalCartesianProductEJASubalgebra(self, basis, **kwargs)
+ from mjo.eja.eja_subalgebra import CartesianProductEJASubalgebra
+ return CartesianProductEJASubalgebra(self, basis, **kwargs)
-FiniteDimensionalEJA.CartesianProduct = CartesianProductEJA
+EJA.CartesianProduct = CartesianProductEJA
class RationalBasisCartesianProductEJA(CartesianProductEJA,
RationalBasisEJA):
SETUP::
- sage: from mjo.eja.eja_algebra import (FiniteDimensionalEJA,
+ sage: from mjo.eja.eja_algebra import (EJA,
....: HadamardEJA,
....: JordanSpinEJA,
....: RealSymmetricEJA)
sage: jp = lambda X,Y: X*Y
sage: ip = lambda X,Y: X[0,0]*Y[0,0]
sage: b1 = matrix(QQ, [[1]])
- sage: J2 = FiniteDimensionalEJA((b1,), jp, ip)
+ sage: J2 = EJA((b1,), jp, ip)
sage: cartesian_product([J2,J1]) # factor one not RationalBasisEJA
Euclidean Jordan algebra of dimension 1 over Algebraic Real
Field (+) Euclidean Jordan algebra of dimension 2 over Algebraic
sage: from mjo.eja.eja_algebra import (ComplexSkewSymmetricEJA,
....: QuaternionHermitianEJA)
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
EXAMPLES:
sage: J = ComplexSkewSymmetricEJA(2, field=QQ, orthonormalize=False)
sage: K = QuaternionHermitianEJA(2, field=QQ, orthonormalize=False)
sage: jordan_isom_matrix = matrix.diagonal(QQ,[-1,1,1,1,1,-1])
- sage: phi = FiniteDimensionalEJAOperator(J,K,jordan_isom_matrix)
+ sage: phi = EJAOperator(J,K,jordan_isom_matrix)
sage: all( phi(x*y) == phi(x)*phi(y)
....: for x in J.gens()
....: for y in J.gens() )
from sage.modules.free_module import VectorSpace
from sage.modules.with_basis.indexed_element import IndexedFreeModuleElement
-from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+from mjo.eja.eja_operator import EJAOperator
from mjo.eja.eja_utils import _scale
-class FiniteDimensionalEJAElement(IndexedFreeModuleElement):
+class EJAElement(IndexedFreeModuleElement):
"""
An element of a Euclidean Jordan algebra.
"""
P = self.parent()
left_mult_by_self = lambda y: self*y
L = P.module_morphism(function=left_mult_by_self, codomain=P)
- return FiniteDimensionalEJAOperator(P, P, L.matrix() )
+ return EJAOperator(P, P, L.matrix() )
def quadratic_representation(self, other=None):
return self.trace_inner_product(self).sqrt()
-class CartesianProductParentEJAElement(FiniteDimensionalEJAElement):
+class CartesianProductParentEJAElement(EJAElement):
r"""
An intermediate class for elements that have a Cartesian
product as their parent algebra.
from sage.categories.all import FreeModules
from sage.categories.map import Map
-class FiniteDimensionalEJAOperator(Map):
+class EJAOperator(Map):
r"""
An operator between two finite-dimensional Euclidean Jordan algebras.
SETUP::
sage: from mjo.eja.eja_algebra import HadamardEJA
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
EXAMPLES:
sage: J = HadamardEJA(3)
sage: V = VectorSpace(J.base_ring(), 3)
sage: M = matrix.identity(J.base_ring(), 3)
- sage: FiniteDimensionalEJAOperator(V,J,M)
+ sage: EJAOperator(V,J,M)
Traceback (most recent call last):
...
TypeError: domain must be a finite-dimensional Euclidean
Jordan algebra
- sage: FiniteDimensionalEJAOperator(J,V,M)
+ sage: EJAOperator(J,V,M)
Traceback (most recent call last):
...
TypeError: codomain must be a finite-dimensional Euclidean
"""
def __init__(self, domain_eja, codomain_eja, mat):
- from mjo.eja.eja_algebra import FiniteDimensionalEJA
+ from mjo.eja.eja_algebra import EJA
# I guess we should check this, because otherwise you could
# pass in pretty much anything algebraish.
- if not isinstance(domain_eja, FiniteDimensionalEJA):
+ if not isinstance(domain_eja, EJA):
raise TypeError('domain must be a finite-dimensional '
'Euclidean Jordan algebra')
- if not isinstance(codomain_eja, FiniteDimensionalEJA):
+ if not isinstance(codomain_eja, EJA):
raise TypeError('codomain must be a finite-dimensional '
'Euclidean Jordan algebra')
SETUP::
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
sage: from mjo.eja.eja_algebra import JordanSpinEJA
EXAMPLES::
sage: J = JordanSpinEJA(3)
sage: x = J.linear_combination(zip(J.gens(),range(len(J.gens()))))
sage: id = identity_matrix(J.base_ring(), J.dimension())
- sage: f = FiniteDimensionalEJAOperator(J,J,id)
+ sage: f = EJAOperator(J,J,id)
sage: f(x) == x
True
SETUP::
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
sage: from mjo.eja.eja_algebra import (
....: JordanSpinEJA,
....: RealSymmetricEJA )
sage: J = RealSymmetricEJA(2)
sage: id = identity_matrix(J.base_ring(), J.dimension())
- sage: f = FiniteDimensionalEJAOperator(J,J,id)
- sage: g = FiniteDimensionalEJAOperator(J,J,id)
+ sage: f = EJAOperator(J,J,id)
+ sage: g = EJAOperator(J,J,id)
sage: f + g
Linear operator between finite-dimensional Euclidean Jordan
algebras represented by the matrix:
sage: id1 = identity_matrix(J1.base_ring(), 3)
sage: J2 = JordanSpinEJA(3)
sage: id2 = identity_matrix(J2.base_ring(), 3)
- sage: f = FiniteDimensionalEJAOperator(J1,J1,id1)
- sage: g = FiniteDimensionalEJAOperator(J2,J2,id2)
+ sage: f = EJAOperator(J1,J1,id1)
+ sage: g = EJAOperator(J2,J2,id2)
sage: f + g
Traceback (most recent call last):
...
TypeError: unsupported operand parent(s) for +: ...
"""
- return FiniteDimensionalEJAOperator(
+ return EJAOperator(
self.domain(),
self.codomain(),
self.matrix() + other.matrix())
SETUP::
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
sage: from mjo.eja.eja_algebra import (
....: JordanSpinEJA,
....: HadamardEJA,
sage: mat1 = matrix(AA, [[1,2,3],
....: [4,5,6]])
sage: mat2 = matrix(AA, [[7,8]])
- sage: g = FiniteDimensionalEJAOperator(J1, J2, mat1)
- sage: f = FiniteDimensionalEJAOperator(J2, J3, mat2)
+ sage: g = EJAOperator(J1, J2, mat1)
+ sage: f = EJAOperator(J2, J3, mat2)
sage: f*g
Linear operator between finite-dimensional Euclidean Jordan
algebras represented by the matrix:
Algebraic Real Field
"""
- return FiniteDimensionalEJAOperator(
+ return EJAOperator(
other.domain(),
self.codomain(),
self.matrix()*other.matrix())
SETUP::
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
sage: from mjo.eja.eja_algebra import RealSymmetricEJA
EXAMPLES::
sage: J = RealSymmetricEJA(2)
sage: id = identity_matrix(J.base_ring(), J.dimension())
- sage: f = FiniteDimensionalEJAOperator(J,J,id)
+ sage: f = EJAOperator(J,J,id)
sage: ~f
Linear operator between finite-dimensional Euclidean Jordan
algebras represented by the matrix:
Codomain: Euclidean Jordan algebra of dimension 3 over...
"""
- return FiniteDimensionalEJAOperator(
+ return EJAOperator(
self.codomain(),
self.domain(),
~self.matrix())
SETUP::
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
sage: from mjo.eja.eja_algebra import RealSymmetricEJA
EXAMPLES:
"""
try:
if other in self.codomain().base_ring():
- return FiniteDimensionalEJAOperator(
+ return EJAOperator(
self.domain(),
self.codomain(),
self.matrix()*other)
SETUP::
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
sage: from mjo.eja.eja_algebra import RealSymmetricEJA
EXAMPLES::
sage: J = RealSymmetricEJA(2)
sage: id = identity_matrix(J.base_ring(), J.dimension())
- sage: f = FiniteDimensionalEJAOperator(J,J,id)
+ sage: f = EJAOperator(J,J,id)
sage: -f
Linear operator between finite-dimensional Euclidean Jordan
algebras represented by the matrix:
Codomain: Euclidean Jordan algebra of dimension 3 over...
"""
- return FiniteDimensionalEJAOperator(
+ return EJAOperator(
self.domain(),
self.codomain(),
-self.matrix())
SETUP::
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
sage: from mjo.eja.eja_algebra import RealSymmetricEJA
TESTS:
sage: J = RealSymmetricEJA(2)
sage: id = identity_matrix(J.base_ring(), J.dimension())
- sage: f = FiniteDimensionalEJAOperator(J,J,id)
+ sage: f = EJAOperator(J,J,id)
sage: f^0 + f^1 + f^2
Linear operator between finite-dimensional Euclidean Jordan
algebras represented by the matrix:
else:
mat = self.matrix()**n
- return FiniteDimensionalEJAOperator(
+ return EJAOperator(
self.domain(),
self.codomain(),
mat)
SETUP::
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
sage: from mjo.eja.eja_algebra import JordanSpinEJA
EXAMPLES::
sage: J = JordanSpinEJA(2)
sage: id = identity_matrix(J.base_ring(), J.dimension())
- sage: FiniteDimensionalEJAOperator(J,J,id)
+ sage: EJAOperator(J,J,id)
Linear operator between finite-dimensional Euclidean Jordan
algebras represented by the matrix:
[1 0]
SETUP::
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
sage: from mjo.eja.eja_algebra import RealSymmetricEJA
EXAMPLES::
sage: J = RealSymmetricEJA(2)
sage: id = identity_matrix(J.base_ring(),J.dimension())
- sage: f = FiniteDimensionalEJAOperator(J,J,id)
+ sage: f = EJAOperator(J,J,id)
sage: f - (f*2)
Linear operator between finite-dimensional Euclidean Jordan
algebras represented by the matrix:
SETUP::
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
sage: from mjo.eja.eja_algebra import (random_eja,
....: JordanSpinEJA,
....: RealSymmetricEJA)
sage: M = matrix(R, [ [0, 0],
....: [0, 0],
....: [0, 0] ])
- sage: L = FiniteDimensionalEJAOperator(J1,J2,M)
+ sage: L = EJAOperator(J1,J2,M)
sage: L.is_zero()
True
sage: M = matrix(R, [ [0, 0],
....: [0, 1],
....: [0, 0] ])
- sage: L = FiniteDimensionalEJAOperator(J1,J2,M)
+ sage: L = EJAOperator(J1,J2,M)
sage: L.is_zero()
False
SETUP::
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
sage: from mjo.eja.eja_algebra import RealSymmetricEJA
EXAMPLES::
sage: J = RealSymmetricEJA(2)
sage: mat = matrix(J.base_ring(), J.dimension(), range(9))
- sage: f = FiniteDimensionalEJAOperator(J,J,mat)
+ sage: f = EJAOperator(J,J,mat)
sage: f.matrix()
[0 1 2]
[3 4 5]
SETUP::
- sage: from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ sage: from mjo.eja.eja_operator import EJAOperator
sage: from mjo.eja.eja_algebra import RealSymmetricEJA
EXAMPLES::
# for the spectral theorem to work.
us[i] = us[i]/us[i].norm()
mat = us[i].column()*us[i].row()
- Pi = FiniteDimensionalEJAOperator(
+ Pi = EJAOperator(
self.domain(),
self.codomain(),
mat)
from sage.matrix.constructor import matrix
from sage.misc.cachefunc import cached_method
-from mjo.eja.eja_algebra import FiniteDimensionalEJA
-from mjo.eja.eja_element import (FiniteDimensionalEJAElement,
+from mjo.eja.eja_algebra import EJA
+from mjo.eja.eja_element import (EJAElement,
CartesianProductParentEJAElement)
-class FiniteDimensionalEJASubalgebraElement(FiniteDimensionalEJAElement):
+class EJASubalgebraElement(EJAElement):
"""
SETUP::
-class FiniteDimensionalEJASubalgebra(FiniteDimensionalEJA):
+class EJASubalgebra(EJA):
"""
A subalgebra of an EJA with a given basis.
sage: from mjo.eja.eja_algebra import (ComplexHermitianEJA,
....: JordanSpinEJA,
....: RealSymmetricEJA)
- sage: from mjo.eja.eja_subalgebra import FiniteDimensionalEJASubalgebra
+ sage: from mjo.eja.eja_subalgebra import EJASubalgebra
EXAMPLES:
....: [0,0] ])
sage: E22 = matrix(AA, [ [0,0],
....: [0,1] ])
- sage: K1 = FiniteDimensionalEJASubalgebra(J, (J(E11),), associative=True)
+ sage: K1 = EJASubalgebra(J, (J(E11),), associative=True)
sage: K1.one().to_matrix()
[1 0]
[0 0]
- sage: K2 = FiniteDimensionalEJASubalgebra(J, (J(E22),), associative=True)
+ sage: K2 = EJASubalgebra(J, (J(E22),), associative=True)
sage: K2.one().to_matrix()
[0 0]
[0 1]
SETUP::
sage: from mjo.eja.eja_algebra import RealSymmetricEJA
- sage: from mjo.eja.eja_subalgebra import FiniteDimensionalEJASubalgebra
+ sage: from mjo.eja.eja_subalgebra import EJASubalgebra
EXAMPLES::
....: [1,0,0] ])
sage: x = J(X)
sage: basis = ( x, x^2 ) # x^2 is the identity matrix
- sage: K = FiniteDimensionalEJASubalgebra(J,
+ sage: K = EJASubalgebra(J,
....: basis,
....: associative=True,
....: orthonormalize=False)
True
"""
- from mjo.eja.eja_operator import FiniteDimensionalEJAOperator
+ from mjo.eja.eja_operator import EJAOperator
mm = self._module_morphism(lambda j: self.superalgebra()(self.monomial(j).to_matrix()),
codomain=self.superalgebra())
- return FiniteDimensionalEJAOperator(self,
+ return EJAOperator(self,
self.superalgebra(),
mm.matrix())
- Element = FiniteDimensionalEJASubalgebraElement
+ Element = EJASubalgebraElement
-class FiniteDimensionalCartesianProductEJASubalgebraElement(FiniteDimensionalEJASubalgebraElement, CartesianProductParentEJAElement):
+class CartesianProductEJASubalgebraElement(EJASubalgebraElement,
+ CartesianProductParentEJAElement):
r"""
The class for elements that both belong to a subalgebra and
have a Cartesian product algebra as their parent. By inheriting
:class:`CartesianProductParentEJAElement` in addition to
- :class:`FiniteDimensionalEJASubalgebraElement`, we allow the
+ :class:`EJASubalgebraElement`, we allow the
``to_matrix()`` method to be overridden with the version that
works on Cartesian products.
"""
pass
-class FiniteDimensionalCartesianProductEJASubalgebra(FiniteDimensionalEJASubalgebra):
+class CartesianProductEJASubalgebra(EJASubalgebra):
r"""
Subalgebras whose parents are Cartesian products. Exists only
to specify a special element class that will (in addition)
inherit from ``CartesianProductParentEJAElement``.
"""
- Element = FiniteDimensionalCartesianProductEJASubalgebraElement
+ Element = CartesianProductEJASubalgebraElement