- 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:
Gael Guennebaud
2012-11-06 15:25:50 +01:00
parent 959ef37006
commit a76fbbf397
88 changed files with 496 additions and 468 deletions

View File

@@ -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;

View File

@@ -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; }
}
}

View File

@@ -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;
}