Skip to content

Commit e0664f1

Browse files
authored
Merge pull request #240 from rust-ndarray/bug-228
Add test for solve-factorized
2 parents c027ef0 + 9c86af7 commit e0664f1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ndarray-linalg/tests/solve.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,26 @@ fn solve_random_t() {
1919
assert_close_l2!(&x, &y, 1e-7);
2020
}
2121

22+
#[test]
23+
fn solve_factorized() {
24+
let a: Array2<f64> = random((3, 3));
25+
let ans: Array1<f64> = random(3);
26+
let b = a.dot(&ans);
27+
let f = a.factorize_into().unwrap();
28+
let x = f.solve_into(b).unwrap();
29+
assert_close_l2!(&x, &ans, 1e-7);
30+
}
31+
32+
#[test]
33+
fn solve_factorized_t() {
34+
let a: Array2<f64> = random((3, 3).f());
35+
let ans: Array1<f64> = random(3);
36+
let b = a.dot(&ans);
37+
let f = a.factorize_into().unwrap();
38+
let x = f.solve_into(b).unwrap();
39+
assert_close_l2!(&x, &ans, 1e-7);
40+
}
41+
2242
#[test]
2343
fn rcond() {
2444
macro_rules! rcond {

0 commit comments

Comments
 (0)