py_alqorithms.SystemBathQSWAPAlgorithm
- class py_alqorithms.SystemBathQSWAPAlgorithm(number_trotter_steps, use_bath_as_control)
QSWAP algorithm for system bath
Based on the following paper: https://arxiv.org/abs/1711.04789 We have implemented the fermionic swapping algorithm in this paper for qubits. 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 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.
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.
- create_circuit_remapped(hermitian_operator, parameter, initial_ordering, system_bath_physical_definition=None)
Create the circuit corresponding to the hermitian operator, according to the chosen algorithm, given an initial qubit ordering.
- 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.
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 MixedHamiltonian.
- 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.