| 1 | #include <stdio.h> |
|---|
| 2 | #include <math.h> |
|---|
| 3 | #include <stdlib.h> |
|---|
| 4 | #include "ellcurv.h" |
|---|
| 5 | |
|---|
| 6 | void do3twoisog(GEN CURV1,GEN CURV2) |
|---|
| 7 | {GEN CURV3,CURV4,CURV5,CURV6,CURV7,CURV8; |
|---|
| 8 | int nroots; GEN root1,root2,root3; int i=0; |
|---|
| 9 | |
|---|
| 10 | nroots=findtwo(CURV1,&root1,&root2,&root3); if (nroots==0) return; |
|---|
| 11 | if (nroots==1) |
|---|
| 12 | {CURV3=twogetcurve(CURV1,root1); nroots=findtwo(CURV3,&root1,&root2,&root3); |
|---|
| 13 | if (nroots==3) |
|---|
| 14 | {CURV4=twogetcurve(CURV3,root1); CURV5=twogetcurve(CURV3,root2); |
|---|
| 15 | if ((gequal((GEN) CURV4[11],(GEN) CURV1[11])==1) && |
|---|
| 16 | (gequal((GEN) CURV4[10],(GEN) CURV1[10])==1)) |
|---|
| 17 | CURV4=twogetcurve(CURV3,root3); |
|---|
| 18 | if ((gequal((GEN) CURV5[11],(GEN) CURV1[11])==1) && |
|---|
| 19 | (gequal((GEN) CURV5[10],(GEN) CURV1[10])==1)) |
|---|
| 20 | CURV5=twogetcurve(CURV3,root3); |
|---|
| 21 | nroots=findthree(CURV3,&root1,&root2); CURV6=threegetcurve(CURV3,root1); |
|---|
| 22 | nroots=findthree(CURV4,&root1,&root2); CURV7=threegetcurve(CURV4,root1); |
|---|
| 23 | nroots=findthree(CURV5,&root1,&root2); CURV8=threegetcurve(CURV5,root1); |
|---|
| 24 | if (PLACE==2) i=1; |
|---|
| 25 | sorttwelve(CURV3,CURV1,CURV4,CURV5,CURV6,CURV2,CURV7,CURV8,2); |
|---|
| 26 | if (i==1) PLACE+=4; |
|---|
| 27 | return; |
|---|
| 28 | } |
|---|
| 29 | ISOG=6; if (PLACE==2) PLACE=3; |
|---|
| 30 | nroots=findtwo(CURV2,&root1,&root2,&root3); CURV4=twogetcurve(CURV2,root1); |
|---|
| 31 | if (mpcmp(myvol(CURV1),myvol(CURV3))==1) |
|---|
| 32 | {cv(1,CURV1); cv(2,CURV3); cv(3,CURV2); cv(4,CURV4);} |
|---|
| 33 | else {PLACE++; cv(2,CURV1); cv(1,CURV3); cv(4,CURV2); cv(3,CURV4);} |
|---|
| 34 | return; |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | CURV3=twogetcurve(CURV1,root1); CURV4=twogetcurve(CURV1,root2); |
|---|
| 38 | CURV5=twogetcurve(CURV1,root3); nroots=findthree(CURV3,&root1,&root2); |
|---|
| 39 | CURV6=threegetcurve(CURV3,root1); nroots=findthree(CURV4,&root1,&root2); |
|---|
| 40 | CURV7=threegetcurve(CURV4,root1); nroots=findthree(CURV5,&root1,&root2); |
|---|
| 41 | CURV8=threegetcurve(CURV5,root1); |
|---|
| 42 | |
|---|
| 43 | if (PLACE==2) i=1; |
|---|
| 44 | sorttwelve(CURV1,CURV3,CURV4,CURV5,CURV2,CURV6,CURV7,CURV8,1); |
|---|
| 45 | if (i==1) PLACE+=4; |
|---|
| 46 | return; |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | void do9twoisog(GEN CURV1,GEN CURV2,GEN CURV3) |
|---|
| 50 | {GEN CURV4,CURV5,CURV6; int nroots; GEN root1,root2,root3; |
|---|
| 51 | |
|---|
| 52 | nroots=findtwo(CURV1,&root1,&root2,&root3); if (nroots==0) return; |
|---|
| 53 | ISOG*=2; |
|---|
| 54 | CURV4=twogetcurve(CURV1,root1); nroots=findtwo(CURV2,&root1,&root2,&root3); |
|---|
| 55 | CURV5=twogetcurve(CURV2,root1); nroots=findtwo(CURV3,&root1,&root2,&root3); |
|---|
| 56 | CURV6=twogetcurve(CURV3,root1); |
|---|
| 57 | if (mpcmp(myvol(CURV4),myvol(CURV1))==1) |
|---|
| 58 | {cv(1,CURV4); cv(2,CURV5); cv(3,CURV6); |
|---|
| 59 | cv(4,CURV1); cv(5,CURV2); cv(6,CURV3); PLACE+=3; |
|---|
| 60 | } |
|---|
| 61 | else {cv(4,CURV4); cv(5,CURV5); cv(6,CURV6);} |
|---|
| 62 | } |
|---|