quri_parts.algo.mitigation.zne.zne module#
- quri_parts.algo.mitigation.zne.zne.FoldingMethod#
Interface representing folding methods
alias of
Callable
[[NonParametricQuantumCircuit
,float
],list
[int
]]
- quri_parts.algo.mitigation.zne.zne.ZeroExtrapolationMethod#
Interface representing zero noise extrapolation methods
alias of
Callable
[[Iterable
[float
],Iterable
[float
]],float
]
- quri_parts.algo.mitigation.zne.zne.CircuitScaling#
Interface representing scaling methods of circuit
alias of
Callable
[[NonParametricQuantumCircuit
,float
,Callable
[[NonParametricQuantumCircuit
,float
],list
[int
]]],NonParametricQuantumCircuit
]
- quri_parts.algo.mitigation.zne.zne.create_folding_left() Callable[[NonParametricQuantumCircuit, float], list[int]] #
Returns a
FoldingMethod
that gives a list of indices of gates to be folded.Folding starts from the left of the circuit.
- quri_parts.algo.mitigation.zne.zne.create_folding_right() Callable[[NonParametricQuantumCircuit, float], list[int]] #
Returns a
FoldingMethod
that gives a list of indices of gates to be folded.Folding starts from the right of the circuit.
- quri_parts.algo.mitigation.zne.zne.create_folding_random(seed: int | None = None) Callable[[NonParametricQuantumCircuit, float], list[int]] #
Returns a
FoldingMethod
that gives a list of indices of gates to be folded.The gates to be folded are chosen at random.
- Parameters:
seed – Seed for random number generator.
- quri_parts.algo.mitigation.zne.zne.scaling_circuit_folding(circuit: NonParametricQuantumCircuit, scale_factor: float, folding_method: Callable[[NonParametricQuantumCircuit, float], list[int]]) NonParametricQuantumCircuit #
Returns a scaled circuit. If the scale factor is odd, all gates are folded regardless of the folding method.
- Parameters:
circuit – Circuit to be folded.
scale_factor – Factor to scale the circuit. A real number that satisfies >= 1.
folding_method – Folding method applied to the circuit as a
FoldingMethod
.
- quri_parts.algo.mitigation.zne.zne.create_polynomial_extrapolate(order: int) Callable[[Iterable[float], Iterable[float]], float] #
Returns a
ZeroExtrapolationMethod
that gives a zero-noise extrapolated value which is evaluated by using the polynomial fitting.- Parameters:
order – Order of the polynomial used for fitting.
- quri_parts.algo.mitigation.zne.zne.create_exp_extrapolate(order: int) Callable[[Iterable[float], Iterable[float]], float] #
Returns a
ZeroExtrapolationMethod
that gives a zero-noise extrapolated value which is evaluated by using the curve fitting and exponential ansatz f(x) = a + b exp(p(x)), where p(x) is a polynomial of a given order.- Parameters:
order – Order of the polynomial on the exponential used for fitting.
- quri_parts.algo.mitigation.zne.zne.create_exp_extrapolate_with_const(order: int, constant: float) Callable[[Iterable[float], Iterable[float]], float] #
Returns a
ZeroExtrapolationMethod
that gives a zero-noise extrapolated value which is evaluated by using the curve fitting and exponential ansatz f(x) = constant + b exp(p(x)), where p(x) is a polynomial of a given order and constant is a known parameter (obtained as the infinite-noise limit f(x->inf)).- Parameters:
order – Order of the polynomial on the exponential used for fitting.
constant – An infinite-noise limit parameter f(x->inf).
- quri_parts.algo.mitigation.zne.zne.create_exp_extrapolate_with_const_log(order: int, constant: float) Callable[[Iterable[float], Iterable[float]], float] #
Returns a
ZeroExtrapolationMethod
that gives a zero-noise extrapolated value which is evaluated by using the log fitting and exponential ansatz f(x) = constant + b exp(p(x)), where p(x) is a polynomial of a given order and constant is a known parameter (obtained as the infinite-noise limit f(x->inf)).- Parameters:
order – Order of the polynomial on the exponential used for fitting.
constant – An infinite-noise limit parameter f(x->inf).
- quri_parts.algo.mitigation.zne.zne.zne(obs: Operator | PauliLabel, circuit: NonParametricQuantumCircuit, estimator: Callable[[Sequence[Operator | PauliLabel], Sequence[GeneralCircuitQuantumState]], Iterable[Estimate[complex]]], scale_factors: Iterable[float], extrapolate_method: Callable[[Iterable[float], Iterable[float]], float], folding_method: Callable[[NonParametricQuantumCircuit, float], list[int]]) float #
Returns an error-mitigated expectation value of an observable by using zero-noise extrapolation (zne).
- Parameters:
obs – Observable for which the expected value is calculated.
circuit – Circuit that ZNE is applied to.
estimator – An estimator that computes the expectation value from obs and circuit.
scale_factors – Factor to scale the circuit. An real number that satisfies >= 1.
extrapolate_method –
ZeroExtrapolationMethod
that determine the method of extrapolation.folding_method –
FoldingMethod
that determines the method of folding.
- quri_parts.algo.mitigation.zne.zne.richardson_extrapolation(obs: Operator | PauliLabel, circuit: NonParametricQuantumCircuit, estimator: Callable[[Sequence[Operator | PauliLabel], Sequence[GeneralCircuitQuantumState]], Iterable[Estimate[complex]]], scale_factors: Iterable[float], folding_method: Callable[[NonParametricQuantumCircuit, float], list[int]]) float #
Returns an error-mitigated expectation value of an observable by using zne.
The order of polynomial = len(list(scale_factors)) - 1.
- Parameters:
obs – Observable for which the expected value is calculated.
circuit – Circuit that apply zne.
estimator – An estimator that computes the expectation value from obs and circuit.
scale_factors – Factor to scale the circuit. A real number that satisfies >= 1.
folding_method –
FoldingMethod
that determines the method of folding.
- quri_parts.algo.mitigation.zne.zne.create_zne_estimator(estimator: Callable[[Sequence[Operator | PauliLabel], Sequence[GeneralCircuitQuantumState]], Iterable[Estimate[complex]]], scale_factors: Iterable[float], extrapolate_method: Callable[[Iterable[float], Iterable[float]], float], folding_method: Callable[[NonParametricQuantumCircuit, float], list[int]]) Callable[[Operator | PauliLabel, GeneralCircuitQuantumState], Estimate[complex]] #
Wrap the given
ConcurrentQuantumEstimator
to create aQuantumEstimator
where zero-noise mitigation is automatically applied to the result.- Parameters:
estimator – An estimator that computes the expectation value from obs and circuit.
scale_factors – Factor to scale the circuit. A real number that satisfies >= 1.
extrapolate_method –
ZeroExtrapolationMethod
that determine the method of extrapolation.folding_method –
FoldingMethod
that determines the method of folding.