15#define mpz_isNeg(A) ((A)->_mp_size<0)
36 if (
mpz_isNeg(n->z)) { *d+=8; mpz_neg(n->z,n->z); }
40 mpz_export(
s,&
l,-1,
sizeof(mp_limb_t),0,0,n->z);
42 s+=
l*
sizeof(mp_limb_t);
47 mpz_export(
s,&
l,-1,
sizeof(mp_limb_t),0,0,n->n);
49 s+=
l*
sizeof(mp_limb_t);
77 mpz_realloc2((*n)->z,
l*
sizeof(mp_limb_t)*8);
78 mpz_import((*n)->z,
l,-1,
sizeof(mp_limb_t),0,0,
s);
79 if (neg) mpz_neg((*n)->z,(*n)->z);
80 s+=
l*
sizeof(mp_limb_t);
86 mpz_init2((*n)->n,
l*
sizeof(mp_limb_t)*8);
87 mpz_import((*n)->n,
l,-1,
sizeof(mp_limb_t),0,0,
s);
88 s+=
l*
sizeof(mp_limb_t);
107 ll+=
l*
sizeof(mp_limb_t);
113 ll+=
l*
sizeof(mp_limb_t);
115 ll+=
l*
sizeof(mp_limb_t);
125 memcpy(
s,
m->exp,r->ExpL_Size*
sizeof(
long));
126 s+=r->ExpL_Size*
sizeof(long);
134 memcpy((*m)->exp,
s,r->ExpL_Size*
sizeof(
long));
135 s+=r->ExpL_Size*
sizeof(long);
142 ll+=r->ExpL_Size*
sizeof(long);
173 for(
long i=0;
i<
l;
i++)
186 long l=SIZEOF_LONG*2;
197 int cnt=0;
int rw=0;
int cl=0;
199 for(
int j=rl-1;
j>=0;
j--)
203 if (xx[
j]->
nrows >rw) rw=xx[
j]->nrows;
208 WerrorS(
"format mismatch in CRT");
212 if ((cpus==1) || (2*cpus>=cnt))
218 int parent_pid=getpid();
223 for(
int i=cnt-1;
i>=0;
i--)
227 for(
int i=cpus;
i>=0;
i--)
233 for (
int i=0;
i<cpus;
i++)
238 if (parent_pid!=getpid())
240 number *
x=(number *)
omAlloc(rl*
sizeof(number));
241 poly *
p=(poly *)
omAlloc(rl*
sizeof(poly));
247 int ind=queue->dequeue();
253 for(
int j=rl-1;
j>=0;
j--)
264 char *
s=(
char*)msg->str();
266 rqueue->enqueue(msg);
276 msg=rqueue->dequeue();
277 char *
s=(
char*)msg->str();
305 int parent_pid=getpid();
310 for(
int i=cnt-1;
i>=0;
i--)
314 for(
int i=cpus;
i>=0;
i--)
320 for (
int i=0;
i<cpus;
i++)
325 if (parent_pid!=getpid())
329 int ind=queue->dequeue();
338 char *
s=(
char*)msg->str();
340 rqueue->enqueue(msg);
350 msg=rqueue->dequeue();
351 char *
s=(
char*)msg->str();
373 printf(
"size: %d\n",ll);
375 printf(
"send len: %d\n",(
int)(
s-
buf));
377 for(
int i=0;
i<=ll/SIZEOF_LONG;
i++) printf(
"%ld ",d[
i]);
381 printf(
"read len: %d\n",(
int)(
s-
buf));
382 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 void vmem_deinit()
static Status vmem_init()
static VRef< VString > vstring(const char *s)
poly p_Farey(poly p, number N, const ring r)
void p_Write(poly p, ring lmRing, ring tailRing)
static poly pReverse(poly p)
static unsigned pLength(poly a)
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 ...
Compatiblity layer for legacy polynomial operations (over currRing)
ideal idInit(int idsize, int rank)
initialise an ideal / module
ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring r)