fast_cov( X )

fast_cov(X): Covariance calculation 15-35% faster than MATLAB built-in cov() for high-dimensional X
66 Downloads
Updated 15 Nov 2017

View License

fast_cov(): Covariance calculation 15-35% faster than MATLAB built-in cov() for high-dimensional X
Input X : M x N ( # features x # samples)
Output Xcov : M x M covariance matrix
NOTE: Easy to confirm that output of fast_cov(X) == cov(X')

Cite As

Joseph Betthauser (2026). fast_cov( X ) (https://www.mathworks.com/matlabcentral/fileexchange/65070-fast_cov-x), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and MATLAB Answers
Version Published Release Notes
1.0.0.0

Specified that the speed boost is achieved particularly for high-dimensional data. For small data matrices, cov() is faster or equivalent.