v2DM-DOCI  1.0
helpers::matrix Class Reference

#include <helpers.h>

+ Collaboration diagram for helpers::matrix:

Public Member Functions

 matrix ()
 
 matrix (int n_, int m_)
 
 matrix (const matrix &orig)
 
 matrix (matrix &&orig)
 
virtual ~matrix ()
 
matrixoperator= (const matrix &orig)
 
matrixoperator= (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
 
matrixprod (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...
 

Detailed Description

Helper class, wrapper around a double array. Has methods to get the number of rows and columns. A simple matrix class.

Definition at line 31 of file helpers.h.

Constructor & Destructor Documentation

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_ 
)
Parameters
n_number of rows
m_number of columns

Definition at line 53 of file helpers.cpp.

matrix::matrix ( const matrix orig)
Parameters
origmatrix to copy

Definition at line 64 of file helpers.cpp.

+ Here is the call graph for this function:

matrix::matrix ( matrix &&  orig)

move constructor

Parameters
origmatrix to copy (descrutive)

Definition at line 76 of file helpers.cpp.

virtual helpers::matrix::~matrix ( )
inlinevirtual

Definition at line 42 of file helpers.h.

Member Function Documentation

int matrix::getm ( ) const
Returns
number of columns

Definition at line 115 of file helpers.cpp.

int matrix::getn ( ) const
Returns
number of rows

Definition at line 107 of file helpers.cpp.

double * matrix::getpointer ( ) const

Definition at line 144 of file helpers.cpp.

+ Here is the caller graph for this function:

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= ( const matrix orig)

Definition at line 83 of file helpers.cpp.

+ Here is the call graph for this function:

matrix & matrix::operator= ( double  val)

Set all matrix elements equal to a value

Parameters
valthe 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::prod ( matrix const &  A,
matrix const &  B 
)

Matrix-Matrix product of A and B. Store result in this

Parameters
Afirst matrix
Bsecond matrix

Definition at line 154 of file helpers.cpp.

+ Here is the call graph for this function:

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!

Returns
list of singular values

Definition at line 173 of file helpers.cpp.

+ Here is the call graph for this function:

std::unique_ptr< double[]> matrix::sym_eig ( )

calculate eigenvalues of symmetric matrix

Returns
array with the eigenvalues

Definition at line 206 of file helpers.cpp.

+ Here is the call graph for this function:

double matrix::trace ( ) const

Definition at line 235 of file helpers.cpp.

Member Data Documentation

int helpers::matrix::m
private

number of columns

Definition at line 82 of file helpers.h.

std::unique_ptr<double []> helpers::matrix::mat
private

n by m array of double

Definition at line 78 of file helpers.h.

int helpers::matrix::n
private

number of rows

Definition at line 80 of file helpers.h.


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