Using this minimal example:
#include <cppad/cppad.hpp>
#include <iostream>
#include <vector>
int main()
{
using CppAD::AD;
const size_t nx = 3, ny = 1;
CppAD::vector<AD<double>> ax(nx);
std::cout << "Recording f(x0, x1, x2) = atan2(x1+x2, x0) ..." << std::endl;
CppAD::Independent(ax);
CppAD::vector<AD<double>> ay(ny);
ay[0] = CppAD::atan2(ax[1] + ax[2], ax[0]); // atan2(y=x1+x2, x=x0)
CppAD::ADFun<double> fun(ax, ay);
std::cout << "Recorded f(x0, x1, x2) = atan2(x1+x2, x0)." << std::endl;
return 0;
}
compiling it in debug mode I have the following error:
Recording f(x0, x1, x2) = atan2(x1+x2, x0) ...
cppad-20260103 error from a known source:
A dependent variable value is not equal to its tape evaluation value,
perhaps it is nan.
Dependent variable value = -nan
Tape evaluation value = -nan
Difference = -nan
Error detected by false result for
0
at line 528 in the file
/usr/local/include/cppad/core/fun_construct.hpp
mwe_debug: /usr/local/include/cppad/utility/error_handler.hpp:204: static void CppAD::ErrorHandler::Default(bool, int, const char*, const char*, const char*): Assertion `false' failed.
Aborted (core dumped)
But I don't know how to avoid it ?
Using this minimal example:
compiling it in debug mode I have the following error:
But I don't know how to avoid it ?