fix windows run
This commit is contained in:
@@ -8,7 +8,9 @@
|
||||
#include <algorithm>
|
||||
// include all std functions
|
||||
using namespace std;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define isnan(x) (_isnan(x) != 0)
|
||||
#endif
|
||||
#include "./xgboost_wrapper.h"
|
||||
#include "../src/data.h"
|
||||
#include "../src/learner/learner-inl.hpp"
|
||||
@@ -149,7 +151,7 @@ extern "C"{
|
||||
bst_ulong nrow,
|
||||
bst_ulong ncol,
|
||||
float missing) {
|
||||
bool nan_missing = std::isnan(missing);
|
||||
bool nan_missing = isnan(missing);
|
||||
DMatrixSimple *p_mat = new DMatrixSimple();
|
||||
DMatrixSimple &mat = *p_mat;
|
||||
mat.info.info.num_row = nrow;
|
||||
@@ -157,7 +159,7 @@ extern "C"{
|
||||
for (bst_ulong i = 0; i < nrow; ++i, data += ncol) {
|
||||
bst_ulong nelem = 0;
|
||||
for (bst_ulong j = 0; j < ncol; ++j) {
|
||||
if (std::isnan(data[j])) {
|
||||
if (isnan(data[j])) {
|
||||
utils::Check(nan_missing, "There are NAN in the matrix, however, you did not set missing=NAN");
|
||||
} else {
|
||||
if (nan_missing || data[j] != missing) {
|
||||
|
||||
Reference in New Issue
Block a user