This namespace contains helper functions for the Bipartition class.
Functions | |
Bipartition | one (Bipartition const &f) |
Return the identity bipartition with the same degree as the given bipartition. | |
void | random (Bipartition &x) |
Replace the contents of a bipartition with a random bipartition. | |
Bipartition | random (size_t deg) |
Returns a random bipartition of specified degree. | |
void | throw_if_invalid (Bipartition const &x) |
Checks a bipartition. | |
std::vector< std::vector< int32_t > > | underlying_partition (Bipartition const &x) |
Return the underlying partition of a Bipartition object. | |
void | uniform_random (Bipartition &x) |
Replace the contents of a bipartition with a random bipartition. | |
Bipartition | uniform_random (size_t deg) |
Returns a random bipartition of specified degree. | |
|
nodiscard |
f | the bipartition. Returns the identity bipartition of degree equal to f.degree() . |
The identity bipartition of degree \(n\) has blocks \(\{i, -i\}\) for all \(i\in \{0, \ldots, n - 1\}\). This member function returns a new identity bipartition of degree equal to the degree of this
.
void random | ( | Bipartition & | x | ) |
This function replaces the contents of the bipartition x
with a random bipartition of degree equal to that of x
, chosen at random from among all bipartitions of degree equal to x
. If the degree of x
is small enough for uniform_random(Bipartition&) to run successfully, then the distribution is uniform, otherwise, the distribution is not uniform.
x | the bipartition. |
Bipartition random | ( | size_t | deg | ) |
This function returns a random bipartition of degree deg
, chosen at random from among all bipartitions of degree equal to deg
. If the degree deg
is small enough for uniform_random(Bipartition&) to run successfully, then the distribution is uniform, otherwise, the distribution is not uniform.
deg | the degree of the returned bipartition. |
void throw_if_invalid | ( | Bipartition const & | x | ) |
This function checks a Bipartition object, and throws an exception if the object is not valid.
x | the bipartition. |
LibsemigroupsException | if x is invalid. |
|
nodiscard |
The underlying partition of a bipartition x
is the partition of a subset \(P\) of \(\{-n, \ldots, -1\}\cup \{1, \ldots,
n\}\) such that:
x
is a transverse block.x | the bipartition. |
void uniform_random | ( | Bipartition & | x | ) |
This function replaces the contents of the bipartition x
with a random bipartition chosen uniformly at random from among all bipartitions of degree equal to that of x
.
x | the bipartition. |
LibsemigroupsException | if the degree of x is too large. The implementation depends on computing several values that can easily exceed the maximum value of any fixed precision integer or float type. When this occurs this exception is thrown. |
random_element
method for the SetPartitions class. Bipartition uniform_random | ( | size_t | deg | ) |
This function returns a random bipartition of degree deg
, chosen uniformly at random from among all bipartitions of degree equal to deg
.
deg | the degree of the returned bipartition. |
LibsemigroupsException | if the degree of x is too large. The implementation depends on computing several values that can easily exceed the maximum value of any fixed precision integer or float type. When this occurs this exception is thrown. |
random_element
method for the SetPartitions