version 1.34, 2003/11/27 02:20:51 |
version 1.38, 2004/09/21 05:23:13 |
|
|
* 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/array.c,v 1.33 2003/11/08 01:12:02 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/array.c,v 1.37 2004/09/15 01:43:32 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
#include "parse.h" |
#include "parse.h" |
#include "inline.h" |
#include "inline.h" |
|
|
|
#define F4_INTRAT_PERIOD 8 |
|
|
#if 0 |
#if 0 |
#undef DMAR |
#undef DMAR |
#define DMAR(a1,a2,a3,d,r) (r)=dmar(a1,a2,a3,d); |
#define DMAR(a1,a2,a3,d,r) (r)=dmar(a1,a2,a3,d); |
Line 87 void Pmat_swap_col_destructive(); |
|
Line 89 void Pmat_swap_col_destructive(); |
|
void Pvect(); |
void Pvect(); |
void Pmat(); |
void Pmat(); |
void Pmatc(); |
void Pmatc(); |
|
void Pnd_det(); |
|
|
struct ftab array_tab[] = { |
struct ftab array_tab[] = { |
{"solve_by_lu_gfmmat",Psolve_by_lu_gfmmat,4}, |
{"solve_by_lu_gfmmat",Psolve_by_lu_gfmmat,4}, |
Line 111 struct ftab array_tab[] = { |
|
Line 114 struct ftab array_tab[] = { |
|
{"ltov",Pltov,1}, |
{"ltov",Pltov,1}, |
{"size",Psize,1}, |
{"size",Psize,1}, |
{"det",Pdet,-2}, |
{"det",Pdet,-2}, |
|
{"nd_det",Pnd_det,-2}, |
{"invmat",Pinvmat,-2}, |
{"invmat",Pinvmat,-2}, |
{"leqm",Pleqm,2}, |
{"leqm",Pleqm,2}, |
{"leqm1",Pleqm1,2}, |
{"leqm1",Pleqm1,2}, |
Line 157 int generic_comp_obj(Obj *a,Obj *b) |
|
Line 161 int generic_comp_obj(Obj *a,Obj *b) |
|
void Pqsort(NODE arg,VECT *rp) |
void Pqsort(NODE arg,VECT *rp) |
{ |
{ |
VECT vect; |
VECT vect; |
NODE n; |
NODE n,n1; |
P p; |
P p; |
V v; |
V v; |
FUNC func; |
FUNC func; |
|
int len,i; |
|
pointer *a; |
|
Obj t; |
|
|
asir_assert(ARG0(arg),O_VECT,"qsort"); |
t = ARG0(arg); |
vect = (VECT)ARG0(arg); |
if (OID(t) == O_LIST) { |
|
n = (NODE)BDY((LIST)t); |
|
len = length(n); |
|
MKVECT(vect,len); |
|
for ( i = 0; i < len; i++, n = NEXT(n) ) { |
|
BDY(vect)[i] = BDY(n); |
|
} |
|
|
|
}else if (OID(t) != O_VECT) { |
|
error("qsort : invalid argument"); |
|
}else { |
|
vect = (VECT)t; |
|
} |
if ( argc(arg) == 1 ) |
if ( argc(arg) == 1 ) |
qsort(BDY(vect),vect->len,sizeof(Obj),(int (*)(const void *,const void *))comp_obj); |
qsort(BDY(vect),vect->len,sizeof(Obj),(int (*)(const void *,const void *))comp_obj); |
else { |
else { |
Line 181 void Pqsort(NODE arg,VECT *rp) |
|
Line 200 void Pqsort(NODE arg,VECT *rp) |
|
MKNODE(n,0,0); MKNODE(generic_comp_obj_arg,0,n); |
MKNODE(n,0,0); MKNODE(generic_comp_obj_arg,0,n); |
qsort(BDY(vect),vect->len,sizeof(Obj),(int (*)(const void *,const void *))generic_comp_obj); |
qsort(BDY(vect),vect->len,sizeof(Obj),(int (*)(const void *,const void *))generic_comp_obj); |
} |
} |
*rp = vect; |
if (OID(t) == O_LIST) { |
|
a = BDY(vect); |
|
for ( i = len - 1, n = 0; i >= 0; i-- ) { |
|
MKNODE(n1,a[i],n); n = n1; |
|
} |
|
MKLIST((LIST)*rp,n); |
|
}else { |
|
*rp = vect; |
|
} |
} |
} |
|
|
void PNBmul_gf2n(NODE arg,GF2N *rp) |
void PNBmul_gf2n(NODE arg,GF2N *rp) |
|
|
add_eg(&eg_chrem_split,&tmp0,&tmp1); |
add_eg(&eg_chrem_split,&tmp0,&tmp1); |
|
|
get_eg(&tmp0); |
get_eg(&tmp0); |
if ( ind % 16 ) |
if ( ind % F4_INTRAT_PERIOD ) |
ret = 0; |
ret = 0; |
else |
else |
ret = intmtoratm(crmat,m1,*nm,dn); |
ret = intmtoratm(crmat,m1,*nm,dn); |
Line 1232 int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn |
|
Line 1259 int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn |
|
add_eg(&eg_mul,&tmp0,&tmp1); |
add_eg(&eg_mul,&tmp0,&tmp1); |
/* q = q*md */ |
/* q = q*md */ |
mulq(q,mdq,&u); q = u; |
mulq(q,mdq,&u); q = u; |
if ( !(count % 16) && intmtoratm_q(xmat,NM(q),*nmmat,dn) ) { |
if ( !(count % F4_INTRAT_PERIOD) && intmtoratm_q(xmat,NM(q),*nmmat,dn) ) { |
for ( j = k = l = 0; j < col; j++ ) |
for ( j = k = l = 0; j < col; j++ ) |
if ( cinfo[j] ) |
if ( cinfo[j] ) |
rind[k++] = j; |
rind[k++] = j; |
Line 2890 void printimat(int **mat,int row,int col) |
|
Line 2917 void printimat(int **mat,int row,int col) |
|
} |
} |
printf("\n"); |
printf("\n"); |
} |
} |
|
} |
|
|
|
void Pnd_det(NODE arg,P *rp) |
|
{ |
|
if ( argc(arg) == 1 ) |
|
nd_det(0,ARG0(arg),rp); |
|
else |
|
nd_det(QTOS((Q)ARG1(arg)),ARG0(arg),rp); |
} |
} |