fix a bug in getting nnz
this version can run, and the sparse jac is encolsed
Merge branch 'dev-jtf' into develop