Skip to content

Commit

Permalink
Merge pull request #17 from cmccomb/master
Browse files Browse the repository at this point in the history
Removal of machine learning to prepare for rhai-ml
  • Loading branch information
cmccomb authored May 14, 2023
2 parents 6580d2f + 72a2c4a commit 55e458d
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 235 deletions.
11 changes: 3 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rhai-sci"
version = "0.1.9"
version = "0.2.0"
edition = "2021"
authors = ["Chris McComb <[email protected]>"]
description = "Scientific computing in the Rhai scripting language"
Expand All @@ -19,10 +19,9 @@ metadata = ["rhai/metadata"]
io = ["polars", "url", "temp-file", "csv-sniffer", "minreq"]
nalgebra = ["nalgebralib", "linregress"]
rand = ["randlib"]
smartcore = ["smartcorelib", "bincode"]

[dependencies]
rhai = "1.8"
rhai = ">=1.8.0"
nalgebralib = {version = "0.32.1", optional = true, package = "nalgebra" }
polars = {version = "0.27.2", optional = true }
url = {version = "2.2.2", optional = true }
Expand All @@ -32,11 +31,9 @@ minreq = { version = "2.6.0", features = ["json-using-serde", "https"], optional
randlib = { version = "0.8", optional = true, package = "rand" }
smartstring = "1.0.1"
linregress = { version = "0.5.0", optional = true }
smartcorelib = {version = "0.3.0", optional = true, package = "smartcore", features=["serde"]}
bincode = { version = "1.3.3", optional = true }

[build-dependencies]
rhai = "1.8"
rhai = ">=1.8.0"
nalgebralib = {version = "0.32.1", optional = true, package = "nalgebra" }
polars = {version = "0.27.2", optional = true }
url = {version = "2.2.2", optional = true }
Expand All @@ -48,8 +45,6 @@ serde_json = "1.0.82"
serde = "1.0.140"
smartstring = "1.0.1"
linregress = { version = "0.5.0", optional = true }
smartcorelib = {version = "0.3.0", optional = true, package = "smartcore", features=["serde"]}
bincode = { version = "1.3.3", optional = true }

[package.metadata.docs.rs]
all-features = true
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,4 @@ let value = engine.eval::<INT>("argmin([43, 42, -500])").unwrap();
| `metadata` | Disabled | Enables exporting function metadata and is ___necessary for running doc-tests on Rhai examples___. |
| `io` | Enabled | Enables the [`read_matrix`](#read_matrixfile_path-string---array) function but pulls in several additional dependencies (`polars`, `url`, `temp-file`, `csv-sniffer`, `minreq`). |
| `nalgebra` | Enabled | Enables several functions ([`regress`](#regressx-array-y-array---map), [`inv`](#invmatrix-array---array), [`mtimes`](#mtimesmatrix1-array-matrix2-array---array), [`horzcat`](#horzcatmatrix1-array-matrix2-array---array), [`vertcat`](#vertcatmatrix1-array-matrix2-array---array), [`repmat`](#repmatmatrix-array-nx-i64-ny-i64---array), [`svd`](#svdmatrix-array---map), [`hessenberg`](#hessenbergmatrix-array---map), and [`qr`](#qrmatrix-array---map)) but brings in the `nalgebra` and `linregress` crates. |
| `rand` | Enabled | Enables the [`rand`](#rand) function for generating random FLOAT values and random matrices, but brings in the `rand` crate. |
| `smartcore` | Enabled | Enables the [`eigs`](#eigsmatrix-array---map), [`train`](#trainx-array-y-array-algorithm-string---model), and [`predict`](#predictx-array-model-model---array) functions, but brings in the `smartcore` and `bincode` crates. |
| `rand` | Enabled | Enables the [`rand`](#rand) function for generating random FLOAT values and random matrices, but brings in the `rand` crate. |
6 changes: 2 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {

// Make empty file for documentation and tests
std::fs::File::create(std::env::var("OUT_DIR").unwrap() + "/rhai-sci-docs.md").unwrap();
std::fs::File::create("tests/rhai-sci-tests.rs").unwrap();
std::fs::File::create(std::env::var("OUT_DIR").unwrap() + "/rhai-sci-tests.rs").unwrap();
}

#[cfg(feature = "metadata")]
Expand Down Expand Up @@ -40,7 +40,7 @@ fn main() {
std::fs::File::create(std::env::var("OUT_DIR").unwrap() + "/rhai-sci-docs.md").unwrap();

// Make a file for tests
let mut test_file = std::fs::File::create("tests/rhai-sci-tests.rs").unwrap();
let mut test_file = std::fs::File::create(std::env::var("OUT_DIR").unwrap() + "/rhai-sci-tests.rs").unwrap();

// Build an engine for doctests
let mut engine = Engine::new();
Expand All @@ -57,7 +57,6 @@ fn main() {
combine_with_exported_module!(&mut lib, "rhai_sci_sets", set_functions);
combine_with_exported_module!(&mut lib, "rhai_sci_moving", moving_functions);
combine_with_exported_module!(&mut lib, "rhai_sci_validate", validation_functions);
combine_with_exported_module!(&mut lib, "rhai_sci_machine_learing", ml_functions);
engine.register_global_module(rhai::Shared::new(lib));

// Extract metadata
Expand Down Expand Up @@ -214,7 +213,6 @@ mod functions {
include!("src/moving.rs");
include!("src/validate.rs");
include!("src/patterns.rs");
include!("src/machine_learning.rs");
}

#[cfg(feature = "metadata")]
Expand Down
2 changes: 1 addition & 1 deletion src/cumulative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub mod cum_functions {
/// ```
#[rhai_fn(name = "cumtrapz", return_raw, pure)]
pub fn cumtrapz_unit(y: &mut Array) -> Result<Array, Box<EvalAltResult>> {
crate::if_list_convert_to_vec_float_and_do(y, |yf| {
if_list_convert_to_vec_float_and_do(y, |yf| {
let mut trapsum = 0.0 as FLOAT;
let mut cumtrapsum = vec![Dynamic::FLOAT_ZERO];
for i in 1..yf.len() {
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ mod sets;
use sets::set_functions;
mod validate;
use validate::validation_functions;
mod machine_learning;
use machine_learning::ml_functions;

def_package! {
/// Package for scientific computing
Expand All @@ -45,7 +43,6 @@ def_package! {
combine_with_exported_module!(lib, "rhai_sci_sets", set_functions);
combine_with_exported_module!(lib, "rhai_sci_moving", moving_functions);
combine_with_exported_module!(lib, "rhai_sci_validation", validation_functions);
combine_with_exported_module!(lib, "rhai_sci_machine_learing", ml_functions);
}
}

Expand Down
163 changes: 0 additions & 163 deletions src/machine_learning.rs

This file was deleted.

Loading

0 comments on commit 55e458d

Please sign in to comment.