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
RevLine 
[35aab3]1#ifndef GRING_H
2#define GRING_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
[52e2f6]6/* $Id: gring.h,v 1.21 2008-06-10 10:17:31 motsak Exp $ */
[35aab3]7/*
8* ABSTRACT additional defines etc for --with-plural
9*/
10
[d312f6]11#ifdef HAVE_PLURAL
[86016d]12
[52e2f6]13
[86016d]14#include <structs.h>
15#include <ring.h>
[35aab3]16
[52e2f6]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
[86016d]27
[e5fc4d4]28BOOLEAN nc_CheckSubalgebra(poly PolyVar, ring r);
[52e2f6]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
[b39bc1f]34BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate);
[6c0f53]35
[5a9e7b]36
[86016d]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);
[5a9e7b]40
[86016d]41// this function should be used inside QRing definition!
42// we go from rG into factor ring rGR with factor ideal rGR->qideal.
[52e2f6]43bool nc_SetupQuotient(ring rGR, const ring rG = NULL); // rG == NULL means that there is no base G-algebra
[5a9e7b]44
[35aab3]45
[86016d]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); 
[35aab3]50
[52e2f6]51void ncCleanUp(nc_struct* p); // just free memory!
52void ncCleanUp(ring r); // smaller than kill: just free mem
53void ncKill(ring r); // complete destructor
[5a9e7b]54
[52e2f6]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);
[5a9e7b]62
[86016d]63// for p_Minus_mm_Mult_qq in pInline2.h
[5a9e7b]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);
[86016d]66
67// // for p_Plus_mm_Mult_qq in pInline2.h
[5a9e7b]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
[35aab3]79
[68349d]80/* subst: */
81poly nc_pSubst(poly p, int n, poly e);
82
83/* copy : */
[5e051b]84poly nc_p_CopyGet(poly a, const ring r);
85poly nc_p_CopyPut(poly a, const ring r);
[35aab3]86
[5a9e7b]87void nc_PolyPolyRed(poly &b, poly p, number *c);
[8fbdb2]88
89
90
[f2109c]91poly nc_CreateShortSpoly(poly p1, poly p2, const ring r=currRing);
[35aab3]92
[5a9e7b]93
[68349d]94/* brackets: */
[35aab3]95poly nc_p_Bracket_qq(poly p, poly q);
96
[68349d]97/* twostd: */
[35aab3]98ideal twostd(ideal I);
[8e165ec]99/* Ann: */
100ideal Approx_Step(ideal L);
[35aab3]101
[68349d]102/* complete reduction routines */
[35aab3]103
104matrix nc_PrintMat(int a, int b, ring r, int metric);
105
[eb234f]106poly p_CopyEmbed(poly p, ring srcRing, int shift, int par_shift);
[b39bc1f]107poly pOppose(ring Rop, poly p);
108ideal idOppose(ring Rop, ideal I);
[8e165ec]109
[5a9e7b]110
111
112
[52e2f6]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);
[5a9e7b]115
[52e2f6]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);
[5a9e7b]118
[52e2f6]119
120
121// //////////////////////////////////////////////////////////////////////// //
122// NC inlines
123
124inline nc_type& ncRingType(nc_struct* p)
[5a9e7b]125{
[52e2f6]126  assume(p!=NULL);
127  return (p->type);
[5a9e7b]128};
[35aab3]129
[52e2f6]130inline nc_type& ncRingType(ring r) // get and set
[5a9e7b]131{
132  assume(rIsPluralRing(r));
[52e2f6]133  return (ncRingType(r->GetNC()));
134};
[5a9e7b]135
[52e2f6]136inline void ncRingType(ring r, nc_type t) // Set
137{
138  assume((r != NULL) && (r->GetNC() != NULL));
139  ncRingType(r) = t;
[5a9e7b]140};
141
[52e2f6]142inline nc_struct*& GetNC(ring r)
143{
144  return r->GetNC();
145}; 
146
[5a9e7b]147
148
149
150// //////////////////////////////////////////////////////
151
152// returns m*p, does neither destroy p nor m
[d5f9aea]153inline poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
[5a9e7b]154{
155  assume(rIsPluralRing(r));
[52e2f6]156  assume(r->GetNC()->p_Procs.mm_Mult_pp!=NULL);
157  return r->GetNC()->p_Procs.mm_Mult_pp(m, p, r);
[5a9e7b]158//  return pp_Mult_mm( p, m, r);
159}
160
161
162// returns m*p, does destroy p, preserves m
[86016d]163inline poly nc_mm_Mult_p(const poly m, poly p, const ring r)
[5a9e7b]164{
165  assume(rIsPluralRing(r));
[52e2f6]166  assume(r->GetNC()->p_Procs.mm_Mult_p!=NULL);
167  return r->GetNC()->p_Procs.mm_Mult_p(m, p, r);
[5a9e7b]168//   return p_Mult_mm( p, m, r);
169}
170
[19370c]171inline poly nc_CreateSpoly(const poly p1, const poly p2, const ring r)
[5a9e7b]172{
173  assume(rIsPluralRing(r));
[52e2f6]174  assume(r->GetNC()->p_Procs.SPoly!=NULL);
175  return r->GetNC()->p_Procs.SPoly(p1, p2, r);
[5a9e7b]176}
177
[19370c]178inline poly nc_ReduceSpoly(const poly p1, poly p2, const ring r)
[5a9e7b]179{
180  assume(rIsPluralRing(r));
[52e2f6]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);
[5a9e7b]186}
187
[8fbdb2]188/*
189inline void nc_PolyReduce(poly &b, const poly p, number *c, const ring r) // nc_PolyPolyRed
190{
191  assume(rIsPluralRing(r));
[52e2f6]192//  assume(r->GetNC()->p_Procs.PolyReduce!=NULL);
193//  r->GetNC()->p_Procs.PolyReduce(b, p, c, r);
[8fbdb2]194}
195*/
196
[19370c]197inline void nc_kBucketPolyRed(kBucket_pt b, poly p, number *c)
[5a9e7b]198{
199  assume(rIsPluralRing(currRing));
200
201//   return gnc_kBucketPolyRedNew(b, p, c);
202
[52e2f6]203  assume(currRing->GetNC()->p_Procs.BucketPolyRed!=NULL);
204  return currRing->GetNC()->p_Procs.BucketPolyRed(b, p, c);
[5a9e7b]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
[52e2f6]213  assume(currRing->GetNC()->p_Procs.BucketPolyRed_Z!=NULL);
214  return currRing->GetNC()->p_Procs.BucketPolyRed_Z(b, p, c);
[5a9e7b]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
[52e2f6]222  assume(currRing->GetNC()->p_Procs.GB!=NULL);
223  return currRing->GetNC()->p_Procs.GB(F, Q, w, hilb, strat);
[5a9e7b]224
225/*
226  if (pOrdSgn==-1)
227  {
[52e2f6]228    assume(currRing->GetNC()->p_Procs.LocalGB!=NULL);
229    return currRing->GetNC()->p_Procs.LocalGB(F, Q, w, hilb, strat);
[5a9e7b]230  } else
231  {
[52e2f6]232    assume(currRing->GetNC()->p_Procs.GlobalGB!=NULL);
233    return currRing->GetNC()->p_Procs.GlobalGB(F, Q, w, hilb, strat);
[5a9e7b]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
[86016d]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); 
[52e2f6]247BOOLEAN gnc_InitMultiplication(ring r, bool bSetupQuotient = false); // just for a moment
[86016d]248
249#endif // PLURAL_INTERNAL_DECLARATIONS
250
251#endif // HAVE_PLURAL :(
252#endif //
Note: See TracBrowser for help on using the repository browser.