Index: /issm/trunk-jpl/src/c/cores/controlm1qn3_core.cpp
===================================================================
--- /issm/trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17896)
+++ /issm/trunk-jpl/src/c/cores/controlm1qn3_core.cpp	(revision 17897)
@@ -48,9 +48,5 @@
 	long      indic        = 4;         /*compute f and g*/
 	long      reverse      = 0;         /*reverse or direct mode*/
-	long      ndz          = 20000;     /*Dimension of the working area*/
-	double    dz[20000];                /*Working array*/
 	long      iz[5];                    /*Integer m1qn3 working array of size 5*/
-	long      niter        = 200;       /*Maximum number of iterations*/
-	long      nsim         = 200;       /*Maximum number of function calls*/
 	long      io           = 6;         /*Channel number for the output*/
 
@@ -58,4 +54,6 @@
 	double    dxmin        = 1.e-10;    /*Resolution for the solution x*/
 	double    epsrel       = 1.e-5;     /*Gradient stopping criterion in ]0 1[ -> |gk|/|g1| < epsrel*/
+	long      niter        = 200;       /*Maximum number of iterations*/
+	long      nsim         = 200;       /*Maximum number of function calls*/
 
 	/*Get problem dimension and initialize gradient and initial guess*/
@@ -65,4 +63,9 @@
 	for(int i=0;i<n;i++) x[i]=5.;
 	dzs[0] = 10; //c = 10 function parameter
+
+	/*Allocate m1qn3 working arrays (see doc)*/
+	long      m   = 100;
+	long      ndz = 4*n+m*(2*n+1);
+	double*   dz  = xNew<double>(ndz);
 
 	if(VerboseControl())_printf0_("   Computing initial solution\n");
@@ -76,13 +79,13 @@
 
 	switch(int(omode)){
-		case 0:  _printf0_("Stop requiered \n"); break;
-		case 1:  _printf0_("Stop on epsg (gradient too small)\n"); break;
-		case 2:  _printf0_("Bad initialization\n"); break;
-		case 3:  _printf0_("Line search failure\n"); break;
-		case 4:  _printf0_("Maximum number of iterations exceeded\n");break;
-		case 5:  _printf0_("Maximum number of function calls exceeded\n"); break;
-		case 6:  _printf0_("stoped on dxmin during line search\n"); break;
-		case 7:  _printf0_("<g,d> > 0  or  <y,s> <0\n"); break;
-		default: _printf0_("Unknown end condition\n");
+		case 0:  _printf0_("   Stop requested (indic = 0)\n"); break;
+		case 1:  _printf0_("   Convergence reached (gradient satisfies stopping criterion)\n"); break;
+		case 2:  _printf0_("   Bad initialization\n"); break;
+		case 3:  _printf0_("   Line search failure\n"); break;
+		case 4:  _printf0_("   Maximum number of iterations exceeded\n");break;
+		case 5:  _printf0_("   Maximum number of function calls exceeded\n"); break;
+		case 6:  _printf0_("   stopped on dxmin during line search\n"); break;
+		case 7:  _printf0_("   <g,d> > 0  or  <y,s> <0\n"); break;
+		default: _printf0_("   Unknown end condition\n");
 	}
 
@@ -93,4 +96,5 @@
 	xDelete<double>(g);
 	xDelete<double>(x);
+	xDelete<double>(dz);
 }
 #else
