quri_parts.algo.mitigation.cdr package#

cdr(obs, circuit, noisy_estimator, exact_estimator, regression_method, num_training_circuits=10, fraction_of_replacement=0.1, seed=None)#

Returns an error-mitigated expectation value of an observable by using clifford-data-regression (CDR).

Parameters:
  • obs (Estimatable) – Observable for which the expected value is calculated.

  • circuit (NonParametricQuantumCircuit) – Circuit that CDR is applied to.

  • noisy_estimator (ConcurrentQuantumEstimator[GeneralCircuitQuantumState]) – A noisy estimator that computes the expectation value from obs and circuit.

  • exact_estimator (ConcurrentQuantumEstimator[GeneralCircuitQuantumState]) – An exact (noiseless) estimator that computes the expectation value from obs and training circuits. This is assumed a simulator that can do a fast simulation of the (almost) Clifford circuit.

  • regression_method (RegressionMethod) – Method used for regression.

  • num_training_circuits (int) – A number of training circuits to be used for CDR.

  • fraction_of_replacement (float) – Fraction of the number of non-Clifford gates that are to be replaced by Clifford gates.

  • seed (Optional[int]) – Seed to choose which gates to replace with Clifford ones.

Return type:

float

create_cdr_estimator(noisy_estimator, exact_estimator, regression_method, num_training_circuits=10, fraction_of_replacement=0.1, seed=None)#

Wrap the given ConcurrentQuantumEstimator to create a QuantumEstimator where clifford-data-regression is automatically applied to the result.

Parameters:
  • noisy_estimator (ConcurrentQuantumEstimator[GeneralCircuitQuantumState]) – A noisy estimator that computes the expectation value from obs and circuit. This is assumed a given ConcurrentQuantumEstimator which will be wrapped.

  • exact_estimator (ConcurrentQuantumEstimator[GeneralCircuitQuantumState]) – An exact (noiseless) estimator that computes the expectation value from obs and training circuits. This is assumed a simulator that can do a fast simulation of the (almost) Clifford circuit.

  • regression_method (RegressionMethod) – Method used for regression.

  • num_training_circuits (int) – A number of training circuits to be used for CDR.

  • fraction_of_replacement (float) – Fraction of the number of non-Clifford gates that are to be replaced by Clifford gates.

  • seed (Optional[int]) – Seed to choose which gates to replace with Clifford ones.

Return type:

QuantumEstimator[GeneralCircuitQuantumState]

create_exp_regression(order)#

Returns a RegressionMethod that gives a value which is evaluated by using the curve regression and exponential function f(x) = a + b exp(p(x)), where p(x) is a polynomial of a given order.

Parameters:

order (int) – Order of the polynomial used for regression.

Return type:

algo.mitigation.cdr.cdr.RegressionMethod

create_exp_regression_with_const(order, constant)#

Returns a RegressionMethod that gives a value which is evaluated by using the curve regression and exponential function 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 limit f(x->inf) when f(x) converges to a finite asymptotic value).

Parameters:
  • order (int) – Order of the polynomial used for regression.

  • constant (float) – A constant deduced from asymptotic behavior f(x->inf).

Return type:

algo.mitigation.cdr.cdr.RegressionMethod

create_exp_regression_with_const_log(order, constant)#

Returns a RegressionMethod that gives a value which is evaluated by using the log regression and exponential function 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 limit f(x->inf) when f(x) converges to a finite asymptotic value).

Parameters:
  • order (int) – Order of the polynomial used for regression.

  • constant (float) – A constant deduced from asymptotic behavior f(x->inf).

Return type:

algo.mitigation.cdr.cdr.RegressionMethod

create_polynomial_regression(order)#

Returns a RegressionMethod that gives a value which is evaluated by using the polynomial regression.

Parameters:

order (int) – Order of the polynomial used for regression.

Return type:

algo.mitigation.cdr.cdr.RegressionMethod

make_training_circuits(circuit, num_non_clifford_untouched, num_training_circuits=10, seed=None)#

Returns a list of near Clifford circuits obtained by replacing some non- Clifford gates in the input circuit by the nearest Clifford gates. The gate to be replaced is chosen at random.

Parameters:
  • circuit (NonParametricQuantumCircuit) – Original circuit from which the near Clifford circuit is constructed.

  • num_non_clifford_untouched (int) – A number of non-Clifford gates that remain untouched in the replacing.

  • num_training_circuits (int) – Number of circuits to be returned.

  • seed (int | None) – Seed to choose which gates to replace with Clifford ones.

Return type:

list[NonParametricQuantumCircuit]

Submodules#