From 6da62159d08009d7bf6def314e4e3317d889d4b5 Mon Sep 17 00:00:00 2001 From: "tqchen@graphlab.com" Date: Mon, 25 Aug 2014 12:10:45 -0700 Subject: [PATCH] fix by giulio --- src/data.h | 4 ++-- src/tree/model.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/data.h b/src/data.h index f85b69034..1c9d9a290 100644 --- a/src/data.h +++ b/src/data.h @@ -373,8 +373,8 @@ class FMatrixS : public FMatrixInterface{ unsigned ncol = static_cast(this->NumCol()); #pragma omp parallel for schedule(static) for (unsigned i = 0; i < ncol; ++i) { - std::sort(&col_data_[col_ptr_[i]], - &col_data_[col_ptr_[i + 1]], Entry::CmpValue); + std::sort(&col_data_[0] + col_ptr_[i], + &col_data_[0] + col_ptr_[i + 1], Entry::CmpValue); } } diff --git a/src/tree/model.h b/src/tree/model.h index af99a5145..650e6b305 100644 --- a/src/tree/model.h +++ b/src/tree/model.h @@ -259,10 +259,12 @@ class TreeModel { } /*! \brief get leaf vector given nid */ inline bst_float* leafvec(int nid) { + if (leaf_vector.size() == 0) return NULL; return &leaf_vector[nid * param.size_leaf_vector]; } /*! \brief get leaf vector given nid */ inline const bst_float* leafvec(int nid) const{ + if (leaf_vector.size() == 0) return NULL; return &leaf_vector[nid * param.size_leaf_vector]; } /*! \brief initialize the model */