Hi, I would like to solve a linear equation Ax=b
with Krylov method. My unknown “vector” x is a multidimensional array wrapped in a custom type that <:AbstractArray
, and my A
operator is just a linear map defined on x
. Since x
is not a AbstractVector
, the linsolve
function from KrylovKit
does not seem to work: e.g.,
julia> using KrylovKit
julia> b=rand(3,3)
3×3 Matrix{Float64}:
0.132235 0.562757 0.258504
0.745966 0.236753 0.783062
0.674764 0.8032 0.723963
julia> res = linsolve(b) do x
return transpose(x)
end
ERROR: MethodError: no method matching orthogonalize!(::LinearAlgebra.Transpose{Float64, Matrix{Float64}}, ::KrylovKit.OrthonormalBasis{Matrix{Float64}}, ::SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, ::ModifiedGramSchmidt2)
Here b
is a 2D array not a vector, linsolve
does not seem to like it.
So is there a general Krylov package that can solve this toy problem without explicitly “vectorize” inputs and outputs of the linear map?