My Project
Loading...
Searching...
No Matches
sbuckets.h
Go to the documentation of this file.
1/****************************************
2* Computer Algebra System SINGULAR *
3****************************************/
4/***************************************************************
5 * File: sbuckets.h
6 * Purpose: declaration of routines for sorting and adding up polys using
7 * a bucket sort
8 * Note: If you need to extract the leading momonial of a bucket,
9 * use kbuckets, instead.
10 * Author: obachman (Olaf Bachmann)
11 * Created: 9/00
12 *******************************************************************/
13#ifndef S_BUCKETS_H
14#define S_BUCKETS_H
16class sBucket; typedef sBucket* sBucket_pt;
17
18//////////////////////////////////////////////////////////////////////////
19// Creation/Destruction of buckets
20//
22void sBucketDestroy(sBucket_pt *bucket);
23
24//////////////////////////////////////////////////////////////////////////
25// New API:
26//
27
28/// Copy sBucket non-intrusive!!!
30
31/// Returns bucket ring
32ring sBucketGetRing(const sBucket_pt bucket);
33
34/// Test whether bucket is empty!?
35bool sIsEmpty(const sBucket_pt bucket);
36
37
38
39/////////////////////////////////////////////////////////////////////////////
40// Convertion from/to SBpolys
41//
42
43// Converts p into a bucket poly (SBpoly) and destroys p
44// Assumes length <= 0 || pLength(p) == length
45// void sBucketInit(sBucket_pt bucket, poly p, int length);
46
47// creates and returns new bucket, initializes it with p
48// sBucket_pt sBucketInit( poly p, int length, ring r = currRing);
49
50// Converts SBpoly into a poly and clears bucket
51// i.e., afterwards SBpoly == 0
52// assumes all monomials in bucket are different
53void sBucketClearMerge(sBucket_pt bucket, poly *p, int *length);
54
55// Converts SBpoly into a poly and clears bucket
56// i.e., afterwards SBpoly == 0
57// bucket may contain equal monials
58void sBucketClearAdd(sBucket_pt bucket, poly *p, int *length);
59
60// Converts SBpoly into a poly and detroys bucket
61inline void sBucketDestroyMerge(sBucket_pt bucket, poly *p, int *length)
62{
63 sBucketClearMerge(bucket, p, length);
64 sBucketDestroy(&bucket);
65}
66
67// Converts SBpoly into a poly and detroys bucket
68inline void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
69{
70 sBucketClearAdd(bucket, p, length);
71 sBucketDestroy(&bucket);
72}
73
74void sBucketDeleteAndDestroy(sBucket_pt *bucket_pt);
75
77//////////////////////////////////////////////////////////////////////////
78
79/// Merges p into Spoly: assumes Bpoly and p have no common monoms
80/// destroys p!
81void sBucket_Merge_p(sBucket_pt bucket, poly p, int lp);
82void sBucket_Merge_m(sBucket_pt bucket, poly p);
83
84/// adds poly p to bucket
85/// destroys p!
86void sBucket_Add_p(sBucket_pt bucket, poly p, int lp);
87void sBucket_Add_m(sBucket_pt bucket, poly p);
88
89
90//////////////////////////////////////////////////////////////////////////
91///
92/// Sorts p with bucketSort: assumes all monomials of p are different
93///
94poly sBucketSortMerge(poly p, const ring r);
95
96//////////////////////////////////////////////////////////////////////////
97///
98/// Sorts p with bucketSort: p may have equal monomials
99///
100poly sBucketSortAdd(poly p, const ring r);
101
102
103//////////////////////////////////////////////////////////////////////////
105char* sBucketString(sBucket_pt bucket);
106void sBucketPrint(sBucket_pt bucket);
107#endif // P_BUCKET_SORT
int p
Definition: cfModGcd.cc:4078
CanonicalForm b
Definition: cfModGcd.cc:4103
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:257
void sBucketPrint(sBucket_pt bucket)
Definition: sbuckets.cc:466
char * sBucketString(sBucket_pt bucket)
Definition: sbuckets.cc:461
void sBucketDeleteAndDestroy(sBucket_pt *bucket_pt)
Definition: sbuckets.cc:110
bool sIsEmpty(const sBucket_pt bucket)
Test whether bucket is empty!?
Definition: sbuckets.cc:50
void sBucketClearMerge(sBucket_pt bucket, poly *p, int *length)
Definition: sbuckets.cc:237
void sBucket_Merge_p(sBucket_pt bucket, poly p, int lp)
Merges p into Spoly: assumes Bpoly and p have no common monoms destroys p!
Definition: sbuckets.cc:148
void sBucket_Add_p(sBucket_pt bucket, poly p, int lp)
adds poly p to bucket destroys p!
Definition: sbuckets.cc:203
sBucket_pt sBucketCopy(const sBucket_pt bucket)
Copy sBucket non-intrusive!!!
Definition: sbuckets.cc:70
sBucket * sBucket_pt
Definition: sbuckets.h:16
void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
Definition: sbuckets.h:68
sBucket_pt sBucketCreate(ring r)
Definition: sbuckets.cc:96
void sBucketCanonicalize(sBucket_pt bucket)
Definition: sbuckets.cc:401
void sBucketDestroy(sBucket_pt *bucket)
Definition: sbuckets.cc:103
void sBucket_Add_m(sBucket_pt bucket, poly p)
Definition: sbuckets.cc:173
poly sBucketSortMerge(poly p, const ring r)
Sorts p with bucketSort: assumes all monomials of p are different.
Definition: sbuckets.cc:332
void sBucketClearAdd(sBucket_pt bucket, poly *p, int *length)
Definition: sbuckets.cc:275
poly sBucketSortAdd(poly p, const ring r)
Sorts p with bucketSort: p may have equal monomials.
Definition: sbuckets.cc:368
void sBucket_Merge_m(sBucket_pt bucket, poly p)
Definition: sbuckets.cc:127
poly sBucketPeek(sBucket_pt b)
Definition: sbuckets.cc:455
void sBucketDestroyMerge(sBucket_pt bucket, poly *p, int *length)
Definition: sbuckets.h:61
ring sBucketGetRing(const sBucket_pt bucket)
Returns bucket ring.
Definition: sbuckets.cc:46