Skip to content

Commit 6d2f083

Browse files
committed
Add test of Norm for RcArray
1 parent 4aaa904 commit 6d2f083

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

tests/header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extern crate ndarray_numtest;
66
extern crate num_traits;
77

88
#[allow(unused_imports)]
9-
use ndarray::prelude::*;
9+
use ndarray::*;
1010
#[allow(unused_imports)]
1111
use ndarray_linalg::prelude::*;
1212
#[allow(unused_imports)]

tests/vector.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,19 @@ fn vector_norm_max() {
2121
let b = arr2(&[[1.0, 3.0], [1.0, -4.0]]);
2222
b.norm_max().assert_close(4.0, 1e-7);
2323
}
24+
25+
#[test]
26+
fn vector_norm_l1_rc() {
27+
let a = rcarr1(&[1.0, -1.0]);
28+
a.norm_l1().assert_close(2.0, 1e-7);
29+
let b = rcarr2(&[[0.0, -1.0], [1.0, 0.0]]);
30+
b.norm_l1().assert_close(2.0, 1e-7);
31+
}
32+
33+
#[test]
34+
fn vector_norm_max_rc() {
35+
let a = rcarr1(&[1.0, 1.0, -3.0]);
36+
a.norm_max().assert_close(3.0, 1e-7);
37+
let b = rcarr2(&[[1.0, 3.0], [1.0, -4.0]]);
38+
b.norm_max().assert_close(4.0, 1e-7);
39+
}

0 commit comments

Comments
 (0)