pyquil.kraus

Module for creating and verifying noisy gate definitions in terms of Kraus maps.

pyquil.kraus.add_noise_to_program(prog, T1=3e-05, T2=None, gate_time_1q=5e-08, gate_time_2q=1.5e-07)

Add generic damping and dephasing noise to a program.

This high-level function is provided as a convenience to investigate the effects of a generic noise model on a program. For more fine-grained control, please investigate the other methods available in the pyquil.kraus module.

In an attempt to closely model the QPU, noisy versions of RX(+-pi/2) and CZ are provided; I and parametric RZ are noiseless, and other gates are not allowed. To use this function, you need to compile your program to this native gate set.

The default noise parameters

  • T1 = 30 us
  • T2 = T1 / 2
  • 1q gate time = 50 ns
  • 2q gate time = 150 ns

are currently typical for near-term devices.

This function will define new gates and add Kraus noise to these gates. It will translate the input program to use the noisy version of the gates.

Parameters:
  • prog – A pyquil program consisting of I, RZ, CZ, and RX(+-pi/2) instructions
  • T1 – The T1 amplitude damping time. By default, this is 30 us
  • T2 – The T2 dephasing time. By default, this is one-half of the T1 time.
  • gate_time_1q – The duration of the one-qubit gates, namely RX(+pi/2) and RX(-pi/2). By default, this is 50 ns.
  • gate_time_2q – The duration of the two-qubit gates, namely CZ. By default, this is 150 ns.
Returns:

A new program with noisy operators.

pyquil.kraus.append_kraus_to_gate(kraus_ops, gate_matrix)

Follow a gate gate_matrix by a Kraus map described by kraus_ops.

Parameters:
  • kraus_ops (list) – The Kraus operators.
  • gate_matrix (numpy.ndarray) – The unitary gate.
Returns:

A list of transformed Kraus operators.

pyquil.kraus.combine_kraus_maps(k1, k2)

Generate the Kraus map corresponding to the composition of two maps on the same qubits with k1 being applied to the state after k2.

Parameters:
  • k1 (list) – The list of Kraus operators that are applied second.
  • k2 (list) – The list of Kraus operators that are applied first.
Returns:

A combinatorially generated list of composed Kraus operators.

pyquil.kraus.damping_after_dephasing(T1, T2, gate_time)

Generate the Kraus map corresponding to the composition of a dephasing channel followed by an amplitude damping channel.

Parameters:
  • T1 (float) – The amplitude damping time
  • T2 (float) – The dephasing time
  • gate_time (float) – The gate duration.
Returns:

A list of Kraus operators.

pyquil.kraus.damping_kraus_map(p=0.1)

Generate the Kraus operators corresponding to an amplitude damping noise channel.

Parameters:p (float) – The one-step damping probability.
Returns:A list [k1, k2] of the Kraus operators that parametrize the map.
Return type:list
pyquil.kraus.dephasing_kraus_map(p=0.1)

Generate the Kraus operators corresponding to a dephasing channel.

Params float p:The one-step dephasing probability.
Returns:A list [k1, k2] of the Kraus operators that parametrize the map.
Return type:list
pyquil.kraus.tensor_kraus_maps(k1, k2)

Generate the Kraus map corresponding to the composition of two maps on different qubits.

Parameters:
  • k1 (list) – The Kraus operators for the first qubit.
  • k2 (list) – The Kraus operators for the second qubit.
Returns:

A list of tensored Kraus operators.