#include #include using namespace std; int main(int argv, char* argc[]); adouble func(adouble* X); adouble func(adouble* X) { //Comment out the line below to remove the error adouble op_on_passive = X[2] * X[2]; adouble op_on_active = X[1] * X[1]; return op_on_active; } int main(int argv, char* argc[]) { double seed[] = {1, 2, 3, 4}; double result = 0; adouble out = 0; adouble X[4]; X[0] = seed[0]; X[1] = seed[1]; X[2] = seed[2]; X[3] = seed[3]; trace_on(1); X[0] <<= X[0].value(); X[1] <<= X[1].value(); out = func(X); out >>= result; trace_off(); int nnz = 0; unsigned int* rind = NULL; unsigned int* cind = NULL; double* values = NULL; int optionsJac[] = {0, 0, 0, 0}; int optionsHes[] = {0, 0}; sparse_jac(1, 1, 2, 0, seed, &nnz, &rind, &cind, &values, optionsJac); cout << "Jacobian:" << endl; for(int n=0; n