LinearSolve for a matrix-free problem

I am trying to use LinearSolve for a matrix-free problem. I tried using the functionoperator from SciMLOperators and it does seem to work when doing matrix multiplication.
However when trying to solve a linear system it converges to the wrong answer. What am I doing wrong?

using LinearSolve
using SciMLOperators

n = 20
A = rand(n,n)
b1 = rand(n)
b2 = rand(n)

    f1(du,u, p, t)  = A * u
    op1 = FunctionOperator(f1,b1,b2)
    prob = LinearProblem(op1, b1)
    probp = LinearProblem(A, b1)
    sol1 = solve(probp,KrylovJL_GMRES(),verbose=true)
    sol = solve(prob,KrylovJL_GMRES(),verbose=true)
 [sol.u sol1.u]
20×2 Matrix{Float64}:
 0.331797    1.15892
 0.300263   -2.09968
 0.0408503  -0.596929
 0.296654   -0.475492
 0.255724    2.01864
 0.0457844   1.18987
 0.0585046   0.607158
 0.234836    1.07355
 0.258045   -2.1207
 0.311212    0.61519
 0.207808    0.118606
 0.309093   -0.458788
 0.12327     6.03655
 0.346188   -1.09937
 0.0845259  -4.70184
 0.201998   -3.66769
 0.179028   -1.33117
 0.0998569   1.11206
 0.201204    2.26892
 0.127912    1.22567
1 Like

Sorry about that. There was a documentation mishap. The big warning sign on the last version of the SciMLOperators docs:

didn’t seem to make it to the deployed version. I just set the deployment tonight, so should update. It will say on the first page:

SciMLOperators is not ready for prime time use yet. Be warned that any user is testing an early and possibly buggy form. This note will be removed when the library is officially released.

Which explains the issue. The other libraries just aren’t setup for it yet. There’s an issue which links to all of the PRs:

I do plan to get to it within the next few months, though the student who was working on this had to focus on quals for a bit so we put it on a small hiatus before finishing the integration. I’ll probably pick it back up again in January to complete this integration step.

Until we have it all integrated and there’s tests on all of the usage, I wouldn’t consider it ready to be used. The warning sign will come down and it’ll be marked as v1.0 when that’s all completed, but I’d stay away from SciMLOperators for now. I mentioned this in the chat channels a few weeks ago but I forgot to make a bigger signal on this, sorry.

1 Like