<div dir="ltr"><div><div><div><div>Dear All,<br><br></div>I am trying to use CppAD along with Ipopt. However, my function<br></div>depends on eigenvalues and for that I am trying to use Eigen.<br><br>A snippet of the code for a simple case is as follows:<br><br><b><span style="font-family:monospace,monospace">          AD<double> x1 = x[0];  <br>          MatrixXd m(2,2);<br>          m(0,0)=x1*x1;<br>          m(0,1)= x1;<br>          m(1,0)= 1.0;<br>          m(1,1)= x1+x1*x1-1.0;<br>          EigenSolver<MatrixXd> es(m);<br>          AD<double> y=es.eigenvalues();<br>          // f(x)<br>          fg[0] = y[0]+y[1];  </span></b><br><br></div>I get following error.<br><b><span style="font-family:monospace,monospace"><br>error: cannot convert ‘CppAD::AD<double>’ to ‘Eigen::DenseCoeffsBase<Eigen:</span></b><wbr><b><span style="font-family:monospace,monospace">:Matrix<double, -1, -1>, 1>::Scalar {aka double}’ in assignment<br><br>myTest.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<br>       AD<double>  y=es.eigenvalues();<br>                                    ^<br>myTest.cpp:33:15: error: no match for call to ‘(CppAD::AD<double>) (int)’<br>    fg[0] = y(0)+y(1);<br><br><br></span></b></div><div><span style="font-family:monospace,monospace"><font face="arial,helvetica,sans-serif">Can anyone help?<br><br></font></span></div><div><span style="font-family:monospace,monospace"><font face="arial,helvetica,sans-serif">Regards,<br></font></span></div><b><span style="font-family:monospace,monospace"></span></b></div>