roadrunner  2.6.0
Fast simulator for SBML models
Public Member Functions | Friends | List of all members
rr::Matrix3D< IndexType, DataType > Class Template Reference

A basic local 3D version of the Matrix class, based on initializer_list. More...

#include <Matrix3D.h>

Public Member Functions

 Matrix3D ()=default
 default construct a 3D matrix
 
 Matrix3D (int numRows, int numCols, int numZ)
 construct an empty 3D matrix with numRows x numCols x numZ dimensions.
 
 Matrix3D (std::initializer_list< IndexType > idx, Matrix3DInitializer data)
 
void insert (IndexType idx, Matrix< DataType > mat)
 
void pushBack (IndexType idx, Matrix< DataType > mat)
 
Matrix< DataType > & operator[] (int idx)
 Indexer to slice a Matrix3D and index value and data at idx. More...
 
rr::Matrix< DataType > & slice (int k)
 1D Matrix slicer. More...
 
rr::Matrix3D< DataType, IndexType > & colSliceByName (const std::vector< std::string > &rowNames)
 slice a Matrix3D by colnames. More...
 
std::vector< DataType > slice (int k, int j)
 2D Matrix slicer. More...
 
DataType slice (int k, int j, int i)
 3D Matrix slicer. More...
 
Matrix< DataType > & getItem (IndexType idx)
 slicing operator that uses the user provided index. More...
 
const std::vector< IndexType > & getIndex () const
 getter for the index data field of the Matrix3D. More...
 
void setKthMatrix (int k, IndexType idx, Matrix< DataType > data)
 
int numRows ()
 get number of rows in this 3D matrix More...
 
int numCols ()
 get number of columns in this 3D matrix More...
 
int numZ ()
 get number of matrices in this 3D matrix More...
 
void setRowNames (const std::vector< std::string > &rowNames)
 set row names for each of the z matrices
 
void setColNames (const std::vector< std::string > &colNames)
 set col names for each of the z matrices
 
std::vector< std::string > getRowNames ()
 return the row names for this Matrix3D
 
std::vector< std::string > getColNames ()
 return the column names for this Matrix3D
 
bool operator== (Matrix3D< IndexType, DataType > &other)
 equality operator
 
bool operator!= (Matrix3D< IndexType, DataType > &other)
 inequality operator
 
bool almostEquals (Matrix3D< double, double > &other, double tol)
 equality operator for double IndexType and DataType types only
 
void deleteRow (const int &which)
 delete the row indexed by More...
 
void deleteRow (const std::string &which)
 delete the row indexed by More...
 
void deleteCol (const int &which)
 delete the col indexed by More...
 
void deleteCol (const std::string &which)
 delete the col indexed by More...
 

Friends

template<typename IndexType_ , typename DataType_ >
std::ostream & operator<< (std::ostream &os, Matrix3D< IndexType_, DataType_ > &matrix3D)
 

Detailed Description

template<typename IndexType, typename DataType>
class rr::Matrix3D< IndexType, DataType >

A basic local 3D version of the Matrix class, based on initializer_list.

Member Function Documentation

◆ colSliceByName()

template<typename IndexType , typename DataType >
rr::Matrix3D<DataType, IndexType>& rr::Matrix3D< IndexType, DataType >::colSliceByName ( const std::vector< std::string > &  rowNames)
inline

slice a Matrix3D by colnames.

Parameters
rowNamesthe names of the columns to keep, the remaining rows are removed in the returned Matrix3D.

◆ deleteCol() [1/2]

template<typename IndexType , typename DataType >
void rr::Matrix3D< IndexType, DataType >::deleteCol ( const int &  which)
inline

delete the col indexed by

Parameters
whichin each of the k submatrices in this Matrix3D.
See also
rr::Matrix::deleteCol.

◆ deleteCol() [2/2]

template<typename IndexType , typename DataType >
void rr::Matrix3D< IndexType, DataType >::deleteCol ( const std::string &  which)
inline

delete the col indexed by

Parameters
whichin each of the k submatrices in this Matrix3D.
See also
rr::Matrix::deleteCol.

◆ deleteRow() [1/2]

