SHOGUN  v2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SGMatrixList.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 __SGMATRIX_LIST_H__
12 #define __SGMATRIX_LIST_H__
13 
15 #include <shogun/lib/SGMatrix.h>
16 
17 namespace shogun
18 {
19 
21 template<class T> class SGMatrixList : public SGReferencedData
22 {
23  public:
25  SGMatrixList();
26 
28  SGMatrixList(SGMatrix<T>* ml, int32_t nmats, bool ref_counting = true);
29 
31  SGMatrixList(int32_t nmats, bool ref_counting = true);
32 
34  SGMatrixList(SGMatrixList const & orig);
35 
37  virtual ~SGMatrixList();
38 
46  inline SGMatrix<T>& get_matrix(index_t index) const
47  {
48  return matrix_list[index];
49  }
50 
58  inline SGMatrix<T>& operator[](index_t index) const
59  {
60  return matrix_list[index];
61  }
62 
73  static SGMatrixList<T> split(SGMatrix<T> matrix, int32_t num_components);
74 
75  protected:
77  virtual void copy_data(SGReferencedData const & orig);
78 
80  virtual void init_data();
81 
83  virtual void free_data();
84 
85  private:
87  void cleanup_matrices();
88 
89  public:
92 
94  int32_t num_matrices;
95 
96 }; /* class SGMatrixList */
97 
98 } /* namespace shogun */
99 
100 #endif /* define __SGMATRIX_LIST_H__ */

SHOGUN Machine Learning Toolbox - Documentation