-
Notifications
You must be signed in to change notification settings - Fork 37
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
Traits not forwarded for structured matrix wrappers like Diagonal
#339
Comments
Noticing now that julia> ArrayInterface.ismutable(Diagonal([1.0, 2.0, 3.0]))
true
julia> ArrayInterface.ismutable(Diagonal(SVector(1.0, 2.0, 3.0)))
false Isn't this a bit backwards? |
We can't just automatically forward things to parent wrappers because there are cases where the wrapper type changes unknown behavior. |
Thanks for the response! I understand it's not straightforward, however the current behavior suggests there's been some effort to try to make it work already, albeit incomplete (since forwarding is happening for I haven't spent much time with ArrayInterface, but unless I misunderstand, the idea is that the interface will be implemented by every new array type introduced and supported (ideally this would be done by the developer of the array type, but currently it's mostly you guys). So explicitly fixing |
Right now we end up having to define each method for types in the standard library, so we have to fix it on our end for now. We should probably be more careful about how we forward methods for |
Oh yeah, I didn't mean that the fix should live in Base. Let me reword the last sentence in my previous post for clarity: """ Are you unsure about the desired behavior or just how to implement it without too much hassle/repetition/boilerplate? I don't know your code well enough to have a suggestion about the latter, but the desired behavior seems pretty clear to me: LinearAlgebra's structured matrix wrappers always forward valid |
That reasoning makes enough sense for those types in LinearAlgebra so we can define it for those. It just can't be generalized to all array types. For example, MappedArrays has some types where the transformation isn't invertible. |
@danielwe, if you have a clear enough idea of what you think this should do you could make a PR and I'd be happy to review it. |
ArrayInterface shows
Diagonal{T,<:SVector}
as supportingsetindex!
, which is clearly not true:Should this be fixed somehow? Or is it a misunderstanding of ArrayInterface to think that this would give the correct answer?
The text was updated successfully, but these errors were encountered: