qrao.MagicRounding¶
- class MagicRounding(quantum_instance, *, basis_sampling='uniform', seed=None)[source]¶
“Magic rounding” method
This method is described in https://arxiv.org/abs/2111.03167v2.
- Parameters:
quantum_instance (
QuantumInstance
) – Provides theBackend
for quantum execution and theshots
count (i.e., the number of samples to collect from the magic bases).basis_sampling (
str
) – Method to use for sampling the magic bases. Must be either"uniform"
(default) or"weighted"
."uniform"
samples all magic bases uniformly, and is the method described in https://arxiv.org/abs/2111.03167v2."weighted"
attempts to choose bases strategically using the Pauli expectation values from the minimum eigensolver. However, the approximation bounds given in https://arxiv.org/abs/2111.03167v2 apply only to"uniform"
sampling.seed (
Optional
[int
]) – Seed for random number generator, which is used to sample the magic bases.
- __init__(quantum_instance, *, basis_sampling='uniform', seed=None)[source]¶
- Parameters:
quantum_instance (
QuantumInstance
) – Provides theBackend
for quantum execution and theshots
count (i.e., the number of samples to collect from the magic bases).basis_sampling (
str
) – Method to use for sampling the magic bases. Must be either"uniform"
(default) or"weighted"
."uniform"
samples all magic bases uniformly, and is the method described in https://arxiv.org/abs/2111.03167v2."weighted"
attempts to choose bases strategically using the Pauli expectation values from the minimum eigensolver. However, the approximation bounds given in https://arxiv.org/abs/2111.03167v2 apply only to"uniform"
sampling.seed (
Optional
[int
]) – Seed for random number generator, which is used to sample the magic bases.
Methods
__init__
(quantum_instance, *[, ...])- type quantum_instance:
QuantumInstance
round
(ctx)Perform magic rounding
Attributes
basis_sampling
Basis sampling method (either
"uniform"
or"weighted"
).quantum_instance
Provides the
Backend
and theshots
(samples) count.shots
Shots count as configured by the given
quantum_instance
.