@@ -6,23 +6,25 @@ use std::fmt::Debug;
66use super :: norm:: * ;
77use super :: types:: * ;
88
9- /// check two values are close in terms of the relative torrence
9+ /// check two values are close in terms of the relative tolerance
1010pub fn rclose < A : Scalar > ( test : A , truth : A , rtol : A :: Real ) {
1111 let dev = ( test - truth) . abs ( ) / truth. abs ( ) ;
1212 if dev > rtol {
13+ eprintln ! ( "==== Assetion Failed ====" ) ;
1314 eprintln ! ( "Expected = {}" , truth) ;
1415 eprintln ! ( "Actual = {}" , test) ;
15- panic ! ( "Too large deviation in relative torrence : {}" , dev) ;
16+ panic ! ( "Too large deviation in relative tolerance : {}" , dev) ;
1617 }
1718}
1819
19- /// check two values are close in terms of the absolute torrence
20+ /// check two values are close in terms of the absolute tolerance
2021pub fn aclose < A : Scalar > ( test : A , truth : A , atol : A :: Real ) {
2122 let dev = ( test - truth) . abs ( ) ;
2223 if dev > atol {
24+ eprintln ! ( "==== Assetion Failed ====" ) ;
2325 eprintln ! ( "Expected = {}" , truth) ;
2426 eprintln ! ( "Actual = {}" , test) ;
25- panic ! ( "Too large deviation in absolute torrence : {}" , dev) ;
27+ panic ! ( "Too large deviation in absolute tolerance : {}" , dev) ;
2628 }
2729}
2830
3840 assert_eq ! ( test. dim( ) , truth. dim( ) ) ;
3941 let tol = ( test - truth) . norm_max ( ) ;
4042 if tol > atol {
43+ eprintln ! ( "==== Assetion Failed ====" ) ;
4144 eprintln ! ( "Expected:\n {}" , truth) ;
4245 eprintln ! ( "Actual:\n {}" , test) ;
43- panic ! ( "Too large deviation in maximum norm: {}" , tol) ;
46+ panic ! ( "Too large deviation in maximum norm: {} > {} " , tol, atol ) ;
4447 }
4548}
4649
5659 assert_eq ! ( test. dim( ) , truth. dim( ) ) ;
5760 let tol = ( test - truth) . norm_l1 ( ) / truth. norm_l1 ( ) ;
5861 if tol > rtol {
62+ eprintln ! ( "==== Assetion Failed ====" ) ;
5963 eprintln ! ( "Expected:\n {}" , truth) ;
6064 eprintln ! ( "Actual:\n {}" , test) ;
61- panic ! ( "Too large deviation in L1-norm: {}" , tol) ;
65+ panic ! ( "Too large deviation in L1-norm: {} > {} " , tol, rtol ) ;
6266 }
6367}
6468
7478 assert_eq ! ( test. dim( ) , truth. dim( ) ) ;
7579 let tol = ( test - truth) . norm_l2 ( ) / truth. norm_l2 ( ) ;
7680 if tol > rtol {
81+ eprintln ! ( "==== Assetion Failed ====" ) ;
7782 eprintln ! ( "Expected:\n {}" , truth) ;
7883 eprintln ! ( "Actual:\n {}" , test) ;
79- panic ! ( "Too large deviation in L2-norm: {}" , tol) ;
84+ panic ! ( "Too large deviation in L2-norm: {} > {} " , tol, rtol ) ;
8085 }
8186}
8287
0 commit comments