rhai-sci 0.4.0

Scientific computing in the Rhai scripting language
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#[cfg(all(feature = "io", feature = "nalgebra"))]
fn main() -> Result<(), Box<rhai::EvalAltResult>> {
    use rhai::{packages::Package, Array, Engine, Scope};
    use rhai_sci::SciPackage;

    let mut engine = Engine::new();
    engine.register_global_module(SciPackage::new().as_shared_module());
    let observations = engine.eval::<Array>(r#"read_matrix("examples/data/calibration.csv")"#)?;
    let mut scope = Scope::new();
    scope.push("observations", observations);
    engine.run_with_scope(&mut scope, include_str!("regression_workflow.rhai"))
}

#[cfg(not(all(feature = "io", feature = "nalgebra")))]
fn main() {
    eprintln!("This CSV example requires the io and nalgebra features.");
}