Sparse matrix check