Skip to content

Commit

Permalink
merge with local changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Siel committed Jan 15, 2024
2 parents 8ac3e36 + bca7e98 commit 614b503
Show file tree
Hide file tree
Showing 35 changed files with 1,028 additions and 3,382 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ r.csv
posterior.csv
simulation_output.csv
meta*.csv
/examples/rosuva/*
/examples/iohexol/*
/examples/vori/*
/examples/data/iohexol*
/examples/data/rosuva*
/examples/data/vori*
/.idea
stop
.vscode
*.f90
*.f90
12 changes: 9 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "npcore"
version = "0.1.1"
version = "0.1.2"
edition = "2021"
authors = [
"Julián D. Otálvaro <juliandavid347@gmail.com>",
Expand Down Expand Up @@ -28,7 +28,7 @@ ndarray-stats = "0.5.1"
linfa-linalg = "0.1.0"
rayon = "1.8.0"
eyre = "0.6.8"
ratatui = { version = "0.24.0", features = ["crossterm"] }
ratatui = { version = "0.25.0", features = ["crossterm"] }
crossterm = "0.27.0"
tokio = { version = "1.32.0", features = ["sync", "rt"] }
ndarray-csv = "0.5.2"
Expand All @@ -37,7 +37,7 @@ argmin = { version = "0.8.1", features = [] }
itertools = "0.12.0"
faer-core = { version = "0.15.0", features = [] }
# faer-lu = "0.9"
faer-qr = "0.15.0"
faer-qr = "0.16.0"
# faer-cholesky = "0.9"
# faer-svd = "0.9"
argmin-math = { version = "0.3.0", features = ["ndarray_v0_15-nolinalg-serde"] }
Expand All @@ -47,6 +47,12 @@ tracing = "0.1.40"
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "fmt", "time"] }
chrono = "0.4"

[dev-dependencies]
criterion = "0.5"

[[bench]]
name = "benchmarks"
harness = false

[profile.release]
codegen-units = 1
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# NPcore
[![Build](https://github.com/LAPKB/NPcore/actions/workflows/rust.yml/badge.svg)](https://github.com/LAPKB/NPcore/actions/workflows/rust.yml)
[![Security Audit](https://github.com/LAPKB/NPcore/actions/workflows/security_audit.yml/badge.svg)](https://github.com/LAPKB/NPcore/actions/workflows/security_audit.yml)
![crates.io](https://img.shields.io/crates/v/npcore.svg)

Rust library with the building blocks to create and implement new non-parametric algorithms and their integration with [Pmetrics](https://github.com/LAPKB/Pmetrics).

Expand Down
23 changes: 23 additions & 0 deletions benches/benchmarks.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};

/// Benchmark the Sobol initialization routine using 1000 points in 10 dimensions
fn benchmark_sobol(c: &mut Criterion) {
c.bench_function("sobol", |b| {
b.iter(|| {
let _ = npcore::routines::initialization::sobol::generate(
black_box(1000),
black_box(&vec![(0.0, 1.0); 10]),
black_box(22),
);
});
});
}

criterion_group! {
name = benches;
config = Criterion::default()
.measurement_time(std::time::Duration::from_secs(10)) // Measure for 10 seconds
.noise_threshold(0.10); // Performance changes less than 10% will be ignored
targets = benchmark_sobol
}
criterion_main!(benches);
6 changes: 3 additions & 3 deletions examples/bimodal_ke/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ log_out = "log/bimodal_ke.log"
[config]
cycles = 1024
engine = "NPAG"
init_points = 2129
init_points = 10000
seed = 347
tui = true
tui = false
pmetrics_outputs = true
cache = true
idelta = 0.1
log_level = "info"
log_level = "debug"

[random]
Ke = [0.001, 3.0]
Expand Down
4 changes: 3 additions & 1 deletion examples/bimodal_ke/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ impl<'a> Predict<'a> for Ode {
scenario.reorder_with_lag(vec![(0.0, 1)]),
)
}
fn get_output(&self, _time: f64, x: &Self::State, system: &Self::Model, outeq: usize) -> f64 {
fn get_output(&self, time: f64, x: &Self::State, system: &Self::Model, outeq: usize) -> f64 {
let v = system.get_param("v");
#[allow(unused_variables)]
let t = time;
match outeq {
1 => x[0] / v,
_ => panic!("Invalid output equation"),
Expand Down
Loading

0 comments on commit 614b503

Please sign in to comment.