Skip to main content

regression_workflow/
regression_workflow.rs

1#[cfg(all(feature = "io", feature = "nalgebra"))]
2fn main() -> Result<(), Box<rhai::EvalAltResult>> {
3    use rhai::{packages::Package, Array, Engine, Scope};
4    use rhai_sci::SciPackage;
5
6    let mut engine = Engine::new();
7    engine.register_global_module(SciPackage::new().as_shared_module());
8    let observations = engine.eval::<Array>(r#"read_matrix("examples/data/calibration.csv")"#)?;
9    let mut scope = Scope::new();
10    scope.push("observations", observations);
11    engine.run_with_scope(&mut scope, include_str!("regression_workflow.rhai"))
12}
13
14#[cfg(not(all(feature = "io", feature = "nalgebra")))]
15fn main() {
16    eprintln!("This CSV example requires the io and nalgebra features.");
17}