| 617 | } |
| 618 | |
| 619 | void Reduce() |
| 620 | { |
| 621 | this->Tree.Nodes.resize(this->Nodes.size()); |
| 622 | this->Tree.Nodes[0] = this->Nodes[0]; |
| 623 | |
| 624 | for (auto ni = this->Tree.Nodes.begin(), nn = this->Tree.Nodes.begin() + 1; |
| 625 | ni != this->Tree.Nodes.end(); ++ni) |
| 626 | { |
| 627 | if (ni->IsLeaf()) |
| 628 | { |
| 629 | continue; |
| 630 | } |
| 631 | |
| 632 | *(nn++) = this->Nodes[ni->GetLeftChildIndex()]; |
| 633 | *(nn++) = this->Nodes[ni->GetRightChildIndex()]; |
| 634 | ni->SetChildren(nn - this->Tree.Nodes.begin() - 2); |
| 635 | } |
| 636 | |
| 637 | const auto numberOfCells = static_cast<size_t>(this->DataSet->GetNumberOfCells()); |
| 638 | this->Tree.Leaves.resize(numberOfCells); |
| 639 | for (size_t i = 0; i < numberOfCells; ++i) |
| 640 | { |
| 641 | this->Tree.Leaves[i] = this->CellsInfo[i].Ind; |
| 642 | } |
| 643 | this->CellsInfo.clear(); |
| 644 | } |
| 645 | }; |
| 646 | |
| 647 | //------------------------------------------------------------------------------ |
no test coverage detected