From b34a56b1f9cd247026aa10d7572a92a26279e761 Mon Sep 17 00:00:00 2001 From: tqchen Date: Wed, 4 Feb 2015 11:18:56 -0800 Subject: [PATCH] fix for ulong --- R-package/src/xgboost_R.cpp | 6 +++--- wrapper/xgboost_wrapper.cpp | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/R-package/src/xgboost_R.cpp b/R-package/src/xgboost_R.cpp index 9ebcec167..39e6a1b66 100644 --- a/R-package/src/xgboost_R.cpp +++ b/R-package/src/xgboost_R.cpp @@ -71,13 +71,13 @@ extern "C" { SEXP missing) { _WrapperBegin(); SEXP dim = getAttrib(mat, R_DimSymbol); - bst_ulong nrow = static_cast(INTEGER(dim)[0]); - bst_ulong ncol = static_cast(INTEGER(dim)[1]); + size_t nrow = static_cast(INTEGER(dim)[0]); + size_t ncol = static_cast(INTEGER(dim)[1]); double *din = REAL(mat); std::vector data(nrow * ncol); #pragma omp parallel for schedule(static) for (bst_omp_uint i = 0; i < nrow; ++i) { - for (bst_ulong j = 0; j < ncol; ++j) { + for (size_t j = 0; j < ncol; ++j) { data[i * ncol +j] = din[i + nrow * j]; } } diff --git a/wrapper/xgboost_wrapper.cpp b/wrapper/xgboost_wrapper.cpp index 2aa523494..6c8f250c1 100644 --- a/wrapper/xgboost_wrapper.cpp +++ b/wrapper/xgboost_wrapper.cpp @@ -151,7 +151,7 @@ extern "C"{ void* XGDMatrixCreateFromMat(const float *data, bst_ulong nrow, bst_ulong ncol, - float missing) { + float missing) { bool nan_missing = isnan(missing); DMatrixSimple *p_mat = new DMatrixSimple(); DMatrixSimple &mat = *p_mat; @@ -161,7 +161,8 @@ extern "C"{ bst_ulong nelem = 0; for (bst_ulong j = 0; j < ncol; ++j) { if (isnan(data[j])) { - utils::Check(nan_missing, "There are NAN in the matrix, however, you did not set missing=NAN"); + utils::Check(nan_missing, + "There are NAN in the matrix, however, you did not set missing=NAN"); } else { if (nan_missing || data[j] != missing) { mat.row_data_.push_back(RowBatch::Entry(j, data[j]));