[filter/derivative] Fix sparse matrix support