mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-04 17:54:07 +08:00
Fix unwanted Real to Scalar to Real conversions in column-pivoting QR.
This commit is contained in:
parent
0f83aeb6b2
commit
f75dfdda7e
@ -505,8 +505,8 @@ void ColPivHouseholderQR<MatrixType>::computeInPlace()
|
|||||||
m_colNormsUpdated.coeffRef(k) = m_colNormsDirect.coeffRef(k);
|
m_colNormsUpdated.coeffRef(k) = m_colNormsDirect.coeffRef(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
RealScalar threshold_helper = numext::abs2<Scalar>(m_colNormsUpdated.maxCoeff() * NumTraits<Scalar>::epsilon()) / RealScalar(rows);
|
RealScalar threshold_helper = numext::abs2<RealScalar>(m_colNormsUpdated.maxCoeff() * NumTraits<RealScalar>::epsilon()) / RealScalar(rows);
|
||||||
RealScalar norm_downdate_threshold = numext::sqrt(NumTraits<Scalar>::epsilon());
|
RealScalar norm_downdate_threshold = numext::sqrt(NumTraits<RealScalar>::epsilon());
|
||||||
|
|
||||||
m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case)
|
m_nonzero_pivots = size; // the generic case is that in which all pivots are nonzero (invertible case)
|
||||||
m_maxpivot = RealScalar(0);
|
m_maxpivot = RealScalar(0);
|
||||||
@ -556,8 +556,8 @@ void ColPivHouseholderQR<MatrixType>::computeInPlace()
|
|||||||
RealScalar temp = abs(m_qr.coeffRef(k, j)) / m_colNormsUpdated.coeffRef(j);
|
RealScalar temp = abs(m_qr.coeffRef(k, j)) / m_colNormsUpdated.coeffRef(j);
|
||||||
temp = (RealScalar(1) + temp) * (RealScalar(1) - temp);
|
temp = (RealScalar(1) + temp) * (RealScalar(1) - temp);
|
||||||
temp = temp < 0 ? 0 : temp;
|
temp = temp < 0 ? 0 : temp;
|
||||||
RealScalar temp2 = temp * numext::abs2<Scalar>(m_colNormsUpdated.coeffRef(j) /
|
RealScalar temp2 = temp * numext::abs2<RealScalar>(m_colNormsUpdated.coeffRef(j) /
|
||||||
m_colNormsDirect.coeffRef(j));
|
m_colNormsDirect.coeffRef(j));
|
||||||
if (temp2 <= norm_downdate_threshold) {
|
if (temp2 <= norm_downdate_threshold) {
|
||||||
// The updated norm has become too inaccurate so re-compute the column
|
// The updated norm has become too inaccurate so re-compute the column
|
||||||
// norm directly.
|
// norm directly.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user