Fix allclose() check for sparse matrices.