Helios++
Helios software for LiDAR simulations
|
This class represents a DesignMatrix \(X \in \mathbb{R}^{m \times n}\). More...
#include <DesignMatrix.h>
Public Member Functions | |
DesignMatrix (vector< string > const &columnNames=vector< string >(0)) | |
Build a DesignMatrix with no data. More... | |
DesignMatrix (arma::Mat< T > const &X, vector< string > const &columnNames=vector< string >(0)) | |
Build a DesignMatrix from given armadillo matrix. More... | |
DesignMatrix (string const &path, string const &sep=",") | |
Build a DesignMatrix from data in file at given path. More... | |
T & | operator() (size_t const i, size_t const j) override |
Access to the \(x_{ij}\) component of the \(X\) design matrix. More... | |
virtual void | mergeInPlace (DesignMatrix const &dm) |
Merge given DesignMatrix into this DesignMatrix. More... | |
void | swapColumns (vector< long unsigned int > const &indices) |
void | swapColumns (vector< unsigned long long > const &indices) |
void | swapColumns (arma::uvec const &indices) |
Swap the columns of the DesignMatrix. More... | |
void | dropColumns (vector< long unsigned int > const &indices) |
void | dropColumns (vector< unsigned long long > const &indices) |
void | dropColumns (arma::uvec const &indices) |
Remove the columns from the DesignMatrix. More... | |
void | dropRows (vector< long unsigned int > const &indices) |
void | dropRows (vector< unsigned long long > const &indices) |
virtual void | dropRows (arma::uvec const &indices) |
Remove the rows from the DesignMatrix. More... | |
void | addToColumn (size_t const colIdx, T const x) |
Add \(x\) to all elements of \(j\)-th column. More... | |
arma::Mat< T > const & | getX () const |
Obtain a constant/read reference to the \(X\) matrix. More... | |
arma::Mat< T > & | getWritableX () |
Obtain a writable reference to the \(X\) matrix. More... | |
size_t | getNumRows () const override |
Obtain the number of rows of the DesignMatrix \(X\). More... | |
size_t | getNumColumns () const override |
Obtain the number of columns of the DesignMatrix \(X\). More... | |
size_t | getNumElements () const override |
Obtain the number of elements of the DesignMatrix \(X\). More... | |
arma::subview_row< T > const | getRow (size_t const i) const |
Obtain the \(i\)-th row of the DesignMatrix \(X\). More... | |
arma::Row< T > | getRowCopy (size_t const i) const |
Like DesignMatrix::getRow(size_t const) but returning a copy by value instead of a view-like reference. More... | |
arma::subview_col< T > const | getColumn (size_t const j) const |
Obtain the \(j\)-th column of the DesignMatrix \(X\). More... | |
arma::Col< T > | getColumnCopy (size_t const j) const |
Like DesignMatrix::getColumn(size_t const) but returning a copy by value instead of a view-like reference. More... | |
arma::subview_col< T > const | getColumn (string const &columnName) const |
Like the fluxionum::DesignMatrix::getColumn(size_t const) method but specifying the column by name. More... | |
arma::Col< T > | getColumnCopy (string const &columnName) const |
Like DesignMatrix::getColumn(string const &) but returning a copy by value instead of a view-like reference. More... | |
void | setColumn (size_t const j, arma::Col< T > const &col) |
Set the \(j\)-th column of the DesignMatrix \(X\). More... | |
![]() | |
AbstractDesignMatrix (vector< string > const &columnNames=vector< string >(0)) | |
Default constructor for the AbstractDesignMatrix. More... | |
T & | operator() (size_t const i, string const columnName) |
Like the AbstractDesignMatrix::operator()(size_t const, size_t const) method but specifying the column by its name instead of its index. More... | |
bool | hasColumnNames () const |
Check whether there are available column names for the AbstractDesignMatrix (true) or not (false) More... | |
string const & | getColumnName (size_t const j) const |
Obtain the name of the \(j\)-th column. More... | |
void | setColumnName (size_t const j, string const &columnName) |
Set the name of the \(j\)-th column. More... | |
vector< string > const & | getColumnNames () const |
Obtain a constant/read reference to the column names. More... | |
void | setColumnNames (vector< string > const &columnNames) |
Obtain a constant/read reference to the column names. More... | |
Protected Attributes | |
arma::Mat< T > | X |
The design matrix \(X \in \mathbb{R}^{m \times n}\). | |
![]() | |
vector< string > | columnNames |
The column names for the DesignMatrix. It can be either an empty vector when no column names are specified or a vector with as many names as columns (in the same order) | |
Additional Inherited Members | |
![]() | |
size_t | translateColumnNameToIndex (string const &columnName) const |
Find the corresponding column name for given index. More... | |
This class represents a DesignMatrix \(X \in \mathbb{R}^{m \times n}\).
It is assumed that each row represents a different point while each column defines a different attribute for the point. Thus, the DesignMatrix can be interpreted as a set of \(m\) different points defined in a \(n\) dimensional space. The DesignMatrix might even be decoded into a structure subset (structure space) that defines the structural relationship between points (i.e. their spatial relationships) and a feature subset (feature space) that defines the characteristics of each point (for instance, as descriptors of their local neighborhood).
T | Type \(\mathcal{T}\) of element for the design matrix \(X\) such that \(x_{ij} \in \mathcal{T}\). |
|
inline |
Build a DesignMatrix with no data.
columnNames | Either the name for each column or an empty vector if there are no names |
|
inline |
Build a DesignMatrix from given armadillo matrix.
X | Armadillo matrix to build DesignMatrix from |
columnNames | Either the name for each column or an empty vector if there are no names |
|
inline |
Build a DesignMatrix from data in file at given path.
path | Path to the file containing the data for the DesignMatrix |
columnNames | The default column names to be used if no column names are read from file at given path |
|
inline |
Add \(x\) to all elements of \(j\)-th column.
colIdx | The index ( \(j\)) of the column to be modified |
x | The value to be added to each element of given column |
|
inline |
Remove the columns from the DesignMatrix.
Let \(\vec{u} = (u_1, \ldots, u_k)\) be the vector of indices for the \(k \leq n\) columns to be removed from the matrix \(X \in \mathbb{R}^{m \times n}\). Thus, the new matrix \(X' \in \mathbb{R}^{m \times (n-k)}\) can be obtained from the \(X\) matrix simply by removing all the columns which index is the \(u_i\) component of vector \(\vec{u}\)
indices | The vector of indices \(vec{u} = (u_1, \ldots, u_n)\) |
|
inline |
|
inline |
|
inlinevirtual |
Remove the rows from the DesignMatrix.
Let \(\vec{u} = (u_1, \ldots, u_k)\) be the vector of indices for the \(k \leq m\) rows to be removed from the matrix \(X \in \mathbb{R}^{m \times n}\). Thus, the new matrix \(X' \in \mathbb{R}^{(m-k) \times n}\) can be obtained from the \(X\) matrix simply by removing all the rows which index if the \(u_i\) component of vector \(\vec{u}\)
indices | The vector of indices \({u} = (u_1, \ldots, u_n)\) |
Reimplemented in fluxionum::TemporalDesignMatrix< TimeType, VarType >.
|
inline |
|
inline |
|
inline |
Obtain the \(j\)-th column of the DesignMatrix \(X\).
j | Index of the column to be obtained |
|
inline |
Like the fluxionum::DesignMatrix::getColumn(size_t const) method but specifying the column by name.
columnName | The name of the column to be obtained |
|
inline |
Like DesignMatrix::getColumn(size_t const) but returning a copy by value instead of a view-like reference.
|
inline |
Like DesignMatrix::getColumn(string const &) but returning a copy by value instead of a view-like reference.
|
inlineoverridevirtual |
Obtain the number of columns of the DesignMatrix \(X\).
Implements fluxionum::AbstractDesignMatrix< T >.
|
inlineoverridevirtual |
Obtain the number of elements of the DesignMatrix \(X\).
Implements fluxionum::AbstractDesignMatrix< T >.
|
inlineoverridevirtual |
Obtain the number of rows of the DesignMatrix \(X\).
Implements fluxionum::AbstractDesignMatrix< T >.
|
inline |
Obtain the \(i\)-th row of the DesignMatrix \(X\).
i | Index of the row to be obtained |
|
inline |
Like DesignMatrix::getRow(size_t const) but returning a copy by value instead of a view-like reference.
|
inline |
Obtain a writable reference to the \(X\) matrix.
WARNING use this method only if you know how to manipulate underlying data structures of armadillo library
|
inline |
Obtain a constant/read reference to the \(X\) matrix.
|
inlinevirtual |
Merge given DesignMatrix into this DesignMatrix.
After merging, the values of this DesignMatrix will be the union of the previous values and the new ones from the given DesignMatrix dm
dm | DesignMatrix to be merged into this |
|
inlineoverridevirtual |
Access to the \(x_{ij}\) component of the \(X\) design matrix.
i | The row of the element being accessed |
j | The column of the element being accessed |
Implements fluxionum::AbstractDesignMatrix< T >.
|
inline |
Set the \(j\)-th column of the DesignMatrix \(X\).
j | Index of the column to be setted |
col | New values for the column to be setted |
|
inline |
Swap the columns of the DesignMatrix.
Let \(\vec{u} = (u_1, \ldots, u_n)\) be the vector of indices for the \(n\) columns of the matrix \(X \in \mathbb{R}^{m \times n}\). Thus, the new matrix \(X' \in \mathbb{R}^{m \times n}\) can be obtained from the \(X\) matrix simply by assuming that the \(i\)-th column of the \(X'\) matrix is the \(u_i\)-th column of the \(X\) matrix
indices | The vector of indices \(\vec{u} = (u_1, \ldots, u_n)\) |
|
inline |
|
inline |