-
Notifications
You must be signed in to change notification settings - Fork 150
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
static interface for permutedims #806
Comments
Good idea, although for full type stability you need to encode the entire permutation in the type, such as struct StaticPermutation{Permutation<:Tuple}
end and then have something like |
Agreed, we should have It may also make logical sense to have the permutation as a kind of struct StaticPermutation{N,Permutation<:NTuple{N,Int}} <: StaticVector{N,Int}
end but the extra |
I think this is where StaticNumbers.jl is useful. Something like OTOH, using |
Great observation, I'd forgotten about StaticNumbers.jl.
Completely agreed about it being a hack. This hack was used in the old const SVector{S, T} = SArray{Tuple{S}, T, 1, S} Without being able to do this we previously had SVector a completely separate type from SArray. |
How about const SVector{S, T} = SArray{1, Tuple{StaticInteger{S}}, T, S} with struct SArray{N, S <: NTuple{N,StaticInteger}, T, L}
data::NTuple{L,T}
size::S
end ? |
That's 2.0 material for sure (or even material for a separate But other than that 💯 — I think you're right and discussing this deserves an issue of its own. One thing which has long bothered me is the inability to use |
Yeah, I agree that's the hardest problem.
I'm actually OK with |
Would you keep maintaining |
Yes, exactly - the thought would be to decouple the upgrade process between packages across the ecosystem, as the concrete type name would be spelled differently and this would just break all the things. But a big split is not great; perhaps we can have a transition plan where we transition users to never spelling out the concrete type names, as mentioned in #807 (comment). |
While I fully agree with If that's OK, I would just submit a PR implementing this feature following the suggestion of @mateuszbaran, and this can be changed later on when the whole package is refactored. |
Of course @tpapp we don't expect you to solve the long-standing design issues for one small feature. If we do take a StaticNumbers dependency we can easily deprecate Base.permutedims(sa::StaticArray, perm::NTuple{N,StaticInteger}) where {N} so that usage would become This suggest we don't want |
I would like to contribute an implementation for
permutedims
, but first I would like to ask for suggestions about the interface.In particular, it would be ideal if one could encode the permutation statically. I could imagine a
type and an interface like
but I am interested in suggestions if there is a better solution.
The text was updated successfully, but these errors were encountered: