-
Notifications
You must be signed in to change notification settings - Fork 113
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
Handle non-interpolating dimensions and improve in-place interpolation #45
Conversation
In the same way as a matrix can be viewed as a collection of column vectors, this allows a matrix to be viewed as a collection of column-interpolants. Compared to just using Constant, the main motivation for a new type is for specifying the number of gradient components.
This allows evaluation all the way to the boundary, preserving the on-grid values.
How do you feel about the last commit? (The |
Any more thoughts about this series of PRs? It's not urgent to get them merged, but I am starting to use this functionality heavily in my own code tree. |
Sorry, meant to come back to this earlier but other things came in the way. As can be expected when you're the committer, the work is splendid. It works really well :) I'm not entirely happy with the need to construct dimspecs as e.g. There are also a few constructor methods missing, but they can be added after merging these PR's without any problems, so they don't have to be blocking - but for example, I'd like to see With regards to |
Understood. Eventually julia> immutable Foo{T} end
julia> f = Foo{Tuple{Int,Float64}}()
Foo{Tuple{Int64,Float64}}()
julia> f = Foo{(Int,Float64)}()
ERROR: TypeError: apply_type: in Foo, expected Type{T}, got Tuple{DataType,DataType}
julia> Foo(t::Tuple) = Foo{Base.to_tuple_type(t)}()
Foo{T}
julia> f = Foo((Int,Float64))
Foo{Tuple{Int64,Float64}}() This may also partially address your constructor issue. Assuming you want to do this (rather than just wait for I will also write something for the LaTeX document; agreed that this is important. I'll try to get that done this weekend. |
I should add that we still need to preserve the "proper" julia> foo{T}(::Type{T}) = Foo{T}()
foo (generic function with 1 method)
julia> foo{T<:Tuple}(t::T) = Foo(t)
foo (generic function with 2 methods)
julia> function myfunc1()
f = foo(Tuple{Int,Float64})
nothing
end
myfunc1 (generic function with 1 method)
julia> function myfunc2()
f = foo((Int,Float64))
nothing
end
myfunc2 (generic function with 1 method)
julia> @code_warntype myfunc1()
Variables:
f::Foo{Tuple{Int64,Float64}}
Body:
begin # none, line 2:
f = $(Expr(:new, Foo{Tuple{Int64,Float64}})) # line 3:
return nothing
end::Void
julia> @code_warntype myfunc2()
Variables:
f::Foo{T}
Body:
begin # none, line 2:
GenSym(0) = (top(tuple))(Int,Float64)::Tuple{DataType,DataType}
f = call((top(apply_type))(Foo,((top(getfield))(Base,:to_tuple_type))(GenSym(0))::Union{Type{_<:Tuple{Any,Any}},Tuple{DataType,DataType}})::Type{_<:Foo{T}})::Foo{T} # line 3:
return nothing
end::Void (too bad the red syntax highlighting doesn't show up here). |
Well, if we can't get proper type inference without constructing tuples using Looking forward to the math docs! :) |
OK, I've added the math docs, as well as our first test for multivalued interpolation. (The latter should be useful as a reference for anyone who wants to implement the required interface.) |
Oh, and can I ask you to re-run pdflatex on the file? I don't have biber, and the installation would eat up a lot of my little remaining hard-drive space 😦. (The curse of using an SSD on a machine that you have a lot of data stored on...) |
Bump. Barring any complaints, I will merge this shortly. We'll also need a big doc update (which I think can be done after this gets merged). Would you prefer to keep most of the documentation in the IJulia notebook, and make the README minimalistic? In a sense the README could be a summary of what's available, now that julia> using Interpolations
julia> ?Interpolations dumps the README contents. So I've begun to think that it might be good to keep the README as an "API reminder" for people who already understand the package, and the IJulia notebook as an introduction to the package. |
Fine with me :) As far as documentation goes, I just opened #46. |
Handle non-interpolating dimensions and improve in-place interpolation
See the comments at the top of the last two commits. (Built on top of #44, so the first 4 commits are redundant.)