24 #ifndef _GEMA_MATRIX_H_ 25 #define _GEMA_MATRIX_H_ 34 #ifndef GM_MATRIX_DEFINED 35 #define GM_MATRIX_DEFINED 51 #define GM_MATRIX_IS_COLUMN_MAJOR 60 #if ARMA_VERSION_MAJOR != 5 || ARMA_VERSION_MINOR != 200 61 #error Unexpected Armadillo version. Please check that our internal fiddling done bellow is still valid 77 #define DECLARE_REF_MATRIX(x, ptr, lin, col) GmMatrix x((ptr), (lin), (col), false, true) 105 : n_rows(nlin), n_cols(ncol), n_elem(nlin*ncol),
106 _mat(const_cast<double*>(data), nlin, ncol, false, true)
112 : n_rows(0), n_cols(0), n_elem(0), _mat(NULL, 0, 0, false, true)
136 arma::access::rw(n_rows) = nlin;
137 arma::access::rw(n_cols) = ncol;
138 arma::access::rw(n_elem) = nlin * ncol;
143 const double& operator[] (
unsigned int ii)
const {
return _mat[ii]; }
144 const double& at(
unsigned int ii)
const {
return _mat.at(ii); }
145 const double& operator() (
unsigned int ii)
const {
return _mat(ii); }
147 const double& at(
unsigned int in_row,
unsigned int in_col)
const {
return _mat.at(in_row, in_col); }
148 const double& operator() (
unsigned int in_row,
unsigned int in_col)
const {
return _mat(in_row, in_col); }
150 bool is_empty()
const {
return _mat.is_empty(); }
151 bool is_vec()
const {
return _mat.is_vec(); }
152 bool is_rowvec()
const {
return _mat.is_rowvec(); }
153 bool is_colvec()
const {
return _mat.is_colvec(); }
154 bool is_square()
const {
return _mat.is_square(); }
156 bool in_range(
unsigned int ii)
const {
return _mat.in_range(ii); }
157 bool in_range(
unsigned int in_row,
unsigned int in_col)
const {
return _mat.in_range(in_row, in_col); }
159 const double* colptr(
unsigned int in_col)
const {
return _mat.colptr(in_col); }
160 const double* memptr()
const {
return _mat.memptr(); }
162 bool empty()
const {
return _mat.empty(); }
163 unsigned int size()
const {
return _mat.size(); }
void setMatrixMemory(GmMatrix &m, double *data, int nlin, int ncol)
Updates the memory area used internally by a matrix. DANGEROUS. Should be used only by the bold ones ...
Definition: gmMatrixUtils.h:106
GmCRMatrix(const double *data, int nlin, int ncol)
Constructs the matrix pointing to a const memory area represented in COLUMN MAJOR ORDER.
Definition: gmMatrix.h:104
const unsigned int n_cols
number of columns in the matrix (read-only)
Definition: gmMatrix.h:119
GmCRMatrix()
Constructs an empty matrix that needs to be initialized later by a call to setMemory()
Definition: gmMatrix.h:111
double elem_type
the type of elements stored in the matrix
Definition: gmMatrix.h:116
Declaration of usefull configuration definitions for the Core library.
Utilitary functions for working with doubles.
const GmMatrix & m()
Returns the wrapped matrix as a CONST reference.
Definition: gmMatrix.h:126
arma::subview_col< double > GmMatrixCol
A subcolumn view of a matrix.
Definition: gmMatrix.h:58
const unsigned int n_elem
number of elements in the matrix (read-only)
Definition: gmMatrix.h:120
const unsigned int n_rows
number of rows in the matrix (read-only)
Definition: gmMatrix.h:118
#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 matrix WRAPPER that binds the matrix to a CONST memory area with data already inicialize...
Definition: gmMatrix.h:100
arma::mat GmMatrix
The basic type for a GeMA matrix object. Currently based on an Armadillo matrix.
Definition: gmMatrix.h:38
void setMemory(const double *data, int nlin, int ncol)
Exchanges the memory area used by the matrix. Same caveats explained in the class documentation apply...
Definition: gmMatrix.h:131
Q_DECLARE_METATYPE(LuaFunction)