Skip to content

Commit 62dea6a

Browse files
Merge branch 'master' into master
2 parents 4a3fc8f + f9258f2 commit 62dea6a

File tree

17 files changed

+68
-66
lines changed

17 files changed

+68
-66
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
- stable
7272
- beta
7373
- nightly
74-
- 1.57.0 # MSRV
74+
- 1.64.0 # MSRV
7575

7676
name: tests/${{ matrix.rust }}
7777
steps:

Cargo.toml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name = "ndarray"
44
version = "0.15.6"
55
edition = "2018"
6-
rust-version = "1.57"
6+
rust-version = "1.64"
77
authors = [
88
"Ulrik Sverdrup \"bluss\"",
99
"Jim Turner"
@@ -31,12 +31,11 @@ num-integer = { version = "0.1.39", default-features = false }
3131
num-traits = { version = "0.2", default-features = false }
3232
num-complex = { version = "0.4", default-features = false }
3333

34-
# Use via the `rayon` crate feature!
35-
rayon_ = { version = "1.0.3", optional = true, package = "rayon" }
34+
rayon = { version = "1.10.0", optional = true }
3635

3736
approx = { version = "0.5", optional = true , default-features = false }
3837

39-
# Use via the `blas` crate feature!
38+
# Use via the `blas` crate feature
4039
cblas-sys = { version = "0.1.4", optional = true, default-features = false }
4140
libc = { version = "0.2.82", optional = true }
4241

@@ -50,17 +49,18 @@ rawpointer = { version = "0.2" }
5049
defmac = "0.2"
5150
quickcheck = { version = "1.0", default-features = false }
5251
approx = "0.5"
53-
itertools = { version = "0.10.0", default-features = false, features = ["use_std"] }
52+
itertools = { version = "0.13.0", default-features = false, features = ["use_std"] }
5453

5554
[features]
5655
default = ["std"]
5756

5857
# Enable blas usage
5958
# See README for more instructions
60-
blas = ["cblas-sys", "libc"]
59+
blas = ["dep:cblas-sys", "dep:libc"]
6160

61+
serde = ["dep:serde"]
6262
# Old name for the serde feature
63-
serde-1 = ["serde"]
63+
serde-1 = ["dep:serde"]
6464

6565
# These features are used for testing
6666
test = []
@@ -69,7 +69,7 @@ test = []
6969
docs = ["approx", "serde", "rayon"]
7070

7171
std = ["num-traits/std", "matrixmultiply/std"]
72-
rayon = ["rayon_", "std"]
72+
rayon = ["dep:rayon", "std"]
7373

7474
critical-section = ["portable-atomic/critical-section"]
7575

@@ -97,7 +97,18 @@ opt-level = 2
9797
opt-level = 2
9898

9999
[workspace]
100-
members = ["ndarray-rand", "xtest-serialization", "xtest-blas", "xtest-numeric"]
100+
members = [
101+
"ndarray-rand",
102+
"extra-tests/serialization",
103+
"extra-tests/blas",
104+
"extra-tests/numeric",
105+
]
106+
107+
[workspace.dependencies]
108+
ndarray = { path = "." }
109+
num-traits = { version = "0.2", default-features = false }
110+
num-complex = { version = "0.4", default-features = false }
111+
ndarray-rand = { path = "./ndarray-rand" }
101112

102113
[package.metadata.release]
103114
no-dev-version = true

extra-tests/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
# Extra Tests
3+
4+
These are test crates whose settings, features and dependencies should be
5+
separate from the main crate.

xtest-blas/Cargo.toml renamed to extra-tests/blas/Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@ name = "blas-tests"
33
version = "0.1.0"
44
authors = ["bluss"]
55
publish = false
6+
edition = "2018"
67

78
[lib]
89
test = false
910

1011
[dev-dependencies]
1112
approx = "0.5"
1213
defmac = "0.2"
13-
num-traits = "0.2"
14-
num-complex = { version = "0.4", default-features = false }
14+
num-traits = { workspace = true }
15+
num-complex = { workspace = true }
1516

1617
[dependencies]
17-
ndarray = { path = "..", features = ["approx", "blas"] }
18+
ndarray = { workspace = true, features = ["approx"] }
1819

19-
blas-src = { version = "0.8", optional = true }
20+
blas-src = { version = "0.10", optional = true }
2021

2122
openblas-src = { version = "0.10", optional = true }
2223
netlib-src = { version = "0.8", optional = true }
File renamed without changes.
File renamed without changes.

xtest-numeric/Cargo.toml renamed to extra-tests/numeric/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ edition = "2018"
77

88
[dependencies]
99
approx = "0.5"
10-
ndarray = { path = "..", features = ["approx"] }
11-
ndarray-rand = { path = "../ndarray-rand" }
10+
ndarray = { workspace = true, features = ["approx"] }
11+
ndarray-rand = { workspace = true }
1212
rand_distr = "0.4"
1313

14-
blas-src = { optional = true, version = "0.8", default-features = false, features = ["openblas"] }
14+
blas-src = { optional = true, version = "0.10", default-features = false, features = ["openblas"] }
1515
openblas-src = { optional = true, version = "0.10", default-features = false, features = ["cblas", "system"] }
1616

1717
[dependencies.rand]
1818
version = "0.8.0"
1919
features = ["small_rng"]
2020

2121
[dev-dependencies]
22-
num-traits = { version = "0.2.14", default-features = false }
23-
num-complex = { version = "0.4", default-features = false }
22+
num-traits = { workspace = true }
23+
num-complex = { workspace = true }
2424

2525
[lib]
2626
test = false
File renamed without changes.

xtest-numeric/tests/accuracy.rs renamed to extra-tests/numeric/tests/accuracy.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ fn random_matrix_mul<A>(
172172
) -> (Array2<A>, Array2<A>)
173173
where A: LinalgScalar
174174
{
175-
let m = rng.gen_range(15..512);
176-
let k = rng.gen_range(15..512);
177-
let n = rng.gen_range(15..1560);
175+
let m = rng.gen_range(15..128);
176+
let k = rng.gen_range(15..128);
177+
let n = rng.gen_range(15..512);
178178
let a = generator(Ix2(m, k), rng);
179179
let b = generator(Ix2(n, k), rng);
180180
let c = if use_general {
@@ -261,7 +261,7 @@ fn accurate_mul_with_column_f64()
261261
// pick a few random sizes
262262
let rng = &mut SmallRng::from_entropy();
263263
for i in 0..10 {
264-
let m = rng.gen_range(1..350);
264+
let m = rng.gen_range(1..128);
265265
let k = rng.gen_range(1..350);
266266
let a = gen::<f64, _>(Ix2(m, k), rng);
267267
let b_owner = gen::<f64, _>(Ix2(k, k), rng);

xtest-serialization/Cargo.toml renamed to extra-tests/serialization/Cargo.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ name = "serialization-tests"
33
version = "0.1.0"
44
authors = ["bluss"]
55
publish = false
6+
edition = "2018"
67

78
[lib]
89
test = false
910

1011
[dependencies]
11-
ndarray = { path = "..", features = ["serde"] }
12+
ndarray = { workspace = true, features = ["serde"] }
1213

1314
[features]
1415
default = ["ron"]
@@ -20,9 +21,14 @@ default-features = false
2021
[dev-dependencies.serde_json]
2122
version = "1.0.40"
2223

24+
[dev-dependencies.rmp]
25+
# Old version to work with Rust 1.64+
26+
version = "=0.8.10"
27+
2328
[dev-dependencies.rmp-serde]
24-
version = "0.14.0"
29+
# Old version to work with Rust 1.64+
30+
version = "0.14"
2531

2632
[dependencies.ron]
27-
version = "0.5.1"
33+
version = "0.8.1"
2834
optional = true
File renamed without changes.

scripts/all-tests.sh

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,19 @@ set -e
66
FEATURES=$1
77
CHANNEL=$2
88

9-
if [ "$CHANNEL" = "1.57.0" ]; then
10-
cargo update --package openblas-src --precise 0.10.5
11-
cargo update --package openblas-build --precise 0.10.5
12-
cargo update --package once_cell --precise 1.14.0
13-
cargo update --package byteorder --precise 1.4.3
14-
cargo update --package rayon --precise 1.5.3
15-
cargo update --package rayon-core --precise 1.9.3
16-
cargo update --package crossbeam-channel --precise 0.5.8
17-
cargo update --package crossbeam-deque --precise 0.8.3
18-
cargo update --package crossbeam-epoch --precise 0.9.15
19-
cargo update --package crossbeam-utils --precise 0.8.16
20-
cargo update --package rmp --precise 0.8.11
21-
cargo update --package serde_json --precise 1.0.99
22-
cargo update --package serde --precise 1.0.156
23-
cargo update --package thiserror --precise 1.0.39
24-
cargo update --package quote --precise 1.0.30
25-
cargo update --package proc-macro2 --precise 1.0.65
26-
fi
27-
289
cargo build --verbose --no-default-features
2910
# Testing both dev and release profiles helps find bugs, especially in low level code
3011
cargo test --verbose --no-default-features
3112
cargo test --release --verbose --no-default-features
3213
cargo build --verbose --features "$FEATURES"
3314
cargo test --verbose --features "$FEATURES"
34-
cargo test --manifest-path=ndarray-rand/Cargo.toml --no-default-features --verbose
35-
cargo test --manifest-path=ndarray-rand/Cargo.toml --features quickcheck --verbose
36-
cargo test --manifest-path=xtest-serialization/Cargo.toml --verbose
37-
cargo test --manifest-path=xtest-blas/Cargo.toml --verbose --features openblas-system
15+
cargo test -p ndarray-rand --no-default-features --verbose
16+
cargo test -p ndarray-rand --features ndarray-rand/quickcheck --verbose
17+
18+
cargo test -p serialization-tests -v
19+
cargo test -p blas-tests -v --features blas-tests/openblas-system
20+
cargo test -p numeric-tests -v
21+
cargo test -p numeric-tests -v --features numeric-tests/test_blas
22+
3823
cargo test --examples
39-
cargo test --manifest-path=xtest-numeric/Cargo.toml --verbose
40-
cargo test --manifest-path=xtest-numeric/Cargo.toml --verbose --features test_blas
4124
([ "$CHANNEL" != "nightly" ] || cargo bench --no-run --verbose --features "$FEATURES")

scripts/cross-tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ TARGET=$3
99

1010
cross build -v --features="$FEATURES" --target=$TARGET
1111
cross test -v --no-fail-fast --features="$FEATURES" --target=$TARGET
12-
cross test -v --no-fail-fast --target=$TARGET --manifest-path=ndarray-rand/Cargo.toml --features quickcheck
13-
cross test -v --no-fail-fast --target=$TARGET --manifest-path=xtest-serialization/Cargo.toml --verbose
14-
cross test -v --no-fail-fast --target=$TARGET --manifest-path=xtest-numeric/Cargo.toml --release
12+
cross test -v --no-fail-fast --target=$TARGET -p ndarray-rand --features ndarray-rand/quickcheck
13+
cross test -v --no-fail-fast --target=$TARGET -p serialization-tests --verbose
14+
cross test -v --no-fail-fast --target=$TARGET -p numeric-tests --release

src/impl_methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2623,7 +2623,7 @@ where
26232623
let dim = self.raw_dim();
26242624
Zip::from(LanesMut::new(self.view_mut(), Axis(n - 1)))
26252625
.and(Lanes::new(rhs.broadcast_assume(dim), Axis(n - 1)))
2626-
.for_each(move |s_row, r_row| Zip::from(s_row).and(r_row).for_each(|a, b| f(a, b)));
2626+
.for_each(move |s_row, r_row| Zip::from(s_row).and(r_row).for_each(&mut f));
26272627
}
26282628

26292629
fn zip_mut_with_elem<B, F>(&mut self, rhs_elem: &B, mut f: F)

src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@
1010
#![doc(html_logo_url = "https://rust-ndarray.github.io/images/rust-ndarray_logo.svg")]
1111
#![allow(
1212
unstable_name_collisions, // our `PointerExt` collides with upcoming inherent methods on `NonNull`
13-
clippy::many_single_char_names,
1413
clippy::deref_addrof,
15-
clippy::unreadable_literal,
1614
clippy::manual_map, // is not an error
1715
clippy::while_let_on_iterator, // is not an error
1816
clippy::from_iter_instead_of_collect, // using from_iter is good style
19-
clippy::redundant_closure, // false positives clippy #7812
2017
clippy::incompatible_msrv, // false positive PointerExt::offset
2118
)]
2219
#![doc(test(attr(deny(warnings))))]
@@ -72,7 +69,8 @@
7269
//! needs matching memory layout to be efficient (with some exceptions).
7370
//! + Efficient floating point matrix multiplication even for very large
7471
//! matrices; can optionally use BLAS to improve it further.
75-
//! - **Requires Rust 1.57 or later**
72+
//!
73+
//! - **MSRV: Requires Rust 1.64 or later**
7674
//!
7775
//! ## Crate Feature Flags
7876
//!
@@ -1590,8 +1588,6 @@ where
15901588

15911589
// parallel methods
15921590
#[cfg(feature = "rayon")]
1593-
extern crate rayon_ as rayon;
1594-
#[cfg(feature = "rayon")]
15951591
pub mod parallel;
15961592

15971593
mod impl_1d;

src/linalg/impl_linalg.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -823,11 +823,11 @@ where
823823
if !same_type::<A, S::Elem>() {
824824
return false;
825825
}
826-
if a.len() > blas_index::max_value() as usize {
826+
if a.len() > blas_index::MAX as usize {
827827
return false;
828828
}
829829
let stride = a.strides()[0];
830-
if stride == 0 || stride > blas_index::max_value() as isize || stride < blas_index::min_value() as isize {
830+
if stride == 0 || stride > blas_index::MAX as isize || stride < blas_index::MIN as isize {
831831
return false;
832832
}
833833
true
@@ -882,12 +882,12 @@ fn is_blas_2d(dim: &Ix2, stride: &Ix2, order: MemoryOrder) -> bool
882882
if s0 < 1 || s1 < 1 {
883883
return false;
884884
}
885-
if (s0 > blas_index::max_value() as isize || s0 < blas_index::min_value() as isize)
886-
|| (s1 > blas_index::max_value() as isize || s1 < blas_index::min_value() as isize)
885+
if (s0 > blas_index::MAX as isize || s0 < blas_index::MIN as isize)
886+
|| (s1 > blas_index::MAX as isize || s1 < blas_index::MIN as isize)
887887
{
888888
return false;
889889
}
890-
if m > blas_index::max_value() as usize || n > blas_index::max_value() as usize {
890+
if m > blas_index::MAX as usize || n > blas_index::MAX as usize {
891891
return false;
892892
}
893893
true

0 commit comments

Comments
 (0)