source: git/kernel/gring.h @ 098f98f

spielwiese
Last change on this file since 098f98f was 341696, checked in by Hans Schönemann <hannes@…>, 14 years ago
Adding Id property to all files git-svn-id: file:///usr/local/Singular/svn/trunk@12231 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 7.9 KB
Line 
1#ifndef GRING_H
2#define GRING_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id$ */
7/*
8* ABSTRACT additional defines etc for --with-plural
9*/
10
11#ifdef HAVE_PLURAL
12
13
14#include <structs.h>
15#include <ring.h>
16#include <matpol.h>
17
18// the part, related to the interface
19// Changes r, Assumes that all other input belongs to curr
20BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r,
21                      bool bSetupQuotient = false,
22                      bool bCopyInput = true,
23                      bool bBeQuiet = false,
24                      ring curr = currRing);
25
26// BOOLEAN nc_CheckOrdCondition(matrix D, ring r);
27// BOOLEAN nc_CheckOrdCondition(ring r); // with D == r->GetNC()->D
28
29BOOLEAN nc_CheckSubalgebra(poly PolyVar, ring r);
30
31// BOOLEAN nc_InitMultiplication(ring r); // should call nc_p_ProcsSet!
32// NOTE: instead of constructing nc_struct and calling nc_InitMultiplication yourself - just create C, D and call nc_CallPlural!!!
33
34
35BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate);
36
37
38// set pProcs table for rGR and global variable p_Procs
39// this should be used by p_ProcsSet in p_Procs_Set.h
40void nc_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
41
42// this function should be used inside QRing definition!
43// we go from rG into factor ring rGR with factor ideal rGR->qideal.
44bool nc_SetupQuotient(ring rGR, const ring rG = NULL, bool bCopy = false); // rG == NULL means that there is no base G-algebra
45
46
47// used by "rSum" from ring.cc only!
48// purpose init nc structure for initially commutative ring:
49// "creates a commutative nc extension; "converts" comm.ring to a Plural ring"
50ring nc_rCreateNCcomm(ring r); 
51
52void nc_rKill(ring r); // complete destructor
53
54BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient = true); // in ring.cc
55
56bool nc_rCopy(ring res, const ring r, bool bSetupQuotient);
57
58// for p_Minus_mm_Mult_qq in pInline2.h
59poly nc_p_Minus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp,
60                                    const int, const poly, const ring r);
61
62// // for p_Plus_mm_Mult_qq in pInline2.h
63// returns p + m*q destroys p, const: q, m
64poly nc_p_Plus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp,
65                              const int, const ring r);
66
67
68// poly _gnc_p_Mult_q(poly p, poly q, const int copy, const ring r);
69
70// general multiplication:
71poly _nc_p_Mult_q(poly p, poly q, const ring r);
72poly _nc_pp_Mult_qq(const poly p, const poly q, const ring r);
73
74
75/* subst: */
76poly nc_pSubst(poly p, int n, poly e);
77
78/* copy : */
79poly nc_p_CopyGet(poly a, const ring r);
80poly nc_p_CopyPut(poly a, const ring r);
81
82void nc_PolyPolyRed(poly &b, poly p, number *c);
83
84
85
86poly nc_CreateShortSpoly(poly p1, poly p2, const ring r=currRing);
87
88
89/* brackets: p will be destroyed... */
90poly nc_p_Bracket_qq(poly p, const poly q);
91
92/* twostd: */
93ideal twostd(ideal I);
94/* Ann: */
95ideal Approx_Step(ideal L);
96
97/* complete reduction routines */
98
99matrix nc_PrintMat(int a, int b, ring r, int metric);
100
101poly p_CopyEmbed(poly p, ring srcRing, int shift, int par_shift);
102poly pOppose(ring Rop, poly p);
103ideal idOppose(ring Rop, ideal I);
104
105
106// const int GRMASK = 1 << 1;
107const int SCAMASK = 1; // For backward compatibility
108const int TESTSYZSCAMASK = 0x0100 | SCAMASK; //
109
110// NCExtensions Mask Property
111int& getNCExtensions();
112int  setNCExtensions(int iMask);
113
114// Test
115bool ncExtensions(int iMask); //  = 0x0FFFF
116
117
118// returns the LCM of the head terms of a and b with the given component
119// NOTE: coeff will be created but remains undefined(zero?)
120poly p_Lcm(const poly a, const poly b, const long lCompM, const ring r);
121
122// returns the LCM of the head terms of a and b with component = max comp. of a & b
123// NOTE: coeff will be created but remains undefined(zero?)
124poly p_Lcm(const poly a, const poly b, const ring r);
125
126
127
128// //////////////////////////////////////////////////////////////////////// //
129// NC inlines
130
131inline nc_struct*& GetNC(ring r)
132{
133  return r->GetNC();
134}; 
135
136inline nc_type& ncRingType(nc_struct* p)
137{
138  assume(p!=NULL);
139  return (p->ncRingType());
140};
141
142inline nc_type ncRingType(ring r) // Get
143{
144  if(rIsPluralRing(r))
145    return (ncRingType(r->GetNC()));
146  else
147    return (nc_error);
148};
149
150inline void ncRingType(ring r, nc_type t) // Set
151{
152  assume((r != NULL) && (r->GetNC() != NULL));
153  ncRingType(r->GetNC()) = t;
154};
155
156
157inline void ncRingType(nc_struct* p, nc_type t) // Set
158{
159  assume(p!=NULL);
160  ncRingType(p) = t;
161};
162
163
164
165
166
167// //////////////////////////////////////////////////////
168
169// returns m*p, does neither destroy p nor m
170inline poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
171{
172  assume(rIsPluralRing(r));
173  assume(r->GetNC()->p_Procs.mm_Mult_pp!=NULL);
174  return r->GetNC()->p_Procs.mm_Mult_pp(m, p, r);
175//  return pp_Mult_mm( p, m, r);
176}
177
178
179// returns m*p, does destroy p, preserves m
180inline poly nc_mm_Mult_p(const poly m, poly p, const ring r)
181{
182  assume(rIsPluralRing(r));
183  assume(r->GetNC()->p_Procs.mm_Mult_p!=NULL);
184  return r->GetNC()->p_Procs.mm_Mult_p(m, p, r);
185//   return p_Mult_mm( p, m, r);
186}
187
188inline poly nc_CreateSpoly(const poly p1, const poly p2, const ring r)
189{
190  assume(rIsPluralRing(r));
191  assume(r->GetNC()->p_Procs.SPoly!=NULL);
192  return r->GetNC()->p_Procs.SPoly(p1, p2, r);
193}
194
195inline poly nc_ReduceSpoly(const poly p1, poly p2, const ring r)
196{
197  assume(rIsPluralRing(r));
198  assume(r->GetNC()->p_Procs.ReduceSPoly!=NULL);
199#ifdef PDEBUG
200//  assume(p_LmDivisibleBy(p1, p2, r));
201#endif
202  return r->GetNC()->p_Procs.ReduceSPoly(p1, p2, r);
203}
204
205/*
206inline void nc_PolyReduce(poly &b, const poly p, number *c, const ring r) // nc_PolyPolyRed
207{
208  assume(rIsPluralRing(r));
209//  assume(r->GetNC()->p_Procs.PolyReduce!=NULL);
210//  r->GetNC()->p_Procs.PolyReduce(b, p, c, r);
211}
212*/
213
214inline void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
215{
216  assume(rIsPluralRing(currRing));
217
218//   return gnc_kBucketPolyRedNew(b, p, c);
219
220  assume(currRing->GetNC()->p_Procs.BucketPolyRed!=NULL);
221  return currRing->GetNC()->p_Procs.BucketPolyRed(b, p, c);
222}
223
224inline void nc_BucketPolyRed_Z(kBucket_pt b, poly p, number *c)
225{
226  assume(rIsPluralRing(currRing));
227
228//   return gnc_kBucketPolyRed_ZNew(b, p, c);
229
230  assume(currRing->GetNC()->p_Procs.BucketPolyRed_Z!=NULL);
231  return currRing->GetNC()->p_Procs.BucketPolyRed_Z(b, p, c);
232
233}
234
235inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat)
236{
237  assume(rIsPluralRing(currRing));
238
239  assume(currRing->GetNC()->p_Procs.GB!=NULL);
240  return currRing->GetNC()->p_Procs.GB(F, Q, w, hilb, strat);
241
242/*
243  if (rHasLocalOrMixedOrder(currRing))
244  {
245    assume(currRing->GetNC()->p_Procs.LocalGB!=NULL);
246    return currRing->GetNC()->p_Procs.LocalGB(F, Q, w, hilb, strat);
247  } else
248  {
249    assume(currRing->GetNC()->p_Procs.GlobalGB!=NULL);
250    return currRing->GetNC()->p_Procs.GlobalGB(F, Q, w, hilb, strat);
251  }
252*/
253}
254
255
256// Macros used to access upper triangle matrices C,D... (which are actually ideals) // afaik
257#define UPMATELEM(i,j,nVar) ( (nVar * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1)-(i) )
258
259
260// inline const nc_struct* GetNC() const { return GetBasering()->GetNC(); };
261
262
263// read only access to NC matrices C/D:
264// get C_{i,j}, 1 <= row = i < j = col <= N
265inline poly GetC( const ring r, int i, int j ) 
266{
267  assume(r!= NULL && rIsPluralRing(r));
268  const matrix C = GetNC(r)->C;
269  assume(C != NULL);
270  const int ncols = C->ncols;
271  assume( (i > 0) && (i < j) && (j <= ncols) );
272  return ( C->m[ncols * ((i)-1) + (j)-1] );
273};
274
275// get D_{i,j}, 1 <= row = i < j = col <= N
276inline poly GetD( const ring r, int i, int j ) 
277{
278  assume(r!= NULL && rIsPluralRing(r));
279  const matrix D = GetNC(r)->D;
280  assume(D != NULL);
281  const int ncols = D->ncols;
282  assume( (i > 0) && (i < j) && (j <= ncols) );
283  return ( D->m[ncols * ((i)-1) + (j)-1] );
284};
285
286
287#ifdef PLURAL_INTERNAL_DECLARATIONS
288
289// we need nc_gr_initBba for sca_gr_bba and gr_bba.
290void nc_gr_initBba(ideal F,kStrategy strat); 
291BOOLEAN gnc_InitMultiplication(ring r, bool bSetupQuotient = false); // just for a moment
292
293#endif // PLURAL_INTERNAL_DECLARATIONS
294
295#endif // HAVE_PLURAL :(
296#endif //
Note: See TracBrowser for help on using the repository browser.