yat  0.21pre
Public Member Functions | Related Functions | List of all members
theplu::yat::utility::DiagonalMatrix Class Reference

Diagonal Matrix. More...

#include <yat/utility/DiagonalMatrix.h>

Public Member Functions

 DiagonalMatrix (void)
 Default constructor.
 
 DiagonalMatrix (size_t row, size_t column, double x=0.0)
 
 DiagonalMatrix (const VectorBase &diagonal)
 
 DiagonalMatrix (const MatrixBase &m)
 
size_t rows (void) const
 
size_t columns (void) const
 
const double operator() (size_t row, size_t col) const
 
double & operator() (size_t i)
 
DiagonalMatrixoperator*= (const DiagonalMatrix &rhs)
 Multiplication and assign operator. More...
 
DiagonalMatrixoperator+= (const DiagonalMatrix &rhs)
 Add and assign operator. More...
 
DiagonalMatrixoperator-= (const DiagonalMatrix &rhs)
 Subtract and assign operator. More...
 

Related Functions

(Note that these are not member functions.)

DiagonalMatrix operator* (const DiagonalMatrix &lhs, const DiagonalMatrix &rhs)
 
template<class T >
expression::DiagonalMatrixMatrix< T > operator* (const DiagonalMatrix &lhs, const BasicMatrix< T > &rhs)
 matrix matrix multiplication More...
 
template<class T >
expression::MatrixDiagonalMatrix< T > operator* (const BasicMatrix< T > &lhs, const DiagonalMatrix &rhs)
 matrix matrix multiplication More...
 
DiagonalMatrix operator+ (const DiagonalMatrix &lhs, const DiagonalMatrix &rhs)
 matrix matrix addition More...
 
template<class T >
expression::DiagonalMatrix< DiagonalMatrix, BasicMatrix< T >, expression::Plusoperator+ (const DiagonalMatrix &lhs, const BasicMatrix< T > &rhs)
 matrix matrix addition More...
 
template<class T >
expression::DiagonalMatrix< BasicMatrix< T >, DiagonalMatrix, expression::Plusoperator+ (const BasicMatrix< T > &lhs, const DiagonalMatrix &rhs)
 matrix matrix addition More...
 
DiagonalMatrix operator- (const DiagonalMatrix &lhs, const DiagonalMatrix &rhs)
 matrix matrix subtraction More...
 
template<class T >
expression::DiagonalMatrix< DiagonalMatrix, BasicMatrix< T >, expression::Minusoperator- (const DiagonalMatrix &lhs, const BasicMatrix< T > &rhs)
 matrix matrix subtraction More...
 
template<class T >
expression::DiagonalMatrix< BasicMatrix< T >, DiagonalMatrix, expression::Minusoperator- (const BasicMatrix< T > &lhs, const DiagonalMatrix &rhs)
 matrix matrix subtraction More...
 
template<class T >
expression::DiagonalMatrixVector< T > operator* (const DiagonalMatrix &lhs, const BasicVector< T > &rhs)
 matrix vector multiplication More...
 
template<class T >
expression::DiagonalMatrixVector< T > operator* (const BasicVector< T > &lhs, const DiagonalMatrix &rhs)
 vector matrix multiplication More...
 

Detailed Description

Diagonal Matrix.

All off-diagonal elements are zero by definition, which can be used to speed up some calculation.

Since
New in yat 0.15

Constructor & Destructor Documentation

◆ DiagonalMatrix() [1/3]

theplu::yat::utility::DiagonalMatrix::DiagonalMatrix ( size_t  row,
size_t  column,
double  x = 0.0 
)

Construct a row x column Matrix with all elements set to x

◆ DiagonalMatrix() [2/3]

theplu::yat::utility::DiagonalMatrix::DiagonalMatrix ( const VectorBase diagonal)
explicit

Construct a square matrix in which diagonal is set to diagonal

◆ DiagonalMatrix() [3/3]

theplu::yat::utility::DiagonalMatrix::DiagonalMatrix ( const MatrixBase m)
explicit

Construct a diagonal matrix from m. All non-diagonal elements are set to zero.

Member Function Documentation

◆ columns()

size_t theplu::yat::utility::DiagonalMatrix::columns ( void  ) const
Returns
number of columns

