# Calculate the covariance of a large matrix

I have to compute the covariance of 50 very large integer matrices (2500x2000 elements). However, according to my estimation this will take around 10 days. Do you have any ideas how to speed things up?

-
A 5000x5000 matrix calculates under 10s for me Covariance[RandomReal[1, {5000, 5000}]]; // AbsoluteTiming What type of elements do you have? –  ssch Nov 14 '13 at 20:58
How did you estimate it will takes 10 days per matrix? (btw, 10 days using which type of computer? since the CPU type and amount of RAM should make some difference) –  Nasser Nov 14 '13 at 21:01
@Nasser Sorry, I made a mistake; it's 10 days altogether. I compute the covariance of 100 smaller, and scaled everything assuming linearity. –  phidelio Nov 14 '13 at 21:10
@ssch Well, maybe it depends on the matrix. I take the data from a stack of 50 b/w tiff files. Could you try with random tiff image? –  phidelio Nov 14 '13 at 21:17
@phidelio Make sure your matrix contains only machine precision numbers, i.e. use N[matrix] instead of matrix. –  Szabolcs Nov 14 '13 at 21:26

Use Covariance@N[matrix] instead of Covariance[matrix].