LOBPCG
Locally Optimal Block Preconditioned Conjugate Gradient (LOBPCG) is a matrix-free method for finding the largest (or smallest) eigenvalues and the corresponding eigenvectors of a symmetric generalized eigenvalue problem

for a given pair  of complex Hermitian or real symmetric matrices, where
the matrix  is also assumed positive-definite. Background
Kantorovich in 1948 proposed calculating the smallest eigenvalue  of a symmetric matrix  by steepest descent using a direction  of a scaled gradient of a Rayleigh quotient  in a scalar product , with the step size computed by minimizing the Rayleigh quotient in the linear span of the vectors  and , i.e. in a locally optimal manner. Samokish proposed applying a preconditioner  to the residual vector  to generate the preconditioned direction  and derived asymptotic, as  approaches the eigenvector, convergence rate bounds. D'yakonov suggested spectrally equivalent preconditioning and derived non-asymptotic convergence rate bounds. Block locally optimal multi-step steepest descent for eigenvalue problems was described in. Local minimization of the Rayleigh quotient on the subspace spanned by the current approximation, the current residual and the previous approximation, as well as its block version, appeared in. The preconditioned version was analyzed in  and. Main features
 Matrix-free, i.e. does not require storing the coefficient matrix explicitly, but can access the matrix by evaluating matrix-vector products. Factorization-free, i.e. does not require any matrix decomposition even for a generalized eigenvalue problem. The costs per iteration and the memory use are competitive with those of the Lanczos method, computing a single extreme eigenpair of a symmetric matrix. Linear convergence is theoretically guaranteed and practically observed. Accelerated convergence due to direct preconditioning, in contrast to the Lanczos method, including variable and non-symmetric as well as fixed and positive definite preconditioning. Allows trivial incorporation of efficient domain decomposition and multigrid techniques via preconditioning. Warm starts and computes an approximation to the eigenvector on every iteration. More numerically stable compared to the Lanczos method, and can operate in low-precision computer arithmetic. Easy to implement, with many versions already appeared. Blocking allows utilizing highly efficient matrix-matrix operations, e.g., BLAS 3. The block size can be tuned to balance convergence speed vs. computer costs of orthogonalizations and the Rayleigh-Ritz method on every iteration. Algorithm

Single-vector version

Preliminaries: Gradient descent for eigenvalue problems
The method performs an iterative maximization (or minimization) of the generalized Rayleigh quotient

which results in finding largest (or smallest) eigenpairs of 

The direction of the steepest ascent, which is the gradient, of the generalized Rayleigh quotient is positively proportional to the vector

called the eigenvector residual. If a preconditioner  is available, it is applied to the residual and gives the vector

called the preconditioned residual. Without preconditioning, we set 
 and so . An iterative method

or, in short,

is known as preconditioned steepest ascent (or descent), where the scalar 
 is called the step size. The optimal step size can be determined by maximizing the Rayleigh quotient, i.e.,

(or  in case of minimizing), 
in which case the method is called locally optimal. Three-term recurrence
To dramatically accelerate the convergence of the locally optimal preconditioned steepest ascent (or descent), one extra vector can be added to the two-term recurrence relation to make it three-term:

