// ----------------------------------------------------------------------
// Convert this sparse matrix into a dense matrix.
startTimer();
Matrix D = Matrix.create(M);
printTime("Convert small sparse matrix to dense: ");
// ----------------------------------------------------------------------
// Check equality from M.
startTimer();
boolean eq = M.equals(D);
printTime("Equality check result (" + eq + "): ");
// ----------------------------------------------------------------------
// Check equality from D.
startTimer();
eq = D.epsilonEquals(M, 0.000001);
printTime("epsilonEquals check result (" + eq + ", should be true): ");
// ----------------------------------------------------------------------
// Change sparse matrix and test equality again (shouldn't be equal)
startTimer();
M.addAt(SSIZE-1, SSIZE-1, 3.14159);
eq = M.equals(D);
printTime("Equality check result (" + eq + ", should be false): ");
// ----------------------------------------------------------------------
// Change dense matrix also; should be equal again.
startTimer();
D.addAt(SSIZE-1, SSIZE-1, 3.14159);
eq = M.equals(D);
printTime("Equality check result (" + eq + ", should be true): ");
}