Fix bugs reported by Timothy Hunter:

* CholeskyWithoutSqrt with 1x1 matrices
 * .part<Diagonal>()
Updated unit tests to handle these cases
This commit is contained in:
Gael Guennebaud
2008-09-03 20:52:26 +00:00
parent e14aa8c8aa
commit c29c7b0ea9
4 changed files with 9 additions and 2 deletions

View File

@@ -88,7 +88,7 @@ template<typename MatrixType, unsigned int Mode> class Part
inline Scalar coeff(int row, int col) const
{
if(Flags & LowerTriangularBit ? col>row : row>col)
if( (Flags & LowerTriangularBit) && (col>row) || (Flags & UpperTriangularBit) && (row>col) )
return (Flags & SelfAdjointBit) ? ei_conj(m_matrix.coeff(col, row)) : (Scalar)0;
if(Flags & UnitDiagBit)
return col==row ? (Scalar)1 : m_matrix.coeff(row, col);