(use  in case of minimizing). The maximization/minimization of the Rayleigh quotient in a 3-dimensional subspace can be performed numerically by the Rayleigh–Ritz method. Adding more vectors, see, e.g., Richardson extrapolation, does not result in significant acceleration but increases computation costs, so is not generally recommended. Numerical stability improvements
As the iterations converge, the vectors  and  become nearly linearly dependent, resulting in a precision loss and making the Rayleigh–Ritz method numerically unstable in the presence of round-off errors. The loss of precision may be avoided by substituting the vector  with a vector , that may be further away from , in the basis of the three-dimensional subspace , while keeping the subspace unchanged and avoiding orthogonalization or any other extra operations. Furthermore, orthogonalizing the basis of the three-dimensional subspace may be needed for ill-conditioned eigenvalue problems to improve stability and attainable accuracy. Krylov subspace analogs
This is a single-vector version of the LOBPCG method—one of possible generalization of the preconditioned conjugate gradient linear solvers to the case of symmetric eigenvalue problems. Even in the trivial case  and  the resulting approximation with  will be different from that obtained by the Lanczos algorithm, although both approximations will belong to the same Krylov subspace. Practical use scenarios
Extreme simplicity and high efficiency of the single-vector version of LOBPCG make it attractive for eigenvalue-related applications under severe hardware limitations, ranging from spectral clustering based real-time anomaly detection via graph partitioning on embedded ASIC or FPGA to modelling physical phenomena of record computing complexity on exascale TOP500 supercomputers. Block version

