Function ndarray_linalg::lobpcg::lobpcg
source · pub fn lobpcg<A: Float + Scalar + Lapack + ScalarOperand + PartialOrd + Default, F: Fn(ArrayView2<'_, A>) -> Array2<A>, G: Fn(ArrayViewMut2<'_, A>)>(
a: F,
x: Array2<A>,
m: G,
y: Option<Array2<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. Ifa
has shape=(n,n), thenx
should have shape=(n,k).m
- Preconditioner toa
, by default the identity matrix. Should approximate the inverse ofa
.y
- Constraints of (n,size_y), iterations are performed in the orthogonal complement of the column-space ofy
. 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 iterationsorder
- 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).