rhai-sci: Functions for Scientific Computing
rhai-sci is an independent Rhai package that provides functions useful for
scientific computing, inspired by languages like MATLAB, Octave, and R.
See https://docs.rs/rhai-sci for the list of functions.
On
crates.io:rhai-sciOn
GitHub:rhaiscript/rhai-sciPackage name:
SciPackage
Dependency
Cargo.toml:
[dependencies]
rhai = "1.23.0"
rhai-sci = "0.1"       # use rhai-sci crate
Features
| Feature | Description | Default? | 
|---|---|---|
| metadata | enables functions metadata (turns on metadatain Rhai); necessary for running doc-tests | no | 
| io | enables the read_matrixfunction but pulls in several additional dependencies | yes | 
| nalgebra | enables the functions regress,inv,mtimes,horzcat,vertcat, andrepmatbut pulls innalgebraandlinregress. | yes | 
| rand | enables the randfunction for generating random values and random matrices, but pulls inrand. | yes | 
Load Package into Engine
use rhai::Engine;
use rhai::packages::Package;    // needed for 'Package' trait
use rhai_sci::SciPackage;
let mut engine = Engine::new();
// Create new 'SciPackage' instance
let sci = SciPackage::new();
// Load the package into the [`Engine`]
sci.register_into_engine(&mut engine);