I am having great trouble getting results from the mincgresults() function. The code is as follows:
Code:
   alglib::real_1d_array lambdaJout;
   lambdaJout.setlength(lenJ);
   for (int i = 0; i < lenJ; i++) {
      lambdaJout[i] = 0.0;
   }
   
   alglib::mincgcreatef(lambdaJguess, diffstep, cgstate);
   alglib::mincgsetcond(cgstate, epsg, epsf, epsx, maxits);
   alglib::mincgsetscale(cgstate, lambdascale);
   alglib::mincgsetprecscale(cgstate);
   alglib:mincgoptimize(cgstate, CG_opt, NULL, ptr);
   mincgresults(cgstate, lambdaJout, cgrep);
   printf("cg rep termination = %i\n", int(cgrep.terminationtype));
   
   FILE* lambdaoptout = fopen("lambdaopt.txt", "w");
   for (int i = 0; i < lenJ; i++) {
      fprintf(lambdaoptout, "%i %e\n", i, lambdaJout[i]);
   }
   fclose(lambdaoptout);
It seems that no matter what I try to do with mincgresults, I cannot get anything but zeros in the print statement. 
The code runs, and the cg rep termination result is 1, but lambdaJout never seems to change. I can post more of the code if needed, and would very much appreciate an help people can offer.
Thanks.