Commit 539993f3 authored by Davis King's avatar Davis King

Avoid division by zero in running_scalar_covariance_decayed.

parent 7c631857
......@@ -549,7 +549,11 @@ namespace dlib
<< "\n\tthis: " << this
);
return covariance() / std::sqrt(variance_x()*variance_y());
T temp = std::sqrt(variance_x()*variance_y());
if (temp != 0)
return covariance() / temp;
else
return 0; // just say it's zero if there isn't any variance in x or y.
}
T variance_x (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment