Tapkee
 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.
19 {
21  inline tapkee::ScalarType kernel(int a, int b) const
22  {
23  return kernel_matrix(a,b);
24  }
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.
33 {
35  inline tapkee::ScalarType distance(int a, int b) const
36  {
37  return distance_matrix(a,b);
38  }
40 };
41 
42 }
43 #endif
44 
Eigen::Matrix< tapkee::ScalarType, Eigen::Dynamic, Eigen::Dynamic > DenseMatrix
dense matrix type (non-overridable)
Definition: types.hpp:23
const tapkee::DenseMatrix & distance_matrix
double ScalarType
default scalar value (can be overrided with TAPKEE_CUSTOM_INTERNAL_NUMTYPE define) ...
Definition: types.hpp:15
const tapkee::DenseMatrix & kernel_matrix
tapkee::ScalarType kernel(int a, int b) const
precomputed_kernel_callback(const tapkee::DenseMatrix &matrix)
tapkee::ScalarType distance(int a, int b) const
precomputed_distance_callback(const tapkee::DenseMatrix &matrix)