q1ss.ap.explicit
Explicitly specified affine partitions.
ExplicitAP
- final class ExplicitAP(subspaces)[source]
Bases:
APClass for ordered balanced affine partitions of
n-bitstrings explicitly specified by a complete family of disjoint affine subspaces.- static __new__(cls, subspaces)[source]
Creates a new explicit affine partition from the given sequence of disjoint affine subspaces.
- Parameters:
subspaces (
Sequence[AffineSubspace])- Return type:
- _get_subspace(label)[source]
Returns the affine subspace corresponding to the given label, providing the underlying logic for
__getitem__.The desired subspace is accessed from internal memory and returned.
- Parameters:
label (
binvec)- Return type:
- static random(subsp_dim, ambient_dim, *, rng=None)[source]
Samples a random affine partition with given subspace and ambient dimensions.
Sampling random affine partitions is an expensive operation in general, and the running time grows exponentially with the ambient dimension.
Warning
This method relies on
randomto sample subspaces, which does not result in a uniform distribution over affine partitions. This will change in future releases.Warning
The current implementation of this method is by rejection sampling, so it can be very slow even for small number of affine subspaces. This will change in future releases.
- Parameters:
- Return type: