MCPcopy Create free account
hub / github.com/dmlc/xgboost / XGDMatrixCreateFromMat_R

Function XGDMatrixCreateFromMat_R

R-package/src/xgboost_R.cc:385–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

383}
384
385XGB_DLL SEXP XGDMatrixCreateFromMat_R(SEXP mat, SEXP missing, SEXP n_threads) {
386 SEXP ret = Rf_protect(R_MakeExternalPtr(nullptr, R_NilValue, R_NilValue));
387 R_API_BEGIN();
388
389 DMatrixHandle handle;
390 int res_code;
391 {
392 auto array_str = MakeArrayInterfaceFromRMat(mat);
393 auto config_str = MakeJsonConfigForArray(missing, n_threads, TYPEOF(mat));
394
395 res_code = XGDMatrixCreateFromDense(array_str.c_str(), config_str.c_str(), &handle);
396 }
397 CHECK_CALL(res_code);
398 R_SetExternalPtrAddr(ret, handle);
399 R_RegisterCFinalizerEx(ret, _DMatrixFinalizer, TRUE);
400 R_API_END();
401 Rf_unprotect(1);
402 return ret;
403}
404
405XGB_DLL SEXP XGDMatrixCreateFromDF_R(SEXP df, SEXP missing, SEXP n_threads) {
406 SEXP ret = Rf_protect(R_MakeExternalPtr(nullptr, R_NilValue, R_NilValue));

Callers

nothing calls this directly

Calls 4

MakeJsonConfigForArrayFunction · 0.85
XGDMatrixCreateFromDenseFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected