version 1.14, 2004/12/10 07:36:35 |
version 1.18, 2017/08/31 09:11:04 |
|
|
* OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY |
* OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY |
* 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/io/bload.c,v 1.13 2003/12/22 09:33:47 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/io/bload.c,v 1.17 2015/08/04 06:20:45 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
#include "com.h" |
#include "com.h" |
#if defined(PARI) |
|
#include "genpari.h" |
|
int get_lg(GEN); |
|
#endif |
|
|
|
extern VL file_vl; |
extern VL file_vl; |
|
|
|
void loadnbp(FILE *s,NBP *p); |
|
|
void (*loadf[])() = { 0, loadnum, loadp, loadr, loadlist, loadvect, loadmat, |
void (*loadf[])() = { 0, loadnum, loadp, loadr, loadlist, loadvect, loadmat, |
loadstring, 0, loaddp, loadui, loaderror,0,0,0,loadgfmmat, loadbytearray }; |
loadstring, 0, loaddp, loadui, loaderror,0,0,0,loadgfmmat, |
|
loadbytearray, 0, 0, 0, 0, 0, 0, 0, 0, loadnbp }; |
|
|
#if defined(INTERVAL) |
#if defined(INTERVAL) |
void loaditv(); |
void loaditv(); |
void loaditvd(); |
void loaditvd(); |
Line 120 void loadreal(FILE *s,Real *p) |
|
Line 120 void loadreal(FILE *s,Real *p) |
|
|
|
void loadbf(FILE *s,BF *p) |
void loadbf(FILE *s,BF *p) |
{ |
{ |
#if defined(PARI) |
BF r; |
GEN z; |
char dmy; |
unsigned int uexpo,lexpo; |
int sgn,prec; |
char dmy; |
UL exp; |
int sign; |
|
unsigned int len; |
|
unsigned long expo; |
|
BF q; |
|
|
|
|
int len; |
read_char(s,&dmy); |
read_char(s,&dmy); |
read_int(s,&sign); |
NEWBF(r); |
read_int(s,&uexpo); |
read_int(s,&sgn); |
read_int(s,&lexpo); |
read_int(s,&prec); |
|
read_int64(s,&exp); |
#if defined(LONG_IS_32BIT) |
|
if ( uexpo ) |
|
error("loadbf : exponent too large"); |
|
read_int(s,&len); |
read_int(s,&len); |
NEWBF(q,len+2); |
mpfr_init2(r->body,prec); |
z = (GEN)BDY(q); |
MPFR_SIGN(r->body) = sgn; |
settyp(z,t_REAL); |
MPFR_EXP(r->body) = (int)exp; |
setlg(z,len+2); |
#if defined(VISUAL) |
setsigne(z,(long)sign); |
#if !defined(_WIN64) |
setexpo(z,(long)lexpo); |
read_intarray(s,(int *)r->body->_mpfr_d,len); |
read_intarray(s,(int *)(z+2),len); |
#else |
#elif defined(LONG_IS_64BIT) |
read_longarray(s,(long long*)r->body->_mpfr_d,len); |
expo = (((UL)uexpo)<<32)|((UL)lexpo); |
|
read_int(s,&len); |
|
NEWBF(q,(len+5)/2); /* 2+(len+1)/2 */ |
|
z = (GEN)BDY(q); |
|
settyp(z,t_REAL); |
|
setlg(z,(len+5)/2); |
|
setsigne(z,(long)sign); |
|
setexpo(z,(long)expo); |
|
read_longarray(s,z+2,len); |
|
#endif |
#endif |
*p = q; |
|
#else |
#else |
error("loadbf : PARI is not combined"); |
#if SIZEOF_LONG == 4 |
|
read_intarray(s,(int *)r->body->_mpfr_d,len); |
|
#else /* SIZEOF_LONG == 8 */ |
|
read_longarray(s,(long *)r->body->_mpfr_d,len); |
#endif |
#endif |
|
#endif |
|
*p = r; |
} |
} |
|
|
#if defined(INTERVAL) |
#if defined(INTERVAL) |
Line 464 void loadgfmmat(FILE *s,GFMMAT *p) |
|
Line 453 void loadgfmmat(FILE *s,GFMMAT *p) |
|
for ( i = 0; i < row; i++ ) |
for ( i = 0; i < row; i++ ) |
read_intarray(s,a[i],col); |
read_intarray(s,a[i],col); |
*p = mat; |
*p = mat; |
|
} |
|
|
|
void loadnbp(FILE *s,NBP *p) |
|
{ |
|
int n,i; |
|
NBM m; |
|
NODE r0,r; |
|
|
|
read_int(s,&n); |
|
for ( i = 0, r0 = 0; i < n; i++ ) { |
|
NEWNBM(m); |
|
loadobj(s,(Obj *)&m->c); |
|
read_int(s,&m->d); |
|
NEWNBMBDY(m,m->d); read_intarray(s,m->b,(m->d+31)/32); |
|
NEXTNODE(r0,r); BDY(r) = (pointer)m; |
|
} |
|
if ( r0 ) NEXT(r) = 0; |
|
MKNBP(*p,r0); |
} |
} |