1 | #ifndef NUMBER2_H |
---|
2 | #define NUMBER2_H |
---|
3 | |
---|
4 | #include "kernel/mod2.h" |
---|
5 | #include "omalloc/omalloc.h" |
---|
6 | #include "coeffs/coeffs.h" |
---|
7 | #include "kernel/structs.h" |
---|
8 | #ifdef SINGULAR_4_2 |
---|
9 | struct snumber2; |
---|
10 | struct spoly2; |
---|
11 | typedef struct snumber2 * number2; |
---|
12 | typedef struct spoly2 * poly2; |
---|
13 | struct snumber2 |
---|
14 | { coeffs cf; |
---|
15 | number n; |
---|
16 | }; |
---|
17 | |
---|
18 | struct spoly2 |
---|
19 | { ring cf; |
---|
20 | poly n; |
---|
21 | }; |
---|
22 | |
---|
23 | static inline number2 n2Init(long i, coeffs c) |
---|
24 | { number2 N=(number2)omAlloc0(sizeof(snumber2)); if (c!=NULL) { N->cf=c; N->n=n_Init(i,c);} return N;} |
---|
25 | |
---|
26 | static inline poly2 p2Init(long i, ring c) |
---|
27 | { poly2 N=(poly2)omAlloc0(sizeof(spoly2)); if (c!=NULL) { N->cf=c; N->n=p_ISet(i,c);} return N;} |
---|
28 | |
---|
29 | // type conversion: |
---|
30 | BOOLEAN jjNUMBER2CR(leftv res, leftv a, leftv b); // <any>,cring ->number2 |
---|
31 | BOOLEAN jjN2_CR(leftv res, leftv a); // number2 ->cring |
---|
32 | BOOLEAN jjCM_CR(leftv res, leftv a); // cmatrix ->cring |
---|
33 | BOOLEAN jjBIM2_CR(leftv res, leftv a); // bigint ->cring |
---|
34 | BOOLEAN jjN2_N(leftv res, leftv a); // number2 ->number |
---|
35 | BOOLEAN jjP2_R(leftv res, leftv a); // poly2 ->ring |
---|
36 | // operations: |
---|
37 | BOOLEAN jjNUMBER2_OP1(leftv res, leftv a); |
---|
38 | BOOLEAN jjNUMBER2_OP2(leftv res, leftv a, leftv b); |
---|
39 | BOOLEAN jjNUMBER2_POW(leftv res, leftv a, leftv b); |
---|
40 | BOOLEAN jjPOLY2_OP1(leftv res, leftv a); |
---|
41 | BOOLEAN jjPOLY2_OP2(leftv res, leftv a, leftv b); |
---|
42 | BOOLEAN jjPOLY2_POW(leftv res, leftv a, leftv b); |
---|
43 | |
---|
44 | number2 n2Copy(const number2 d); |
---|
45 | void n2Delete(number2 &d); |
---|
46 | char *n2String(number2 d, BOOLEAN typed); |
---|
47 | void n2Print(number2 d); |
---|
48 | |
---|
49 | poly2 p2Copy(const poly2 d); |
---|
50 | void p2Delete(poly2 &d); |
---|
51 | char *p2String(poly2 d, BOOLEAN typed); |
---|
52 | void p2Print(poly2 d); |
---|
53 | |
---|
54 | BOOLEAN jjCMATRIX_3(leftv, leftv, leftv,leftv); |
---|
55 | #endif |
---|
56 | char *crString(coeffs c); |
---|
57 | |
---|
58 | void crPrint(coeffs cf); |
---|
59 | |
---|
60 | BOOLEAN jjR2_CR(leftv res, leftv a); // ring ->cring |
---|
61 | |
---|
62 | BOOLEAN jjCRING_Zp(leftv res, leftv a, leftv b); |
---|
63 | BOOLEAN jjCRING_Zm(leftv res, leftv a, leftv b); |
---|
64 | |
---|
65 | BOOLEAN jjEQUAL_CR(leftv res, leftv a, leftv b); // compare cring |
---|
66 | |
---|
67 | #endif |
---|