From: Ross Anderson on
Hi all,

I have Ax=B where A and B are sparse. I want to reduce this so any row ax=b is unique, but I don't have the resources to make A and B full first. If I could, I could say

Afull = [full(A) full(B)];
[newmat,index] = unique(Afull,'rows','first');
repeatedIndex = setdiff(1:size(Afull,1),index);
Af = full(A);
Bf = full(B);
Af(repeatedIndex,:) = [];
Bf(repeatedIndex)=[];
A = sparse(Af);
B = sparse(Bf);

but is there a way to do this without un-sparsifying A and B?
I have the components of A and B in vectors
A = sparse(rows(:,1),rows(:,2),rows(:,3),numrows,sizeX);
and I can guarantee that for a row the non-zero elements are in ascending order. I was thinking I might search the matrix rows for a block [rows(:,2) rows(:,3)] with a different rows(:,1). But that seems overly complicated and slow.

Suggestions?