1 | #ifndef LONGTRANS_H |
---|
2 | #define LONGTRANS_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id: longtrans.h 12469 2011-02-25 13:38:49Z seelisch $ */ |
---|
7 | /* |
---|
8 | * ABSTRACT: numbers in transcendental field extensions, |
---|
9 | i.e., in rational function fields |
---|
10 | */ |
---|
11 | #include <coeffs/longrat.h> |
---|
12 | #include <polys/monomials/polys-impl.h> |
---|
13 | |
---|
14 | /* |
---|
15 | IMPORTANT INFORMATION: |
---|
16 | Instantiation of an algebraic field extension in SINGULAR |
---|
17 | works by first creating a transcendental field extension |
---|
18 | and then providing a minimal polynomial / minimal ideal. |
---|
19 | Consequently, first the code for transcendental field |
---|
20 | extensions will be activated; see longtrans.*. |
---|
21 | When providing a minimal polynomial / minimal ideal, all |
---|
22 | function pointers will be re-defined, using the below method |
---|
23 | redefineFunctionPointers(). After that, the code for algebraic |
---|
24 | field extensions is active; see longalg.*. |
---|
25 | |
---|
26 | NOTE: |
---|
27 | Elements of algebraic and transcendental field extensions |
---|
28 | are polynomials or quotients of two polynomials, respectively. |
---|
29 | All these polynomials, as well as the minimal polynomial (in |
---|
30 | the case of an algebraic extension) live in the globally |
---|
31 | accessible ring 'nacRing', defined in longtrans.*. |
---|
32 | |
---|
33 | METHOD NAMING CONVENTIONS |
---|
34 | (not true for types / structs / global variables): |
---|
35 | nap* macros and methods operating on polynomials living in |
---|
36 | nacRing (defined in longtrans.*), |
---|
37 | na* (but not nap*) methods and macros for algebraic field |
---|
38 | extensions (defined in longalg.*), |
---|
39 | nt* methods and macros for transcendental field extensions, |
---|
40 | (defined in longtrans.*) |
---|
41 | nac* function pointers for computing with the coefficients of |
---|
42 | polynomials living in nacRing (defined in longtrans.*) |
---|
43 | */ |
---|
44 | |
---|
45 | struct slnumber; |
---|
46 | typedef struct slnumber * lnumber; |
---|
47 | struct slnumber |
---|
48 | { |
---|
49 | poly z; |
---|
50 | poly n; |
---|
51 | BOOLEAN s; |
---|
52 | }; |
---|
53 | |
---|
54 | extern int ntNumbOfPar; |
---|
55 | #define ntParNames (currRing->parameter) |
---|
56 | extern int ntIsChar0; /* == 1 iff char = 0, |
---|
57 | == 0 otherwise */ |
---|
58 | extern ring ntMapRing; |
---|
59 | extern int ntParsToCopy; |
---|
60 | |
---|
61 | /* specific methods / macros for transcendental field extensions */ |
---|
62 | void ntSetChar(int p, ring r); |
---|
63 | void ntDelete (number *p, const ring r); |
---|
64 | number ntInit(int i, const ring r); /* z := i */ |
---|
65 | number ntPar(int i); /* z := par(i) */ |
---|
66 | int ntParDeg(number n); /* i := deg(n) */ |
---|
67 | int ntSize(number n); /* size desc. */ |
---|
68 | int ntInt(number &n, const ring r); |
---|
69 | BOOLEAN ntIsZero(number za); /* za = 0 ? */ |
---|
70 | BOOLEAN ntIsOne(number za); /* za = 1 ? */ |
---|
71 | BOOLEAN ntIsMOne(number za); /* za = -1 ? */ |
---|
72 | BOOLEAN ntEqual(number a, number b); /* a = b ? */ |
---|
73 | BOOLEAN ntGreater(number a, number b); /* dummy */ |
---|
74 | number ntNeg(number za); /* za := - za */ |
---|
75 | number ntInvers(number a); |
---|
76 | void ntPower(number x, int exp, number *lo); |
---|
77 | BOOLEAN ntGreaterZero(number a); |
---|
78 | number ntCopy(number p); /* erg:= p */ |
---|
79 | number nt_Copy(number p, const ring r); /* erg:= p */ |
---|
80 | number ntAdd(number la, number li); /* lu := la+li */ |
---|
81 | number ntMult(number la, number li); /* lo := la*li */ |
---|
82 | number ntDiv(number la, number li); /* lo := la/li */ |
---|
83 | number ntIntDiv(number la, number li); /* lo := la/li */ |
---|
84 | //number ntIntMod(number la, number li); /* lo := la/li */ |
---|
85 | number ntSub(number la, number li); /* lu := la-li */ |
---|
86 | void ntNormalize(number &p); |
---|
87 | number ntGcd(number a, number b, const ring r); |
---|
88 | number ntLcm(number a, number b, const ring r); |
---|
89 | const char* ntRead(const char * s, number * p); |
---|
90 | void ntWrite(number &p, const ring r); |
---|
91 | char* ntName(number n); |
---|
92 | nMapFunc ntSetMap(const ring src, const ring dst); |
---|
93 | number ntMap0P(number c); |
---|
94 | number ntMap00(number c); |
---|
95 | #ifdef LDEBUG |
---|
96 | BOOLEAN ntDBTest(number a, const char *f,const int l); |
---|
97 | #endif |
---|
98 | poly ntRemainder(poly f, const poly g); |
---|
99 | void ntSetIdeal(ideal I); |
---|
100 | void ntCoefNormalize(number pp); |
---|
101 | extern number (*ntMap)(number from); |
---|
102 | |
---|
103 | /* procedure variables for computing with the coefficients of |
---|
104 | polynomials living in nacRing */ |
---|
105 | extern ring nacRing; |
---|
106 | extern numberfunc nacMult, nacSub, nacAdd, nacDiv, nacIntDiv; |
---|
107 | extern number (*nacGcd)(number a, number b, const ring r); |
---|
108 | extern number (*nacLcm)(number a, number b, const ring r); |
---|
109 | extern number (*nacInit)(int i, const ring r); |
---|
110 | extern int (*nacInt)(number &n, const ring r); |
---|
111 | extern void (*nacNormalize)(number &a); |
---|
112 | extern number (*nacNeg)(number a); |
---|
113 | extern number (*nacCopy)(number a); |
---|
114 | extern number (*nacInvers)(number a); |
---|
115 | extern BOOLEAN (*nacIsZero)(number a); |
---|
116 | extern BOOLEAN (*nacIsOne)(number a); |
---|
117 | extern BOOLEAN (*nacGreaterZero)(number a); |
---|
118 | extern BOOLEAN (*nacGreater)(number a, number b); |
---|
119 | extern number (*nacMap)(number); |
---|
120 | |
---|
121 | /* for computing with polynomials living in nacRing */ |
---|
122 | poly napPermNumber(number z, int * par_perm, int P, ring r); |
---|
123 | #define napAddExp(p,i,e) (p_AddExp(p,i,e,currRing->extRing)) |
---|
124 | #define napLength(p) pLength(p) |
---|
125 | #define napNeg(p) (p_Neg(p,currRing->extRing)) |
---|
126 | #define napVariables naNumbOfPar |
---|
127 | #define napGetCoeff(p) pGetCoeff(p) |
---|
128 | #define napGetExpFrom(p,i,r) (p_GetExp(p,i,r->extRing)) |
---|
129 | #define napSetExp(p,i,e) (p_SetExp(p,i,e,currRing->extRing)) |
---|
130 | #define napNew() (p_Init(currRing->extRing)) |
---|
131 | #define napAdd(p1,p2) (p_Add_q(p1,p2,currRing->extRing)) |
---|
132 | #define napSetm(p) p_Setm(p,currRing->extRing) |
---|
133 | #define napCopy(p) p_Copy(p,nacRing) |
---|
134 | #define napSetCoeff(p,n) {n_Delete(&pGetCoeff(p),nacRing);pGetCoeff(p)=n;} |
---|
135 | #define napComp(p,q) p_LmCmp((poly)p,(poly)q, nacRing) |
---|
136 | #define napMultT(A,E) A=(poly)p_Mult_mm((poly)A,(poly)E,nacRing) |
---|
137 | #define napDeg(p) (int)p_Totaldegree(p, nacRing) |
---|
138 | number napGetDenom(number &n, const ring r); |
---|
139 | number napGetNumerator(number &n, const ring r); |
---|
140 | void napTest(poly p); |
---|
141 | poly napInitz(number z); |
---|
142 | poly napCopyNeg(const poly p); |
---|
143 | void napMultN(poly p, const number z); |
---|
144 | void napDivMod(poly f, const poly g, poly *q, poly *r); |
---|
145 | poly napRemainder(poly f, const poly g); |
---|
146 | poly napInvers(poly x, const poly c); |
---|
147 | int napMaxDeg(poly p); |
---|
148 | int napMaxDegLen(poly p, int &l); |
---|
149 | void napWrite(poly p,const BOOLEAN has_denom, const ring r); |
---|
150 | int napExp(poly a, poly b); |
---|
151 | int napExpi(int i, poly a, poly b); |
---|
152 | void napContent(poly ph); |
---|
153 | void napCleardenom(poly ph); |
---|
154 | poly napGcd0(poly a, poly b); |
---|
155 | poly napGcd(poly a, poly b); |
---|
156 | number napLcm(poly a); |
---|
157 | BOOLEAN napDivPoly (poly p, poly q); |
---|
158 | poly napRedp (poly q); |
---|
159 | poly napTailred (poly q); |
---|
160 | poly napMap(poly p); |
---|
161 | poly napPerm(poly p, const int *par_perm, const ring src_ring, |
---|
162 | const nMapFunc nMap); |
---|
163 | const char* napHandleMons(const char *s, int i, poly ex); |
---|
164 | const char* napHandlePars(const char *s, int i, poly ex); |
---|
165 | const char* napRead(const char *s, poly *b); |
---|
166 | |
---|
167 | #endif |
---|
168 | #endif |
---|
169 | |
---|