Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
539993f3
Commit
539993f3
authored
Nov 14, 2016
by
Davis King
Browse files
Avoid division by zero in running_scalar_covariance_decayed.
parent
7c631857
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
dlib/statistics/statistics.h
dlib/statistics/statistics.h
+5
-1
No files found.
dlib/statistics/statistics.h
View file @
539993f3
...
...
@@ -549,7 +549,11 @@ namespace dlib
<<
"
\n\t
this: "
<<
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
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment