Skip to content
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

Always use similar as fallback when resize throws in applying composite maps #221

Merged
merged 4 commits into from
Jan 31, 2024

Conversation

krcools
Copy link
Contributor

@krcools krcools commented Jan 25, 2024

When using subtypes of AbstractVector that do not support resize! (such as BlockArrays.PseudoBlockVector), the memory optimisation in the _unsafe_mul! for composite maps result in errors.

I have changed _resize to allways fall back to memory allocation via similar, whereas previously this only happened when the argument was a SharedArrays.SharedVector.

Copy link

codecov bot commented Jan 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4c95579) 99.68% compared to head (010ca9c) 99.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #221      +/-   ##
==========================================
- Coverage   99.68%   99.68%   -0.01%     
==========================================
  Files          22       22              
  Lines        1591     1589       -2     
==========================================
- Hits         1586     1584       -2     
  Misses          5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dkarrasch
Copy link
Member

LGTM. Do you have a quick test case at hand? I believe we have BlockArrays.jl in our test dependencies anyway.

@krcools
Copy link
Contributor Author

krcools commented Jan 25, 2024

I have added a test with a triple product of LinearMaps over BlockArrays in nontradaxes.jl

@dkarrasch
Copy link
Member

It turns out that it requires four maps to hit that _resize path. 😄

@dkarrasch dkarrasch merged commit 2b43953 into JuliaLinearAlgebra:master Jan 31, 2024
10 of 13 checks passed
@dkarrasch
Copy link
Member

Thanks! That's a clear improvement, since otherwise there was no way to get this to work, right?

@krcools
Copy link
Contributor Author

krcools commented Jan 31, 2024

It turns out that it requires four maps to hit that _resize path. 😄

Thank you, I missed that the triple product would return before _resize got hit.

Thanks! That's a clear improvement, since otherwise there was no way to get this to work, right?

I think so, that was my motivation to submit the PR. A better solution is probably to implement _resize only for Vector, as I understand from the Julia coding recommendations that exception handling is rather expensive...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants