-
Notifications
You must be signed in to change notification settings - Fork 21
Improve behavior of LinearOperator objects
#473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: devel
Are you sure you want to change the base?
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job @jowezarek! Thanks!
I have a few comments and questions
|
@jowezarek Is this PR ready for being reviewed one last time? If yes, please update the PR description with a list of the changes made, and the issues which it fixes. When merging with |
First attempt at defining the rules for operating with `LinearOperator` objects.
Replace `vector_space` with `coeff_space`.
LinearOperator objects
Closes #453
The issue described in #453 is not a
ZeroOperatorbug, but rather an issue in the__add__method of the BlockLinearOperator:First Issue
In lines 11 & 12, it is assumed that all
LinearOperatorshave acopymethod. This is a useful requirement, as we don't want the last line of the following codeto change
C.In fact, this code does not run if
A2does not have an implementedcopymethod.Hence I made
copya mandatory method for allLinearOperators.Second Issue
Line 16 is called whenever there is a block
[i,j]such that in the caseC = A + BA[i,j] == NoneandB[i,j] != None.The method
set_backendlooks like this:Here, unless one of the four break criteria is met, and unless all not-None blocks are
StencilMatricesorStencilInterfaceMatrices, eachLinearOperatormust have aset_backendfunction defined. I don't think that is useful, and hence replaced line 16 as followsNow, only if a
set_backendmethod exists, it is called.Third Issue
In line 13 of the
BlockLinearOperator.__add__method, if either one of theLinearOperatorsBijorMijis aZeroOperatorwe haveBij + Mij = MijorBij + Mij = Bijrather thanMij.copy()orBij.copy(). The same issue appears in the__sub__method. Hence I changed the code as follows:Additional Change
I have required, and used locally, a
set_scalarmethod in theScaledLinearOperatorclass for a long time already.It looks as follows and is included in this PR
Finally, I have added many instances of
copymethods - sometimes like soand sometimes like so
Tests
are included in this PR for "standard"
LinearOperatorcopyfunctions. I've also included tests that would previously fail, either due to a non-existentset_backendmethod or due to a non-existentcopymethod.