Skip to content

Commit

Permalink
Update metrics.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
richardnorth3 authored Feb 3, 2025
1 parent 4fade17 commit bb61721
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cpp/oneapi/dal/backend/primitives/distance/metrics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,15 @@ struct correlation_metric : public metric_base<Float> {
if (count == zero)
return Float(zero);

const Float n1_mean = n1_num / count;
const Float n2_mean = n2_num / count;
const Float n1_mean = n1_sum / count;
const Float n2_mean = n2_sum / count;

for (auto it1 = first1, it2 = first2; it1 != last1; ++it1, ++it2) {
const Float v1 = *it1 - n1_mean;
const Float v2 = *it2 - n2_mean;
n1_acc += (v1 * v1);
n2_acc += (v2 * v2);
ip_acc += (v1 * v2);

}
const Float rsqn1 = one / std::sqrt(n1_acc);
const Float rsqn2 = one / std::sqrt(n2_acc);
Expand Down

0 comments on commit bb61721

Please sign in to comment.