Cast diagonalSize() to Scalar before multiplication. Without this, automatic differentiation in Ceres breaks because Scalar is a custom type that does not support multiplication by Index.

This commit is contained in:
Rasmus Munk Larsen 2018-08-09 11:09:10 -07:00
parent 131ed1191f
commit 8603d80029

View File

@ -320,7 +320,7 @@ template<typename _MatrixType> class FullPivLU
return m_usePrescribedThreshold ? m_prescribedThreshold
// this formula comes from experimenting (see "LU precision tuning" thread on the list)
// and turns out to be identical to Higham's formula used already in LDLt.
: NumTraits<Scalar>::epsilon() * m_lu.diagonalSize();
: NumTraits<Scalar>::epsilon() * Scalar(m_lu.diagonalSize());
}
/** \returns the rank of the matrix of which *this is the LU decomposition.