The Blocks class
A Blocks
object represents a signed partition of the set \(\{0,
\ldots, n - 1\}\).
It is possible to associate to every Bipartition
a pair of blocks,
Bipartition.left_blocks()
and Bipartition.right_blocks()
,
which determine the Green’s \(\mathscr{L}\)- and
\(\mathscr{R}\)-classes of the Bipartition
in the monoid of all
bipartitions. This is the purpose of this class.
See also Bipartition
for more details and context.
Contents
A |
|
|
Copy a Blocks object. |
Return the degree of a blocks object. |
|
Check if a block is a transverse block. |
|
Return a const iterator yielding the indices of the blocks. |
|
Returns the transverse blocks lookup. |
|
Return the number of blocks in a Blocks object. |
|
|
Return the number of transverse blocks. |
Full API
- class Blocks
- __init__(self: Blocks, blocks: list[list[int]]) None
Constructs a Blocks object from a list of lists of integers.
This function constructs a
Blocks
object from a list of lists of integers, so that the blocks consisting of negative values are transverse and those consisting of positive values are not.- Parameters:
- Raises:
LibsemigroupsError – if the set consisting of the absolute values of the entries in blocks is not \(\{1, \ldots, n\}\) where \(n\) is the maximum such value.
LibsemigroupsError – if
0
is an item in any block.LibsemigroupsError – if any block is empty.
LibsemigroupsError – if any block contains both negative and positive values.
LibsemigroupsError – if the constructed
Blocks
object is not valid.
- Complexity:
linear in the sum of the sizes of the lists in blocks.
- degree(self: Blocks) int
Return the degree of a blocks object. The degree of a
Blocks
object is the size of the set of which it is a partition, or the size of theblocks
used to construct self.
- is_transverse_block(self: Blocks, index: int) bool
Check if a block is a transverse block.
This function returns
True
if the block with index index is a transverse (or signed) block and it returnsFalse
if it is not transverse (or unsigned).- Parameters:
index (int) – the index of a block
- Returns:
Whether or not the given block is transverse.
- Return type:
- Raises:
LibsemigroupsError – if index is not in the range \([0, n)\) where \(n\) is the return value of
number_of_blocks
.- Complexity:
Constant.
- iterator(self: Blocks) collections.abc.Iterator[int]
Return a const iterator yielding the indices of the blocks.
- Returns:
An iterator yielding the indices of blocks.
- Return type:
- Complexity:
Constant.
- lookup(self: Blocks) list[bool]
Returns the transverse blocks lookup.
This function returns the transverse blocks lookup. The value in position
i
of the returned list isTrue
if the block with indexi
is transverse andFalse
if it is not.