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-sci

On GitHub: rhaiscript/rhai-sci

Package name: SciPackage



rhai = "1.11.0"
rhai-sci = "0.1"       # use rhai-sci crate


metadataenables functions metadata (turns on metadata in Rhai); necessary for running doc-testsno
ioenables the read_matrix function but pulls in several additional dependenciesyes
nalgebraenables the functions regress, inv, mtimes, horzcat, vertcat, and repmat but pulls in nalgebra and linregress.yes
randenables 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);