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
f0ccfd40
Commit
f0ccfd40
authored
Jun 13, 2015
by
Davis King
Browse files
Added an if to avoid a possible division by zero inside spectral_cluster().
parent
7e9013f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
dlib/clustering/spectral_cluster.h
dlib/clustering/spectral_cluster.h
+3
-1
No files found.
dlib/clustering/spectral_cluster.h
View file @
f0ccfd40
...
@@ -59,7 +59,9 @@ namespace dlib
...
@@ -59,7 +59,9 @@ namespace dlib
for
(
long
r
=
0
;
r
<
v
.
nr
();
++
r
)
for
(
long
r
=
0
;
r
<
v
.
nr
();
++
r
)
{
{
spec_samps
.
push_back
(
trans
(
rowm
(
v
,
r
)));
spec_samps
.
push_back
(
trans
(
rowm
(
v
,
r
)));
spec_samps
.
back
()
/=
length
(
spec_samps
.
back
());
const
double
len
=
length
(
spec_samps
.
back
());
if
(
len
!=
0
)
spec_samps
.
back
()
/=
len
;
}
}
// Finally do the K-means clustering
// Finally do the K-means clustering
pick_initial_centers
(
num_clusters
,
centers
,
spec_samps
);
pick_initial_centers
(
num_clusters
,
centers
,
spec_samps
);
...
...
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