| 310 | |
| 311 | template <typename T> |
| 312 | void test_correlation_scales ( |
| 313 | const T x_scale, |
| 314 | const T y_scale |
| 315 | ) |
| 316 | { |
| 317 | running_scalar_covariance<T> positive, negative, partial; |
| 318 | positive.add(-x_scale, -y_scale); |
| 319 | positive.add(0, 0); |
| 320 | positive.add(x_scale, y_scale); |
| 321 | negative.add(-x_scale, y_scale); |
| 322 | negative.add(0, 0); |
| 323 | negative.add(x_scale, -y_scale); |
| 324 | partial.add(-x_scale, 0); |
| 325 | partial.add(0, -y_scale); |
| 326 | partial.add(x_scale, y_scale); |
| 327 | |
| 328 | const T tolerance = 8*std::numeric_limits<T>::epsilon(); |
| 329 | DLIB_TEST_MSG(std::abs(positive.correlation()-1) < tolerance, |
| 330 | "x_scale: " << x_scale << " y_scale: " << y_scale |
| 331 | << " correlation: " << positive.correlation()); |
| 332 | DLIB_TEST_MSG(std::abs(negative.correlation()+1) < tolerance, |
| 333 | "x_scale: " << x_scale << " y_scale: " << y_scale |
| 334 | << " correlation: " << negative.correlation()); |
| 335 | DLIB_TEST_MSG(std::abs(partial.correlation()-T(0.5)) < tolerance, |
| 336 | "x_scale: " << x_scale << " y_scale: " << y_scale |
| 337 | << " correlation: " << partial.correlation()); |
| 338 | } |
| 339 | |
| 340 | template <typename T> |
| 341 | void test_running_scalar_correlation() |
nothing calls this directly
no test coverage detected