◆ operator()() [1/2]

const double theplu::yat::utility::DiagonalMatrix::operator() ( size_t  row,
size_t  col 
) const

access element at row row and column column

◆ operator()() [2/2]

double& theplu::yat::utility::DiagonalMatrix::operator() ( size_t  i)

access element at row i and column i

Elements outside diagnonal are only accessible as const

◆ operator*=()

DiagonalMatrix& theplu::yat::utility::DiagonalMatrix::operator*= ( const DiagonalMatrix rhs)

Multiplication and assign operator.

Same as doing *this = *this * rhs.

Since
New in yat 0.20

◆ operator+=()

DiagonalMatrix& theplu::yat::utility::DiagonalMatrix::operator+= ( const DiagonalMatrix rhs)

Add and assign operator.

Elementwise addition of the diagnonal elements.

Since
New in yat 0.20

◆ operator-=()

DiagonalMatrix& theplu::yat::utility::DiagonalMatrix::operator-= ( const DiagonalMatrix rhs)

Subtract and assign operator.

Elementwise addition of the diagnonal elements.

Since
New in yat 0.20

◆ rows()

size_t theplu::yat::utility::DiagonalMatrix::rows ( void  ) const
Returns
number of rows

Friends And Related Function Documentation

◆ operator*() [1/5]

DiagonalMatrix operator* ( const DiagonalMatrix lhs,
const DiagonalMatrix rhs 
)
related

Multiplication of two diagonal matrices

Diagonal elements are calculated as lhs(i,i) * rhs(i,i)

Since
new in yat 0.15

◆ operator*() [2/5]

template<class T >
expression::DiagonalMatrixMatrix< T > operator* ( const DiagonalMatrix lhs,
const BasicMatrix< T > &  rhs 
)
related

matrix matrix multiplication

Since
new in yat 0.15

◆ operator*() [3/5]

template<class T >
expression::MatrixDiagonalMatrix< T > operator* ( const BasicMatrix< T > &  lhs,
const DiagonalMatrix rhs 
)
related

matrix matrix multiplication

Since
new in yat 0.15

◆ operator*() [4/5]

template<class T >
expression::DiagonalMatrixVector< T > operator* ( const DiagonalMatrix lhs,
const BasicVector< T > &  rhs 
)
related

matrix vector multiplication

Since
new in yat 0.15

◆ operator*() [5/5]

template<class T >
expression::DiagonalMatrixVector< T > operator* ( const BasicVector< T > &  lhs,
const DiagonalMatrix rhs 
)
related

vector matrix multiplication

Since
new in yat 0.15

◆ operator+() [1/3]

DiagonalMatrix operator+ ( const DiagonalMatrix lhs,
const DiagonalMatrix rhs 
)
related

matrix matrix addition

Since
new in yat 0.15

◆ operator+() [2/3]

template<class T >
expression::DiagonalMatrix< DiagonalMatrix, BasicMatrix< T >, expression::Plus > operator+ ( const DiagonalMatrix lhs,
const BasicMatrix< T > &  rhs 
)
related

matrix matrix addition

Since
new in yat 0.15

◆ operator+() [3/3]

template<class T >
expression::DiagonalMatrix< BasicMatrix< T >, DiagonalMatrix, expression::Plus > operator+ ( const BasicMatrix< T > &  lhs,
const DiagonalMatrix rhs 
)
related

matrix matrix addition

Since
new in yat 0.15

◆ operator-() [1/3]

DiagonalMatrix operator- ( const DiagonalMatrix lhs,
const DiagonalMatrix rhs 
)
related

matrix matrix subtraction

Since
new in yat 0.15

◆ operator-() [2/3]

template<class T >
expression::DiagonalMatrix< DiagonalMatrix, BasicMatrix< T >, expression::Minus > operator- ( const DiagonalMatrix lhs,
const BasicMatrix< T > &  rhs 
)
related

matrix matrix subtraction

Since
new in yat 0.15

◆ operator-() [3/3]

template<class T >
expression::DiagonalMatrix< BasicMatrix< T >, DiagonalMatrix, expression::Minus > operator- ( const BasicMatrix< T > &  lhs,
const DiagonalMatrix rhs 
)
related

matrix matrix subtraction

Since
new in yat 0.15

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

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14