@@ -52,16 +52,16 @@ public class RegressionTesting {
5252 private static Logger log = LoggerFactory .getLogger ( RegressionTesting .class );
5353
5454 /**
55- * @param a expected
56- * @param b measured
57- * @param tolerance
55+ * @param expected
56+ * @param actual
57+ * @param tolerance permitted delta between the values
5858 */
59- public static boolean closeEnough ( double [] a , double [] b , double tolerance ) {
60- if ( a .length != b .length ) return false ;
59+ public static boolean closeEnough ( double [] expected , double [] actual , double tolerance ) {
60+ if ( expected .length != actual .length ) return false ;
6161
62- for ( int i = 0 ; i < a .length ; i ++ ) {
63- if ( Math .abs ( a [i ] - b [i ] ) > tolerance ) {
64- log .error ( "Expected " + a [i ] + " got " + b [i ] + " at " + i );
62+ for ( int i = 0 ; i < expected .length ; i ++ ) {
63+ if ( Math .abs ( expected [i ] - actual [i ] ) > tolerance ) {
64+ log .error ( "Expected " + expected [i ] + " got " + actual [i ] + " at " + i );
6565 return false ;
6666 }
6767 }
@@ -74,16 +74,16 @@ public static boolean closeEnough( double[] a, double[] b, double tolerance ) {
7474 /**
7575 * Test whether two DoubleArrayLists are 'close enough' to call equal.
7676 *
77- * @param a
78- * @param b
77+ * @param expected
78+ * @param actual
7979 * @param tolerance
8080 * @return
8181 */
82- public static boolean closeEnough ( DoubleArrayList a , DoubleArrayList b , double tolerance ) {
83- if ( a .size () != b .size () ) return false ;
82+ public static boolean closeEnough ( DoubleArrayList expected , DoubleArrayList actual , double tolerance ) {
83+ if ( expected .size () != actual .size () ) return false ;
8484
85- for ( int i = 0 ; i < a .size (); i ++ ) {
86- if ( Math .abs ( a .get ( i ) - b .get ( i ) ) > tolerance ) return false ;
85+ for ( int i = 0 ; i < expected .size (); i ++ ) {
86+ if ( Math .abs ( expected .get ( i ) - actual .get ( i ) ) > tolerance ) return false ;
8787 }
8888 return true ;
8989 }
@@ -96,16 +96,16 @@ public static boolean closeEnough( DoubleArrayList a, DoubleArrayList b, double
9696 * @param tolerance
9797 * @return try if all the values in both matrices are within 'tolerance' of each other.
9898 */
99- public static boolean closeEnough ( DoubleMatrix <?, ?> a , DoubleMatrix <?, ?> b , double tolerance ) {
100- if ( a .rows () != b .rows () || a .columns () != b .columns () ) {
99+ public static boolean closeEnough ( DoubleMatrix <?, ?> expected , DoubleMatrix <?, ?> actual , double tolerance ) {
100+ if ( expected .rows () != actual .rows () || expected .columns () != actual .columns () ) {
101101 log .error ( "Unequal rows and/or columns" );
102102 return false ;
103103 }
104104
105- for ( int i = 0 ; i < a .rows (); i ++ ) {
106- for ( int j = 0 ; j < a .columns (); j ++ ) {
107- if ( Math .abs ( a .get ( i , j ) - b .get ( i , j ) ) > tolerance ) {
108- log .error ( "Expected: " + a .get ( i , j ) + ", actual=" + b .get ( i , j ) );
105+ for ( int i = 0 ; i < expected .rows (); i ++ ) {
106+ for ( int j = 0 ; j < expected .columns (); j ++ ) {
107+ if ( Math .abs ( expected .get ( i , j ) - actual .get ( i , j ) ) > tolerance ) {
108+ log .error ( "Expected: " + expected .get ( i , j ) + ", actual=" + actual .get ( i , j ) );
109109 return false ;
110110 }
111111 }
@@ -114,13 +114,13 @@ public static boolean closeEnough( DoubleMatrix<?, ?> a, DoubleMatrix<?, ?> b, d
114114 }
115115
116116 /**
117- * @param a
118- * @param b
117+ * @param expected
118+ * @param actual
119119 * @param tolerance
120120 * @return
121121 */
122- public static boolean closeEnough ( DoubleMatrix1D a , DoubleMatrix1D b , double tolerance ) {
123- return closeEnough ( a .toArray (), b .toArray (), tolerance );
122+ public static boolean closeEnough ( DoubleMatrix1D expected , DoubleMatrix1D actual , double tolerance ) {
123+ return closeEnough (expected .toArray (), actual .toArray (), tolerance );
124124 }
125125
126126 public static boolean closeEnough ( DoubleMatrix2D a , DoubleMatrix2D b , double tolerance ) {
0 commit comments