rsl-interpolation 0.1.19

A re-write of GSL's Interpolation Routines in Rust.
Documentation
mod common;

use common::*;
use rsl_interpolation::*;

#[test]
fn gsl_linear() {
    let xa = [0.0, 1.0, 2.0, 3.0];
    let ya = [0.0, 1.0, 2.0, 3.0];

    let spline = Spline::build::<LinearInterpolator>(&xa, &ya).unwrap();

    let xtest = [0.0, 0.5, 1.0, 1.5, 2.5, 3.0];
    let ytest = [0.0, 0.5, 1.0, 1.5, 2.5, 3.0];
    let dytest = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0];
    let iytest = [0.0, 0.125, 0.5, 9.0 / 8.0, 25.0 / 8.0, 9.0 / 2.0];

    let test_e_table = XYTable {
        x: &xtest,
        y: &ytest,
    };

    let test_d_table = XYTable {
        x: &xtest,
        y: &dytest,
    };

    let test_i_table = XYTable {
        x: &xtest,
        y: &iytest,
    };

    assert_eq!(
        spline.eval_deriv2(1.5, &mut Accelerator::new()).unwrap(),
        0.0
    );

    test_spline(test_e_table, test_d_table, test_i_table, spline);
}