The ultimate test of a good preconditioner is whether is actually improves the rate of convergence. You may note, however, that if you replace your current call to lm() in ``sch.m'' with pclm(), the energy may begin to increase momentarily. This is not uncommon when starting a minimization far from the minimum. To make a more appropriate comparison replace your current call to lm() with
W=lm(W,20); %# 20 iterations of simple lm() to get nearer to the minimum [Wlm, Elm]=lm(W,50); %# 50 iterations of lm() from W, while recording results [Wpclm, Epclm]=pclm(W,50); %# 50 iterations of pclm from same W semilogy([1:50],Elm-18,'r-',[1:50],Epclm-18,'b-'); %# Plot results on log scale pause; %# Wait for keyboard input before continuingThis will first ``relax'' W with 20 iterations to give a joint starting point reasonably close to the minimum, run both lm() and pclm() from that same point for 50 iterations, and plot on a log scale the difference of each algorithm from the analytic result of 18, with line minimization in red, and preconditioned line minimization in blue. If the preconditioner is working you should notice both a large initial difference coming from the first iteration where the preconditoner eliminates nearly all of the high frequency errors and a difference in slope (exponential convergence rate) at the higher iteration numbers.
Tomas Arias 2004-05-04