FIX comparison operators for non-canonical CSR/C sparse matrices

Fixes #3268, ensures tests are run, and refactors the implementation.