fix for ulong

This commit is contained in:
tqchen 2015-02-04 11:18:56 -08:00
parent 90c698ba13
commit b34a56b1f9
2 changed files with 6 additions and 5 deletions

View File

@ -71,13 +71,13 @@ extern "C" {
SEXP missing) {
_WrapperBegin();
SEXP dim = getAttrib(mat, R_DimSymbol);
bst_ulong nrow = static_cast<bst_ulong>(INTEGER(dim)[0]);
bst_ulong ncol = static_cast<bst_ulong>(INTEGER(dim)[1]);
size_t nrow = static_cast<size_t>(INTEGER(dim)[0]);
size_t ncol = static_cast<size_t>(INTEGER(dim)[1]);
double *din = REAL(mat);
std::vector<float> 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];
}
}

View File

@ -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]));