Function linfa_linalg::lobpcg::lobpcg

source ·
pub fn lobpcg<A: NdFloat + Sum, F: Fn(ArrayView2<'_, A>) -> Array2<A>, G: Fn(ArrayViewMut2<'_, A>)>(
    a: F,
    x: Array2<A>,
    m: G,
    y: Option<ArrayView2<'_, A>>,
    tol: f32,
    maxiter: usize,
    order: Order,
) -> LobpcgResult<A>
Expand description

Eigenvalue solver for large symmetric positive definite (SPD) eigenproblems

§Arguments

  • a - An operator defining the problem, usually a sparse (sometimes also dense) matrix multiplication. Also called the “stiffness matrix”.
  • x - Initial approximation of the k eigenvectors. If a has shape=(n,n), then x should have shape=(n,k).
  • m - Preconditioner to a, by default the identity matrix. Should approximate the inverse of a.
  • y - Constraints of (n,size_y), iterations are performed in the orthogonal complement of the column-space of y. It must be full rank.
  • tol - The tolerance values defines at which point the solver stops the optimization. The approximation of a eigenvalue stops when then l2-norm of the residual is below this threshold.
  • maxiter - The maximal number of iterations
  • order - Whether to solve for the largest or lowest eigenvalues

The function returns an LobpcgResult with the eigenvalue/eigenvector and achieved residual norm for it. All iterations are tracked and the optimal solution returned. In case of an error a special variant LobpcgResult::NotConverged additionally carries the error. This can happen when the precision of the matrix is too low (switch then from f32 to f64 for example).