=0; i--) {
j = index[i];
z[i] /= Amatrix(i,j);
for (k=0; k* itmax) /* over the iteration count, oops */
goto terminate;
alpha = 2; /* greater than the values we will be
comparing, which will all be <= 1 */
for (i=0; i*

0 for j in P? If so, set x:=z and break out of this inner loop, returning to the main loop. */ if (alpha > 1) { /* the next four lines of code corresponds to lines 244-247 in the Fortran 66 version */ for (i=0; i

= 0) { i = index[q]; x[i] = 0; /* ensure that rounding errors don't creep in */ /* now use Givens rotations to fix up A and b */ for (jj=q+1; jj

=0. They should be, because of
the way alpha was determined. If they are not,
this is due to rounding error, so we set any
non-positive elements to zero and move them too
from set P to set Z */
for (q=p-1; q>=0; q--)
if (x[index[q]] <= 0) break;
/* now if q>=0, then x[index[q]] <= 0,
and if q<0, we are done */
} /* end of while (q >= 0) loop */
/* OK, all x[i]=0 have now had their indices moved from P
to Z. We can now solve the least squares problem
|Az-b| once again, ready for the next secondary loop.
So we simply copy b into z and solve the triangular
system, as before. We could reduce the code size a
fraction by having this code at the beginning of the
loop, but that would make the loop exit code (checking
iter) appear in the middle, which would be a tad
confusing. */
for (i=0; i* itmax) ? -3 : 0;
}
// Emacs settings:
// Local variables:
// mode: c
// c-basic-offset: 4
// tab-width: 4
// End:
*