ip <- function(z) approxfun(1:length(z),z,rule=2)(1:length(z))