JuliaMath / JuliaMath/Interpolations.jl
Interpolation of whole matrices with Cubic, Quadratic etc.
- Dominant language
- Julia
- Stars
- 575
- Forks
- 117
- PR merge metrics
- No merged PRs in 30d
Description
Currently this only works with `Linear`:
```julia
julia> data = [[1 2; 3 4], [5 6; 7 8]]
2-element Array{Array{Int64,2},1}:
[1 2; 3 4]
[5 6; 7 8]
julia> itp = interpolate(data, BSpline(Linear()))
2-element interpolate(::Array{Array{Int64,2},1}, BSpline(Linear())) with element type Array{Float64,2}:
[1 2; 3 4]
[5 6; 7 8]
julia> itp[1.0]
2×2 Array{Float64,2}:
1.0 2.0
3.0 4.0
julia> itp[1.1]
2×2 Array{Float64,2}:
1.4 2.4
3.4 4.4
julia> itp = interpolate(data, BSpline(Cubic(Line(OnGrid()))))
ERROR: MethodError: no method matching zero(::Type{Array{Int64,2}})
Closest candidates are:
zero(::Type{Pkg.Resolve.FieldValue}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Pkg/src/Resolve/fieldvalues.jl:38
zero(::Type{DateTime}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Dates/src/types.jl:404
zero(::Type{Measures.Length{:mm,Float64}}) at /home/raf/.julia/packages/Plots/M1wcx/src/layouts.jl:12
...
Stacktrace:
[1] copy_with_padding(::Type{Array{Int64,2}}, ::Array{Array{Int64,2},1}, ::BSpline{Cubic{Line{OnGrid}}}) at /home/raf/.julia/packages/Interpolations/TBuvH/src/b-splines/prefiltering.jl:27
[2] prefilter(::Type{Float64}, ::Type{Array{Int64,2}}, ::Array{Array{Int64,2},1}, ::BSpline{Cubic{Line{OnGrid}}}) at /home/raf/.julia/packages/Interpolations/TBuvH/src/b-splines/prefiltering.jl:39
[3] interpolate(::Type{Float64}, ::Type{Array{Int64,2}}, ::Array{Array{Int64,
2},1}, ::BSpline{Cubic{Line{OnGrid}}}) at /home/raf/.julia/packages/Interpolations/TBuvH/src/b-splines/b-splines.jl:160
[4] interpolate(::Array{Array{Int64,2},1}, ::BSpline{Cubic{Line{OnGrid}}}) at /home/raf/.julia/packages/Interpolations/TBuvH/src/b-splines/b-splines.jl:179
[5] top-level scope at REPL[40]:1
```
Looks like it will need some work in prefiltering to use `zero` on the array A rather than the type TC, when you have a matrix:
https://github.com/JuliaMath/Interpolations.jl/blob/eb5690069a8c5cbe97b6ac2e44f58ea1567bee8d/src/b-splines/prefiltering.jl#L19-L31
I will be able to do this at some stage, just wondering how feasble it is and if I will break other things doing it.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.