Default linear solver: perform LU factorization on `LinearOperator`.
Summary
In the _run_default_solver method, called to solve a linear system, the strategy is as follow:
- Run the LGMRES algorithm,
- If failed, run the GMRES algorithm,
- If failed, perform a sparse LU factorisation (direct method, expected to work as a last resort).
For this latter, there is no test to check whether the left-hand side is indeed a matrix (ndarray from NumPy or spmatrix from SciPy).
Proposition
As a quick fix, adding a check on the left-hand side type before performing a direct method.
In the future
The default strategy described above, when the left-hand side is a LinearOperator, will no longer have a last resort strategy ensuring that we can solve the system anyway. We should thus take care of the eventuality that neither LGMRES nor GMRES managed to solve the system.