Summary
Subsequent eigenpairs can be computed one-by-one via single-vector LOBPCG supplemented with an orthogonal deflation or simultaneously as a block. In the former approach, imprecisions in already computed approximate eigenvectors additively affect the accuracy of the subsequently computed eigenvectors, thus increasing the error with every new computation. Iterating several approximate eigenvectors together in a block in a locally optimal fashion in the block version of the LOBPCG. allows fast, accurate, and robust computation of eigenvectors, including those corresponding to nearly-multiple eigenvalues where the single-vector LOBPCG suffers from slow convergence. The block size can be tuned to balance numerical stability vs. convergence speed vs. computer costs of orthogonalizations and the Rayleigh-Ritz method on every iteration. Core design
The block approach in LOBPCG replaces single-vectors  and  with block-vectors, i.e. matrices  and , where, e.g., every column of  approximates one of the eigenvectors. All columns are iterated simultaneously, and the next matrix of approximate eigenvectors  is determined by the Rayleigh–Ritz method on the subspace spanned by all columns of matrices  and . Each column of  is computed simply as the preconditioned residual for every column of  The matrix  is determined such that the subspaces spanned by the columns of  and of  are the same. Numerical stability vs. efficiency
The outcome of the Rayleigh–Ritz method is determined by the subspace spanned by all columns of matrices  and , where a basis of the subspace can theoretically be arbitrary. However, in inexact computer arithmetic the Rayleigh–Ritz method becomes numerically unstable if some of the basis vectors are approximately linearly dependent. Numerical instabilities typically occur, e.g., if some of the eigenvectors in the iterative block already reach attainable accuracy for a given computer precision and are especially prominent in low precision, e.g., single precision. The art of multiple different implementation of LOBPCG is to ensure numerical stability of the  Rayleigh–Ritz method at minimal computing costs by choosing a good basis of the subspace. The arguably most stable approach of making the basis vectors orthogonal, e.g., by the Gram–Schmidt process, is also the most computational expensive. For example, LOBPCG implementations, utilize unstable but efficient Cholesky decomposition of the normal matrix, which is performed only on individual matrices  and , rather than on the whole subspace. The constantly increasing amount of computer memory allows typical block sizes nowadays in the  range, where the percentage of compute time spend on orthogonalizations and the Rayleigh-Ritz method starts dominating. Locking of previously converged eigenvectors
Block methods for eigenvalue problems that iterate subspaces commonly have some of the iterative eigenvectors converged faster than others that motivates locking the already converged eigenvectors, i.e., removing them from the iterative loop, in order to eliminate unnecessary computations and improve numerical stability. A simple removal of an eigenvector may likely result in forming its duplicate in still iterating vectors. The fact that the eigenvectors of symmetric eigenvalue problems are pair-wise orthogonal suggest keeping all iterative vectors orthogonal to the locked vectors. Locking can be implemented differently maintaining numerical accuracy and stability while minimizing the compute costs. For example, LOBPCG implementations, follow, separating hard locking, i.e. a deflation by restriction, where the locked eigenvectors serve as a code input and do not change, from soft locking, where the locked vectors do not participate in the typically most expensive iterative step of computing the residuals, however, fully participate in the Rayleigh—Ritz method and thus are allowed to be changed by the Rayleigh—Ritz method. Modifications, LOBPCG II
LOBPCG includes all columns of matrices  and  into the Rayleigh–Ritz method resulting in an up to -by- eigenvalue problem needed to solve and up to  dot products to compute at every iteration, where  denotes the block size — the number of columns. For large block sizes  this starts dominating compute and I/O costs and limiting parallelization, where multiple compute devices are running simultaneously. The original LOBPCG paper describes a modification, called LOBPCG II, to address such a problem running the single-vector version of the LOBPCG method for each desired eigenpair with the Rayleigh-Ritz procedure solving  of 3-by-3 projected eigenvalue problems. The global Rayleigh-Ritz procedure for all  eigenpairs is on every iteration but only on the columns of the matrix , thus reducing the number of the necessary dot products to  from  and the size of the global projected eigenvalue problem to -by- from -by- on every iteration. Reference  goes further applying the LOBPCG algorithm to each approximate eigenvector separately, i.e., running the unblocked version of the LOBPCG method for each desired eigenpair for a fixed number of iterations. The Rayleigh-Ritz procedures in these runs only need to solve a set of 3 × 3 projected eigenvalue problems. The global Rayleigh-Ritz procedure for all desired eigenpairs is only applied periodically at the end of a fixed number of unblocked LOBPCG iterations. Such modifications may be less robust compared to the original LOBPCG. Individually running branches of the single-vector LOBPCG may not follow continuous iterative paths flipping instead and creating duplicated approximations to the same eigenvector. The single-vector LOBPCG may be unsuitable for clustered eigenvalues, but separate small-block LOBPCG runs require determining their block sizes automatically during the process of iterations since the number of the clusters of eigenvalues and their sizes may be unknown a priori. Convergence theory and practice
LOBPCG by construction is guaranteed to minimize the Rayleigh quotient not slower than the block steepest gradient descent, which has a comprehensive convergence theory. Every eigenvector is a stationary point of the Rayleigh quotient, where the gradient vanishes. Thus, the gradient descent may slow down in a vicinity of any eigenvector, however, it is guaranteed to either converge to the eigenvector with a linear convergence rate or, if this eigenvector is a saddle point, the iterative Rayleigh quotient is more likely to drop down below the corresponding eigenvalue and start converging linearly to the next eigenvalue below. The worst value of the linear convergence rate has been determined and depends on the relative gap between the eigenvalue and the rest of the matrix spectrum and the quality of the preconditioner, if present. For a general matrix, there is evidently no way to predict the eigenvectors and thus generate the initial approximations that always work well. The iterative solution by LOBPCG may be sensitive to the initial eigenvectors approximations, e.g., taking longer to converge slowing down as passing intermediate eigenpairs. Moreover, in theory, one cannot guarantee convergence necessarily to the smallest eigenpair, although the probability of the miss is zero. A good quality random Gaussian function with the zero mean is commonly the default in LOBPCG to generate the initial approximations. To fix the initial approximations, one can select a fixed seed for the random number generator. In contrast to the Lanczos method, LOBPCG rarely exhibits asymptotic superlinear convergence in practice. Partial Principal component analysis (PCA) and Singular Value Decomposition (SVD)
LOBPCG can be trivially adapted for computing several largest singular values and the corresponding singular vectors (partial SVD), e.g., for iterative computation of PCA, for a data matrix  with zero mean, without explicitly computing the covariance matrix , i.e. in matrix-free fashion. The main calculation is evaluation of a function of the product  of the covariance matrix  and the block-vector  that iteratively approximates the desired singular vectors. PCA needs the largest eigenvalues of the covariance matrix, while LOBPCG is typically implemented to calculate the smallest ones. A simple work-around is to negate the function, substituting  for  and thus reversing the order of the eigenvalues, since LOBPCG does not care if the matrix of the eigenvalue problem is positive definite or not. LOBPCG for PCA and SVD is implemented in SciPy since revision 1.4.0

