Commit a5d29187 authored by Davis King's avatar Davis King

Fixed some compile time errors related to sparse vector use.

parent d76511de
......@@ -10,6 +10,7 @@
#include <vector>
#include <utility>
#include <algorithm>
#include "sparse_vector.h"
namespace dlib
{
......@@ -71,7 +72,7 @@ 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
)
{
......@@ -87,9 +88,29 @@ namespace dlib
return false;
}
// If these are dense vectors then they must all have the same dimensionality.
if (is_matrix<T>::value)
return true;
}
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);
for (unsigned long i = 0; i < samples.size(); ++i)
{
......@@ -110,7 +131,6 @@ namespace dlib
return false;
}
}
}
return true;
}
......
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