v2DM-DOCI
1.0
|
#include <helpers.h>
Public Member Functions | |
matrix () | |
matrix (int n_, int m_) | |
matrix (const matrix &orig) | |
matrix (matrix &&orig) | |
virtual | ~matrix () |
matrix & | operator= (const matrix &orig) |
matrix & | operator= (double val) |
int | getn () const |
int | getm () const |
double | operator() (int x, int y) const |
double & | operator() (int x, int y) |
double & | operator[] (int x) |
double | operator[] (int x) const |
double * | getpointer () const |
matrix & | prod (matrix const &A, matrix const &B) |
std::unique_ptr< double[]> | svd () |
std::unique_ptr< double[]> | sym_eig () |
void | Print () const |
double | trace () const |
void | SaveToFile (std::string filename) const |
void | ReadFromFile (std::string filename) const |
Private Attributes | |
std::unique_ptr< double[]> | mat |
n by m array of double More... | |
int | n |
number of rows More... | |
int | m |
number of columns More... | |
Helper class, wrapper around a double array. Has methods to get the number of rows and columns. A simple matrix class.
matrix::matrix | ( | ) |
Empty matrix constructor. Don't use it unless you know what you're doing
Definition at line 43 of file helpers.cpp.
matrix::matrix | ( | int | n_, |
int | m_ | ||
) |
n_ | number of rows |
m_ | number of columns |
Definition at line 53 of file helpers.cpp.
matrix::matrix | ( | const matrix & | orig | ) |
orig | matrix to copy |
Definition at line 64 of file helpers.cpp.
matrix::matrix | ( | matrix && | orig | ) |
move constructor
orig | matrix to copy (descrutive) |
Definition at line 76 of file helpers.cpp.
int matrix::getm | ( | ) | const |
Definition at line 115 of file helpers.cpp.
int matrix::getn | ( | ) | const |
Definition at line 107 of file helpers.cpp.
double * matrix::getpointer | ( | ) | const |
double matrix::operator() | ( | int | x, |
int | y | ||
) | const |
Definition at line 120 of file helpers.cpp.
double & matrix::operator() | ( | int | x, |
int | y | ||
) |
Definition at line 126 of file helpers.cpp.
matrix & matrix::operator= | ( | double | val | ) |
Set all matrix elements equal to a value
val | the value to use |
Definition at line 96 of file helpers.cpp.
double & matrix::operator[] | ( | int | x | ) |
Definition at line 132 of file helpers.cpp.
double matrix::operator[] | ( | int | x | ) | const |
Definition at line 138 of file helpers.cpp.
void matrix::Print | ( | ) | const |
Definition at line 228 of file helpers.cpp.
Matrix-Matrix product of A and B. Store result in this
A | first matrix |
B | second matrix |
Definition at line 154 of file helpers.cpp.
void matrix::ReadFromFile | ( | std::string | filename | ) | const |
Definition at line 291 of file helpers.cpp.
void matrix::SaveToFile | ( | std::string | filename | ) | const |
Definition at line 246 of file helpers.cpp.
std::unique_ptr< double[]> matrix::svd | ( | ) |
Do a SVD on this matrix and store left singular values in this. Changes the size of the matrix!
Definition at line 173 of file helpers.cpp.
std::unique_ptr< double[]> matrix::sym_eig | ( | ) |
calculate eigenvalues of symmetric matrix
Definition at line 206 of file helpers.cpp.
double matrix::trace | ( | ) | const |
Definition at line 235 of file helpers.cpp.
|
private |