version 1.4, 2000/08/21 08:31:21 |
version 1.6, 2001/03/13 01:10:24 |
|
|
* shall be made on your publication or presentation in any form of the |
* shall be made on your publication or presentation in any form of the |
* results obtained by use of the SOFTWARE. |
* results obtained by use of the SOFTWARE. |
* (4) In the event that you modify the SOFTWARE, you shall notify FLL by |
* (4) In the event that you modify the SOFTWARE, you shall notify FLL by |
* e-mail at risa-admin@flab.fujitsu.co.jp of the detailed specification |
* e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification |
* for such modification or the source code of the modified part of the |
* for such modification or the source code of the modified part of the |
* SOFTWARE. |
* SOFTWARE. |
* |
* |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/poly.c,v 1.3 2000/01/11 06:43:35 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/poly.c,v 1.5 2000/08/22 05:03:59 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 63 void Pp_mag(),Pmaxblen(); |
|
Line 63 void Pp_mag(),Pmaxblen(); |
|
void Pmergelist(), Pch_mv(), Pre_mv(), Pdeglist(); |
void Pmergelist(), Pch_mv(), Pre_mv(), Pdeglist(); |
void Pptomp(),Pmptop(); |
void Pptomp(),Pmptop(); |
void Pptolmp(),Plmptop(); |
void Pptolmp(),Plmptop(); |
|
void Psfptop(); |
void Pptogf2n(),Pgf2ntop(),Pgf2ntovect(); |
void Pptogf2n(),Pgf2ntop(),Pgf2ntovect(); |
void Pptogfpn(),Pgfpntop(); |
void Pptogfpn(),Pgfpntop(); |
void Pfind_root_gf2n(); |
void Pfind_root_gf2n(); |
Line 143 struct ftab poly_tab[] = { |
|
Line 144 struct ftab poly_tab[] = { |
|
{"ptolmp",Pptolmp,1}, |
{"ptolmp",Pptolmp,1}, |
{"lmptop",Plmptop,1}, |
{"lmptop",Plmptop,1}, |
|
|
|
{"sfptop",Psfptop,1}, |
|
|
{"ptogf2n",Pptogf2n,1}, |
{"ptogf2n",Pptogf2n,1}, |
{"gf2ntop",Pgf2ntop,-2}, |
{"gf2ntop",Pgf2ntop,-2}, |
{"gf2ntovect",Pgf2ntovect,1}, |
{"gf2ntovect",Pgf2ntovect,1}, |
|
|
STOQ(ret,*rp); |
STOQ(ret,*rp); |
} |
} |
|
|
|
extern int current_gfs_ext; |
|
extern int current_gfs_q; |
|
extern int current_gfs_q1; |
|
extern int *current_gfs_plus1; |
|
extern int *current_gfs_ntoi; |
|
extern int *current_gfs_iton; |
|
|
void Psetmod_ff(arg,rp) |
void Psetmod_ff(arg,rp) |
NODE arg; |
NODE arg; |
Obj *rp; |
Obj *rp; |
|
|
N n; |
N n; |
UP up; |
UP up; |
UP2 up2; |
UP2 up2; |
Q q; |
Q q,r; |
P p; |
P p; |
NODE n0,n1; |
NODE n0,n1; |
LIST list; |
LIST list; |
|
|
error("setmod_ff : invalid argument"); |
error("setmod_ff : invalid argument"); |
switch ( OID(mod) ) { |
switch ( OID(mod) ) { |
case O_N: |
case O_N: |
current_ff = FF_GFP; |
if ( SGN((Q)mod) < 0 ) { |
setmod_lm(NM((Q)mod)); break; |
/* small finite field; primitive root representation */ |
|
current_ff = FF_GFS; |
|
setmod_sf(BD(NM((Q)mod))[0],1); |
|
} else { |
|
current_ff = FF_GFP; |
|
setmod_lm(NM((Q)mod)); |
|
} |
|
break; |
case O_P: |
case O_P: |
current_ff = FF_GF2N; |
current_ff = FF_GF2N; |
setmod_gf2n((P)mod); break; |
setmod_gf2n((P)mod); break; |
|
|
error("setmod_ff : invalid argument"); |
error("setmod_ff : invalid argument"); |
} |
} |
} else if ( ac == 2 ) { |
} else if ( ac == 2 ) { |
current_ff = FF_GFPN; |
|
defpoly = (Obj)ARG0(arg); |
|
mod = (Obj)ARG1(arg); |
mod = (Obj)ARG1(arg); |
if ( !mod || !defpoly ) |
if ( SGN((Q)mod) < 0 ) { |
error("setmod_ff : invalid argument"); |
error("setmod_ff : not implemented yet"); |
setmod_lm(NM((Q)mod)); |
} else { |
setmod_gfpn((P)defpoly); |
current_ff = FF_GFPN; |
|
defpoly = (Obj)ARG0(arg); |
|
if ( !mod || !defpoly ) |
|
error("setmod_ff : invalid argument"); |
|
setmod_lm(NM((Q)mod)); |
|
setmod_gfpn((P)defpoly); |
|
} |
} |
} |
switch ( current_ff ) { |
switch ( current_ff ) { |
case FF_GFP: |
case FF_GFP: |
|
|
MKNODE(n1,q,0); MKNODE(n0,p,n1); |
MKNODE(n1,q,0); MKNODE(n0,p,n1); |
MKLIST(list,n0); |
MKLIST(list,n0); |
*rp = (Obj)list; break; |
*rp = (Obj)list; break; |
|
case FF_GFS: |
|
STOQ(current_gfs_q,q); |
|
STOQ(current_gfs_iton[1],r); |
|
n0 = mknode(3,ONE,q,r); |
|
MKLIST(list,n0); |
|
*rp = (Obj)list; break; |
default: |
default: |
*rp = 0; break; |
*rp = 0; break; |
} |
} |
|
|
DCP dc,dcr0,dcr; |
DCP dc,dcr0,dcr; |
GF2N rg,sg; |
GF2N rg,sg; |
GFPN rpn,spn; |
GFPN rpn,spn; |
|
GFS rs; |
P t; |
P t; |
Obj obj; |
Obj obj; |
|
|
|
|
case FF_GFPN: |
case FF_GFPN: |
ntogfpn((Obj)p,&rpn); simpgfpn((GFPN)rpn,&spn); *rp = (Obj)spn; |
ntogfpn((Obj)p,&rpn); simpgfpn((GFPN)rpn,&spn); *rp = (Obj)spn; |
break; |
break; |
|
case FF_GFS: |
|
if ( current_gfs_ext > 1 ) { |
|
error("simp_ff : not implemented yet"); |
|
} else { |
|
ptomp(current_gfs_q,(P)p,&t); mqtogfs(t,&rs); |
|
*rp = (Obj)rs; |
|
} |
|
break; |
default: |
default: |
*rp = (Obj)p; |
*rp = (Obj)p; |
break; |
break; |
|
|
P *rp; |
P *rp; |
{ |
{ |
lmptop((P)ARG0(arg),rp); |
lmptop((P)ARG0(arg),rp); |
|
} |
|
|
|
void Psfptop(arg,rp) |
|
NODE arg; |
|
P *rp; |
|
{ |
|
sfptop((P)ARG0(arg),rp); |
} |
} |
|
|
void Pptogf2n(arg,rp) |
void Pptogf2n(arg,rp) |