FIX comparison operators for non-canonical compressed sparse matrices

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