Tricks and Tips: Covariance calculation with CUDA

Covariance calculation in CUDA can be easily performed by using cuBLAS in conjunction with Thrust.
Considering N realizations of K random variables, the covariance estimation formula is the following:

Covariance

where qjkj,k=1,…,K are the covariance estimate values,  and   are the random variable means as estimated from the available realizations.

A fully worked example on how calculating the covariance matrix with Thrust and cuBLAS is reported on our GitHub page.

Leave a Reply

Your email address will not be published. Required fields are marked *