15#define mpz_isNeg(A) ((A)->_mp_size<0)
40 if (
mpz_isNeg(n->z)) { *d+=8; mpz_neg(n->z,n->z); }
44 mpz_export(
s,&
l,-1,
sizeof(mp_limb_t),0,0,n->z);
46 s+=
l*
sizeof(mp_limb_t);
51 mpz_export(
s,&
l,-1,
sizeof(mp_limb_t),0,0,n->n);
53 s+=
l*
sizeof(mp_limb_t);
81 mpz_realloc2((*n)->z,
l*
sizeof(mp_limb_t)*8);
82 mpz_import((*n)->z,
l,-1,
sizeof(mp_limb_t),0,0,
s);
83 if (neg) mpz_neg((*n)->z,(*n)->z);
84 s+=
l*
sizeof(mp_limb_t);
90 mpz_init2((*n)->n,
l*
sizeof(mp_limb_t)*8);
91 mpz_import((*n)->n,
l,-1,
sizeof(mp_limb_t),0,0,
s);
92 s+=
l*
sizeof(mp_limb_t);
111 ll+=
l*
sizeof(mp_limb_t);
117 ll+=
l*
sizeof(mp_limb_t);
119 ll+=
l*
sizeof(mp_limb_t);
129 memcpy(
s,
m->exp,r->ExpL_Size*
sizeof(
long));
130 s+=r->ExpL_Size*
sizeof(long);
138 memcpy((*m)->exp,
s,r->ExpL_Size*
sizeof(
long));
139 s+=r->ExpL_Size*
sizeof(long);
146 ll+=r->ExpL_Size*
sizeof(long);
177 for(
long i=0;
i<
l;
i++)
190 long l=SIZEOF_LONG*2;
201 int cnt=0;
int rw=0;
int cl=0;
203 for(
int j=rl-1;
j>=0;
j--)
207 if (xx[
j]->
nrows >rw) rw=xx[
j]->nrows;
212 WerrorS(
"format mismatch in CRT");
226 int parent_pid=getpid();
231 for(
int i=cnt-1;
i>=0;
i--)
235 for(
int i=cpus;
i>=0;
i--)
241 int *pids=(
int*)
omAlloc0(cpus*
sizeof(
int));
242 for (
int i=0;
i<cpus;
i++)
248 if (parent_pid!=getpid())
253 number *
x=(number *)
omAlloc(rl*
sizeof(number));
254 poly *
p=(poly *)
omAlloc(rl*
sizeof(poly));
260 int ind=queue->dequeue();
266 for(
int j=rl-1;
j>=0;
j--)
277 char *
s=(
char*)msg->str();
279 rqueue->enqueue(msg);
289 msg=rqueue->dequeue();
290 char *
s=(
char*)msg->str();
306 int p=si_waitpid(pids[
i],
NULL,WNOHANG);
340 int parent_pid=getpid();
345 for(
int i=cnt-1;
i>=0;
i--)
349 for(
int i=cpus;
i>=0;
i--)
355 int *pids=(
int*)
omAlloc0(cpus*
sizeof(
int));
356 for (
int i=0;
i<cpus;
i++)
362 if (parent_pid!=getpid())
369 int ind=queue->dequeue();
378 char *
s=(
char*)msg->str();
380 rqueue->enqueue(msg);
390 msg=rqueue->dequeue();
391 char *
s=(
char*)msg->str();
407 int p=si_waitpid(pids[
i],
NULL,WNOHANG);
433 printf(
"size: %d\n",ll);
435 printf(
"send len: %d\n",(
int)(
s-
buf));
437 for(
int i=0;
i<=ll/SIZEOF_LONG;
i++) printf(
"%ld ",d[
i]);
441 printf(
"read len: %d\n",(
int)(
s-
buf));
442 Print(
":index: %d\n",ll);
static int si_min(const int a, const int b)
const CanonicalForm CFMap CFMap & N
si_hdl_typ si_set_signal(int sig, si_hdl_typ signal_handler)
meta function for binding a signal to an handler
void sig_term_hdl_child(int)
const CanonicalForm int s
void WerrorS(const char *s)
const char * feSetOptValue(feOptIndex opt, char *optarg)
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
static void vmem_deinit()
static Status vmem_init()
static VRef< VString > vstring(const char *s)
#define omFreeSize(addr, size)
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)
void singular_close_links()