Description
We can support sparsity in the in-place format (out of place doesn't really make sense anyways) by dispatching on the return type.
Currently there's no generic way to do this
(JuliaLang/julia#19372 (comment)).
That shows how sparse vectors can easily be handled.
But we can support sparse matrices like is shown there by simply looping over the non-zero elements like that. Our current kernels can be refactored to make use of stuff like:
https://pdfs.semanticscholar.org/ee06/57173bb0f0ed9571e205e970819346fb59de.pdf
for choosing the differencing and ordering. It might be nice to just handle the basic cases for that are easy to decouple, like tridiagonal and banded matrices, with a generic fallback that keeps output sparsity in tact without the computational advantage.