Skip to content

Commit 2364dac

Browse files
committed
Add tests for matching shape checks in SolveH
1 parent 866c359 commit 2364dac

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

ndarray-linalg/tests/solveh.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
use ndarray::*;
22
use ndarray_linalg::*;
33

4+
#[should_panic]
5+
#[test]
6+
fn solveh_shape_mismatch() {
7+
let a: Array2<f64> = random_hpd(3);
8+
let b: Array1<f64> = random(2);
9+
let _ = a.solveh_into(b);
10+
}
11+
12+
#[should_panic]
13+
#[test]
14+
fn factorizeh_solveh_shape_mismatch() {
15+
let a: Array2<f64> = random_hpd(3);
16+
let b: Array1<f64> = random(2);
17+
let f = a.factorizeh_into().unwrap();
18+
let _ = f.solveh_into(b);
19+
}
20+
421
#[test]
522
fn solveh_random() {
623
let a: Array2<f64> = random_hpd(3);
@@ -15,6 +32,23 @@ fn solveh_random() {
1532
assert_close_l2!(&x, &y, 1e-7);
1633
}
1734

35+
#[should_panic]
36+
#[test]
37+
fn solveh_t_shape_mismatch() {
38+
let a: Array2<f64> = random_hpd(3).reversed_axes();
39+
let b: Array1<f64> = random(2);
40+
let _ = a.solveh_into(b);
41+
}
42+
43+
#[should_panic]
44+
#[test]
45+
fn factorizeh_solveh_t_shape_mismatch() {
46+
let a: Array2<f64> = random_hpd(3).reversed_axes();
47+
let b: Array1<f64> = random(2);
48+
let f = a.factorizeh_into().unwrap();
49+
let _ = f.solveh_into(b);
50+
}
51+
1852
#[test]
1953
fn solveh_random_t() {
2054
let a: Array2<f64> = random_hpd(3).reversed_axes();

0 commit comments

Comments
 (0)