# opentl::math::SquareMatrix Class Reference

Special matrix class for a square matrix,. More...

Inherits opentl::math::Matrix.

List of all members.

## Public Member Functions
virtual SquareMatrix | cofactor ()
| Calculate cofactor matrix.
virtual double | determinant () const
| Calculate determinant of matrix.
virtual void | diagonal (math::Vector &v) const
| Returns the elements on the matrix main diagonal.
virtual void | eigenValues (Matrix &eigenVectors, Vector &values) const
| Calculate Eigenvalues and Eigenvectors of square matrix.
virtual double | getTrace () const
| Computes the trace (=sum of the diagonal).
virtual void | identity ()
| Set matrix values to identity.
virtual bool | invert (opentl::math::SquareMatrix &out, const InversionMethod &method=LU) const
virtual SquareMatrix | invert (const InversionMethod &method=LU) const
| SquareMatrix (const Matrix &matrix)
| SquareMatrix (const SquareMatrix &matrix)
| Constructor based on content of an existing SquareMatrix matrix.
| SquareMatrix (std::size_t dim)
| Constructor.
| SquareMatrix ()
virtual | ~SquareMatrix ()
| Destructor.

## Detailed Description

Special matrix class for a square matrix,.

Author:
  Claus Lenz <lenz@in.tum.de>

  Thomas Friedlhuber <friedlhu@in.tum.de>

## Constructor & Destructor Documentation

opentl::math::SquareMatrix::SquareMatrix | ( |  | ) |

opentl::math::SquareMatrix::SquareMatrix | ( | std::size_t | dim | ) | `[explicit]`

Constructor.

Parameters:

  | dim | dimension of square matrix

opentl::math::SquareMatrix::SquareMatrix | ( | const SquareMatrix & | matrix | ) |

Constructor based on content of an existing SquareMatrix matrix.

Parameters:

  | matrix | existing matrix

opentl::math::SquareMatrix::SquareMatrix | ( | const Matrix & | matrix | ) | `[explicit]`

virtual opentl::math::SquareMatrix::~SquareMatrix | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

virtual SquareMatrix opentl::math::SquareMatrix::cofactor | ( |  | ) | `[virtual]`

Calculate cofactor matrix.

virtual double opentl::math::SquareMatrix::determinant | ( |  | ) | const`[virtual]`

Calculate determinant of matrix.

virtual void opentl::math::SquareMatrix::diagonal | ( | math::Vector & | v | ) | const`[virtual]`

Returns the elements on the matrix main diagonal.

Parameters:

  | v | Diagonal elements in vector representation.

virtual void opentl::math::SquareMatrix::eigenValues | ( | Matrix & | eigenVectors,
|  | Vector & | values |
| ) |  |  | const`[virtual]`

Calculate Eigenvalues and Eigenvectors of square matrix.

Parameters:

  | eigenVectors | The output matrix of eigenvectors, stored as a subsequent rows (= transposed eigenvector per row)
  | eigenValues | The output vector of eigenvalues, stored in the descenting order (order of eigenvalues and eigenvectors is syncronized, of course).

virtual double opentl::math::SquareMatrix::getTrace | ( |  | ) | const`[virtual]`

Computes the trace (=sum of the diagonal).

virtual void opentl::math::SquareMatrix::identity | ( |  | ) | `[virtual]`

Set matrix values to identity.

virtual bool opentl::math::SquareMatrix::invert | ( | opentl::math::SquareMatrix & | out,
|  | const InversionMethod & | method = `LU` |
| ) |  |  | const`[virtual]`

brief inverts this matrix

Parameters:

  | method | LU - Gaussian elimination with optimal pivot element chose; SVD - Singular value decomposition (SVD) method; SVD_SYM - SVD method for a symmetric positively-defined matrix

Returns:
  was the solving successful?

virtual SquareMatrix opentl::math::SquareMatrix::invert | ( | const InversionMethod & | method = `LU` | ) | const`[virtual]`

brief inverts square matrices

Parameters:

  | method | LU - Gaussian elimination with optimal pivot element chose; SVD - Singular value decomposition (SVD) method; SVD_SYM - SVD method for a symmetric positively-defined matrix Note: if the inversion fails the resulting matrix is a ZERO matrix!