Tapkee
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
pimpl_callbacks.hpp
Go to the documentation of this file.
1
/* This software is distributed under BSD 3-clause license (see LICENSE file).
2
*
3
* Copyright (c) 2012-2013 Sergey Lisitsyn
4
*/
5
6
#ifndef TAPKEE_PIMPL_CALLBACKS_H_
7
#define TAPKEE_PIMPL_CALLBACKS_H_
8
9
// Kernel function callback that computes
10
// similarity function values on vectors
11
// given by their indices. This impl. computes
12
// kernel i.e. dot product between two vectors.
13
template
<
class
Implementation>
14
struct
pimpl_kernel_callback
15
{
16
pimpl_kernel_callback
(Implementation* i) :
impl
(i) {};
17
inline
tapkee::ScalarType
kernel
(
int
a,
int
b)
const
18
{
19
return
impl
->kernel(a,b);
20
}
21
Implementation*
impl
;
22
};
23
24
// Distance function callback that provides
25
// dissimilarity function values on vectors
26
// given by their indices. This impl. computes
27
// euclidean distance between two vectors.
28
template
<
class
Implementation>
29
struct
pimpl_distance_callback
30
{
31
pimpl_distance_callback
(Implementation* i) :
impl
(i) {};
32
inline
tapkee::ScalarType
distance
(
int
a,
int
b)
const
33
{
34
return
impl
->distance(a,b);
35
}
36
Implementation*
impl
;
37
};
38
39
#endif
include
tapkee
callbacks
pimpl_callbacks.hpp
Generated by
1.8.3.1