]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: propagate check_axioms to some other "check" variables.
authorMichael Orlitzky <michael@orlitzky.com>
Thu, 3 Dec 2020 02:38:54 +0000 (21:38 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 3 Dec 2020 02:38:54 +0000 (21:38 -0500)
mjo/eja/DESIGN
mjo/eja/eja_algebra.py
mjo/eja/eja_subalgebra.py

index 4e34946cb96fea452599ebe844da7895f9e98010..248af84883c27d9e9fa9a4f6e9502b535126d313 100644 (file)
@@ -31,20 +31,3 @@ need to know how to undo the process. If we run Gram-Schmidt on the
 basis matrix ourselves, then we can save the matrix that undoes the
 process. And by undoing the process, we can get to a basis where
 computations are fast again.
-
-Question: what's the best way to construct these algebras? We'll
-usually know,
-
-  * the multiplication function
-  * the inner-product function
-  * a basis in either vector or matrix format
-
-and want:
-
-  * an orthonormalized copy of the basis, in long-vector format
-  * the reverse gram-schmidt matrix that deorthonormalizes that
-    long-vector basis
-  * a multiplication matrix (for speed) w.r.t. the orthonormal basis
-  * an inner-product matrix (for speed) w.r.t. the orthonormal basis
-  * a way to turn those two matrices into multiplication and inner-
-    product matrices for the deorthonormalized basis.
index e9f971f42164b2fc960b82724aa1cf29466c29d9..56d91bdef13bd76dc7e48f8f1237b02c18ef59a3 100644 (file)
@@ -119,10 +119,12 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
 
         The ``field`` we're given must be real with ``check_field=True``::
 
-            sage: JordanSpinEJA(2,QQbar)
+            sage: JordanSpinEJA(2, QQbar)
             Traceback (most recent call last):
             ...
             ValueError: scalar field is not real
+            sage: JordanSpinEJA(2, QQbar, check_field=False)
+            Euclidean Jordan algebra of dimension 2 over Algebraic Field
 
         The multiplication table must be square with ``check_axioms=True``::
 
@@ -313,8 +315,12 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule):
         # element's ring because the basis space might be an algebraic
         # closure whereas the base ring of the 3-by-3 identity matrix
         # could be QQ instead of QQbar.
+        #
+        # We pass check=False because the matrix basis is "guaranteed"
+        # to be linearly independent... right? Ha ha.
         V = VectorSpace(self.base_ring(), elt.nrows()*elt.ncols())
-        W = V.span_of_basis( _mat2vec(s) for s in self.matrix_basis() )
+        W = V.span_of_basis( (_mat2vec(s) for s in self.matrix_basis()),
+                             check=False)
 
         try:
             coords =  W.coordinate_vector(_mat2vec(elt))
@@ -1220,8 +1226,9 @@ class RationalBasisEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebr
                                           check_axioms=False)
 
             # Compute the deorthonormalized tables before we orthonormalize
-            # the given basis.
-            W = V.span_of_basis( vector_basis )
+            # the given basis. The "check" parameter here guarantees that
+            # the basis is linearly-independent.
+            W = V.span_of_basis( vector_basis, check=check_axioms)
 
             # Note: the Jordan and inner-products are defined in terms
             # of the ambient basis. It's important that their arguments
@@ -1257,22 +1264,20 @@ class RationalBasisEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebr
             else:
                 vector_basis = gram_schmidt(vector_basis, inner_product)
 
-            W = V.span_of_basis( vector_basis )
-
             # Normalize the "matrix" basis, too!
             basis = vector_basis
 
             if basis_is_matrices:
                 basis = tuple( map(_vec2mat,basis) )
 
-        W = V.span_of_basis( vector_basis )
+        W = V.span_of_basis( vector_basis, check=check_axioms)
 
         # Now "W" is the vector space of our algebra coordinates. The
         # variables "X1", "X2",...  refer to the entries of vectors in
         # W. Thus to convert back and forth between the orthonormal
         # coordinates and the given ones, we need to stick the original
         # basis in W.
-        U = V.span_of_basis( deortho_vector_basis )
+        U = V.span_of_basis( deortho_vector_basis, check=check_axioms)
         self._deortho_matrix = matrix( U.coordinate_vector(q)
                                        for q in vector_basis )
 
@@ -2275,14 +2280,15 @@ class HadamardEJA(ConcreteEuclideanJordanAlgebra):
         def inner_product(x,y):
             return x.inner_product(y)
 
-        # Don't orthonormalize because our basis is already orthonormal
-        # with respect to our inner-product.
+        # Don't orthonormalize because our basis is already
+        # orthonormal with respect to our inner-product. But also
+        # don't pass check_field=False here, because the user can pass
+        # in a field!
         super(HadamardEJA, self).__init__(field,
                                           basis,
                                           jordan_product,
                                           inner_product,
                                           orthonormalize=False,
-                                          check_field=False,
                                           check_axioms=False,
                                           **kwargs)
         self.rank.set_cache(n)
@@ -2512,11 +2518,12 @@ class JordanSpinEJA(BilinearFormEJA):
         B = matrix.identity(field, n)
 
         # Don't orthonormalize because our basis is already
-        # orthonormal with respect to our inner-product.
+        # orthonormal with respect to our inner-product. But
+        # also don't pass check_field=False here, because the
+        # user can pass in a field!
         super(JordanSpinEJA, self).__init__(B,
                                             field,
                                             orthonormalize=False,
-                                            check_field=False,
                                             check_axioms=False,
                                             **kwargs)
 
index fb0f26cceaca91c1a2d7328abb26c0003dcebcee..8c0f9092f040e659b5e550cfa90d4f27f4487ad4 100644 (file)
@@ -173,7 +173,8 @@ class FiniteDimensionalEuclideanJordanSubalgebra(FiniteDimensionalEuclideanJorda
         # If our superalgebra is a subalgebra of something else, then
         # these vectors won't have the right coordinates for
         # V.span_of_basis() unless we use V.from_vector() on them.
-        W = V.span_of_basis( V.from_vector(b.to_vector()) for b in basis )
+        W = V.span_of_basis( (V.from_vector(b.to_vector()) for b in basis),
+                             check=check_axioms)
 
         n = len(basis)
         if check_axioms: