SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LocalAlignmentStringKernel.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 1999-2009 Soeren Sonnenburg
8  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #ifndef _LOCALALIGNMENTSTRINGKERNEL_H___
12 #define _LOCALALIGNMENTSTRINGKERNEL_H___
13 
14 #include <shogun/lib/common.h>
16 
17 namespace shogun
18 {
19 #define LOGSUM_TBL 10000 /* span of the logsum table */
20 
28 {
29  public:
33  CLocalAlignmentStringKernel(int32_t size=0);
34 
44  float64_t opening=12, float64_t extension=2);
45 
47 
54  virtual bool init(CFeatures* l, CFeatures* r);
55 
57  virtual void cleanup();
58 
64  {
65  return K_LOCALALIGNMENT;
66  }
67 
72  virtual const char* get_name() const
73  {
74  return "LocalAlignmentStringKernel";
75  }
76 
77  protected:
86  virtual float64_t compute(int32_t idx_a, int32_t idx_b);
87 
88 
89  private:
91  void init_logsum();
92 
99  int32_t LogSum(int32_t p1, int32_t p2);
100 
107  float32_t LogSum2(float32_t p1, float32_t p2);
108 
117  float64_t LAkernelcompute(
118  int32_t* aaX, int32_t* aaY, int32_t nX, int32_t nY);
119 
122  void init_static_variables();
123 
124  void init();
125 
126  protected:
129 
131  int32_t *isAA;
133  int32_t *aaIndex;
134 
136  int32_t m_opening;
138  int32_t m_extension;
139 
141  static int32_t logsum_lookup[LOGSUM_TBL];
143  static const int32_t blosum[];
145  int32_t* scaled_blosum;
147  static const char* aaList;
148 };
149 }
150 #endif /* _LOCALALIGNMENTSTRINGKERNEL_H__ */

SHOGUN Machine Learning Toolbox - Documentation