-
Notifications
You must be signed in to change notification settings - Fork 42
add mulstyle feature #76
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
Conversation
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 think this looks really nice!
One could think of replacing
https://github.com/Jutho/LinearMaps.jl/blob/e2cb3a13fc4d2dac9e7f6f78d0a2bee66cccb91f/src/linearcombination.jl#L104-L110
with something like
An = A.maps[n]
muladd!(mulstyle(An), y, An, x, z)
and then introduce the functions
muladd!(::FiveArg, y, A, x, _) = mul!(y, A, x, true, true)
function muladd!(::ThreeArg, y, A, x, z)
A_mul_B!(z, A, x)
y .+= z
end
but that is stylish nit-picking.
Codecov Report
@@ Coverage Diff @@
## master #76 +/- ##
==========================================
+ Coverage 96.1% 96.13% +0.03%
==========================================
Files 10 10
Lines 616 621 +5
==========================================
+ Hits 592 597 +5
Misses 24 24
Continue to review full report at Codecov.
|
@jagot Many thanks for your quick review. I took some structure from another pending PR and merged it here. As I said in #75, we can get rid of the mul!(y, ::TransposeMap{<:Any,<:SomeMap}, x [, alpha, beta]) or (for free) via invariance of the map type under adjoint/transpose transpose(::SomeMap) = SomeMap(...) |
With the new changes, I am even more happy! |
Now I have again the issue that locally tests pass, both when I run the |
I ran the test suite, but I did not see any allocations reported. Where do I find those? |
They pop up on Travis. Good to have confirmation that they don't occur locally. On my other PR, I get failing zero-allocation tests when testing in pkg-mode, but not when I run the test script simply as a file. |
@Jutho Will you be able to find some time for a quick review the next days? This one should be relatively easy. |
Thanks for the reminder, I'll try to find some time tonight. Any other PRs which are ready for review? To what extent is introducing a |
Great! I'd say these things are orthogonal. The mulstyle helps to elegantly check whether there exists an allocation-free 5-arg I'll give a brief update on the other PRs in their respective threads. |
refactor linear combination multiplication try to get rid of allocations in lincomb mul show coefficients more details in uniform scaling mul opt-out of allocation testing fix mulstyle error in kronecker, improve coverage
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.
Approved, but I gave some suggestions, none truly essential, just in case you want more programming fun! :-)
I'll give the allocation testing a try once more. I think I'll rename all multiplication helper functions to |
Seems like the allocation issue had something to do with my unclean handling of types vs singleton instances and whatnot. Once tests pass, I'll merge. I'd suggest to have #72 in and then (finally) release v2.6. Since removal of |
Closes #75. @jagot
This adds the
mulstyle
trait toLinearMaps.jl
and some tests.