}
for (i=0;i<n;i++) xold[i]=x[i];
fold=f.val;
for (i=0;i<n;i++) p[i] = -fvec[i];
LUdcmp alu = new LUdcmp(fjac);
alu.solve(p,p);
lnsrch(xold,fold,g,p,x,f,stpmax,check,fmin);
test=0.0;
for (i=0;i<n;i++)
if (abs(fvec[i]) > test) test=abs(fvec[i]);
if (test < TOLF) {