SHOGUN  v3.0.0
 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 
16 
17 
18 namespace shogun
19 {
20 
29 template< class ST > class CMatrixFeatures : public CFeatures
30 {
31  public:
34 
40  CMatrixFeatures(int32_t num_vecs, int32_t num_feats = 0);
41 
47  CMatrixFeatures(SGMatrixList< ST > feats, int32_t num_feats = 0);
48 
60  CMatrixFeatures(SGMatrix< ST > feats, int32_t feat_length, int32_t num_vecs);
61 
66  virtual CFeatures* duplicate() const;
67 
69  virtual ~CMatrixFeatures();
70 
75  virtual EFeatureType get_feature_type() const;
76 
81  virtual EFeatureClass get_feature_class() const;
82 
89  virtual int32_t get_num_vectors() const { return m_num_vectors; }
90 
97  SGMatrix< ST > get_feature_vector(int32_t num) const;
98 
105  void get_feature_vector_col(SGVector< ST > out, int32_t num, int32_t col) const;
106 
112  void set_feature_vector(SGMatrix< ST > const vec, int32_t num);
113 
118  inline SGMatrixList< ST > get_features() const { return m_features; }
119 
125  void set_features(SGMatrixList< ST > features, int32_t num_feats);
126 
128  virtual const char* get_name() const { return "MatrixFeatures"; }
129 
131  inline int32_t get_num_features() const { return m_num_features; }
132 
136  static CMatrixFeatures* obtain_from_generic(CFeatures* const base_features);
137 
138  private:
140  void init();
141 
143  void cleanup();
144 
145  private:
147  int32_t m_num_vectors;
148 
150  int32_t m_num_features;
151 
153  SGMatrixList< ST > m_features;
154 
155 }; /* class CMatrixFeatures */
156 
157 } /* namespace shogun */
158 
159 #endif /* _MATRIX_FEATURES__H__ */

SHOGUN Machine Learning Toolbox - Documentation