24 #ifndef _GEMA_VECTOR_H_ 25 #define _GEMA_VECTOR_H_ 30 #ifndef GM_VECTOR_DEFINED 31 #define GM_VECTOR_DEFINED 45 #if ARMA_VERSION_MAJOR != 5 || ARMA_VERSION_MINOR != 200 46 #error Unexpected Armadillo version. Please check that our internal fiddling done bellow is still valid 61 #define DECLARE_REF_VECTOR(x, ptr, lin) GmVector x((ptr), (lin), false, true) 74 : n_rows(nlin), n_cols(1), n_elem(nlin),
75 _vec(const_cast<double*>(data), nlin, false, true)
81 : n_rows(0), n_cols(0), n_elem(0), _vec(NULL, 0, false, true)
105 arma::access::rw(n_rows) = nlin;
106 arma::access::rw(n_cols) = 1;
107 arma::access::rw(n_elem) = nlin;
112 const double& operator[] (
unsigned int ii)
const {
return _vec[ii]; }
113 const double& at(
unsigned int ii)
const {
return _vec.at(ii); }
114 const double& operator() (
unsigned int ii)
const {
return _vec(ii); }
116 bool is_empty()
const {
return _vec.is_empty(); }
118 bool in_range(
unsigned int ii)
const {
return _vec.in_range(ii); }
120 const double* memptr()
const {
return _vec.memptr(); }
122 bool empty()
const {
return _vec.empty(); }
123 unsigned int size()
const {
return _vec.size(); }
double elem_type
the type of elements stored in the vector
Definition: gmVector.h:85
const unsigned int n_rows
number of rows in the vector (read-only)
Definition: gmVector.h:87
const unsigned int n_elem
number of elements in the vector (read-only)
Definition: gmVector.h:89
GmCRVector()
Constructs an empty vector that needs to be initialized later by a call to setMemory()
Definition: gmVector.h:80
Declaration of usefull configuration definitions for the Core library.
GmCRVector(const double *data, int nlin)
Constructs the vector pointing to a const memory area.
Definition: gmVector.h:73
void setMemory(const double *data, int nlin)
Exchanges the memory area used by the vector. Same caveats explained in the class documentation apply...
Definition: gmVector.h:100
#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
An auxiliary vector WRAPPER that binds the vector to a CONST memory area with data already initialize...
Definition: gmVector.h:69
const GmVector & v()
Returns the wrapped vector as a CONST reference.
Definition: gmVector.h:95
Utilitary functions for working with vectors.
const unsigned int n_cols
number of columns in the vector (read-only)
Definition: gmVector.h:88
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition: gmVector.h:34
Q_DECLARE_METATYPE(LuaFunction)
void setVectorMemory(GmVector &v, double *data, int nlin)
Updates the memory area used internally by a vector. DANGEROUS. Should be used only by the bold ones ...
Definition: gmVectorUtils.h:113