00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2011 Heiko Strathmann 00008 * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society 00009 */ 00010 00011 #ifndef __SUBSET_H_ 00012 #define __SUBSET_H_ 00013 00014 #include <shogun/base/SGObject.h> 00015 00016 namespace shogun 00017 { 00018 00024 class CSubset: public CSGObject 00025 { 00026 public: 00028 CSubset(); 00029 00034 CSubset(SGVector<index_t> subset_idx); 00035 00037 virtual ~CSubset(); 00038 00040 inline const char* get_name() const { return "Subset"; } 00041 00045 inline const index_t get_size() const { return m_subset_idx.vlen; } 00046 00048 CSubset* duplicate(); 00049 00055 inline index_t subset_idx_conversion(index_t idx) const 00056 { 00057 return m_subset_idx.vector ? m_subset_idx.vector[idx] : idx; 00058 } 00059 private: 00060 void init(); 00061 00062 private: 00063 const SGVector<index_t> m_subset_idx; 00064 }; 00065 00066 } 00067 #endif /* __SUBSET_H_ */