Cypress
1.0
C++ Spiking Neural Network Simulation Framework
|
#include <matrix.hpp>
Public Member Functions | |
Matrix () | |
Matrix (std::initializer_list< T > init) | |
template<size_t Rows, size_t Cols> | |
Matrix (const std::array< std::array< T, Cols >, Rows > &init) | |
Matrix (const std::vector< std::vector< T >> &init) | |
Matrix (const std::vector< T > &init) | |
Matrix (size_t rows, size_t cols, MatrixFlags flags=MatrixFlags::NONE) | |
Matrix (size_t rows, size_t cols, const T *data) | |
Matrix (size_t rows, size_t cols, T *data, bool destroy) | |
Matrix (const Matrix &o) | |
Matrix (Matrix &&o) noexcept | |
Matrix & | operator= (const Matrix &o) |
Matrix & | operator= (Matrix &&o) noexcept |
~Matrix () | |
operator std::vector< T > () const | |
bool | operator== (const Matrix< T > &o) const |
Matrix< T > & | fill (const T &val) |
T * | begin (size_t row=0) |
T * | end () |
const T * | begin (size_t row=0) const |
const T * | end () const |
const T * | cbegin (size_t row=0) const |
const T * | cend () const |
T & | operator() (size_t row, size_t col) |
const T & | operator() (size_t row, size_t col) const |
T & | operator() (size_t i) |
const T & | operator() (size_t i) const |
T & | operator[] (size_t i) |
const T & | operator[] (size_t i) const |
size_t | rows () const |
size_t | cols () const |
size_t | size () const |
void | resize (size_t rows, size_t cols) |
void | reshape (size_t rows, size_t cols) |
T * | data () |
const T * | data () const |
bool | empty () const |
Matrix | submatrix (size_t row, size_t col) const |
Returns the submatrix not containing specified row and column. More... | |
T | determinant () const |
Calculate the determinant of this matrix. Note that the type of the returned value is of the same type as the matrix, which might be a problem for unsigned types! Only valid for squared matrices! More... | |
Matrix | adjugate () const |
Calculates the adjugate/adjunct matrix. As for the determinant, this runs into issues with unsigned types and works only for squared matrices! More... | |
Matrix< double > | inverse () const |
Calculates the inverse of the matrix. As for the determinant, this runs into issues with unsigned types and works only for squared matrices! Note that the type of the returned matrix is always double! Throws if matrix is not invertible! More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const Matrix< T > &m) |
Base class providing storage for a 2D memory region of an arbitrary type T.
T | is the type stored in the matrix. |
|
inline |
Default constructor. Creates an empty matrix.
|
inline |
Initialiser list constructor.
|
inline |
2D array constructor.
|
inline |
|
inline |
|
inline |
Constructor of the Matrix type, creates a new matrix with the given extent.
rows | is the number of rows in the matrix. |
cols | is the number of columns in the matrix. |
flags | set to MatrixFlags::ZEROS to force an initialisation of the memory. If not given, the memory is not initialised. |
|
inline |
Constructor of the Matrix type, creates a new matrix with the given extent, copying the data from the given address.
rows | is the number of rows in the matrix. |
cols | is the number of columns in the matrix. |
data | is a pointer at a pre-existing data region from which the data will be copied. |
|
inline |
Constructor of the Matrix type from an existing data structure without a copy
rows | is the number of rows in the matrix. |
cols | is the number of columns in the matrix. |
data | is a pointer at a pre-existing data region |
destroy | True: destructor will free memory, False: Destructor will do nothing |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
Calculates the adjugate/adjunct matrix. As for the determinant, this runs into issues with unsigned types and works only for squared matrices!
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the height of the matrix.
|
inline |
Returns a pointer at the raw data buffer.
|
inline |
Returns a const pointer at the raw data.
|
inline |
Calculate the determinant of this matrix. Note that the type of the returned value is of the same type as the matrix, which might be a problem for unsigned types! Only valid for squared matrices!
|
inline |
Returns true if the matrix contains no data.
|
inline |
|
inline |
|
inline |
Fills the matrix with the given value.
|
inline |
Calculates the inverse of the matrix. As for the determinant, this runs into issues with unsigned types and works only for squared matrices! Note that the type of the returned matrix is always double! Throws if matrix is not invertible!
|
inline |
Conversion to a std::vector
|
inline |
Returns a reference at the element at position row and col.
|
inline |
Returns a const reference at the element at position row and col.
|
inline |
Returns a reference at the i-th element.
|
inline |
Returns a const reference at the i-th element.
|
inline |
|
inlinenoexcept |
|
inline |
Tests equality between two matrices.
o | is the matrix to which this matrix should be compared. |
|
inline |
Returns a copy of the i-th element.
|
inline |
Returns a copy of the i-th element.
|
inline |
Reshapes the matrix if rows * cols does not change. Otherwise flushes all previously stored data, does nothing if the dimensions do not change.
|
inline |
Resizes the matrix, flushes all previously stored data, does nothing if the dimensions do not change.
|
inline |
Returns the width of the matrix.
|
inline |
Returns the size of the matrix.
|
inline |
Returns the submatrix not containing specified row and column.
row | row to delete |
col | column to delete |
|
friend |
Dumps the matrix as CSV.