UniformPauliSubset
class samplomatic.distributions.UniformPauliSubset(num_subsystems: int, paulis: ndarray)
Bases: Distribution
The uniform distribution over a subset of virtual Pauli gates.
Here, paulis is an array with elements corresponding to Paulis as enumerated in PauliRegister. The length of an individual Pauli should be a divisor of num_subsystems. The output PauliRegister is partitioned contiguously such that each part samples independently from paulis.
>>> import numpy as np
>>> from samplomatic.distributions import UniformPauliSubset
>>>
>>> # Create a distribution that samples a random phase on each qubit
>>> z_distribution = UniformPauliSubset(3, np.array([[0], [1]]))
>>>
>>> # Create a correlated phase distribution
>>> z_corr_distribution = UniformPauliSubset(3, np.array([[0, 0, 0], [1, 1, 1]]))Parameters
- num_subsystems – The number of subsystems this distribution samples.
- paulis – The subset of Paulis to sample from.
Raises
ValueError – If the number of subsystems is not divisible by the length of an element of paulis.
Attributes Summary
Column 1 | Column 2 |
|---|---|
paulis | The subset of Paulis to sample from. |
register_type | The virtual gate type being sampled. |
Methods Summary
Column 1 | Column 2 |
|---|---|
from_name(num_subsystems, name) | Return a new instance from a specific distribution name. |
sample(size, rng) | Sample the distribution. |
Attributes Documentation
paulis
The subset of Paulis to sample from.
register_type
Methods Documentation
from_name
classmethod from_name(num_subsystems: int, name: str) → UniformPauliSubset
Return a new instance from a specific distribution name.
Parameters
- num_subsystems – The number of subsystems this distribution samples.
- name – The distribution name to use.
Returns
The new distribution.
sample
sample(size, rng)
Sample the distribution.
Parameters
- size – The number elements to sample.
- rng – A randomness generator.
Returns
The samples.