-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Generic Butcher Tableau - Fix all warnings - More & safe non-macro
- Loading branch information
Showing
38 changed files
with
883 additions
and
523 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "peroxide" | ||
version = "0.36.0" | ||
version = "0.36.1" | ||
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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use peroxide::fuga::*; | ||
|
||
#[allow(unused_variables)] | ||
fn main() -> Result<(), Box<dyn Error>> { | ||
let dp45 = DP45::new(1e-4, 0.9, 1e-6, 1e-1, 100); | ||
let basic_ode_solver = BasicODESolver::new(dp45); | ||
let (_, y_vec) = basic_ode_solver.solve( | ||
&Lorenz, | ||
(0f64, 100f64), | ||
1e-2, | ||
)?; | ||
let y_mat = py_matrix(y_vec); | ||
let y0 = y_mat.col(0); | ||
let y2 = y_mat.col(2); | ||
|
||
#[cfg(feature = "plot")] | ||
{ | ||
let mut plt = Plot2D::new(); | ||
plt | ||
.set_domain(y0) | ||
.insert_image(y2) | ||
.set_xlabel(r"$y_0$") | ||
.set_ylabel(r"$y_2$") | ||
.set_style(PlotStyle::Nature) | ||
.tight_layout() | ||
.set_dpi(600) | ||
.set_path("example_data/lorenz_dp45.png") | ||
.savefig()?; | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
struct Lorenz; | ||
|
||
impl ODEProblem for Lorenz { | ||
fn initial_conditions(&self) -> Vec<f64> { | ||
vec![10f64, 1f64, 1f64] | ||
} | ||
|
||
fn rhs(&self, _t: f64, y: &[f64], dy: &mut [f64]) -> Result<(), ODEError> { | ||
dy[0] = 10f64 * (y[1] - y[0]); | ||
dy[1] = 28f64 * y[0] - y[1] - y[0] * y[2]; | ||
dy[2] = -8f64 / 3f64 * y[2] + y[0] * y[1]; | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use peroxide::fuga::*; | ||
|
||
#[allow(unused_variables)] | ||
fn main() -> Result<(), Box<dyn Error>> { | ||
let tsit45 = TSIT45::new(1e-2, 0.9, 1e-6, 1e-1, 100); | ||
let basic_ode_solver = BasicODESolver::new(tsit45); | ||
let (_, y_vec) = basic_ode_solver.solve( | ||
&Lorenz, | ||
(0f64, 100f64), | ||
1e-2, | ||
)?; | ||
let y_mat = py_matrix(y_vec); | ||
let y0 = y_mat.col(0); | ||
let y2 = y_mat.col(2); | ||
|
||
#[cfg(feature = "plot")] | ||
{ | ||
let mut plt = Plot2D::new(); | ||
plt | ||
.set_domain(y0) | ||
.insert_image(y2) | ||
.set_xlabel(r"$y_0$") | ||
.set_ylabel(r"$y_2$") | ||
.set_style(PlotStyle::Nature) | ||
.tight_layout() | ||
.set_dpi(600) | ||
.set_path("example_data/lorenz_tsit45.png") | ||
.savefig()?; | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
||
struct Lorenz; | ||
|
||
impl ODEProblem for Lorenz { | ||
fn initial_conditions(&self) -> Vec<f64> { | ||
vec![10f64, 1f64, 1f64] | ||
} | ||
|
||
fn rhs(&self, _t: f64, y: &[f64], dy: &mut [f64]) -> Result<(), ODEError> { | ||
dy[0] = 10f64 * (y[1] - y[0]); | ||
dy[1] = 28f64 * y[0] - y[1] - y[0] * y[2]; | ||
dy[2] = -8f64 / 3f64 * y[2] + y[0] * y[1]; | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.