@@ -166,7 +166,7 @@ cdef class LeanMatrix:
166166 cdef long i, j
167167 cdef LeanMatrix A = type (self )(self .nrows(), self .ncols() + self .nrows())
168168 for i in range (self .nrows()):
169- A.set_unsafe(i, i, self .base_ring()( 1 ))
169+ A.set_unsafe(i, i, self .base_ring().one( ))
170170 for j in range (self .ncols()):
171171 A.set_unsafe(i, self .nrows() + j, self .get_unsafe(i, j))
172172 return A
@@ -696,8 +696,8 @@ cdef class GenericMatrix(LeanMatrix):
696696 # Default:
697697 if self ._base_ring is None :
698698 self ._base_ring = ZZ
699- self ._zero = self ._base_ring( 0 )
700- self ._one = self ._base_ring( 1 )
699+ self ._zero = self ._base_ring.zero( )
700+ self ._one = self ._base_ring.one( )
701701 self ._entries = [self ._zero] * nrows * ncols
702702 if M is not None :
703703 if isinstance (M, GenericMatrix):
@@ -995,8 +995,8 @@ cdef class BinaryMatrix(LeanMatrix):
995995 global GF2, GF2_zero, GF2_one, GF2_not_defined
996996 if GF2_not_defined:
997997 GF2 = GF(2 )
998- GF2_zero = GF2( 0 )
999- GF2_one = GF2( 1 )
998+ GF2_zero = GF2.zero( )
999+ GF2_one = GF2.one( )
10001000 GF2_not_defined = False
10011001 if M is not None :
10021002 if isinstance (M, BinaryMatrix):
@@ -1433,7 +1433,7 @@ cdef class BinaryMatrix(LeanMatrix):
14331433 if s_eq.nrows() != o_eq.nrows():
14341434 return False
14351435 if s_eq.nrows() == s_eq.ncols(): # s_eq and o_eq partition into singletons
1436- morph = [0 for i in range (self ._nrows)]
1436+ morph = [0 for _ in range (self ._nrows)]
14371437 for i in range (self ._nrows):
14381438 morph[bitset_first(s_eq._M[i])] = bitset_first(o_eq._M[i])
14391439 for i in range (self ._nrows):
@@ -1580,8 +1580,8 @@ cdef class TernaryMatrix(LeanMatrix):
15801580 global GF3, GF3_zero, GF3_one, GF3_minus_one, GF3_not_defined
15811581 if GF3_not_defined:
15821582 GF3 = GF(3 )
1583- GF3_zero = GF3( 0 )
1584- GF3_one = GF3( 1 )
1583+ GF3_zero = GF3.zero( )
1584+ GF3_one = GF3.one( )
15851585 GF3_minus_one = GF3(2 )
15861586 GF3_not_defined = False
15871587
@@ -2170,37 +2170,37 @@ cdef class QuaternaryMatrix(LeanMatrix):
21702170 if M is not None :
21712171 if isinstance (M, QuaternaryMatrix):
21722172 self ._gf4 = (< QuaternaryMatrix> M)._gf4
2173- self ._zero = self ._gf4( 0 )
2174- self ._one = self ._gf4( 1 )
2173+ self ._zero = self ._gf4.zero( )
2174+ self ._one = self ._gf4.one( )
21752175 self ._x_zero = self ._gf4.gens()[0 ]
21762176 self ._x_one = self ._x_zero + self ._one
21772177 for i in range ((< QuaternaryMatrix> M)._nrows):
21782178 bitset_copy(self ._M0[i], (< QuaternaryMatrix> M)._M0[i])
21792179 bitset_copy(self ._M1[i], (< QuaternaryMatrix> M)._M1[i])
21802180 elif isinstance (M, LeanMatrix):
21812181 self ._gf4 = (< LeanMatrix> M).base_ring()
2182- self ._zero = self ._gf4( 0 )
2183- self ._one = self ._gf4( 1 )
2182+ self ._zero = self ._gf4.zero( )
2183+ self ._one = self ._gf4.one( )
21842184 self ._x_zero = self ._gf4.gens()[0 ]
21852185 self ._x_one = self ._x_zero + self ._one
21862186 for i in range (M.nrows()):
21872187 for j in range (M.ncols()):
21882188 self .set(i, j, (< LeanMatrix> M).get_unsafe(i, j))
21892189 elif isinstance (M, Matrix):
21902190 self ._gf4 = (< Matrix> M).base_ring()
2191- self ._zero = self ._gf4( 0 )
2192- self ._one = self ._gf4( 1 )
2191+ self ._zero = self ._gf4.zero( )
2192+ self ._one = self ._gf4.one( )
21932193 self ._x_zero = self ._gf4.gens()[0 ]
21942194 self ._x_one = self ._x_zero + self ._one
21952195 for i in range (M.nrows()):
21962196 for j in range (M.ncols()):
21972197 self .set(i, j, (< Matrix> M).get_unsafe(i, j))
21982198 else :
2199- raise TypeError (" unrecognized input type. " )
2199+ raise TypeError (" unrecognized input type" )
22002200 else :
22012201 self ._gf4 = ring
2202- self ._zero = self ._gf4( 0 )
2203- self ._one = self ._gf4( 1 )
2202+ self ._zero = self ._gf4.zero( )
2203+ self ._one = self ._gf4.one( )
22042204 self ._x_zero = self ._gf4.gens()[0 ]
22052205 self ._x_one = self ._x_zero + self ._one
22062206
0 commit comments