Google

Go to the first, previous, next, last section, table of contents.


ecm_add_ff, ecm_sub_ff, ecm_chsgn_ff

ecm_add_ff(p1,p2,ec)
ecm_sub_ff(p1,p2,ec)
ecm_chsgn_ff(p1)
:: Addition, Subtraction and additive inverse for points on an elliptic curve.
return
vector or 0
p1,p2
vector of length 3 or 0
ec
vector of length 2
  • Let p1, p2 be points on the elliptic curve represented by ec over the current base field. ecm_add_ff(p1,p2,ec), ecm_sub_ff(p1,p2,ec) and ecm_chsgn_ff(p1) returns p1+p2, p1-p2 and -p1 respectively.
  • If the current base field is a prime field of odd order, then ec represents y^2=x^3+ec[0]x+ec[1]. If the characteristic of the current base field is 2, then ec represents y^2+xy=x^3+ec[0]x^2+ec[1].
  • The point at infinity is represented by 0.
  • If an argument denoting a point is a vector of length 3, then it is the projective coordinate. In such a case the third coordinate must not be 0.
  • If the result is a vector of length 3, then the third coordinate is not equal to 0 but not necessarily 1. To get the result by the affine coordinate, the first and the second coordinates should be divided by the third coordinate.
  • The check whether the arguments are on the curve is omitted.
[0] setmod_ff(1125899906842679)$
[1] EC=newvect(2,[ptolmp(1),ptolmp(1)])$
[2] Pt1=newvect(3,[1,-412127497938252,1])$
[3] Pt2=newvect(3,[6,-252647084363045,1])$
[4] Pt3=ecm_add_ff(Pt1,Pt2,EC);
[ 560137044461222 184453736165476 125 ]
[5] F=y^2-(x^3+EC[0]*x+EC[1])$
[6] subst(F,x,Pt3[0]/Pt3[2],y,Pt3[1]/Pt3[2]);
0
[7] ecm_add_ff(Pt3,ecm_chsgn_ff(Pt3),EC);
0
[8] D=ecm_sub_ff(Pt3,Pt2,EC);
[ 886545905133065 119584559149586 886545905133065 ]
[9] D[0]/D[2]==Pt1[0]/Pt1[2];
1
[10] D[1]/D[2]==Pt1[1]/Pt1[2];
1
References
section setmod_ff


Go to the first, previous, next, last section, table of contents.