]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: pass keyword arguments through simple EJA constructors.
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 7 Aug 2019 19:04:20 +0000 (15:04 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 7 Aug 2019 19:04:20 +0000 (15:04 -0400)
mjo/eja/eja_algebra.py

index 3855f0ef41e0e95efcadb359d6c7b908960a13b2..580c923c37a7c00ed492272161eec70ced95c2de 100644 (file)
@@ -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)