source: git/kernel/gring.h @ 0f7420d

spielwiese
Last change on this file since 0f7420d was 151000, checked in by Motsak Oleksandr <motsak@…>, 16 years ago
*motsak: some more NC ShortSpoly! in kutil... git-svn-id: file:///usr/local/Singular/svn/trunk@10747 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 7.0 KB
Line 
1#ifndef GRING_H
2#define GRING_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: gring.h,v 1.22 2008-06-10 14:35:41 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 the given component
114// NOTE: coeff will be created but remains undefined(zero?)
115poly p_Lcm(const poly a, const poly b, const long lCompM, const ring r);
116
117// returns the LCM of the head terms of a and b with component = max comp. of a & b
118// NOTE: coeff will be created but remains undefined(zero?)
119poly p_Lcm(const poly a, const poly b, const ring r);
120
121
122
123// //////////////////////////////////////////////////////////////////////// //
124// NC inlines
125
126inline nc_type& ncRingType(nc_struct* p)
127{
128  assume(p!=NULL);
129  return (p->type);
130};
131
132inline nc_type& ncRingType(ring r) // get and set
133{
134  assume(rIsPluralRing(r));
135  return (ncRingType(r->GetNC()));
136};
137
138inline void ncRingType(ring r, nc_type t) // Set
139{
140  assume((r != NULL) && (r->GetNC() != NULL));
141  ncRingType(r) = t;
142};
143
144inline nc_struct*& GetNC(ring r)
145{
146  return r->GetNC();
147}; 
148
149
150
151
152// //////////////////////////////////////////////////////
153
154// returns m*p, does neither destroy p nor m
155inline poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
156{
157  assume(rIsPluralRing(r));
158  assume(r->GetNC()->p_Procs.mm_Mult_pp!=NULL);
159  return r->GetNC()->p_Procs.mm_Mult_pp(m, p, r);
160//  return pp_Mult_mm( p, m, r);
161}
162
163
164// returns m*p, does destroy p, preserves m
165inline poly nc_mm_Mult_p(const poly m, poly p, const ring r)
166{
167  assume(rIsPluralRing(r));
168  assume(r->GetNC()->p_Procs.mm_Mult_p!=NULL);
169  return r->GetNC()->p_Procs.mm_Mult_p(m, p, r);
170//   return p_Mult_mm( p, m, r);
171}
172
173inline poly nc_CreateSpoly(const poly p1, const poly p2, const ring r)
174{
175  assume(rIsPluralRing(r));
176  assume(r->GetNC()->p_Procs.SPoly!=NULL);
177  return r->GetNC()->p_Procs.SPoly(p1, p2, r);
178}
179
180inline poly nc_ReduceSpoly(const poly p1, poly p2, const ring r)
181{
182  assume(rIsPluralRing(r));
183  assume(r->GetNC()->p_Procs.ReduceSPoly!=NULL);
184#ifdef PDEBUG
185//  assume(p_LmDivisibleBy(p1, p2, r));
186#endif
187  return r->GetNC()->p_Procs.ReduceSPoly(p1, p2, r);
188}
189
190/*
191inline void nc_PolyReduce(poly &b, const poly p, number *c, const ring r) // nc_PolyPolyRed
192{
193  assume(rIsPluralRing(r));
194//  assume(r->GetNC()->p_Procs.PolyReduce!=NULL);
195//  r->GetNC()->p_Procs.PolyReduce(b, p, c, r);
196}
197*/
198
199inline void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
200{
201  assume(rIsPluralRing(currRing));
202
203//   return gnc_kBucketPolyRedNew(b, p, c);
204
205  assume(currRing->GetNC()->p_Procs.BucketPolyRed!=NULL);
206  return currRing->GetNC()->p_Procs.BucketPolyRed(b, p, c);
207}
208
209inline void nc_BucketPolyRed_Z(kBucket_pt b, poly p, number *c)
210{
211  assume(rIsPluralRing(currRing));
212
213//   return gnc_kBucketPolyRed_ZNew(b, p, c);
214
215  assume(currRing->GetNC()->p_Procs.BucketPolyRed_Z!=NULL);
216  return currRing->GetNC()->p_Procs.BucketPolyRed_Z(b, p, c);
217
218}
219
220inline ideal nc_GB(const ideal F, const ideal Q, const intvec *w, const intvec *hilb, kStrategy strat)
221{
222  assume(rIsPluralRing(currRing));
223
224  assume(currRing->GetNC()->p_Procs.GB!=NULL);
225  return currRing->GetNC()->p_Procs.GB(F, Q, w, hilb, strat);
226
227/*
228  if (pOrdSgn==-1)
229  {
230    assume(currRing->GetNC()->p_Procs.LocalGB!=NULL);
231    return currRing->GetNC()->p_Procs.LocalGB(F, Q, w, hilb, strat);
232  } else
233  {
234    assume(currRing->GetNC()->p_Procs.GlobalGB!=NULL);
235    return currRing->GetNC()->p_Procs.GlobalGB(F, Q, w, hilb, strat);
236  }
237*/
238}
239
240
241// Macros used to access upper triangle matrices C,D... (which are actually ideals) // afaik
242#define UPMATELEM(i,j,nVar) ( (nVar * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1)-(i) )
243
244
245#ifdef PLURAL_INTERNAL_DECLARATIONS
246
247// we need nc_gr_initBba for sca_gr_bba and gr_bba.
248void nc_gr_initBba(ideal F,kStrategy strat); 
249BOOLEAN gnc_InitMultiplication(ring r, bool bSetupQuotient = false); // just for a moment
250
251#endif // PLURAL_INTERNAL_DECLARATIONS
252
253#endif // HAVE_PLURAL :(
254#endif //
Note: See TracBrowser for help on using the repository browser.