make clustering use a sparse matrix