canonical ideal working
This commit is contained in:
parent
9376f28100
commit
1891b447b6
@ -17,7 +17,7 @@ class as_polyform:
|
|||||||
"""Find coordinates of the given holomorphic form self in terms of the basis forms in a list holo."""
|
"""Find coordinates of the given holomorphic form self in terms of the basis forms in a list holo."""
|
||||||
AS = self.curve
|
AS = self.curve
|
||||||
if basis == 0:
|
if basis == 0:
|
||||||
basis = AS.holomorphic_differentials_basis()
|
basis = AS.holo_polydifferentials_basis(mult = self.mult)
|
||||||
RxyzQ, Rxyz, x, y, z = AS.fct_field
|
RxyzQ, Rxyz, x, y, z = AS.fct_field
|
||||||
# We need to have only polynomials to use monomial_coefficients in linear_representation_polynomials,
|
# We need to have only polynomials to use monomial_coefficients in linear_representation_polynomials,
|
||||||
# and sometimes basis elements have denominators. Thus we multiply by them.
|
# and sometimes basis elements have denominators. Thus we multiply by them.
|
||||||
@ -51,8 +51,9 @@ def as_symmetric_power_basis(AS, n, threshold = 8):
|
|||||||
result = []
|
result = []
|
||||||
for i in indices_nonrepeating:
|
for i in indices_nonrepeating:
|
||||||
tensor_form = [B0[i[j]] for j in range(n)]
|
tensor_form = [B0[i[j]] for j in range(n)]
|
||||||
|
tensor_form = [1] + tensor_form
|
||||||
result += [tensor_form]
|
result += [tensor_form]
|
||||||
print(binomial(g + n - 1, n), len(result))
|
result = [as_symmetric_product_forms([a]) for a in result]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def as_canonical_ideal(AS, n, threshold=8):
|
def as_canonical_ideal(AS, n, threshold=8):
|
||||||
@ -61,30 +62,22 @@ def as_canonical_ideal(AS, n, threshold=8):
|
|||||||
g = AS.genus()
|
g = AS.genus()
|
||||||
RxyzQ, Rxyz, x, y, z = AS.fct_field
|
RxyzQ, Rxyz, x, y, z = AS.fct_field
|
||||||
from itertools import product
|
from itertools import product
|
||||||
#B1 = as_symmetric_power_basis(AS, n, threshold = 8)
|
B1 = as_symmetric_power_basis(AS, n, threshold = 8)
|
||||||
B1 = [[B0[i[j]] for j in range(n)] for i in product(*indices)]
|
|
||||||
B2 = AS.holo_polydifferentials_basis(n, threshold = threshold)
|
B2 = AS.holo_polydifferentials_basis(n, threshold = threshold)
|
||||||
g = AS.genus()
|
g = AS.genus()
|
||||||
r = len(B2)
|
r = len(B2)
|
||||||
M = matrix(F, len(B1), r)
|
M = matrix(F, len(B1), r)
|
||||||
for i in range(0, len(B1)):
|
for i in range(0, len(B1)):
|
||||||
atuple = B1[i]
|
c = B1[i].multiply()
|
||||||
c = Rxyz(1)
|
|
||||||
for a in atuple:
|
|
||||||
c = c*a.form
|
|
||||||
c = as_reduction(AS, c)
|
|
||||||
c = as_function(AS, c)
|
|
||||||
c = as_polyform(c, n)
|
|
||||||
#return M, c.coordinates(basis=B2)
|
#return M, c.coordinates(basis=B2)
|
||||||
M[i, :] = vector(c.coordinates(basis=B2))
|
M[i, :] = vector(c.coordinates(basis=B2))
|
||||||
K = M.kernel().basis()
|
K = M.kernel().basis()
|
||||||
result = []
|
result = []
|
||||||
for v in K:
|
for v in K:
|
||||||
coeffs = {tuple(b) : 0 for b in B1}
|
kernel_vector = 0*B1[0]
|
||||||
for i in range(r):
|
for i in range(len(v)):
|
||||||
if v[i] != 0:
|
kernel_vector += v[i]*B1[i]
|
||||||
coeffs[tuple(B1[i])] += v[i]
|
result += [kernel_vector]
|
||||||
result += [as_symmetric_product_forms(B1, coeffs)]
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
as_cover.canonical_ideal = as_canonical_ideal
|
as_cover.canonical_ideal = as_canonical_ideal
|
||||||
@ -94,61 +87,17 @@ def as_canonical_ideal_polynomials(AS, n, threshold=8):
|
|||||||
|
|
||||||
as_cover.canonical_ideal_polynomials = as_canonical_ideal_polynomials
|
as_cover.canonical_ideal_polynomials = as_canonical_ideal_polynomials
|
||||||
|
|
||||||
class as_tensor_product_forms:
|
|
||||||
def __init__(self, pairs_of_forms, coeffs):
|
|
||||||
self.pairs = pairs_of_forms
|
|
||||||
self.coeffs = coeffs #dictionary
|
|
||||||
self.curve = pairs_of_forms[0][0].curve
|
|
||||||
|
|
||||||
def coordinates(self, basis = 0):
|
|
||||||
AS = self.curve
|
|
||||||
g = AS.genus()
|
|
||||||
F = AS.base_ring
|
|
||||||
if basis == 0:
|
|
||||||
basis = AS.holomorphic_differentials_basis()
|
|
||||||
result = matrix(F, g, g)
|
|
||||||
for (omega1, omega2) in self.pairs:
|
|
||||||
c = omega1.coordinates(basis = basis)
|
|
||||||
d = omega2.coordinates(basis = basis)
|
|
||||||
for i in range(g):
|
|
||||||
for j in range(g):
|
|
||||||
result[i, j] += self.coeffs[(omega1, omega2)]*c[i]*d[j]
|
|
||||||
return result
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
result = ''
|
|
||||||
for (omega1, omega2) in self.pairs:
|
|
||||||
if self.coeffs[(omega1, omega2)] !=0:
|
|
||||||
result += str(self.coeffs[(omega1, omega2)]) + ' * ' + str(omega1) + '⊗' + str(omega2) + ' + '
|
|
||||||
return result
|
|
||||||
|
|
||||||
def polynomial(self):
|
|
||||||
AS = self.curve
|
|
||||||
F = AS.base_ring
|
|
||||||
g = AS.genus()
|
|
||||||
M = self.coordinates()
|
|
||||||
Rg = PolynomialRing(F, 'X', g)
|
|
||||||
X = Rg.gens()
|
|
||||||
return sum(M[i, j] * X[i]*X[j] for i in range(g) for j in range(g))
|
|
||||||
|
|
||||||
def group_action(self, elt):
|
|
||||||
p = self.base_ring.characteristic()
|
|
||||||
n = self.height
|
|
||||||
elt1 = [p^n - a for a in elt]
|
|
||||||
pairs_of_forms2 = [(a.group_action(elt), b.group_action(elt1)) for (a, b) in pairs_of_forms]
|
|
||||||
coeffs2 = {(a.group_action(elt), b.group_action(elt1)) : self.coeffs[(a, b)] for (a, b) in pairs_of_forms}
|
|
||||||
return as_tensor_product_forms(pairs_of_forms2, self.coeffs)
|
|
||||||
|
|
||||||
class as_symmetric_product_forms:
|
class as_symmetric_product_forms:
|
||||||
def __init__(self, tuples_of_forms, coeffs):
|
def __init__(self, forms_and_coeffs):
|
||||||
self.n = len(tuples_of_forms[0])
|
'''Elements of forms_and_coeffs are of the form [coeff, form1, ..., formn]'''
|
||||||
self.tuples = tuples_of_forms
|
self.n = len(forms_and_coeffs[0]) - 1
|
||||||
self.coeffs = coeffs #dictionary
|
self.tuples = forms_and_coeffs
|
||||||
self.curve = tuples_of_forms[0][0].curve
|
self.curve = forms_and_coeffs[0][1].curve
|
||||||
|
|
||||||
def coordinates(self, basis = 0):
|
def coordinates(self, basis = 0):
|
||||||
AS = self.curve
|
AS = self.curve
|
||||||
g = AS.genus()
|
g = AS.genus()
|
||||||
|
n = self.n
|
||||||
F = AS.base_ring
|
F = AS.base_ring
|
||||||
if basis == 0:
|
if basis == 0:
|
||||||
basis = AS.holomorphic_differentials_basis()
|
basis = AS.holomorphic_differentials_basis()
|
||||||
@ -156,26 +105,39 @@ class as_symmetric_product_forms:
|
|||||||
indices = [list(range(g)) for i in range(self.n)]
|
indices = [list(range(g)) for i in range(self.n)]
|
||||||
result = {i : 0 for i in product(*indices)}
|
result = {i : 0 for i in product(*indices)}
|
||||||
for atuple in self.tuples:
|
for atuple in self.tuples:
|
||||||
coors = [omega.coordinates(basis = basis) for omega in atuple]
|
coors = [omega.coordinates(basis = basis) for omega in atuple[1:]]
|
||||||
for i in product(*indices):
|
for i in product(*indices):
|
||||||
aux_product = 1
|
aux_product = 1
|
||||||
for j in range(n):
|
for j in range(n):
|
||||||
aux_product *= coors[j][i[j]]
|
aux_product *= coors[j][i[j]]
|
||||||
result[i] += self.coeffs[tuple(atuple)]*aux_product
|
result[i] += atuple[0]*aux_product
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
result = ''
|
result = ''
|
||||||
for atuple in self.tuples:
|
for atuple in self.tuples:
|
||||||
if self.coeffs[tuple(atuple)] !=0:
|
if atuple[0] !=0:
|
||||||
result += str(self.coeffs[tuple(atuple)]) + ' * '
|
result += str(atuple[0]) + ' * '
|
||||||
for j in range(self.n):
|
for j in range(1, self.n+1):
|
||||||
result += "(" + str(atuple[j]) + ")"
|
result += "(" + str(atuple[j]) + ")"
|
||||||
if j != self.n-1:
|
if j != self.n:
|
||||||
result + '⊗'
|
result + '⊗'
|
||||||
result += ' + '
|
result += ' + '
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def __add__(self, other):
|
||||||
|
return as_symmetric_product_forms(self.tuples + other.tuples)
|
||||||
|
|
||||||
|
def __rmul__(self, other):
|
||||||
|
AS = self.curve
|
||||||
|
F = AS.base_ring
|
||||||
|
if isinstance(other, int) or other in ZZ or other in F:
|
||||||
|
aux_tuples = []
|
||||||
|
for atuple in self.tuples:
|
||||||
|
atuple1 = [other * atuple[0]] + atuple[1:]
|
||||||
|
aux_tuples += [atuple1]
|
||||||
|
return as_symmetric_product_forms(aux_tuples)
|
||||||
|
|
||||||
def multiply(self):
|
def multiply(self):
|
||||||
n = self.n
|
n = self.n
|
||||||
AS = self.curve
|
AS = self.curve
|
||||||
@ -183,10 +145,12 @@ class as_symmetric_product_forms:
|
|||||||
result = as_polyform(0*AS.x, n)
|
result = as_polyform(0*AS.x, n)
|
||||||
for atuple in self.tuples:
|
for atuple in self.tuples:
|
||||||
aux_product = Rxyz(1)
|
aux_product = Rxyz(1)
|
||||||
for fct in atuple:
|
for fct in atuple[1:]:
|
||||||
aux_product = aux_product * fct.form
|
aux_product = aux_product * fct.form
|
||||||
aux_product = as_function(AS, aux_product)
|
aux_product = as_function(AS, aux_product)
|
||||||
result += as_polyform(self.coeffs[tuple(atuple)]*aux_product, n)
|
aux_product = as_reduction(AS, aux_product)
|
||||||
|
aux_product = as_function(AS, aux_product)
|
||||||
|
result += as_polyform(atuple[0]*aux_product, n)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def polynomial(self):
|
def polynomial(self):
|
||||||
@ -210,21 +174,11 @@ class as_symmetric_product_forms:
|
|||||||
def group_action(self, elt):
|
def group_action(self, elt):
|
||||||
p = self.base_ring.characteristic()
|
p = self.base_ring.characteristic()
|
||||||
n = self.height
|
n = self.height
|
||||||
elt1 = [p^n - a for a in elt]
|
aux_tuples = []
|
||||||
pairs_of_forms2 = [(a.group_action(elt), b.group_action(elt1)) for (a, b) in pairs_of_forms]
|
for atuple in self.tuples:
|
||||||
coeffs2 = {(a.group_action(elt), b.group_action(elt1)) : self.coeffs[(a, b)] for (a, b) in pairs_of_forms}
|
aux_tuple = atuple[0] + [a.group_action(elt) for a in atuple[1:]]
|
||||||
return as_tensor_product_forms(pairs_of_forms2, self.coeffs)
|
aux_tuples += [aux_tuple]
|
||||||
|
return as_symmetric_product_forms(aux_tuples)
|
||||||
|
|
||||||
def non_decreasing(L):
|
def non_decreasing(L):
|
||||||
return all(x<=y for x, y in zip(L, L[1:]))
|
return all(x<=y for x, y in zip(L, L[1:]))
|
||||||
|
|
||||||
def as_multiply_forms(list_of_forms):
|
|
||||||
n = len(list_of_forms)
|
|
||||||
AS = list_of_forms[0].curve
|
|
||||||
RxyzQ, Rxyz, x, y, z = AS.fct_field
|
|
||||||
aux_product = Rxyz(1)
|
|
||||||
for fct in list_of_forms:
|
|
||||||
aux_product = aux_product * fct.form
|
|
||||||
aux_product = as_function(AS, aux_product)
|
|
||||||
aux_product = as_polyform(aux_product, n)
|
|
||||||
return aux_product
|
|
Loading…
Reference in New Issue
Block a user