Skip to content

Commit 5f12a2e

Browse files
jturner314LukeMathWalker
authored andcommitted
Patch matrixmultiply for zero-sized arrays
* Patch matrixmultiply for zero-sized arrays See bluss/matrixmultiply#21. * Fix test_covariance_zero_observations The dot product should be all zeros, and the `dof` is `0. - (-1.) = 1.`, so all elements in the result should be `0. / 1. = 0.`. This matches the result from NumPy.
1 parent 80ab905 commit 5f12a2e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ ndarray-rand = "0.8"
1616
[patch.crates-io]
1717
ndarray = { git = "https://github.com/jturner314/ndarray.git", branch = "master" }
1818
noisy_float = { git = "https://github.com/SergiusIW/noisy_float-rs.git", rev = "c33a94803987475bbd205c9ff5a697af533f9a17" }
19+
matrixmultiply = { git = "https://github.com/jturner314/matrixmultiply.git", rev = "344f4b43c55fcf7b20be20baff38406ebe9afbfb" }

src/correlation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ mod tests {
146146
// Negative ddof (-1 < 0) to avoid invalid-ddof panic
147147
let cov = a.cov(-1.);
148148
assert_eq!(cov.shape(), &[2, 2]);
149-
cov.mapv(|x| x.is_nan());
149+
cov.mapv(|x| assert_eq!(x, 0.));
150150
}
151151

152152
#[test]

0 commit comments

Comments
 (0)