function test vn = [5,50,200,500] if 0 et =zeros(1,4); et2 =zeros(1,4); idn = 1; vn = [5,50,200,500] for n= vn A=rand(n);B=rand(n);C=rand(n); tic; for i=1:10 C=matmult(A,B); end et(idn) = toc; tic; for i=1:10 C=A*B; end et2(idn) = toc; idn =idn+1; end save blas_test else load blas_test end itload('../blas_test.it') figure plot(vn,et) hold on plot(vn,et2,'r'); plot(vn,exec_times,'--') plot(vn,exec_times_b,'r--') plot(vn,exec_times_c,'g--') title('For cycle vs. BLAS'); ylabel('execution time'); xlabel('matrix size'); set(gca,'YScale','log') set(gca,'XScale','log') set(gcf,'PaperPositionMode','auto'); legend('matlab for','matlab blas','IT++ for','IT++ blas','C array') function C=matmult(A,B) for i=1:size(A,1) for j=1:size(A,2) sum=0; for k=1:size(A,2) sum=sum+A(i,k)*B(k,j); end C(i,j)=sum; end end