Macaulay2 Engine
Loading...
Searching...
No Matches
monom.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright (C) 2006-2011 by Mikhail V. Zinin *
3 * mzinin@gmail.com *
4 * *
5 * You may redistribute this file under the terms of the GNU General *
6 * Public License as published by the Free Software Foundation, either *
7 * version 2 of the License, or any later version. *
8 *****************************************************************************/
9
10#ifndef BIBASIS_MONOM_HPP
11#define BIBASIS_MONOM_HPP
12
46
47#include <set>
48#include <iostream>
49#include "allocator.hpp"
50
51namespace BIBasis
52{
69 class Monom
70 {
71 public:
72 typedef short int Integer;
79
80 protected:
94 {
98
101
102 void* operator new(size_t);
103 void operator delete(void* ptr);
104 };
107
109
110 protected:
111 Monom();
112 virtual void MultiplyBy(Integer var) = 0;
113 virtual VarsListNode* Find(const Integer var) const = 0;
114
115 public:
116 virtual ~Monom();
117 virtual Integer Degree() const;
118
119 virtual void SetOne() = 0;
120 virtual Integer operator[](const Integer var) const = 0;
121
122 virtual Integer FirstMultiVar() const = 0;
123 virtual std::set<Integer> GetVariablesSet() const = 0;
124
125 static Integer GetDimIndepend();
126 static void SetDimIndepend(Integer independ);
127 };
128
130 : Value(0)
131 , Next(nullptr)
132 {
133 }
134
138
139 inline void* Monom::VarsListNode::operator new(std::size_t)
140 {
141 return Allocator.Allocate();
142 }
143
144 inline void Monom::VarsListNode::operator delete(void* ptr)
145 {
146 Allocator.Free(ptr);
147 }
148
150 : ListHead(nullptr)
151 , TotalDegree(0)
152 {
153 }
154
156 {
157 }
158
160 {
161 return TotalDegree;
162 }
163
165 {
166 return DimIndepend;
167 }
168}
169
170#endif //BIBASIS_MONOM_HPP
BIBasis::FastAllocator — per-size-class slab allocator for BIBasis's small objects.
Slab allocator handing out fixed-size blocks for one BIBasis type per instance.
Definition allocator.hpp:57
virtual Integer operator[](const Integer var) const =0
virtual VarsListNode * Find(const Integer var) const =0
virtual void MultiplyBy(Integer var)=0
static Integer GetDimIndepend()
Definition monom.hpp:164
virtual std::set< Integer > GetVariablesSet() const =0
static void SetDimIndepend(Integer independ)
Definition monom.cpp:14
virtual Integer Degree() const
Definition monom.hpp:159
virtual Integer FirstMultiVar() const =0
short int Integer
Definition monom.hpp:72
Integer TotalDegree
Definition monom.hpp:106
VarsListNode * ListHead
Definition monom.hpp:105
static Integer DimIndepend
Definition monom.hpp:108
virtual void SetOne()=0
virtual ~Monom()
Definition monom.hpp:155
void size_t
Definition m2-mem.h:114
static FastAllocator Allocator
Definition monom.hpp:97
Singly linked-list node of a Monom's variable list, with a per-class slab allocator.
Definition monom.hpp:94