1 | #ifndef GRING_H |
---|
2 | #define GRING_H |
---|
3 | /**************************************** |
---|
4 | * Computer Algebra System SINGULAR * |
---|
5 | ****************************************/ |
---|
6 | /* $Id: gring.h,v 1.19 2007-02-07 10:49:40 Singular 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 | poly nc_CreateShortSpoly(poly p1, poly p2, const ring r=currRing); |
---|
69 | |
---|
70 | |
---|
71 | /* brackets: */ |
---|
72 | poly nc_p_Bracket_qq(poly p, poly q); |
---|
73 | |
---|
74 | /* twostd: */ |
---|
75 | ideal twostd(ideal I); |
---|
76 | /* Ann: */ |
---|
77 | ideal Approx_Step(ideal L); |
---|
78 | |
---|
79 | /* complete reduction routines */ |
---|
80 | |
---|
81 | matrix nc_PrintMat(int a, int b, ring r, int metric); |
---|
82 | |
---|
83 | poly p_CopyEmbed(poly p, ring srcRing, int shift, int par_shift); |
---|
84 | poly pOppose(ring Rop, poly p); |
---|
85 | ideal idOppose(ring Rop, ideal I); |
---|
86 | |
---|
87 | |
---|
88 | |
---|
89 | // //////////////////////////////////////////////////////////////////////// // |
---|
90 | // NC inlines |
---|
91 | |
---|
92 | |
---|
93 | |
---|
94 | inline void ncRingType(ring r, nc_type t) |
---|
95 | { |
---|
96 | assume((r != NULL) && (r->nc != NULL)); |
---|
97 | r->nc->type = t; |
---|
98 | }; |
---|
99 | |
---|
100 | inline nc_type ncRingType(ring r) |
---|
101 | { |
---|
102 | assume(rIsPluralRing(r)); |
---|
103 | |
---|
104 | return (r->nc->type); |
---|
105 | }; |
---|
106 | |
---|
107 | |
---|
108 | |
---|
109 | |
---|
110 | // ////////////////////////////////////////////////////// |
---|
111 | |
---|
112 | // returns m*p, does neither destroy p nor m |
---|
113 | inline poly nc_mm_Mult_pp(const poly m, const poly p, const ring r) |
---|
114 | { |
---|
115 | assume(rIsPluralRing(r)); |
---|
116 | assume(r->nc->p_Procs.mm_Mult_pp!=NULL); |
---|
117 | return r->nc->p_Procs.mm_Mult_pp(m, p, r); |
---|
118 | // return pp_Mult_mm( p, m, r); |
---|
119 | } |
---|
120 | |
---|
121 | |
---|
122 | // returns m*p, does destroy p, preserves m |
---|
123 | inline poly nc_mm_Mult_p(const poly m, poly p, const ring r) |
---|
124 | { |
---|
125 | assume(rIsPluralRing(r)); |
---|
126 | assume(r->nc->p_Procs.mm_Mult_p!=NULL); |
---|
127 | return r->nc->p_Procs.mm_Mult_p(m, p, r); |
---|
128 | // return p_Mult_mm( p, m, r); |
---|
129 | } |
---|
130 | |
---|
131 | inline poly nc_CreateSpoly(const poly p1, const poly p2, const ring r) |
---|
132 | { |
---|
133 | assume(rIsPluralRing(r)); |
---|
134 | assume(r->nc->p_Procs.SPoly!=NULL); |
---|
135 | return r->nc->p_Procs.SPoly(p1, p2, r); |
---|
136 | } |
---|
137 | |
---|
138 | inline poly nc_ReduceSpoly(const poly p1, poly p2, const ring r) |
---|
139 | { |
---|
140 | assume(rIsPluralRing(r)); |
---|
141 | assume(r->nc->p_Procs.ReduceSPoly!=NULL); |
---|
142 | return r->nc->p_Procs.ReduceSPoly(p1, p2, r); |
---|
143 | } |
---|
144 | |
---|
145 | inline void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c) |
---|
146 | { |
---|
147 | assume(rIsPluralRing(currRing)); |
---|
148 | |
---|
149 | // return gnc_kBucketPolyRedNew(b, p, c); |
---|
150 | |
---|
151 | assume(currRing->nc->p_Procs.BucketPolyRed!=NULL); |
---|
152 | return currRing->nc->p_Procs.BucketPolyRed(b, p, c); |
---|
153 | } |
---|
154 | |
---|
155 | inline void nc_BucketPolyRed_Z(kBucket_pt b, poly p, number *c) |
---|
156 | { |
---|
157 | assume(rIsPluralRing(currRing)); |
---|
158 | |
---|
159 | // return gnc_kBucketPolyRed_ZNew(b, p, c); |
---|
160 | |
---|
161 | assume(currRing->nc->p_Procs.BucketPolyRed_Z!=NULL); |
---|
162 | return currRing->nc->p_Procs.BucketPolyRed_Z(b, p, c); |
---|
163 | |
---|
164 | } |
---|
165 | |
---|
166 | inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat) |
---|
167 | { |
---|
168 | assume(rIsPluralRing(currRing)); |
---|
169 | |
---|
170 | assume(currRing->nc->p_Procs.GB!=NULL); |
---|
171 | return currRing->nc->p_Procs.GB(F, Q, w, hilb, strat); |
---|
172 | |
---|
173 | /* |
---|
174 | if (pOrdSgn==-1) |
---|
175 | { |
---|
176 | assume(currRing->nc->p_Procs.LocalGB!=NULL); |
---|
177 | return currRing->nc->p_Procs.LocalGB(F, Q, w, hilb, strat); |
---|
178 | } else |
---|
179 | { |
---|
180 | assume(currRing->nc->p_Procs.GlobalGB!=NULL); |
---|
181 | return currRing->nc->p_Procs.GlobalGB(F, Q, w, hilb, strat); |
---|
182 | } |
---|
183 | */ |
---|
184 | } |
---|
185 | |
---|
186 | |
---|
187 | // Macros used to access upper triangle matrices C,D... (which are actually ideals) // afaik |
---|
188 | #define UPMATELEM(i,j,nVar) ( (nVar * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1)-(i) ) |
---|
189 | |
---|
190 | |
---|
191 | #ifdef PLURAL_INTERNAL_DECLARATIONS |
---|
192 | |
---|
193 | // we need nc_gr_initBba for sca_gr_bba and gr_bba. |
---|
194 | void nc_gr_initBba(ideal F,kStrategy strat); |
---|
195 | |
---|
196 | #endif // PLURAL_INTERNAL_DECLARATIONS |
---|
197 | |
---|
198 | #endif // HAVE_PLURAL :( |
---|
199 | #endif // |
---|