Function Dune::XT::LA::eye_matrix

template<class MatrixType>
int Dune::XT::LA::eye_matrix(MatrixType &matrix)

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

template<class MatrixType>
int 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).

template<class MatrixType>
int 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.