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.

On crates.io: rhai-sci

On GitHub: rhaiscript/rhai-sci

Package name: SciPackage

Dependency

Cargo.toml:

[dependencies]
rhai = "1.8.0"
rhai-sci = "0.1"       # use rhai-sci crate

Features

FeatureDescriptionDefault?
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 pull in nalgebra and linregress.yes
randenables the rand function for generating random values and random matrices, but brings in the rand library.yes

Load Package into Engine

use rhai::Engine;
use rhai::packages::Package;    // needed for 'as_shared_module'
use rhai_sci::SciPackage;

let mut engine = Engine::new();

// Create new 'SciPackage' instance
let sci = SciPackage::new();

// Load the package
engine.register_global_module(sci.as_shared_module());

Package Functions

See https://docs.rs/rhai-sci for details.