Request for review: better tests for `sparse.linalg.LinearOperator`

Hi all, I’m looking for a review on TST: sparse.linalg.LinearOperator: add dot-tests by lucascolley · Pull Request #23860 · scipy/scipy · GitHub. The PR adds a new test class for sparse.linalg.LinearOperator, to verify correctness properties of the interface using randomised data, primarily equivalence of forward and adjoint matvec / matmat for various linear operators. The new tests build on and extend similar tests from the library GitHub - PyLops/pylops: PyLops – A Linear-Operator Library for Python.

The PR is blocking for ENH: sparse.linalg.LinearOperator: n-D batch support by lucascolley · Pull Request #23836 · scipy/scipy · GitHub, in which I have extended sparse.linalg.LinearOperator to support batch dimensions. Once these new tests are in, I can work on extending them to verify correctness of the implementation of batch dimension support.

I am also planning work on exploring batch support in the iterative solvers in sparse.linalg, which I hope to be able to share soon, and adding support to LinearOperator is the primary blocker for that at the minute. See RFC: sparse.linalg: batching and array types support · Issue #23315 · scipy/scipy · GitHub for context.

Any feedback greatly appreciated!

Cheers,
Lucas