Skip to content

Instantly share code, notes, and snippets.

@simonbyrne
Created June 3, 2015 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simonbyrne/b511ea9f368b7b9065bc to your computer and use it in GitHub Desktop.
Save simonbyrne/b511ea9f368b7b9065bc to your computer and use it in GitHub Desktop.
Test performance of interpolations
# based on https://github.com/tlycken/Interpolations.jl/pull/37
Pkg.checkout("Interpolations", "master")
Pkg.checkout("Ratios", "checked")
using Interpolations, Grid
A = rand(300,300,30);
itp = interpolate!(copy(A), BSpline(Quadratic(Flat)), OnCell);
yi = InterpGrid(copy(A), BCreflect, InterpQuadratic);
function interp_all!(dest, itp)
for k = 1:size(itp,3)
for j = 1:size(itp,2)
for i = 1:size(itp,1)
dest[i,j,k] = itp[i,j,k]
end
end
end
dest
end
B = similar(A);
# warmup
@time interp_all!(B, itp);
@time interp_all!(B, yi);
@time interp_all!(B, itp);
@time interp_all!(B, yi);
@time interp_all!(B, itp);
@time interp_all!(B, yi);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment