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