source: git/Singular/sbuckets.h @ 446935

spielwiese
Last change on this file since 446935 was 446935, checked in by Olaf Bachmann <obachman@…>, 23 years ago
added buckets for sorting git-svn-id: file:///usr/local/Singular/svn/trunk@5005 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.7 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.1 2000-12-31 15:17:47 obachman Exp $
13 *******************************************************************/
14#ifndef S_BUCKETS_H
15#define S_BUCKETS_H
16
17#include "mod2.h"
18#include "structs.h"
19
20//////////////////////////////////////////////////////////////////////////
21// Creation/Destruction of buckets
22//
23sBucket_pt    sBucketCreate(ring r = currRing);
24void          sBucketDestroy(sBucket_pt *bucket);
25
26
27/////////////////////////////////////////////////////////////////////////////
28// Convertion from/to SBpolys
29//
30
31// Converts p into a bucket poly (SBpoly) and destroys p
32// Assumes length <= 0 || pLength(p) == length
33void sBucketInit(sBucket_pt bucket, poly p, int length);
34
35// creates and returns new bucket, initializes it with p
36sBucket_pt  sBucketInit( poly p, int length, ring r = currRing);
37
38// Converts SBpoly into a poly and clears bucket
39// i.e., afterwards SBpoly == 0
40// assumes all monomials in bucket are different
41void sBucketClearMerge(sBucket_pt bucket, poly *p, int *length);
42
43// Converts SBpoly into a poly and clears bucket
44// i.e., afterwards SBpoly == 0
45// bucket may contain equal monials
46void sBucketClearAdd(sBucket_pt bucket, poly *p, int *length);
47
48// Converts SBpoly into a poly and detroys bucket
49inline void sBucketDestroyMerge(sBucket_pt bucket, poly *p, int *length)
50{
51  sBucketClearMerge(bucket, p, length);
52  sBucketDestroy(&bucket);
53}
54
55// Converts SBpoly into a poly and detroys bucket
56inline void sBucketDestroyAdd(sBucket_pt bucket, poly *p, int *length)
57{
58  sBucketClearAdd(bucket, p, length);
59  sBucketDestroy(&bucket);
60}
61
62
63//////////////////////////////////////////////////////////////////////////
64///
65/// Merges p into Spoly: assumes Bpoly and p have no common monoms
66///
67void sBucket_Merge_p(sBucket_pt bucket, poly p, int lp);
68// adds poly p to bucket
69void sBucket_Add_p(sBucket_pt bucket, poly p, int lp);
70
71
72//////////////////////////////////////////////////////////////////////////
73///
74/// Sorts p with bucektSort: assumes all monomials of p are different
75///
76poly sBucketSortMerge(poly p, ring r);
77
78//////////////////////////////////////////////////////////////////////////
79///
80/// Sorts p with bucektSort: p may have equal monomials
81///
82poly sBucketSortAdd(poly p, ring r);
83
84
85#endif // P_BUCKET_SORT
Note: See TracBrowser for help on using the repository browser.