Tapkee
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
precomputed_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, Fernando Iglesias
4
*/
5
6
#ifndef TAPKEE_PRECOMPUTED_CALLBACKS_H_
7
#define TAPKEE_PRECOMPUTED_CALLBACKS_H_
8
9
namespace
tapkee
10
{
11
// Here we provide basic but still full set of callbacks
12
// based on the Eigen3 template matrix library
13
14
// Kernel function callback that computes
15
// similarity function values on vectors
16
// given by their indices. This impl. computes
17
// linear kernel i.e. dot product between two vectors.
18
struct
precomputed_kernel_callback
19
{
20
precomputed_kernel_callback
(
const
tapkee::DenseMatrix
& matrix) :
kernel_matrix
(matrix) {};
21
inline
tapkee::ScalarType
kernel
(
int
a,
int
b)
const
22
{
23
return
kernel_matrix
(a,b);
24
}
25
const
tapkee::DenseMatrix
&
kernel_matrix
;
26
};
27
28
// Distance function callback that provides
29
// dissimilarity function values on vectors
30
// given by their indices. This impl. computes
31
// euclidean distance between two vectors.
32
struct
precomputed_distance_callback
33
{
34
precomputed_distance_callback
(
const
tapkee::DenseMatrix
& matrix) :
distance_matrix
(matrix) {};
35
inline
tapkee::ScalarType
distance
(
int
a,
int
b)
const
36
{
37
return
distance_matrix
(a,b);
38
}
39
const
tapkee::DenseMatrix
&
distance_matrix
;
40
};
41
42
}
43
#endif
44
include
tapkee
callbacks
precomputed_callbacks.hpp
Generated by
1.8.3.1