BUG: sparse: fix __eq__ for matrices with explicit zeros

`_cs_matrix.__eq__` is buggy for matrices with explicit zeros. It and `__ne__` are also buggy for scalar nan comparisons.

This PR fixes those bugs and adds relevant tests.

Fixes gh-3812