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
"docs/source/vscode:/vscode.git/clone" did not exist on "f73c7a648b6eae0cebb12f7c6d601d594da15366"
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
Hide 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 @@
#include <vector>
#include <utility>
#include <algorithm>
#include "sparse_vector.h"
namespace
dlib
{
...
...
@@ -71,7 +72,29 @@ namespace dlib
template
<
typename
T
>
bool
is_ranking_problem
(
typename
disable_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
;
}
return
true
;
}
template
<
typename
T
>
typename
enable_if
<
is_matrix
<
T
>
,
bool
>::
type
is_ranking_problem
(
const
std
::
vector
<
ranking_pair
<
T
>
>&
samples
)
{
...
...
@@ -88,27 +111,24 @@ namespace dlib
}
// If these are dense vectors then they must all have the same dimensionality.
if
(
is_matrix
<
T
>::
value
)
const
long
dims
=
max_index_plus_one
(
samples
[
0
].
relevant
);
for
(
unsigned
long
i
=
0
;
i
<
samples
.
size
();
++
i
)
{
const
long
dims
=
max_index_plus_one
(
samples
[
0
].
relevant
);
for
(
unsigned
long
i
=
0
;
i
<
samples
.
size
();
++
i
)
for
(
unsigned
long
j
=
0
;
j
<
samples
[
i
].
relevant
.
size
();
++
j
)
{
if
(
is_vector
(
samples
[
i
].
relevant
[
j
])
==
false
)
return
false
;
if
(
samples
[
i
].
relevant
[
j
].
size
()
!=
dims
)
return
false
;
}
for
(
unsigned
long
j
=
0
;
j
<
samples
[
i
].
nonrelevant
.
size
();
++
j
)
{
for
(
unsigned
long
j
=
0
;
j
<
samples
[
i
].
relevant
.
size
();
++
j
)
{
if
(
is_vector
(
samples
[
i
].
relevant
[
j
])
==
false
)
return
false
;
if
(
samples
[
i
].
relevant
[
j
].
size
()
!=
dims
)
return
false
;
}
for
(
unsigned
long
j
=
0
;
j
<
samples
[
i
].
nonrelevant
.
size
();
++
j
)
{
if
(
is_vector
(
samples
[
i
].
nonrelevant
[
j
])
==
false
)
return
false
;
if
(
samples
[
i
].
nonrelevant
[
j
].
size
()
!=
dims
)
return
false
;
}
if
(
is_vector
(
samples
[
i
].
nonrelevant
[
j
])
==
false
)
return
false
;
if
(
samples
[
i
].
nonrelevant
[
j
].
size
()
!=
dims
)
return
false
;
}
}
...
...
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