Handling sparse matrix also for CV