Skip to content

Commit

Permalink
Ver 0.37.7
Browse files Browse the repository at this point in the history
- Update pyo3
- Update README
  • Loading branch information
Axect committed Jul 5, 2024
2 parents fd5127b + a5f3649 commit ffb9964
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "peroxide"
version = "0.37.6"
version = "0.37.7"
authors = ["axect <[email protected]>"]
edition = "2018"
description = "Rust comprehensive scientific computation library contains linear algebra, numerical analysis, statistics and machine learning tools with farmiliar syntax"
Expand All @@ -20,7 +20,7 @@ maintenance = { status = "actively-developed" }
float-cmp = "0.9"

[dependencies]
csv = { version = "1.3", optional = true, default_features = false }
csv = { version = "1.3", optional = true, default-features = false }
rand = { version = "0.8", features = ["small_rng"] }
rand_distr = "0.4"
order-stat = "0.1"
Expand All @@ -31,8 +31,8 @@ peroxide-num = "0.1"
anyhow = "1.0"
paste = "1.0"
#num-complex = "0.3"
netcdf = { version = "0.7", optional = true, default_features = false }
pyo3 = { version = "0.21", optional = true, features = ["auto-initialize", "gil-refs"] }
netcdf = { version = "0.7", optional = true, default-features = false }
pyo3 = { version = "0.22", optional = true, features = ["auto-initialize", "gil-refs"] }
blas = { version = "0.22", optional = true }
lapack = { version = "0.19", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ Peroxide can do many things.
- Cubic Hermite Spline
- Estimate slope via Akima
- Estimate slope via Quadratic interpolation
- B-Spline (incomplete)
- Uniform Cubic B-Spline basis function
- B-Spline
- Non-linear regression
- Gradient Descent
- Levenberg Marquardt
Expand Down Expand Up @@ -312,7 +311,7 @@ How's that? Let me know if there's anything else you'd like me to improve!

## Latest README version

Corresponding to `0.37.1`
Corresponding to `0.37.7`

## Pre-requisite

Expand Down Expand Up @@ -408,7 +407,7 @@ Corresponding to `0.37.1`
- [ode.rs](src/numerical/ode.rs) : Main ODE solver with various algorithms
- [optimize.rs](src/numerical/optimize.rs) : Non-linear regression
- [root.rs](src/numerical/root.rs) : Root finding
- [spline.rs](src/numerical/spline.rs) : Cubic spline & Cubic Hermite spline
- [spline.rs](src/numerical/spline.rs) : Cubic spline, Cubic Hermite spline & B-Spline
- [utils.rs](src/numerical/utils.rs) : Utils to do numerical things (e.g. jacobian)
- __prelude__ : Prelude for using simple
- [mod.rs](src/prelude/mod.rs)
Expand Down
6 changes: 6 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Release 0.37.7 (2024-07-05)

- Bump `pyo3` dependency to `0.22`
- Fix plot functions to be compatible with `pyo3`
- Add B-Spline to README

# Release 0.37.6 (2024-06-19)

## Huge Spline Change
Expand Down
26 changes: 13 additions & 13 deletions src/util/plot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,23 +494,23 @@ impl Plot for Plot2D {
let plot_type = self.plot_type.clone();

// Global variables to plot
let globals = vec![("plt", py.import("matplotlib.pyplot")?)].into_py_dict(py);
globals.set_item("x", x)?;
globals.set_item("y", ys)?;
globals.set_item("pair", pairs)?;
globals.set_item("n", y_length)?;
globals.set_item("p", pair_length)?;
let globals = vec![("plt", py.import_bound("matplotlib.pyplot")?)].into_py_dict_bound(py);
globals.as_gil_ref().set_item("x", x)?;
globals.as_gil_ref().set_item("y", ys)?;
globals.as_gil_ref().set_item("pair", pairs)?;
globals.as_gil_ref().set_item("n", y_length)?;
globals.as_gil_ref().set_item("p", pair_length)?;
if let Some(fs) = fig_size {
globals.set_item("fs", fs)?;
globals.as_gil_ref().set_item("fs", fs)?;
}
globals.set_item("dp", dpi)?;
globals.set_item("gr", grid)?;
globals.set_item("pa", path)?;
globals.as_gil_ref().set_item("dp", dpi)?;
globals.as_gil_ref().set_item("gr", grid)?;
globals.as_gil_ref().set_item("pa", path)?;
if let Some(xl) = self.xlim {
globals.set_item("xl", xl)?;
globals.as_gil_ref().set_item("xl", xl)?;
}
if let Some(yl) = self.ylim {
globals.set_item("yl", yl)?;
globals.as_gil_ref().set_item("yl", yl)?;
}

// Plot Code
Expand Down Expand Up @@ -661,7 +661,7 @@ impl Plot for Plot2D {
plot_string.push_str(&format!("plt.savefig(pa, dpi={})", dpi)[..]);
}

py.run(&plot_string[..], Some(&globals), None)?;
py.run_bound(&plot_string[..], Some(&globals), None)?;
Ok(())
})
}
Expand Down

0 comments on commit ffb9964

Please sign in to comment.