py_alqorithms.CNOTAlgorithm
- class py_alqorithms.CNOTAlgorithm(number_trotter_steps)
CNOT Algorithm
- Parameters:
number_trotter_steps (int) -- The number of times to apply the Hamiltonian, which has been trotterised by the user.
- Returns:
Self
- __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.
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.
order(order)Change the Trotter order (first or second order available) property of self.
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.
- 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.
- order(order)
Change the Trotter order (first or second order available) property of self.
- Parameters:
order (int) -- The new order (1 or 2).
- Returns:
The instance with the modified order parameter
- Return type:
self
- 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.