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

Function XGDMatrixSliceDMatrixEx

src/c_api/c_api.cc:601–612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

599}
600
601XGB_DLL int XGDMatrixSliceDMatrixEx(DMatrixHandle handle, const int *idxset, xgboost::bst_ulong len,
602 DMatrixHandle *out, int allow_groups) {
603 API_BEGIN();
604 CHECK_HANDLE();
605 if (!allow_groups) {
606 CHECK_EQ(static_cast<std::shared_ptr<DMatrix> *>(handle)->get()->Info().group_ptr_.size(), 0U)
607 << "slice does not support group structure";
608 }
609 DMatrix *dmat = static_cast<std::shared_ptr<DMatrix> *>(handle)->get();
610 *out = new std::shared_ptr<DMatrix>(dmat->Slice({idxset, static_cast<std::size_t>(len)}));
611 API_END();
612}
613
614XGB_DLL int XGDMatrixFree(DMatrixHandle handle) {
615 API_BEGIN();

Callers 4

SliceDMatrixWinWarFunction · 0.85
SliceDMatrixWinWar<long>Function · 0.85
XGDMatrixSliceDMatrixFunction · 0.85
XGDMatrixSliceDMatrix_RFunction · 0.85

Calls 4

sizeMethod · 0.45
InfoMethod · 0.45
getMethod · 0.45
SliceMethod · 0.45

Tested by

no test coverage detected