source: git/Singular/kbuckets.h @ 5e16f9a

fieker-DuValspielwiese
Last change on this file since 5e16f9a was 0f98876, checked in by Olaf Bachmann <obachman@…>, 24 years ago
towards strat->tailRing git-svn-id: file:///usr/local/Singular/svn/trunk@4672 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 4.6 KB
Line 
1#ifndef KBUCKETS_H
2#define KBUCKETS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id: kbuckets.h,v 1.12 2000-10-26 06:39:27 obachman Exp $ */
7#include "structs.h"
8
9/////////////////////////////////////////////////////////////////////////
10// configuration
11//
12
13// define to not really use the bucket feature
14// #define HAVE_PSEUDO_BUCKETS
15
16//////////////////////////////////////////////////////////////////////////
17// Creation/Destruction of buckets
18//
19kBucket_pt kBucketCreate(ring r = currRing);
20// only free memory allocated for bucket
21void kBucketDestroy(kBucket_pt *bucket);
22// frees polys/monomials in bucket and destroys bucket
23void kBucketDeleteAndDestroy(kBucket_pt *bucket);
24
25
26/////////////////////////////////////////////////////////////////////////////
27// Convertion from/to Bpolys
28//
29
30// Converts p into a bucket poly (Bpoly) and destroys p
31// Assumes length <= 0 || pLength(p) == length
32void kBucketInit(kBucket_pt bucket, poly p, int length);
33
34// Converts Bpoly into a poly and clears bucket
35// i.e., afterwards Bpoly == 0
36void kBucketClear(kBucket_pt bucket, poly *p, int *length);
37
38// Canonicalizes Bpoly, i.e. converts polys of buckets into one poly in
39// one bucket: Returns number of bucket into which it is canonicalized
40int kBucketCanonicalize(kBucket_pt bucket);
41
42/////////////////////////////////////////////////////////////////////////////
43// Gets leading monom of bucket, does NOT change Bpoly!!!!!
44// Returned monom is READ ONLY, i.e. no manipulations are allowed !!!!
45//
46const poly kBucketGetLm(kBucket_pt bucket);
47
48/////////////////////////////////////////////////////////////////////////////
49// Extracts lm of Bpoly, i.e. Bpoly is changed s.t.
50// Bpoly == Bpoly - Lm(Bpoly)
51//
52poly kBucketExtractLm(kBucket_pt bucket);
53
54/////////////////////////////////////////////////////////////////////////////
55// Reduces Bpoly (say, q) with p, i.e.:
56// q = (Lc(p) / gcd(Lc(p), Lc(q)))*q - (Lc(q)/gcd(Lc(p),Lc(q)))*p*(Lm(q)/Lm(p))
57// Assumes p1 != NULL, Bpoly != NULL
58//         Lm(p1) divides Lm(Bpoly)
59//         pLength(p1) == l1
60// Returns: Lc(p) / gcd(Lc(p), Lc(q))
61number kBucketPolyRed(kBucket_pt bucket,
62                      poly p, int l,
63                      poly spNoether);
64
65
66/////////////////////////////////////////////////////////////////////////////
67//
68// Extract all monomials from bucket with component comp
69// Return as a polynomial *p with length *l
70// In other words, afterwards
71// Bpoly == Bpoly - (poly consisting of all monomials with component comp)
72// and components of monomials of *p are all 0
73
74void kBucketTakeOutComp(kBucket_pt bucket,
75                        Exponent_t comp,
76                        poly *p, int *l);
77
78// Here we only extract such monoms which have component == comp and
79// degree == order
80// ASSUME: monomial ordering is Order compatible, i.e., if m1, m2 Monoms then
81//         m1 >= m2 ==> pGetOrder(m1) >= pGetOrder(m2)
82void kBucketDecrOrdTakeOutComp(kBucket_pt bucket,
83                               Exponent_t comp, Order_t order,
84                               poly *p, int *l);
85
86//////////////////////////////////////////////////////////////////////////
87///
88/// Multiply Bucket by number ,i.e. Bpoly == n*Bpoly
89///
90void kBucket_Mult_n(kBucket_pt bucket, number n);
91
92
93//////////////////////////////////////////////////////////////////////////
94///
95/// Bpoly == Bpoly - m*p; where m is a monom
96/// Does not destroy p and m
97/// assume (*l <= 0 || pLength(p) == *l)
98void kBucket_Minus_m_Mult_p(kBucket_pt bucket, poly m, poly p, int *l,
99                            poly spNother = NULL);
100
101
102//////////////////////////////////////////////////////////////////////////
103///
104/// For changing the ring of the Bpoly to new_tailBin
105///
106void kBucketShallowCopyDelete(kBucket_pt bucket, 
107                              ring new_tailRing, omBin new_tailBin,
108                              pShallowCopyDeleteProc p_shallow_copy_delete);
109
110//////////////////////////////////////////////////////////////////////////
111///
112/// Tests
113///
114///
115#ifdef KDEBUG
116BOOLEAN kbTest(kBucket_pt bucket);
117#else
118#define kbTest(bucket)  ((void)0)
119#endif
120
121//////////////////////////////////////////////////////////////////////////
122///
123/// Bucket definition (should be no one elses business, though)
124///
125
126
127#define MAX_BUCKET 14 // suitable for polys up to a length of 4^14 = 2^28
128class kBucket
129{
130public:
131#ifdef HAVE_PSEUDO_BUCKETS
132  poly p;
133  int l;
134#else
135  poly buckets[MAX_BUCKET + 1];        // polys in bucket
136  int  buckets_length[MAX_BUCKET + 1]; // length if i-th poly
137  int buckets_used;                    // max number of used bucket
138#endif
139  ring bucket_ring;
140};
141
142#endif /* KBUCKETS_H */
Note: See TracBrowser for help on using the repository browser.