26#include <ql/math/comparison.hpp>
31 double sum = 0.0, n =
static_cast<Real
>(end1 - begin1);
33 for (
auto v = begin1; v != end1; ++v, ++w) {
35 for (
auto v2 = begin1; v2 != v; ++v2, ++w2) {
36 Real t = (*v2 - *v) * (*w2 - *w);
37 if (!QuantLib::close_enough(t, 0.0)) {
38 sum += t > 0.0 ? 1.0 : -1.0;
42 return 2.0 *
sum / (n * (n - 1));
Real kendallRankCorrelation(I1 begin1, I1 end1, I2 begin2)
Real sum(const Cash &c, const Cash &d)