Commit 140243f2 authored by Davis King's avatar Davis King

Added a missing check for division by zero.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403306
parent 09606b95
...@@ -93,6 +93,9 @@ namespace dlib ...@@ -93,6 +93,9 @@ namespace dlib
{ {
const scalar_type kx = kern(x,x); const scalar_type kx = kern(x,x);
if (alpha.size() == 0) if (alpha.size() == 0)
{
// just ignore this sample if it is the zero vector (or really close to being zero)
if (std::abs(kx) > std::numeric_limits<scalar_type>::epsilon())
{ {
// set initial state since this is the first training example we have seen // set initial state since this is the first training example we have seen
...@@ -106,6 +109,7 @@ namespace dlib ...@@ -106,6 +109,7 @@ namespace dlib
P.set_size(1,1); P.set_size(1,1);
P(0,0) = 1; P(0,0) = 1;
} }
}
else else
{ {
// fill in k // fill in k
......
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