Macaulay2 Engine
Loading...
Searching...
No Matches
schur-poly-heap.hpp
Go to the documentation of this file.
1// Copyright 1996-2011 Michael E. Stillman
2
3#ifndef _schur_poly_heap_hpp_
4#define _schur_poly_heap_hpp_
5
38
40{
42 const SchurRing2 *S;
44
45 void add_to(ring_elem &a, ring_elem &b);
46
47 public:
48 schur_poly_heap(const SchurRing2 *S0);
49 ~schur_poly_heap() { /* nothing */}
50
51 void add(ring_elem p);
52
54 value(); // Returns the linearized value, and resets the schur_poly_heap.
55
57 {
58 return heap[i];
59 } // DO NOT USE, except for debugging purposes!
60};
61
63{
64 ring_elem c = S->add(a, b);
65 a = c;
66 b = S->zero();
67}
68
70 : S(S0), top_of_heap(-1)
71{
72 int i;
73 for (i = 0; i < GEOHEAP_SIZE; i++) heap[i] = S->zero();
74}
75
77{
78 size_t len = S->size(p);
79 int i = 0;
80 while (len >= heap_size[i]) i++;
81 add_to(heap[i], p);
82 len = S->size(heap[i]);
83 while (len >= heap_size[i])
84 {
85 i++;
86 add_to(heap[i], heap[i - 1]);
87 len = S->size(heap[i]);
88 }
89 if (i > top_of_heap) top_of_heap = i;
90}
91
93{
94 ring_elem result = S->zero();
95 for (int i = 0; i <= top_of_heap; i++)
96 {
97 if (S->size(heap[i]) == 0) continue;
98 add_to(result, heap[i]);
99 }
100 top_of_heap = -1;
101 return result;
102}
103
104#endif
Refactored Schur (symmetric-function) ring whose elements are schur_poly sums of partitions over a co...
Definition schur2.hpp:152
ring_elem debug_list(int i)
ring_elem heap[GEOHEAP_SIZE]
void add(ring_elem p)
const SchurRing2 * S
void add_to(ring_elem &a, ring_elem &b)
schur_poly_heap(const SchurRing2 *S0)
const int heap_size[GEOHEAP_SIZE]
Definition engine.cpp:53
int p
VALGRIND_MAKE_MEM_DEFINED & result(result)
#define GEOHEAP_SIZE
Definition style.hpp:46