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

Function EncodeTreeImpl

library/cpp/par/distr_tree.cpp:201–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199 }
200
201 static void EncodeTreeImpl(const TDistrTree& t, TVector<ui16>* res) {
202 if (t.Children.empty()) {
203 Y_ASSERT(t.FinalNodeId < N_GROUP_FIRST_CODE);
204 res->push_back(static_cast<ui16>(t.FinalNodeId));
205 } else {
206 if (t.Children.ysize() == 1)
207 EncodeTreeImpl(t.Children[0], res);
208 else {
209 res->push_back(N_GROUP_START);
210 for (int i = 0; i < t.Children.ysize(); ++i)
211 EncodeTreeImpl(t.Children[i], res);
212 res->push_back(N_GROUP_END);
213 }
214 }
215 }
216
217 static void EncodeTree(const TDistrTree& t, TVector<ui16>* res) {
218 res->resize(0);

Callers 1

EncodeTreeFunction · 0.85

Calls 3

emptyMethod · 0.45
push_backMethod · 0.45
ysizeMethod · 0.45

Tested by

no test coverage detected