L-BFGS-B  3.0
Large-scale Bound-constrained Optimization
cmprlb.f
Go to the documentation of this file.
1 c> \file cmprlb.f
2 
3 c> \brief This subroutine computes r=-Z'B(xcp-xk)-Z'g by using
4 c> wa(2m+1)=W'(xcp-x) from subroutine cauchy.
5 c>
6 c> This subroutine computes r=-Z'B(xcp-xk)-Z'g by using
7 c> wa(2m+1)=W'(xcp-x) from subroutine cauchy.
8 c>
9 c> @param n number of parameters
10 c> @param m history size of Hessian approximation
11 c> @param x position
12 c> @param g gradient
13 c> @param ws part of L-BFGS matrix
14 c> @param wy part of L-BFGS matrix
15 c> @param sy part of L-BFGS matrix
16 c> @param wt part of L-BFGS matrix
17 c> @param z The generalized Cauchy point xcp computed by cauchy.
18 c> Used here as the linearisation point: r encodes -B(z-x) - g
19 c> restricted to the free variables.
20 c> @param r On exit r(1:nfree) contains -theta*(z(k)-x(k)) - g(k) plus the
21 c> W*M^{-1}*W' correction, where k = index(i). Caller uses this as
22 c> the residual for the subspace minimisation problem.
23 c> When cnstnd=.false. and col>0, the shortcut path sets
24 c> r(1:n) = -g(:) without using the index array.
25 c> @param wa Length-4m workspace shared with cauchy. On entry, the segment
26 c> wa(2m+1 : 2m+2col) holds W'(z-x) (filled by cauchy). On exit
27 c> wa(1 : 2col) holds M^{-1}*W'(z-x) from the bmv call.
28 c> @param index Permutation of (1..n): index(1..nfree) lists the indices of
29 c> variables that are free at the GCP and are the active
30 c> optimisation variables here.
31 c> @param theta Scaling factor specifying the initial Hessian B_0 = theta*I.
32 c> @param col Number of stored (s,y) correction pairs (0 on the first
33 c> iteration; up to m thereafter).
34 c> @param head Index in the cyclic WS/WY buffer of the oldest stored
35 c> correction. Used to walk the columns in chronological order.
36 c> @param nfree Number of free variables; size of the subspace problem.
37 c> @param cnstnd .true. if the problem has bounds; controls the shortcut
38 c> path described under @param r.
39 c>
40 c> Historical note: this routine used to take an `info` output parameter
41 c> to forward errors from the embedded `bmv` call. Since `bmv` cannot
42 c> fail under LAPACK `dtrsm`, the parameter was always 0 on exit and
43 c> has been removed.
44  subroutine cmprlb(n, m, x, g, ws, wy, sy, wt, z, r, wa, index,
45  + theta, col, head, nfree, cnstnd)
46 
47  logical cnstnd
48  integer n, m, col, head, nfree, index(n)
49  double precision theta,
50  + x(n), g(n), z(n), r(n), wa(4*m),
51  + ws(n, m), wy(n, m), sy(m, m), wt(m, m)
52 c
53 c * * *
54 c
55 c NEOS, November 1994. (Latest revision June 1996.)
56 c Optimization Technology Center.
57 c Argonne National Laboratory and Northwestern University.
58 c Written by
59 c Ciyou Zhu
60 c in collaboration with R.H. Byrd, P. Lu-Chen and J. Nocedal.
61 c
62 c
63 c ************
64 
65  integer i,j,k,pointr
66  double precision a1,a2
67 
68  if (.not. cnstnd .and. col .gt. 0) then
69  do 26 i = 1, n
70  r(i) = -g(i)
71  26 continue
72  else
73  do 30 i = 1, nfree
74  k = index(i)
75  r(i) = -theta*(z(k) - x(k)) - g(k)
76  30 continue
77  call bmv(m,sy,wt,col,wa(2*m+1),wa(1))
78  pointr = head
79  do 34 j = 1, col
80  a1 = wa(j)
81  a2 = theta*wa(col + j)
82  do 32 i = 1, nfree
83  k = index(i)
84  r(i) = r(i) + wy(k,pointr)*a1 + ws(k,pointr)*a2
85  32 continue
86  pointr = mod(pointr,m) + 1
87  34 continue
88  endif
89 
90  return
91 
92  end
subroutine bmv(m, sy, wt, col, v, p)
This subroutine computes the product of the 2m x 2m middle matrix in the compact L-BFGS formula of B ...
Definition: bmv.f:37
subroutine cmprlb(n, m, x, g, ws, wy, sy, wt, z, r, wa, index, theta, col, head, nfree, cnstnd)
This subroutine computes r=-Z'B(xcp-xk)-Z'g by using wa(2m+1)=W'(xcp-x) from subroutine cauchy.
Definition: cmprlb.f:46