24#ifndef _GEMA_VECTOR_H_
25#define _GEMA_VECTOR_H_
30#ifndef GM_VECTOR_DEFINED
31#define GM_VECTOR_DEFINED
47#if ARMA_VERSION_MAJOR != 14 || ARMA_VERSION_MINOR != 0
48#error Unexpected Armadillo version. Please check that our internal fiddling done below is still valid
63#define DECLARE_REF_VECTOR(x, ptr, lin) GmVector x((ptr), (lin), false, true)
76 : n_rows(nlin), n_cols(1), n_elem(nlin),
77 _vec(const_cast<double*>(data), nlin, false, true)
83 : n_rows(0), n_cols(0), n_elem(0), _vec(NULL, 0, false, true)
107 arma::access::rw(n_rows) = nlin;
108 arma::access::rw(n_cols) = 1;
109 arma::access::rw(n_elem) = nlin;
114 const double& operator[] (
unsigned int ii)
const {
return _vec[ii]; }
115 const double& at(
unsigned int ii)
const {
return _vec.at(ii); }
116 const double& operator() (
unsigned int ii)
const {
return _vec(ii); }
118 bool is_empty()
const {
return _vec.is_empty(); }
120 bool in_range(
unsigned int ii)
const {
return _vec.in_range(ii); }
122 const double* memptr()
const {
return _vec.memptr(); }
124 bool empty()
const {
return _vec.empty(); }
125 unsigned int size()
const {
return _vec.size(); }
An auxiliary vector WRAPPER that binds the vector to a CONST memory area with data already initialize...
Definition gmVector.h:72
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:102
GmCRVector()
Constructs an empty vector that needs to be initialized later by a call to setMemory()
Definition gmVector.h:82
const unsigned int n_elem
number of elements in the vector (read-only)
Definition gmVector.h:91
double elem_type
the type of elements stored in the vector
Definition gmVector.h:87
const unsigned int n_cols
number of columns in the vector (read-only)
Definition gmVector.h:90
GmCRVector(const double *data, int nlin)
Constructs the vector pointing to a const memory area.
Definition gmVector.h:75
const unsigned int n_rows
number of rows in the vector (read-only)
Definition gmVector.h:89
const GmVector & v()
Returns the wrapped vector as a CONST reference.
Definition gmVector.h:97
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
arma::vec2 GmVector2
A 2D vector with fixed size of 2 elements.
Definition gmVector.h:36
arma::vec GmVector
The basic type for a GeMA vector object. Currently based on an Armadillo vector.
Definition gmVector.h:34
arma::vec3 GmVector3
A 3D vector with fixed size of 3 elements.
Definition gmVector.h:35
Utilitary functions for working with vectors.
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:124