From ce4c7e206125cd399239698d26f951a4aac073f2 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 7 Aug 2019 15:04:20 -0400 Subject: [PATCH] eja: pass keyword arguments through simple EJA constructors. --- mjo/eja/eja_algebra.py | 50 +++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 3855f0e..580c923 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -659,14 +659,21 @@ class RealCartesianProductEJA(FiniteDimensionalEuclideanJordanAlgebra): sage: e2*e2 e2 + TESTS: + + We can change the generator prefix:: + + sage: RealCartesianProductEJA(3, prefix='r').gens() + (r0, r1, r2) + """ - def __init__(self, n, field=QQ): + def __init__(self, n, field=QQ, **kwargs): V = VectorSpace(field, n) mult_table = [ [ V.gen(i)*(i == j) for j in range(n) ] for i in range(n) ] fdeja = super(RealCartesianProductEJA, self) - return fdeja.__init__(field, mult_table, rank=n) + return fdeja.__init__(field, mult_table, rank=n, **kwargs) def inner_product(self, x, y): return _usual_ip(x,y) @@ -1145,8 +1152,13 @@ class RealSymmetricEJA(FiniteDimensionalEuclideanJordanAlgebra): sage: J(expected) == x*y True + We can change the generator prefix:: + + sage: RealSymmetricEJA(3, prefix='q').gens() + (q0, q1, q2, q3, q4, q5) + """ - def __init__(self, n, field=QQ): + def __init__(self, n, field=QQ, **kwargs): S = _real_symmetric_basis(n, field=field) Qs = _multiplication_table_from_matrix_basis(S) @@ -1154,7 +1166,8 @@ class RealSymmetricEJA(FiniteDimensionalEuclideanJordanAlgebra): return fdeja.__init__(field, Qs, rank=n, - natural_basis=S) + natural_basis=S, + **kwargs) def inner_product(self, x, y): return _matrix_ip(x,y) @@ -1197,8 +1210,13 @@ class ComplexHermitianEJA(FiniteDimensionalEuclideanJordanAlgebra): sage: J(expected) == x*y True + We can change the generator prefix:: + + sage: ComplexHermitianEJA(2, prefix='z').gens() + (z0, z1, z2, z3) + """ - def __init__(self, n, field=QQ): + def __init__(self, n, field=QQ, **kwargs): S = _complex_hermitian_basis(n) Qs = _multiplication_table_from_matrix_basis(S) @@ -1206,7 +1224,8 @@ class ComplexHermitianEJA(FiniteDimensionalEuclideanJordanAlgebra): return fdeja.__init__(field, Qs, rank=n, - natural_basis=S) + natural_basis=S, + **kwargs) def inner_product(self, x, y): @@ -1257,8 +1276,13 @@ class QuaternionHermitianEJA(FiniteDimensionalEuclideanJordanAlgebra): sage: J(expected) == x*y True + We can change the generator prefix:: + + sage: QuaternionHermitianEJA(2, prefix='a').gens() + (a0, a1, a2, a3, a4, a5) + """ - def __init__(self, n, field=QQ): + def __init__(self, n, field=QQ, **kwargs): S = _quaternion_hermitian_basis(n) Qs = _multiplication_table_from_matrix_basis(S) @@ -1266,7 +1290,8 @@ class QuaternionHermitianEJA(FiniteDimensionalEuclideanJordanAlgebra): return fdeja.__init__(field, Qs, rank=n, - natural_basis=S) + natural_basis=S, + **kwargs) def inner_product(self, x, y): # Since a+bi+cj+dk on the diagonal is represented as @@ -1313,8 +1338,13 @@ class JordanSpinEJA(FiniteDimensionalEuclideanJordanAlgebra): sage: e2*e3 0 + We can change the generator prefix:: + + sage: JordanSpinEJA(2, prefix='B').gens() + (B0, B1) + """ - def __init__(self, n, field=QQ): + def __init__(self, n, field=QQ, **kwargs): V = VectorSpace(field, n) mult_table = [[V.zero() for j in range(n)] for i in range(n)] for i in range(n): @@ -1335,7 +1365,7 @@ class JordanSpinEJA(FiniteDimensionalEuclideanJordanAlgebra): # one-dimensional ambient space (because the rank is bounded by # the ambient dimension). fdeja = super(JordanSpinEJA, self) - return fdeja.__init__(field, mult_table, rank=min(n,2)) + return fdeja.__init__(field, mult_table, rank=min(n,2), **kwargs) def inner_product(self, x, y): return _usual_ip(x,y) -- 2.44.2