General software implementations
LOBPCG's inventor, Andrew Knyazev, published a reference implementation called Block Locally Optimal Preconditioned Eigenvalue Xolvers (BLOPEX) with interfaces to PETSc, hypre, and Parallel Hierarchical Adaptive MultiLevel method (PHAML). Other implementations are available in, e.g., GNU Octave, MATLAB (including for distributed or tiling arrays), Java, Anasazi (Trilinos), SLEPc, SciPy
,  Julia, MAGMA, Pytorch, Rust,  OpenMP and OpenACC, CuPy (A NumPy-compatible array library accelerated by CUDA),
Google JAX,
and NVIDIA AMGX. LOBPCG is implemented, but not included, in TensorFlow. Applications

Data mining
Software packages scikit-learn and Megaman use LOBPCG to scale spectral clustering and manifold learning via Laplacian eigenmaps to large data sets. NVIDIA has implemented LOBPCG in its nvGRAPH library introduced in CUDA 8. Sphynx, a hybrid distributed- and shared-memory-enabled parallel graph partitioner  - the first graph partitioning tool that works on GPUs on distributed-memory settings - uses spectral clustering for graph partitioning, computing eigenvectors on the Laplacian matrix of the graph using LOBPCG from the Anasazi package. Material sciences
LOBPCG is implemented in ABINIT (including CUDA version) and Octopus. It has been used for multi-billion size matrices by Gordon Bell Prize finalists, on the Earth Simulator supercomputer in Japan. Hubbard model for strongly-correlated electron systems to understand the mechanism behind the superconductivity uses LOBPCG to calculate the ground state of the Hamiltonian on the K computer and multi-GPU systems. There are MATLAB and Julia
versions of LOBPCG for Kohn-Sham equations and density functional theory (DFT) using the plane wave basis. Recent implementations include TTPY, Platypus‐QM, MFDn, ACE-Molecule, LACONIC. Mechanics and fluids
LOBPCG from BLOPEX is used for preconditioner setup in Multilevel Balancing Domain Decomposition by Constraints (BDDC) solver library BDDCML, which is incorporated into OpenFTL (Open Finite element Template Library) and Flow123d simulator of underground water flow, solute and heat transport in fractured porous media. LOBPCG has been implemented in LS-DYNA. Maxwell's equations
LOBPCG is one of core eigenvalue solvers in PYFEMax and high performance multiphysics finite element software Netgen/NGSolve. LOBPCG from hypre is incorporated into open source lightweight scalable C++ library for finite element methods MFEM, which is used in many projects, including BLAST, XBraid, VisIt, xSDK, the FASTMath institute in SciDAC, and the co-design Center for Efficient Exascale Discretizations (CEED) in the Exascale computing Project. Denoising
Iterative LOBPCG-based approximate low-pass filter can be used for denoising; see, e.g., to accelerate total variation denoising. Image segmentation
Image segmentation via spectral clustering performs a low-dimension embedding using an affinity matrix between pixels, followed by clustering of the components of the eigenvectors in the low dimensional space, e.g., using the graph Laplacian for the bilateral filter. Image segmentation via spectral graph partitioning by LOBPCG with multigrid preconditioning has been first proposed in  and actually tested in  and. The latter approach has been later implemented in Python scikit-learn that uses LOBPCG from SciPy with algebraic multigrid preconditioning for solving the eigenvalue problem for the graph Laplacian. References

External links
LOBPCG in MATLAB
LOBPCG in Octave
LOBPCG in SciPy
LOBPCG in Java at Google Code
LOBPCG in Block Locally Optimal Preconditioned Eigenvalue Xolvers (BLOPEX) at GitHub and archived at Google Code

Numerical linear algebra
Scientific simulation software