SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MatrixFeatures.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) 2012 Fernando José Iglesias García
8  * Copyright (C) 2012 Fernando José Iglesias García
9  */
10 
11 #ifndef _MATRIX_FEATURES__H__
12 #define _MATRIX_FEATURES__H__
13 
14 #include <shogun/lib/config.h>
15 
18 
19 
20 namespace shogun
21 {
22 
31 template< class ST > class CMatrixFeatures : public CFeatures
32 {
33  public:
36 
42  CMatrixFeatures(int32_t num_vecs, int32_t num_feats = 0);
43 
49  CMatrixFeatures(SGMatrixList< ST > feats, int32_t num_feats = 0);
50 
62  CMatrixFeatures(SGMatrix< ST > feats, int32_t feat_length, int32_t num_vecs);
63 
68  virtual CFeatures* duplicate() const;
69 
71  virtual ~CMatrixFeatures();
72 
77  virtual EFeatureType get_feature_type() const;
78 
83  virtual EFeatureClass get_feature_class() const;
84 
91  virtual int32_t get_num_vectors() const { return m_num_vectors; }
92 
99  SGMatrix< ST > get_feature_vector(int32_t num) const;
100 
107  void get_feature_vector_col(SGVector< ST > out, int32_t num, int32_t col) const;
108 
114  void set_feature_vector(SGMatrix< ST > const vec, int32_t num);
115 
120  inline SGMatrixList< ST > get_features() const { return m_features; }
121 
127  void set_features(SGMatrixList< ST > features, int32_t num_feats);
128 
130  virtual const char* get_name() const { return "MatrixFeatures"; }
131 
133  inline int32_t get_num_features() const { return m_num_features; }
134 
138  static CMatrixFeatures* obtain_from_generic(CFeatures* const base_features);
139 
140  private:
142  void init();
143 
145  void cleanup();
146 
147  private:
149  int32_t m_num_vectors;
150 
152  int32_t m_num_features;
153 
155  SGMatrixList< ST > m_features;
156 
157 }; /* class CMatrixFeatures */
158 
159 } /* namespace shogun */
160 
161 #endif /* _MATRIX_FEATURES__H__ */

SHOGUN Machine Learning Toolbox - Documentation