Illustrative code of Wold's PLS algorithm based on Geladi and Kowalski 1988 paper. The predictor in the example is incorrect. You state the prediction Y_hat_new = (X_new*P)*B*Q', which yields an error norm(Y_new-Y_hat_new)=0.187. The correct predictor is Y_hat_new = X_new* (W/(P'*W))*B*Q'.
This is exactly what I needed. Unfortunately, it doesn't seem to work on eigenvalue problems where the crossings happen over a wide range, or where they cross and then cross back. For my system, this really only worked for small crossings.
04 Dec 2012
Consistently sorted eigenvalue and eigenvector sequences