@@ -6,23 +6,25 @@ use std::fmt::Debug;
6
6
use super :: norm:: * ;
7
7
use super :: types:: * ;
8
8
9
- /// check two values are close in terms of the relative torrence
9
+ /// check two values are close in terms of the relative tolerance
10
10
pub fn rclose < A : Scalar > ( test : A , truth : A , rtol : A :: Real ) {
11
11
let dev = ( test - truth) . abs ( ) / truth. abs ( ) ;
12
12
if dev > rtol {
13
+ eprintln ! ( "==== Assetion Failed ====" ) ;
13
14
eprintln ! ( "Expected = {}" , truth) ;
14
15
eprintln ! ( "Actual = {}" , test) ;
15
- panic ! ( "Too large deviation in relative torrence : {}" , dev) ;
16
+ panic ! ( "Too large deviation in relative tolerance : {}" , dev) ;
16
17
}
17
18
}
18
19
19
- /// check two values are close in terms of the absolute torrence
20
+ /// check two values are close in terms of the absolute tolerance
20
21
pub fn aclose < A : Scalar > ( test : A , truth : A , atol : A :: Real ) {
21
22
let dev = ( test - truth) . abs ( ) ;
22
23
if dev > atol {
24
+ eprintln ! ( "==== Assetion Failed ====" ) ;
23
25
eprintln ! ( "Expected = {}" , truth) ;
24
26
eprintln ! ( "Actual = {}" , test) ;
25
- panic ! ( "Too large deviation in absolute torrence : {}" , dev) ;
27
+ panic ! ( "Too large deviation in absolute tolerance : {}" , dev) ;
26
28
}
27
29
}
28
30
38
40
assert_eq ! ( test. dim( ) , truth. dim( ) ) ;
39
41
let tol = ( test - truth) . norm_max ( ) ;
40
42
if tol > atol {
43
+ eprintln ! ( "==== Assetion Failed ====" ) ;
41
44
eprintln ! ( "Expected:\n {}" , truth) ;
42
45
eprintln ! ( "Actual:\n {}" , test) ;
43
- panic ! ( "Too large deviation in maximum norm: {}" , tol) ;
46
+ panic ! ( "Too large deviation in maximum norm: {} > {} " , tol, atol ) ;
44
47
}
45
48
}
46
49
56
59
assert_eq ! ( test. dim( ) , truth. dim( ) ) ;
57
60
let tol = ( test - truth) . norm_l1 ( ) / truth. norm_l1 ( ) ;
58
61
if tol > rtol {
62
+ eprintln ! ( "==== Assetion Failed ====" ) ;
59
63
eprintln ! ( "Expected:\n {}" , truth) ;
60
64
eprintln ! ( "Actual:\n {}" , test) ;
61
- panic ! ( "Too large deviation in L1-norm: {}" , tol) ;
65
+ panic ! ( "Too large deviation in L1-norm: {} > {} " , tol, rtol ) ;
62
66
}
63
67
}
64
68
74
78
assert_eq ! ( test. dim( ) , truth. dim( ) ) ;
75
79
let tol = ( test - truth) . norm_l2 ( ) / truth. norm_l2 ( ) ;
76
80
if tol > rtol {
81
+ eprintln ! ( "==== Assetion Failed ====" ) ;
77
82
eprintln ! ( "Expected:\n {}" , truth) ;
78
83
eprintln ! ( "Actual:\n {}" , test) ;
79
- panic ! ( "Too large deviation in L2-norm: {}" , tol) ;
84
+ panic ! ( "Too large deviation in L2-norm: {} > {} " , tol, rtol ) ;
80
85
}
81
86
}
82
87
0 commit comments