Closed e-moral-sanchez closed 3 months ago
This is useful I think, thanks!
As a test, you can check the behaviour of a "fake" matrix-free operator: an operator created with a dot product involving a Stencil Matrix should act exactly like the matrix itself.
You can also check that an iterative solver (like cg) can run with an object of this new class.
I see that some tests are failing because of minres()
getting an unexpected keyword argument tol
. Is this related to this new class?
The new version 1.14.0
of SciPy removed the tol
argument in minres
: https://docs.scipy.org/doc/scipy-1.13.1/reference/generated/scipy.sparse.linalg.minres.html
This also affects PR https://github.com/campospinto/psydac_dev/pull/6 .
I will fix this in this PR.
This PR provides the class
MatrixFreeLinearOperator
, which is a subclass of the abstract classLinearOperator
.The class
MatrixFreeLinearOperator
allows to create a general matrix-free linear operator. The constructor only requires the domain, codomain and a callabledot
method.TODO: add simple unit tests (ideas are welcome!)
I am just adding a few unit tests
I am also adding some features to handle the case where the given dot method has not optional 'out' argument, and the possibility (not mandatory) to pass a 'transpose_dot' method
This PR provides a
MatrixFreeLinearOperator
class which is a subclass of the abstract classLinearOperator
.The new class allows to create a general matrix-free linear operator. The constructor only requires the domain, codomain and a callable
dot
method.Notes:
dot
method may or may not take an 'out' argumenttranspose_dot
method may also be provided (mandatory to instantiate the transpose() linear operator)Additional change:
tol
argument in calls to scipy's minres. This forces us to use scipy >= 1.14 and hence python >= 3.9