DACE 2.0 API Manual
Differential Algebra Core Engine
Public Member Functions
DACE::AlgebraicMatrix< T > Class Template Reference

#include <dace/AlgebraicMatrix.h>

Public Member Functions

 AlgebraicMatrix ()
 
 AlgebraicMatrix (const int size)
 Default Constructor. More...
 
 AlgebraicMatrix (const int nrows, const int ncols)
 
 AlgebraicMatrix (const int nrows, const int ncols, const T &d)
 
unsigned int ncols () const
 
unsigned int nrows () const
 
unsigned int size () const
 
void resize (int size)
 
void resize (int rows, int cols)
 
T & at (const unsigned int irow, const unsigned int icol)
 Reading/Writing single element. More...
 
const T & at (const unsigned int irow, const unsigned int icol) const
 Reading/Writing single element. More...
 
std::vector< T > getrow (const unsigned int irow) const
 Reading row. More...
 
std::vector< T > getcol (const unsigned int icol) const
 Reading column. More...
 
void setrow (const unsigned int irow, const std::vector< T > &obj)
 Set row equal to std::vector. More...
 
void setcol (const unsigned int icol, const std::vector< T > &obj)
 Set column equal to std::vector. More...
 
AlgebraicMatrix< T > submat (const unsigned int first_row, const unsigned int first_col, const unsigned int last_row, const unsigned int last_col) const
 Extract submatrix. More...
 
AlgebraicMatrix< T > submat (const unsigned int last_row, const unsigned int last_col) const
 Extract submatrix, starting from position (0,0) More...
 
AlgebraicMatrix< T > transpose () const
 Matrix transpose. More...
 
det () const
 Matrix determinant. More...
 
AlgebraicMatrix< T > inv () const
 Matrix inverse XXX: name. More...
 
AlgebraicMatrix< double > cons () const
 Return the costant part of a AlgebraicMatrix<T> More...
 

Detailed Description

template<class T>
class DACE::AlgebraicMatrix< T >

Class to handle matrices and their operations.

Constructor & Destructor Documentation

◆ AlgebraicMatrix() [1/4]

template<class T>
DACE::AlgebraicMatrix< T >::AlgebraicMatrix ( )
inline

◆ AlgebraicMatrix() [2/4]

template<class T>
DACE::AlgebraicMatrix< T >::AlgebraicMatrix ( const int  size)
inlineexplicit

Default Constructor.

Constructor for square matrices.

Parameters
[in]sizesize of the matrix, i.e. the number of rows and columns.

◆ AlgebraicMatrix() [3/4]

template<class T>
DACE::AlgebraicMatrix< T >::AlgebraicMatrix ( const int  nrows,
const int  ncols 
)
inline

Constructor for rectangular matrices.

Parameters
[in]nrowsnumber of rows of the matrix
[in]ncolsnumber of columns of the matrix

◆ AlgebraicMatrix() [4/4]

template<class T>
DACE::AlgebraicMatrix< T >::AlgebraicMatrix ( const int  nrows,
const int  ncols,
const T &  d 
)
inline

Constructor for rectangular matrices that allows to set all elements equal to a variable.

Parameters
[in]nrowsnumber of rows of the matrix
[in]ncolsnumber of columns of the matrix
[in]dmatrix elements value

Member Function Documentation

◆ at() [1/2]

template<class T >
T & DACE::AlgebraicMatrix< T >::at ( const unsigned int  irow,
const unsigned int  icol 
)

Reading/Writing single element.

Reads/write element from/to AlgebraicMatrix.

Parameters
[in]irowrow index.
[in]icolcolumn index.
Returns
The element of the AlgebraicMatrix.
See also
AlgebraicMatrix<T>::at

◆ at() [2/2]

template<class T >
const T & DACE::AlgebraicMatrix< T >::at ( const unsigned int  irow,
const unsigned int  icol 
) const

Reading/Writing single element.

Reads/write element from/to AlgebraicMatrix.

Parameters
[in]irowrow index.
[in]icolcolumn index.
Returns
The element of the AlgebraicMatrix.
See also
AlgebraicMatrix<T>::at

◆ cons()

template<class T >
AlgebraicMatrix< double > DACE::AlgebraicMatrix< T >::cons ( ) const

Return the costant part of a AlgebraicMatrix<T>

Extract the constant part of a AlgebraicMatrix The result is copied in a new AlgebraicMatrix.

Returns
A new AlgebraicMatrix that contains the constant part of the original.
See also
AlgebraicMatrix<T>::cons

◆ det()

template<class T >
T DACE::AlgebraicMatrix< T >::det ( ) const

Matrix determinant.

Compute the determinant of an AlgebraicMatrix

Returns
A variable that is the determinant of the matrix.
See also
AlgebraicMatrix<T>::det

◆ getcol()

template<class T >
std::vector< T > DACE::AlgebraicMatrix< T >::getcol ( const unsigned int  icol) const

Reading column.

Extracts a column of an AlgebraicMatrix. The result is copied in a new std::vector.

