work on sparse matrices