fix for ulong
This commit is contained in:
parent
90c698ba13
commit
b34a56b1f9
@ -71,13 +71,13 @@ extern "C" {
|
|||||||
SEXP missing) {
|
SEXP missing) {
|
||||||
_WrapperBegin();
|
_WrapperBegin();
|
||||||
SEXP dim = getAttrib(mat, R_DimSymbol);
|
SEXP dim = getAttrib(mat, R_DimSymbol);
|
||||||
bst_ulong nrow = static_cast<bst_ulong>(INTEGER(dim)[0]);
|
size_t nrow = static_cast<size_t>(INTEGER(dim)[0]);
|
||||||
bst_ulong ncol = static_cast<bst_ulong>(INTEGER(dim)[1]);
|
size_t ncol = static_cast<size_t>(INTEGER(dim)[1]);
|
||||||
double *din = REAL(mat);
|
double *din = REAL(mat);
|
||||||
std::vector<float> data(nrow * ncol);
|
std::vector<float> data(nrow * ncol);
|
||||||
#pragma omp parallel for schedule(static)
|
#pragma omp parallel for schedule(static)
|
||||||
for (bst_omp_uint i = 0; i < nrow; ++i) {
|
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];
|
data[i * ncol +j] = din[i + nrow * j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -161,7 +161,8 @@ extern "C"{
|
|||||||
bst_ulong nelem = 0;
|
bst_ulong nelem = 0;
|
||||||
for (bst_ulong j = 0; j < ncol; ++j) {
|
for (bst_ulong j = 0; j < ncol; ++j) {
|
||||||
if (isnan(data[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 {
|
} else {
|
||||||
if (nan_missing || data[j] != missing) {
|
if (nan_missing || data[j] != missing) {
|
||||||
mat.row_data_.push_back(RowBatch::Entry(j, data[j]));
|
mat.row_data_.push_back(RowBatch::Entry(j, data[j]));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user