Template Function sequant::bits::bipartitions_ordered

Function Documentation

template<std::unsigned_integral T>
constexpr auto sequant::bits::bipartitions_ordered(T mask)

Generates all ordered bipartitions of the set bits in the mask.

For a given mask representing a set S, this function returns a view of pairs (A, B) such that A ∪ B = S, A ∩ B = {}, and A, B are subsets of S. The iteration order results in B descending and A ascending.

Template Parameters:

T – The unsigned integer type of the mask.

Parameters:

mask – The bitmask representing the set.

Returns:

A view of pairs of disjoint submasks.