Parameters
[in]icolindex of the column to be extracted
Returns
A new std::vector containing the column of the AlgebraicMatrix.
See also
AlgebraicMatrix<T>::getcol

◆ getrow()

template<class T >
std::vector< T > DACE::AlgebraicMatrix< T >::getrow ( const unsigned int  irow) const

Reading row.

Extracts a row of an AlgebraicMatrix. The result is copied in a new std::vector.

Parameters
[in]irowindex of the row to be extracted
Returns
A new std::vector containing the row of the AlgebraicMatrix.
See also
AlgebraicMatrix<T>::getrow

◆ inv()

template<class T >
AlgebraicMatrix< T > DACE::AlgebraicMatrix< T >::inv ( ) const

Matrix inverse XXX: name.

Compute the inverse of an AlgebraicMatrix Algorithm based on the Gauss elimination with full pivot (from the Numerical Cookbook) The result is copied in a new AlgebraicMatrix.

Returns
A new AlgebraicMatrix that is the inverse of the original.
See also
AlgebraicMatrix<T>::inverse

◆ ncols()

template<class T>
unsigned int DACE::AlgebraicMatrix< T >::ncols ( ) const
inline

Returns the number of columns of the matrix

Returns
number of columns of the matrix.

◆ nrows()

template<class T>
unsigned int DACE::AlgebraicMatrix< T >::nrows ( ) const
inline

Returns the number of rows of the matrix

Returns
number of rows of the matrix.

◆ resize() [1/2]

template<class T >
void DACE::AlgebraicMatrix< T >::resize ( int  size)

Resize AlgeraicMatrix to a square AlgebraicMatrix of size. The original values are kept at the original location if they are inside bounds of the new matrix.

Parameters
[in]sizeSize of the matrix (number of rows/columns).
See also
AlgebraicMatrix<T>::resize

◆ resize() [2/2]

template<class T >
void DACE::AlgebraicMatrix< T >::resize ( int  rows,
int  cols 
)

Resize AlgeraicMatrix to a rectangular AlgebraicMatrix with size rows \(\times\) cols. The original values are kept at the original location if they are inside bounds of the new matrix.

Parameters
[in]rowsNumber of rows of the resized AlgebraicMatrix.
[in]colsNumber of columns of the resized AlgebraicMatrix.
See also
AlgebraicMatrix<T>::resize

◆ setcol()

template<class T >
void DACE::AlgebraicMatrix< T >::setcol ( const unsigned int  icol,
const std::vector< T > &  obj 
)

Set column equal to std::vector.

Insert std::vector into column of AlgebraicMatrix of the same type.

Parameters
[in]icolcolumn to be written
[in]objstd::vector to be written
See also
AlgebraicMatrix<T>::setrow

◆ setrow()

template<class T >
void DACE::AlgebraicMatrix< T >::setrow ( const unsigned int  irow,
const std::vector< T > &  obj 
)

Set row equal to std::vector.

Insert std::vector into row of AlgebraicMatrix of the same type.

Parameters
[in]irowrow to be written
[in]objstd::vector to be inserted as a row
See also
AlgebraicMatrix<T>::setrow

◆ size()

template<class T>
unsigned int DACE::AlgebraicMatrix< T >::size ( ) const
inline

Returns the number of elements of the matrix

Returns
number of elements of the matrix.

◆ submat() [1/2]

template<class T >
AlgebraicMatrix< T > DACE::AlgebraicMatrix< T >::submat ( const unsigned int  first_row,
const unsigned int  first_col,
const unsigned int  last_row,
const unsigned int  last_col 
) const

Extract submatrix.

Extracts submatrix of AlgebraicMatrix. The result is stored into a new AlgebraicMatrix.

Parameters
[in]first_rowindex of the first row to be extracted.
[in]last_rowindex of the last row to be extracted.
[in]first_colindex of the first column to be extracted.
[in]last_colindex of the last column to be extracted.
Returns
AlgebraicMatrix containing the desired submatrix.
See also
AlgebraicMatrix<T>::submat

◆ submat() [2/2]

template<class T >
AlgebraicMatrix< T > DACE::AlgebraicMatrix< T >::submat ( const unsigned int  last_row,
const unsigned int  last_col 
) const

Extract submatrix, starting from position (0,0)

Extracts submatrix of AlgebraicMatrix, starting from element (0,0). The result is stored into a new AlgebraicMatrix.

Parameters
[in]last_rowindex of the last row to be extracted.
[in]last_colindex of the last column to be extracted.
Returns
AlgebraicMatrix containing the desired submatrix.
See also
AlgebraicMatrix<T>::submat

◆ transpose()

template<class T >
AlgebraicMatrix< T > DACE::AlgebraicMatrix< T >::transpose ( ) const

Matrix transpose.

Transpose matrix. The result is copied into a new AlgebraicMatrix.

Returns
A new AlgebraicMatrix that is the transpose of the original.
See also
AlgebraicMatrix<T>::transpose

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