version 1.53, 2006/06/12 11:52:10 |
version 1.58, 2009/03/03 10:04:10 |
|
|
* 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.52 2006/05/30 07:35:30 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/builtin/array.c,v 1.57 2009/02/03 00:39:23 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "base.h" |
#include "base.h" |
|
|
|
|
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/stat.h> |
#include <sys/stat.h> |
|
#if !defined(_MSC_VER) |
#include <unistd.h> |
#include <unistd.h> |
|
#endif |
|
|
#define F4_INTRAT_PERIOD 8 |
#define F4_INTRAT_PERIOD 8 |
|
|
Line 391 void Pnewvect(NODE arg,VECT *rp) |
|
Line 393 void Pnewvect(NODE arg,VECT *rp) |
|
if ( argc(arg) == 2 ) { |
if ( argc(arg) == 2 ) { |
list = (LIST)ARG1(arg); |
list = (LIST)ARG1(arg); |
asir_assert(list,O_LIST,"newvect"); |
asir_assert(list,O_LIST,"newvect"); |
|
#if 0 |
for ( r = 0, tn = BDY(list); tn; r++, tn = NEXT(tn) ); |
for ( r = 0, tn = BDY(list); tn; r++, tn = NEXT(tn) ); |
if ( r > len ) { |
if ( r > len ) { |
*rp = vect; |
*rp = vect; |
return; |
return; |
} |
} |
|
#endif |
for ( i = 0, tn = BDY(list), vb = BDY(vect); tn; i++, tn = NEXT(tn) ) |
for ( i = 0, tn = BDY(list), vb = BDY(vect); tn; i++, tn = NEXT(tn) ) |
vb[i] = (pointer)BDY(tn); |
vb[i] = (pointer)BDY(tn); |
} |
} |
Line 457 void Pnewbytearray(NODE arg,BYTEARRAY *rp) |
|
Line 461 void Pnewbytearray(NODE arg,BYTEARRAY *rp) |
|
|
|
ac = argc(arg); |
ac = argc(arg); |
if ( ac == 1 ) { |
if ( ac == 1 ) { |
/* ARG0(arg) must be a filename */ |
if ( !OID((Obj)ARG0(arg)) ) error("newbytearray : invalid argument"); |
asir_assert(ARG0(arg),O_STR,"newbytearray"); |
switch ( OID((Obj)ARG0(arg)) ) { |
fname = BDY((STRING)ARG0(arg)); |
case O_STR: |
fp = fopen(fname,"rb"); |
fname = BDY((STRING)ARG0(arg)); |
if ( !fp ) error("newbytearray : fopen failed"); |
fp = fopen(fname,"rb"); |
if ( stat(fname,&sbuf) < 0 ) error("newbytearray : stat failed"); |
if ( !fp ) error("newbytearray : fopen failed"); |
len = sbuf.st_size; |
if ( stat(fname,&sbuf) < 0 ) |
MKBYTEARRAY(array,len); |
error("newbytearray : stat failed"); |
fread(BDY(array),len,sizeof(char),fp); |
len = sbuf.st_size; |
|
MKBYTEARRAY(array,len); |
|
fread(BDY(array),len,sizeof(char),fp); |
|
break; |
|
case O_N: |
|
if ( !RATN(ARG0(arg)) ) |
|
error("newbytearray : invalid argument"); |
|
len = QTOS((Q)ARG0(arg)); |
|
if ( len < 0 ) |
|
error("newbytearray : invalid size"); |
|
MKBYTEARRAY(array,len); |
|
break; |
|
default: |
|
error("newbytearray : invalid argument"); |
|
} |
} else if ( ac == 2 ) { |
} else if ( ac == 2 ) { |
asir_assert(ARG0(arg),O_N,"newbytearray"); |
asir_assert(ARG0(arg),O_N,"newbytearray"); |
len = QTOS((Q)ARG0(arg)); |
len = QTOS((Q)ARG0(arg)); |
Line 1542 int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn |
|
Line 1560 int generic_gauss_elim_hensel(MAT mat,MAT *nmmat,Q *dn |
|
} |
} |
} |
} |
|
|
int generic_gauss_elim_hensel_dalg(MAT mat,MAT *nmmat,Q *dn,int **rindp,int **cindp) |
int generic_gauss_elim_hensel_dalg(MAT mat,DP *mb,MAT *nmmat,Q *dn,int **rindp,int **cindp) |
{ |
{ |
MAT bmat,xmat; |
MAT bmat,xmat; |
Q **a0,**a,**b,**x,**nm; |
Q **a0,**a,**b,**x,**nm; |
Line 1566 int generic_gauss_elim_hensel_dalg(MAT mat,MAT *nmmat, |
|
Line 1584 int generic_gauss_elim_hensel_dalg(MAT mat,MAT *nmmat, |
|
N wn; |
N wn; |
Q wq; |
Q wq; |
NumberField nf; |
NumberField nf; |
DP *mb; |
|
DP m; |
DP m; |
int col1; |
int col1; |
|
|
nf = get_numberfield(); |
|
mb = nf->mb; |
|
a0 = (Q **)mat->body; |
a0 = (Q **)mat->body; |
row = mat->row; col = mat->col; |
row = mat->row; col = mat->col; |
w = (int **)almat(row,col); |
w = (int **)almat(row,col); |
Line 1818 int intmtoratm(MAT mat,N md,MAT nm,Q *dn) |
|
Line 1833 int intmtoratm(MAT mat,N md,MAT nm,Q *dn) |
|
return 0; |
return 0; |
row = mat->row; col = mat->col; |
row = mat->row; col = mat->col; |
bshiftn(md,1,&t); |
bshiftn(md,1,&t); |
isqrt(t,&b); |
|
#if 0 |
|
isqrt(t,&s); |
isqrt(t,&s); |
bshiftn(s,64,&b); |
bshiftn(s,64,&b); |
if ( !b ) |
if ( !b ) |
b = ONEN; |
b = ONEN; |
#endif |
|
dn0 = ONE; |
dn0 = ONE; |
tmat = (N **)mat->body; |
tmat = (N **)mat->body; |
rmat = (Q **)nm->body; |
rmat = (Q **)nm->body; |
Line 2066 void red_by_compress(int m,unsigned int *p,unsigned in |
|
Line 2078 void red_by_compress(int m,unsigned int *p,unsigned in |
|
|
|
void red_by_vect(int m,unsigned int *p,unsigned int *r,unsigned int hc,int len) |
void red_by_vect(int m,unsigned int *p,unsigned int *r,unsigned int hc,int len) |
{ |
{ |
register unsigned int up,lo; |
unsigned int up,lo,dmy; |
unsigned int dmy; |
|
|
|
*p++ = 0; r++; len--; |
*p++ = 0; r++; len--; |
for ( ; len; len--, r++, p++ ) |
for ( ; len; len--, r++, p++ ) |