mirror of https://github.com/davisking/dlib.git
Added another overload to kernel_matrix() so it can work with random_subset_selector
objects. --HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403810
This commit is contained in:
parent
dceac7e9c4
commit
c01d94b7bc
|
@ -7,6 +7,7 @@
|
|||
#include "kernel_matrix_abstract.h"
|
||||
#include "../matrix.h"
|
||||
#include "../algs.h"
|
||||
#include "../statistics/random_subset_selector.h"
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
|
@ -23,6 +24,12 @@ namespace dlib
|
|||
return m(i);
|
||||
}
|
||||
|
||||
template <typename kernel_type, typename T, typename Rand_type>
|
||||
inline const T& access ( const random_subset_selector<T,Rand_type>& m, long i)
|
||||
{
|
||||
return m[i];
|
||||
}
|
||||
|
||||
template <typename kernel_type, typename T, typename alloc>
|
||||
inline const T& access ( const std::vector<T,alloc>& m, long i)
|
||||
{
|
||||
|
@ -52,6 +59,12 @@ namespace dlib
|
|||
return m.size();
|
||||
}
|
||||
|
||||
template <typename kernel_type, typename T, typename Rand_type>
|
||||
inline unsigned long size ( const random_subset_selector<T,Rand_type>& m)
|
||||
{
|
||||
return m.size();
|
||||
}
|
||||
|
||||
template <typename kernel_type, typename T, typename alloc>
|
||||
inline unsigned long size ( const std::vector<T,alloc>& m)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,8 @@ namespace dlib
|
|||
requires
|
||||
- kernel == a kernel function object as defined by the file dlib/svm/kernel_abstract.h.
|
||||
This kernel must also be capable of operating on the contents of v.
|
||||
- V == dlib::matrix, std::vector, dlib::std_vector_c, or kernel_type::sample_type.
|
||||
- V == dlib::matrix, std::vector, dlib::std_vector_c, dlib::random_subset_selector, or
|
||||
kernel_type::sample_type.
|
||||
- if (V is a dlib::matrix) then
|
||||
- is_vector(v) == true
|
||||
ensures
|
||||
|
@ -58,8 +59,10 @@ namespace dlib
|
|||
requires
|
||||
- kernel == a kernel function object as defined by the file dlib/svm/kernel_abstract.h
|
||||
This kernel must also be capable of operating on the contents of v1 and v2.
|
||||
- V1 == dlib::matrix, std::vector, dlib::std_vector_c, or kernel_type::sample_type.
|
||||
- V2 == dlib::matrix, std::vector, dlib::std_vector_c, or kernel_type::sample_type.
|
||||
- V1 == dlib::matrix, std::vector, dlib::std_vector_c, dlib::random_subset_selector, or
|
||||
kernel_type::sample_type.
|
||||
- V2 == dlib::matrix, std::vector, dlib::std_vector_c, dlib::random_subset_selector, or
|
||||
kernel_type::sample_type.
|
||||
- if (V1 is a dlib::matrix) then
|
||||
- is_vector(v1) == true
|
||||
- if (V2 is a dlib::matrix) then
|
||||
|
|
Loading…
Reference in New Issue