SHOGUN  v2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlifMatrix.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) 2009 Soeren Sonnenburg
8  * Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 
11 #ifndef _PLIFMATRIX_H_
12 #define _PLIFMATRIX_H_
13 
14 #include <shogun/lib/DataType.h>
15 #include <shogun/lib/SGNDArray.h>
16 #include <shogun/lib/SGMatrix.h>
17 #include <shogun/base/SGObject.h>
18 #include <shogun/structure/Plif.h>
22 
23 namespace shogun
24 {
25 template <class T> class SGString;
26 
29 class CPlifMatrix: public CSGObject
30 {
31  public:
35  CPlifMatrix();
36 
40  ~CPlifMatrix();
41 
46  inline CPlif** get_PEN() { return m_PEN; }
47 
52  inline CPlifBase** get_plif_matrix() { return m_plif_matrix; }
53 
59  inline int32_t get_num_states() { return m_num_states; }
60 
61 
67 
72  inline int32_t get_num_plifs() { return m_num_plifs; }
73 
78  inline int32_t get_num_limits() { return m_num_limits; }
79 
85  void create_plifs(int32_t num_plifs, int32_t num_limits);
86 
92 
98 
103  void set_plif_max_values(SGVector<float64_t> max_values);
104 
109  void set_plif_use_cache(SGVector<bool> use_cache);
110 
115  void set_plif_use_svm(SGVector<int32_t> use_svm);
116 
123 
129  void set_plif_penalties(SGMatrix<float64_t> penalties);
130 
137  void set_plif_names(SGString<char>* names, int32_t num_values, int32_t maxlen=0);
138 
147  void set_plif_transform_type(SGString<char>* transform_type, int32_t num_values, int32_t maxlen=0);
148 
154  inline int32_t get_plif_id(int32_t idx)
155  {
156  int32_t id = m_ids[idx];
157  if (id>=m_num_plifs)
158  SG_ERROR("plif id (%i) exceeds array length (%i)\n",id,m_num_plifs);
159  return id;
160  }
161 
170  bool compute_plif_matrix(SGNDArray<float64_t> penalties_array);
171 
178  bool compute_signal_plifs(SGMatrix<int32_t> state_signals);
179 
186  void set_plif_state_signal_matrix(int32_t *plif_id_matrix, int32_t m, int32_t n);
187 
188 
190  inline virtual const char* get_name() const { return "PlifMatrix"; }
191 
192  protected:
193 
196 
198  int32_t m_num_plifs;
199 
201  int32_t m_num_limits;
202 
204  int32_t m_num_states;
205 
208 
211 
214 
217 };
218 }
219 #endif /* _PLIFMATRIX_H_ */

SHOGUN Machine Learning Toolbox - Documentation