From e2f3e4e4aaabb186cf6023d9e30b8b1879e2e60d Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 1 Dec 2014 14:45:15 +0100 Subject: [PATCH] Document non-const SparseMatrix::diagonal() method. --- Eigen/src/SparseCore/SparseMatrix.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Eigen/src/SparseCore/SparseMatrix.h b/Eigen/src/SparseCore/SparseMatrix.h index b0bd8638e..4c79c7dc3 100644 --- a/Eigen/src/SparseCore/SparseMatrix.h +++ b/Eigen/src/SparseCore/SparseMatrix.h @@ -633,8 +633,13 @@ class SparseMatrix m_data.resize(size); } - /** \returns a const expression of the diagonal coefficients */ + /** \returns a const expression of the diagonal coefficients. */ const ConstDiagonalReturnType diagonal() const { return ConstDiagonalReturnType(*this); } + + /** \returns a read-write expression of the diagonal coefficients. + * \warning If the diagonal entries are written, then all diagonal + * entries \b must already exist, otherwise an assertion will be raised. + */ DiagonalReturnType diagonal() { return DiagonalReturnType(*this); } /** Default constructor yielding an empty \c 0 \c x \c 0 matrix */