GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmSparseMatrixOptions.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
24#ifndef _GEMA_SPARSE_MATRIX_OPTIONS_H_
25#define _GEMA_SPARSE_MATRIX_OPTIONS_H_
26
27#include "gmCoreConfig.h"
28
30
32class LuaTable;
33
36{
40 // ----------------------------------------------------------------------
49};
50
51#define GM_MATRIX_OPTIONS_DEF_RESIZE_FACTOR 2.0
52
55{
56public:
58
60
61 bool loadUserDefinitions(LuaTable& table, QString& err);
62
64 GmSparseMatrixLayoutMode mode() const { return _mode; }
65
67 const char* modeStr() const { return matrixModeToStr(_mode); }
68
77 bool lowMemory() const { return _lowMemory; }
78
85 {
86 if(_tripletSortStrategy < 0)
88 else
89 return (GmSparseMatrixTripletBufferSortStrategy)_tripletSortStrategy;
90 }
91
95 size_t reserve() const { return _reserve; }
96
100 double resizeFactor() const { return _resizeFactor; }
101
108 int numThreads() const { return _nthreads; }
109
110 void setNumThreads(int nthreads);
111
113 void setMode(GmSparseMatrixLayoutMode mode) { _mode = mode; }
114
116 void setLowMemory(bool mode) { _lowMemory = mode; }
117
120
121private:
122 static bool checkLowMemoryCondition(const GmSimulationData* simulation);
123 static const char* matrixModeToStr(GmSparseMatrixLayoutMode mode);
124 static int strToMatrixMode(const QString& str);
125
128 size_t _reserve;
131 int _tripletSortStrategy;
132};
133
134#endif
Auxiliar class used to store the complete set of simulation data.
Definition gmSimulationData.h:55
Set of configuration options for Sparse matrices.
Definition gmSparseMatrixOptions.h:55
GmSparseMatrixLayoutMode _mode
The mode for building the sparse matrix.
Definition gmSparseMatrixOptions.h:126
size_t _reserve
A user given estimate of the expected number of triplets / layout entries. If 0, will be estimated by...
Definition gmSparseMatrixOptions.h:128
double resizeFactor() const
Returns the user given metric for resizing data structures. Returns 0.0 if the value should be estima...
Definition gmSparseMatrixOptions.h:100
void setTripletSortStrategy(GmSparseMatrixTripletBufferSortStrategy st)
Updates the trilet sort strategy control (used by tests code only)
Definition gmSparseMatrixOptions.h:119
double _resizeFactor
A user given metric for resizing data structures. If 0, will be estimated by GeMA.
Definition gmSparseMatrixOptions.h:129
size_t reserve() const
Returns the user given estimate of the expected number of triplets / layout entries....
Definition gmSparseMatrixOptions.h:95
bool _lowMemory
User given setting to favour low memory strategies.
Definition gmSparseMatrixOptions.h:127
const char * modeStr() const
Returns the mode for building the sparse matrix as a string.
Definition gmSparseMatrixOptions.h:67
void setLowMemory(bool mode)
Updates the sparse matrix low memory control (used by tests code only)
Definition gmSparseMatrixOptions.h:116
int numThreads() const
The number of threads that should be used by sparse matrix building code. A value of -1 means the max...
Definition gmSparseMatrixOptions.h:108
GmSparseMatrixLayoutMode mode() const
Returns the mode for building the sparse matrix.
Definition gmSparseMatrixOptions.h:64
bool lowMemory() const
Returns true if the matrix should favour low memory strategies, false otherwise. If the user didn't s...
Definition gmSparseMatrixOptions.h:77
GmSparseMatrixTripletBufferSortStrategy tripletSortStrategy() const
Returns the sorting strategy used to process triplet lists. If the user didn't specified a value,...
Definition gmSparseMatrixOptions.h:84
void setMode(GmSparseMatrixLayoutMode mode)
Updates the sparse matrix building mode.
Definition gmSparseMatrixOptions.h:113
int _nthreads
The maximum number of threads that should be used by sparse matrix.
Definition gmSparseMatrixOptions.h:130
Declaration of useful configuration definitions for the Core library.
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
GmSparseMatrixLayoutMode
Supported modes for building the sparse matrix.
Definition gmSparseMatrixOptions.h:36
@ GM_HASH_LAYOUT
Layout mode with a hash table.
Definition gmSparseMatrixOptions.h:38
@ GM_VECTOR_LAYOUT
Layout mode with a vector based structure.
Definition gmSparseMatrixOptions.h:39
@ GM_ARMADILLO_TRIPLET_LIST
Definition gmSparseMatrixOptions.h:48
@ GM_TRIPLET_LIST
Batch mode with a (per thread) triplet list.
Definition gmSparseMatrixOptions.h:37
Declaration of the GmSparseMatrixTripletData and GmSparseMatrixTripletBuffer template classes.
GmSparseMatrixTripletBufferSortStrategy
The strategy used by the GmSparseMatrixTripletBuffer<T>::sortedData() methods.
Definition gmSparseMatrixTripletData.h:110
@ GM_TRIBUF_SS_ISORT_MERGE
Vectors are parallel inplace sorted, followed by a merge operation to the destination vector.
Definition gmSparseMatrixTripletData.h:112
@ GM_TRIBUF_SS_CONCAT_PCSORT
Vectors are concatenated and then parallel copy sorted. Faster when there is plenty of memory.
Definition gmSparseMatrixTripletData.h:111