# tensorplay.functional.corrcoef Source: https://www.tensorplay.cn/docs/generated/tensorplay.functional.corrcoef.html ```python tensorplay.functional.corrcoef(input) → Tensor ``` Estimates the Pearson product-moment correlation coefficient matrix of the variables given by the input matrix, where rows are the variables and columns are the observations. > **Note** > > The correlation coefficient matrix R is computed using the covariance matrix C as given by $R_{ij} = \frac{ C_{ij} } { \sqrt{ C_{ii} * C_{jj} } }$ > **Note** > > Due to floating point rounding, the resulting array may not be Hermitian and its diagonal elements may not be 1. The real and imaginary values are clipped to the interval [-1, 1] in an attempt to improve this situation. Parameters: input ([Tensor](/docs/generated/tensorplay.Tensor.html#tensorplay.Tensor)) – A 2D matrix containing multiple variables and observations, or a Scalar or 1D vector representing a single variable. Returns: (Tensor) The correlation coefficient matrix of the variables. > **See also** > > tensorplay.cov() covariance matrix. Example: ``` >>> x = tensorplay.tensor([[0, 1, 2], [2, 1, 0]]) >>> tensorplay.corrcoef(x) tensor([[ 1., -1.], [-1., 1.]]) >>> x = tensorplay.randn(2, 4) >>> x tensor([[-0.2678, -0.0908, -0.3766, 0.2780], [-0.5812, 0.1535, 0.2387, 0.2350]]) >>> tensorplay.corrcoef(x) tensor([[1.0000, 0.3582], [0.3582, 1.0000]]) >>> tensorplay.corrcoef(x[0]) tensor(1.) ```