version 1.57, 2010/05/01 02:17:49 |
version 1.62, 2016/03/31 01:40:10 |
|
|
* 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/dp-supp.c,v 1.56 2009/10/15 07:08:40 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/dp-supp.c,v 1.61 2015/08/14 13:51:54 fujimoto Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
Line 651 void dp_sp(DP p1,DP p2,DP *rp) |
|
Line 651 void dp_sp(DP p1,DP p2,DP *rp) |
|
LIST hist; |
LIST hist; |
NODE node; |
NODE node; |
|
|
node = mknode(4,ONE,0,s1,ONE); |
node = mknode(4,ONE,NULLP,s1,ONE); |
MKLIST(hist,node); |
MKLIST(hist,node); |
MKNODE(TraceList,hist,0); |
MKNODE(TraceList,hist,0); |
|
|
node = mknode(4,ONE,0,0,ONE); |
node = mknode(4,ONE,NULLP,NULLP,ONE); |
chsgnd(s2,(DP *)&ARG2(node)); |
chsgnd(s2,(DP *)&ARG2(node)); |
MKLIST(hist,node); |
MKLIST(hist,node); |
MKNODE(node,hist,TraceList); TraceList = node; |
MKNODE(node,hist,TraceList); TraceList = node; |
Line 704 void _dp_sp_dup(DP p1,DP p2,DP *rp) |
|
Line 704 void _dp_sp_dup(DP p1,DP p2,DP *rp) |
|
LIST hist; |
LIST hist; |
NODE node; |
NODE node; |
|
|
node = mknode(4,ONE,0,s1,ONE); |
node = mknode(4,ONE,NULLP,s1,ONE); |
MKLIST(hist,node); |
MKLIST(hist,node); |
MKNODE(TraceList,hist,0); |
MKNODE(TraceList,hist,0); |
|
|
node = mknode(4,ONE,0,0,ONE); |
node = mknode(4,ONE,NULLP,NULLP,ONE); |
chsgnd(s2,(DP *)&ARG2(node)); |
chsgnd(s2,(DP *)&ARG2(node)); |
MKLIST(hist,node); |
MKLIST(hist,node); |
MKNODE(node,hist,TraceList); TraceList = node; |
MKNODE(node,hist,TraceList); TraceList = node; |
Line 1249 DP *dp_true_nf_and_quotient_marked (NODE b,DP g,DP *ps |
|
Line 1249 DP *dp_true_nf_and_quotient_marked (NODE b,DP g,DP *ps |
|
|
|
dn = (P)ONE; |
dn = (P)ONE; |
if ( !g ) { |
if ( !g ) { |
*rp = 0; *dnp = dn; return; |
*rp = 0; *dnp = dn; return 0; |
} |
} |
for ( n = 0, l = b; l; l = NEXT(l), n++ ); |
for ( n = 0, l = b; l; l = NEXT(l), n++ ); |
wb = (int *)ALLOCA(n*sizeof(int)); |
wb = (int *)ALLOCA(n*sizeof(int)); |
Line 1306 DP *dp_true_nf_and_quotient_marked_mod(NODE b,DP g,DP |
|
Line 1306 DP *dp_true_nf_and_quotient_marked_mod(NODE b,DP g,DP |
|
for ( i = 0; i < n; i++ ) q[i] = 0; |
for ( i = 0; i < n; i++ ) q[i] = 0; |
dn = (P)ONEM; |
dn = (P)ONEM; |
if ( !g ) { |
if ( !g ) { |
*rp = 0; *dnp = dn; return; |
*rp = 0; *dnp = dn; return 0; |
} |
} |
wb = (int *)ALLOCA(n*sizeof(int)); |
wb = (int *)ALLOCA(n*sizeof(int)); |
for ( i = 0, l = b; i < n; l = NEXT(l), i++ ) |
for ( i = 0, l = b; i < n; l = NEXT(l), i++ ) |
Line 1735 void dp_nf_tab_f(DP p,LIST *tab,DP *rp) |
|
Line 1735 void dp_nf_tab_f(DP p,LIST *tab,DP *rp) |
|
|
|
int create_order_spec(VL vl,Obj obj,struct order_spec **specp) |
int create_order_spec(VL vl,Obj obj,struct order_spec **specp) |
{ |
{ |
int i,j,n,s,row,col,ret; |
int i,j,n,s,row,col,ret,wlen; |
struct order_spec *spec; |
struct order_spec *spec; |
struct order_pair *l; |
struct order_pair *l; |
NODE node,t,tn; |
Obj wp,wm; |
|
NODE node,t,tn,wpair; |
MAT m; |
MAT m; |
VECT v; |
VECT v; |
pointer **b,*bv; |
pointer **b,*bv; |
Line 1757 int create_order_spec(VL vl,Obj obj,struct order_spec |
|
Line 1758 int create_order_spec(VL vl,Obj obj,struct order_spec |
|
spec->ord.simple = QTOS((Q)obj); |
spec->ord.simple = QTOS((Q)obj); |
return 1; |
return 1; |
} else if ( OID(obj) == O_LIST ) { |
} else if ( OID(obj) == O_LIST ) { |
|
/* module order; obj = [0|1,w,ord] or [0|1,ord] */ |
node = BDY((LIST)obj); |
node = BDY((LIST)obj); |
if ( !BDY(node) || NUM(BDY(node)) ) { |
if ( !BDY(node) || NUM(BDY(node)) ) { |
if ( length(node) < 2 ) |
switch ( length(node) ) { |
error("create_order_spec : invalid argument"); |
case 2: |
create_order_spec(0,(Obj)BDY(NEXT(node)),&spec); |
create_order_spec(0,(Obj)BDY(NEXT(node)),&spec); |
spec->id += 256; spec->obj = obj; |
spec->id += 256; spec->obj = obj; |
spec->ispot = (BDY(node)!=0); |
spec->top_weight = 0; |
if ( spec->ispot ) { |
spec->module_rank = 0; |
n = QTOS((Q)BDY(node)); |
spec->module_top_weight = 0; |
if ( n < 0 ) |
spec->ispot = (BDY(node)!=0); |
spec->pot_nelim = -n; |
if ( spec->ispot ) { |
else |
n = QTOS((Q)BDY(node)); |
spec->pot_nelim = 0; |
if ( n < 0 ) |
} |
spec->pot_nelim = -n; |
|
else |
|
spec->pot_nelim = 0; |
|
} |
|
break; |
|
|
|
case 3: |
|
create_order_spec(0,(Obj)BDY(NEXT(NEXT(node))),&spec); |
|
spec->id += 256; spec->obj = obj; |
|
spec->ispot = (BDY(node)!=0); |
|
node = NEXT(node); |
|
if ( !BDY(node) || OID(BDY(node)) != O_LIST ) |
|
error("create_order_spec : [weight_for_poly,weight_for_modlue] must be specified as a module topweight"); |
|
wpair = BDY((LIST)BDY(node)); |
|
if ( length(wpair) != 2 ) |
|
error("create_order_spec : [weight_for_poly,weight_for_modlue] must be specified as a module topweight"); |
|
|
|
wp = BDY(wpair); |
|
wm = BDY(NEXT(wpair)); |
|
if ( !wp || OID(wp) != O_LIST || !wm || OID(wm) != O_LIST ) |
|
error("create_order_spec : [weight_for_poly,weight_for_modlue] must be specified as a module topweight"); |
|
spec->nv = length(BDY((LIST)wp)); |
|
spec->top_weight = (int *)MALLOC_ATOMIC(spec->nv*sizeof(int)); |
|
for ( i = 0, t = BDY((LIST)wp); i < spec->nv; t = NEXT(t), i++ ) |
|
spec->top_weight[i] = QTOS((Q)BDY(t)); |
|
|
|
spec->module_rank = length(BDY((LIST)wm)); |
|
spec->module_top_weight = (int *)MALLOC_ATOMIC(spec->module_rank*sizeof(int)); |
|
for ( i = 0, t = BDY((LIST)wm); i < spec->module_rank; t = NEXT(t), i++ ) |
|
spec->module_top_weight[i] = QTOS((Q)BDY(t)); |
|
break; |
|
default: |
|
error("create_order_spec : invalid arguments for module order"); |
|
} |
|
|
*specp = spec; |
*specp = spec; |
return 1; |
return 1; |
} |
} else { |
|
/* block order in polynomial ring */ |
for ( n = 0, t = node; t; t = NEXT(t), n++ ); |
for ( n = 0, t = node; t; t = NEXT(t), n++ ); |
l = (struct order_pair *)MALLOC_ATOMIC(n*sizeof(struct order_pair)); |
l = (struct order_pair *)MALLOC_ATOMIC(n*sizeof(struct order_pair)); |
for ( i = 0, t = node, s = 0; i < n; t = NEXT(t), i++ ) { |
for ( i = 0, t = node, s = 0; i < n; t = NEXT(t), i++ ) { |
tn = BDY((LIST)BDY(t)); l[i].order = QTOS((Q)BDY(tn)); |
tn = BDY((LIST)BDY(t)); l[i].order = QTOS((Q)BDY(tn)); |
tn = NEXT(tn); l[i].length = QTOS((Q)BDY(tn)); |
tn = NEXT(tn); l[i].length = QTOS((Q)BDY(tn)); |
s += l[i].length; |
s += l[i].length; |
} |
} |
spec->id = 1; spec->obj = obj; |
spec->id = 1; spec->obj = obj; |
spec->ord.block.order_pair = l; |
spec->ord.block.order_pair = l; |
spec->ord.block.length = n; spec->nv = s; |
spec->ord.block.length = n; spec->nv = s; |
return 1; |
return 1; |
|
} |
} else if ( OID(obj) == O_MAT ) { |
} else if ( OID(obj) == O_MAT ) { |
m = (MAT)obj; row = m->row; col = m->col; b = BDY(m); |
m = (MAT)obj; row = m->row; col = m->col; b = BDY(m); |
w = almat(row,col); |
w = almat(row,col); |