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
AbstractDimStack <: AbstractArray
#576
Comments
I largely support the idea. However, I think this raises a few questions:
|
A = (x -> x.a * x.b).(st) .* C Which is different to A = st.a .* st.b .* C Because it will handle mixed-size layers. But yes its a little clunky accessing nested values in broadcasts. |
Probably a Dictionaries.jl See: andyferris/Dictionaries.jl#43 We really need |
For InferenceObjects.jl, we for the most part ignore that |
It would be a huge relief if 1.11 can address the compilation issue with
That makes sense and would work well enough in general. However, would it be possible to return an |
The idea came up trying to write
rand
samplers forAbstractDimStack
.Why isn't an
AbstractDimArray
anAbstractArray{<:NamedTuple}
?With
rand
, we would always want the sampler to return aNamedTuple
of values from each layer. But what does that mean with mixed-size layers? Currently indexing aDimStack
with a linearInt
doesn't do something sensible - it just indexes every layer at the same index inmap
. We should instead treat aDimStack
exactly like theDimTable
it can be unrolled into. Linear indexing aDimStack
should always give the same value as indexing a row of itsDimTable
- that is it really indexes with:I had actually forgotten that it doesn't do that already and consider it almost a bug. When all layers are the same size there will be no difference, and we can still just use regular linear indexing on all layers.
With that change
DimStack
can basically be anAbstractArray
. This meansrand
will work already without adding a sampler, andbroadcast
and iteration will also "just work", closing #412.The main breaking change is to
map
that currently works over stackArray
layers, notNamedTuple
values. We will need to replace it with e.g.maplayers
. This will need a lot of changes here and also in Rasters.jl. So probably in other packages too.Any thoughts @sethaxen @felixcremer @JoshuaBillson ?
The text was updated successfully, but these errors were encountered: