mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
bug #701: workaround (min) and (max) blocking ADL by introducing numext::mini and numext::maxi internal functions and a EIGEN_NOT_A_MACRO macro.
This commit is contained in:
@@ -368,7 +368,6 @@ EigenSolver<MatrixType>::compute(const MatrixType& matrix, bool computeEigenvect
|
||||
{
|
||||
using std::sqrt;
|
||||
using std::abs;
|
||||
using std::max;
|
||||
using numext::isfinite;
|
||||
eigen_assert(matrix.cols() == matrix.rows());
|
||||
|
||||
@@ -409,7 +408,7 @@ EigenSolver<MatrixType>::compute(const MatrixType& matrix, bool computeEigenvect
|
||||
{
|
||||
Scalar t0 = m_matT.coeff(i+1, i);
|
||||
Scalar t1 = m_matT.coeff(i, i+1);
|
||||
Scalar maxval = (max)(abs(p),(max)(abs(t0),abs(t1)));
|
||||
Scalar maxval = numext::maxi(abs(p),numext::maxi(abs(t0),abs(t1)));
|
||||
t0 /= maxval;
|
||||
t1 /= maxval;
|
||||
Scalar p0 = p/maxval;
|
||||
@@ -600,8 +599,7 @@ void EigenSolver<MatrixType>::doComputeEigenvectors()
|
||||
}
|
||||
|
||||
// Overflow control
|
||||
EIGEN_USING_STD_MATH(max);
|
||||
Scalar t = (max)(abs(m_matT.coeff(i,n-1)),abs(m_matT.coeff(i,n)));
|
||||
Scalar t = numext::maxi(abs(m_matT.coeff(i,n-1)),abs(m_matT.coeff(i,n)));
|
||||
if ((eps * t) * t > Scalar(1))
|
||||
m_matT.block(i, n-1, size-i, 2) /= t;
|
||||
|
||||
|
||||
@@ -732,7 +732,6 @@ struct direct_selfadjoint_eigenvalues<SolverType,2,false>
|
||||
EIGEN_DEVICE_FUNC
|
||||
static inline void run(SolverType& solver, const MatrixType& mat, int options)
|
||||
{
|
||||
EIGEN_USING_STD_MATH(max)
|
||||
EIGEN_USING_STD_MATH(sqrt);
|
||||
|
||||
eigen_assert(mat.cols() == 2 && mat.cols() == mat.rows());
|
||||
@@ -746,7 +745,7 @@ struct direct_selfadjoint_eigenvalues<SolverType,2,false>
|
||||
|
||||
// map the matrix coefficients to [-1:1] to avoid over- and underflow.
|
||||
Scalar scale = mat.cwiseAbs().maxCoeff();
|
||||
scale = (max)(scale,Scalar(1));
|
||||
scale = numext::maxi(scale,Scalar(1));
|
||||
MatrixType scaledMat = mat / scale;
|
||||
|
||||
// Compute the eigenvalues
|
||||
|
||||
Reference in New Issue
Block a user