Open
Description
For the case that the step size in the abscissa is constant, the following zero_hold
interpolant is some 150 times faster than ZeroSpline
-- on a test case. However, I'm no super coder, so my code uses some 7 times more memory on my test case.
function zero_hold(x,dx,y)
if x < 0
return y[1]
elseif x >= length(y)*dx
return y[end]
else
return y[trunc(Int,x/dx)+1]
end
end
The added speed is important (my test case is not that important -- I used a simple sinus function). But because of added memory use, in practice my code is slower when used in an ODE solver (due to garbage collection).
Would it be possible to extend the ZeroSpline
interpolant to allow for constant abscissa step? With your coding expertise -- can you make it memory efficient, too? That would be super!
Metadata
Metadata
Assignees
Labels
No labels