Skip to content

ZeroSpline... add option for constant abscissa step? #34

Open
@BerntLie

Description

@BerntLie

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions