[CppAD] Using eigenvalues from Eigen in CppAD with Ipopt
Jyotiranjan Beuria
jyotiranjan.beuria at gmail.com
Sun May 21 08:40:48 EDT 2017
Dear All,
I am trying to use CppAD along with Ipopt. However, my function
depends on eigenvalues and for that I am trying to use Eigen.
A snippet of the code for a simple case is as follows:
* AD<double> x1 = x[0]; MatrixXd m(2,2);
m(0,0)=x1*x1; m(0,1)= x1; m(1,0)= 1.0; m(1,1)=
x1+x1*x1-1.0; EigenSolver<MatrixXd> es(m); AD<double>
y=es.eigenvalues(); // f(x) fg[0] = y[0]+y[1]; *
I get following error.
*error: cannot convert ‘CppAD::AD<double>’ to
‘Eigen::DenseCoeffsBase<Eigen:*
*:Matrix<double, -1, -1>, 1>::Scalar {aka double}’ in
assignmentmyTest.cpp:31:36: error: conversion from ‘const EigenvalueType
{aka const Eigen::Matrix<std::complex<double>, -1, 1>}’ to non-scalar type
‘CppAD::AD<double>’ requested AD<double>
y=es.eigenvalues(); ^myTest.cpp:33:15:
error: no match for call to ‘(CppAD::AD<double>) (int)’ fg[0] =
y(0)+y(1);*
Can anyone help?
Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/cppad/attachments/20170521/82acf867/attachment.html>
More information about the CppAD
mailing list