Open doddgray opened 3 years ago
apologies, I think I misunderstood the intended input style for constraints here. Comparing with the docs for scipy.sparse.linalg.lobpcg
(here) it looks like constraints is expecting an N x n_constraints
array (just a few concatenated column vectors), where the target operator is N x N
and n_constraints
is determined by the number of independent constraints you want to apply. Is that right?
It would be helpful to see an example of this being using correctly.
Comparing with the docs for scipy.sparse.linalg.lobpcg (here) it looks like constraints is expecting an N x n_constraints array (just a few concatenated column vectors), where the target operator is N x N and n_constraints is determined by the number of independent constraints you want to apply. Is that right?
Yes that's correct.
IterativeSolvers.jl's LOBPCG methods for partial eigen-decomposition provide a keyword argument interface for constraint operators/matrices. The documentation for this argument currently says
The requirements for constraint maps in the current implementation are actually much more strict than this (and much more strict than for the target operator and preconditioner).
I ran into this issue while trying to use constraints of type
LinearMaps.FunctionMap
withIterativeSolvers.lobpcg
. During construction of callableConstraint
structs, constraint operators pass through various pre-processing steps that are incompatible with generalLinearMaps
types (similar
andHermitian
). More broadly, the algorithm for constraints seems to requiresetindex!
viaview
and slicing, as well asldiv!
, seeupdate!
and methods ofConstraint
:https://github.com/JuliaLinearAlgebra/IterativeSolvers.jl/blob/ae01dfe228138d0db9164eb343252150f6c0bfc6/src/lobpcg.jl#L144-L224
Could somebody more knowledgeable explain the actual requirements and suggested types for constraint operators? I think the main appeal of
IterativeSolvers.lobpcg
is compatibility with "matrix-free"/implicit linear operator types, so the currently undocumented constraint interface requirements could lead to confusion.It would be great to allow more general constraint functions & operators if it wouldn't be too much work. IIUC, these extra requirements for constraint operators arise because
nev
(# eigenvalues/vectors solved) extra columns are glued onto the constraint matrix and mutated during each iteration. Could the same processing be achieved without constraining the constraints (hehe), just by creating a separate array? I would be glad to take a crack at it if a PR is desired, although this solver seems to be stuck mid-overhaul at the moment (#247).