You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks for developing this great tool! I'm new to CppADCodeGen, I'd like to ask is there any way to get the value of a scalar type CppAD::AD<CppAD::cg::CG<double>> (or convert this type to the double type). I know in CppAD this is possible by using CppAD::Value() of Var2Par() function, but I don't know how to do that in CppADCodeGen. Would you please give me any advice? Thanks a lot!
The text was updated successfully, but these errors were encountered:
It is possible to CppAD::Value() and Var2Par() to retrieve the CG<double> and then CG<double>::getValue() to retrive the value (which can throw an exception if the value is not defined).
For instance:
CppAD::vector<ADCG> x(2);
x[0] = 2.; // values must be defined!
x[1] = 3.; // values must be defined!Independent(x);
ADCG a = x[0] / 1. + x[1] * x[1];
ADCG b = a / 2e-6;
std::cout << CppAD::Value(CppAD::Var2Par(b)).getValue() << std::endl;
Hi,
First of all, thanks for developing this great tool! I'm new to CppADCodeGen, I'd like to ask is there any way to get the value of a scalar type
CppAD::AD<CppAD::cg::CG<double>>
(or convert this type to the double type). I know in CppAD this is possible by usingCppAD::Value()
ofVar2Par()
function, but I don't know how to do that in CppADCodeGen. Would you please give me any advice? Thanks a lot!The text was updated successfully, but these errors were encountered: