version 1.24, 2002/01/28 00:54:41 |
version 1.28, 2003/01/15 04:53:03 |
|
|
* 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.23 2001/11/19 01:40:04 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/dp.c,v 1.27 2003/01/06 01:16:37 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
#include "parse.h" |
#include "parse.h" |
|
|
extern int dp_fcoeffs; |
|
extern int dp_nelim; |
extern int dp_nelim; |
extern int dp_order_pair_length; |
extern int dp_order_pair_length; |
extern struct order_pair *dp_order_pair; |
extern struct order_pair *dp_order_pair; |
Line 73 void Pdp_gr_mod_main(),Pdp_gr_f_main(); |
|
Line 72 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_f4_main(),Pdp_f4_mod_main(),Pdp_f4_f_main(); |
void Pdp_f4_main(),Pdp_f4_mod_main(),Pdp_f4_f_main(); |
void Pdp_gr_print(); |
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(), Pdp_nf_tab_f(); |
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_gr_checklist(); |
Line 89 void Pdp_set_weight(); |
|
Line 88 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(); |
|
|
|
LIST remove_zero_from_list(LIST); |
|
|
struct ftab dp_tab[] = { |
struct ftab dp_tab[] = { |
/* content reduction */ |
/* content reduction */ |
{"dp_ptozp",Pdp_ptozp,1}, |
{"dp_ptozp",Pdp_ptozp,1}, |
Line 113 struct ftab dp_tab[] = { |
|
Line 114 struct ftab dp_tab[] = { |
|
{"dp_nf_mod",Pdp_nf_mod,5}, |
{"dp_nf_mod",Pdp_nf_mod,5}, |
{"dp_true_nf_mod",Pdp_true_nf_mod,5}, |
{"dp_true_nf_mod",Pdp_true_nf_mod,5}, |
{"dp_lnf_mod",Pdp_lnf_mod,3}, |
{"dp_lnf_mod",Pdp_lnf_mod,3}, |
|
{"dp_nf_tab_f",Pdp_nf_tab_f,2}, |
{"dp_nf_tab_mod",Pdp_nf_tab_mod,3}, |
{"dp_nf_tab_mod",Pdp_nf_tab_mod,3}, |
{"dp_lnf_f",Pdp_lnf_f,2}, |
{"dp_lnf_f",Pdp_lnf_f,2}, |
|
|
|
|
QTOS((Q)ARG2(arg)),rp); |
QTOS((Q)ARG2(arg)),rp); |
} |
} |
|
|
|
void Pdp_nf_tab_f(arg,rp) |
|
NODE arg; |
|
DP *rp; |
|
{ |
|
asir_assert(ARG0(arg),O_DP,"dp_nf_tab_f"); |
|
asir_assert(ARG1(arg),O_VECT,"dp_nf_tab_f"); |
|
dp_nf_tab_f((DP)ARG0(arg),(LIST *)BDY((VECT)ARG1(arg)),rp); |
|
} |
|
|
void Pdp_ord(arg,rp) |
void Pdp_ord(arg,rp) |
NODE arg; |
NODE arg; |
Obj *rp; |
Obj *rp; |
|
|
asir_assert(ARG2(arg),O_N,"dp_gr_main"); |
asir_assert(ARG2(arg),O_N,"dp_gr_main"); |
asir_assert(ARG3(arg),O_N,"dp_gr_main"); |
asir_assert(ARG3(arg),O_N,"dp_gr_main"); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
|
f = remove_zero_from_list(f); |
|
if ( !BDY(f) ) { |
|
*rp = f; return; |
|
} |
homo = (Num)ARG2(arg); |
homo = (Num)ARG2(arg); |
m = (Q)ARG3(arg); |
m = (Q)ARG3(arg); |
if ( !m ) |
if ( !m ) |
|
|
{ |
{ |
LIST f,v; |
LIST f,v; |
Num homo; |
Num homo; |
|
int m,field,t; |
struct order_spec ord; |
struct order_spec ord; |
|
NODE n; |
|
|
do_weyl = 0; |
do_weyl = 0; |
asir_assert(ARG0(arg),O_LIST,"dp_gr_f_main"); |
asir_assert(ARG0(arg),O_LIST,"dp_gr_f_main"); |
asir_assert(ARG1(arg),O_LIST,"dp_gr_f_main"); |
asir_assert(ARG1(arg),O_LIST,"dp_gr_f_main"); |
asir_assert(ARG2(arg),O_N,"dp_gr_f_main"); |
asir_assert(ARG2(arg),O_N,"dp_gr_f_main"); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
|
f = remove_zero_from_list(f); |
|
if ( !BDY(f) ) { |
|
*rp = f; return; |
|
} |
homo = (Num)ARG2(arg); |
homo = (Num)ARG2(arg); |
|
#if 0 |
|
asir_assert(ARG3(arg),O_N,"dp_gr_f_main"); |
|
m = QTOS((Q)ARG3(arg)); |
|
if ( m ) |
|
error("dp_gr_f_main : trace lifting is not implemented yet"); |
|
create_order_spec(ARG4(arg),&ord); |
|
#else |
|
m = 0; |
create_order_spec(ARG3(arg),&ord); |
create_order_spec(ARG3(arg),&ord); |
dp_gr_main(f,v,homo,0,1,&ord,rp); |
#endif |
|
field = 0; |
|
for ( n = BDY(f); n; n = NEXT(n) ) { |
|
t = get_field_type(BDY(n)); |
|
if ( !t ) |
|
continue; |
|
if ( t < 0 ) |
|
error("dp_gr_f_main : incosistent coefficients"); |
|
if ( !field ) |
|
field = t; |
|
else if ( t != field ) |
|
error("dp_gr_f_main : incosistent coefficients"); |
|
} |
|
dp_gr_main(f,v,homo,m?1:0,field,&ord,rp); |
} |
} |
|
|
void Pdp_f4_main(arg,rp) |
void Pdp_f4_main(arg,rp) |
|
|
asir_assert(ARG0(arg),O_LIST,"dp_f4_main"); |
asir_assert(ARG0(arg),O_LIST,"dp_f4_main"); |
asir_assert(ARG1(arg),O_LIST,"dp_f4_main"); |
asir_assert(ARG1(arg),O_LIST,"dp_f4_main"); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
|
f = remove_zero_from_list(f); |
|
if ( !BDY(f) ) { |
|
*rp = f; return; |
|
} |
create_order_spec(ARG2(arg),&ord); |
create_order_spec(ARG2(arg),&ord); |
dp_f4_main(f,v,&ord,rp); |
dp_f4_main(f,v,&ord,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)); |
|
f = remove_zero_from_list(f); |
|
if ( !BDY(f) ) { |
|
*rp = f; return; |
|
} |
if ( !m ) |
if ( !m ) |
error("dp_f4_mod_main : invalid argument"); |
error("dp_f4_mod_main : invalid argument"); |
create_order_spec(ARG3(arg),&ord); |
create_order_spec(ARG3(arg),&ord); |
|
|
asir_assert(ARG2(arg),O_N,"dp_gr_mod_main"); |
asir_assert(ARG2(arg),O_N,"dp_gr_mod_main"); |
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); |
|
f = remove_zero_from_list(f); |
|
if ( !BDY(f) ) { |
|
*rp = f; return; |
|
} |
homo = (Num)ARG2(arg); m = QTOS((Q)ARG3(arg)); |
homo = (Num)ARG2(arg); m = QTOS((Q)ARG3(arg)); |
if ( !m ) |
if ( !m ) |
error("dp_gr_mod_main : invalid argument"); |
error("dp_gr_mod_main : invalid argument"); |
|
|
asir_assert(ARG2(arg),O_N,"dp_weyl_gr_main"); |
asir_assert(ARG2(arg),O_N,"dp_weyl_gr_main"); |
asir_assert(ARG3(arg),O_N,"dp_weyl_gr_main"); |
asir_assert(ARG3(arg),O_N,"dp_weyl_gr_main"); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
|
f = remove_zero_from_list(f); |
|
if ( !BDY(f) ) { |
|
*rp = f; return; |
|
} |
homo = (Num)ARG2(arg); |
homo = (Num)ARG2(arg); |
m = (Q)ARG3(arg); |
m = (Q)ARG3(arg); |
if ( !m ) |
if ( !m ) |
|
|
asir_assert(ARG2(arg),O_N,"dp_weyl_gr_main"); |
asir_assert(ARG2(arg),O_N,"dp_weyl_gr_main"); |
asir_assert(ARG3(arg),O_N,"dp_weyl_gr_main"); |
asir_assert(ARG3(arg),O_N,"dp_weyl_gr_main"); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
|
f = remove_zero_from_list(f); |
|
if ( !BDY(f) ) { |
|
*rp = f; return; |
|
} |
homo = (Num)ARG2(arg); |
homo = (Num)ARG2(arg); |
create_order_spec(ARG3(arg),&ord); |
create_order_spec(ARG3(arg),&ord); |
do_weyl = 1; |
do_weyl = 1; |
|
|
asir_assert(ARG0(arg),O_LIST,"dp_weyl_f4_main"); |
asir_assert(ARG0(arg),O_LIST,"dp_weyl_f4_main"); |
asir_assert(ARG1(arg),O_LIST,"dp_weyl_f4_main"); |
asir_assert(ARG1(arg),O_LIST,"dp_weyl_f4_main"); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
f = (LIST)ARG0(arg); v = (LIST)ARG1(arg); |
|
f = remove_zero_from_list(f); |
|
if ( !BDY(f) ) { |
|
*rp = f; return; |
|
} |
create_order_spec(ARG2(arg),&ord); |
create_order_spec(ARG2(arg),&ord); |
do_weyl = 1; |
do_weyl = 1; |
dp_f4_main(f,v,&ord,rp); |
dp_f4_main(f,v,&ord,rp); |
|
|
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)); |
|
f = remove_zero_from_list(f); |
|
if ( !BDY(f) ) { |
|
*rp = f; return; |
|
} |
if ( !m ) |
if ( !m ) |
error("dp_weyl_f4_mod_main : invalid argument"); |
error("dp_weyl_f4_mod_main : invalid argument"); |
create_order_spec(ARG3(arg),&ord); |
create_order_spec(ARG3(arg),&ord); |
|
|
asir_assert(ARG2(arg),O_N,"dp_weyl_gr_mod_main"); |
asir_assert(ARG2(arg),O_N,"dp_weyl_gr_mod_main"); |
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); |
|
f = remove_zero_from_list(f); |
|
if ( !BDY(f) ) { |
|
*rp = f; return; |
|
} |
homo = (Num)ARG2(arg); m = QTOS((Q)ARG3(arg)); |
homo = (Num)ARG2(arg); m = QTOS((Q)ARG3(arg)); |
if ( !m ) |
if ( !m ) |
error("dp_weyl_gr_mod_main : invalid argument"); |
error("dp_weyl_gr_mod_main : invalid argument"); |
|
|
for ( i = 0; i < n; i++ ) |
for ( i = 0; i < n; i++ ) |
current_weyl_weight_vector[i] = QTOS((Q)v->body[i]); |
current_weyl_weight_vector[i] = QTOS((Q)v->body[i]); |
*rp = v; |
*rp = v; |
|
} |
|
} |
|
|
|
LIST remove_zero_from_list(LIST l) |
|
{ |
|
NODE n,r0,r; |
|
LIST rl; |
|
|
|
asir_assert(l,O_LIST,"remove_zero_from_list"); |
|
n = BDY(l); |
|
for ( r0 = 0; n; n = NEXT(n) ) |
|
if ( BDY(n) ) { |
|
NEXTNODE(r0,r); |
|
BDY(r) = BDY(n); |
|
} |
|
if ( r0 ) |
|
NEXT(r) = 0; |
|
MKLIST(rl,r0); |
|
return rl; |
|
} |
|
|
|
int get_field_type(P p) |
|
{ |
|
int type,t; |
|
DCP dc; |
|
|
|
if ( !p ) |
|
return 0; |
|
else if ( NUM(p) ) |
|
return NID((Num)p); |
|
else { |
|
type = 0; |
|
for ( dc = DC(p); dc; dc = NEXT(dc) ) { |
|
t = get_field_type(COEF(dc)); |
|
if ( !t ) |
|
continue; |
|
if ( t < 0 ) |
|
return t; |
|
if ( !type ) |
|
type = t; |
|
else if ( t != type ) |
|
return -1; |
|
} |
|
return type; |
} |
} |
} |
} |