Expand description
Implements various index arithmetic functions for perfect binary trees.
Functions§
- children
- Returns an index’s children.
- expand
- Returns an index’s family.
- first_
leaf - Returns the first leaf of a tree rooted at
root
with adepth
. - general_
index_ to_ subtree - Translate the general index
index
into a subtree index rooted atroot
. - is_
in_ subtree - Returns if
index
is in the subtree rooted atroot
. - last_
leaf - Returns the last leaf of a tree rooted at
root
with adepth
. - last_
power_ of_ two - Returns the last power of two for
n
using bit twiddling. - log2
- Returns the log base 2 of
n
. - next_
power_ of_ two - Returns the next power of two for
n
using bit twiddling. - relative_
depth - Returns the depth between two general indicies.
- root_
from_ depth - Returns the subtree root for
index
assuming the tree isdepth
deep. - sibling
- Returns the index’s sibling.
- subtree_
index_ to_ general - Translate the subtree index
index
rooted atroot
into a general index.