Skip to content

Commit d64e9d5

Browse files
committed
add one more surface test for ndg
1 parent c1c8f4a commit d64e9d5

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/ndg_evaluate.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,35 @@ fn test_make_surface() {
2323

2424
assert_abs_diff_eq!(yi, y);
2525
}
26+
27+
28+
#[test]
29+
fn test_make_surface_1() {
30+
let x0 = array![1., 2., 3.];
31+
let x1 = array![1., 2., 3., 4.];
32+
let x = vec![x0.view(), x1.view()];
33+
34+
let xi0 = array![1., 1.5, 2., 2.5, 3.];
35+
let xi1 = array![1., 1.5, 2., 2.5, 3., 3.5, 4.];
36+
let xi = vec![xi0.view(), xi1.view()];
37+
38+
let y = array![
39+
[1., 2., 3., 4.],
40+
[5., 6., 7., 8.],
41+
[9., 10., 11., 12.],
42+
];
43+
44+
let yi_expected = array![
45+
[1., 1.5, 2., 2.5, 3., 3.5, 4.],
46+
[3., 3.5, 4., 4.5, 5., 5.5, 6.],
47+
[5., 5.5, 6., 6.5, 7., 7.5, 8.],
48+
[7., 7.5, 8., 8.5, 9., 9.5, 10.],
49+
[9., 9.5, 10., 10.5, 11., 11.5, 12.],
50+
];
51+
52+
let yi = GridCubicSmoothingSpline::new(&x, &y)
53+
.make().unwrap()
54+
.evaluate(&xi).unwrap();
55+
56+
assert_abs_diff_eq!(yi, yi_expected);
57+
}

0 commit comments

Comments
 (0)