Following are the changes and enhancement proposed in this PR.

1. added a new method nnz in sparse, which returns the number of non-zero elements of Matrix.

2. added a function doktocsr to convert dictionary format to csr format. This format will be used for sparse arithmetic in the next PR. I was not sure where to place them so I created a new file mat.py.

3. added tests
Fixing failing tests, but there is a trailing white space in docstring of __neg__ method of sparse. I am not able to remove it yet, but will do it subsequent commit.
Addressed comments. I left initalizing of  A, IA and JA to empty lists, as I think they serve as good documentation.
Fixed bugs in the current implementation. Also added some new tests
Fixed the test failure, it was failing because it was not handling the case of multiple zero rows at the end.
Unwanted changes
Trying to fix errors

into newsparse

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.