Function Dune::XT::LA::eye_matrix

Function template Dune::XT::LA::eye_matrix

template<class MatrixType>
typename std::enable_if<Common::is_matrix<MatrixType>::value && !is_matrix<MatrixType>::value, MatrixType>::type Dune::XT::LA::eye_matrix(const size_t rows, const size_t cols, const SparsityPatternDefault& = SparsityPatternDefault())

Creates a rows x cols identity matrix for a generic (non-LA) matrix type.

Function template Dune::XT::LA::eye_matrix

template<class MatrixType>
typename std::enable_if<Common::is_matrix<MatrixType>::value, MatrixType>::type Dune::XT::LA::eye_matrix(const size_t size, const SparsityPatternDefault &pattern = SparsityPatternDefault())

Creates a square size x size identity matrix of the given matrix type.

Function template Dune::XT::LA::eye_matrix

template<class MatrixType>
typename std::enable_if<Common::is_matrix<MatrixType>::value, void>::type Dune::XT::LA::eye_matrix(MatrixType &matrix)

Overwrites the given matrix with the identity (zeros off-diagonal, ones on the diagonal).

Function template Dune::XT::LA::eye_matrix

template<class MatrixType>
typename std::enable_if<is_matrix<MatrixType>::value, MatrixType>::type Dune::XT::LA::eye_matrix(const size_t rows, const size_t cols, const SparsityPatternDefault &pattern = SparsityPatternDefault())

Creates a rows x cols identity matrix of the given LA matrix type (optionally with a sparsity pattern).