49 template<
typename dtype>
54 const auto covariance =
cov(x);
55 auto normalizedCovariance =
empty_like(covariance);
56 for (
decltype(covariance.numRows()) i = 0; i < covariance.numRows(); ++i)
58 for (
decltype(covariance.numCols()) j = 0; j < covariance.numCols(); ++j)
60 normalizedCovariance(i, j) = covariance(i, j) /
sqrt(covariance(i, i) * covariance(j, j));
64 return normalizedCovariance;
#define STATIC_ASSERT_ARITHMETIC_OR_COMPLEX(dtype)
Definition StaticAsserts.hpp:56
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
Definition Cartesian.hpp:40
NdArray< double > cov(const NdArray< dtype > &x, Bias bias=Bias::NO)
Definition cov.hpp:53
NdArray< dtype > empty_like(const NdArray< dtype > &inArray)
Definition empty_like.hpp:44
auto sqrt(dtype inValue) noexcept
Definition sqrt.hpp:48
NdArray< double > corrcoef(const NdArray< dtype > &x)
Definition corrcoef.hpp:50