version 1.49, 2009/01/04 05:44:51 |
version 1.54, 2009/06/01 07:31:54 |
|
|
* 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.48 2007/10/21 07:47:59 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/dp-supp.c,v 1.53 2009/01/07 05:33:18 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
Line 1701 int create_order_spec(VL vl,Obj obj,struct order_spec |
|
Line 1701 int create_order_spec(VL vl,Obj obj,struct order_spec |
|
return 1; |
return 1; |
} else if ( OID(obj) == O_LIST ) { |
} else if ( OID(obj) == O_LIST ) { |
node = BDY((LIST)obj); |
node = BDY((LIST)obj); |
|
if ( !BDY(node) || NUM(BDY(node)) ) { |
|
if ( length(node) < 2 ) |
|
error("create_order_spec : invalid argument"); |
|
create_order_spec(0,(Obj)BDY(NEXT(node)),&spec); |
|
spec->id += 256; spec->obj = obj; |
|
spec->ispot = (BDY(node)!=0); |
|
if ( spec->ispot ) { |
|
n = QTOS((Q)BDY(node)); |
|
if ( n < 0 ) |
|
spec->pot_nelim = -n; |
|
else |
|
spec->pot_nelim = 0; |
|
} |
|
*specp = spec; |
|
return 1; |
|
} |
|
|
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++ ) { |
Line 1722 int create_order_spec(VL vl,Obj obj,struct order_spec |
|
Line 1739 int create_order_spec(VL vl,Obj obj,struct order_spec |
|
spec->nv = col; spec->ord.matrix.row = row; |
spec->nv = col; spec->ord.matrix.row = row; |
spec->ord.matrix.matrix = w; |
spec->ord.matrix.matrix = w; |
return 1; |
return 1; |
} else if ( OID(obj) == O_VECT ) { |
|
v = (VECT)obj; bv = BDY(v); |
|
if ( v->len < 2 ) error("create_order_spec : invalid argument"); |
|
create_order_spec(0,(Obj)bv[1],&spec); |
|
spec->id += 256; spec->obj = obj; |
|
spec->istop = bv[0]==0; |
|
*specp = spec; |
|
return 1; |
|
} else |
} else |
return 0; |
return 0; |
} |
} |
Line 2193 void homogenize_order(struct order_spec *old,int n,str |
|
Line 2202 void homogenize_order(struct order_spec *old,int n,str |
|
error("homogenize_order : invalid input"); |
error("homogenize_order : invalid input"); |
} |
} |
break; |
break; |
case 1: |
case 1: case 257: |
length = old->ord.block.length; |
length = old->ord.block.length; |
l = (struct order_pair *) |
l = (struct order_pair *) |
MALLOC_ATOMIC((length+1)*sizeof(struct order_pair)); |
MALLOC_ATOMIC((length+1)*sizeof(struct order_pair)); |
bcopy((char *)old->ord.block.order_pair,(char *)l,length*sizeof(struct order_pair)); |
bcopy((char *)old->ord.block.order_pair,(char *)l,length*sizeof(struct order_pair)); |
l[length].order = 2; l[length].length = 1; |
l[length].order = 2; l[length].length = 1; |
new->id = 1; new->nv = n+1; |
new->id = old->id; new->nv = n+1; |
new->ord.block.order_pair = l; |
new->ord.block.order_pair = l; |
new->ord.block.length = length+1; |
new->ord.block.length = length+1; |
|
new->ispot = old->ispot; |
break; |
break; |
case 2: |
case 2: case 258: |
nv = old->nv; row = old->ord.matrix.row; |
nv = old->nv; row = old->ord.matrix.row; |
oldm = old->ord.matrix.matrix; newm = almat(row+1,nv+1); |
oldm = old->ord.matrix.matrix; newm = almat(row+1,nv+1); |
for ( i = 0; i <= nv; i++ ) |
for ( i = 0; i <= nv; i++ ) |
Line 2213 void homogenize_order(struct order_spec *old,int n,str |
|
Line 2223 void homogenize_order(struct order_spec *old,int n,str |
|
newm[i+1][j] = oldm[i][j]; |
newm[i+1][j] = oldm[i][j]; |
newm[i+1][j] = 0; |
newm[i+1][j] = 0; |
} |
} |
new->id = 2; new->nv = nv+1; |
new->id = old->id; new->nv = nv+1; |
new->ord.matrix.row = row+1; new->ord.matrix.matrix = newm; |
new->ord.matrix.row = row+1; new->ord.matrix.matrix = newm; |
|
new->ispot = old->ispot; |
break; |
break; |
case 3: |
case 3: case 259: |
onv = old->nv; |
onv = old->nv; |
nnv = onv+1; |
nnv = onv+1; |
olen = old->ord.composite.length; |
olen = old->ord.composite.length; |
Line 2250 void homogenize_order(struct order_spec *old,int n,str |
|
Line 2261 void homogenize_order(struct order_spec *old,int n,str |
|
(struct sparse_weight *)MALLOC(sizeof(struct sparse_weight)); |
(struct sparse_weight *)MALLOC(sizeof(struct sparse_weight)); |
nwb[i].body.sparse_weight[0].pos = onv; |
nwb[i].body.sparse_weight[0].pos = onv; |
nwb[i].body.sparse_weight[0].value = 1; |
nwb[i].body.sparse_weight[0].value = 1; |
new->id = 3; |
new->id = old->id; |
new->nv = nnv; |
new->nv = nnv; |
new->ord.composite.length = nlen; |
new->ord.composite.length = nlen; |
new->ord.composite.w_or_b = nwb; |
new->ord.composite.w_or_b = nwb; |
|
new->ispot = old->ispot; |
print_composite_order_spec(new); |
print_composite_order_spec(new); |
|
break; |
|
case 256: /* simple module order */ |
|
switch ( old->ord.simple ) { |
|
case 0: |
|
new->id = 256; new->ord.simple = 0; break; |
|
case 1: |
|
l = (struct order_pair *) |
|
MALLOC_ATOMIC(2*sizeof(struct order_pair)); |
|
l[0].length = n; l[0].order = old->ord.simple; |
|
l[1].length = 1; l[1].order = 2; |
|
new->id = 257; |
|
new->ord.block.order_pair = l; |
|
new->ord.block.length = 2; new->nv = n+1; |
|
break; |
|
case 2: |
|
new->id = 256; new->ord.simple = 1; break; |
|
default: |
|
error("homogenize_order : invalid input"); |
|
} |
|
new->ispot = old->ispot; |
break; |
break; |
default: |
default: |
error("homogenize_order : invalid input"); |
error("homogenize_order : invalid input"); |