mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-02 18:20:38 +08:00
Fix precision regression when attempting to fix underflow issues.
(transplanted from af824091be78c82212cef4b2fb085a083fbebc5e )
This commit is contained in:
parent
1914024965
commit
e2886d34ef
@ -743,7 +743,16 @@ static void tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index sta
|
|||||||
// RealScalar e2 = abs2(subdiag[end-1]);
|
// RealScalar e2 = abs2(subdiag[end-1]);
|
||||||
// RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2));
|
// RealScalar mu = diag[end] - e2 / (td + (td>0 ? 1 : -1) * sqrt(td*td + e2));
|
||||||
// This explain the following, somewhat more complicated, version:
|
// This explain the following, somewhat more complicated, version:
|
||||||
RealScalar mu = diag[end] - (e / (td + (td>0 ? 1 : -1))) * (e / hypot(td,e));
|
RealScalar mu = diag[end];
|
||||||
|
if(td==0)
|
||||||
|
mu -= abs(e);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RealScalar e2 = abs2(subdiag[end-1]);
|
||||||
|
RealScalar h = hypot(td,e);
|
||||||
|
if(e2==0) mu -= (e / (td + (td>0 ? 1 : -1))) * (e / h);
|
||||||
|
else mu -= e2 / (td + (td>0 ? h : -h));
|
||||||
|
}
|
||||||
|
|
||||||
RealScalar x = diag[start] - mu;
|
RealScalar x = diag[start] - mu;
|
||||||
RealScalar z = subdiag[start];
|
RealScalar z = subdiag[start];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user