version 1.17, 2001/09/05 01:57:32 |
version 1.24, 2002/01/28 00:54:41 |
|
|
* 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.c,v 1.16 2001/09/04 08:48:18 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/dp.c,v 1.23 2001/11/19 01:40:04 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
Line 76 void Pdp_gr_print(); |
|
Line 76 void Pdp_gr_print(); |
|
void Pdp_mbase(),Pdp_lnf_mod(),Pdp_nf_tab_mod(),Pdp_mdtod(); |
void Pdp_mbase(),Pdp_lnf_mod(),Pdp_nf_tab_mod(),Pdp_mdtod(); |
void Pdp_vtoe(), Pdp_etov(), Pdp_dtov(), Pdp_idiv(), Pdp_sep(); |
void Pdp_vtoe(), Pdp_etov(), Pdp_dtov(), Pdp_idiv(), Pdp_sep(); |
void Pdp_cont(); |
void Pdp_cont(); |
|
void Pdp_gr_checklist(); |
|
|
void Pdp_weyl_red(); |
void Pdp_weyl_red(); |
void Pdp_weyl_sp(); |
void Pdp_weyl_sp(); |
Line 84 void Pdp_weyl_gr_main(),Pdp_weyl_gr_mod_main(),Pdp_wey |
|
Line 85 void Pdp_weyl_gr_main(),Pdp_weyl_gr_mod_main(),Pdp_wey |
|
void Pdp_weyl_f4_main(),Pdp_weyl_f4_mod_main(),Pdp_weyl_f4_f_main(); |
void Pdp_weyl_f4_main(),Pdp_weyl_f4_mod_main(),Pdp_weyl_f4_f_main(); |
void Pdp_weyl_mul(),Pdp_weyl_mul_mod(); |
void Pdp_weyl_mul(),Pdp_weyl_mul_mod(); |
void Pdp_weyl_set_weight(); |
void Pdp_weyl_set_weight(); |
|
void Pdp_set_weight(); |
void Pdp_nf_f(),Pdp_weyl_nf_f(); |
void Pdp_nf_f(),Pdp_weyl_nf_f(); |
void Pdp_lnf_f(); |
void Pdp_lnf_f(); |
|
|
Line 118 struct ftab dp_tab[] = { |
|
Line 120 struct ftab dp_tab[] = { |
|
{"dp_gr_main",Pdp_gr_main,5}, |
{"dp_gr_main",Pdp_gr_main,5}, |
{"dp_gr_mod_main",Pdp_gr_mod_main,5}, |
{"dp_gr_mod_main",Pdp_gr_mod_main,5}, |
{"dp_gr_f_main",Pdp_gr_f_main,4}, |
{"dp_gr_f_main",Pdp_gr_f_main,4}, |
|
{"dp_gr_checklist",Pdp_gr_checklist,2}, |
|
|
/* F4 algorithm */ |
/* F4 algorithm */ |
{"dp_f4_main",Pdp_f4_main,3}, |
{"dp_f4_main",Pdp_f4_main,3}, |
Line 149 struct ftab dp_tab[] = { |
|
Line 152 struct ftab dp_tab[] = { |
|
{"dp_weyl_f4_mod_main",Pdp_weyl_f4_mod_main,4}, |
{"dp_weyl_f4_mod_main",Pdp_weyl_f4_mod_main,4}, |
|
|
/* misc */ |
/* misc */ |
|
{"dp_set_weight",Pdp_set_weight,-1}, |
{"dp_weyl_set_weight",Pdp_weyl_set_weight,-1}, |
{"dp_weyl_set_weight",Pdp_weyl_set_weight,-1}, |
{0,0,0}, |
{0,0,0}, |
}; |
}; |
|
|
n = v->len; |
n = v->len; |
NEWDL(dl,n); d = dl->d; |
NEWDL(dl,n); d = dl->d; |
for ( i = 0, td = 0; i < n; i++ ) { |
for ( i = 0, td = 0; i < n; i++ ) { |
d[i] = QTOS((Q)(v->body[i])); td += d[i]; |
d[i] = QTOS((Q)(v->body[i])); td += MUL_WEIGHT(d[i],i); |
} |
} |
dl->td = td; |
dl->td = td; |
NEWMP(m); m->dl = dl; m->c = (P)ONE; NEXT(m) = 0; |
NEWMP(m); m->dl = dl; m->c = (P)ONE; NEXT(m) = 0; |
|
|
n = p1->nv; d1 = BDY(p1)->dl; d2 = BDY(p2)->dl; |
n = p1->nv; d1 = BDY(p1)->dl; d2 = BDY(p2)->dl; |
NEWDL(d,n); |
NEWDL(d,n); |
for ( i = 0, td = 0; i < n; i++ ) { |
for ( i = 0, td = 0; i < n; i++ ) { |
d->d[i] = MAX(d1->d[i],d2->d[i]); td += d->d[i]; |
d->d[i] = MAX(d1->d[i],d2->d[i]); td += MUL_WEIGHT(d->d[i],i); |
} |
} |
d->td = td; |
d->td = td; |
NEWMP(m); m->dl = d; m->c = (P)ONE; NEXT(m) = 0; |
NEWMP(m); m->dl = d; m->c = (P)ONE; NEXT(m) = 0; |
|
|
dp_f4_main(f,v,&ord,rp); |
dp_f4_main(f,v,&ord,rp); |
} |
} |
|
|
|
/* dp_gr_checklist(list of dp) */ |
|
|
|
void Pdp_gr_checklist(arg,rp) |
|
NODE arg; |
|
LIST *rp; |
|
{ |
|
VECT g; |
|
LIST dp; |
|
NODE r; |
|
int n; |
|
|
|
do_weyl = 0; |
|
asir_assert(ARG0(arg),O_LIST,"dp_gr_checklist"); |
|
asir_assert(ARG1(arg),O_N,"dp_gr_checklist"); |
|
n = QTOS((Q)ARG1(arg)); |
|
gbcheck_list(BDY((LIST)ARG0(arg)),n,&g,&dp); |
|
r = mknode(2,g,dp); |
|
MKLIST(*rp,r); |
|
} |
|
|
void Pdp_f4_mod_main(arg,rp) |
void Pdp_f4_mod_main(arg,rp) |
NODE arg; |
NODE arg; |
LIST *rp; |
LIST *rp; |
|
|
asir_assert(ARG1(arg),O_LIST,"dp_f4_mod_main"); |
asir_assert(ARG1(arg),O_LIST,"dp_f4_mod_main"); |
asir_assert(ARG2(arg),O_N,"dp_f4_mod_main"); |
asir_assert(ARG2(arg),O_N,"dp_f4_mod_main"); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); m = QTOS((Q)ARG2(arg)); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); m = QTOS((Q)ARG2(arg)); |
|
if ( !m ) |
|
error("dp_f4_mod_main : invalid argument"); |
create_order_spec(ARG3(arg),&ord); |
create_order_spec(ARG3(arg),&ord); |
dp_f4_mod_main(f,v,m,&ord,rp); |
dp_f4_mod_main(f,v,m,&ord,rp); |
} |
} |
|
|
asir_assert(ARG3(arg),O_N,"dp_gr_mod_main"); |
asir_assert(ARG3(arg),O_N,"dp_gr_mod_main"); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
homo = (Num)ARG2(arg); m = QTOS((Q)ARG3(arg)); |
homo = (Num)ARG2(arg); m = QTOS((Q)ARG3(arg)); |
|
if ( !m ) |
|
error("dp_gr_mod_main : invalid argument"); |
create_order_spec(ARG4(arg),&ord); |
create_order_spec(ARG4(arg),&ord); |
dp_gr_mod_main(f,v,homo,m,&ord,rp); |
dp_gr_mod_main(f,v,homo,m,&ord,rp); |
} |
} |
|
|
{ |
{ |
LIST f,v; |
LIST f,v; |
Num homo; |
Num homo; |
Q m; |
|
int modular; |
|
struct order_spec ord; |
struct order_spec ord; |
|
|
asir_assert(ARG0(arg),O_LIST,"dp_weyl_gr_main"); |
asir_assert(ARG0(arg),O_LIST,"dp_weyl_gr_main"); |
|
|
asir_assert(ARG1(arg),O_LIST,"dp_weyl_f4_main"); |
asir_assert(ARG1(arg),O_LIST,"dp_weyl_f4_main"); |
asir_assert(ARG2(arg),O_N,"dp_f4_main"); |
asir_assert(ARG2(arg),O_N,"dp_f4_main"); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); m = QTOS((Q)ARG2(arg)); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); m = QTOS((Q)ARG2(arg)); |
|
if ( !m ) |
|
error("dp_weyl_f4_mod_main : invalid argument"); |
create_order_spec(ARG3(arg),&ord); |
create_order_spec(ARG3(arg),&ord); |
do_weyl = 1; |
do_weyl = 1; |
dp_f4_mod_main(f,v,m,&ord,rp); |
dp_f4_mod_main(f,v,m,&ord,rp); |
|
|
asir_assert(ARG3(arg),O_N,"dp_weyl_gr_mod_main"); |
asir_assert(ARG3(arg),O_N,"dp_weyl_gr_mod_main"); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
homo = (Num)ARG2(arg); m = QTOS((Q)ARG3(arg)); |
homo = (Num)ARG2(arg); m = QTOS((Q)ARG3(arg)); |
|
if ( !m ) |
|
error("dp_weyl_gr_mod_main : invalid argument"); |
create_order_spec(ARG4(arg),&ord); |
create_order_spec(ARG4(arg),&ord); |
do_weyl = 1; |
do_weyl = 1; |
dp_gr_mod_main(f,v,homo,m,&ord,rp); |
dp_gr_mod_main(f,v,homo,m,&ord,rp); |
do_weyl = 0; |
do_weyl = 0; |
} |
} |
|
|
static VECT current_weight_vector_obj; |
static VECT current_dl_weight_vector_obj; |
int *current_weight_vector; |
int *current_dl_weight_vector; |
|
|
|
void Pdp_set_weight(arg,rp) |
|
NODE arg; |
|
VECT *rp; |
|
{ |
|
VECT v; |
|
int i,n; |
|
|
|
if ( !arg ) |
|
*rp = current_dl_weight_vector_obj; |
|
else if ( !ARG0(arg) ) { |
|
current_dl_weight_vector_obj = 0; |
|
current_dl_weight_vector = 0; |
|
*rp = 0; |
|
} else { |
|
asir_assert(ARG0(arg),O_VECT,"dp_set_weight"); |
|
v = (VECT)ARG0(arg); |
|
current_dl_weight_vector_obj = v; |
|
n = v->len; |
|
current_dl_weight_vector = (int *)CALLOC(n,sizeof(int)); |
|
for ( i = 0; i < n; i++ ) |
|
current_dl_weight_vector[i] = QTOS((Q)v->body[i]); |
|
*rp = v; |
|
} |
|
} |
|
|
|
static VECT current_weyl_weight_vector_obj; |
|
int *current_weyl_weight_vector; |
|
|
void Pdp_weyl_set_weight(arg,rp) |
void Pdp_weyl_set_weight(arg,rp) |
NODE arg; |
NODE arg; |
VECT *rp; |
VECT *rp; |
|
|
int i,n; |
int i,n; |
|
|
if ( !arg ) |
if ( !arg ) |
*rp = current_weight_vector_obj; |
*rp = current_weyl_weight_vector_obj; |
else { |
else { |
asir_assert(ARG0(arg),O_VECT,"dp_weyl_set_weight"); |
asir_assert(ARG0(arg),O_VECT,"dp_weyl_set_weight"); |
v = (VECT)ARG0(arg); |
v = (VECT)ARG0(arg); |
current_weight_vector_obj = v; |
current_weyl_weight_vector_obj = v; |
n = v->len; |
n = v->len; |
current_weight_vector = (int *)CALLOC(n,sizeof(int)); |
current_weyl_weight_vector = (int *)CALLOC(n,sizeof(int)); |
for ( i = 0; i < n; i++ ) |
for ( i = 0; i < n; i++ ) |
current_weight_vector[i] = QTOS((Q)v->body[i]); |
current_weyl_weight_vector[i] = QTOS((Q)v->body[i]); |
*rp = v; |
*rp = v; |
} |
} |
} |
} |