source: git/kernel/sbuckets.h @ 835d83

spielwiese
Last change on this file since 835d83 was 835d83, checked in by Hans Schönemann <hannes@…>, 14 years ago
move stuff from structs.h git-svn-id: file:///usr/local/Singular/svn/trunk@12398 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • 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 *  Version: $Id$
13 *******************************************************************/
14#ifndef S_BUCKETS_H
15#define S_BUCKETS_H
16
17#include "structs.h"
18#include "ring.h"
19
20
21
22//////////////////////////////////////////////////////////////////////////
23// Creation/Destruction of buckets
24//
25sBucket_pt    sBucketCreate(ring r = currRing);
26void          sBucketDestroy(sBucket_pt *bucket);
27
28
29//////////////////////////////////////////////////////////////////////////
30// New API:
31//
32
33/// Copy sBucket non-intrusive!!!
34sBucket_pt    sBucketCopy(const sBucket_pt bucket);
35
36/// Returns bucket ring
37const ring sBucketGetRing(const sBucket_pt bucket);
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
76//////////////////////////////////////////////////////////////////////////
77///
78/// Merges p into Spoly: assumes Bpoly and p have no common monoms
79///
80void sBucket_Merge_p(sBucket_pt bucket, poly p, int lp);
81// adds poly p to bucket
82void sBucket_Add_p(sBucket_pt bucket, poly p, int lp);
83
84
85//////////////////////////////////////////////////////////////////////////
86///
87/// Sorts p with bucketSort: assumes all monomials of p are different
88///
89poly sBucketSortMerge(poly p, ring r);
90
91//////////////////////////////////////////////////////////////////////////
92///
93/// Sorts p with bucketSort: p may have equal monomials
94///
95poly sBucketSortAdd(poly p, ring r);
96
97
98#endif // P_BUCKET_SORT
Note: See TracBrowser for help on using the repository browser.