#include "header.h" //Prototype for internal computation void fA_part(float *xp, float *Fp, int i); //Optimization function //computes f(x) and returns values //in Fp int fA(Vector x, float *Fp, int spec){ int i, n = x.n; float FTemp=0.0; float *fp=x.fp; static int c=0; *Fp = 0.0; if(spec==1){return c;} c++; for(i=1; i<=n-2; i++){ fA_part(fp, &FTemp,i); *Fp += FTemp; } return 0; } void fA_part(float *xp, float *Fp, int i){ float InnerArg; InnerArg = xp[i]*xp[i+1]+cos(xp[i-1]-xp[i]); *Fp = sin(InnerArg); }