version 1.59, 2009/03/25 07:06:30 |
version 1.62, 2013/06/14 05:55:24 |
|
|
* 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.58 2009/03/03 10:04:10 ohara Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/array.c,v 1.61 2012/12/17 07:20:44 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
Line 154 int comp_obj(Obj *a,Obj *b) |
|
Line 154 int comp_obj(Obj *a,Obj *b) |
|
|
|
static FUNC generic_comp_obj_func; |
static FUNC generic_comp_obj_func; |
static NODE generic_comp_obj_arg; |
static NODE generic_comp_obj_arg; |
|
static NODE generic_comp_obj_option; |
|
|
int generic_comp_obj(Obj *a,Obj *b) |
int generic_comp_obj(Obj *a,Obj *b) |
{ |
{ |
Line 161 int generic_comp_obj(Obj *a,Obj *b) |
|
Line 162 int generic_comp_obj(Obj *a,Obj *b) |
|
|
|
BDY(generic_comp_obj_arg)=(pointer)(*a); |
BDY(generic_comp_obj_arg)=(pointer)(*a); |
BDY(NEXT(generic_comp_obj_arg))=(pointer)(*b); |
BDY(NEXT(generic_comp_obj_arg))=(pointer)(*b); |
r = (Q)bevalf(generic_comp_obj_func,generic_comp_obj_arg); |
r = (Q)bevalf_with_opts(generic_comp_obj_func,generic_comp_obj_arg,generic_comp_obj_option); |
if ( !r ) |
if ( !r ) |
return 0; |
return 0; |
else |
else |
Line 208 void Pqsort(NODE arg,LIST *rp) |
|
Line 209 void Pqsort(NODE arg,LIST *rp) |
|
func = (FUNC)v->priv; |
func = (FUNC)v->priv; |
} |
} |
generic_comp_obj_func = func; |
generic_comp_obj_func = func; |
MKNODE(n,0,0); MKNODE(generic_comp_obj_arg,0,n); |
MKNODE(n,0,0); MKNODE(generic_comp_obj_arg,0,n); |
|
generic_comp_obj_option = current_option; |
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); |
} |
} |
if (OID(t) == O_LIST) { |
if (OID(t) == O_LIST) { |
Line 342 void Psepmat_destructive(NODE arg,LIST *rp) |
|
Line 344 void Psepmat_destructive(NODE arg,LIST *rp) |
|
sgn = SGN(ent); |
sgn = SGN(ent); |
divn(nm,mod,&quo,&rem); |
divn(nm,mod,&quo,&rem); |
/* if ( quo != nm && rem != nm ) */ |
/* if ( quo != nm && rem != nm ) */ |
/* GC_free(nm); */ |
/* GCFREE(nm); */ |
/* GC_free(ent); */ |
/* GCFREE(ent); */ |
NTOQ(rem,sgn,a[i][j]); NTOQ(quo,sgn,a1[i][j]); |
NTOQ(rem,sgn,a[i][j]); NTOQ(quo,sgn,a1[i][j]); |
} |
} |
MKNODE(n1,mat1,0); MKNODE(n0,mat,n1); |
MKNODE(n1,mat1,0); MKNODE(n0,mat,n1); |
Line 409 void Pnewvect(NODE arg,VECT *rp) |
|
Line 411 void Pnewvect(NODE arg,VECT *rp) |
|
} |
} |
|
|
void Pvect(NODE arg,VECT *rp) { |
void Pvect(NODE arg,VECT *rp) { |
int len,i,r; |
int len,i; |
VECT vect; |
VECT vect; |
pointer *vb; |
pointer *vb; |
NODE tn; |
NODE tn; |
Line 921 void Pgeneric_gauss_elim(NODE arg,LIST *rp) |
|
Line 923 void Pgeneric_gauss_elim(NODE arg,LIST *rp) |
|
int *ri,*ci; |
int *ri,*ci; |
VECT rind,cind; |
VECT rind,cind; |
Q dn,q; |
Q dn,q; |
int i,j,k,l,row,col,t,rank; |
int i,row,col,t,rank; |
int is_hensel = 0; |
int is_hensel = 0; |
char *key; |
char *key; |
Obj value; |
Obj value; |
Line 2961 void inner_product_int(Q *a,Q *b,int n,Q *r) |
|
Line 2963 void inner_product_int(Q *a,Q *b,int n,Q *r) |
|
t = wma; wma = sum; sum = t; |
t = wma; wma = sum; sum = t; |
} |
} |
} |
} |
GC_free(wm); |
GCFREE(wm); |
GC_free(wma); |
GCFREE(wma); |
if ( !sgn ) { |
if ( !sgn ) { |
GC_free(sum); |
GCFREE(sum); |
*r = 0; |
*r = 0; |
} else |
} else |
NTOQ(sum,sgn,*r); |
NTOQ(sum,sgn,*r); |
Line 3019 void inner_product_mat_int_mod(Q **a,int **b,int n,int |
|
Line 3021 void inner_product_mat_int_mod(Q **a,int **b,int n,int |
|
t = wma; wma = sum; sum = t; |
t = wma; wma = sum; sum = t; |
} |
} |
} |
} |
GC_free(wm); |
GCFREE(wm); |
GC_free(wma); |
GCFREE(wma); |
if ( !sgn ) { |
if ( !sgn ) { |
GC_free(sum); |
GCFREE(sum); |
*r = 0; |
*r = 0; |
} else |
} else |
NTOQ(sum,sgn,*r); |
NTOQ(sum,sgn,*r); |
Line 3456 void Pnd_det(NODE arg,P *rp) |
|
Line 3458 void Pnd_det(NODE arg,P *rp) |
|
nd_det(QTOS((Q)ARG1(arg)),ARG0(arg),rp); |
nd_det(QTOS((Q)ARG1(arg)),ARG0(arg),rp); |
} |
} |
|
|
void Pmat_col(NODE arg,P *rp) |
void Pmat_col(NODE arg,VECT *rp) |
{ |
{ |
int i,j,n; |
int i,j,n; |
pointer t; |
|
MAT mat; |
MAT mat; |
VECT vect; |
VECT vect; |
|
|