Open JeffFessler opened 1 year ago
The diagonal preconditioner has a general ldiv! method that can apply to a vector or a matrix because b is duck typed: https://github.com/JuliaLinearAlgebra/Preconditioners.jl/blob/52b3702e9c8c5d42d6092ed2df7efdbe07c81411/src/diagonal.jl#L40
ldiv!
b
In contrast, the incomplete Cholesky preconditioner ldiv! is pinned to a Vector argument: https://github.com/JuliaLinearAlgebra/Preconditioners.jl/blob/52b3702e9c8c5d42d6092ed2df7efdbe07c81411/src/incompletecholesky.jl#L28
Could the package provide a more general RHS? Something like:
@inline function ldiv!(y::AbstractVecOrMat, C::CholeskyPreconditioner, b::AbstractVecOrMat)
One related hack is something like this:
import Base.\ \(C::CholeskyPreconditioner, A::AbstractMatrix) = reduce(hcat, [C \ c for c in eachcol(A)])
but I think there should be a better way?
We will need to upstream these implementations to the dependency packages first if possible. If the maintainers are not receptive, we can roll our own implementation here.
The diagonal preconditioner has a general
ldiv!
method that can apply to a vector or a matrix becauseb
is duck typed: https://github.com/JuliaLinearAlgebra/Preconditioners.jl/blob/52b3702e9c8c5d42d6092ed2df7efdbe07c81411/src/diagonal.jl#L40In contrast, the incomplete Cholesky preconditioner
ldiv!
is pinned to a Vector argument: https://github.com/JuliaLinearAlgebra/Preconditioners.jl/blob/52b3702e9c8c5d42d6092ed2df7efdbe07c81411/src/incompletecholesky.jl#L28Could the package provide a more general RHS? Something like:
One related hack is something like this:
but I think there should be a better way?