DOCI-Exact  1.0
helpers::matrix Class Reference

#include <helpers.h>

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)
 
matrixoperator+= (const matrix &orig)
 
matrixoperator-= (const matrix &orig)
 
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 ()
 
void mvprod (const double *x, double *y, double beta) const
 
void Print () const
 
double trace () const
 
std::vector< double > GetColumn (unsigned int) const
 
const double * GetColumnRaw (unsigned int idx) const
 
void SaveToFile (std::string filename) const
 
void ReadFromFile (std::string filename) const
 
 matrix ()
 
 matrix (int n_, int m_)
 
 matrix (const matrix &orig)
 
 matrix (matrix &&orig)
 
virtual ~matrix ()
 
matrixoperator= (const matrix &orig)
 
matrixoperator= (double val)
 
matrixoperator+= (const matrix &orig)
 
matrixoperator-= (const matrix &orig)
 
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 ()
 
void mvprod (const double *x, double *y, double beta) const
 
void Print () const
 
double trace () const
 
std::vector< double > GetColumn (unsigned int) const
 
const double * GetColumnRaw (unsigned int idx) const
 
void SaveToFile (std::string filename) const
 
void ReadFromFile (std::string filename) const
 

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 38 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 42 of file helpers.cpp.

matrix::matrix ( int  n_,
int  m_ 
)
Parameters
n_number of rows
m_number of columns

Definition at line 52 of file helpers.cpp.

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

Definition at line 63 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 75 of file helpers.cpp.

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

Definition at line 49 of file helpers.h.

helpers::matrix::matrix ( )
helpers::matrix::matrix ( int  n_,
int  m_ 
)
helpers::matrix::matrix ( const matrix orig)
helpers::matrix::matrix ( matrix &&  orig)
virtual helpers::matrix::~matrix ( )
inlinevirtual

Definition at line 49 of file helpers.h.

Member Function Documentation

std::vector< double > matrix::GetColumn ( unsigned int  idx) const

Get a column out of a matrix.

Parameters
idxthe number of the column
Returns
a vector with the contents of the column

Definition at line 255 of file helpers.cpp.

std::vector<double> helpers::matrix::GetColumn ( unsigned  int) const
const double * matrix::GetColumnRaw ( unsigned int  idx) const

Dangerious brother of GetColumn(), it returns a raw pointer to a column. If this object goes out of scope, this pointer will no longer be valid

Parameters
idxthe number of the column
Returns
pointer to the column requested

Definition at line 272 of file helpers.cpp.

const double* helpers::matrix::GetColumnRaw ( unsigned int  idx) const
int matrix::getm ( ) const
Returns
number of columns

Definition at line 136 of file helpers.cpp.

+ Here is the caller graph for this function:

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

Definition at line 128 of file helpers.cpp.

+ Here is the caller graph for this function:

int helpers::matrix::getn ( ) const
double * matrix::getpointer ( ) const

Definition at line 165 of file helpers.cpp.

+ Here is the caller graph for this function:

double* helpers::matrix::getpointer ( ) const
void helpers::matrix::mvprod ( const double *  x,
double *  y,
double  beta 
) const
void matrix::mvprod ( const double *  x,
double *  y,
double  beta 
) const

Definition at line 223 of file helpers.cpp.

+ Here is the call graph for this function:

double helpers::matrix::operator() ( int  x,
int  y 
) const
double matrix::operator() ( int  x,
int  y 
) const

Definition at line 141 of file helpers.cpp.

double & matrix::operator() ( int  x,
int  y 
)

Definition at line 147 of file helpers.cpp.

double& helpers::matrix::operator() ( int  x,
int  y 
)
matrix & matrix::operator+= ( const matrix orig)

Definition at line 103 of file helpers.cpp.

+ Here is the call graph for this function:

matrix& helpers::matrix::operator+= ( const matrix orig)
matrix & matrix::operator-= ( const matrix orig)

Definition at line 114 of file helpers.cpp.

+ Here is the call graph for this function:

matrix& helpers::matrix::operator-= ( const matrix orig)
matrix& helpers::matrix::operator= ( const matrix orig)
matrix & matrix::operator= ( const matrix orig)

Definition at line 82 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 95 of file helpers.cpp.

matrix& helpers::matrix::operator= ( double  val)
double & matrix::operator[] ( int  x)

Definition at line 153 of file helpers.cpp.

double& helpers::matrix::operator[] ( int  x)
double matrix::operator[] ( int  x) const

Definition at line 159 of file helpers.cpp.

double helpers::matrix::operator[] ( int  x) const
void matrix::Print ( ) const

Definition at line 233 of file helpers.cpp.

void helpers::matrix::Print ( ) const
matrix& helpers::matrix::prod ( matrix const &  A,
matrix const &  B 
)
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 175 of file helpers.cpp.

+ Here is the call graph for this function:

void helpers::matrix::ReadFromFile ( std::string  filename) const
void matrix::ReadFromFile ( std::string  filename) const

Definition at line 325 of file helpers.cpp.

void helpers::matrix::SaveToFile ( std::string  filename) const
void matrix::SaveToFile ( std::string  filename) const

Definition at line 280 of file helpers.cpp.

std::unique_ptr<double []> helpers::matrix::svd ( )
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 194 of file helpers.cpp.

+ Here is the call graph for this function:

double matrix::trace ( ) const

Definition at line 240 of file helpers.cpp.

double helpers::matrix::trace ( ) const

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