py_alqorithms.SystemBathCNOTAlgorithm

class py_alqorithms.SystemBathCNOTAlgorithm(number_trotter_steps, use_bath_as_control)

CNOT algorithm for system bath

This algorithm is designed to simulate an interacting spin system in contact with an (internally) non-interacting bath.

Parameters:
  • number_trotter_steps (int) -- The number of times to apply the Hamiltonian, which has been trotterised by the user.

  • use_bath_as_control (bool) -- In the CNOT part of this algorithm, a CNOT gate is applied for the coupling between system and bath. We can choose to use the bath qubit as the control qubit for the CNOT (True) or the system qubit as the control qubit for the CNOT (False).

__init__()

Methods

__init__()

create_circuit(hermitian_operator, parameter)

Create the circuit corresponding to the hermitian operator, according to the chosen algorithm.

create_circuit_from_list(...)

Create the circuits corresponding to the hermitian operators, according to the chosen algorithm.

decomposition_blocks(decomposition_blocks)

Change whether or not to use PragmaStart/StopDecompositionBlocks in the circuit.

from_bincode(input)

Convert the bincode representation of self to an instance using the [bincode] crate.

from_json(input)

Convert the json representation of self to an instance.

to_bincode()

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

to_json()

Return the json representation of self.

create_circuit(hermitian_operator, parameter, system_bath_physical_definition=None)

Create the circuit corresponding to the hermitian operator, according to the chosen algorithm.

Parameters:
  • hermitian_operator (MixedHamiltonian) -- The hamiltonian to turn into a circuit according to the algorithm.

  • parameter (CalculatorFloat) -- The parameter for which to create the circuit.

Returns:

The created circuit.

Return type:

Circuit

Raises:
  • PyTypeError -- Parameter is not a CalculatorFloat.

  • PyTypeError -- Hermitian operator is not a MixedHamiltonian.

  • PyValueError -- System Bath must consist of exactly two spin subsystem.

create_circuit_from_list(hermitian_operators, parameters)

Create the circuits corresponding to the hermitian operators, according to the chosen algorithm.

Parameters:
  • hermitian_operators (List[MixedHamiltonian]) -- The list of hamiltonians to turn into circuits according to the algorithm.

  • parameters (List[CalculatorFloat]) -- The parameters for which to create the circuit.

Returns:

The created circuits.

Return type:

List[Circuit]

Raises:
  • PyTypeError -- Parameter is not a CalculatorFloat.

  • PyTypeError -- Hermitian operator is not a MixedHamiltonian.

  • PyValueError -- System Bath must consist of exactly two spin subsystem.

decomposition_blocks(decomposition_blocks)

Change whether or not to use PragmaStart/StopDecompositionBlocks in the circuit.

Parameters:

decomposition_blocks (bool) -- The new decomposition_blocks flag.

Returns:

The instance with the modified decomposition_blocks parameter

Return type:

self

static from_bincode(input)

Convert the bincode representation of self to an instance using the [bincode] crate.

Parameters:

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

Returns:

The deserialized object.

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

  • ValueError -- Input cannot be deserialized.

static from_json(input)

Convert the json representation of self to an instance.

Parameters:

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

Returns:

The deserialized object.

Raises:

ValueError -- Input cannot be deserialized.

to_bincode()

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

Returns:

The serialized object (in [bincode] form).

Return type:

ByteArray

Raises:

ValueError -- Cannot serialize object to bytes.

to_json()

Return the json representation of self.

Returns:

The serialized form of self.

Return type:

str

Raises:

ValueError -- Cannot serialize object to json.