| 552 | } |
| 553 | |
| 554 | XGB_DLL int XGDMatrixCreateFromCSC(char const *indptr, char const *indices, char const *data, |
| 555 | xgboost::bst_ulong nrow, char const *c_json_config, |
| 556 | DMatrixHandle *out) { |
| 557 | API_BEGIN(); |
| 558 | xgboost_CHECK_C_ARG_PTR(indptr); |
| 559 | xgboost_CHECK_C_ARG_PTR(indices); |
| 560 | xgboost_CHECK_C_ARG_PTR(data); |
| 561 | data::CSCArrayAdapter adapter{StringView{indptr}, StringView{indices}, StringView{data}, |
| 562 | static_cast<std::size_t>(nrow)}; |
| 563 | xgboost_CHECK_C_ARG_PTR(c_json_config); |
| 564 | auto config = Json::Load(StringView{c_json_config}); |
| 565 | float missing = GetMissing(config); |
| 566 | auto n_threads = OptionalArg<Integer, int64_t>(config, "nthread", common::OmpGetNumThreads(0)); |
| 567 | auto data_split_mode = |
| 568 | static_cast<DataSplitMode>(OptionalArg<Integer, int64_t>(config, "data_split_mode", 0)); |
| 569 | xgboost_CHECK_C_ARG_PTR(out); |
| 570 | *out = new std::shared_ptr<DMatrix>( |
| 571 | DMatrix::Create(&adapter, missing, n_threads, "", data_split_mode)); |
| 572 | |
| 573 | API_END(); |
| 574 | } |
| 575 | |
| 576 | XGB_DLL int XGDMatrixCreateFromMat(const bst_float *data, xgboost::bst_ulong nrow, |
| 577 | xgboost::bst_ulong ncol, bst_float missing, DMatrixHandle *out) { |
no test coverage detected