SyTen

◆ truncate_rec()

SRDef syten::BTT::State::truncate_rec ( Ptr  ptr,
Truncation const &  trunc,
State::DropNorm const  dropN 
)

Recursive helper for truncation.

The parent of ptr is assumed to be normalised in the direction of ptr.

Assuming that both subtrees exist, the right subtree is then root-normalised without truncation first, followed by a a-normalisation of the current node without truncation. We can then descend into the left subtree to truncate there (its node is properly left-normalised). Once that subtree is normalised, we can left-normalised the node again with truncation, followed by second root-normalisation of the top of the left subtree. This is necessary to truncate “in both directions”.

Following this, we right-normalise the node, descend into the right subtree and again normalise the node with truncation and the top of the right subtree with truncation.

Finally, the node is root-normalised, as expected from a possible parent caller.

References anorm_node(), bnorm_node(), drop_all(), std::isnan(), rnorm_node(), and syten::BinaryTree::Tree< Cached< Tensor< 4 > > >::visit_bottom_rec().

Referenced by truncate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: