/* * Test_Sparse_jac.cpp * * Created on: May 17, 2013 * Author: ad007804 */ /*---------------------------------------------------------------------------- ADOL-C -- Automatic Differentiation by Overloading in C++ File: sparse_jacobian.cpp Revision: $Id: sparse_jacobian.cpp 299 2012-03-21 16:08:40Z kulshres $ Contents: example for computation of sparse jacobians Copyright (c) Andrea Walther, Andreas Griewank, Andreas Kowarz, Hristo Mitev, Sebastian Schlenkrich, Jean Utke, Olaf Vogel This file is part of ADOL-C. This software is provided as open source. Any use, reproduction, or distribution of the software constitutes recipient's acceptance of the terms of the accompanying license file. ---------------------------------------------------------------------------*/ #include #include #include #include #include #include "sys/types.h" #include "sys/sysinfo.h" #define tag 1 void ceval_ad(adouble *x, adouble *c); void ceval(double *x, double *c); #define m 10000 int main() { adouble factive[m]; double f[m]; double xpassive[m]; adouble xactive[m]; adouble a[m], b[m]; for (int q=0;q>=f[q]; trace_off(); double **Jac; Jac = myalloc2(m,m); jacobian(0,m,m,xpassive,Jac); //Check RAM usage struct sysinfo memInfo; sysinfo (&memInfo); long long physMemUsed = memInfo.totalram - memInfo.freeram; physMemUsed *= memInfo.mem_unit; std::cout<<"physMemUsed: "<< physMemUsed<