Simd
Simd

Reputation: 21254

How to find column in a sparse matrix with only one value set

I have a large sparse matrix M. How can I find the index of a column in the matrix which has only one value set? That is exactly one non-zero value.

Upvotes: 1

Views: 92

Answers (1)

Kristoffer Carlsson
Kristoffer Carlsson

Reputation: 2838

I think findall(==(1), diff(M.colptr)) should do it (to find all columns with one stored value).

Upvotes: 3

Related Questions