Mapper  0.9.0
API documentation
Public Member Functions | List of all members
OpenOrienteering::Matrix Class Reference

Dynamically sized matrix of doubles. More...

#include <matrix.h>

Public Member Functions

 Matrix ()
 Constructs a 0x0 matrix. More...
 
 Matrix (const Matrix &other)
 Copy constructor. More...
 
 Matrix (int n, int m)
 Constructs a nxm matrix. More...
 
 ~Matrix ()
 Destructs the matrix. More...
 
void save (QXmlStreamWriter &xml, const QString &role) const
 Saves the matrix in xml format with the given value of the role attribute. More...
 
void load (QXmlStreamReader &xml)
 Loads the matrix in xml format. More...
 
int getRows () const
 Returns the number of rows. More...
 
int getCols () const
 Returns the number of columns. More...
 
Matrixoperator= (const Matrix &other)
 Assignment. More...
 
void setSize (int n, int m)
 Changes the size of the matrix. More...
 
void setTo (double v)
 Sets all matrix elements to v. More...
 
void set (int i, int j, double v)
 Sets a matrix element. More...
 
double get (int i, int j) const
 Returns a matrix element. More...
 
void swapRows (int a, int b)
 Exchanges the rows with indices a and b. More...
 
void subtract (const Matrix &b, Matrix &out) const
 Component-wise subtraction. More...
 
void add (const Matrix &b, Matrix &out) const
 Component-wise addition. More...
 
void multiply (double b, Matrix &out) const
 Multiplication with scalar factor. More...
 
void multiply (const Matrix &b, Matrix &out) const
 Matrix multiplication. More...
 
void transpose (Matrix &out)
 Matrix transpose. More...
 
double determinant () const
 Calculates the determinant. More...
 
bool invert (Matrix &out) const
 Tries to inverts the matrix. More...
 
void print () const
 Outputs the matrix to stdout for debugging purposes. More...
 

Detailed Description

Dynamically sized matrix of doubles.

Constructor & Destructor Documentation

◆ Matrix() [1/3]

OpenOrienteering::Matrix::Matrix ( )
inline

Constructs a 0x0 matrix.

◆ Matrix() [2/3]

OpenOrienteering::Matrix::Matrix ( const Matrix other)
inline

Copy constructor.

◆ Matrix() [3/3]

OpenOrienteering::Matrix::Matrix ( int  n,
int  m 
)
inline

Constructs a nxm matrix.

◆ ~Matrix()

OpenOrienteering::Matrix::~Matrix ( )
inline

Destructs the matrix.

Member Function Documentation

◆ add()

void OpenOrienteering::Matrix::add ( const Matrix b,
Matrix out 
) const
inline

Component-wise addition.

◆ determinant()

double OpenOrienteering::Matrix::determinant ( ) const

Calculates the determinant.

◆ get()

double OpenOrienteering::Matrix::get ( int  i,
int  j 
) const
inline

Returns a matrix element.

◆ getCols()

int OpenOrienteering::Matrix::getCols ( ) const
inline

Returns the number of columns.

◆ getRows()

int OpenOrienteering::Matrix::getRows ( ) const
inline

Returns the number of rows.

◆ invert()

bool OpenOrienteering::Matrix::invert ( Matrix out) const

Tries to inverts the matrix.

Returns true if successful.

◆ load()

void OpenOrienteering::Matrix::load ( QXmlStreamReader xml)

Loads the matrix in xml format.

◆ multiply() [1/2]

void OpenOrienteering::Matrix::multiply ( double  b,
Matrix out 
) const
inline

Multiplication with scalar factor.

◆ multiply() [2/2]

void OpenOrienteering::Matrix::multiply ( const Matrix b,
Matrix out 
) const
inline

Matrix multiplication.

◆ operator=()

Matrix& OpenOrienteering::Matrix::operator= ( const Matrix other)
inline

Assignment.

◆ print()

void OpenOrienteering::Matrix::print ( ) const

Outputs the matrix to stdout for debugging purposes.

◆ save()

void OpenOrienteering::Matrix::save ( QXmlStreamWriter xml,
const QString role 
) const

Saves the matrix in xml format with the given value of the role attribute.

◆ set()

void OpenOrienteering::Matrix::set ( int  i,
int  j,
double  v 
)
inline

Sets a matrix element.

◆ setSize()

void OpenOrienteering::Matrix::setSize ( int  n,
int  m 
)
inline

Changes the size of the matrix.

If the new size is different to the old, all matrix elements will be reset to zero.

◆ setTo()

void OpenOrienteering::Matrix::setTo ( double  v)
inline

Sets all matrix elements to v.

◆ subtract()

void OpenOrienteering::Matrix::subtract ( const Matrix b,
Matrix out 
) const
inline

Component-wise subtraction.

◆ swapRows()

void OpenOrienteering::Matrix::swapRows ( int  a,
int  b 
)
inline

Exchanges the rows with indices a and b.

◆ transpose()

void OpenOrienteering::Matrix::transpose ( Matrix out)
inline

Matrix transpose.


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