Skip to content

slayton/matlab-corr-col

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

matlab-corr-col

Quickly compute a the column by column correlation between large matrices.

Usage Example

Create two large matrices

A = rand(100, 5000);
B = rand(100, 5000);

Meausre the time required to compute the column by column correlation using:

corr_col
tic;
C1 = corr_col(A,B);
t1 = toc;
diag + corr
tic;
C2 = diag(corr(A,B));
t2 = toc;
loop + corr
tic;
C3 = zeros(size(A,1),1);
for i = 1:size(A,2);
    C3(i) = corr(A(:,i), B(:,i));
end
t3 = toc;

Results

Results:
  col_corr:  0.0080 seconds
  diag+corr: 0.1953 seconds
  loop+corr: 1.0560 seconds
Difference between results:
  col_corr  vs diag+corr: 0.1747e-12
  loop+corr vs diag+corr: 0.1397e-12

About

Quickly compute a the column by column correlation between large matrices

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages