How to check if two sparse matrices are equal in python

Viewed 117

I have a and b in in Compressed Sparse Column format, generated by scipy.sparse.csc_matrix(). I know that we can use

(a!=b).nnz==0 

to check if the sparsities of two arrays are equal, but how about the nonzeros? I have tried:

np.allclose(a.A, b.A)

But it gives me an error like this:

*** MemoryError

Is there any function that I can use to check if a and b are equal?

0 Answers
Related