mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
update adolc support wrt "new" NumTraits mechanism
This commit is contained in:
@@ -23,11 +23,20 @@
|
||||
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "main.h"
|
||||
#include <Eigen/Dense>
|
||||
|
||||
#define NUMBER_DIRECTIONS 16
|
||||
#include <unsupported/Eigen/AdolcForward>
|
||||
|
||||
int adtl::ADOLC_numDir;
|
||||
|
||||
template<typename Vector>
|
||||
EIGEN_DONT_INLINE typename Vector::Scalar foo(const Vector& p)
|
||||
{
|
||||
typedef typename Vector::Scalar Scalar;
|
||||
return (p-Vector(Scalar(-1),Scalar(1.))).norm() + (p.array().sqrt().abs() * p.array().sin()).sum() + p.dot(p);
|
||||
}
|
||||
|
||||
template<typename _Scalar, int NX=Dynamic, int NY=Dynamic>
|
||||
struct TestFunc1
|
||||
{
|
||||
@@ -138,4 +147,12 @@ void test_forward_adolc()
|
||||
CALL_SUBTEST(( adolc_forward_jacobian(TestFunc1<double,3,3>()) ));
|
||||
CALL_SUBTEST(( adolc_forward_jacobian(TestFunc1<double>(3,3)) ));
|
||||
}
|
||||
|
||||
{
|
||||
// simple instanciation tests
|
||||
Matrix<adtl::adouble,2,1> x;
|
||||
foo(x);
|
||||
Matrix<adtl::adouble,Dynamic,Dynamic> A(4,4);;
|
||||
A.selfadjointView<Lower>().eigenvalues();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user