]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: split "check" args into check_field and check_axioms.
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 10 Nov 2020 01:59:33 +0000 (20:59 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 10 Nov 2020 01:59:33 +0000 (20:59 -0500)
mjo/eja/TODO
mjo/eja/eja_algebra.py
mjo/eja/eja_element_subalgebra.py
mjo/eja/eja_subalgebra.py

index 0c3bd156662e20247bdc2206a304e4acadf55ec2..e8a2a8d4fc8988b1ad6f744a69daba9cf0582397 100644 (file)
@@ -1,15 +1,13 @@
 1. Add CartesianProductEJA.
 
-2. Check the axioms in the constructor when check != False?
+2. Add references and start citing them.
 
-3. Add references and start citing them.
+3. Implement the octonion simple EJA.
 
-4. Implement the octonion simple EJA.
-
-5. Factor out the unit-norm basis (and operator symmetry) tests once
+4. Factor out the unit-norm basis (and operator symmetry) tests once
    all of the algebras pass.
 
-6. Override inner_product(), _max_test_case_size(), et cetera in
+5. Override inner_product(), _max_test_case_size(), et cetera in
    DirectSumEJA.
 
-7. Switch to QQ in *all* algebras for _charpoly_coefficients().
+6. Switch to QQ in *all* algebras for _charpoly_coefficients().
index 4bef201cd2d0bbda251dbfd347cd9006185d82a5..26fe1929be872b393fe41926eeda801dbd0a9436 100644 (file)
@@ -57,7 +57,8 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
                  prefix='e',
                  category=None,
                  natural_basis=None,
-                 check=True):
+                 check_field=True,
+                 check_axioms=True):
         """
         SETUP::
 
@@ -78,14 +79,14 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
 
         TESTS:
 
-        The ``field`` we're given must be real with ``check=True``::
+        The ``field`` we're given must be real with ``check_field=True``::
 
             sage: JordanSpinEJA(2,QQbar)
             Traceback (most recent call last):
             ...
-            ValueError: field is not real
+            ValueError: scalar field is not real
 
-        The multiplication table must be square with ``check=True``::
+        The multiplication table must be square with ``check_axioms=True``::
 
             sage: FiniteDimensionalEuclideanJordanAlgebra(QQ,((),()))
             Traceback (most recent call last):
@@ -93,12 +94,18 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
             ValueError: multiplication table is not square
 
         """
-        if check:
+        if check_field:
             if not field.is_subring(RR):
                 # Note: this does return true for the real algebraic
-                # field, and any quadratic field where we've specified
-                # a real embedding.
-                raise ValueError('field is not real')
+                # field, the rationals, and any quadratic field where
+                # we've specified a real embedding.
+                raise ValueError("scalar field is not real")
+
+        # The multiplication table had better be square
+        n = len(mult_table)
+        if check_axioms:
+            if not all( len(l) == n for l in mult_table ):
+                raise ValueError("multiplication table is not square")
 
         self._natural_basis = natural_basis
 
@@ -106,12 +113,6 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
             category = MagmaticAlgebras(field).FiniteDimensional()
             category = category.WithBasis().Unital()
 
-        # The multiplication table had better be square
-        n = len(mult_table)
-        if check:
-            if not all( len(l) == n for l in mult_table ):
-                raise ValueError("multiplication table is not square")
-
         fda = super(FiniteDimensionalEuclideanJordanAlgebra, self)
         fda.__init__(field,
                      range(n),
@@ -130,7 +131,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
             for ls in mult_table
         ]
 
-        if check:
+        if check_axioms:
             if not self._is_commutative():
                 raise ValueError("algebra is not commutative")
             if not self._is_jordanian():
@@ -263,8 +264,8 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
         Whether or not this algebra's multiplication table is commutative.
 
         This method should of course always return ``True``, unless
