59 number lo = fun(
lower,
R->cf, r->cf),
60 up = fun(
upper,
R->cf, r->cf);
82 for (
i = 0;
i < n;
i++)
97 for (
i = 0;
i < n;
i++)
107 for (
i = 0;
i < n;
i++)
118 if (0 <=
i && i < R->
N)
204 n1 = (number) args->
CopyD();
208 WerrorS(
"Input not supported: first argument not int or number");
229 WerrorS(
"Input not supported: second argument not int or number");
250 result->data = (
void*) RES;
268 WerrorS(
"syntax: length(<interval>)");
304 int i, imax = 0, imin = 0;
305 for (
i = 1;
i < 4;
i++)
317 lo =
n_Copy(nums[imin], I->
R->cf);
318 up =
n_Copy(nums[imax], I->
R->cf);
321 for (
i = 0;
i < 4;
i++)
442 WerrorS(
"syntax: <interval> + <interval>");
450 WerrorS(
"adding intervals defined in different rings not supported");
461 WerrorS(
"syntax: <interval> - <interval>");
469 WerrorS(
"subtracting intervals defined in different rings not supported");
478 if (i1->
Typ() == i2->
Typ())
486 WerrorS(
"multiplying intervals defined in different rings not supported");
496 leftv iscalar, iinterv;
511 switch (iscalar->
Typ())
514 { n =
nInit((
int)(
long) iscalar->
Data());
break; }
516 { n = (number) iscalar->
CopyD();
break; }
518 {
WerrorS(
"first argument not int/number/interval");
return TRUE; }
540 WerrorS(
"second interval contains zero");
556 WerrorS(
"dividing intervals from different rings not supported");
580 WerrorS(
"first argument not int/number/interval");
600 { n =
nInit((
int)(
long) i2->
Data());
break; }
602 { n =
nCopy((number) i2->
Data());
break; }
605 WerrorS(
"second argument not int/number/interval");
612 WerrorS(
"<interval>/0 not supported");
630 WerrorS(
"syntax: <interval> ^ <int>");
633 int p = (int)(
long) i2->
Data();
636 WerrorS(
"<interval> ^ n not implemented for n < 0");
648 WerrorS(
"syntax: <interval> == <interval>");
665 WerrorS(
"syntax: <interval>[<int>]");
670 int n = (int)(
long) i2->
Data();
683 WerrorS(
"Allowed indices are 1 and 2");
690 number r = (number)
result->Data();
695 result->data = (
void*) out;
714 result->data = (
void*) RES;
728 memset(&
l, 0,
sizeof(
l));
729 memset(&lo, 0,
sizeof(lo));
730 memset(&up, 0,
sizeof(up));
733 l.data = (
void*)
"interval";
761 l->next =
f->m->Read(
f);
763 number lo = (number)
l->CopyD(),
764 up = (number)
l->next->CopyD();
778 return (
void*)
new box();
783 return (
void*)
new box((
box*) d);
805 for (
i = 1;
i < n;
i++)
840 int M =
m > (n-1) ? (n-1) :
m;
842 for (
i = 0;
i <=
M;
i++)
846 WerrorS(
"list contains non-intervals");
860 WerrorS(
"Input not supported: first argument not box, list, or interval");
877 result->data = (
void*) RES;
888 Werror(
"first argument is not box but type(%d), second is type(%d)",
903 WerrorS(
"second argument not int");
911 int i = (int)(
long) b2->
Data();
915 WerrorS(
"index out of bounds");
935 WerrorS(
"second argument not box");
944 WerrorS(
"subtracting boxes from different rings not supported");
949 for (
i = 0;
i < n;
i++)
960 result->data = (
void*) RES;
969 WerrorS(
"second argument not box");
974 for (
i = 0;
i < n;
i++)
1003 WerrorS(
"can only intersect boxes");
1008 number lowerb[n], upperb[n];
1011 for (
i = 0;
i < n;
i++)
1013 lowerb[
i] =
B->intervals[
i]->lower;
1014 upperb[
i] =
B->intervals[
i]->upper;
1022 WerrorS(
"can only intersect boxes");
1027 for (
i = 0;
i < n;
i++)
1031 lowerb[
i] =
B->intervals[
i]->lower;
1035 upperb[
i] =
B->intervals[
i]->upper;
1041 result->data = (
void*) (-1);
1051 for (
i = 0;
i < n;
i++)
1057 result->data = (
void*) RES;
1074 memset(&
l, 0,
sizeof(
l));
1075 memset(&iv, 0,
sizeof(iv));
1078 l.data = (
void*)
"box";
1084 for (
i = 0;
i <
N;
i++)
1086 iv.
data = (
void*)
B->intervals[
i];
1087 f->m->Write(
f, &iv);
1110 for (
i = 1;
i <
N;
i++)
1136 WerrorS(
"boxSet: index out of range");
1147 result->data = (
void*) RES;
1164 poly
p = (poly) args->
Data();
1166 int i, pot, n =
B->R->N;
1174 for (
i = 1;
i <= n;
i++)
1206 result->data = (
void*) RES;
1217 blackbox *b_iv = (blackbox*)
omAlloc0(
sizeof(blackbox)),
1218 *b_bx = (blackbox*)
omAlloc0(
sizeof(blackbox));
1244 psModulFunctions->iiAddCproc(
"rootisolation.lib",
"length",
FALSE,
length);
1245 psModulFunctions->iiAddCproc(
"rootisolation.lib",
"boxSet",
FALSE,
boxSet);
1246 psModulFunctions->iiAddCproc(
"rootisolation.lib",
"evalPolyAtBox",
FALSE,
int setBlackboxStuff(blackbox *bb, const char *n)
define a new type
BOOLEAN blackboxDefaultOp2(int, leftv, leftv, leftv)
default procedure blackboxDefaultOp2, to be called as "default:" branch
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
BOOLEAN blackboxDefaultOpM(int op, leftv res, leftv args)
default procedure blackboxDefaultOpM, to be called as "default:" branch
const CanonicalForm CFMap CFMap & N
Class used for (list of) interpreter objects.
void CleanUp(ring r=currRing)
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
static FORCE_INLINE number n_Invers(number a, const coeffs r)
return the multiplicative inverse of 'a'; raise an error if 'a' is not invertible
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff 'a' is larger than 'b'; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static FORCE_INLINE void n_Normalize(number &n, const coeffs r)
inplace-normalization of n; produces some canonical representation of n;
void WerrorS(const char *s)
static BOOLEAN box_serialize(blackbox *, void *d, si_link f)
static BOOLEAN evalPolyAtBox(leftv result, leftv args)
static void * box_Init(blackbox *)
static BOOLEAN box_Assign(leftv result, leftv args)
static void interval_Destroy(blackbox *, void *d)
static interval * intervalAdd(interval *I, interval *J)
static void box_Destroy(blackbox *, void *d)
static void * interval_Init(blackbox *)
static char * interval_String(blackbox *, void *d)
static interval * intervalSubtract(interval *I, interval *J)
static interval * intervalScalarMultiply(number a, interval *I)
static BOOLEAN box_OpM(int op, leftv result, leftv args)
static bool intervalContainsZero(interval *I)
static char * box_String(blackbox *, void *d)
static void * interval_Copy(blackbox *, void *d)
static interval * intervalPower(interval *I, int p)
static BOOLEAN interval_serialize(blackbox *, void *d, si_link f)
static BOOLEAN interval_Assign(leftv result, leftv args)
static interval * intervalMultiply(interval *I, interval *J)
static BOOLEAN interval_Op2(int op, leftv result, leftv i1, leftv i2)
static void * box_Copy(blackbox *, void *d)
static bool intervalEqual(interval *I, interval *J)
static BOOLEAN interval_deserialize(blackbox **, void **d, si_link f)
STATIC_VAR int intervalID
static BOOLEAN box_deserialize(blackbox **, void **d, si_link f)
static BOOLEAN box_Op2(int op, leftv result, leftv b1, leftv b2)
static BOOLEAN length(leftv result, leftv arg)
static BOOLEAN boxSet(leftv result, leftv args)
BOOLEAN iiCheckTypes(leftv args, const short *type_list, int report)
check a list of arguemys against a given field of types return TRUE if the types match return FALSE (...
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
#define pGetExp(p, i)
Exponent.
void StringSetS(const char *st)
void StringAppendS(const char *st)
void Werror(const char *fmt,...)
static ring rIncRefCnt(ring r)
static void rDecRefCnt(ring r)
box & setInterval(int, interval *)
interval(const ring r=currRing)