pyqonvert.optimization.SleepInserter

class pyqonvert.optimization.SleepInserter(gates, involved_qubits, sleep_time, placement=None)

Converter that adds a PragmaSleep operation before or after a gate, depending on the user inputs.

The PragmaSleep will only be added to gates that have at least one involved qubit of the input and are of the gate type specified in the input. The placement depends on the placement input (before/after).

__init__()

Methods

__init__()

convert(conversion_input, device[, noise_models])

Convert Circuits or QuantumPrograms for decomposition, optimization and adding noise.

current_version()

Returns the current version of the pyqonvert library .

from_bincode(input)

Convert the bincode representation of the Converter to a Converter using the [bincode] crate.

from_json(json_string)

Convert the json representation of a Converter to a Converter.

json_schema()

Return the JsonSchema for the json serialisation of the class.

min_supported_version()

Return the minimum version of pyqonvert that supports this object.

to_bincode()

Return the bincode representation of the Converter using the [bincode] crate.

to_json()

Return the json representation of the Converter.

convert(conversion_input, device, noise_models=None)

Convert Circuits or QuantumPrograms for decomposition, optimization and adding noise.

Parameters:
  • conversion_input -- Circuit or QuantumProgram to be converted.

  • device (Device) -- determines connectivity and gate times.

  • noise_models (List[NoiseModel]) -- Noise models determining noise properties. Not used in conversions without noise.

Returns:

Output of converted Circuit when input is a Circuit. QuantumProgram: Output of converted QuantumProgram when input is a QuantumProgram.

Return type:

Circuit

Raises:
  • RuntimeError - Error occured in the conversion when running the SleepInserter. --

  • ValueError -- Could not convert inputs.

static current_version()

Returns the current version of the pyqonvert library .

Returns:

The current version of the library.

Return type:

str

static from_bincode(input)

Convert the bincode representation of the Converter to a Converter using the [bincode] crate.

Parameters:

input (ByteArray) -- The serialized Converter (in [bincode] form).

Returns:

The deserialized Converter.

Return type:

Converter

Raises:
  • TypeError -- Input cannot be converted to byte array.

  • ValueError -- Input cannot be deserialized to Converter.

static from_json(json_string)

Convert the json representation of a Converter to a Converter.

Parameters:

input (str) -- The serialized Converter in json form.

Returns:

The deserialized Converter.

Return type:

Converter

Raises:

ValueError -- Input cannot be deserialized to Converter.

static json_schema()

Return the JsonSchema for the json serialisation of the class.

Returns:

The json schema serialized to json

Return type:

str

min_supported_version()

Return the minimum version of pyqonvert that supports this object.

Returns:

The minimum version of the pyqonvert library to deserialize this object.

Return type:

str

to_bincode()

Return the bincode representation of the Converter using the [bincode] crate.

Returns:

The serialized Converter (in [bincode] form).

Return type:

ByteArray

Raises:

ValueError -- Cannot serialize Converter to bytes.

to_json()

Return the json representation of the Converter.

Returns:

The serialized form of Converter.

Return type:

str

Raises:

ValueError -- Cannot serialize Converter to json.