I have sequential code for sparse matrix multiplication. How to write the same code for parallel processing of sparse matrix?
%%sequential%%
A=[ 0 2 3;0 1 0;0 0 3 ];
[row col v] = find(A);
S(:,1)=row; S(:,2)=col; S(:,3)=v;
S_A = S; clear S;
B=[ 0 0 7;0 8 0;0 9 6 ];
[row col v] = find(B);
S(:,1)=row; S(:,2)=col; S(:,3)=v;
S_B = S;
a = sparse(A);
b = sparse(B);
k3=1;
tic
for i=1:size(S_A,1)
for j=1:size(S_B,1)
if S_A(i,2)== S_B(j,1)
S_ans(k3,3) = S_A(i,3)*S_B(j,3);
S_ans(k3,1)=S_A(i,1); S_ans(k3,2)=S_B(j,2);
k3=k3+1;
end;
end;
end;
time1=toc
I want to run the code for matrix multiplication in parallel in Matlab. I have written the sequential code for it. My aim is to reduce the execution time by running the code in parallelhow do i do it? Thank You