source: git/libpolys/polys/sbuckets.h @ 98b2b91

spielwiese
Last change on this file since 98b2b91 was 6ce030f, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
removal of the $Id$ svn tag from everywhere NOTE: the git SHA1 may be used instead (only on special places) NOTE: the libraries Singular/LIB/*.lib still contain the marker due to our current use of svn
  • Property mode set to 100644
File size: 3.0 KB
Line 
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
15
16#include <polys/monomials/ring.h>
17
18
19class sBucket;
20typedef sBucket*           sBucket_pt;
21//////////////////////////////////////////////////////////////////////////
22// Creation/Destruction of buckets
23//
24sBucket_pt    sBucketCreate(ring r);
25void          sBucketDestroy(sBucket_pt *bucket);
26
27
28//////////////////////////////////////////////////////////////////////////
29// New API:
30//
31
32/// Copy sBucket non-intrusive!!!
33sBucket_pt    sBucketCopy(const sBucket_pt bucket);
34
35/// Returns bucket ring
36ring sBucketGetRing(const sBucket_pt bucket);
37
38/////////////////////////////////////////////////////////////////////////////
39// Convertion from/to SBpolys
40//
41
42// Converts p into a bucket poly (SBpoly) and destroys p
43// Assumes length <= 0 || pLength(p) == length
44// void sBucketInit(sBucket_pt bucket, poly p, int length);
45
46// creates and returns new bucket, initializes it with p
47// sBucket_pt sBucketInit( poly p, int length, ring r = currRing);
48
49// Converts SBpoly into a poly and clears bucket
50// i.e., afterwards SBpoly == 0
51// assumes all monomials in bucket are different
52void sBucketClearMerge(sBucket_pt bucket, poly *p, int *length);
53
54// Converts SBpoly into a poly and clears bucket
55// i.e., afterwards SBpoly == 0
56// bucket may contain equal monials
57void sBucketClearAdd(sBucket_pt bucket, poly *p, int *length);
58
59// Converts SBpoly into a poly and detroys bucket
60inline void sBucketDestroyMerge(sBucket_pt bucket, poly *p, int *length)
61{
62  sBucketClearMerge(bucket, p, length);
63  sBucketDestroy(&bucket);
64}
65
66// Converts SBpoly into a poly and detroys bucket
67inline void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
68{
69  sBucketClearAdd(bucket, p, length);
70  sBucketDestroy(&bucket);
71}
72
73void sBucketDeleteAndDestroy(sBucket_pt *bucket_pt);
74
75//////////////////////////////////////////////////////////////////////////
76///
77/// Merges p into Spoly: assumes Bpoly and p have no common monoms
78///
79void sBucket_Merge_p(sBucket_pt bucket, poly p, int lp);
80// adds poly p to bucket
81void sBucket_Add_p(sBucket_pt bucket, poly p, int lp);
82
83
84//////////////////////////////////////////////////////////////////////////
85///
86/// Sorts p with bucketSort: assumes all monomials of p are different
87///
88poly sBucketSortMerge(poly p, ring r);
89
90//////////////////////////////////////////////////////////////////////////
91///
92/// Sorts p with bucketSort: p may have equal monomials
93///
94poly sBucketSortAdd(poly p, ring r);
95
96
97#endif // P_BUCKET_SORT
Note: See TracBrowser for help on using the repository browser.