scipy/scipy — pull request #2684 by pv (2013-08-04 11:49:51+00:00)
Title: BUG: arpack-ng: fix bug occurring on OSX or LAPACK 3.2.1

This PR fixes a bug in ARPACK that manifests with on OSX with Accelerate and on other platforms with LAPACK 3.2.1.

See discussion at http://forge.scilab.org/index.php/p/arpack-ng/issues/1259/

The Ritz vector purification step assumes workl(iq) still contains the original Q matrix. This is however overwritten by the call to xGEQR2 earlier. This code in ARPACK never actually functioned correctly, but due to the way most LAPACK versions form the QR decomposition, the applied correction would be zero.

This patch fixes the issue by making a copy of the last row of the eigenvector matrix, after it is recomputed after QR by xORM2R. The work space WORKL(IW+NCV:IW+2*NCV) used for the TAU values of the QR decomposition is not used later in the routine, and can be used to store a copy of the last row.

Fixes gh-2547 (provided you use -ff2c flag for compiling)