Commit 0659f416 authored by MASSON Simon's avatar MASSON Simon

critere polynome de definition Fpk

parent 0e2c16f7
......@@ -505,7 +505,7 @@ class CocksPinchVariantResult(object):
"""
def __init__(self,k,D,T,i,ht=Integer(0),hy=Integer(0),pre=False,l=1, allowed_cofactor = 1, allowed_size_cofactor = 5, max_trialdiv=10**6, max_B1=10**4, new_semantics=False):
def __init__(self,k,D,T,i,ht=Integer(0),hy=Integer(0),max_poly_coeff=0,pre=False,l=1, allowed_cofactor = 1, allowed_size_cofactor = 5, max_trialdiv=10**6, max_B1=10**4, new_semantics=False):
kl = k * l
fD = -fundamental_discriminant(-D)
......@@ -515,6 +515,7 @@ class CocksPinchVariantResult(object):
self.T = Integer(T)
self.i = i
self.r = cyclotomic_polynomial(kl)(T)
self.max_poly_coeff = max_poly_coeff
self.allowed_size_cofactor = allowed_size_cofactor
self.allowed_cofactor = allowed_cofactor
self.max_trialdiv = max_trialdiv
......@@ -623,6 +624,11 @@ class CocksPinchVariantResult(object):
if pre:
print "C=%s" % repr(self)
def u(self):
return self.T
def T(self):
return self.T
def _prepare_E2(self):
if self._E2 is not None:
return
......@@ -1029,6 +1035,7 @@ class CocksPinchVariantSearch(object):
output_file="",
T_choice="",
hty_choice="",
max_poly_coeff=0,
l=1,
required_cofactor=1,
allowed_cofactor = 1,
......@@ -1052,6 +1059,7 @@ class CocksPinchVariantSearch(object):
- `random`: abide by the other parameters, except that we do random picks.
- `hamming=X`: restrict to Hamming weight equal to `X` (int, positive)
- `2-naf=X`: restrict to 2-NAF weight equal to `X` (int, positive)
- `max_poly_coeff` (int): maximum value of alpha such that x^k - alpha is irreducible
- `verbose` (boolean): verbose mode
- `output_file` (string): filename where to write the parameters
- `hty_choice` (string): strategy to select hy in y = y0 + hy*r and ht in t = t0 + ht*r;
......@@ -1076,6 +1084,7 @@ class CocksPinchVariantSearch(object):
self.T_choice = T_choice
self.hty_choice = hty_choice
self.l = l
self.max_poly_coeff = Integer(max_poly_coeff)
self.required_cofactor = Integer(required_cofactor)
self.allowed_cofactor = Integer(allowed_cofactor)
self.allowed_size_cofactor = Integer(allowed_size_cofactor)
......@@ -1922,6 +1931,18 @@ class CocksPinchVariantSearch(object):
fail['p milrab'] += 1
continue
if self.max_poly_coeff > 0 :
boo = False
for alpha in range(1, self.max_poly_coeff):
if (x**k - alpha).is_irreducible() :
boo = True
break
if (x**k + alpha).is_irreducible() :
boo = True
break
if not(boo) :
fail['large poly'] += 1
E = CocksPinchVariantResult(k,fD,T,i,ht=ht,hy=hy,l=self.l)
if not self.check_automatic_factors(E):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment