-
Notifications
You must be signed in to change notification settings - Fork 69
provide sub to override AA #2194
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
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2194 +/- ##
==========================================
+ Coverage 88.17% 88.21% +0.03%
==========================================
Files 99 99
Lines 37177 37087 -90
==========================================
- Hits 32782 32716 -66
+ Misses 4395 4371 -24 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5800a6e to
e04724e
Compare
|
@lgoettgens we cleaned it up (similar to your suggestions). |
lgoettgens
left a comment
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.
Looks good, thanks! Two comments below
a110b89 to
f2fee53
Compare
src/matrix.jl
Outdated
| # make x[r, c] sugar for sub(x, r, c) | ||
| getindex(x::_MatTypes, r::AbstractVector{Int}, c::AbstractVector{Int}) = sub(x, r, c) |
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.
Note that AA defines https://github.com/Nemocas/AbstractAlgebra.jl/blob/a2325de25fea847b16780935803a30ee84582443/src/Matrix.jl#L476, i.e. the delegation goes from sub to getindex already. This means that this line is superfluous, and the other two special cases should be added to getindex instead.
| # make x[r, c] sugar for sub(x, r, c) | |
| getindex(x::_MatTypes, r::AbstractVector{Int}, c::AbstractVector{Int}) = sub(x, r, c) |
| function sub(x::$T, r::AbstractUnitRange{Int}, c::AbstractUnitRange{Int}) | ||
| return deepcopy(view(x, r, c)) | ||
| end | ||
|
|
||
| function sub(M::$T, r::AbstractVector{Int}, c::AbstractVector{Int}) |
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.
| function sub(x::$T, r::AbstractUnitRange{Int}, c::AbstractUnitRange{Int}) | |
| return deepcopy(view(x, r, c)) | |
| end | |
| function sub(M::$T, r::AbstractVector{Int}, c::AbstractVector{Int}) | |
| function getindex(x::$T, r::AbstractUnitRange{Int}, c::AbstractUnitRange{Int}) | |
| return deepcopy(view(x, r, c)) | |
| end | |
| function getindex(M::$T, r::AbstractVector{Int}, c::AbstractVector{Int}) |
|
Nevermind, my suggestions contradict with the implementations in Nemo. I think, the cleanest solution would be to switch the delegation direction in AA and then keep everything here as is (just removing the last two lines as they then coincide with AA) |
|
Hm, yeah, there is also still something off. I agree that eventually we should swap it around in AA (make |
|
I'd like to make a "breaking" AA release soon (this week, before Christmas?) for other reasons. If someone can make a PR for the AA change discussed here "soonish", it could perhaps also get into that AA release? |
No description provided.