Enable visitor on empty matrices (the visitor is left unchanged), and protect min/maxCoeff(Index*,Index*) on empty matrices by an assertion (+ doc & unit tests)

This commit is contained in:
Gael Guennebaud
2019-01-15 15:21:14 +01:00
parent 027e44ed24
commit 6ec6bf0b0d
3 changed files with 42 additions and 0 deletions

View File

@@ -23,6 +23,11 @@ template<typename MatrixType> void zeroReduction(const MatrixType& m) {
VERIFY(!m.hasNaN());
VERIFY_RAISES_ASSERT( m.minCoeff() );
VERIFY_RAISES_ASSERT( m.maxCoeff() );
Index i,j;
VERIFY_RAISES_ASSERT( m.minCoeff(&i,&j) );
VERIFY_RAISES_ASSERT( m.maxCoeff(&i,&j) );
VERIFY_RAISES_ASSERT( m.reshaped().minCoeff(&i) );
VERIFY_RAISES_ASSERT( m.reshaped().maxCoeff(&i) );
}