L-BFGS-B  3.0
Large-scale Bound-constrained Optimization
matupd.f
Go to the documentation of this file.
1 c> \file matupd.f
2 
3 c> \brief This subroutine updates matrices WS and WY, and forms the
4 c> middle matrix in B.
5 c>
6 c> This subroutine updates matrices WS and WY, and forms the
7 c> middle matrix in B.
8 c>
9 c> @param n On entry n is the number of variables.<br/>
10 c> On exit n is unchanged.
11 c>
12 c> @param m On entry m is the maximum number of variable metric
13 c> corrections allowed in the limited memory matrix.<br/>
14 c> On exit m is unchanged.
15 c>
16 c> @param ws On entry this stores S, a set of s-vectors, that defines the
17 c> limited memory BFGS matrix.<br/>
18 c> On exit this array is unchanged.
19 c>
20 c> @param wy On entry this stores Y, a set of y-vectors, that defines the
21 c> limited memory BFGS matrix.<br/>
22 c> On exit this array is unchanged.
23 c>
24 c> @param sy On entry this stores S'Y, that defines the
25 c> limited memory BFGS matrix.<br/>
26 c> On exit this array is unchanged.
27 c>
28 c> @param ss On entry this stores S'S, that defines the
29 c> limited memory BFGS matrix.<br/>
30 c> On exit this array is unchanged.
31 c> @param d TODO
32 c> @param r TODO
33 c> @param itail TODO
34 c> @param iupdat TODO
35 c> @param col On entry col is the actual number of variable metric
36 c> corrections stored so far.<br/>
37 c> On exit col is unchanged.
38 c>
39 c> @param head On entry head is the location of the first s-vector (or y-vector)
40 c> in S (or Y).<br/>
41 c> On exit col is unchanged.
42 c>
43 c> @param theta On entry theta is the scaling factor specifying B_0 = theta I.<br/>
44 c> On exit theta is unchanged.
45 c> @param rr TODO
46 c> @param dr TODO
47 c> @param stp TODO
48 c> @param dtd TODO
49  subroutine matupd(n, m, ws, wy, sy, ss, d, r, itail,
50  + iupdat, col, head, theta, rr, dr, stp, dtd)
51 
52  integer n, m, itail, iupdat, col, head
53  double precision theta, rr, dr, stp, dtd, d(n), r(n),
54  + ws(n, m), wy(n, m), sy(m, m), ss(m, m)
55 
56 c
57 c * * *
58 c
59 c NEOS, November 1994. (Latest revision June 1996.)
60 c Optimization Technology Center.
61 c Argonne National Laboratory and Northwestern University.
62 c Written by
63 c Ciyou Zhu
64 c in collaboration with R.H. Byrd, P. Lu-Chen and J. Nocedal.
65 c
66 c
67 c ************
68 
69  integer j,pointr
70  double precision ddot
71  double precision one
72  parameter(one=1.0d0)
73 
74 c Set pointers for matrices WS and WY.
75 
76  if (iupdat .le. m) then
77  col = iupdat
78  itail = mod(head+iupdat-2,m) + 1
79  else
80  itail = mod(itail,m) + 1
81  head = mod(head,m) + 1
82  endif
83 
84 c Update matrices WS and WY.
85 
86  call dcopy(n,d,1,ws(1,itail),1)
87  call dcopy(n,r,1,wy(1,itail),1)
88 
89 c Set theta=yy/ys.
90 
91  theta = rr/dr
92 
93 c Form the middle matrix in B.
94 
95 c update the upper triangle of SS,
96 c and the lower triangle of SY:
97  if (iupdat .gt. m) then
98 c move old information
99  do 50 j = 1, col - 1
100  call dcopy(j,ss(2,j+1),1,ss(1,j),1)
101  call dcopy(col-j,sy(j+1,j+1),1,sy(j,j),1)
102  50 continue
103  endif
104 c add new information: the last row of SY
105 c and the last column of SS:
106  pointr = head
107  do 51 j = 1, col - 1
108  sy(col,j) = ddot(n,d,1,wy(1,pointr),1)
109  ss(j,col) = ddot(n,ws(1,pointr),1,d,1)
110  pointr = mod(pointr,m) + 1
111  51 continue
112  if (stp .eq. one) then
113  ss(col,col) = dtd
114  else
115  ss(col,col) = stp*stp*dtd
116  endif
117  sy(col,col) = dr
118 
119  return
120 
121  end
subroutine matupd(n, m, ws, wy, sy, ss, d, r, itail, iupdat, col, head, theta, rr, dr, stp, dtd)
This subroutine updates matrices WS and WY, and forms the middle matrix in B.
Definition: matupd.f:51