MCPcopy Create free account
hub / github.com/catboost/catboost / ForEach

Method ForEach

catboost/libs/helpers/sparse_array-inl.h:422–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420 template <class TSize>
421 template <class F>
422 inline void TSparseArrayIndexing<TSize>::ForEach(F &&f) const {
423 auto nonDefaultIterator = GetIterator();
424 TSize i = 0;
425 while (auto nextNonDefault = nonDefaultIterator->Next()) {
426 auto nextNonDefaultIndex = *nextNonDefault;
427 for (; i < nextNonDefaultIndex; ++i) {
428 f(i, /*isDefault*/ true);
429 }
430 f(i++, /*isDefault*/ false);
431 }
432 for (; i != Size; ++i) {
433 f(i, /*isDefault*/ true);
434 }
435 }
436
437 template <class TSize>
438 IDynamicIteratorPtr<TSize> TSparseArrayIndexing<TSize>::GetIterator() const {

Callers 7

TestOneCaseFunction · 0.45
TestOneCaseFunction · 0.45
TestMutableFunction · 0.45
CalcTrainSubsetsRangeFunction · 0.45
CatBoostPoolSlice_RFunction · 0.45

Calls 2

fFunction · 0.50
NextMethod · 0.45

Tested by 3

TestOneCaseFunction · 0.36
TestOneCaseFunction · 0.36
TestMutableFunction · 0.36