-
Notifications
You must be signed in to change notification settings - Fork 109
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
Vector-valued evaluation #24
Comments
Agreed. This is really exciting! |
Is there any way to do this into a pre-allocated array? (Do we want to?) If so, what should the method signature look like? |
It could look like this:
There are some models of this in |
Nice! I ended up using a promotion rule like this to define the array: eval(ngenerate(:N, :(Array{T, N}), :(getindex{T,N,TCoefs}(itp::Interpolation{T,N,TCoefs,$IT,$EB}, x::NTuple{N,Any}...)),
N->quote
Tout = promote_type(T, map(eltype, @ntuple $N x)...)
dest = Array(T, map(length, @ntuple $N x)...)
getindex!(dest, itp, x...)
end
)) However, I couldn't use the same expression to define the return type (that's why the above says Also, when trying to resolve all the ambiguity errors, I want to @nsplat 2:Base.Cartesian.CARTESIAN_DIMS getindex{T,N,...}(itp::Interpolation{T,N,...}, x::Union(Real,AbstractVector)) = error("...") but of course |
You can cascade calls:
|
Leaving that here (as a mental note to myself, mostly, so I can see if I can take a stab at this if I get some quality Julia time this weekend 😄 ): With JuliaLang/julia#10525 this is basically done - |
+1 for vector indexing (and stopgap warnings that it's not supported yet). In Julia 0.5.0 or 0.5.1 it seems to work for an interpolator from Here's the test:
|
Looking at #5, this is one of very few things left to do before we might call ourselves ready for a version 0.1.
I still think this makes sense only in a multi-linear context; the following is probably a good method definition for that:
Of course, it's going to have to be more specific in order to avoid ambiguity errors. I'm thinking we might not have to specify the type of the vector elements at all - we'll get method errors in the next stage anyway, if the user supplies some nonsensical index vector.
The text was updated successfully, but these errors were encountered: