Closed timholy closed 5 years ago
So the call tree for getindex(A::AxisArray, w::WeightedIndex) (manually inlining) is
getindex(A, w) -> getindex_converted(A, to_index(A,(w,))...) -> getindex(A, to_index(A,(w,))...) # since to_index returns an
Idx
-> AxisArray(A.data[to_index(A,(w,))...], reaxis(A, to_index(A,(w,))...))
Not quite. to_index
doesn't do anything with WeightedIndex
(it returns it as-is), and Idx
is Union{Colon,Real,AbstractArray{Int}}
. So it takes the getindex_converted(A, idxs...)
path rather than the getindex_converted(A, idxs::Idx...)
path, which means it strips the wrapper.
Do you have an example/test for a kind of specialized index that AxisArrays can't/shouldn't handle?
The test I submitted is one such example. Or is there something that's not covering?
The test I submitted is one such example. Or is there something that's not covering?
Sorry, my mistake not reading closely enough. This looks good to me then.
I was impressed you asked. It's quite difficult to mentally execute dispatch paths as complex as those in this package!
Thanks for the review. I'll leave it open until next Monday; aside from giving others a chance to point out concerns, I'm on vacation and I'd rather not have to deal with fallout from anything I break :wink:.
Ah darn, I forgot about this one or I would have put it in the release.
Never mind though, version numbers are cheap :-)
AxisArrays has to handle many different index types, but it can't handle types defined in other packages. This provides for a fallback mode in which AxisArrays tries to convert "fancy" index types into "regular" ones, but if this fails then it assumes this is something the parent knows how to handle.
Fixes the following error:
I want to give folks a little time to complain about anything this breaks, so I won't merge in the next week. But @ChantalJuntao you can check out this branch.