-
Notifications
You must be signed in to change notification settings - Fork 7
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
Indexing ComMatrix #22
Comments
Oh, thanks, yes I think i abandoned those over using |
I see a number of ways to change this, but let me ask you: what would you expect to get from |
To be honest, I hadn't considered the case of indexing a range. I can definitely see this going either way, though I think retaining the |
I certainly agree about the julia> a = [1 2; 3 4]
2×2 Array{Int64,2}:
1 2
3 4
julia> @view a[1,2]
0-dimensional SubArray{Int64,0,Array{Int64,2},Tuple{Int64,Int64},false}:
2 does return an array. I don't feel strongly about |
I like the idea of having straight indexing return the underlying value/matrix, while |
My preference would be that if we have some way of indexing returning another |
Thanks guys, that's helpful. After thinking about it I think it makes the most sense to have ComMatrix behave like a regular Array (which involves dropping dimensions, in this case that means returning a scalar when indexing for a single value but otherwise returning a ComMatrix). It doesn't currently inherit from AbstractArray, but that may change in the future if we redefine ComMatrix as a particular parametrization of an AxisArray as discussed here EcoJulia/Diversity.jl#23 (comment) I'll make the PR here. |
This came up a couple of times as I was trying to revamp Microbiome.jl - the
getindex()
function defined here doesn't seem to work, or at least doesn't work as I expected it to:This also seems to break
setindex!()
as far as I can tell.The text was updated successfully, but these errors were encountered: