Fréchet View  1.6.0
A Tool for Exploring Fréchet Distance Algorithms
frechet::data::MatrixPool Class Reference

Detailed Description

memory pool for matrix objects (M4RI matrices mzd_t* and OpenCL matrices clm4rm_t*)

Keeps a list of recycled objects to reduce the need for new memory allocations. During the course of the poly-algorithm, all matrixes have similar sizes, so the chances for reusability are very good.

Author
Peter Schäfer

Definition at line 26 of file matrix_pool.h.

#include <matrix_pool.h>

Public Member Functions

 MatrixPool ()
 empty constructor More...
 
 ~MatrixPool ()
 destructor; releases all resources More...
 
mzd_t * new_mzd_t (int rows, int cols)
 allocate a new mzd_t structure (a matrix for the M4RI algorithms) More...
 
clmatrix_tnew_clmatrix_t (int rows, int cols, clm4rm_conditions *cond)
 allocate a new clmatrix_t structure (a matrix for the CLM4RM algorithms) More...
 
void reclaim (mzd_t *)
 reclaim an object (i.e. put it into the recycling list) More...
 
void reclaim (clmatrix_t *)
 reclaim an object (i.e. put it into the recycling list) More...
 
void clear ()
 release all resources More...
 

Private Types

typedef std::pair< int, int > Key
 
typedef std::list< mzd_t * > mzdList
 
typedef std::list< clmatrix_t * > clmatrixList
 
typedef boost::unordered_map< Key, mzdListmzdMap
 
typedef boost::unordered_map< Key, clmatrixListclmatrixMap
 

Private Member Functions

mzdListgetMzdFreeList (int rows, int cols)
 
clmatrixListgetClmatrixFreeList (int rows, int cols)
 

Private Attributes

mzdMap free_mzd
 set of recyclable mzd_t objects More...
 
clmatrixMap free_clmatrix
 set of recyclable clmatrix_t objects More...
 

Member Typedef Documentation

◆ clmatrixList

Definition at line 30 of file matrix_pool.h.

◆ clmatrixMap

typedef boost::unordered_map<Key,clmatrixList> frechet::data::MatrixPool::clmatrixMap
private

Definition at line 33 of file matrix_pool.h.

◆ Key

typedef std::pair<int,int> frechet::data::MatrixPool::Key
private

Definition at line 28 of file matrix_pool.h.

◆ mzdList

typedef std::list<mzd_t*> frechet::data::MatrixPool::mzdList
private

Definition at line 29 of file matrix_pool.h.

◆ mzdMap

typedef boost::unordered_map<Key,mzdList> frechet::data::MatrixPool::mzdMap
private

Definition at line 32 of file matrix_pool.h.

Constructor & Destructor Documentation

◆ MatrixPool()

MatrixPool::MatrixPool ( )

empty constructor

Definition at line 19 of file matrix_pool.cpp.

◆ ~MatrixPool()

MatrixPool::~MatrixPool ( )

destructor; releases all resources

Definition at line 23 of file matrix_pool.cpp.

Member Function Documentation

◆ clear()

void MatrixPool::clear ( )

release all resources

Definition at line 94 of file matrix_pool.cpp.

◆ getClmatrixFreeList()

MatrixPool::clmatrixList & MatrixPool::getClmatrixFreeList ( int  rows,
int  cols 
)
private
Returns
the clmatrix_t recycling-list for a given matrix size

Definition at line 36 of file matrix_pool.cpp.

◆ getMzdFreeList()

MatrixPool::mzdList & MatrixPool::getMzdFreeList ( int  rows,
int  cols 
)
private
Returns
the mzd_t recycling-list for a given matrix size

Definition at line 27 of file matrix_pool.cpp.

◆ new_clmatrix_t()

clmatrix_t * MatrixPool::new_clmatrix_t ( int  rows,
int  cols,
clm4rm_conditions cond 
)

allocate a new clmatrix_t structure (a matrix for the CLM4RM algorithms)

Parameters
rowsnumber of matrix rows
colsnumber of matrix columns
condclm4rm_conditions keeps track of OpenCL working queue
Returns
a clmatrix_t object, preferrably a recycled one

Definition at line 66 of file matrix_pool.cpp.

◆ new_mzd_t()

mzd_t * MatrixPool::new_mzd_t ( int  rows,
int  cols 
)

allocate a new mzd_t structure (a matrix for the M4RI algorithms)

Parameters
rowsnumber of matrix rows
colsnumber of matrix columns
Returns
a mzd_t object, preferrably a recycled one

Definition at line 46 of file matrix_pool.cpp.

◆ reclaim() [1/2]

void MatrixPool::reclaim ( mzd_t *  M)

reclaim an object (i.e. put it into the recycling list)

Definition at line 84 of file matrix_pool.cpp.

◆ reclaim() [2/2]

void MatrixPool::reclaim ( clmatrix_t M)

reclaim an object (i.e. put it into the recycling list)

Definition at line 89 of file matrix_pool.cpp.

Member Data Documentation

◆ free_clmatrix

clmatrixMap frechet::data::MatrixPool::free_clmatrix
private

set of recyclable clmatrix_t objects

Definition at line 38 of file matrix_pool.h.

◆ free_mzd

mzdMap frechet::data::MatrixPool::free_mzd
private

set of recyclable mzd_t objects

Definition at line 36 of file matrix_pool.h.


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