5#define TRANSEXT_PRIVATES 1
98 lintree.
mark_error(
"trying to share unsupported data type");
121 result->data = (
char *)data;
128 result->data = (
char *)data;
133 size_t nbytes = (mpz_sizeinbase(
num, 2) + 7UL) / 8UL;
134 char *
p = (
char *) alloca(nbytes);
135 mpz_export(
p, &nbytes, 1, 1, 0, 0,
num);
141 size_t nbytes = lintree.
get<
size_t>();
143 mpz_import(
num, nbytes, 1, 1, 0, 0,
p);
162 long data = (long)(val->
Data());
167 long data = lintree.
get<
long>();
172 lintree.
skip<
long>();
178 char *
p = (
char *)val->
Data();
179 size_t len = strlen(
p);
185 size_t len = lintree.
get<
size_t>();
194 size_t len = lintree.
get<
size_t>();
201 char *
p = (
char *)val->
Name();
202 size_t len = strlen(
p);
208 size_t len = lintree.
get<
size_t>();
214 memcpy(
name,
p, len);
223 size_t len = lintree.
get<
size_t>();
233 lintree.
put<
int>(-1);
234 lintree.
put<
long>(nn);
236 lintree.
put<
int>(n->s);
248 int subtype = lintree.
get_int();
251 else if (subtype < 2) {
272 fraction
f= (fraction) n;
281 lintree.
put<
long>((long) n);
287 lintree.
mark_error(
"coefficient type not supported");
306 return (number) (lintree.
get<
long>());
310 lintree.
mark_error(
"coefficient type not supported");
336 lintree.
skip<
long>();
369 int len = rows * cols;
371 for (
int i = 0;
i < len;
i++) {
379 int rows =
v->rows();
380 int cols =
v->cols();
381 int len =
v->length();
384 for (
int i = 0;
i < len;
i++) {
392 int len = rows * cols;
393 for (
int i = 0;
i < len;
i++) {
405 for (
int j=1;
j<=
rVar(r);
j++) {
425 for (
int l = 0;
l < len;
l++) {
438 if (ret==
NULL) ret=
p;
453 for (
int l = 0;
l <len;
l++) {
487 for (
int i=0;
i<mn;
i++)
497 int typ = val->
Typ();
498 void *data = val->
Data();
505 ideal
M = (ideal) data;
520 for (
int i=0;
i<n;
i++)
550 for (
int i=0;
i<r->N;
i++) {
554 if (r->order)
while (r->order[
i] != 0)
i++;
557 if (r->order)
while (r->order[
i] != 0) {
561 switch (r->order[
i]) {
568 for (
int j = r->block0[
i]; j <= r->block1[
i];
j++)
575 lintree.
mark_error(
"ring order not implemented");
610 lintree.
mark_error(
"cannot find coeffient name");
623 names = (
char **)
omAlloc(
N*
sizeof(
char *));
624 for (
int i=0;
i<
N;
i++)
631 int *block0 = (
int *)
omAlloc0((num_ord + 1)*
sizeof(int));
632 int *block1 = (
int *)
omAlloc0((num_ord + 1)*
sizeof(int));
633 int **wvhdl = (
int **)
omAlloc0((num_ord + 1)*
sizeof(
int*));
634 for (
int i=0;
i<num_ord;
i++)
646 wvhdl[
i] = (
int *)
omAlloc((block1[
i]-block0[
i]+1)*
sizeof(int));
647 for (
int j=block0[
i];
j<=block1[
i];
j++)
654 lintree.
mark_error(
"ring oder not implemented for lintrees");
669 r =
rDefault(ch,
N, names, num_ord, ord, block0, block1, wvhdl);
675 r =
rDefault(
cf,
N, names, num_ord, ord, block0, block1, wvhdl);
676 }
else if (ch == -2) {
681 r =
rDefault(
cf,
N, names, num_ord, ord, block0, block1, wvhdl);
682 }
else if (ch == -3) {
683 r =
rDefault(
cf,
N, names, num_ord, ord, block0, block1, wvhdl);
707 for (
int i=0;
i<
N;
i++)
709 int num_ord = lintree.
get_int();
710 for (
int i=0;
i<
N;
i++) {
712 int block0 = lintree.
get_int();
713 int block1 = lintree.
get_int();
721 for (
int j=block0;
j<=block1;
j++)
727 if (ch == -1 || ch == -2) {
739 for (
int i=0;
i<=n;
i++) {
748 for (
int i=0;
i<=n;
i++) {
750 memcpy(&
l->m[
i], val,
sizeof(*val));
758 for (
int i = 0;
i < n;
i++) {
770 encode(lintree, &cmd->arg1);
773 encode(lintree, &cmd->arg2);
775 encode(lintree, &cmd->arg3);
787 memcpy(&cmd->arg1, val,
sizeof(*val));
793 memcpy(&cmd->arg2, val,
sizeof(*val));
798 memcpy(&cmd->arg3, val,
sizeof(*val));
822 printf(
"%d: ", (
int)str.size());
823 for (
int i=0;
i<str.size();
i++) {
825 if (ch < ' ' || ch >= 0x7f)
826 printf(
"#%02x", (
int) ch & 0xff);
835 Werror(
"libthread encoding error: %s",
s);
839 Werror(
"libthread decoding error: %s",
s);
902 rKill((ring) last_ring);
909 rKill((ring) last_ring);
const CanonicalForm CFMap CFMap & N
void put_bytes(char *p, size_t n)
std::string & to_string()
void skip_bytes(size_t n)
void put_cstring(char *p)
LinTree & operator=(const LinTree &other)
const char * get_bytes(size_t n)
void set_last_ring(void *r)
void mark_error(const char *s)
const char * get_cstring()
Class used for (list of) interpreter objects.
@ n_Q
rational (GMP) numbers
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
static FORCE_INLINE int n_GetChar(const coeffs r)
Return the characteristic of the coeff. domain.
static FORCE_INLINE char * nCoeffName(const coeffs cf)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
const CanonicalForm int s
const Variable & v
< [in] a sqrfree bivariate poly
EXTERN_VAR omBin sleftv_bin
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
void set_needs_ring(int typ)
ring decode_ring_raw(LinTree &lintree)
void ref_poly(LinTree &lintree, int by)
void encode_intmat(LinTree &lintree, leftv val)
poly decode_poly(LinTree &lintree, const ring r)
leftv decode_bigint(LinTree &lintree)
void ref_number(LinTree &lintree, int by)
void ref_def(LinTree &lintree, int by)
leftv decode_none(LinTree &lintree)
void encode(LinTree &lintree, leftv val)
void encode_bigint(LinTree &lintree, leftv val)
void ref_none(LinTree &lintree, int by)
void encode_mpz(LinTree &lintree, const mpz_t num)
void updateref(LinTree &lintree, int by)
void ref_number_cf(LinTree &lintree, coeffs cf, int by)
number decode_longrat_cf(LinTree &lintree)
void encode_string(LinTree &lintree, leftv val)
void ref_bigint(LinTree &lintree, int by)
void ref_int(LinTree &lintree, int by)
void encode_none(LinTree &lintree, leftv val)
vector< char > needs_ring
void encode_list(LinTree &lintree, leftv val)
void encode_ring(LinTree &lintree, const ring r)
void decoding_error(const char *s)
vector< LinTreeDecodeFunc > decoders
void(* LinTreeRefFunc)(LinTree &lintree, int by)
void dump_string(string str)
std::string to_string(leftv val)
leftv(* LinTreeDecodeFunc)(LinTree &lintree)
leftv new_leftv(int code, void *data)
leftv decode_command(LinTree &lintree)
void ref_ring(LinTree &lintree, int by)
void encode_command(LinTree &lintree, leftv val)
void ref_ideal(LinTree &lintree, int by)
leftv decode_def(LinTree &lintree)
vector< LinTreeRefFunc > refupdaters
leftv decode_string(LinTree &lintree)
leftv decode_int(LinTree &lintree)
number decode_number_cf(LinTree &lintree, const coeffs cf)
void encode_ideal(LinTree &lintree, int typ, const ideal I, const ring R)
void encoding_error(const char *s)
void encode_int(LinTree &lintree, leftv val)
ideal decode_ideal(LinTree &lintree, int typ, const ring r)
void ref_string(LinTree &lintree, int by)
leftv decode_number(LinTree &lintree)
void encode_def(LinTree &lintree, leftv val)
void decode_mpz(LinTree &lintree, mpz_t &num)
void ref_list(LinTree &lintree, int by)
leftv decode_intmat(LinTree &lintree)
leftv decode_list(LinTree &lintree)
void encode_longrat_cf(LinTree &lintree, const number n)
vector< LinTreeEncodeFunc > encoders
void install(int typ, LinTreeEncodeFunc enc, LinTreeDecodeFunc dec, LinTreeRefFunc ref)
void ref_intmat(LinTree &lintree, int by)
leftv from_string(std::string &str)
void encode_poly(LinTree &lintree, int typ, poly p, const ring r)
void encode_number(LinTree &lintree, leftv val)
leftv decode(LinTree &lintree)
void ref_command(LinTree &lintree, int by)
void(* LinTreeEncodeFunc)(LinTree &lintree, leftv val)
leftv decode_ring(LinTree &lintree)
void encode_number_cf(LinTree &lintree, const number n, const coeffs cf)
The main handler for Singular numbers which are suitable for Singular polynomials.
coeffs nFindCoeffByName(char *cf_name)
find an existing coeff by its "CoeffName"
#define omFreeBin(addr, bin)
static int pLength(poly a)
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
static void p_Setm(poly p, const ring r)
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
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 ...
void Werror(const char *fmt,...)
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
static BOOLEAN rField_is_Zp(const ring r)
static n_coeffType rFieldType(const ring r)
the type of the coefficient filed of r (n_Zp, n_Q, etc)
static ring rIncRefCnt(ring r)
@ ringorder_a64
for int64 weights
@ ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
@ ringorder_IS
Induced (Schreyer) ordering.
static BOOLEAN rField_is_Q(const ring r)
static short rVar(const ring r)
#define rVar(r) (r->N)
ideal idInit(int idsize, int rank)
initialise an ideal / module
int name
New type name for int.
struct for passing initialization parameters to naInitChar