Skip to content

Commit

Permalink
Merge pull request argmin-rs#96 from stefan-k/version_bump_210222
Browse files Browse the repository at this point in the history
Updated dependendies
  • Loading branch information
stefan-k authored Feb 22, 2021
2 parents dc2a06c + 4753df3 commit 49ab739
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ ctrlc = { version = "3.1.2", optional = true }
instant = {version = "0.1", features = ["now"] }
gnuplot = { version = "0.0.37", optional = true}
paste = "1.0.0"
nalgebra = { version = "0.22.0", optional = true, features = ["serde-serialize"] }
ndarray = { version = "0.13", optional = true, features = ["serde-1"] }
ndarray-linalg = { version = "0.12", optional = true }
nalgebra = { version = "0.24.1", optional = true, features = ["serde-serialize"] }
ndarray = { version = "0.14", optional = true, features = ["serde-1"] }
ndarray-linalg = { version = "0.13", optional = true }
ndarray-rand = {version = "0.13.0", optional = true }
num = { version = "0.3" }
num-complex = "0.2"
rand = { version = "0.7.2", features = ["serde1"] }
rand_xorshift = { version = "0.2.0", features = ["serde1"] }
num-complex = "0.3"
rand = { version = "0.8.3", features = ["serde1"] }
rand_xorshift = { version = "0.3.0", features = ["serde1"] }
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = "1.0"
slog = "2.4.1"
Expand All @@ -41,8 +41,8 @@ slog-json = "2.3.0"
thiserror = "1.0"

[dev-dependencies]
ndarray-linalg = { version = "0.12", features = ["openblas"] }
finitediff = { version = "0.1.2", features = ["ndarray"] }
ndarray-linalg = { version = "0.13", features = ["openblas"] }
finitediff = { version = "0.1.3", features = ["ndarray"] }
argmin_testfunctions = "0.1.1"

[features]
Expand Down
4 changes: 2 additions & 2 deletions examples/simulatedannealing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ impl ArgminOp for Rosenbrock {
// Compute random index of the parameter vector using the supplied random number
// generator.
let mut rng = self.rng.lock().unwrap();
let idx = (*rng).gen_range(0, param.len());
let idx = (*rng).gen_range(0..param.len());

// Compute random number in [0.1, 0.1].
let val = 0.1 * (*rng).gen_range(-1.0, 1.0);
let val = 0.1 * (*rng).gen_range(-1.0..1.0);

// modify previous parameter value at random position `idx` by `val`
let tmp = param[idx] + val;
Expand Down
5 changes: 4 additions & 1 deletion src/core/math/inv_ndarray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ mod tests {
let res = <Array2<$t> as ArgminInv<Array2<$t>>>::inv(&a).unwrap();
for i in 0..2 {
for j in 0..2 {
assert!((((res[(i, j)] - target[(i, j)]) as f64).abs()) < std::f64::EPSILON);
// TODO: before ndarray 0.14 / ndarray-linalg 0.13, comparison with
// EPSILON worked, now errors are larger (and dependent on the BLAS
// backend)
assert!((((res[(i, j)] - target[(i, j)]) as f64).abs()) < 0.000001);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/math/random_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ where
if a == b {
a.clone()
} else if a < b {
rng.gen_range(a, b)
rng.gen_range(a.clone()..b.clone())
} else {
rng.gen_range(b, a)
rng.gen_range(b.clone()..a.clone())
}
})
.collect()
Expand Down

0 comments on commit 49ab739

Please sign in to comment.