Hi everyone, I'm new to Matlab and trying to get rid of java/c programmer customs. I'm trying to do same thing without any loop.(To increase performance since I'm dealing with matrices of size O(50'000×50'000) ).
Basically I'm trying to find number of rows of the matrix A that have 1 at both column i and column j. I need these two for loop to have(/access to) all possible 2-column combinations of A.
Thanks in advance
PS: Matrix a is (binary) sparse vector.
MATLAB codetic%%step 1 create random matrix, t>10'000
A=logical(rand(t,n0)<p);toc%step 2 this step is really fast, nothing to change
tic%finding weight of all columns, summing up 1's in each column
wi=sum(A);%marking vectors that do not satisfy condition
marked=find(wi<=(1-delta)*u1);toc%step 3
tic%finding number of rows of A that have 1 at both column i and column j
%by multiplying it with its transpose
B=sparse(A)'*sparse(A);%getting numbers (i.e )
W=triu(B,1);edges=(W>=meanvalue);toc
I'm still trying to optimize step 1 and step 3.
Best Answer