Skip to content

Commit

Permalink
ditto
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnCremona committed Apr 22, 2024
1 parent 38c03e5 commit 3979e1f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 26 deletions.
23 changes: 12 additions & 11 deletions libsrc/eclib/ffmod.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,55 +31,56 @@

#include "pointsmod.h"

class ffmodq{
class ffmodq{

public:

// static members defining the function field:
static galois_field Fq; // the constant field
static curvemodq E; // the curve mod q
static FqPoly f1, f2; // f2=a1*x+a3, f2=x^3+a2*x^2+a4*x+a6
static void init(const curvemodq& EE); // set Fq, E, f1, f2

// data defining one element of th function field:
FqPoly h1, h2; // for h1+y*h2


public:

// constructors

// special one to initialize the curve and field only:
explicit ffmodq(const curvemodq& EE);

// normal ones:
ffmodq(void)
ffmodq(void)
{
init_h1h2();
FqPolyAssign0(h1);
FqPolyAssign0(h2);
}

explicit ffmodq(const gf_element& c)
explicit ffmodq(const gf_element& c)
{
init_h1h2();
FqPolyAssignGF(h1,c);
FqPolyAssign0(h2);
}

explicit ffmodq(const bigint& c)
explicit ffmodq(const bigint& c)
{
init_h1h2();
FqPolyAssignZ(h1,c);
FqPolyAssign0(h2);
}

explicit ffmodq(const FqPoly& hh1)
explicit ffmodq(const FqPoly& hh1)
{
init_h1h2();
h1=hh1;
h1=hh1;
FqPolyAssign0(h2);
}

ffmodq(const FqPoly& hh1, const FqPoly& hh2) :h1(hh1), h2(hh2) {}

// initialization
void init_f1f2(void);

void init_h1h2(void)
{
FqPolySetField(h1,Fq);
Expand Down
16 changes: 4 additions & 12 deletions libsrc/ffmod.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,11 @@ curvemodq ffmodq::E;
FqPoly ffmodq::f1;
FqPoly ffmodq::f2;

// special constructor to initialize the curve and field only:
ffmodq::ffmodq(const curvemodq& EE)
void ffmodq::init(const curvemodq& EE)
{
E=EE; Fq=get_field(EE);
init_f1f2();
}

void ffmodq::init_f1f2(void)
{
// cout<<"In ffmodq::init_f1f1()"<<endl;

NewGF(Fq,a1); NewGF(Fq,a2); NewGF(Fq,a3);
NewGF(Fq,a4); NewGF(Fq,a6);
E = EE;
Fq = get_field(EE);
NewGF(Fq,a1); NewGF(Fq,a2); NewGF(Fq,a3); NewGF(Fq,a4); NewGF(Fq,a6);
E.get_ai(a1,a2,a3,a4,a6);
// set f1, f2:
NewFqPoly(Fq,X);
Expand Down
4 changes: 2 additions & 2 deletions libsrc/pointsmod.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ pointmodq reduce_point(const Point& P, const curvemodq& Emodq)

void curvemodqbasis::set_basis()
{
ffmodq(*this); // to initialize the class: sets global ffmodq::E, Fq, f1, f2
ffmodq::init(*this); // to initialize the class: sets global ffmodq::E, Fq, f1, f2
P1=pointmodq(*this);
P2=P1;
if(lazy_flag)
Expand Down Expand Up @@ -965,7 +965,7 @@ void my_isomorphism_type(curvemodq& Cq,
cout<<"Assuming that P does have maximal order,\n";
cout<<"group structure is "<<ordP<<"*"<<quot<<"="<<(quot*ordP)<<endl;
}
ffmodq dummy(Cq); // to initialize the function field's static data
ffmodq::init(Cq); // to initialize the function field's static data
if(debug_iso_type)
cout<<"Looking for a second generator of order "<<quot<<endl;

Expand Down
2 changes: 1 addition & 1 deletion libsrc/tlss.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void TLSS::init_tlpolys()
}

// initialize the ffmodq class
ffmodq dummy((const curvemodq)Emodq);
ffmodq::init((const curvemodq)Emodq);
// initialize the TL-functions
TLpolys.resize(0);
int i;
Expand Down

0 comments on commit 3979e1f

Please sign in to comment.