source: git/kernel/sbuckets.h @ 17268cb

fieker-DuValspielwiese
Last change on this file since 17268cb was a795c77, checked in by Motsak Oleksandr <motsak@…>, 15 years ago
*motsak: more sBucket API git-svn-id: file:///usr/local/Singular/svn/trunk@11848 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.9 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 *  Version: $Id: sbuckets.h,v 1.3 2009-05-27 16:15:14 motsak Exp $
13 *******************************************************************/
14#ifndef S_BUCKETS_H
15#define S_BUCKETS_H
16
17#include "structs.h"
18
19
20
21//////////////////////////////////////////////////////////////////////////
22// Creation/Destruction of buckets
23//
24sBucket_pt    sBucketCreate(ring r = currRing);
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
36const ring 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
73
74//////////////////////////////////////////////////////////////////////////
75///
76/// Merges p into Spoly: assumes Bpoly and p have no common monoms
77///
78void sBucket_Merge_p(sBucket_pt bucket, poly p, int lp);
79// adds poly p to bucket
80void sBucket_Add_p(sBucket_pt bucket, poly p, int lp);
81
82
83//////////////////////////////////////////////////////////////////////////
84///
85/// Sorts p with bucketSort: assumes all monomials of p are different
86///
87poly sBucketSortMerge(poly p, ring r);
88
89//////////////////////////////////////////////////////////////////////////
90///
91/// Sorts p with bucketSort: p may have equal monomials
92///
93poly sBucketSortAdd(poly p, ring r);
94
95
96#endif // P_BUCKET_SORT
Note: See TracBrowser for help on using the repository browser.