Add sparse matrices support.