Breaking: better DimStack indexing, again #689
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds type parameters
K,T,N
to stacks for better dispatch and type stabiity in both Array-like and NamedTuple-lke behaviors.It it incliudes a bunch of performance fixes and more complete tests.
Pacakges extending
AbstractDimStack{L}
will now need to extendAbstractDimStack{K,T,N,L}
. There are new helper methodsstacktype
anddata_eltype
to help getting these paremeters.data_eltype
can be extended for alternate stack data objects besidesNamedTuple
.There is also a new standard behavour: indexing with dimensional objects like a vector of dimension tuples will do a
mergedims
, because you can index a subset of the dimensions. But indexing withcolon
or Vector of Int/CartesianIndex will return a raw vector of NamedTuple, not a mergedims DimStack - so there is a way to avoid the overhead of buiding the merged lookups.@sethaxen this will require some changes to Arviz, maybe you want to review. It would be good to make sure I've covered everything and don't need to make any more breaking changes.