diff options
Diffstat (limited to '')
| -rw-r--r-- | parameters_Q4_new.sage | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/parameters_Q4_new.sage b/parameters_Q4_new.sage new file mode 100644 index 0000000..554cc0a --- /dev/null +++ b/parameters_Q4_new.sage | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | # Returns the l-dvisibility parameters of G over Q, given a good basis gb of G, | ||
| 2 | # as a list of pairs (di,hi). | ||
| 3 | def parameters_Q( gb, l ): | ||
| 4 | ret = [] | ||
| 5 | for i in range( len( gb ) ): | ||
| 6 | for j in gb[i]: | ||
| 7 | ret.append( (i,0) ) | ||
| 8 | return ret | ||
| 9 | |||
| 10 | # Computes the l-divisibility parameters of G over Q4, given a good basis gb | ||
| 11 | # over Q for G. Returns a list of pairs (di,hi). | ||
| 12 | # If l is odd it just uses the good basis given to compute the parameters. | ||
| 13 | # If l=2, it uses the results of PST-2. | ||
| 14 | def parameters_Q4_new( gb, l ): | ||
| 15 | if l != 2: | ||
| 16 | return parameters_Q( gb, l ) | ||
| 17 | else: | ||
| 18 | # Converts from "good basis format" to simple list | ||
| 19 | b = [] | ||
| 20 | for x in gb: | ||
| 21 | b += x | ||
| 22 | |||
| 23 | M = exponent_matrix( b ) | ||
| 24 | |||
| 25 | # Thanks to my terrible notation, the elements of b are what are called | ||
| 26 | # g_i in the article, while the elements of bb will be the b_i's. | ||
| 27 | bb = [ abs(b[i]) ^ (2^(-divisibility(M[i],2))) for i in range(len(b)) ] | ||
| 28 | |||
| 29 | # Computing a combination of bb elements of the form 2 * square. | ||
| 30 | MM = exponent_matrix( bb + [2] ).change_ring( GF( 2 ) ) | ||
| 31 | |||
| 32 | for a in MM.kernel().basis(): | ||
| 33 | if a[-1] != 0: | ||
| 34 | # the vector a[0:-1] gives the coefficients for a combination | ||
| 35 | # of the b_i's of the form 2 * square | ||
| 36 | |||
| 37 | # Basis elements that actually appear in the combination | ||
| 38 | c = [ b[i] for i in range(len(a[0:-1])) if a[i] != 0 ] | ||
| 39 | |||
| 40 | # Return the parameters, changing only the ones fo the element | ||
| 41 | # of highest divisibility that appears in the combination. | ||
| 42 | ret = [] | ||
| 43 | div_max = -1 | ||
| 44 | ind_max = -1 | ||
| 45 | for i in range(len(b)): | ||
| 46 | ret.append( (divisibility(M[i],2), 1-max(0,sgn(b[i]))) ) | ||
| 47 | if a[i] != 0 and ret[i][0] > div_max: | ||
| 48 | div_max = ret[i][0] | ||
| 49 | ind_max = i | ||
| 50 | d1, h1 = ret[ind_max] | ||
| 51 | if d1 == 1: | ||
| 52 | h1 = 1 - h1 | ||
| 53 | elif d1 == 0: | ||
| 54 | h1 = 2 | ||
| 55 | ret[ind_max] = ( d1+1, h1 ) | ||
| 56 | |||
| 57 | return ret | ||
| 58 | |||
| 59 | return parameters_Q( gb, 2 ) | ||
| 60 | |||
