Finish implementing sparse matrices support.