2
2
r"""
3
3
Genus
4
4
5
-
6
5
AUTHORS:
7
6
8
7
- David Kohel & Gabriele Nebe (2007): First created
20
19
# https://www.gnu.org/licenses/
21
20
# ****************************************************************************
22
21
22
+ from copy import copy , deepcopy
23
+
23
24
from sage .misc .lazy_import import lazy_import
24
25
from sage .misc .misc_c import prod
25
26
from sage .misc .cachefunc import cached_method
26
27
from sage .arith .functions import lcm as LCM
27
28
from sage .arith .misc import fundamental_discriminant
28
29
from sage .matrix .matrix_space import MatrixSpace
29
30
from sage .matrix .constructor import matrix
30
- from sage .rings .integer_ring import IntegerRing , ZZ
31
- from sage .rings .rational_field import RationalField , QQ
31
+ from sage .rings .integer_ring import ZZ
32
+ from sage .rings .rational_field import QQ
32
33
from sage .rings .integer import Integer
33
- from copy import copy , deepcopy
34
34
from sage .misc .verbose import verbose
35
35
from sage .quadratic_forms .special_values import quadratic_L_function__exact
36
36
lazy_import ('sage.quadratic_forms.genera.normal_form' , '_min_nonsquare' )
@@ -81,7 +81,6 @@ def genera(sig_pair, determinant, max_scale=None, even=False):
81
81
"""
82
82
from sage .misc .mrange import mrange_iter
83
83
# input checks
84
- ZZ = IntegerRing ()
85
84
determinant = ZZ (determinant )
86
85
sig_pair = (ZZ (sig_pair [0 ]), ZZ (sig_pair [1 ]))
87
86
even = bool (even )
@@ -440,7 +439,7 @@ def is_GlobalGenus(G):
440
439
sym = loc ._symbol
441
440
v = sum ([ss [0 ] * ss [1 ] for ss in sym ])
442
441
a = D // (p ** v )
443
- b = Integer ( prod ([ ss [2 ] for ss in sym ]) )
442
+ b = ZZ . prod (ss [2 ] for ss in sym )
444
443
if p == 2 :
445
444
if not is_2_adic_genus (sym ):
446
445
verbose (mesg = "False in is_2_adic_genus(sym)" , level = 2 )
@@ -906,10 +905,10 @@ def p_adic_symbol(A, p, val):
906
905
907
906
from sage .rings .finite_rings .finite_field_constructor import FiniteField
908
907
909
- m0 = min ([ c .valuation (p ) for c in A .list () ] )
908
+ m0 = min (c .valuation (p ) for c in A .list ())
910
909
q = p ** m0
911
910
n = A .nrows ()
912
- A = MatrixSpace (IntegerRing () , n , n )([ c // q for c in A .list () ])
911
+ A = MatrixSpace (ZZ , n , n )([ c // q for c in A .list () ])
913
912
A_p = MatrixSpace (FiniteField (p ), n , n )(A )
914
913
B_p = A_p .kernel ().echelonized_basis_matrix ()
915
914
if B_p .nrows () == 0 :
@@ -922,16 +921,16 @@ def p_adic_symbol(A, p, val):
922
921
n0 = C_p .nrows ()
923
922
sym = [ [0 , n0 , e0 ] ]
924
923
r = B_p .nrows ()
925
- B = MatrixSpace (IntegerRing () , r , n )(B_p )
926
- C = MatrixSpace (IntegerRing () , n - r , n )(C_p )
924
+ B = MatrixSpace (ZZ , r , n )(B_p )
925
+ C = MatrixSpace (ZZ , n - r , n )(C_p )
927
926
# Construct the blocks for the Jordan decomposition [F,X;X,A_new]
928
- F = MatrixSpace (RationalField () , n - r , n - r )(C * A * C .transpose ())
927
+ F = MatrixSpace (QQ , n - r , n - r )(C * A * C .transpose ())
929
928
U = F ** - 1
930
929
d = LCM ([ c .denominator () for c in U .list () ])
931
- R = IntegerRing () .quotient_ring (Integer (p )** (val + 3 ))
930
+ R = ZZ .quotient_ring (Integer (p )** (val + 3 ))
932
931
u = R (d )** - 1
933
932
MatR = MatrixSpace (R , n - r , n - r )
934
- MatZ = MatrixSpace (IntegerRing () , n - r , n - r )
933
+ MatZ = MatrixSpace (ZZ , n - r , n - r )
935
934
U = MatZ (MatR (MatZ (U * d )) * u )
936
935
# X = C*A*B.transpose()
937
936
# A = B*A*B.transpose() - X.transpose()*U*X
@@ -1017,7 +1016,7 @@ def split_odd(A):
1017
1016
"""
1018
1017
n0 = A .nrows ()
1019
1018
if n0 == 1 :
1020
- return A [0 , 0 ], MatrixSpace (IntegerRing () , 0 , A .ncols ())([])
1019
+ return A [0 , 0 ], MatrixSpace (ZZ , 0 , A .ncols ())([])
1021
1020
even , i = is_even_matrix (A )
1022
1021
R = A .parent ().base_ring ()
1023
1022
C = MatrixSpace (R , n0 - 1 , n0 )(0 )
@@ -1098,7 +1097,7 @@ def trace_diag_mod_8(A):
1098
1097
while A .nrows ():
1099
1098
u , A = split_odd (A )
1100
1099
tr += u
1101
- return IntegerRing () (tr )
1100
+ return ZZ (tr )
1102
1101
1103
1102
1104
1103
def two_adic_symbol (A , val ):
@@ -1141,7 +1140,6 @@ def two_adic_symbol(A, val):
1141
1140
m0 = min ([ c .valuation (2 ) for c in A .list () ])
1142
1141
q = 2 ** m0
1143
1142
A = A .parent ()([ c // q for c in A .list () ])
1144
- ZZ = IntegerRing ()
1145
1143
A_2 = MatrixSpace (FiniteField (2 ), n , n )(A )
1146
1144
K_2 = A_2 .kernel ()
1147
1145
R_8 = ZZ .quotient_ring (Integer (8 ))
@@ -1156,7 +1154,7 @@ def two_adic_symbol(A, val):
1156
1154
print ("A:" )
1157
1155
print (A )
1158
1156
assert False
1159
- even , i = is_even_matrix (A_2 ) # Determine whether the matrix is even or odd.
1157
+ even , _ = is_even_matrix (A_2 ) # Determine whether the matrix is even or odd.
1160
1158
if even :
1161
1159
return [[m0 , n0 , d0 , 0 , 0 ]]
1162
1160
else :
@@ -1178,22 +1176,22 @@ def two_adic_symbol(A, val):
1178
1176
print ("A:" )
1179
1177
print (A_new )
1180
1178
assert False
1181
- even , i = is_even_matrix (A_new )
1179
+ even , _ = is_even_matrix (A_new )
1182
1180
if even :
1183
1181
sym = [[0 , n0 , d0 , 0 , 0 ]]
1184
1182
else :
1185
1183
tr8 = trace_diag_mod_8 (A_8 )
1186
1184
sym = [[0 , n0 , d0 , 1 , tr8 ]]
1187
1185
r = B_2 .nrows ()
1188
1186
B = MatrixSpace (ZZ ,r ,n )(B_2 )
1189
- C = MatrixSpace (IntegerRing () , n - r , n )(C_2 )
1190
- F = MatrixSpace (RationalField () , n - r , n - r )(C * A * C .transpose ())
1187
+ C = MatrixSpace (ZZ , n - r , n )(C_2 )
1188
+ F = MatrixSpace (QQ , n - r , n - r )(C * A * C .transpose ())
1191
1189
U = F ** - 1
1192
1190
d = LCM ([ c .denominator () for c in U .list () ])
1193
- R = IntegerRing () .quotient_ring (Integer (2 )** (val + 3 ))
1191
+ R = ZZ .quotient_ring (Integer (2 )** (val + 3 ))
1194
1192
u = R (d )** - 1
1195
1193
MatR = MatrixSpace (R , n - r , n - r )
1196
- MatZ = MatrixSpace (IntegerRing () , n - r , n - r )
1194
+ MatZ = MatrixSpace (ZZ , n - r , n - r )
1197
1195
U = MatZ (MatR (MatZ (U * d )) * u )
1198
1196
X = C * A
1199
1197
A = B * (A - X .transpose ()* U * X ) * B .transpose ()
@@ -2757,10 +2755,11 @@ def signature(self):
2757
2755
2758
2756
def determinant (self ):
2759
2757
r"""
2760
- Return the determinant of this genus, where the determinant
2761
- is the Hessian determinant of the quadratic form whose Gram
2762
- matrix is the Gram matrix giving rise to this global genus
2763
- symbol.
2758
+ Return the determinant of this genus.
2759
+
2760
+ The determinant is the Hessian determinant of the quadratic
2761
+ form whose Gram matrix is the Gram matrix giving rise to this
2762
+ global genus symbol.
2764
2763
2765
2764
OUTPUT: an integer
2766
2765
@@ -2771,8 +2770,8 @@ def determinant(self):
2771
2770
sage: GS.determinant()
2772
2771
-24
2773
2772
"""
2774
- p , n = self .signature_pair ()
2775
- return (- 1 )** n * prod ([ G .determinant () for G in self ._local_symbols ] )
2773
+ _ , n = self .signature_pair ()
2774
+ return (- 1 )** n * ZZ . prod (G .determinant () for G in self ._local_symbols )
2776
2775
2777
2776
det = determinant
2778
2777
0 commit comments