1 | #ifndef GRING_H |
---|
2 | #define GRING_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id: gring.h,v 1.17 2007-01-11 11:27:25 Singular Exp $ */ |
---|
7 | /* |
---|
8 | * ABSTRACT additional defines etc for --with-plural |
---|
9 | */ |
---|
10 | |
---|
11 | #ifdef HAVE_PLURAL |
---|
12 | #include "structs.h" |
---|
13 | #include "ring.h" |
---|
14 | |
---|
15 | /* the part, related to the interface */ |
---|
16 | BOOLEAN nc_CallPlural(matrix CC, matrix DD, poly CN, poly DN, ring r); |
---|
17 | BOOLEAN nc_CheckOrdCondition(matrix D, ring r); |
---|
18 | BOOLEAN nc_CheckSubalgebra(poly PolyVar, ring r); |
---|
19 | BOOLEAN nc_InitMultiplication(ring r); |
---|
20 | BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate); |
---|
21 | |
---|
22 | // set pProcs for r and global variable p_Procs |
---|
23 | void SetProcsGNC(ring& rGR, p_Procs_s* p_Procs); |
---|
24 | |
---|
25 | ring nc_rCreateNCcomm(ring r); |
---|
26 | void ncKill(ring r); |
---|
27 | void ncCleanUp(ring r); /* smaller than kill */ |
---|
28 | |
---|
29 | /* poly functions defined in p_Procs : */ |
---|
30 | |
---|
31 | /* other routines we need in addition : */ |
---|
32 | // poly gnc_p_Minus_mm_Mult_qq(poly p, const poly m, poly q, const ring r); |
---|
33 | |
---|
34 | // #define PLURAL_INTERNAL_DECLARATIONS |
---|
35 | |
---|
36 | #ifdef PLURAL_INTERNAL_DECLARATIONS |
---|
37 | // // poly gnc_p_Minus_mm_Mult_qq_ign(poly p, const poly m, poly q, int & d1, poly d2, const ring ri, poly &d3); |
---|
38 | |
---|
39 | |
---|
40 | poly gnc_pp_Mult_mm(const poly p, const poly m, const ring r, poly &last); |
---|
41 | poly gnc_p_Mult_mm(poly p, const poly m, const ring r); |
---|
42 | poly gnc_mm_Mult_p(const poly m, poly p, const ring r); |
---|
43 | poly gnc_mm_Mult_pp(const poly m, const poly p, const ring r); |
---|
44 | #endif |
---|
45 | |
---|
46 | |
---|
47 | |
---|
48 | // // for p_Minus_mm_Mult_qq in pInline2.h |
---|
49 | // poly nc_p_Minus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp, int lq, const ring r); |
---|
50 | // // for p_Plus_mm_Mult_qq in pInline2.h |
---|
51 | // poly nc_p_Plus_mm_Mult_qq (poly p, const poly m, const poly q, int &lp, int lq, const ring r); |
---|
52 | |
---|
53 | |
---|
54 | // |
---|
55 | poly nc_p_Minus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp, |
---|
56 | const int, const poly, const ring r); |
---|
57 | // returns p + m*q destroys p, const: q, m |
---|
58 | poly nc_p_Plus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp, |
---|
59 | const int, const ring r); |
---|
60 | |
---|
61 | |
---|
62 | // poly _gnc_p_Mult_q(poly p, poly q, const int copy, const ring r); |
---|
63 | |
---|
64 | // general multiplication: |
---|
65 | poly _nc_p_Mult_q(poly p, poly q, const ring r); |
---|
66 | poly _nc_pp_Mult_qq(const poly p, const poly q, const ring r); |
---|
67 | |
---|
68 | |
---|
69 | /* subst: */ |
---|
70 | poly nc_pSubst(poly p, int n, poly e); |
---|
71 | |
---|
72 | /* copy : */ |
---|
73 | poly nc_p_CopyGet(poly a, const ring r); |
---|
74 | poly nc_p_CopyPut(poly a, const ring r); |
---|
75 | |
---|
76 | void nc_PolyPolyRed(poly &b, poly p, number *c); |
---|
77 | poly nc_CreateShortSpoly(poly p1, poly p2, const ring r=currRing); |
---|
78 | |
---|
79 | |
---|
80 | #define PLURAL_INTERNAL_DECLARATIONS |
---|
81 | #ifdef PLURAL_INTERNAL_DECLARATIONS |
---|
82 | /* syzygies : */ |
---|
83 | poly gnc_CreateSpolyOld(const poly p1, const poly p2/*, poly spNoether*/, const ring r); |
---|
84 | poly gnc_ReduceSpolyOld(const poly p1, poly p2/*, poly spNoether*/, const ring r); |
---|
85 | |
---|
86 | poly gnc_CreateSpolyNew(const poly p1, const poly p2/*, poly spNoether*/, const ring r); |
---|
87 | poly gnc_ReduceSpolyNew(const poly p1, poly p2/*, poly spNoether*/, const ring r); |
---|
88 | |
---|
89 | |
---|
90 | |
---|
91 | void gnc_kBucketPolyRedNew(kBucket_pt b, poly p, number *c); |
---|
92 | void gnc_kBucketPolyRed_ZNew(kBucket_pt b, poly p, number *c); |
---|
93 | |
---|
94 | void gnc_kBucketPolyRedOld(kBucket_pt b, poly p, number *c); |
---|
95 | void gnc_kBucketPolyRed_ZOld(kBucket_pt b, poly p, number *c); |
---|
96 | |
---|
97 | |
---|
98 | // poly gnc_ReduceSpolyNew(poly p1, poly p2, poly spNoether, const ring r); |
---|
99 | // void gnc_ReduceSpolyTail(poly p1, poly q, poly q2, poly spNoether, const ring r); |
---|
100 | |
---|
101 | /* void nc_kBucketPolyRed(kBucket_pt b, poly p); */ |
---|
102 | void gr_initBba(ideal F,kStrategy strat); |
---|
103 | |
---|
104 | ideal gnc_gr_bba (const ideal F, const ideal Q, const intvec *, const intvec *, kStrategy strat); |
---|
105 | ideal gnc_gr_mora(const ideal, const ideal, const intvec *, const intvec *, kStrategy); // Not yet! |
---|
106 | #endif |
---|
107 | |
---|
108 | |
---|
109 | /* brackets: */ |
---|
110 | poly nc_p_Bracket_qq(poly p, poly q); |
---|
111 | |
---|
112 | /* twostd: */ |
---|
113 | ideal twostd(ideal I); |
---|
114 | /* Ann: */ |
---|
115 | ideal Approx_Step(ideal L); |
---|
116 | |
---|
117 | /* complete reduction routines */ |
---|
118 | |
---|
119 | matrix nc_PrintMat(int a, int b, ring r, int metric); |
---|
120 | |
---|
121 | poly p_CopyEmbed(poly p, ring srcRing, int shift, int par_shift); |
---|
122 | poly pOppose(ring Rop, poly p); |
---|
123 | ideal idOppose(ring Rop, ideal I); |
---|
124 | |
---|
125 | |
---|
126 | |
---|
127 | // //////////////////////////////////////////////////////////////////////// // |
---|
128 | // NC inlines |
---|
129 | |
---|
130 | |
---|
131 | |
---|
132 | inline void ncRingType(ring r, nc_type t) |
---|
133 | { |
---|
134 | assume((r != NULL) && (r->nc != NULL)); |
---|
135 | r->nc->type = t; |
---|
136 | }; |
---|
137 | |
---|
138 | inline nc_type ncRingType(ring r) |
---|
139 | { |
---|
140 | assume(rIsPluralRing(r)); |
---|
141 | |
---|
142 | return (r->nc->type); |
---|
143 | }; |
---|
144 | |
---|
145 | |
---|
146 | |
---|
147 | |
---|
148 | // ////////////////////////////////////////////////////// |
---|
149 | |
---|
150 | // returns m*p, does neither destroy p nor m |
---|
151 | inline poly nc_mm_Mult_pp(const poly m, const poly p, const ring r) |
---|
152 | { |
---|
153 | assume(rIsPluralRing(r)); |
---|
154 | assume(r->nc->p_Procs.mm_Mult_pp!=NULL); |
---|
155 | return r->nc->p_Procs.mm_Mult_pp(m, p, r); |
---|
156 | // return pp_Mult_mm( p, m, r); |
---|
157 | } |
---|
158 | |
---|
159 | |
---|
160 | // returns m*p, does destroy p, preserves m |
---|
161 | inline poly mm_Mult_p(const poly m, poly p, const ring r) |
---|
162 | { |
---|
163 | assume(rIsPluralRing(r)); |
---|
164 | assume(r->nc->p_Procs.mm_Mult_p!=NULL); |
---|
165 | return r->nc->p_Procs.mm_Mult_p(m, p, r); |
---|
166 | // return p_Mult_mm( p, m, r); |
---|
167 | } |
---|
168 | |
---|
169 | inline poly nc_SPoly(const poly p1, const poly p2, const ring r) |
---|
170 | { |
---|
171 | assume(rIsPluralRing(r)); |
---|
172 | assume(r->nc->p_Procs.SPoly!=NULL); |
---|
173 | return r->nc->p_Procs.SPoly(p1, p2, r); |
---|
174 | } |
---|
175 | |
---|
176 | inline poly nc_ReduceSPoly(const poly p1, poly p2, const ring r) |
---|
177 | { |
---|
178 | assume(rIsPluralRing(r)); |
---|
179 | assume(r->nc->p_Procs.ReduceSPoly!=NULL); |
---|
180 | return r->nc->p_Procs.ReduceSPoly(p1, p2, r); |
---|
181 | } |
---|
182 | |
---|
183 | inline void nc_BucketPolyRed(kBucket_pt b, poly p, number *c) |
---|
184 | { |
---|
185 | assume(rIsPluralRing(currRing)); |
---|
186 | |
---|
187 | // return gnc_kBucketPolyRedNew(b, p, c); |
---|
188 | |
---|
189 | assume(currRing->nc->p_Procs.BucketPolyRed!=NULL); |
---|
190 | return currRing->nc->p_Procs.BucketPolyRed(b, p, c); |
---|
191 | } |
---|
192 | |
---|
193 | inline void nc_BucketPolyRed_Z(kBucket_pt b, poly p, number *c) |
---|
194 | { |
---|
195 | assume(rIsPluralRing(currRing)); |
---|
196 | |
---|
197 | // return gnc_kBucketPolyRed_ZNew(b, p, c); |
---|
198 | |
---|
199 | assume(currRing->nc->p_Procs.BucketPolyRed_Z!=NULL); |
---|
200 | return currRing->nc->p_Procs.BucketPolyRed_Z(b, p, c); |
---|
201 | |
---|
202 | } |
---|
203 | |
---|
204 | inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat) |
---|
205 | { |
---|
206 | assume(rIsPluralRing(currRing)); |
---|
207 | |
---|
208 | assume(currRing->nc->p_Procs.GB!=NULL); |
---|
209 | return currRing->nc->p_Procs.GB(F, Q, w, hilb, strat); |
---|
210 | |
---|
211 | /* |
---|
212 | if (pOrdSgn==-1) |
---|
213 | { |
---|
214 | assume(currRing->nc->p_Procs.LocalGB!=NULL); |
---|
215 | return currRing->nc->p_Procs.LocalGB(F, Q, w, hilb, strat); |
---|
216 | } else |
---|
217 | { |
---|
218 | assume(currRing->nc->p_Procs.GlobalGB!=NULL); |
---|
219 | return currRing->nc->p_Procs.GlobalGB(F, Q, w, hilb, strat); |
---|
220 | } |
---|
221 | */ |
---|
222 | } |
---|
223 | |
---|
224 | |
---|
225 | // Macros used to access upper triangle matrices C,D... (which are actually ideals) // afaik |
---|
226 | #define UPMATELEM(i,j,nVar) ( (nVar * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1)-(i) ) |
---|
227 | |
---|
228 | #endif |
---|
229 | #endif |
---|