SHOGUN  v3.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 
21 const int32_t LOGSUM_TBL=10000;
22 
30 {
31  public:
35  CLocalAlignmentStringKernel(int32_t size=0);
36 
46  float64_t opening=10, float64_t extension=2);
47 
49 
56  virtual bool init(CFeatures* l, CFeatures* r);
57 
59  virtual void cleanup();
60 
66  {
67  return K_LOCALALIGNMENT;
68  }
69 
74  virtual const char* get_name() const
75  {
76  return "LocalAlignmentStringKernel";
77  }
78 
79  protected:
88  virtual float64_t compute(int32_t idx_a, int32_t idx_b);
89 
90 
91  private:
93  void init_logsum();
94 
101  int32_t LogSum(int32_t p1, int32_t p2);
102 
109  float32_t LogSum2(float32_t p1, float32_t p2);
110 
119  float64_t LAkernelcompute(
120  int32_t* aaX, int32_t* aaY, int32_t nX, int32_t nY);
121 
124  void init_static_variables();
125 
126  void init();
127 
128  protected:
131 
133  int32_t *isAA;
135  int32_t *aaIndex;
136 
138  int32_t m_opening;
140  int32_t m_extension;
141 
143  static int32_t logsum_lookup[LOGSUM_TBL];
145  static const int32_t blosum[];
147  int32_t* scaled_blosum;
149  static const char* aaList;
150 };
151 }
152 #endif /* _LOCALALIGNMENTSTRINGKERNEL_H__ */

SHOGUN Machine Learning Toolbox - Documentation