mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix bug #314:
- remove most of the metaprogramming kung fu in MathFunctions.h (only keep functions that differs from the std) - remove the overloads for array expression that were in the std namespace
This commit is contained in:
@@ -210,6 +210,7 @@ bool companion<_Scalar,_Deg>::balancedR( Scalar colNorm, Scalar rowNorm,
|
||||
template< typename _Scalar, int _Deg >
|
||||
void companion<_Scalar,_Deg>::balance()
|
||||
{
|
||||
using std::abs;
|
||||
EIGEN_STATIC_ASSERT( Deg == Dynamic || 1 < Deg, YOU_MADE_A_PROGRAMMING_MISTAKE );
|
||||
const Index deg = m_monic.size();
|
||||
const Index deg_1 = deg-1;
|
||||
|
||||
@@ -69,10 +69,11 @@ class PolynomialSolverBase
|
||||
inline void realRoots( Stl_back_insertion_sequence& bi_seq,
|
||||
const RealScalar& absImaginaryThreshold = NumTraits<Scalar>::dummy_precision() ) const
|
||||
{
|
||||
using std::abs;
|
||||
bi_seq.clear();
|
||||
for(Index i=0; i<m_roots.size(); ++i )
|
||||
{
|
||||
if( internal::abs( m_roots[i].imag() ) < absImaginaryThreshold ){
|
||||
if( abs( m_roots[i].imag() ) < absImaginaryThreshold ){
|
||||
bi_seq.push_back( m_roots[i].real() ); }
|
||||
}
|
||||
}
|
||||
@@ -118,13 +119,14 @@ class PolynomialSolverBase
|
||||
bool& hasArealRoot,
|
||||
const RealScalar& absImaginaryThreshold = NumTraits<Scalar>::dummy_precision() ) const
|
||||
{
|
||||
using std::abs;
|
||||
hasArealRoot = false;
|
||||
Index res=0;
|
||||
RealScalar abs2(0);
|
||||
|
||||
for( Index i=0; i<m_roots.size(); ++i )
|
||||
{
|
||||
if( internal::abs( m_roots[i].imag() ) < absImaginaryThreshold )
|
||||
if( abs( m_roots[i].imag() ) < absImaginaryThreshold )
|
||||
{
|
||||
if( !hasArealRoot )
|
||||
{
|
||||
@@ -144,7 +146,7 @@ class PolynomialSolverBase
|
||||
}
|
||||
else
|
||||
{
|
||||
if( internal::abs( m_roots[i].imag() ) < internal::abs( m_roots[res].imag() ) ){
|
||||
if( abs( m_roots[i].imag() ) < abs( m_roots[res].imag() ) ){
|
||||
res = i; }
|
||||
}
|
||||
}
|
||||
@@ -158,13 +160,14 @@ class PolynomialSolverBase
|
||||
bool& hasArealRoot,
|
||||
const RealScalar& absImaginaryThreshold = NumTraits<Scalar>::dummy_precision() ) const
|
||||
{
|
||||
using std::abs;
|
||||
hasArealRoot = false;
|
||||
Index res=0;
|
||||
RealScalar val(0);
|
||||
|
||||
for( Index i=0; i<m_roots.size(); ++i )
|
||||
{
|
||||
if( internal::abs( m_roots[i].imag() ) < absImaginaryThreshold )
|
||||
if( abs( m_roots[i].imag() ) < absImaginaryThreshold )
|
||||
{
|
||||
if( !hasArealRoot )
|
||||
{
|
||||
@@ -184,7 +187,7 @@ class PolynomialSolverBase
|
||||
}
|
||||
else
|
||||
{
|
||||
if( internal::abs( m_roots[i].imag() ) < internal::abs( m_roots[res].imag() ) ){
|
||||
if( abs( m_roots[i].imag() ) < abs( m_roots[res].imag() ) ){
|
||||
res = i; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ template <typename Polynomial>
|
||||
inline
|
||||
typename NumTraits<typename Polynomial::Scalar>::Real cauchy_max_bound( const Polynomial& poly )
|
||||
{
|
||||
using std::abs;
|
||||
typedef typename Polynomial::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real Real;
|
||||
|
||||
@@ -82,7 +83,7 @@ typename NumTraits<typename Polynomial::Scalar>::Real cauchy_max_bound( const Po
|
||||
Real cb(0);
|
||||
|
||||
for( DenseIndex i=0; i<poly.size()-1; ++i ){
|
||||
cb += internal::abs(poly[i]*inv_leading_coeff); }
|
||||
cb += abs(poly[i]*inv_leading_coeff); }
|
||||
return cb + Real(1);
|
||||
}
|
||||
|
||||
@@ -96,6 +97,7 @@ template <typename Polynomial>
|
||||
inline
|
||||
typename NumTraits<typename Polynomial::Scalar>::Real cauchy_min_bound( const Polynomial& poly )
|
||||
{
|
||||
using std::abs;
|
||||
typedef typename Polynomial::Scalar Scalar;
|
||||
typedef typename NumTraits<Scalar>::Real Real;
|
||||
|
||||
@@ -107,7 +109,7 @@ typename NumTraits<typename Polynomial::Scalar>::Real cauchy_min_bound( const Po
|
||||
const Scalar inv_min_coeff = Scalar(1)/poly[i];
|
||||
Real cb(1);
|
||||
for( DenseIndex j=i+1; j<poly.size(); ++j ){
|
||||
cb += internal::abs(poly[j]*inv_min_coeff); }
|
||||
cb += abs(poly[j]*inv_min_coeff); }
|
||||
return Real(1)/cb;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user