15#define mpz_isNeg(A) ((A)->_mp_size<0)
37 if (
mpz_isNeg(n->z)) { *d+=8; mpz_neg(n->z,n->z); }
41 mpz_export(
s,&
l,-1,
sizeof(mp_limb_t),0,0,n->z);
43 s+=
l*
sizeof(mp_limb_t);
48 mpz_export(
s,&
l,-1,
sizeof(mp_limb_t),0,0,n->n);
50 s+=
l*
sizeof(mp_limb_t);
78 mpz_realloc2((*n)->z,
l*
sizeof(mp_limb_t)*8);
79 mpz_import((*n)->z,
l,-1,
sizeof(mp_limb_t),0,0,
s);
80 if (neg) mpz_neg((*n)->z,(*n)->z);
81 s+=
l*
sizeof(mp_limb_t);
87 mpz_init2((*n)->n,
l*
sizeof(mp_limb_t)*8);
88 mpz_import((*n)->n,
l,-1,
sizeof(mp_limb_t),0,0,
s);
89 s+=
l*
sizeof(mp_limb_t);
108 ll+=
l*
sizeof(mp_limb_t);
114 ll+=
l*
sizeof(mp_limb_t);
116 ll+=
l*
sizeof(mp_limb_t);
126 memcpy(
s,
m->exp,r->ExpL_Size*
sizeof(
long));
127 s+=r->ExpL_Size*
sizeof(long);
135 memcpy((*m)->exp,
s,r->ExpL_Size*
sizeof(
long));
136 s+=r->ExpL_Size*
sizeof(long);
143 ll+=r->ExpL_Size*
sizeof(long);
174 for(
long i=0;
i<
l;
i++)
187 long l=SIZEOF_LONG*2;
198 int cnt=0;
int rw=0;
int cl=0;
200 for(
int j=rl-1;
j>=0;
j--)
204 if (xx[
j]->
nrows >rw) rw=xx[
j]->nrows;
209 WerrorS(
"format mismatch in CRT");
216 if ((cpus==1) || (2*cpus>=cnt))
222 int parent_pid=getpid();
227 for(
int i=cnt-1;
i>=0;
i--)
231 for(
int i=cpus;
i>=0;
i--)
237 for (
int i=0;
i<cpus;
i++)
239 int pid = fork_process();
242 if (parent_pid!=getpid())
244 number *
x=(number *)
omAlloc(rl*
sizeof(number));
245 poly *
p=(poly *)
omAlloc(rl*
sizeof(poly));
251 int ind=queue->dequeue();
257 for(
int j=rl-1;
j>=0;
j--)
268 char *
s=(
char*)msg->str();
270 rqueue->enqueue(msg);
280 msg=rqueue->dequeue();
281 char *
s=(
char*)msg->str();
312 int parent_pid=getpid();
317 for(
int i=cnt-1;
i>=0;
i--)
321 for(
int i=cpus;
i>=0;
i--)
327 for (
int i=0;
i<cpus;
i++)
329 int pid = fork_process();
332 if (parent_pid!=getpid())
336 int ind=queue->dequeue();
345 char *
s=(
char*)msg->str();
347 rqueue->enqueue(msg);
357 msg=rqueue->dequeue();
358 char *
s=(
char*)msg->str();
384 printf(
"size: %d\n",ll);
386 printf(
"send len: %d\n",(
int)(
s-
buf));
388 for(
int i=0;
i<=ll/SIZEOF_LONG;
i++) printf(
"%ld ",d[
i]);
392 printf(
"read len: %d\n",(
int)(
s-
buf));
393 Print(
":index: %d\n",ll);
const CanonicalForm CFMap CFMap & N
const CanonicalForm int s
void WerrorS(const char *s)
static void * feOptValue(feOptIndex opt)
ideal id_Farey(ideal x, number N, const ring r)
static char * get_poly(char *s, int &ind, poly *p, const ring r)
static char * get_mon(char *s, poly *m, const ring r)
static long size_poly(poly p, const ring r)
ideal id_Farey_0(ideal x, number N, const ring r)
static long size_number(number n)
static char * send_poly(char *s, int ind, poly p, const ring r)
static char * send_number(char *s, number n)
static char * send_mon(char *s, poly m, const ring r)
ideal id_ChineseRemainder_0(ideal *xx, number *q, int rl, const ring r)
static char * get_number(char *s, number *n)
static long size_mon(poly m, const ring r)
poly p_ChineseRemainder(poly *xx, mpz_ptr *x, mpz_ptr *q, int rl, mpz_ptr *C, const ring R)
static const int MAX_PROCESS
poly p_Farey(poly p, number N, const ring r)
static int pLength(poly a)
void p_Write(poly p, ring lmRing, ring tailRing)
static poly pReverse(poly p)
static poly p_Init(const ring r, omBin bin)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Compatibility layer for legacy polynomial operations (over currRing)
int status int void * buf
ideal idInit(int idsize, int rank)
initialise an ideal / module
ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r)