A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Functions
corrcoef
ArrayFire Functions | ArrayFire Functions by Category » Statistics » Basic statistics functions

## Functions
template<typename T >
AFAPI T | corrcoef (const array &X, const array &Y)
| C++ Interface for correlation coefficient.
AFAPI af_err | af_corrcoef (double *realVal, double *imagVal, const af_array X, const af_array Y)
| C Interface for correlation coefficient.

## Detailed Description

Find the correlation coefficient of values in the input

This function performs the operation across all dimensions of the input array.

## Function Documentation

## ◆ af_corrcoef()

AFAPI af_err af_corrcoef | ( | double * | realVal,
|  | double * | imagVal,
|  | const af_array | X,
|  | const af_array | Y )

C Interface for correlation coefficient.

Parameters

  [out] | realVal | will contain the real part of correlation coefficient of the inputs
  [out] | imagVal | will contain the imaginary part of correlation coefficient of the inputs
  [in] | X | is the first input array
  [in] | Y | is the second input array

Returns
  AF_SUCCESS if the operation is successful, otherwise an appropriate error code is returned.

Note
  There are many ways correlation coefficient is calculated. This algorithm returns Pearson product-moment correlation coefficient.

## ◆ corrcoef()

template<typename T >

AFAPI T corrcoef | ( | const array & | X,
|  | const array & | Y )

C++ Interface for correlation coefficient.

Parameters

  [in] | X | is the first input array
  [in] | Y | is the second input array

Returns
  correlation coefficient of the input arrays

Note
  There are many ways correlation coefficient is calculated. This algorithm returns Pearson product-moment correlation coefficient.