Next: , Previous: , Up: Preface  


5 Genus 2 curve functions

We only consider the so-called “imaginary” genus 2 curves, i.e., curves given by the equation

C: y^2 + h(x) y = f(x),

with \deg{h}\le 2 and \deg{f} = 5. We also require that C be nonsingular and the leading coefficient of f(x) be 1.


Types field_t and poly_t are for the field element type and the corresponding polynomial type, respectively. They are defined in the header file include/g2hec_nsfieldtype.h. Type poly_tc is the type const poly_t.


A genus 2 curve is stored in the g2hcurve class.


Below are some of the class’s public member functions. They are exported in the file include/g2hec_Genus2_ops.h.


g2hcurve():


default constructor; set curve to y^2 = 0.


g2hcurve(const poly_tc& poly1, const poly_tc& poly2):


constructor; sets curve to y^2 + poly2*y = poly1.


g2hcurve(const g2hcurve& hcurve):


copy constructor.


void set_f(const poly_tc& poly):


sets f(x) to poly.


void set_h(const poly_tc& poly):


sets h(x) to poly.


void update():


checks and set internal flags to determine whether the curve is nonsingular and of genus 2. This function MUST be called immediately after the curve has been changed by set_f(), set_h(), or/and assignment, and before any further operations related to the curve. This is very important to remember, otherwise error may occur.


const poly_tc& get_f():


returns reference to polynomial f(x).


const poly_tc& get_h():


returns reference to polynomial h(x).


bool_t is_valid_curve():


returns TRUE is curve is nonsingular, genus 2, and f(x) is monic.


You can also write curve1 = curve2 naturally to set the value of curve1 to be the same as curve2. It is not needed that curve2 be valid for this assignment.


You can do comparisons like curve1 == curve2 or curve1 != curve2 to test if two curves are the same. Curves do not need to be valid for these comparisons.


Next: Divisor functions, Previous: Tutorial, Up: Preface