source: git/kernel/gring.h @ 4e35a89

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