version 1.5, 2019/03/13 08:01:05 |
version 1.21, 2019/12/27 08:13:59 |
|
|
* 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/asir2018/builtin/dp.c,v 1.4 2018/11/12 07:59:33 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2018/builtin/dp.c,v 1.20 2019/12/12 04:44:59 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
Line 79 void Pdp_nf_mod(),Pdp_true_nf_mod(); |
|
Line 79 void Pdp_nf_mod(),Pdp_true_nf_mod(); |
|
void Pdp_criB(),Pdp_nelim(); |
void Pdp_criB(),Pdp_nelim(); |
void Pdp_minp(),Pdp_sp_mod(); |
void Pdp_minp(),Pdp_sp_mod(); |
void Pdp_homo(),Pdp_dehomo(); |
void Pdp_homo(),Pdp_dehomo(); |
|
void Pdpm_homo(),Pdpm_dehomo(); |
void Pdp_gr_mod_main(),Pdp_gr_f_main(); |
void Pdp_gr_mod_main(),Pdp_gr_f_main(); |
void Pdp_gr_main(),Pdp_gr_hm_main(),Pdp_gr_d_main(),Pdp_gr_flags(); |
void Pdp_gr_main(),Pdp_gr_hm_main(),Pdp_gr_d_main(),Pdp_gr_flags(); |
void Pdp_interreduce(); |
void Pdp_interreduce(); |
Line 89 void Pdp_vtoe(), Pdp_etov(), Pdp_dtov(), Pdp_idiv(), P |
|
Line 90 void Pdp_vtoe(), Pdp_etov(), Pdp_dtov(), Pdp_idiv(), P |
|
void Pdp_cont(); |
void Pdp_cont(); |
void Pdp_gr_checklist(); |
void Pdp_gr_checklist(); |
void Pdp_ltod(),Pdpv_ord(),Pdpv_ht(),Pdpv_hm(),Pdpv_hc(); |
void Pdp_ltod(),Pdpv_ord(),Pdpv_ht(),Pdpv_hm(),Pdpv_hc(); |
void Pdpm_ltod(),Pdpm_dtol(),Pdpm_ord(),Pdpm_nf(),Pdpm_weyl_nf(),Pdpm_sp(),Pdpm_weyl_sp(); |
void Pdpm_ltod(),Pdpm_dtol(),Pdpm_set_schreyer(),Pdpm_nf(),Pdpm_weyl_nf(),Pdpm_sp(),Pdpm_weyl_sp(),Pdpm_nf_and_quotient(),Pdpm_nf_and_quotient2(); |
void Pdpm_hm(),Pdpm_ht(),Pdpm_hc(); |
void Pdpm_schreyer_frame(),Pdpm_set_schreyer_level(); |
|
void Pdpm_list_to_array(),Pdpm_sp_nf(),Pdpm_insert_to_zlist(); |
|
void Pdpm_hm(),Pdpm_ht(),Pdpm_hc(),Pdpm_hp(),Pdpm_rest(),Pdpm_shift(),Pdpm_split(),Pdpm_extract(),Pdpm_sort(),Pdpm_dptodpm(),Pdpm_redble(); |
|
void Pdpm_schreyer_base(),Pdpm_simplify_syz(),Pdpm_td(); |
|
void Pdpm_remove_cont(); |
|
|
void Pdp_weyl_red(); |
void Pdp_weyl_red(); |
void Pdp_weyl_sp(); |
void Pdp_weyl_sp(); |
Line 139 struct ftab dp_tab[] = { |
|
Line 144 struct ftab dp_tab[] = { |
|
{"dp_prim",Pdp_prim,1}, |
{"dp_prim",Pdp_prim,1}, |
{"dp_red_coef",Pdp_red_coef,2}, |
{"dp_red_coef",Pdp_red_coef,2}, |
{"dp_cont",Pdp_cont,1}, |
{"dp_cont",Pdp_cont,1}, |
|
{"dpm_remove_cont",Pdpm_remove_cont,1}, |
|
|
/* polynomial ring */ |
/* polynomial ring */ |
/* special operations */ |
/* special operations */ |
Line 157 struct ftab dp_tab[] = { |
|
Line 163 struct ftab dp_tab[] = { |
|
{"dp_nf",Pdp_nf,4}, |
{"dp_nf",Pdp_nf,4}, |
{"dp_nf_mod",Pdp_nf_mod,5}, |
{"dp_nf_mod",Pdp_nf_mod,5}, |
{"dp_nf_f",Pdp_nf_f,4}, |
{"dp_nf_f",Pdp_nf_f,4}, |
{"dpm_nf_f",Pdpm_nf_f,4}, |
{"dpm_nf_and_quotient",Pdpm_nf_and_quotient,-3}, |
{"dpm_weyl_nf_f",Pdpm_weyl_nf_f,4}, |
{"dpm_nf_and_quotient2",Pdpm_nf_and_quotient2,-3}, |
{"dpm_nf",Pdpm_nf,4}, |
{"dpm_nf_f",Pdpm_nf_f,-4}, |
|
{"dpm_weyl_nf_f",Pdpm_weyl_nf_f,-4}, |
|
{"dpm_nf",Pdpm_nf,-4}, |
{"dpm_sp",Pdpm_sp,2}, |
{"dpm_sp",Pdpm_sp,2}, |
{"dpm_weyl_sp",Pdpm_weyl_sp,2}, |
{"dpm_weyl_sp",Pdpm_weyl_sp,2}, |
|
|
Line 215 struct ftab dp_tab[] = { |
|
Line 223 struct ftab dp_tab[] = { |
|
|
|
/* normal form */ |
/* normal form */ |
{"dp_weyl_nf",Pdp_weyl_nf,4}, |
{"dp_weyl_nf",Pdp_weyl_nf,4}, |
{"dpm_weyl_nf",Pdpm_weyl_nf,4}, |
{"dpm_weyl_nf",Pdpm_weyl_nf,-4}, |
{"dp_weyl_nf_mod",Pdp_weyl_nf_mod,5}, |
{"dp_weyl_nf_mod",Pdp_weyl_nf_mod,5}, |
{"dp_weyl_nf_f",Pdp_weyl_nf_f,4}, |
{"dp_weyl_nf_f",Pdp_weyl_nf_f,4}, |
|
|
Line 252 struct ftab dp_supp_tab[] = { |
|
Line 260 struct ftab dp_supp_tab[] = { |
|
/* setting flags */ |
/* setting flags */ |
{"dp_sort",Pdp_sort,1}, |
{"dp_sort",Pdp_sort,1}, |
{"dp_ord",Pdp_ord,-1}, |
{"dp_ord",Pdp_ord,-1}, |
{"dpm_ord",Pdpm_ord,-1}, |
{"dpm_set_schreyer",Pdpm_set_schreyer,-1}, |
|
{"dpm_set_schreyer_level",Pdpm_set_schreyer_level,1}, |
|
{"dpm_schreyer_frame",Pdpm_schreyer_frame,1}, |
{"dpv_ord",Pdpv_ord,-2}, |
{"dpv_ord",Pdpv_ord,-2}, |
{"dp_set_kara",Pdp_set_kara,-1}, |
{"dp_set_kara",Pdp_set_kara,-1}, |
{"dp_nelim",Pdp_nelim,-1}, |
{"dp_nelim",Pdp_nelim,-1}, |
Line 274 struct ftab dp_supp_tab[] = { |
|
Line 284 struct ftab dp_supp_tab[] = { |
|
{"dp_ltod",Pdp_ltod,-2}, |
{"dp_ltod",Pdp_ltod,-2}, |
|
|
{"dpm_ltod",Pdpm_ltod,2}, |
{"dpm_ltod",Pdpm_ltod,2}, |
{"dpm_dtol",Pdpm_dtol,3}, |
{"dpm_dptodpm",Pdpm_dptodpm,2}, |
|
{"dpm_dtol",Pdpm_dtol,2}, |
|
{"dpm_homo",Pdpm_homo,1}, |
|
{"dpm_dehomo",Pdpm_dehomo,1}, |
|
|
/* criteria */ |
/* criteria */ |
{"dp_cri1",Pdp_cri1,2}, |
{"dp_cri1",Pdp_cri1,2}, |
Line 293 struct ftab dp_supp_tab[] = { |
|
Line 306 struct ftab dp_supp_tab[] = { |
|
{"dpm_hm",Pdpm_hm,1}, |
{"dpm_hm",Pdpm_hm,1}, |
{"dpm_ht",Pdpm_ht,1}, |
{"dpm_ht",Pdpm_ht,1}, |
{"dpm_hc",Pdpm_hc,1}, |
{"dpm_hc",Pdpm_hc,1}, |
|
{"dpm_hp",Pdpm_hp,1}, |
|
{"dpm_rest",Pdpm_rest,1}, |
|
{"dpm_shift",Pdpm_shift,2}, |
|
{"dpm_split",Pdpm_split,2}, |
|
{"dpm_extract",Pdpm_extract,2}, |
|
{"dpm_sort",Pdpm_sort,1}, |
{"dp_rest",Pdp_rest,1}, |
{"dp_rest",Pdp_rest,1}, |
{"dp_initial_term",Pdp_initial_term,1}, |
{"dp_initial_term",Pdp_initial_term,1}, |
{"dp_order",Pdp_order,1}, |
{"dp_order",Pdp_order,1}, |
Line 303 struct ftab dp_supp_tab[] = { |
|
Line 322 struct ftab dp_supp_tab[] = { |
|
{"dp_mag",Pdp_mag,1}, |
{"dp_mag",Pdp_mag,1}, |
{"dp_sugar",Pdp_sugar,1}, |
{"dp_sugar",Pdp_sugar,1}, |
{"dp_set_sugar",Pdp_set_sugar,2}, |
{"dp_set_sugar",Pdp_set_sugar,2}, |
|
{"dpm_td",Pdpm_td,1}, |
|
|
/* misc */ |
/* misc */ |
{"dp_mbase",Pdp_mbase,1}, |
{"dp_mbase",Pdp_mbase,1}, |
{"dp_redble",Pdp_redble,2}, |
{"dp_redble",Pdp_redble,2}, |
|
{"dpm_redble",Pdpm_redble,2}, |
{"dp_sep",Pdp_sep,2}, |
{"dp_sep",Pdp_sep,2}, |
{"dp_idiv",Pdp_idiv,2}, |
{"dp_idiv",Pdp_idiv,2}, |
{"dp_tdiv",Pdp_tdiv,2}, |
{"dp_tdiv",Pdp_tdiv,2}, |
Line 316 struct ftab dp_supp_tab[] = { |
|
Line 337 struct ftab dp_supp_tab[] = { |
|
{"dp_compute_essential_df",Pdp_compute_essential_df,2}, |
{"dp_compute_essential_df",Pdp_compute_essential_df,2}, |
{"dp_mono_raddec",Pdp_mono_raddec,2}, |
{"dp_mono_raddec",Pdp_mono_raddec,2}, |
{"dp_mono_reduce",Pdp_mono_reduce,2}, |
{"dp_mono_reduce",Pdp_mono_reduce,2}, |
|
{"dpm_schreyer_base",Pdpm_schreyer_base,1}, |
|
{"dpm_list_to_array",Pdpm_list_to_array,1}, |
|
{"dpm_sp_nf",Pdpm_sp_nf,4}, |
|
{"dpm_insert_to_zlist",Pdpm_insert_to_zlist,3}, |
|
{"dpm_simplify_syz",Pdpm_simplify_syz,2}, |
|
|
{"dp_rref2",Pdp_rref2,2}, |
{"dp_rref2",Pdp_rref2,2}, |
{"sumi_updatepairs",Psumi_updatepairs,3}, |
{"sumi_updatepairs",Psumi_updatepairs,3}, |
Line 338 int comp_by_tdeg(DP *a,DP *b) |
|
Line 364 int comp_by_tdeg(DP *a,DP *b) |
|
else return 0; |
else return 0; |
} |
} |
|
|
#if 0 |
|
void make_reduced(VECT b) |
|
{ |
|
int n,i,j; |
|
DP *p; |
|
DP pi; |
|
|
|
n = b->len; |
|
p = (DP *)BDY(b); |
|
if ( BDY(p[0])->dl->td == 0 ) { |
|
b->len = 1; |
|
return; |
|
} |
|
for ( i = 0; i < n; i++ ) { |
|
pi = p[i]; |
|
if ( !pi ) continue; |
|
for ( j = 0; j < n; j++ ) |
|
if ( i != j && p[j] && dp_redble(p[j],pi) ) p[j] = 0; |
|
} |
|
for ( i = j = 0; i < n; i++ ) |
|
if ( p[i] ) p[j++] = p[i]; |
|
b->len = j; |
|
} |
|
|
|
void make_reduced2(VECT b,int k) |
|
{ |
|
int n,i,j,l; |
|
DP *p; |
|
DP pi; |
|
|
|
n = b->len; |
|
p = (DP *)BDY(b); |
|
for ( i = l = k; i < n; i++ ) { |
|
pi = p[i]; |
|
for ( j = 0; j < k; j++ ) |
|
if ( dp_redble(pi,p[j]) ) break; |
|
if ( j == k ) |
|
p[l++] = pi; |
|
} |
|
b->len = l; |
|
} |
|
|
|
struct oEGT eg_comp; |
|
|
|
void mhp_rec(VECT b,VECT x,P t,P *r) |
|
{ |
|
int n,i,j,k,l,i2,y,len; |
|
int *d; |
|
Z mone,z; |
|
DCP dc,dc1; |
|
P s; |
|
P *r2; |
|
DP *p,*q; |
|
DP pi,xj; |
|
VECT c; |
|
struct oEGT eg0,eg1; |
|
|
|
n = b->len; |
|
y = x->len; |
|
p = (DP *)BDY(b); |
|
if ( !n ) { |
|
r[0] = (P)ONE; |
|
return; |
|
} |
|
if ( n == 1 && BDY(p[0])->dl->td == 0 ) { |
|
return; |
|
} |
|
for ( i = 0; i < n; i++ ) |
|
if ( BDY(p[i])->dl->td > 1 ) break; |
|
if ( i == n ) { |
|
r[n] = (P)ONE; |
|
return; |
|
} |
|
get_eg(&eg0); |
|
pi = p[i]; |
|
d = BDY(pi)->dl->d; |
|
for ( j = 0; j < y; j++ ) |
|
if ( d[j] ) break; |
|
xj = BDY(x)[j]; |
|
|
|
MKVECT(c,n); q = (DP *)BDY(c); |
|
for ( i = k = l = 0; i < n; i++ ) |
|
if ( BDY(p[i])->dl->d[j] ) |
|
dp_subd(p[i],xj,&p[k++]); |
|
else |
|
q[l++] = p[i]; |
|
for ( i = k, i2 = 0; i2 < l; i++, i2++ ) |
|
p[i] = q[i2]; |
|
/* b=(b[0]/xj,...,b[k-1]/xj,b[k],...b[n-1]) where |
|
b[0],...,b[k-1] are divisible by k */ |
|
make_reduced2(b,k); |
|
get_eg(&eg1); add_eg(&eg_comp,&eg0,&eg1); |
|
mhp_rec(b,x,t,r); |
|
/* c = (b[0],...,b[l-1],xj) */ |
|
q[l] = xj; c->len = l+1; |
|
r2 = (P *)CALLOC(y+1,sizeof(P)); |
|
mhp_rec(c,x,t,r2); |
|
get_eg(&eg0); |
|
for ( i = 0; i <= y; i++ ) { |
|
mulp(CO,r[i],t,&s); addp(CO,s,r2[i],&r[i]); |
|
} |
|
get_eg(&eg1); add_eg(&eg_comp,&eg0,&eg1); |
|
} |
|
|
|
void Pdp_monomial_hilbert_poincare(NODE arg,LIST *rp) |
|
{ |
|
LIST g,v; |
|
VL vl; |
|
int m,n,i; |
|
VECT b,x; |
|
NODE t,nd; |
|
Z z; |
|
P hp,tv,mt,t1,u,w; |
|
DP *p; |
|
P *plist,*r; |
|
struct order_spec *spec; |
|
struct oEGT eg0,eg1; |
|
|
|
if ( get_opt("hf",&val) && val ) hf = 1; |
|
else hf = 0; |
|
g = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
|
pltovl(v,&vl); |
|
m = length(BDY(g)); MKVECT(b,m); p = (DP *)BDY(b); |
|
for ( t = BDY(g), i = 0; t; t = NEXT(t), i++ ) |
|
ptod(CO,vl,(P)BDY(t),&p[i]); |
|
n = length(BDY(v)); MKVECT(x,n); p = (DP *)BDY(x); |
|
for ( t = BDY(v), i = 0; t; t = NEXT(t), i++ ) |
|
ptod(CO,vl,(P)BDY(t),&p[i]); |
|
create_order_spec(0,0,&spec); initd(spec); |
|
/* create (1,1-t,...,(1-t)^n) */ |
|
plist = (P *)MALLOC((n+1)*sizeof(P)); |
|
/* t1 = 1-t */ |
|
makevar("t",&tv); chsgnp(tv,&mt); addp(CO,mt,(P)ONE,&t1); |
|
for ( plist[0] = (P)ONE, i = 1; i <= n; i++ ) |
|
mulp(CO,plist[i-1],t1,&plist[i]); |
|
r = (P *)CALLOC(n+1,sizeof(P)); |
|
make_reduced(b); |
|
mhp_rec(b,x,tv,r); |
|
for ( hp = 0, i = 0; i <= n; i++ ) { |
|
mulp(CO,plist[i],r[i],&u); addp(CO,u,hp,&w); hp = w; |
|
} |
|
UTOZ(n,z); |
|
if ( !hf ) { |
|
nd = mknode(2,hp,z); |
|
MKLIST(*rp,nd); |
|
} else { |
|
P gcd,q; |
|
int s; |
|
Z qd; |
|
ezgcdp(CO,hp,plist[n],&gcd); |
|
if ( NUM(gcd) ) { |
|
s = n; |
|
q = hp; |
|
} else { |
|
s = n-ZTOS(DC(gcd)); |
|
sdivp(CO,hp,plist[n-s],&q); |
|
} |
|
if ( NUM(q) ) qd = 0; |
|
else qd = DEG(DC(q)); |
|
nd = mknode(4,hp,z,q,qd); |
|
MKLIST(*rp,nd); |
|
} |
|
} |
|
#else |
|
|
|
void dl_print(DL d,int n) |
void dl_print(DL d,int n) |
{ |
{ |
int i; |
int i; |
Line 668 P binpoly(P n,int a,int b) |
|
Line 529 P binpoly(P n,int a,int b) |
|
return r; |
return r; |
} |
} |
|
|
void mhp_to_hf(VL vl,P hp,int n,P *plist,VECT *head,P *hf,Z *den) |
void ibin(unsigned long int n,unsigned long int k,Z *r); |
|
|
|
void mhp_to_hf(VL vl,P hp,int n,P *plist,VECT *head,P *hf) |
{ |
{ |
P tv,gcd,q,h,hphead,tt,ai,hpoly,nv,bp,w; |
P tv,gcd,q,h,hphead,tt,ai,hpoly,nv,bp,w; |
Z d; |
Z d,z; |
DCP dc,topdc; |
DCP dc,topdc; |
VECT hfhead; |
VECT hfhead; |
int i,s,qd; |
int i,s,qd; |
|
|
if ( !hp ) { |
if ( !hp ) { |
MKVECT(hfhead,0); *head = hfhead; |
MKVECT(hfhead,0); *head = hfhead; |
*hf = 0; *den = ONE; |
*hf = 0; |
} else { |
} else { |
makevar("t",&tv); |
makevar("t",&tv); |
ezgcdp(CO,hp,plist[n],&gcd); |
ezgcdp(CO,hp,plist[n],&gcd); |
Line 691 void mhp_to_hf(VL vl,P hp,int n,P *plist,VECT *head,P |
|
Line 554 void mhp_to_hf(VL vl,P hp,int n,P *plist,VECT *head,P |
|
} |
} |
if ( NUM(q) ) qd = 0; |
if ( NUM(q) ) qd = 0; |
else qd = ZTOS(DEG(DC(q))); |
else qd = ZTOS(DEG(DC(q))); |
if ( qd ) { |
if ( s == 0 ) { |
topdc = 0; |
MKVECT(hfhead,qd+1); |
for ( i = 0; i < qd; i++ ) { |
for ( i = 0; i <= qd; i++ ) { |
NEWDC(dc); NEXT(dc) = topdc; |
coefp(q,i,(P *)&BDY(hfhead)[i]); |
ibin(i+s-1,s-1,&COEF(dc)); |
|
STOZ(i,d); DEG(dc) = d; |
|
topdc = dc; |
|
} |
} |
MKP(VR(tv),topdc,h); |
*head = hfhead; |
mulp(CO,h,q,&hphead); |
*hf = 0; |
|
} else { |
|
if ( qd ) { |
|
topdc = 0; |
|
for ( i = 0; i < qd; i++ ) { |
|
NEWDC(dc); NEXT(dc) = topdc; |
|
ibin(i+s-1,s-1,(Z *)&COEF(dc)); |
|
STOZ(i,d); DEG(dc) = d; |
|
topdc = dc; |
|
} |
|
MKP(VR(tv),topdc,h); |
|
mulp(CO,h,q,&hphead); |
|
} |
|
MKVECT(hfhead,qd); |
|
for ( i = 0; i < qd; i++ ) |
|
coefp(hphead,i,(P *)&BDY(hfhead)[i]); |
|
*head = hfhead; |
|
hpoly = 0; |
|
makevar("n",&nv); |
|
for ( i = 0; i <= qd; i++ ) { |
|
coefp(q,i,&ai); |
|
bp = binpoly(nv,s-i-1,s-1); |
|
mulp(CO,ai,bp,&tt); |
|
addp(CO,hpoly,tt,&w); |
|
hpoly = w; |
|
} |
|
if ( s > 2 ) { |
|
factorialz(s-1,&z); |
|
divsp(CO,hpoly,(P)z,&tt); hpoly = tt; |
|
} |
|
*hf = hpoly; |
|
for ( i = qd-1; i >= 0; i-- ) { |
|
UTOZ(i,z); |
|
substp(CO,hpoly,VR(nv),(P)z,&tt); |
|
if ( cmpz((Z)tt,(Z)BDY(hfhead)[i]) ) break; |
|
} |
|
hfhead->len = i+1; |
} |
} |
MKVECT(hfhead,qd); |
|
for ( i = 0; i < qd; i++ ) |
|
coefp(hphead,i,(P *)&BDY(hfhead)[i]); |
|
*head = hfhead; |
|
hpoly = 0; |
|
makevar("n",&nv); |
|
for ( i = 0; i <= qd; i++ ) { |
|
coefp(q,i,&ai); |
|
bp = binpoly(nv,s-i-1,s-1); |
|
mulp(CO,ai,bp,&tt); |
|
addp(CO,hpoly,tt,&w); |
|
hpoly = w; |
|
} |
|
*hf = hpoly; |
|
factorialz(s-1,den); |
|
} |
} |
} |
} |
|
|
Line 781 void Pdp_monomial_hilbert_poincare(NODE arg,LIST *rp) |
|
Line 662 void Pdp_monomial_hilbert_poincare(NODE arg,LIST *rp) |
|
make_reduced(b,n); |
make_reduced(b,n); |
mhp_rec(b,x,tv,r); |
mhp_rec(b,x,tv,r); |
hp = mhp_ctop(r,plist,n); |
hp = mhp_ctop(r,plist,n); |
mhp_to_hf(CO,hp,n,plist,&hfhead,&hpoly,&den); |
mhp_to_hf(CO,hp,n,plist,&hfhead,&hpoly); |
UTOZ(n,z); |
UTOZ(n,z); |
nd = mknode(5,hp,z,hfhead,hpoly,den); |
nd = mknode(4,hp,z,hfhead,hpoly); |
MKLIST(*rp,nd); |
MKLIST(*rp,nd); |
} |
} |
|
|
#endif |
|
|
|
void Pdp_compute_last_t(NODE arg,LIST *rp) |
void Pdp_compute_last_t(NODE arg,LIST *rp) |
{ |
{ |
NODE g,gh,homo,n; |
NODE g,gh,homo,n; |
Line 945 void Pdp_cont(NODE arg,Z *rp) |
|
Line 824 void Pdp_cont(NODE arg,Z *rp) |
|
dp_cont((DP)ARG0(arg),rp); |
dp_cont((DP)ARG0(arg),rp); |
} |
} |
|
|
|
void dpm_ptozp(DPM p,Z *cont,DPM *r); |
|
|
|
void Pdpm_remove_cont(NODE arg,LIST *rp) |
|
{ |
|
NODE nd; |
|
Z cont; |
|
DPM p; |
|
|
|
dpm_ptozp((DPM)ARG0(arg),&cont,&p); |
|
nd = mknode(2,cont,p); |
|
MKLIST(*rp,nd); |
|
} |
|
|
void Pdp_dtov(NODE arg,VECT *rp) |
void Pdp_dtov(NODE arg,VECT *rp) |
{ |
{ |
dp_dtov((DP)ARG0(arg),rp); |
dp_dtov((DP)ARG0(arg),rp); |
Line 1046 void Pdp_nf_tab_f(NODE arg,DP *rp) |
|
Line 938 void Pdp_nf_tab_f(NODE arg,DP *rp) |
|
dp_nf_tab_f((DP)ARG0(arg),(LIST *)BDY((VECT)ARG1(arg)),rp); |
dp_nf_tab_f((DP)ARG0(arg),(LIST *)BDY((VECT)ARG1(arg)),rp); |
} |
} |
|
|
|
extern int dpm_ordtype; |
|
|
void Pdp_ord(NODE arg,Obj *rp) |
void Pdp_ord(NODE arg,Obj *rp) |
{ |
{ |
struct order_spec *spec; |
struct order_spec *spec; |
Line 1063 void Pdp_ord(NODE arg,Obj *rp) |
|
Line 957 void Pdp_ord(NODE arg,Obj *rp) |
|
else if ( !create_order_spec(0,(Obj)ARG0(arg),&spec) ) |
else if ( !create_order_spec(0,(Obj)ARG0(arg),&spec) ) |
error("dp_ord : invalid order specification"); |
error("dp_ord : invalid order specification"); |
initd(spec); *rp = spec->obj; |
initd(spec); *rp = spec->obj; |
|
if ( spec->id >= 256 ) dpm_ordtype = spec->module_ordtype; |
} |
} |
} |
} |
|
|
Line 1213 void Pdpm_ltod(NODE arg,DPM *rp) |
|
Line 1108 void Pdpm_ltod(NODE arg,DPM *rp) |
|
|
|
nd = BDY(f); |
nd = BDY(f); |
len = length(nd); |
len = length(nd); |
for ( i = 0, t = nd, s = 0; i < len; i++, t = NEXT(t) ) { |
for ( i = 1, t = nd, s = 0; i <= len; i++, t = NEXT(t) ) { |
ptod(CO,vl,(P)BDY(t),&d); |
ptod(CO,vl,(P)BDY(t),&d); |
dtodpm(d,i,&u); |
dtodpm(d,i,&u); |
adddpm(CO,s,u,&w); s = w; |
adddpm(CO,s,u,&w); s = w; |
Line 1221 void Pdpm_ltod(NODE arg,DPM *rp) |
|
Line 1116 void Pdpm_ltod(NODE arg,DPM *rp) |
|
*rp = s; |
*rp = s; |
} |
} |
|
|
|
// c*[monomial,i]+... -> c*<<monomial:i>>+... |
|
|
|
void Pdpm_dptodpm(NODE arg,DPM *rp) |
|
{ |
|
DP p; |
|
MP mp; |
|
int pos,shift; |
|
DMM m0,m; |
|
|
|
p = (DP)ARG0(arg); |
|
pos = ZTOS((Z)ARG1(arg)); |
|
if ( pos <= 0 ) |
|
error("dpm_mtod : position must be positive"); |
|
if ( !p ) *rp = 0; |
|
else { |
|
for ( m0 = 0, mp = BDY(p); mp; mp = NEXT(mp) ) { |
|
NEXTDMM(m0,m); m->dl = mp->dl; m->c = mp->c; m->pos = pos; |
|
} |
|
if ( dp_current_spec->module_top_weight ) { |
|
if ( pos > dp_current_spec->module_rank ) |
|
error("dpm_dptodpm : inconsistent order spec"); |
|
shift = dp_current_spec->module_top_weight[pos-1]; |
|
m->dl->td += shift; |
|
} else |
|
shift = 0; |
|
|
|
MKDPM(p->nv,m0,*rp); (*rp)->sugar = p->sugar+shift; |
|
} |
|
} |
|
|
void Pdpm_dtol(NODE arg,LIST *rp) |
void Pdpm_dtol(NODE arg,LIST *rp) |
{ |
{ |
DPM a; |
DPM a; |
Line 1235 void Pdpm_dtol(NODE arg,LIST *rp) |
|
Line 1160 void Pdpm_dtol(NODE arg,LIST *rp) |
|
Obj s; |
Obj s; |
|
|
a = (DPM)ARG0(arg); |
a = (DPM)ARG0(arg); |
|
if ( !a ) { |
|
MKLIST(*rp,0); |
|
return; |
|
} |
for ( vl = 0, nd = BDY((LIST)ARG1(arg)), nv = 0; nd; nd = NEXT(nd), nv++ ) { |
for ( vl = 0, nd = BDY((LIST)ARG1(arg)), nv = 0; nd; nd = NEXT(nd), nv++ ) { |
if ( !vl ) { |
if ( !vl ) { |
NEWVL(vl); tvl = vl; |
NEWVL(vl); tvl = vl; |
Line 1245 void Pdpm_dtol(NODE arg,LIST *rp) |
|
Line 1174 void Pdpm_dtol(NODE arg,LIST *rp) |
|
} |
} |
if ( vl ) |
if ( vl ) |
NEXT(tvl) = 0; |
NEXT(tvl) = 0; |
n = ZTOS((Q)ARG2(arg)); |
for ( t = BDY(a), n = 0; t; t = NEXT(t) ) |
|
if ( t->pos > n ) n = t->pos; |
w = (MP *)CALLOC(n,sizeof(MP)); |
w = (MP *)CALLOC(n,sizeof(MP)); |
for ( t = BDY(a), len = 0; t; t = NEXT(t) ) len++; |
for ( t = BDY(a), len = 0; t; t = NEXT(t) ) len++; |
wa = (DMM *)MALLOC(len*sizeof(DMM)); |
wa = (DMM *)MALLOC(len*sizeof(DMM)); |
Line 1253 void Pdpm_dtol(NODE arg,LIST *rp) |
|
Line 1183 void Pdpm_dtol(NODE arg,LIST *rp) |
|
for ( i = len-1; i >= 0; i-- ) { |
for ( i = len-1; i >= 0; i-- ) { |
NEWMP(m); m->dl = wa[i]->dl; C(m) = C(wa[i]); |
NEWMP(m); m->dl = wa[i]->dl; C(m) = C(wa[i]); |
pos = wa[i]->pos; |
pos = wa[i]->pos; |
NEXT(m) = w[pos]; |
NEXT(m) = w[pos-1]; |
w[pos] = m; |
w[pos-1] = m; |
} |
} |
nd = 0; |
nd = 0; |
for ( i = n-1; i >= 0; i-- ) { |
for ( i = n-1; i >= 0; i-- ) { |
Line 1414 void Pdp_weyl_nf(NODE arg,DP *rp) |
|
Line 1344 void Pdp_weyl_nf(NODE arg,DP *rp) |
|
void Pdpm_nf(NODE arg,DPM *rp) |
void Pdpm_nf(NODE arg,DPM *rp) |
{ |
{ |
NODE b; |
NODE b; |
DPM *ps; |
VECT ps; |
DPM g; |
DPM g; |
int full; |
int ac,full; |
|
|
if ( !(g = (DPM)ARG1(arg)) ) { |
if ( !(g = (DPM)ARG1(arg)) ) { |
*rp = 0; return; |
*rp = 0; return; |
} |
} |
do_weyl = 0; dp_fcoeffs = 0; |
do_weyl = 0; dp_fcoeffs = 0; |
asir_assert(ARG0(arg),O_LIST,"dpm_nf"); |
ac = argc(arg); |
asir_assert(ARG1(arg),O_DPM,"dpm_nf"); |
if ( ac < 3 ) |
asir_assert(ARG2(arg),O_VECT,"dpm_nf"); |
error("dpm_nf: invalid arguments"); |
asir_assert(ARG3(arg),O_N,"dpm_nf"); |
else if ( ac == 3 ) { |
b = BDY((LIST)ARG0(arg)); ps = (DPM *)BDY((VECT)ARG2(arg)); |
asir_assert(ARG1(arg),O_VECT,"dpm_nf"); |
full = (Q)ARG3(arg) ? 1 : 0; |
b = 0; g = (DPM)ARG0(arg); ps = (VECT)ARG1(arg); |
|
} else if ( ac == 4 ) { |
|
asir_assert(ARG0(arg),O_LIST,"dpm_nf"); |
|
asir_assert(ARG2(arg),O_VECT,"dpm_nf"); |
|
b = BDY((LIST)ARG0(arg)); g = (DPM)ARG1(arg); ps = (VECT)ARG2(arg); |
|
full = (Q)ARG3(arg) ? 1 : 0; |
|
} |
dpm_nf_z(b,g,ps,full,DP_Multiple,rp); |
dpm_nf_z(b,g,ps,full,DP_Multiple,rp); |
} |
} |
|
|
|
DP *dpm_nf_and_quotient(NODE b,DPM g,VECT ps,DPM *rp,P *dnp); |
|
DPM dpm_nf_and_quotient2(NODE b,DPM g,VECT ps,DPM *rp,P *dnp); |
|
|
|
void Pdpm_nf_and_quotient(NODE arg,LIST *rp) |
|
{ |
|
NODE b; |
|
VECT ps; |
|
DPM g,nm; |
|
P dn; |
|
VECT quo; |
|
NODE n; |
|
int ac; |
|
|
|
do_weyl = 0; dp_fcoeffs = 0; |
|
ac = argc(arg); |
|
if ( ac < 2 ) |
|
error("dpm_nf_and_quotient : invalid arguments"); |
|
else if ( ac == 2 ) { |
|
asir_assert(ARG1(arg),O_VECT,"dpm_nf_and_quotient"); |
|
b = 0; g = (DPM)ARG0(arg); ps = (VECT)ARG1(arg); |
|
} else if ( ac == 3 ) { |
|
asir_assert(ARG0(arg),O_LIST,"dpm_nf_and_quotient"); |
|
asir_assert(ARG2(arg),O_VECT,"dpm_nf_and_quotient"); |
|
b = BDY((LIST)ARG0(arg)); g = (DPM)ARG1(arg); ps = (VECT)ARG2(arg); |
|
} |
|
NEWVECT(quo); quo->len = ps->len; |
|
if ( g ) { |
|
quo->body = (pointer *)dpm_nf_and_quotient(b,g,ps,&nm,&dn); |
|
} else { |
|
quo->body = (pointer *)MALLOC(quo->len*sizeof(pointer)); |
|
nm = 0; dn = (P)ONE; |
|
} |
|
n = mknode(3,nm,dn,quo); |
|
MKLIST(*rp,n); |
|
} |
|
|
|
void Pdpm_nf_and_quotient2(NODE arg,LIST *rp) |
|
{ |
|
NODE b; |
|
VECT ps; |
|
DPM g,nm,q; |
|
P dn; |
|
NODE n; |
|
int ac; |
|
|
|
do_weyl = 0; dp_fcoeffs = 0; |
|
ac = argc(arg); |
|
if ( ac < 2 ) |
|
error("dpm_nf_and_quotient2 : invalid arguments"); |
|
else if ( ac == 2 ) { |
|
asir_assert(ARG1(arg),O_VECT,"dpm_nf_and_quotient2"); |
|
b = 0; g = (DPM)ARG0(arg); ps = (VECT)ARG1(arg); |
|
} else if ( ac == 3 ) { |
|
asir_assert(ARG0(arg),O_LIST,"dpm_nf_and_quotient2"); |
|
asir_assert(ARG2(arg),O_VECT,"dpm_nf_and_quotient2"); |
|
b = BDY((LIST)ARG0(arg)); g = (DPM)ARG1(arg); ps = (VECT)ARG2(arg); |
|
} |
|
if ( g ) { |
|
q = dpm_nf_and_quotient2(b,g,ps,&nm,&dn); |
|
} else { |
|
q = 0; nm = 0; dn = (P)ONE; |
|
} |
|
n = mknode(3,nm,dn,q); |
|
MKLIST(*rp,n); |
|
} |
|
|
void Pdpm_weyl_nf(NODE arg,DPM *rp) |
void Pdpm_weyl_nf(NODE arg,DPM *rp) |
{ |
{ |
NODE b; |
NODE b; |
DPM *ps; |
VECT ps; |
DPM g; |
DPM g; |
int full; |
int ac,full; |
|
|
if ( !(g = (DPM)ARG1(arg)) ) { |
if ( !(g = (DPM)ARG1(arg)) ) { |
*rp = 0; return; |
*rp = 0; return; |
} |
} |
asir_assert(ARG0(arg),O_LIST,"dpm_weyl_nf"); |
do_weyl = 1; dp_fcoeffs = 0; |
asir_assert(ARG1(arg),O_DPM,"dpm_weyl_nf"); |
ac = argc(arg); |
asir_assert(ARG2(arg),O_VECT,"dpm_weyl_nf"); |
if ( ac < 3 ) |
asir_assert(ARG3(arg),O_N,"dpm_weyl_nf"); |
error("dpm_weyl_nf: invalid arguments"); |
b = BDY((LIST)ARG0(arg)); ps = (DPM *)BDY((VECT)ARG2(arg)); |
else if ( ac == 3 ) { |
full = (Q)ARG3(arg) ? 1 : 0; |
asir_assert(ARG1(arg),O_VECT,"dpm_nf"); |
do_weyl = 1; |
b = 0; g = (DPM)ARG0(arg); ps = (VECT)ARG1(arg); |
|
} else if ( ac == 4 ) { |
|
asir_assert(ARG0(arg),O_LIST,"dpm_weyl_nf"); |
|
asir_assert(ARG2(arg),O_VECT,"dpm_weyl_nf"); |
|
b = BDY((LIST)ARG0(arg)); g = (DPM)ARG1(arg); ps = (VECT)ARG2(arg); |
|
full = (Q)ARG3(arg) ? 1 : 0; |
|
} |
dpm_nf_z(b,g,ps,full,DP_Multiple,rp); |
dpm_nf_z(b,g,ps,full,DP_Multiple,rp); |
do_weyl = 0; |
do_weyl = 0; |
} |
} |
Line 1498 void Pdp_weyl_nf_f(NODE arg,DP *rp) |
|
Line 1506 void Pdp_weyl_nf_f(NODE arg,DP *rp) |
|
void Pdpm_nf_f(NODE arg,DPM *rp) |
void Pdpm_nf_f(NODE arg,DPM *rp) |
{ |
{ |
NODE b; |
NODE b; |
DPM *ps; |
VECT ps; |
DPM g; |
DPM g; |
int full; |
int ac,full; |
|
|
if ( !(g = (DPM)ARG1(arg)) ) { |
if ( !(g = (DPM)ARG1(arg)) ) { |
*rp = 0; return; |
*rp = 0; return; |
} |
} |
asir_assert(ARG0(arg),O_LIST,"dpm_nf_f"); |
ac = argc(arg); |
asir_assert(ARG1(arg),O_DPM,"dpm_nf_f"); |
if ( ac < 3 ) |
asir_assert(ARG2(arg),O_VECT,"dpm_nf_f"); |
error("dpm_nf_f: invalid arguments"); |
asir_assert(ARG3(arg),O_N,"dpm_nf_f"); |
else if ( ac == 3 ) { |
b = BDY((LIST)ARG0(arg)); ps = (DPM *)BDY((VECT)ARG2(arg)); |
asir_assert(ARG1(arg),O_VECT,"dpm_nf_f"); |
full = (Q)ARG3(arg) ? 1 : 0; |
b = 0; g = (DPM)ARG0(arg); ps = (VECT)ARG1(arg); |
|
} else if ( ac == 4 ) { |
|
asir_assert(ARG0(arg),O_LIST,"dpm_nf_f"); |
|
asir_assert(ARG2(arg),O_VECT,"dpm_nf_f"); |
|
b = BDY((LIST)ARG0(arg)); g = (DPM)ARG1(arg); ps = (VECT)ARG2(arg); |
|
full = (Q)ARG3(arg) ? 1 : 0; |
|
} |
|
do_weyl = 0; |
dpm_nf_f(b,g,ps,full,rp); |
dpm_nf_f(b,g,ps,full,rp); |
} |
} |
|
|
void Pdpm_weyl_nf_f(NODE arg,DPM *rp) |
void Pdpm_weyl_nf_f(NODE arg,DPM *rp) |
{ |
{ |
NODE b; |
NODE b; |
DPM *ps; |
VECT ps; |
DPM g; |
DPM g; |
int full; |
int ac,full; |
|
|
if ( !(g = (DPM)ARG1(arg)) ) { |
if ( !(g = (DPM)ARG1(arg)) ) { |
*rp = 0; return; |
*rp = 0; return; |
} |
} |
asir_assert(ARG0(arg),O_LIST,"dpm_weyl_nf_f"); |
ac = argc(arg); |
asir_assert(ARG1(arg),O_DP,"dpm_weyl_nf_f"); |
if ( ac < 3 ) |
asir_assert(ARG2(arg),O_VECT,"dpm_weyl_nf_f"); |
error("dpm_weyl_nf_f: invalid arguments"); |
asir_assert(ARG3(arg),O_N,"dpm_weyl_nf_f"); |
else if ( ac == 3 ) { |
b = BDY((LIST)ARG0(arg)); ps = (DPM *)BDY((VECT)ARG2(arg)); |
asir_assert(ARG1(arg),O_VECT,"dpm_weyl_nf_f"); |
full = (Q)ARG3(arg) ? 1 : 0; |
b = 0; g = (DPM)ARG0(arg); ps = (VECT)ARG1(arg); |
|
} else if ( ac == 4 ) { |
|
asir_assert(ARG0(arg),O_LIST,"dpm_weyl_nf_f"); |
|
asir_assert(ARG2(arg),O_VECT,"dpm_weyl_nf_f"); |
|
b = BDY((LIST)ARG0(arg)); g = (DPM)ARG1(arg); ps = (VECT)ARG2(arg); |
|
full = (Q)ARG3(arg) ? 1 : 0; |
|
} |
do_weyl = 1; |
do_weyl = 1; |
dpm_nf_f(b,g,ps,full,rp); |
dpm_nf_f(b,g,ps,full,rp); |
do_weyl = 0; |
do_weyl = 0; |
Line 1912 void Pdp_redble(NODE arg,Z *rp) |
|
Line 1933 void Pdp_redble(NODE arg,Z *rp) |
|
*rp = 0; |
*rp = 0; |
} |
} |
|
|
|
void Pdpm_redble(NODE arg,Z *rp) |
|
{ |
|
asir_assert(ARG0(arg),O_DPM,"dpm_redble"); |
|
asir_assert(ARG1(arg),O_DPM,"dpm_redble"); |
|
if ( dpm_redble((DPM)ARG0(arg),(DPM)ARG1(arg)) ) |
|
*rp = ONE; |
|
else |
|
*rp = 0; |
|
} |
|
|
|
void dpm_schreyer_base(LIST g,LIST *s); |
|
void dpm_schreyer_base_zlist(LIST g,LIST *s); |
|
|
|
void Pdpm_schreyer_base(NODE arg,LIST *rp) |
|
{ |
|
asir_assert(ARG0(arg),O_LIST,"dpm_schreyer_base"); |
|
dpm_schreyer_base_zlist((LIST)ARG0(arg),rp); |
|
} |
|
|
|
void dpm_list_to_array(LIST g,VECT *psv,VECT *psiv); |
|
|
|
void Pdpm_list_to_array(NODE arg,LIST *rp) |
|
{ |
|
VECT psv,psiv; |
|
NODE nd; |
|
|
|
asir_assert(ARG0(arg),O_LIST,"dpm_list_to_array"); |
|
dpm_list_to_array((LIST)ARG0(arg),&psv,&psiv); |
|
nd = mknode(2,psv,psiv); |
|
MKLIST(*rp,nd); |
|
} |
|
|
|
/* [quo,nf] = dpm_sp_nf(psv,psiv,i,j,top) */ |
|
DPM dpm_sp_nf_zlist(VECT psv,VECT psiv,int i,int j,int top,DPM *nf); |
|
|
|
void Pdpm_sp_nf(NODE arg,LIST *rp) |
|
{ |
|
VECT psv,psiv; |
|
DPM quo,nf; |
|
Obj val; |
|
int i,j,top; |
|
NODE nd; |
|
|
|
asir_assert(ARG0(arg),O_VECT,"dpm_sp_nf"); psv = (VECT)ARG0(arg); |
|
asir_assert(ARG1(arg),O_VECT,"dpm_sp_nf"); psiv = (VECT)ARG1(arg); |
|
asir_assert(ARG2(arg),O_N,"dpm_sp_nf"); i = ZTOS((Q)ARG2(arg)); |
|
asir_assert(ARG3(arg),O_N,"dpm_sp_nf"); j = ZTOS((Q)ARG3(arg)); |
|
if ( get_opt("top",&val) && val ) |
|
top = 1; |
|
else |
|
top = 0; |
|
quo = dpm_sp_nf_zlist(psv,psiv,i,j,top,&nf); |
|
nd = mknode(2,quo,nf); |
|
MKLIST(*rp,nd); |
|
} |
|
|
|
void dpm_insert_to_zlist(VECT psiv,int pos,int i); |
|
|
|
/* insert_to_zlist(indarray,dpm_hp(f),i) */ |
|
void Pdpm_insert_to_zlist(NODE arg,VECT *rp) |
|
{ |
|
VECT psiv; |
|
int i,pos; |
|
|
|
asir_assert(ARG0(arg),O_VECT,"dpm_insert_to_zlist"); psiv = (VECT)ARG0(arg); |
|
asir_assert(ARG1(arg),O_N,"dpm_insert_to_zlist"); pos = ZTOS((Q)ARG1(arg)); |
|
asir_assert(ARG2(arg),O_N,"dpm_insert_to_zlist"); i = ZTOS((Q)ARG2(arg)); |
|
dpm_insert_to_zlist(psiv,pos,i); |
|
*rp = psiv; |
|
} |
|
|
|
|
|
void dpm_simplify_syz(LIST m,LIST s,LIST *m1,LIST *s1,LIST *w1); |
|
|
|
void Pdpm_simplify_syz(NODE arg,LIST *rp) |
|
{ |
|
LIST s1,m1,w1; |
|
NODE t; |
|
|
|
asir_assert(ARG0(arg),O_LIST,"dpm_simplify_syz"); |
|
asir_assert(ARG1(arg),O_LIST,"dpm_simplify_syz"); |
|
dpm_simplify_syz((LIST)ARG0(arg),(LIST)ARG1(arg),&s1,&m1,&w1); |
|
t = mknode(3,s1,m1,w1); |
|
MKLIST(*rp,t); |
|
} |
|
|
|
|
void Pdp_red_mod(NODE arg,LIST *rp) |
void Pdp_red_mod(NODE arg,LIST *rp) |
{ |
{ |
DP h,r; |
DP h,r; |
Line 2074 void Pdp_weyl_sp(NODE arg,DP *rp) |
|
Line 2182 void Pdp_weyl_sp(NODE arg,DP *rp) |
|
do_weyl = 0; |
do_weyl = 0; |
} |
} |
|
|
void Pdpm_sp(NODE arg,DPM *rp) |
void Pdpm_sp(NODE arg,Obj *rp) |
{ |
{ |
DPM p1,p2; |
DPM p1,p2,sp; |
|
DP mul1,mul2; |
|
Obj val; |
|
NODE nd; |
|
LIST l; |
|
|
do_weyl = 0; |
do_weyl = 0; |
p1 = (DPM)ARG0(arg); p2 = (DPM)ARG1(arg); |
p1 = (DPM)ARG0(arg); p2 = (DPM)ARG1(arg); |
asir_assert(p1,O_DPM,"dpm_sp"); asir_assert(p2,O_DPM,"dpm_sp"); |
asir_assert(p1,O_DPM,"dpm_sp"); asir_assert(p2,O_DPM,"dpm_sp"); |
dpm_sp(p1,p2,rp); |
dpm_sp(p1,p2,&sp,&mul1,&mul2); |
|
if ( get_opt("coef",&val) && val ) { |
|
nd = mknode(3,sp,mul1,mul2); |
|
MKLIST(l,nd); |
|
*rp = (Obj)l; |
|
} else { |
|
*rp = (Obj)sp; |
|
} |
} |
} |
|
|
void Pdpm_weyl_sp(NODE arg,DPM *rp) |
void Pdpm_weyl_sp(NODE arg,Obj *rp) |
{ |
{ |
DPM p1,p2; |
DPM p1,p2,sp; |
|
DP mul1,mul2; |
|
Obj val; |
|
NODE nd; |
|
LIST l; |
|
|
p1 = (DPM)ARG0(arg); p2 = (DPM)ARG1(arg); |
p1 = (DPM)ARG0(arg); p2 = (DPM)ARG1(arg); |
asir_assert(p1,O_DPM,"dpm_weyl_sp"); asir_assert(p2,O_DPM,"dpm_weyl_sp"); |
asir_assert(p1,O_DPM,"dpm_weyl_sp"); asir_assert(p2,O_DPM,"dpm_weyl_sp"); |
do_weyl = 1; |
do_weyl = 1; |
dpm_sp(p1,p2,rp); |
dpm_sp(p1,p2,&sp,&mul1,&mul2); |
do_weyl = 0; |
do_weyl = 0; |
|
if ( get_opt("coef",&val) && val ) { |
|
nd = mknode(3,sp,mul1,mul2); |
|
MKLIST(l,nd); |
|
*rp = (Obj)l; |
|
} else { |
|
*rp = (Obj)sp; |
|
} |
} |
} |
|
|
void Pdp_sp_mod(NODE arg,DP *rp) |
void Pdp_sp_mod(NODE arg,DP *rp) |
Line 2173 void Pdp_td(NODE arg,Z *rp) |
|
Line 2303 void Pdp_td(NODE arg,Z *rp) |
|
STOZ(BDY(p)->dl->td,*rp); |
STOZ(BDY(p)->dl->td,*rp); |
} |
} |
|
|
|
void Pdpm_td(NODE arg,Z *rp) |
|
{ |
|
DPM p; |
|
|
|
p = (DPM)ARG0(arg); asir_assert(p,O_DPM,"dpm_td"); |
|
if ( !p ) |
|
*rp = 0; |
|
else |
|
STOZ(BDY(p)->dl->td,*rp); |
|
} |
|
|
void Pdp_sugar(NODE arg,Z *rp) |
void Pdp_sugar(NODE arg,Z *rp) |
{ |
{ |
DP p; |
DP p; |
Line 2413 void Pdp_dehomo(NODE arg,DP *rp) |
|
Line 2554 void Pdp_dehomo(NODE arg,DP *rp) |
|
dp_dehomo((DP)ARG0(arg),rp); |
dp_dehomo((DP)ARG0(arg),rp); |
} |
} |
|
|
|
void dpm_homo(DPM a,DPM *b); |
|
void dpm_dehomo(DPM a,DPM *b); |
|
|
|
void Pdpm_homo(NODE arg,DPM *rp) |
|
{ |
|
asir_assert(ARG0(arg),O_DPM,"dpm_homo"); |
|
dpm_homo((DPM)ARG0(arg),rp); |
|
} |
|
|
|
void Pdpm_dehomo(NODE arg,DPM *rp) |
|
{ |
|
asir_assert(ARG0(arg),O_DPM,"dpm_dehomo"); |
|
dpm_dehomo((DPM)ARG0(arg),rp); |
|
} |
|
|
|
|
void Pdp_gr_flags(NODE arg,LIST *rp) |
void Pdp_gr_flags(NODE arg,LIST *rp) |
{ |
{ |
Obj name,value; |
Obj name,value; |
Line 2962 void Pnd_gr_trace(NODE arg,LIST *rp) |
|
Line 3119 void Pnd_gr_trace(NODE arg,LIST *rp) |
|
{ |
{ |
LIST f,v; |
LIST f,v; |
int m,homo,ac; |
int m,homo,ac; |
|
Obj val; |
|
int retdp; |
Num nhomo; |
Num nhomo; |
struct order_spec *ord; |
struct order_spec *ord; |
|
|
Line 2985 void Pnd_gr_trace(NODE arg,LIST *rp) |
|
Line 3144 void Pnd_gr_trace(NODE arg,LIST *rp) |
|
homo = ZTOS((Q)nhomo); |
homo = ZTOS((Q)nhomo); |
} else |
} else |
error("nd_gr_trace : invalid argument"); |
error("nd_gr_trace : invalid argument"); |
nd_gr_trace(f,v,m,homo,0,ord,rp); |
retdp = 0; |
|
if ( get_opt("dp",&val) && val ) retdp = 1; |
|
nd_gr_trace(f,v,m,homo,retdp,0,ord,rp); |
} |
} |
|
|
void Pnd_f4_trace(NODE arg,LIST *rp) |
void Pnd_f4_trace(NODE arg,LIST *rp) |
{ |
{ |
LIST f,v; |
LIST f,v; |
int m,homo,ac; |
int m,homo,ac; |
|
int retdp; |
|
Obj val; |
Num nhomo; |
Num nhomo; |
struct order_spec *ord; |
struct order_spec *ord; |
|
|
Line 3015 void Pnd_f4_trace(NODE arg,LIST *rp) |
|
Line 3178 void Pnd_f4_trace(NODE arg,LIST *rp) |
|
homo = ZTOS((Q)nhomo); |
homo = ZTOS((Q)nhomo); |
} else |
} else |
error("nd_gr_trace : invalid argument"); |
error("nd_gr_trace : invalid argument"); |
nd_gr_trace(f,v,m,homo,1,ord,rp); |
retdp = 0; |
|
if ( get_opt("dp",&val) && val ) retdp = 1; |
|
nd_gr_trace(f,v,m,homo,retdp,1,ord,rp); |
} |
} |
|
|
void Pnd_weyl_gr(NODE arg,LIST *rp) |
void Pnd_weyl_gr(NODE arg,LIST *rp) |
Line 3056 void Pnd_weyl_gr(NODE arg,LIST *rp) |
|
Line 3221 void Pnd_weyl_gr(NODE arg,LIST *rp) |
|
void Pnd_weyl_gr_trace(NODE arg,LIST *rp) |
void Pnd_weyl_gr_trace(NODE arg,LIST *rp) |
{ |
{ |
LIST f,v; |
LIST f,v; |
int m,homo,ac; |
int m,homo,ac,retdp; |
|
Obj val; |
Num nhomo; |
Num nhomo; |
struct order_spec *ord; |
struct order_spec *ord; |
|
|
Line 3080 void Pnd_weyl_gr_trace(NODE arg,LIST *rp) |
|
Line 3246 void Pnd_weyl_gr_trace(NODE arg,LIST *rp) |
|
homo = ZTOS((Q)nhomo); |
homo = ZTOS((Q)nhomo); |
} else |
} else |
error("nd_weyl_gr_trace : invalid argument"); |
error("nd_weyl_gr_trace : invalid argument"); |
nd_gr_trace(f,v,m,homo,0,ord,rp); |
retdp = 0; |
|
if ( get_opt("dp",&val) && val ) retdp = 1; |
|
nd_gr_trace(f,v,m,homo,retdp,0,ord,rp); |
do_weyl = 0; |
do_weyl = 0; |
} |
} |
|
|
Line 3899 void Pdpv_ord(NODE arg,Obj *rp) |
|
Line 4067 void Pdpv_ord(NODE arg,Obj *rp) |
|
*rp = dp_current_modspec->obj; |
*rp = dp_current_modspec->obj; |
} |
} |
|
|
extern int dpm_ispot; |
extern int dpm_ordtype; |
|
extern DMMstack dmm_stack; |
|
|
void Pdpm_ord(NODE arg,LIST *rp) |
void set_schreyer_order(LIST n); |
|
|
|
void Pdpm_set_schreyer(NODE arg,LIST *rp) |
{ |
{ |
Z q; |
if ( argc(arg) ) { |
NODE nd; |
set_schreyer_order(ARG0(arg)?(LIST)ARG0(arg):0); |
struct order_spec *spec; |
|
|
|
if ( arg ) { |
|
nd = BDY((LIST)ARG0(arg)); |
|
if ( !create_order_spec(0,(Obj)ARG1(nd),&spec) ) |
|
error("dpm_ord : invalid order specification"); |
|
initdpm(spec,ZTOS((Q)ARG0(nd))); |
|
} |
} |
STOZ(dpm_ispot,q); |
if ( dmm_stack ) |
nd = mknode(2,q,dp_current_spec->obj); |
*rp = dmm_stack->obj; |
MKLIST(*rp,nd); |
else |
|
*rp = 0; |
} |
} |
|
|
|
DMMstack_array Schreyer_Frame; |
|
DMMstack_array dpm_schreyer_frame(NODE n); |
|
void set_schreyer_level(DMMstack_array array,int level); |
|
|
|
void Pdpm_set_schreyer_level(NODE arg,Q *rp) |
|
{ |
|
set_schreyer_level(Schreyer_Frame,ZTOS((Q)ARG0(arg))); |
|
*rp = (Q)ARG0(arg); |
|
} |
|
|
|
DPM dmmtodpm(DMM d) |
|
{ |
|
} |
|
|
|
void Pdpm_schreyer_frame(NODE arg,LIST *rp) |
|
{ |
|
DMMstack_array a; |
|
DMMstack *body; |
|
DMM *in,*sum; |
|
DPM f,s; |
|
NODE b,b1,nd; |
|
LIST l; |
|
VECT v; |
|
Z lev,deg,ind; |
|
int len,i,nv,rank,j; |
|
|
|
Schreyer_Frame = a = dpm_schreyer_frame(BDY((LIST)ARG0(arg))); |
|
len = a->len; |
|
body = a->body; |
|
/* XXX */ |
|
nv = ((DPM)BDY(BDY((LIST)body[0]->obj)))->nv; |
|
b = 0; |
|
for ( i = 0; i < len; i++ ) { |
|
rank = body[i]->rank; |
|
in = body[i]->in; |
|
sum = body[i]->sum; |
|
MKVECT(v,rank+1); |
|
STOZ(i+1,lev); |
|
for ( j = 1; j <= rank; j++ ) { |
|
MKDPM(nv,in[j],f); f->sugar = in[j]->dl->td; |
|
MKDPM(nv,sum[j],s);s->sugar = sum[j]->dl->td; |
|
STOZ(s->sugar,deg); |
|
STOZ(j,ind); |
|
nd = mknode(5,f,s,ind,lev,deg); |
|
MKLIST(l,nd); |
|
BDY(v)[j] = (pointer)l; |
|
} |
|
MKNODE(b1,(pointer)v,b); |
|
b = b1; |
|
} |
|
MKLIST(l,b); |
|
*rp = l; |
|
} |
|
|
|
|
void Pdpm_hm(NODE arg,DPM *rp) |
void Pdpm_hm(NODE arg,DPM *rp) |
{ |
{ |
DPM p; |
DPM p; |
Line 3930 void Pdpm_ht(NODE arg,DPM *rp) |
|
Line 4150 void Pdpm_ht(NODE arg,DPM *rp) |
|
{ |
{ |
DPM p; |
DPM p; |
|
|
p = (DPM)ARG0(arg); asir_assert(p,O_DPM,"dp_ht"); |
p = (DPM)ARG0(arg); asir_assert(p,O_DPM,"dpm_ht"); |
dpm_ht(p,rp); |
dpm_ht(p,rp); |
} |
} |
|
|
void Pdpm_hc(NODE arg,Obj *rp) |
void dpm_rest(DPM p,DPM *r); |
|
|
|
void Pdpm_rest(NODE arg,DPM *rp) |
{ |
{ |
|
DPM p; |
|
|
|
p = (DPM)ARG0(arg); asir_assert(p,O_DPM,"dpm_ht"); |
|
dpm_rest(p,rp); |
|
} |
|
|
|
|
|
void Pdpm_hp(NODE arg,Z *rp) |
|
{ |
|
DPM p; |
|
int pos; |
|
|
|
p = (DPM)ARG0(arg); asir_assert(p,O_DPM,"dpm_ht"); |
|
pos = BDY(p)->pos; |
|
STOZ(pos,*rp); |
|
} |
|
|
|
void dpm_shift(DPM p,int s,DPM *rp); |
|
|
|
void Pdpm_shift(NODE arg,DPM *rp) |
|
{ |
|
DPM p; |
|
int s; |
|
|
|
p = (DPM)ARG0(arg); asir_assert(p,O_DPM,"dpm_shift"); |
|
s = ZTOS((Z)ARG1(arg)); |
|
dpm_shift(p,s,rp); |
|
} |
|
|
|
void dpm_sort(DPM p,DPM *rp); |
|
|
|
void Pdpm_sort(NODE arg,DPM *rp) |
|
{ |
|
DPM p; |
|
int s; |
|
|
|
p = (DPM)ARG0(arg); |
|
if ( !p ) *rp = 0; |
|
else dpm_sort(p,rp); |
|
} |
|
|
|
void dpm_split(DPM p,int s,DPM *up,DPM *lo); |
|
void dpm_extract(DPM p,int s,DP *r); |
|
|
|
void Pdpm_split(NODE arg,LIST *rp) |
|
{ |
|
DPM p,up,lo; |
|
int s; |
|
NODE nd; |
|
|
|
p = (DPM)ARG0(arg); |
|
s = ZTOS((Z)ARG1(arg)); |
|
dpm_split(p,s,&up,&lo); |
|
nd = mknode(2,up,lo); |
|
MKLIST(*rp,nd); |
|
} |
|
|
|
void Pdpm_extract(NODE arg,DP *rp) |
|
{ |
|
DPM p; |
|
int s; |
|
|
|
p = (DPM)ARG0(arg); |
|
s = ZTOS((Z)ARG1(arg)); |
|
dpm_extract(p,s,rp); |
|
} |
|
|
|
|
|
void Pdpm_hc(NODE arg,DP *rp) |
|
{ |
|
DPM p; |
|
DP d; |
|
MP m; |
|
|
asir_assert(ARG0(arg),O_DPM,"dpm_hc"); |
asir_assert(ARG0(arg),O_DPM,"dpm_hc"); |
if ( !ARG0(arg) ) |
if ( !ARG0(arg) ) |
*rp = 0; |
*rp = 0; |
else |
else { |
*rp = BDY((DPM)ARG0(arg))->c; |
p = (DPM)ARG0(arg); |
|
NEWMP(m); |
|
m->dl = BDY(p)->dl; |
|
m->c = BDY(p)->c; |
|
NEXT(m) = 0; |
|
MKDP(NV(p),m,d); d->sugar = p->sugar; |
|
*rp = d; |
|
} |
} |
} |
|
|
|
|
void Pdpv_ht(NODE arg,LIST *rp) |
void Pdpv_ht(NODE arg,LIST *rp) |
{ |
{ |
NODE n; |
NODE n; |
Line 4043 int dpv_hp(DPV p) |
|
Line 4345 int dpv_hp(DPV p) |
|
case ORD_LEX: |
case ORD_LEX: |
for ( i = 0; i < len; i++ ) |
for ( i = 0; i < len; i++ ) |
if ( e[i] ) return i; |
if ( e[i] ) return i; |
|
return -1; |
|
break; |
|
default: |
|
error("dpv_hp : unsupported term ordering"); |
return -1; |
return -1; |
break; |
break; |
} |
} |