version 1.12, 2019/12/12 04:44:59 |
version 1.18, 2022/09/10 04:04:50 |
|
|
* 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-supp.c,v 1.11 2019/11/21 04:03:16 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2018/builtin/dp-supp.c,v 1.17 2020/12/15 07:40:09 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
Line 96 LIST get_denomlist() |
|
Line 96 LIST get_denomlist() |
|
return l; |
return l; |
} |
} |
|
|
|
int dp_iszp(DP p) |
|
{ |
|
MP m; |
|
|
|
if ( !p ) return 1; |
|
for ( m = BDY(p); m; m = NEXT(m)) |
|
if ( !INT(m->c) ) return 0; |
|
return 1; |
|
} |
|
|
void dp_ptozp(DP p,DP *rp) |
void dp_ptozp(DP p,DP *rp) |
{ |
{ |
MP m,mr,mr0; |
MP m,mr,mr0; |
Line 147 void dp_ptozp2(DP p0,DP p1,DP *hp,DP *rp) |
|
Line 157 void dp_ptozp2(DP p0,DP p1,DP *hp,DP *rp) |
|
*hp = h; *rp = r; |
*hp = h; *rp = r; |
} |
} |
|
|
|
int dpm_iszp(DPM p) |
|
{ |
|
DMM m; |
|
|
|
if ( !p ) return 1; |
|
for ( m = BDY(p); m; m = NEXT(m)) |
|
if ( !INT(m->c) ) return 0; |
|
return 1; |
|
} |
|
|
void dpm_ptozp(DPM p,Z *cont,DPM *rp) |
void dpm_ptozp(DPM p,Z *cont,DPM *rp) |
{ |
{ |
DMM m,mr,mr0; |
DMM m,mr,mr0; |
Line 315 int _dl_redble(DL d1,DL d2,int nvar) |
|
Line 335 int _dl_redble(DL d1,DL d2,int nvar) |
|
return 1; |
return 1; |
} |
} |
|
|
|
int _dl_redble_ext(DL d1,DL d2,DL quo,int nvar) |
|
{ |
|
int i; |
|
|
|
if ( (quo->td = d2->td-d1->td) < 0 ) |
|
return 0; |
|
for ( i = 0; i < nvar; i++ ) |
|
if ( (quo->d[i] = d2->d[i]-d1->d[i]) < 0 ) |
|
break; |
|
if ( i < nvar ) |
|
return 0; |
|
else |
|
return 1; |
|
} |
|
|
void insert_to_node(DL d,NODE *n,int nvar) |
void insert_to_node(DL d,NODE *n,int nvar) |
{ |
{ |
DL d1; |
DL d1; |
|
|
|
|
/* psiv is a vector of lists of Z */ |
/* psiv is a vector of lists of Z */ |
|
|
DPM dpm_sp_nf_zlist(VECT psv,VECT psiv,int i,int j,DPM *nf) |
DPM dpm_sp_nf_zlist(VECT psv,VECT psiv,int i,int j,int top,DPM *nf) |
{ |
{ |
DPM *ps; |
DPM *ps; |
int n,nv,s1,s2,sugar,max,pos,psugar; |
int n,nv,s1,s2,sugar,max,pos,psugar; |
Line 2023 DPM dpm_sp_nf_zlist(VECT psv,VECT psiv,int i,int j,DPM |
|
Line 2058 DPM dpm_sp_nf_zlist(VECT psv,VECT psiv,int i,int j,DPM |
|
} |
} |
if ( u ) { |
if ( u ) { |
g = u; |
g = u; |
} else { |
} else if ( !top ) { |
#if 0 |
|
m = BDY(g); |
m = BDY(g); |
NEXTDMM(mr0,mr); |
NEXTDMM(mr0,mr); |
mr->dl = m->dl; mr->c = m->c; mr->pos = m->pos; |
mr->dl = m->dl; mr->c = m->c; mr->pos = m->pos; |
dpm_rest(g,&t); g = t; |
dpm_rest(g,&t); g = t; |
#else |
} else { |
*nf = g; |
*nf = g; |
if ( mq0 ) { |
if ( mq0 ) { |
NEXT(mq) = 0; MKDPM(nv,mq0,q); q->sugar = sugar; |
NEXT(mq) = 0; MKDPM(nv,mq0,q); q->sugar = sugar; |
} else |
} else |
q = 0; |
q = 0; |
return q; |
return q; |
#endif |
|
} |
} |
} |
} |
last: |
last: |
Line 2305 void dpm_split(DPM p,int s,DPM *up,DPM *lo) |
|
Line 2338 void dpm_split(DPM p,int s,DPM *up,DPM *lo) |
|
} |
} |
} |
} |
|
|
|
/* extract the component in DP of position s */ |
|
void dpm_extract(DPM p,int s,DP *r) |
|
{ |
|
DMM m; |
|
MP mu0,mu; |
|
DP t; |
|
|
|
if ( !p ) { |
|
*r = 0; return; |
|
} |
|
for ( m = BDY(p), mu0 = 0; m; m = NEXT(m) ) { |
|
if ( m->pos == s ) { |
|
NEXTMP(mu0,mu); |
|
mu->dl = m->dl; mu->c = m->c; |
|
} |
|
} |
|
if ( mu0 ) { |
|
NEXT(mu) = 0; MKDP(p->nv,mu0,t); t->sugar = p->sugar; |
|
*r = t; |
|
} else |
|
*r = 0; |
|
} |
|
|
/* nf computation over a field */ |
/* nf computation over a field */ |
|
|
void dp_nf_f(NODE b,DP g,DP *ps,int full,DP *rp) |
void dp_nf_f(NODE b,DP g,DP *ps,int full,DP *rp) |
Line 2726 int create_order_spec(VL vl,Obj obj,struct order_spec |
|
Line 2782 int create_order_spec(VL vl,Obj obj,struct order_spec |
|
spec->pot_nelim = 0; |
spec->pot_nelim = 0; |
break; |
break; |
|
|
case 3: /* [n,[wv,wm],ord] */ |
case 3: /* [n,[mlist1,mlist2,...],ord] or [n,[wv,wm],ord] */ |
spec->module_ordtype = ZTOS((Z)BDY(node)); |
spec->module_ordtype = ZTOS((Z)BDY(node)); |
if ( spec->module_ordtype < 0 ) { |
if ( spec->module_ordtype < 0 ) { |
spec->pot_nelim = -spec->module_ordtype; |
spec->pot_nelim = -spec->module_ordtype; |
Line 2760 int create_order_spec(VL vl,Obj obj,struct order_spec |
|
Line 2816 int create_order_spec(VL vl,Obj obj,struct order_spec |
|
create_order_spec(0,baseobj,&basespec); |
create_order_spec(0,baseobj,&basespec); |
basespec->obj = baseobj; |
basespec->obj = baseobj; |
spec->base = basespec; |
spec->base = basespec; |
} else { /* weighted order */ |
} else if ( spec->module_ordtype == 4 ) { /* POT with base order [n,bord,ord] */ |
|
NODE base_ord; |
|
int rank; |
|
|
|
create_order_spec(0,(Obj)BDY(NEXT(NEXT(node))),&spec); |
|
spec->id += 256; spec->obj = obj; |
|
spec->top_weight = 0; |
|
spec->module_rank = 0; |
|
spec->module_top_weight = 0; |
|
spec->pot_nelim = 0; |
|
spec->module_ordtype = 4; |
|
node = NEXT(node); |
|
if ( !BDY(node) || OID(BDY(node)) != O_LIST ) |
|
error("create_order_spec : a permitation list must be specified"); |
|
base_ord = BDY((LIST)BDY(node)); |
|
spec->module_rank = rank = length(base_ord); |
|
spec->module_base_ord = (int *)MALLOC_ATOMIC((rank+1)*sizeof(int)); |
|
for ( i = 1, t = base_ord; i <= rank; i++, t = NEXT(t) ) |
|
spec->module_base_ord[ZTOS((Q)BDY(t))] = i; |
|
break; |
|
} else { /* weighted order * [n,[wv,wm],ord] */ |
int ordtype; |
int ordtype; |
|
|
ordtype = spec->module_ordtype; |
ordtype = spec->module_ordtype; |
Line 3282 void dp_mod(DP p,int mod,NODE subst,DP *rp) |
|
Line 3358 void dp_mod(DP p,int mod,NODE subst,DP *rp) |
|
} |
} |
} |
} |
|
|
|
void dpm_mod(DPM p,int mod,DPM *rp) |
|
{ |
|
DMM m,mr,mr0; |
|
P t; |
|
V v; |
|
NODE tn; |
|
|
|
if ( !p ) |
|
*rp = 0; |
|
else { |
|
for ( mr0 = 0, m = BDY(p); m; m = NEXT(m) ) { |
|
ptomp(mod,(P)m->c,&t); |
|
if ( t ) { |
|
NEXTDMM(mr0,mr); mr->c = (Obj)t; mr->dl = m->dl; |
|
} |
|
} |
|
if ( mr0 ) { |
|
NEXT(mr) = 0; MKDPM(p->nv,mr0,*rp); (*rp)->sugar = p->sugar; |
|
} else |
|
*rp = 0; |
|
} |
|
} |
|
|
void dp_rat(DP p,DP *rp) |
void dp_rat(DP p,DP *rp) |
{ |
{ |
MP m,mr,mr0; |
MP m,mr,mr0; |
Line 3581 void dpm_rest(DPM p,DPM *rp) |
|
Line 3680 void dpm_rest(DPM p,DPM *rp) |
|
if ( *rp ) |
if ( *rp ) |
(*rp)->sugar = p->sugar; |
(*rp)->sugar = p->sugar; |
} |
} |
|
} |
|
|
|
int dp_getdeg(DP p) |
|
{ |
|
int max,n,i; |
|
MP m; |
|
int *d; |
|
|
|
if ( !p ) return 0; |
|
n = p->nv; |
|
max = 0; |
|
for ( m = BDY(p); m; m = NEXT(m) ) { |
|
d = m->dl->d; |
|
for ( i = 0; i < n; i++ ) |
|
if ( d[i] > max ) max = d[i]; |
|
} |
|
return max; |
} |
} |
|
|
int dpm_getdeg(DPM p,int *r) |
int dpm_getdeg(DPM p,int *r) |