From 696af3def3b2e70f57fe6238175ff9d6bf9dcf75 Mon Sep 17 00:00:00 2001 From: Rong Ou Date: Tue, 23 Jul 2019 11:11:59 -0700 Subject: [PATCH] remove RowSet which is no longer being used --- include/xgboost/data.h | 75 ------------------------------------------ 1 file changed, 75 deletions(-) diff --git a/include/xgboost/data.h b/include/xgboost/data.h index 45e41a114130..3d910235ea27 100644 --- a/include/xgboost/data.h +++ b/include/xgboost/data.h @@ -348,41 +348,6 @@ class DataSource : public dmlc::DataIter { MetaInfo info; }; -/*! - * \brief A vector-like structure to represent set of rows. - * But saves the memory when all rows are in the set (common case in xgb) - */ -class RowSet { - public: - /*! \return i-th row index */ - inline bst_uint operator[](size_t i) const; - /*! \return the size of the set. */ - inline size_t Size() const; - /*! \brief push the index back to the set */ - inline void PushBack(bst_uint i); - /*! \brief clear the set */ - inline void Clear(); - /*! - * \brief save rowset to file. - * \param fo The file to be saved. - */ - inline void Save(dmlc::Stream* fo) const; - /*! - * \brief Load rowset from file. - * \param fi The file to be loaded. - * \return if read is successful. - */ - inline bool Load(dmlc::Stream* fi); - /*! \brief constructor */ - RowSet() = default; - - private: - /*! \brief The internal data structure of size */ - uint64_t size_{0}; - /*! \brief The internal data structure of row set if not all*/ - std::vector rows_; -}; - /*! * \brief Internal data structured used by XGBoost during training. * There are two ways to create a customized DMatrix that reads in user defined-format. @@ -467,49 +432,9 @@ class DMatrix { /*! \brief page size 32 MB */ static const size_t kPageSize = 32UL << 20UL; }; - -// implementation of inline functions -inline bst_uint RowSet::operator[](size_t i) const { - return rows_.size() == 0 ? static_cast(i) : rows_[i]; -} - -inline size_t RowSet::Size() const { - return size_; -} - -inline void RowSet::Clear() { - rows_.clear(); size_ = 0; -} - -inline void RowSet::PushBack(bst_uint i) { - if (rows_.size() == 0) { - if (i == size_) { - ++size_; return; - } else { - rows_.resize(size_); - for (size_t i = 0; i < size_; ++i) { - rows_[i] = static_cast(i); - } - } - } - rows_.push_back(i); - ++size_; -} - -inline void RowSet::Save(dmlc::Stream* fo) const { - fo->Write(rows_); - fo->Write(&size_, sizeof(size_)); -} - -inline bool RowSet::Load(dmlc::Stream* fi) { - if (!fi->Read(&rows_)) return false; - if (rows_.size() != 0) return true; - return fi->Read(&size_, sizeof(size_)) == sizeof(size_); -} } // namespace xgboost namespace dmlc { DMLC_DECLARE_TRAITS(is_pod, xgboost::Entry, true); -DMLC_DECLARE_TRAITS(has_saveload, xgboost::RowSet, true); } #endif // XGBOOST_DATA_H_