carl  24.04
Computer ARithmetic Library
carl::MonomialPool Class Reference

#include <MonomialPool.h>

Inheritance diagram for carl::MonomialPool:
Collaboration diagram for carl::MonomialPool:

Data Structures

struct  content_equal
 
struct  content_hash
 

Public Member Functions

Monomial::Arg create (Variable _var, exponent _exp)
 Creates a monomial from a variable and an exponent. More...
 
template<typename Number >
Monomial::Arg create (Variable _var, Number &&_exp)
 Creates a monomial from a variable and an exponent. More...
 
Monomial::Arg create (std::vector< std::pair< Variable, exponent >> &&_exponents, exponent _totalDegree)
 Creates a monomial from a list of variables and their exponents. More...
 
Monomial::Arg create (const std::initializer_list< std::pair< Variable, exponent >> &_exponents)
 Creates a Monomial. More...
 
Monomial::Arg create (std::vector< std::pair< Variable, exponent >> &&_exponents)
 Creates a monomial from a list of variables and their exponents. More...
 
void free (const Monomial *m)
 
std::size_t size () const
 
std::size_t largestID () const
 

Static Public Member Functions

static MonomialPoolgetInstance ()
 Returns the single instance of this class by reference. More...
 

Protected Member Functions

 MonomialPool (std::size_t _capacity=1000)
 Constructor of the pool. More...
 
 ~MonomialPool ()
 
Monomial::Arg add (Monomial::Content &&c, exponent totalDegree=0)
 
void check_rehash ()
 

Private Types

using underlying_set = boost::intrusive::unordered_set< Monomial >
 

Private Attributes

IDPool mIDs
 id allocator More...
 
pool::RehashPolicy mRehashPolicy
 
std::unique_ptr< underlying_set::bucket_type[]> mPoolBuckets
 
underlying_set mPool
 The pool. More...
 
std::recursive_mutex mMutex
 Mutex to avoid multiple access to the pool. More...
 

Friends

class Singleton< MonomialPool >
 
std::ostream & operator<< (std::ostream &os, const MonomialPool &mp)
 

Detailed Description

Definition at line 23 of file MonomialPool.h.

Member Typedef Documentation

◆ underlying_set

using carl::MonomialPool::underlying_set = boost::intrusive::unordered_set<Monomial>
private

Definition at line 49 of file MonomialPool.h.

Constructor & Destructor Documentation

◆ MonomialPool()

carl::MonomialPool::MonomialPool ( std::size_t  _capacity = 1000)
inlineexplicitprotected

Constructor of the pool.

Parameters
_capacityExpected necessary capacity of the pool.

Definition at line 71 of file MonomialPool.h.

Here is the call graph for this function:

◆ ~MonomialPool()

carl::MonomialPool::~MonomialPool ( )
inlineprotected

Definition at line 80 of file MonomialPool.h.

Member Function Documentation

◆ add()

Monomial::Arg carl::MonomialPool::add ( Monomial::Content &&  c,
exponent  totalDegree = 0 
)
protected

Definition at line 12 of file MonomialPool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ check_rehash()

void carl::MonomialPool::check_rehash ( )
inlineprotected

Definition at line 87 of file MonomialPool.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create() [1/5]

Monomial::Arg carl::MonomialPool::create ( const std::initializer_list< std::pair< Variable, exponent >> &  _exponents)

Creates a Monomial.

Parameters
_exponentsPossibly unsorted list of variables and epxonents.

Definition at line 41 of file MonomialPool.cpp.

Here is the call graph for this function:

◆ create() [2/5]

Monomial::Arg carl::MonomialPool::create ( std::vector< std::pair< Variable, exponent >> &&  _exponents)

Creates a monomial from a list of variables and their exponents.

Note that the input is required to be sorted.

Parameters
Sortedlist of variables and exponents.

Definition at line 48 of file MonomialPool.cpp.

Here is the call graph for this function:

◆ create() [3/5]

Monomial::Arg carl::MonomialPool::create ( std::vector< std::pair< Variable, exponent >> &&  _exponents,
exponent  _totalDegree 
)

Creates a monomial from a list of variables and their exponents.

Note that the input is required to be sorted.

Parameters
_exponentsSorted list of variables and exponents.
_totalDegreeTotal degree.

Definition at line 36 of file MonomialPool.cpp.

Here is the call graph for this function:

◆ create() [4/5]

Monomial::Arg carl::MonomialPool::create ( Variable  _var,
exponent  _exp 
)

Creates a monomial from a variable and an exponent.

Definition at line 31 of file MonomialPool.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create() [5/5]

template<typename Number >
Monomial::Arg carl::MonomialPool::create ( Variable  _var,
Number &&  _exp 
)
inline

Creates a monomial from a variable and an exponent.

Definition at line 106 of file MonomialPool.h.

Here is the call graph for this function:

◆ free()

void carl::MonomialPool::free ( const Monomial m)
inline

Definition at line 136 of file MonomialPool.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInstance()

static MonomialPool & carl::Singleton< MonomialPool >::getInstance ( )
inlinestaticinherited

Returns the single instance of this class by reference.

If there is no instance yet, a new one is created.

Definition at line 45 of file Singleton.h.

◆ largestID()

std::size_t carl::MonomialPool::largestID ( ) const
inline

Definition at line 154 of file MonomialPool.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

std::size_t carl::MonomialPool::size ( ) const
inline

Definition at line 151 of file MonomialPool.h.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const MonomialPool mp 
)
friend

Definition at line 159 of file MonomialPool.h.

◆ Singleton< MonomialPool >

friend class Singleton< MonomialPool >
friend

Definition at line 168 of file MonomialPool.h.

Field Documentation

◆ mIDs

IDPool carl::MonomialPool::mIDs
private

id allocator

Definition at line 46 of file MonomialPool.h.

◆ mMutex

std::recursive_mutex carl::MonomialPool::mMutex
mutableprivate

Mutex to avoid multiple access to the pool.

Definition at line 54 of file MonomialPool.h.

◆ mPool

underlying_set carl::MonomialPool::mPool
private

The pool.

Definition at line 52 of file MonomialPool.h.

◆ mPoolBuckets

std::unique_ptr<underlying_set::bucket_type[]> carl::MonomialPool::mPoolBuckets
private

Definition at line 50 of file MonomialPool.h.

◆ mRehashPolicy

pool::RehashPolicy carl::MonomialPool::mRehashPolicy
private

Definition at line 48 of file MonomialPool.h.


The documentation for this class was generated from the following files: