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