-        this algebra was constructed with ``check=False`` and passed
-        an invalid multiplication table.
+        this algebra was constructed with ``check_axioms=False`` and
+        passed an invalid multiplication table.
         """
         return all( self.product_on_basis(i,j) == self.product_on_basis(i,j)
                     for i in range(self.dimension())
@@ -279,7 +280,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
         ``True`` result to be truly true, you should also check
         :meth:`_is_commutative`. This method should of course always
         return ``True``, unless this algebra was constructed with
-        ``check=False`` and passed an invalid multiplication table.
+        ``check_axioms=False`` and passed an invalid multiplication table.
         """
         return all( (self.monomial(i)**2)*(self.monomial(i)*self.monomial(j))
                     ==
@@ -293,13 +294,13 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
         associative; that is, whether or not `B(xy,z) = B(x,yz)`.
 
         This method should of course always return ``True``, unless
-        this algebra was constructed with ``check=False`` and passed
-        an invalid multiplication table.
+        this algebra was constructed with ``check_axioms=False`` and
+        passed an invalid multiplication table.
         """
 
         # Used to check whether or not something is zero in an inexact
         # ring. This number is sufficient to allow the construction of
-        # QuaternionHermitianEJA(2, RDF) with check=True.
+        # QuaternionHermitianEJA(2, RDF) with check_axioms=True.
         epsilon = 1e-16
 
         for i in range(self.dimension()):
@@ -747,7 +748,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
                 gens = tuple( self.from_vector(b) for b in eigspace.basis() )
                 subalg = FiniteDimensionalEuclideanJordanSubalgebra(self,
                                                                     gens,
-                                                                    check=False)
+                                                                    check_axioms=False)
                 if eigval == 0:
                     J0 = subalg
                 elif eigval == 1:
@@ -1053,7 +1054,7 @@ class HadamardEJA(FiniteDimensionalEuclideanJordanAlgebra):
 
         super(HadamardEJA, self).__init__(field,
                                           mult_table,
-                                          check=False,
+                                          check_axioms=False,
                                           **kwargs)
         self.rank.set_cache(n)
 
@@ -1165,13 +1166,14 @@ class MatrixEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebra):
 
             # Do this over the rationals and convert back at the end.
             # Only works because we know the entries of the basis are
-            # integers. The argument ``check=False`` is required
+            # integers. The argument ``check_axioms=False`` is required
             # because the trace inner-product method for this
             # class is a stub and can't actually be checked.
             J = MatrixEuclideanJordanAlgebra(QQ,
                                              basis,
                                              normalize_basis=False,
-                                             check=False)
+                                             check_field=False,
+                                             check_axioms=False)
             a = J._charpoly_coefficients()
 
             # Unfortunately, changing the basis does change the
@@ -1411,7 +1413,7 @@ class RealSymmetricEJA(RealMatrixEuclideanJordanAlgebra):
         basis = self._denormalized_basis(n, field)
         super(RealSymmetricEJA, self).__init__(field,
                                                basis,
-                                               check=False,
+                                               check_axioms=False,
                                                **kwargs)
         self.rank.set_cache(n)
 
@@ -1710,7 +1712,7 @@ class ComplexHermitianEJA(ComplexMatrixEuclideanJordanAlgebra):
         basis = self._denormalized_basis(n,field)
         super(ComplexHermitianEJA,self).__init__(field,
                                                  basis,
-                                                 check=False,
+                                                 check_axioms=False,
                                                  **kwargs)
         self.rank.set_cache(n)
 
@@ -2014,7 +2016,7 @@ class QuaternionHermitianEJA(QuaternionMatrixEuclideanJordanAlgebra):
         basis = self._denormalized_basis(n,field)
         super(QuaternionHermitianEJA,self).__init__(field,
                                                     basis,
-                                                    check=False,
+                                                    check_axioms=False,
                                                     **kwargs)
         self.rank.set_cache(n)
 
@@ -2100,7 +2102,7 @@ class BilinearFormEJA(FiniteDimensionalEuclideanJordanAlgebra):
         # by the ambient dimension).
         super(BilinearFormEJA, self).__init__(field,
                                               mult_table,
-                                              check=False,
+                                              check_axioms=False,
                                               **kwargs)
         self.rank.set_cache(min(n,2))
 
@@ -2229,7 +2231,7 @@ class TrivialEJA(FiniteDimensionalEuclideanJordanAlgebra):
         mult_table = []
         super(TrivialEJA, self).__init__(field,
                                          mult_table,
-                                         check=False,
+                                         check_axioms=False,
                                          **kwargs)
         # The rank is zero using my definition, namely the dimension of the
         # largest subalgebra generated by any element.
@@ -2280,6 +2282,6 @@ class DirectSumEJA(FiniteDimensionalEuclideanJordanAlgebra):
 
         super(DirectSumEJA, self).__init__(field,
                                            mult_table,
-                                           check=False,
+                                           check_axioms=False,
                                            **kwargs)
         self.rank.set_cache(J1.rank() + J2.rank())
index a4d7d1f3de4c43347b43451be15cc38b5e1c9556..b9069c484d16b57b4154774d5a288350adf1b64e 100644 (file)
@@ -53,7 +53,7 @@ class FiniteDimensionalEuclideanJordanElementSubalgebra(FiniteDimensionalEuclide
         fdeja.__init__(self._superalgebra,
                        superalgebra_basis,
                        category=category,
-                       check=False)
+                       check_axioms=False)
 
         # The rank is the highest possible degree of a minimal
         # polynomial, and is bounded above by the dimension. We know
index d7bcf2c3a59638ef8a4176a7ae0dba2a422e6af2..8f003739ac8e520d3fc43df567c24fbb46c316b6 100644 (file)
@@ -130,7 +130,7 @@ class FiniteDimensionalEuclideanJordanSubalgebra(FiniteDimensionalEuclideanJorda
         1
 
     """
-    def __init__(self, superalgebra, basis, category=None, check=True):
+    def __init__(self, superalgebra, basis, category=None, check_axioms=True):
         self._superalgebra = superalgebra
         V = self._superalgebra.vector_space()
         field = self._superalgebra.base_ring()
@@ -180,7 +180,8 @@ class FiniteDimensionalEuclideanJordanSubalgebra(FiniteDimensionalEuclideanJorda
                        prefix=prefix,
                        category=category,
                        natural_basis=natural_basis,
-                       check=check)
+                       check_field=False,
+                       check_axioms=check_axioms)