-
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
map SOneTo to SVector #1032
Comments
Looking at the code, I was wondering if using signatures of the type mapreduce(f, op, a::Union{SOneTo,StaticArray}, b::Union{SOneTo,StaticArray}...) would fix this. (The approach of #978 would make this slightly cleaner, instead of hardcoding a concrete type.) I will wait for comments then make a PR. |
This is consistent with julia> map(i -> (a = i, b = i + 1), Base.OneTo(3))
3-element Vector{NamedTuple{(:a, :b), Tuple{Int64, Int64}}}:
(a = 1, b = 2)
(a = 2, b = 3)
(a = 3, b = 4) In this case, given a statically sized axis, we obtain a statically sized mutable vector. |
The issue for me is getting Generally, I found find it consistent if |
I understand, and I do agree that this could be made allocation-free. However, if you specifically want an |
Revisiting this issue: I agree that one should wrap in ERROR: The size of type `SVector` is not known. Would it make sense to have have a conversion method, eg along the lines of SVector(ι::SOneTo{N}) where N = SVector(ntuple(identity, Val(N))) |
I'm occasionally quite annoyed by this behavior. Maybe a partial solution would be to provide a similar constructor as So basically I'm proposing a constructor A related issue is that |
Issue
is an
MVector
, while intuitively (and perhaps incorrectly?) I expected anSVector
.Versions
though discussion in #855 suggests this has been around for a while.
The text was updated successfully, but these errors were encountered: