py_alqorithms.QSWAPAlgorithm

class py_alqorithms.QSWAPAlgorithm(number_trotter_steps)

QSwap Algorithm

Parameters:

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

__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.

create_circuit_remapped(hermitian_operator, ...)

Create the circuit corresponding to the hermitian operator, according to the chosen algorithm, given an initial qubit ordering.

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)

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

Parameters:
  • hermitian_operator (PauliHamiltonian) -- 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 PauliHamiltonian.

create_circuit_from_list(hermitian_operators, parameters)

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

Parameters:
  • hermitian_operators (List[PauliHamiltonian]) -- 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 PauliHamiltonian.

create_circuit_remapped(hermitian_operator, parameter, initial_ordering)

Create the circuit corresponding to the hermitian operator, according to the chosen algorithm, given an initial qubit ordering.

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

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

  • initial_ordering (List[int]) -- A list of the qubit indices in the ordering they start in.

Returns:

The created circuit and resulted qubit ordering.

Return type:

Tuple[Circuit, List[int]]

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

  • PyTypeError -- Hermitian operator is not a PauliHamiltonian.

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.