source: git/libpolys/polys/sbuckets.h @ 30664c

spielwiese
Last change on this file since 30664c was 30664c, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
Warning elimination + cosmetics
  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[35aab3]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
[8179468]16class sBucket; typedef sBucket*           sBucket_pt;
17struct  spolyrec; typedef struct spolyrec polyrec; typedef polyrec* poly;
18struct ip_sring; typedef struct ip_sring* ring; typedef struct ip_sring const* const_ring;
[a795c77]19
20
[35aab3]21//////////////////////////////////////////////////////////////////////////
22// Creation/Destruction of buckets
23//
[8a8c9e]24sBucket_pt    sBucketCreate(ring r);
[35aab3]25void          sBucketDestroy(sBucket_pt *bucket);
26
27
[a795c77]28//////////////////////////////////////////////////////////////////////////
29// New API:
30//
31
32/// Copy sBucket non-intrusive!!!
33sBucket_pt    sBucketCopy(const sBucket_pt bucket);
34
35/// Returns bucket ring
[760a78f]36ring sBucketGetRing(const sBucket_pt bucket);
[a795c77]37
[35aab3]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
[b3e756]44// void sBucketInit(sBucket_pt bucket, poly p, int length);
[35aab3]45
46// creates and returns new bucket, initializes it with p
[b3e756]47// sBucket_pt sBucketInit( poly p, int length, ring r = currRing);
[35aab3]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
[590f989]73void sBucketDeleteAndDestroy(sBucket_pt *bucket_pt);
[35aab3]74
75//////////////////////////////////////////////////////////////////////////
[30664c]76
[35aab3]77/// Merges p into Spoly: assumes Bpoly and p have no common monoms
[30664c]78/// destroys p!
[35aab3]79void sBucket_Merge_p(sBucket_pt bucket, poly p, int lp);
[30664c]80
81/// adds poly p to bucket
82/// destroys p!
[35aab3]83void sBucket_Add_p(sBucket_pt bucket, poly p, int lp);
84
85
86//////////////////////////////////////////////////////////////////////////
87///
[a795c77]88/// Sorts p with bucketSort: assumes all monomials of p are different
[35aab3]89///
90poly sBucketSortMerge(poly p, ring r);
91
92//////////////////////////////////////////////////////////////////////////
93///
[a795c77]94/// Sorts p with bucketSort: p may have equal monomials
[35aab3]95///
96poly sBucketSortAdd(poly p, ring r);
97
98
99#endif // P_BUCKET_SORT
Note: See TracBrowser for help on using the repository browser.