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 metadata in Rhai); necessary for running doc-tests | no |
io | enables the read_matrix function but pulls in several additional dependencies | yes |
nalgebra | enables the functions regress, inv, mtimes, horzcat, vertcat, and repmat but pulls in nalgebra and linregress. | yes |
rand | enables the rand function for generating random values and random matrices, but pulls in rand. | 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);