The C++ interface for Correlation Coefficient. More...

template<typename ty >
ty corrcoef (const array &x, const array &y)
 Correlation coefficient of two inputs of same size. More...
 

Detailed Description

The C++ interface for Correlation Coefficient.

Returns the correlation coefficient of a set of elements

Function Documentation

ty af::corrcoef ( const array &  x,
const array &  y 
)

Correlation coefficient of two inputs of same size.

array a = array(seq(5));
array b = array(seq(5))-2*constant(1,5);
print(a); // 0 1 2 3 4
print(b); // -2 -1 0 1 2
float c = corrcoef<float>(a,b);
printf("%f\n",c); // 0.10
Parameters
[in]xinput
[in]yinput same size as x
Returns
Correlation coefficient between inputs