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
DFT-based Operators #2138
DFT-based Operators #2138
Conversation
I took some time today to polish my code a bit. We've talked about this a while ago. I decided to call them dft-based operators in order to avoid confusion with the "structured operators" that may come. |
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.
It seems ok to me so far. It would be good to resolve conflicts.
38b4f94
to
baef1a0
Compare
Cool. Yeah, I forgot to finish the rebase. |
baef1a0
to
d02861d
Compare
I've decided to remove I've finalized The functionality right now is exactly what I need, but in regards of code structure I am not happy yet. instead of The nice thing is, that Right now, |
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.
I'm thinking that maybe these Operators
should be named Numpy...
for consistency since the source and range are NumpyVectorSpaces
.
In that sense, BlockDFTBasedOperator
would not fit in pymor.operators.block
if the source and range are not BlockVectorSpaces
.
Thats true. I'm happy to change the names, maybe even of the module.
Yes. But what can we call it? It still does a lot of things similarly. It might be possible to route the operations in |
Would it make sense to have a single |
That's how it was before. The old A compromise could be to bring back |
a204287
to
b43ef28
Compare
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.
It looks like the new Operators
are gone.
3d7cf32
to
976f16f
Compare
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.
Concerning the non-blocked Operators
, it seems to me that composition would be better than inheritance. Since both Toeplitz and Hankel matrices use circulant matvec, my suggestion would be to merge NumpyDFTBasedOperator
and NumpyCirculantOperator
into a single NumpyCirculatOperator
class that inherits from Operator
and CachableObject
. Then NumpyToeplitzOperator
and NumpyHankelOperator
would inherit from Operator
and instantiate a NumpyCirculantOperator
in their __init__
methods which would be used in apply
.
I'll think about the blocked Operators
more later.
You are right. Mathematically speaking, a circulant matrix is a special kind of Toeplitz matrix, so I tried to reflect that in the inheritance structure. Probably not important though...
I am currently trying to run the code on a huge example and it turns out that my approach is very inefficient. I think the speed benefits of using 2d-FFTs on large arrays is much better than avoiding unecessary zeroes. So I am working towards your suggestion (close to the old code) where e.g. |
245a83a
to
eccc28a
Compare
@pmli I've refactored the code and added tests also to |
@artpelling, there seems to be an issue with the api docs (see ci build). Can you take a look, or do you need help? |
edcc24a
to
d753093
Compare
Fixed it. Also had to fix some operator fixtures. They revealed a minor but fatal mistake in the |
97b0b04
to
518be23
Compare
@sdrave Do you have an idea what is wrong with the tests? |
I think I get the issue. For an In pymor/src/pymor/operators/interface.py Lines 236 to 263 in efd4095
the issue is that the The question then is, is it ok for |
Co-authored-by: Petar Mlinarić <mlinaric@vt.edu>
Co-authored-by: Petar Mlinarić <mlinaric@vt.edu>
a864e94
to
0182131
Compare
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.
I haven't looked into the mathematical details. But structurally, the code looks good!
This PR adds a new module
operators.dft
for matrix-free operators with DFT based matrix-vector multiplications, namelyCirculantOperator
,HankelOperator
andToeplitzOperator
. See here to get the gist.In contrast to
NumpyHankelOperator
the operators can now also be non-square.Todo:
to_matrix
rules and tests)