source: git/kernel/gring.h @ 9cd0ce

fieker-DuValspielwiese
Last change on this file since 9cd0ce was 52e2f6, checked in by Motsak Oleksandr <motsak@…>, 16 years ago
*motsak: major redesign of NC Subsystem, maybe something more... git-svn-id: file:///usr/local/Singular/svn/trunk@10739 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 6.9 KB
Line 
1#ifndef GRING_H
2#define GRING_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: gring.h,v 1.21 2008-06-10 10:17:31 motsak Exp $ */
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
17// the part, related to the interface
18// Changes r, Assumes that all other input belongs to currRing
19BOOLEAN nc_CallPlural(matrix CC, matrix DD, poly CN, poly DN, ring r,
20                      bool bSetupQuotient = false,
21                      bool bCopyInput = true,
22                      bool bBeQuiet = false,
23                      ring curr = currRing);
24
25// BOOLEAN nc_CheckOrdCondition(matrix D, ring r);
26// BOOLEAN nc_CheckOrdCondition(ring r); // with D == r->GetNC()->D
27
28BOOLEAN nc_CheckSubalgebra(poly PolyVar, ring r);
29
30// BOOLEAN nc_InitMultiplication(ring r); // should call nc_p_ProcsSet!
31// NOTE: instead of constructing nc_struct and calling nc_InitMultiplication yourself - just create C, D and call nc_CallPlural!!!
32
33
34BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate);
35
36
37// set pProcs table for rGR and global variable p_Procs
38// this should be used by p_ProcsSet in p_Procs_Set.h
39void nc_p_ProcsSet(ring rGR, p_Procs_s* p_Procs);
40
41// this function should be used inside QRing definition!
42// we go from rG into factor ring rGR with factor ideal rGR->qideal.
43bool nc_SetupQuotient(ring rGR, const ring rG = NULL); // rG == NULL means that there is no base G-algebra
44
45
46// used by "rSum" from ring.cc only!
47// purpose init nc structure for initially commutative ring:
48// "creates a commutative nc extension; "converts" comm.ring to a Plural ring"
49ring nc_rCreateNCcomm(ring r); 
50
51void ncCleanUp(nc_struct* p); // just free memory!
52void ncCleanUp(ring r); // smaller than kill: just free mem
53void ncKill(ring r); // complete destructor
54
55BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient = true); // in ring.cc
56
57
58// share the same nc-structure with a new copy ``res'' of ``r''.
59// used by rCopy only.
60// additionally inits multipication on ``res''!
61void nc_rCopy0(ring res, const ring r);
62
63// for p_Minus_mm_Mult_qq in pInline2.h
64poly nc_p_Minus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp,
65                                    const int, const poly, const ring r);
66
67// // for p_Plus_mm_Mult_qq in pInline2.h
68// returns p + m*q destroys p, const: q, m
69poly nc_p_Plus_mm_Mult_qq(poly p, const poly m, const poly q, int &lp,
70                              const int, const ring r);
71
72
73// poly _gnc_p_Mult_q(poly p, poly q, const int copy, const ring r);
74
75// general multiplication:
76poly _nc_p_Mult_q(poly p, poly q, const ring r);
77poly _nc_pp_Mult_qq(const poly p, const poly q, const ring r);
78
79
80/* subst: */
81poly nc_pSubst(poly p, int n, poly e);
82
83/* copy : */
84poly nc_p_CopyGet(poly a, const ring r);
85poly nc_p_CopyPut(poly a, const ring r);
86
87void nc_PolyPolyRed(poly &b, poly p, number *c);
88
89
90
91poly nc_CreateShortSpoly(poly p1, poly p2, const ring r=currRing);
92
93
94/* brackets: */
95poly nc_p_Bracket_qq(poly p, poly q);
96
97/* twostd: */
98ideal twostd(ideal I);
99/* Ann: */
100ideal Approx_Step(ideal L);
101
102/* complete reduction routines */
103
104matrix nc_PrintMat(int a, int b, ring r, int metric);
105
106poly p_CopyEmbed(poly p, ring srcRing, int shift, int par_shift);
107poly pOppose(ring Rop, poly p);
108ideal idOppose(ring Rop, ideal I);
109
110
111
112
113// returns the LCM of the head terms of a and b with given component
114poly p_Lcm(const poly a, const poly b, const long lCompM, const ring r);
115
116// returns the LCM of the head terms of a and b with component = max comp. of a & b
117poly p_Lcm(const poly a, const poly b, const ring r);
118
119
120
121// //////////////////////////////////////////////////////////////////////// //
122// NC inlines
123
124inline nc_type& ncRingType(nc_struct* p)
125{
126  assume(p!=NULL);
127  return (p->type);
128};
129
130inline nc_type& ncRingType(ring r) // get and set
131{
132  assume(rIsPluralRing(r));
133  return (ncRingType(r->GetNC()));
134};
135
136inline void ncRingType(ring r, nc_type t) // Set
137{
138  assume((r != NULL) && (r->GetNC() != NULL));
139  ncRingType(r) = t;
140};
141
142inline nc_struct*& GetNC(ring r)
143{
144  return r->GetNC();
145}; 
146
147
148
149
150// //////////////////////////////////////////////////////
151
152// returns m*p, does neither destroy p nor m
153inline poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
154{
155  assume(rIsPluralRing(r));
156  assume(r->GetNC()->p_Procs.mm_Mult_pp!=NULL);
157  return r->GetNC()->p_Procs.mm_Mult_pp(m, p, r);
158//  return pp_Mult_mm( p, m, r);
159}
160
161
162// returns m*p, does destroy p, preserves m
163inline poly nc_mm_Mult_p(const poly m, poly p, const ring r)
164{
165  assume(rIsPluralRing(r));
166  assume(r->GetNC()->p_Procs.mm_Mult_p!=NULL);
167  return r->GetNC()->p_Procs.mm_Mult_p(m, p, r);
168//   return p_Mult_mm( p, m, r);
169}
170
171inline poly nc_CreateSpoly(const poly p1, const poly p2, const ring r)
172{
173  assume(rIsPluralRing(r));
174  assume(r->GetNC()->p_Procs.SPoly!=NULL);
175  return r->GetNC()->p_Procs.SPoly(p1, p2, r);
176}
177
178inline poly nc_ReduceSpoly(const poly p1, poly p2, const ring r)
179{
180  assume(rIsPluralRing(r));
181  assume(r->GetNC()->p_Procs.ReduceSPoly!=NULL);
182#ifdef PDEBUG
183//  assume(p_LmDivisibleBy(p1, p2, r));
184#endif
185  return r->GetNC()->p_Procs.ReduceSPoly(p1, p2, r);
186}
187
188/*
189inline void nc_PolyReduce(poly &b, const poly p, number *c, const ring r) // nc_PolyPolyRed
190{
191  assume(rIsPluralRing(r));
192//  assume(r->GetNC()->p_Procs.PolyReduce!=NULL);
193//  r->GetNC()->p_Procs.PolyReduce(b, p, c, r);
194}
195*/
196
197inline void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
198{
199  assume(rIsPluralRing(currRing));
200
201//   return gnc_kBucketPolyRedNew(b, p, c);
202
203  assume(currRing->GetNC()->p_Procs.BucketPolyRed!=NULL);
204  return currRing->GetNC()->p_Procs.BucketPolyRed(b, p, c);
205}
206
207inline void nc_BucketPolyRed_Z(kBucket_pt b, poly p, number *c)
208{
209  assume(rIsPluralRing(currRing));
210
211//   return gnc_kBucketPolyRed_ZNew(b, p, c);
212
213  assume(currRing->GetNC()->p_Procs.BucketPolyRed_Z!=NULL);
214  return currRing->GetNC()->p_Procs.BucketPolyRed_Z(b, p, c);
215
216}
217
218inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat)
219{
220  assume(rIsPluralRing(currRing));
221
222  assume(currRing->GetNC()->p_Procs.GB!=NULL);
223  return currRing->GetNC()->p_Procs.GB(F, Q, w, hilb, strat);
224
225/*
226  if (pOrdSgn==-1)
227  {
228    assume(currRing->GetNC()->p_Procs.LocalGB!=NULL);
229    return currRing->GetNC()->p_Procs.LocalGB(F, Q, w, hilb, strat);
230  } else
231  {
232    assume(currRing->GetNC()->p_Procs.GlobalGB!=NULL);
233    return currRing->GetNC()->p_Procs.GlobalGB(F, Q, w, hilb, strat);
234  }
235*/
236}
237
238
239// Macros used to access upper triangle matrices C,D... (which are actually ideals) // afaik
240#define UPMATELEM(i,j,nVar) ( (nVar * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1)-(i) )
241
242
243#ifdef PLURAL_INTERNAL_DECLARATIONS
244
245// we need nc_gr_initBba for sca_gr_bba and gr_bba.
246void nc_gr_initBba(ideal F,kStrategy strat); 
247BOOLEAN gnc_InitMultiplication(ring r, bool bSetupQuotient = false); // just for a moment
248
249#endif // PLURAL_INTERNAL_DECLARATIONS
250
251#endif // HAVE_PLURAL :(
252#endif //
Note: See TracBrowser for help on using the repository browser.