lm()

function [out, Elist]=lm(W,Nit)

Input:

Output:

Implement the line minimization algorithm discussed in lecture,

  1. Initialize $W_0$
  2. Evaluate gradient: $g=\nabla_W E(W_n)$
  3. If not first iteration, do ``linmin test'': check $(g \cdot
d)/\sqrt{(g \cdot g) (d \cdot d)}$ for $d$ being the previous search direction
  4. Set search direction: $d=-g$
  5. Evaluate gradient at trial step: $g_t=\nabla_W E(W_n+\alpha_t d)$
  6. Compute estimate of best step: $\alpha=\alpha_t (g \cdot
d)/([g-gt] \cdot d)$
  7. $W_{n+1}=W_n+\alpha d$
  8. Repeat (2-7)
with a function of the above prototype in the file ``lm.m''. You may wish to experiment with the trial step size. You will find that the algorithm is not very sensitive to this parameter. A trial step size of $\alpha_t=3 \times 10^{-5}$ to work well.
Hint: As on the previous assignment, because of our trick of coding gradients as complex matrices, we must evaluate the dot products according to the formula

\begin{displaymath}
a \cdot b = 2 {\mbox{Re\,}}{\mbox{Tr\,}}\left(a^\dagger b\right).
\end{displaymath}

As a matter of convenience, note that the ``extra'' factor of two, while very important for getting the values of dot products correct, actually cancels out of all of the expressions above.



Subsections
Tomas Arias 2004-05-04