25 #ifndef _GEMA_SPARSE_MATRIX_TRIPLET_DATA_H_ 26 #define _GEMA_SPARSE_MATRIX_TRIPLET_DATA_H_ 43 #if Q_BYTE_ORDER != Q_LITTLE_ENDIAN 44 #error Invalid Triplet layout 47 static_assert(2 *
sizeof(
int) ==
sizeof(quint64),
"Unexpected int size in triplet layout");
58 template <GmSparseMatrixLayoutTypes T>
74 int ptr()
const {
return _key[1]; }
77 int index()
const {
return _key[0]; }
88 return *((quint64*)(&_key[0])) < *((quint64*)(&other.
_key[0]));
95 : _key{ col, lin }, _value(val) {}
100 : _key{ lin, col }, _value(val) {}
119 template <GmSparseMatrixLayoutTypes T>
137 template <GmSparseMatrixLayoutTypes T>
149 template <GmSparseMatrixLayoutTypes T>
An implementation of the GmAppendBuffer interface based on a "per thread" growing buffer.
Definition: gmAppendBuffer.h:152
virtual GmSparseMatrixTripletData< T > * sortedData(int nlin, GmSparseMatrixTripletBufferSortStrategy st)
Similar to data() but returning a sorted vector, obtained by using the given strategy....
Definition: gmSparseMatrixTripletData.cpp:133
GmSparseMatrixSingleTripletBuffer(size_t initSize, double resizeFactor=2.0, int numThreads=-1)
Buffer constructor. See the description for the GmSingleAppendBuffer constructor.
Definition: gmSparseMatrixTripletData.h:142
Declaration of usefull configuration definitions for the Core library.
GmSparseMatrixTripletData(int ptr, int index, double val, bool)
Alternate constructor receiving the ptr and the index values.
Definition: gmSparseMatrixTripletData.h:68
An implementation of the GmAppendBuffer interface based on synchoronized access to a shared buffer.
Definition: gmAppendBuffer.h:402
Especialization of the GmPerThreadAppendBuffer class using the GmSparseMatrixTripletBuffer interface.
Definition: gmSparseMatrixTripletData.h:150
A virtual class representing a buffer of T objects that can be appended in a thread-safe way,...
Definition: gmArmadilloSolverMatrix.h:36
Especialization of the GmSingleAppendBuffer class using the GmSparseMatrixTripletBuffer interface.
Definition: gmSparseMatrixTripletData.h:138
int ptr() const
Returns either the line (CSR) or column (CSC) data depending on the matrix format.
Definition: gmSparseMatrixTripletData.h:74
int index() const
Returns either the column (CSR) or line (CSC) data depending on the matrix format.
Definition: gmSparseMatrixTripletData.h:77
int _key[2]
Either column + line (CSR) or line + column (CSC), depending on the matrix format.
Definition: gmSparseMatrixTripletData.h:61
Declaration of the GmAppendBuffer class.
Vectors are concatenated and then parallel copy sorted. Faster when there is plenty of memory.
Definition: gmSparseMatrixTripletData.h:111
bool operator<(const GmSparseMatrixTripletData< T > &other) const
Compare operator to enable sorting with standard sort routines. Not needed by integer sorting....
Definition: gmSparseMatrixTripletData.h:84
virtual GmSparseMatrixTripletData< T > * sortedData(int nlin, GmSparseMatrixTripletBufferSortStrategy st)
Similar to data() but returning a sorted vector, obtained by using the given strategy....
Definition: gmSparseMatrixTripletData.cpp:63
An especialization of GmAppendBufffer for triplet data with an extra method for returning the buffer ...
Definition: gmSparseMatrixTripletData.h:120
GmSparseMatrixPerThreadTripletBuffer(size_t initSize, double resizeFactor=2.0, int numThreads=-1)
Buffer constructor. See the description for the GmPerThreadAppendBuffer constructor.
Definition: gmSparseMatrixTripletData.h:154
#define GMC_API_EXPORT
Macro for controling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_LI...
Definition: gmCoreConfig.h:35
virtual GmSparseMatrixTripletData< T > * sortedData(int nlin, GmSparseMatrixTripletBufferSortStrategy st)=0
Similar to data() but returning a sorted vector, obtained by using the given strategy....
GmSparseMatrixTripletBufferSortStrategy
The strategy used by the GmSparseMatrixTripletBuffer<T>::sortedData() methods.
Definition: gmSparseMatrixTripletData.h:109
Vectors are parallel inplace sorted, followed by a merge operation to the destination vector.
Definition: gmSparseMatrixTripletData.h:112
Aux structure used when building sparse matrices with the help of a triplet list. The tripet structur...
Definition: gmSparseMatrixTripletData.h:59
Declaration of the GmSparseMatrixLayout structure and its derived types.
static const char * sortStrategyToStr(GmSparseMatrixTripletBufferSortStrategy st)
Returns the string used to define the given sort strategy.
Definition: gmSparseMatrixTripletData.cpp:46
double _value
The triplet value.
Definition: gmSparseMatrixTripletData.h:62
static int strToSortStrategy(const QString &str)
Returns the sort strategy associated with the given string. Returns -1 if no match was found.
Definition: gmSparseMatrixTripletData.cpp:32
GmSparseMatrixTripletData()
Dummy constructor to allow using the structure inside a vector.
Definition: gmSparseMatrixTripletData.h:71