24#ifndef _GEMA_MATRIX_H_
25#define _GEMA_MATRIX_H_
34#ifndef GM_MATRIX_DEFINED
35#define GM_MATRIX_DEFINED
39typedef arma::mat33 GmMatrix3x3;
52#define GM_MATRIX_IS_COLUMN_MAJOR
61#if ARMA_VERSION_MAJOR != 14 || ARMA_VERSION_MINOR != 0
62#error Unexpected Armadillo version. Please check that our internal fiddling done below is still valid
78#define DECLARE_REF_MATRIX(x, ptr, lin, col) GmMatrix x((ptr), (lin), (col), false, true)
106 : n_rows(nlin), n_cols(ncol), n_elem(nlin*ncol),
107 _mat(const_cast<double*>(data), nlin, ncol, false, true)
113 : n_rows(0), n_cols(0), n_elem(0), _mat(NULL, 0, 0, false, true)
137 arma::access::rw(n_rows) = nlin;
138 arma::access::rw(n_cols) = ncol;
139 arma::access::rw(n_elem) = nlin * ncol;
144 const double& operator[] (
unsigned int ii)
const {
return _mat[ii]; }
145 const double& at(
unsigned int ii)
const {
return _mat.at(ii); }
146 const double& operator() (
unsigned int ii)
const {
return _mat(ii); }
148 const double& at(
unsigned int in_row,
unsigned int in_col)
const {
return _mat.at(in_row, in_col); }
149 const double& operator() (
unsigned int in_row,
unsigned int in_col)
const {
return _mat(in_row, in_col); }
151 bool is_empty()
const {
return _mat.is_empty(); }
152 bool is_vec()
const {
return _mat.is_vec(); }
153 bool is_rowvec()
const {
return _mat.is_rowvec(); }
154 bool is_colvec()
const {
return _mat.is_colvec(); }
155 bool is_square()
const {
return _mat.is_square(); }
157 bool in_range(
unsigned int ii)
const {
return _mat.in_range(ii); }
158 bool in_range(
unsigned int in_row,
unsigned int in_col)
const {
return _mat.in_range(in_row, in_col); }
160 const double* colptr(
unsigned int in_col)
const {
return _mat.colptr(in_col); }
161 const double* memptr()
const {
return _mat.memptr(); }
163 bool empty()
const {
return _mat.empty(); }
164 unsigned int size()
const {
return _mat.size(); }
An auxiliary matrix WRAPPER that binds the matrix to a CONST memory area with data already inicialize...
Definition gmMatrix.h:102
const unsigned int n_rows
number of rows in the matrix (read-only)
Definition gmMatrix.h:119
const GmMatrix & m()
Returns the wrapped matrix as a CONST reference.
Definition gmMatrix.h:127
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:105
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:132
GmCRMatrix()
Constructs an empty matrix that needs to be initialized later by a call to setMemory()
Definition gmMatrix.h:112
double elem_type
the type of elements stored in the matrix
Definition gmMatrix.h:117
const unsigned int n_cols
number of columns in the matrix (read-only)
Definition gmMatrix.h:120
const unsigned int n_elem
number of elements in the matrix (read-only)
Definition gmMatrix.h:121
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
Q_DECLARE_METATYPE(GmMatrix)
Fixed size def for 2x2.
arma::subview_col< double > GmMatrixCol
A subcolumn view of a matrix.
Definition gmMatrix.h:59
arma::mat GmMatrix
The basic type for a GeMA matrix object. Currently based on an Armadillo matrix.
Definition gmMatrix.h:38
arma::mat22 GmMatrix2x2
Fixed size def for 3x3.
Definition gmMatrix.h:40
Utilitary functions for working with doubles.
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