subroutine funmax( m, P, neJacP, x, f, g ) implicit double precision (a-h,o-z) integer P double precision x(P), f(m), g(neJacP) * ------------------------------------------------------------------ * funmax is an auxiliary routine for funcon for problem maxi. * Its structure parallels that of mxdata. * ------------------------------------------------------------------ parameter ( two = 2.0d+0 ) ne = 0 iz = 0 do 100, k = 1, P xk = x(k) * Column k has k-1 "z" entries. do 20, l = 1, k-1 ne = ne + 1 iz = iz + 1 t = xk - x(l) f(iz) = f(iz) + t**2 g(ne) = two * t 20 continue * Column k has P-k entries from the diagonal matrices. do 30, l = k, P-1 ne = ne + 1 t = x(l+1) - xk g(ne) = - two * t 30 continue 100 continue * end of funmax end