template<typename IndexType , typename DataType >
void rr::Matrix3D< IndexType, DataType >::deleteRow ( const int &  which)
inline

delete the row indexed by

Parameters
whichin each of the k submatrices in this Matrix3D.
See also
rr::Matrix::deleteRow.

◆ deleteRow() [2/2]

template<typename IndexType , typename DataType >
void rr::Matrix3D< IndexType, DataType >::deleteRow ( const std::string &  which)
inline

delete the row indexed by

Parameters
whichin each of the k submatrices in this Matrix3D.
See also
rr::Matrix::deleteRow.

◆ getIndex()

template<typename IndexType , typename DataType >
const std::vector<IndexType>& rr::Matrix3D< IndexType, DataType >::getIndex ( ) const
inline

getter for the index data field of the Matrix3D.

Returns
a std::vector<IndexType>

◆ getItem()

template<typename IndexType , typename DataType >
Matrix<DataType>& rr::Matrix3D< IndexType, DataType >::getItem ( IndexType  idx)
inline

slicing operator that uses the user provided index.

Parameters
idxthe value of the element in this Matrix3D that has the unique index idx.
Returns
the Matrix<DataType> indexed by the IndexType idx.

◆ numCols()

template<typename IndexType , typename DataType >
int rr::Matrix3D< IndexType, DataType >::numCols ( )
inline

get number of columns in this 3D matrix

if x is rows, y is columns, z is depth.

◆ numRows()

template<typename IndexType , typename DataType >
int rr::Matrix3D< IndexType, DataType >::numRows ( )
inline

get number of rows in this 3D matrix

x is rows, y is columns, z is depth.

◆ numZ()

template<typename IndexType , typename DataType >
int rr::Matrix3D< IndexType, DataType >::numZ ( )
inline

get number of matrices in this 3D matrix

if x is rows, y is columns, z is depth.

◆ operator[]()

template<typename IndexType , typename DataType >
Matrix<DataType>& rr::Matrix3D< IndexType, DataType >::operator[] ( int  idx)
inline

Indexer to slice a Matrix3D and index value and data at idx.

Returns
the k'th 2D matrix, indexed by Z dimension

◆ slice() [1/3]

template<typename IndexType , typename DataType >
rr::Matrix<DataType>& rr::Matrix3D< IndexType, DataType >::slice ( int  k)
inline

1D Matrix slicer.

Convert a 3D matrix to a 2D rr::Matrix<DataType> by slicing the Z direction using numerical indices. Equivalent to Matrix3D<DataType>::operator[]

Parameters
kcorresponds to the number of sub matrices, indexed by k in the set 0, 1, ..., zMax.
Returns
A single 2D rr::Matrix<DataType> object at index k of this Matrix3D<DataType> with dimensions (xMax, yMax) (width by height)

◆ slice() [2/3]

template<typename IndexType , typename DataType >
std::vector<DataType> rr::Matrix3D< IndexType, DataType >::slice ( int  k,
int  j 
)
inline

2D Matrix slicer.

Convert a 3D matrix to a 1D std::vector<DataType> by slicing the Z (depth) and then the y (height) direction using numerical indices.

Parameters
kindexes the number of sub matrices, k in 0, 1, ..., zMax.
jindexes the number of row vectors in submatrix k for j in 0, 1, ..., yMax
Returns
A single 1D std::vector<DataType> object at index k, j of this Matrix3D<DataType> with dimensions (xMax) (width). This is a row vector at submatrix k, row j of this rr::Matrix3D<DataType>

◆ slice() [3/3]

template<typename IndexType , typename DataType >
DataType rr::Matrix3D< IndexType, DataType >::slice ( int  k,
int  j,
int  i 
)
inline

3D Matrix slicer.

Convert a 3D matrix to a scalar DataType by slicing the (k, j, i) (depth, height, width) direction using numerical indices.

Parameters
kcorresponds to the number of sub matrices, indexed by k in the set 0, 1, ..., zMax.
jindexes the number of row vectors in submatrix k for j in 0, 1, ..., yMax
iindexes the number of elements in each row vector j; i in 0, 1, ..., xMax
Returns
A scalar DataType object at index k, j, i of this Matrix3D<DataType>.

The documentation for this class was generated from the following file: