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