* also check m2.preMultiply(m1) - should be same as m1.postMultiply(m2)
*/
MatrixI m4 = m2.preMultiply(m1);
- assertMatricesMatch(m3, m4);
+ assertMatricesMatch(m3, m4, 0.00001d);
/*
* m1 has more rows than columns
assertEquals(m3.getValue(1, 2), 3000d);
m4 = m2.preMultiply(m1);
- assertMatricesMatch(m3, m4);
+ assertMatricesMatch(m3, m4, 0.00001d);
/*
* m1 has more columns than rows
* and check premultiply equivalent
*/
m4 = m2.preMultiply(m1);
- assertMatricesMatch(m3, m4);
+ assertMatricesMatch(m3, m4, 0.00001d);
}
@Test(groups = "Timing")
/*
* make a pseudo-random symmetric matrix as required for tred/tqli
*/
- // TODO why does this fail for rows > 9??
- int rows = 9;
+ int rows = 10;
int cols = rows;
double[][] d = getSparseValues(rows, cols, 3);
}
Matrix m1 = new Matrix(d);
Matrix m2 = new SparseMatrix(d1);
- assertMatricesMatch(m1, m2); // sanity check
+ assertMatricesMatch(m1, m2, 0.00001d); // sanity check
m1.tred();
m2.tred();
- assertMatricesMatch(m1, m2);
+ assertMatricesMatch(m1, m2, 0.00001d);
}
- private void assertMatricesMatch(MatrixI m1, MatrixI m2)
+ private void assertMatricesMatch(MatrixI m1, MatrixI m2, double delta)
{
if (m1.height() != m2.height())
{
}
}
}
- ArrayAsserts.assertArrayEquals(m1.getD(), m2.getD(), 0.00001d);
+ ArrayAsserts.assertArrayEquals(m1.getD(), m2.getD(), delta);
ArrayAsserts.assertArrayEquals(m1.getE(), m2.getE(), 0.00001d);
}
// have to do tred() before doing tqli()
m1.tred();
m2.tred();
- assertMatricesMatch(m1, m2);
+ assertMatricesMatch(m1, m2, 0.00001d);
m1.tqli();
m2.tqli();
- assertMatricesMatch(m1, m2);
+ assertMatricesMatch(m1, m2, 0.00001d);
}
/**
}
Matrix m1 = new SparseMatrix(d);
Matrix m2 = new SparseMatrix(d1);
- assertMatricesMatch(m1, m2); // sanity check
+ assertMatricesMatch(m1, m2, 1.0e16); // sanity check
m1.tred();
m2.tred();
- assertMatricesMatch(m1, m2);
+ assertMatricesMatch(m1, m2, 0.00001d);
}
}
\ No newline at end of file