Added tests for sparse matrices. Fixes Issue #1521

Very simple straightforward issue.
Gives error when using chi2 and additice_chi2 with sparse matrices.