99  Jordan algebra 
1010""" 
1111
12- #** *************************************************************************** 
12+ #  *************************************************************************** 
1313#  Copyright (C) 2014, 2023 Travis Scrimshaw <tscrim at ucdavis.edu> 
1414# 
1515#  Distributed under the terms of the GNU General Public License (GPL) 
1616#                  https://www.gnu.org/licenses/ 
17- #** *************************************************************************** 
17+ #  *************************************************************************** 
1818
1919from  sage .structure .parent  import  Parent 
2020from  sage .structure .unique_representation  import  UniqueRepresentation 
@@ -209,7 +209,7 @@ def __classcall_private__(self, arg0, arg1=None, names=None):
209209        if  not  arg1 .is_symmetric ():
210210            raise  ValueError ("the bilinear form is not symmetric" )
211211
212-         arg1  =  arg1 .change_ring (arg0 ) # This makes a copy 
212+         arg1  =  arg1 .change_ring (arg0 )   # This makes a copy 
213213        arg1 .set_immutable ()
214214        return  JordanAlgebraSymmetricBilinear (arg0 , arg1 , names = names )
215215
@@ -311,7 +311,7 @@ def _an_element_(self):
311311        return  self .element_class (self , self ._A .an_element ())
312312
313313    @cached_method  
314-     def  basis (self ):
314+     def  basis (self )  ->   Family :
315315        """ 
316316        Return the basis of ``self``. 
317317
@@ -323,12 +323,13 @@ def basis(self):
323323            Lazy family (Term map(i))_{i in Free monoid on 3 generators (x, y, z)} 
324324        """ 
325325        B  =  self ._A .basis ()
326-         return  Family (B .keys (), lambda  x : self .element_class (self , B [x ]), name = "Term map" )
326+         return  Family (B .keys (),
327+                       lambda  x : self .element_class (self , B [x ]), name = "Term map" )
327328
328329    algebra_generators  =  basis 
329330
330331    # TODO: Keep this until we can better handle R.<...> shorthand 
331-     def  gens (self ) ->  tuple :
332+     def  gens (self ) ->  Family :
332333        """ 
333334        Return the generators of ``self``. 
334335
@@ -338,16 +339,14 @@ def gens(self) -> tuple:
338339            sage: C = CombinatorialFreeModule(QQ, ['x','y','z'], category=cat) 
339340            sage: J = JordanAlgebra(C) 
340341            sage: J.gens() 
341-             ( B['x'], B['y'], B['z'])  
342+             Finite family {'x':  B['x'], 'y':  B['y'], 'z':  B['z']}  
342343
343344            sage: F.<x,y,z> = FreeAlgebra(QQ) 
344345            sage: J = JordanAlgebra(F) 
345346            sage: J.gens() 
346-             Traceback (most recent call last): 
347-             ... 
348-             NotImplementedError: infinite set 
347+             Lazy family (Term map(i))_{i in Free monoid on 3 generators (x, y, z)} 
349348        """ 
350-         return  tuple ( self .algebra_generators () )
349+         return  self .algebra_generators ()
351350
352351    @cached_method  
353352    def  zero (self ):
@@ -741,7 +740,7 @@ def _coerce_map_from_base_ring(self):
741740        return  self ._generic_coerce_map (self .base_ring ())
742741
743742    @cached_method  
744-     def  basis (self ):
743+     def  basis (self )  ->   Family :
745744        """ 
746745        Return a basis of ``self``. 
747746
@@ -763,7 +762,7 @@ def basis(self):
763762
764763    algebra_generators  =  basis 
765764
766-     def  gens (self ) ->  tuple :
765+     def  gens (self ) ->  Family :
767766        """ 
768767        Return the generators of ``self``. 
769768
@@ -772,9 +771,9 @@ def gens(self) -> tuple:
772771            sage: m = matrix([[0,1],[1,1]]) 
773772            sage: J = JordanAlgebra(m) 
774773            sage: J.gens() 
775-             (1 + (0, 0), 0 + (1, 0), 0 + (0, 1)) 
774+             Family  (1 + (0, 0), 0 + (1, 0), 0 + (0, 1)) 
776775        """ 
777-         return  tuple ( self .algebra_generators () )
776+         return  self .algebra_generators ()
778777
779778    @cached_method  
780779    def  zero (self ):
@@ -974,7 +973,7 @@ def _mul_(self, other):
974973            P  =  self .parent ()
975974            return  self .__class__ (P ,
976975                                  self ._s  *  other ._s 
977-                                     +  (self ._v  *  P ._form  *  other ._v .column ())[0 ],
976+                                   +  (self ._v  *  P ._form  *  other ._v .column ())[0 ],
978977                                  other ._s  *  self ._v  +  self ._s  *  other ._v )
979978
980979        def  _lmul_ (self , other ):
@@ -1023,8 +1022,8 @@ def monomial_coefficients(self, copy=True):
10231022                {0: 1, 1: 2, 2: -1} 
10241023            """ 
10251024            d  =  {0 : self ._s }
1026-             for  i ,c  in  enumerate (self ._v ):
1027-                 d [i + 1 ] =  c 
1025+             for  i ,  c  in  enumerate (self ._v ):
1026+                 d [i   +   1 ] =  c 
10281027            return  d 
10291028
10301029        def  trace (self ):
@@ -1258,8 +1257,8 @@ def _test_multiplication_self_adjoint(self, **options):
12581257                 [SD [3 ].conjugate (), SD [1 ], SD [5 ]],
12591258                 [SD [4 ].conjugate (), SD [5 ].conjugate (), SD [2 ]]]
12601259            Y  =  [[OD [0 ], OD [3 ], OD [4 ]],
1261-                    [OD [3 ].conjugate (), OD [1 ], OD [5 ]],
1262-                    [OD [4 ].conjugate (), OD [5 ].conjugate (), OD [2 ]]]
1260+                  [OD [3 ].conjugate (), OD [1 ], OD [5 ]],
1261+                  [OD [4 ].conjugate (), OD [5 ].conjugate (), OD [2 ]]]
12631262            for  r , c  in  data_pairs :
12641263                if  r  !=  c :
12651264                    val  =  sum (X [r ][i ] *  Y [i ][c ] +  Y [r ][i ] *  X [i ][c ] for  i  in  range (3 )) *  self ._half 
@@ -1270,7 +1269,7 @@ def _test_multiplication_self_adjoint(self, **options):
12701269                    tester .assertEqual (val .imag_part (), zerO )
12711270
12721271    @cached_method  
1273-     def  basis (self ):
1272+     def  basis (self )  ->   Family :
12741273        r""" 
12751274        Return a basis of ``self``. 
12761275
@@ -1315,7 +1314,7 @@ def basis(self):
13151314
13161315    algebra_generators  =  basis 
13171316
1318-     def  gens (self ) ->  tuple :
1317+     def  gens (self ) ->  Family :
13191318        """ 
13201319        Return the generators of ``self``. 
13211320
@@ -1337,7 +1336,7 @@ def gens(self) -> tuple:
13371336            [ 0  0  k] 
13381337            [ 0 -k  0] 
13391338        """ 
1340-         return  tuple ( self .algebra_generators () )
1339+         return  self .basis ( )
13411340
13421341    @cached_method  
13431342    def  zero (self ):
@@ -1684,8 +1683,8 @@ def _mul_(self, other):
16841683                 [SD [3 ].conjugate (), SD [1 ], SD [5 ]],
16851684                 [SD [4 ].conjugate (), SD [5 ].conjugate (), SD [2 ]]]
16861685            Y  =  [[OD [0 ], OD [3 ], OD [4 ]],
1687-                    [OD [3 ].conjugate (), OD [1 ], OD [5 ]],
1688-                    [OD [4 ].conjugate (), OD [5 ].conjugate (), OD [2 ]]]
1686+                  [OD [3 ].conjugate (), OD [1 ], OD [5 ]],
1687+                  [OD [4 ].conjugate (), OD [5 ].conjugate (), OD [2 ]]]
16891688            # we do a simplified multiplication for the diagonal entries since 
16901689            # we have, e.g., \alpha * \alpha' + (x (x')^* + x' x^* + y (y')^* + y' y^*) / 2 
16911690            ret  =  [X [0 ][0 ] *  Y [0 ][0 ] +  (X [0 ][1 ] *  Y [1 ][0 ]).real_part () +  (X [0 ][2 ] *  Y [2 ][0 ]).real_part (),
0 commit comments