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;
204 WerrorS(
"no sub-processes allowed");
207 int cnt=0;
int rw=0;
int cl=0;
209 for(
int j=rl-1;
j>=0;
j--)
213 if (xx[
j]->
nrows >rw) rw=xx[
j]->nrows;
218 WerrorS(
"format mismatch in CRT");
231 int parent_pid=getpid();
236 for(
int i=cnt-1;
i>=0;
i--)
240 for(
int i=cpus;
i>=0;
i--)
246 int *pids=(
int*)
omAlloc0(cpus*
sizeof(
int));
247 for (
int i=0;
i<cpus;
i++)
253 if (parent_pid!=getpid())
258 number *
x=(number *)
omAlloc(rl*
sizeof(number));
259 poly *
p=(poly *)
omAlloc(rl*
sizeof(poly));
265 int ind=queue->dequeue();
271 for(
int j=rl-1;
j>=0;
j--)
282 char *
s=(
char*)msg->str();
284 rqueue->enqueue(msg);
294 msg=rqueue->dequeue();
295 char *
s=(
char*)msg->str();
311 int p=si_waitpid(pids[
i],
NULL,WNOHANG);
345 int parent_pid=getpid();
350 for(
int i=cnt-1;
i>=0;
i--)
354 for(
int i=cpus;
i>=0;
i--)
360 int *pids=(
int*)
omAlloc0(cpus*
sizeof(
int));
361 for (
int i=0;
i<cpus;
i++)
367 if (parent_pid!=getpid())
374 int ind=queue->dequeue();
383 char *
s=(
char*)msg->str();
385 rqueue->enqueue(msg);
395 msg=rqueue->dequeue();
396 char *
s=(
char*)msg->str();
412 int p=si_waitpid(pids[
i],
NULL,WNOHANG);
438 printf(
"size: %d\n",ll);
440 printf(
"send len: %d\n",(
int)(
s-
buf));
442 for(
int i=0;
i<=ll/SIZEOF_LONG;
i++) printf(
"%ld ",d[
i]);
446 printf(
"read len: %d\n",(
int)(
s-
buf));
447 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()