mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-17 03:43:13 +08:00
fix under- and overflow
This commit is contained in:
parent
9ce08b352f
commit
ea99880760
@ -400,7 +400,9 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
|
||||
RealVectorType& diag = m_eivalues;
|
||||
MatrixType& mat = m_eivec;
|
||||
|
||||
mat = matrix;
|
||||
// map the matrix coefficients to [-1:1] to avoid over- and underflow.
|
||||
RealScalar scale = matrix.cwiseAbs().maxCoeff();
|
||||
mat = matrix / scale;
|
||||
m_subdiag.resize(n-1);
|
||||
internal::tridiagonalization_inplace(mat, diag, m_subdiag, computeEigenvectors);
|
||||
|
||||
@ -457,6 +459,9 @@ SelfAdjointEigenSolver<MatrixType>& SelfAdjointEigenSolver<MatrixType>
|
||||
}
|
||||
}
|
||||
|
||||
// scale back the eigen values
|
||||
m_eivalues *= scale;
|
||||
|
||||
m_isInitialized = true;
|
||||
m_eigenvectorsOk = computeEigenvectors;
|
||||
return *this;
|
||||
|
Loading…
x
Reference in New Issue
Block a user