mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-26 00:03:14 +08:00
remove use of GSL in polynomialsolver unit test
This commit is contained in:
parent
51410975ac
commit
a3ddb14426
@ -79,20 +79,7 @@ else()
|
|||||||
ei_add_property(EIGEN_MISSING_BACKENDS "OpenGL, ")
|
ei_add_property(EIGEN_MISSING_BACKENDS "OpenGL, ")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(GSL)
|
ei_add_test(polynomialsolver)
|
||||||
if(GSL_FOUND AND GSL_VERSION_MINOR LESS 9)
|
|
||||||
set(GSL_FOUND "")
|
|
||||||
endif(GSL_FOUND AND GSL_VERSION_MINOR LESS 9)
|
|
||||||
if(GSL_FOUND)
|
|
||||||
add_definitions("-DHAS_GSL" ${GSL_DEFINITIONS})
|
|
||||||
include_directories(${GSL_INCLUDE_DIR})
|
|
||||||
ei_add_property(EIGEN_TESTED_BACKENDS "GSL, ")
|
|
||||||
else(GSL_FOUND)
|
|
||||||
ei_add_property(EIGEN_MISSING_BACKENDS "GSL, ")
|
|
||||||
set(GSL_LIBRARIES " ")
|
|
||||||
endif(GSL_FOUND)
|
|
||||||
|
|
||||||
ei_add_test(polynomialsolver " " "${GSL_LIBRARIES}" )
|
|
||||||
ei_add_test(polynomialutils)
|
ei_add_test(polynomialutils)
|
||||||
ei_add_test(kronecker_product)
|
ei_add_test(kronecker_product)
|
||||||
ei_add_test(splines)
|
ei_add_test(splines)
|
||||||
|
@ -27,10 +27,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#ifdef HAS_GSL
|
|
||||||
#include "gsl_helper.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace Eigen {
|
namespace Eigen {
|
||||||
@ -73,32 +69,6 @@ bool aux_evalSolver( const POLYNOMIAL& pols, SOLVER& psolve )
|
|||||||
cerr << endl;
|
cerr << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_GSL
|
|
||||||
if (internal::is_same< Scalar, double>::value)
|
|
||||||
{
|
|
||||||
typedef GslTraits<Scalar> Gsl;
|
|
||||||
RootsType gslRoots(deg);
|
|
||||||
Gsl::eigen_poly_solve( pols, gslRoots );
|
|
||||||
EvalRootsType gslEvr( deg );
|
|
||||||
for( int i=0; i<gslRoots.size(); ++i )
|
|
||||||
{
|
|
||||||
gslEvr[i] = std::abs( poly_eval( pols, gslRoots[i] ) );
|
|
||||||
}
|
|
||||||
bool gslEvalToZero = gslEvr.isZero( test_precision<Scalar>() );
|
|
||||||
if( !evalToZero )
|
|
||||||
{
|
|
||||||
if( !gslEvalToZero ){
|
|
||||||
cerr << "GSL also failed" << endl; }
|
|
||||||
else{
|
|
||||||
cerr << "GSL did NOT failed" << endl; }
|
|
||||||
cerr << "GSL roots found: " << gslRoots.transpose() << endl;
|
|
||||||
cerr << "Abs value of the polynomial at the GSL roots: " << gslEvr.transpose() << endl;
|
|
||||||
cerr << endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif //< HAS_GSL
|
|
||||||
|
|
||||||
|
|
||||||
std::vector<Scalar> rootModuli( roots.size() );
|
std::vector<Scalar> rootModuli( roots.size() );
|
||||||
Map< EvalRootsType > aux( &rootModuli[0], roots.size() );
|
Map< EvalRootsType > aux( &rootModuli[0], roots.size() );
|
||||||
aux = roots.array().abs();
|
aux = roots.array().abs();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user