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
a5d29187
"vscode:/vscode.git/clone" did not exist on "3f229d64f847d6921c69bf5c19f67c340a1ed617"
Commit
a5d29187
authored
Nov 23, 2012
by
Davis King
Browse files
Fixed some compile time errors related to sparse vector use.
parent
d76511de
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
20 deletions
+40
-20
dlib/svm/ranking_tools.h
dlib/svm/ranking_tools.h
+40
-20
No files found.
dlib/svm/ranking_tools.h
View file @
a5d29187
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#include <vector>
#include <vector>
#include <utility>
#include <utility>
#include <algorithm>
#include <algorithm>
#include "sparse_vector.h"
namespace
dlib
namespace
dlib
{
{
...
@@ -71,7 +72,7 @@ namespace dlib
...
@@ -71,7 +72,7 @@ namespace dlib
template
<
template
<
typename
T
typename
T
>
>
bool
is_ranking_problem
(
typename
disable_if
<
is_matrix
<
T
>
,
bool
>::
type
is_ranking_problem
(
const
std
::
vector
<
ranking_pair
<
T
>
>&
samples
const
std
::
vector
<
ranking_pair
<
T
>
>&
samples
)
)
{
{
...
@@ -87,9 +88,29 @@ namespace dlib
...
@@ -87,9 +88,29 @@ namespace dlib
return
false
;
return
false
;
}
}
// If these are dense vectors then they must all have the same dimensionality.
return
true
;
if
(
is_matrix
<
T
>::
value
)
}
template
<
typename
T
>
typename
enable_if
<
is_matrix
<
T
>
,
bool
>::
type
is_ranking_problem
(
const
std
::
vector
<
ranking_pair
<
T
>
>&
samples
)
{
{
if
(
samples
.
size
()
==
0
)
return
false
;
for
(
unsigned
long
i
=
0
;
i
<
samples
.
size
();
++
i
)
{
if
(
samples
[
i
].
relevant
.
size
()
==
0
)
return
false
;
if
(
samples
[
i
].
nonrelevant
.
size
()
==
0
)
return
false
;
}
// If these are dense vectors then they must all have the same dimensionality.
const
long
dims
=
max_index_plus_one
(
samples
[
0
].
relevant
);
const
long
dims
=
max_index_plus_one
(
samples
[
0
].
relevant
);
for
(
unsigned
long
i
=
0
;
i
<
samples
.
size
();
++
i
)
for
(
unsigned
long
i
=
0
;
i
<
samples
.
size
();
++
i
)
{
{
...
@@ -110,7 +131,6 @@ namespace dlib
...
@@ -110,7 +131,6 @@ namespace dlib
return
false
;
return
false
;
}
}
}
}
}
return
true
;
return
true
;
}
}
...
...
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