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
Block assemble (and ZeroOperator) #285
Conversation
Hi @pmli, thanks for your work! Could you explain why you changed the internal representation of BlockOperator from sparse to dense? Personally, I have no strong opinion on this, but one has to keep in mind that @ftalbrecht has a use case were one has hundreds (or more) blocks and the operator has a sparse structure. So there might be some performance drawbacks. @ftalbrecht is currently on vacation, so we should probably wait until he as returned. Regarding ZeroOperator.assemble_lincomb: The |
Hi @sdrave, thanks for comments! I changed the internal representation purely for the ease of implementation. I expected @ftalbrecht would have something to say about this. Concerning performance, I'm not sure if any representation is significantly better for bigger, sparser block-matrices. In both cases, every method has to traverse all the blocks... My suggestion would be using SciPy sparse matrices instead of NumPy arrays for such cases. About |
Use len_ind to simplify code.
It no longer returns None for a longer list of ZeroOperators.
- Nones in self._blocks are replaced by ZeroOperators - add apply and apply_adjoint to BlockDiagonalOperator - improve docs
I agree, that if the |
Mhm, I am not to happy with a dense representation. I have use-cases where I have a quite sparse structure of only few blocks per row. In that case iterating over the sparse blocks is already nearly as costly as the individiual operations on the operators. I would think that adding So long story short: I think we need a sparse |
To my surprise, it seems SciPy sparse matrices do not support object dtype. So, we do need an ad hoc sparse format. I could revert to the previous implementation, but I'm not sure if NumPy 2D array with operators and Nones is "good enough". For a large number of block rows and columns, a memory overflow could occur. Even if it all fits in RAM, iterating over the 2D array and checking @sdrave Should I include the changes from #299 here or in a different pull request? |
Regarding the sparse version, I would say we will find a solution (implementation) when this is really needed, @ftalbrecht? #299 should be merged by tomorrow. I would say it is perfectly fine if you merge master into this pull request branch and make the changes in an additional commit ... |
Looks ready to merge. @ftalbrecht, is it ok to stick with this dense implementation for now and reimplement a sparse version when needed? |
Yes. |
@pmli, anything you still want to change? Otherwise we can merge .. |
No. Maybe we can add more tests for assemble methods later. |
@pmli, you're right, the |
See #307 regarding the tests. |
ZeroOperator
:apply_adjoint
(Add missing methods in operators.constructions #188)assemble_lincomb
BlockOperator
,BlockDiagonalOperator
:assemble
andassemble_lincomb
None
a are replaced byZeroOperators
...)