|
18 | 18 | #
|
19 | 19 | # https://www.gnu.org/licenses/
|
20 | 20 | # ****************************************************************************
|
21 |
| -from pathlib import Path |
22 | 21 | from copy import copy, deepcopy
|
| 22 | +from pathlib import Path |
23 | 23 |
|
24 |
| -from sage.misc.lazy_import import lazy_import |
25 |
| -from sage.misc.misc_c import prod |
26 |
| -from sage.misc.cachefunc import cached_method |
27 | 24 | from sage.arith.functions import lcm as LCM
|
28 | 25 | from sage.arith.misc import fundamental_discriminant
|
29 |
| -from sage.matrix.matrix_space import MatrixSpace |
30 | 26 | from sage.matrix.constructor import matrix
|
31 |
| -from sage.rings.integer_ring import ZZ |
32 |
| -from sage.rings.rational_field import QQ |
33 |
| -from sage.rings.integer import Integer |
| 27 | +from sage.matrix.matrix_space import MatrixSpace |
| 28 | +from sage.misc.cachefunc import cached_method |
| 29 | +from sage.misc.lazy_import import lazy_import |
| 30 | +from sage.misc.misc_c import prod |
34 | 31 | from sage.misc.verbose import verbose
|
35 | 32 | from sage.quadratic_forms.special_values import quadratic_L_function__exact
|
| 33 | +from sage.rings.integer import Integer |
| 34 | +from sage.rings.integer_ring import ZZ |
| 35 | +from sage.rings.rational_field import QQ |
| 36 | + |
36 | 37 | lazy_import('sage.quadratic_forms.genera.normal_form', '_min_nonsquare')
|
37 | 38 | lazy_import('sage.interfaces.magma', 'magma')
|
38 | 39 |
|
@@ -120,8 +121,7 @@ def genera(sig_pair, determinant, max_scale=None, even=False):
|
120 | 121 | return genera
|
121 | 122 |
|
122 | 123 |
|
123 |
| -# #35557: In Python < 3.10, a staticmethod cannot be called directly |
124 |
| -_genera_staticmethod = staticmethod(genera) |
| 124 | +genera = staticmethod(genera) |
125 | 125 |
|
126 | 126 |
|
127 | 127 | def _local_genera(p, rank, det_val, max_scale, even):
|
@@ -172,8 +172,8 @@ def _local_genera(p, rank, det_val, max_scale, even):
|
172 | 172 | Genus symbol at 5: 5^-2,
|
173 | 173 | Genus symbol at 5: 5^2]
|
174 | 174 | """
|
175 |
| - from sage.misc.mrange import cantor_product |
176 | 175 | from sage.combinat.integer_lists.invlex import IntegerListsLex
|
| 176 | + from sage.misc.mrange import cantor_product |
177 | 177 | scales_rks = [] # contains possibilities for scales and ranks
|
178 | 178 | for rkseq in IntegerListsLex(rank, length=max_scale + 1): # rank sequences
|
179 | 179 | # sum(rkseq) = rank
|
@@ -2871,8 +2871,10 @@ def rational_representative(self):
|
2871 | 2871 | [0 0 0 0 0 0 1 0]
|
2872 | 2872 | [0 0 0 0 0 0 0 2]
|
2873 | 2873 | """
|
2874 |
| - from sage.quadratic_forms.quadratic_form import QuadraticForm |
2875 |
| - from sage.quadratic_forms.quadratic_form import quadratic_form_from_invariants |
| 2874 | + from sage.quadratic_forms.quadratic_form import ( |
| 2875 | + QuadraticForm, |
| 2876 | + quadratic_form_from_invariants, |
| 2877 | + ) |
2876 | 2878 | sminus = self.signature_pair_of_matrix()[1]
|
2877 | 2879 | det = self.determinant()
|
2878 | 2880 | m = self.rank()
|
@@ -2907,7 +2909,10 @@ def _compute_representative(self, LLL=True):
|
2907 | 2909 | ....: G = genera((2,2), det, even=False)
|
2908 | 2910 | ....: assert all(g==Genus(g.representative()) for g in G)
|
2909 | 2911 | """
|
2910 |
| - from sage.modules.free_quadratic_module_integer_symmetric import IntegralLattice, local_modification |
| 2912 | + from sage.modules.free_quadratic_module_integer_symmetric import ( |
| 2913 | + IntegralLattice, |
| 2914 | + local_modification, |
| 2915 | + ) |
2911 | 2916 | q = self.rational_representative()
|
2912 | 2917 | # the associated quadratic form xGx.T/2 should be integral
|
2913 | 2918 | L = IntegralLattice(4 * q).maximal_overlattice()
|
@@ -3059,15 +3064,19 @@ def representatives(self, backend=None, algorithm=None):
|
3059 | 3064 | if self.signature_pair()[0] == 0:
|
3060 | 3065 | e = ZZ(-1)
|
3061 | 3066 | d = - 4 * self.determinant()
|
3062 |
| - from sage.quadratic_forms.binary_qf import BinaryQF_reduced_representatives |
| 3067 | + from sage.quadratic_forms.binary_qf import ( |
| 3068 | + BinaryQF_reduced_representatives, |
| 3069 | + ) |
3063 | 3070 | for q in BinaryQF_reduced_representatives(d, proper=False):
|
3064 | 3071 | if q[1] % 2 == 0: # we want integrality of the gram matrix
|
3065 | 3072 | m = e*matrix(ZZ, 2, [q[0], q[1] // 2, q[1] // 2, q[2]])
|
3066 | 3073 | if Genus(m) == self:
|
3067 | 3074 | representatives.append(m)
|
3068 | 3075 | if n > 2:
|
3069 | 3076 | from sage.quadratic_forms.quadratic_form import QuadraticForm
|
3070 |
| - from sage.quadratic_forms.quadratic_form__neighbors import neighbor_iteration |
| 3077 | + from sage.quadratic_forms.quadratic_form__neighbors import ( |
| 3078 | + neighbor_iteration, |
| 3079 | + ) |
3071 | 3080 | e = ZZ.one()
|
3072 | 3081 | if not self.is_even():
|
3073 | 3082 | e = ZZ(2)
|
@@ -3152,10 +3161,10 @@ def _standard_mass(self):
|
3152 | 3161 | sage: GS._standard_mass() # needs sage.symbolic
|
3153 | 3162 | 1/48
|
3154 | 3163 | """
|
| 3164 | + from sage.functions.gamma import gamma |
| 3165 | + from sage.functions.transcendental import zeta |
3155 | 3166 | from sage.symbolic.constants import pi
|
3156 | 3167 | from sage.symbolic.ring import SR
|
3157 |
| - from sage.functions.transcendental import zeta |
3158 |
| - from sage.functions.gamma import gamma |
3159 | 3168 | n = self.dimension()
|
3160 | 3169 | if n % 2 == 0:
|
3161 | 3170 | s = n // 2
|
|
0 commit comments