// Linearly interpolate between sorted strictly increasing knots, extending constant values past both ends. Supply matching nonempty arrays. pub fn piecewise_interp(xs: vector, ys: vector, point: f64) -> f64 { if len(xs)==0 || len(xs)!=len(ys) { return 0.0; } if point <= at(xs,0) { return at(ys,0); } let mut i = 1; while i