6.6. simulators#
- class Simulator[source]#
Bases:
ABC
The super class for all backends.
- abstract apply()[source]#
Apply an operation to the state, which is currently kept in the simulator. Besides the operation, which is applied, in many cases, this method also takes as parameters the targets of the operations, which might be qubits, classical bits or both. The specific parameters might depend on the implementation.
- class ensembleSimulatorSymPy(numberBits: int, numberQubits: int)[source]#
Bases:
BaseSympySimulator
- apply(gate: QuantumOperation, targets: list[int], classicalTargets: list[int] | None = None)[source]#
Apply an operation to the state, which is currently kept in the simulator.
- Parameters:
gate (geqo.core.quantum_operation.QuantumOperation) – The operation that should be applied.
targets (list(int)) – The list of qubit indexes, which are the target of the provided operation.
classicalTargets (list(int)) – The list of classical bits, which are the target of the provided operation.
- prepareBackend(operations: list[QuantumOperation])[source]#
For a list of supported operators, this method sets the necessary values for the simulator.
- Parameters:
operations (list(geqo.core.quantum_operation.QuantumOperation)) – A list of quantum operations, for which the backend should be prepared.
- class mixedStateSimulatorSymPy(numberBits: int, numberQubits: int, return_density: bool = False)[source]#
Bases:
ensembleSimulatorSymPy
- apply(gate: QuantumOperation, targets: list[int], classicalTargets: list[int] | None = None)[source]#
Apply an operation to the state, which is currently kept in the simulator.
- Parameters:
gate (geqo.core.quantum_operation.QuantumOperation) – The operation that should be applied.
targets (list(int)) – The list of qubit indexes, which are the target of the provided operation.
classicalTargets (list(int)) – The list of classical bits, which are the target of the provided operation.
- class simulatorStatevectorNumpy(numberBits: int, numberQubits: int)[source]#
Bases:
BaseSimulatorNumpy
- apply(gate: QuantumOperation, targets: list[int], classicalTargets=None)[source]#
Apply an operation to the state, which is currently kept in the simulator.
- Parameters:
gate (geqo.core.quantum_operation.QuantumOperation) – The operation that should be applied.
targets (list(int)) – The list of qubit indexes, which are the target of the provided operation.
classicalTargets (list(int)) – The list of classical bits, which are the target of the provided operation, e.g. a measurement.
extraControls (list(int)) – A list of qubit indices. The qubits are used as control qubits. Note that this is only for internal use.
- applyUmatrixNumpy(u: ndarray, targets: list[int], extraControls: dict | list[int] | None = None)[source]#
Apply a unitary matrix to the state, which is currently kept in the simulator. For recursion, a list of extra control qubits can be defined.
- Parameters:
u (numpy.ndarray) – A unitary matrix.
targets (list(int)) – The list of qubit indexes, which are the target of the provided unitary matrix.
extraControls (list(int)) – A list of indexes, which are taken as control qubits.
- prepareBackend(operations: list[QuantumOperation])[source]#
For a list of supported operators, this method sets the necessary values for the simulator.
- Parameters:
operations (list(geqo.core.quantum_operation.QuantumOperation)) – A list of quantum operations, for which the backend should be prepared.
- class simulatorUnitarySymPy(numberQubits: int)[source]#
Bases:
BaseSympySimulator
Calculate the unitary matrix corresponding to a sequence of gates. No non-unitary operations like ClassicalControl, Measurement or DropQubits are allowed.
- apply(gate: QuantumOperation, targets: list[int])[source]#
Apply an operation to the quantum state, which is currently kept in the simulator.
- Parameters:
gate (geqo.core.quantum_operation.QuantumOperation) – The operation that should be applied.
targets (list(int)) – The list of qubit indexes, which are the target of the provided operation.
- prepareBackend(operations: list[QuantumOperation])[source]#
For a list of supported operators, this method sets the necessary values for the simulator.
- Parameters:
operations (list(geqo.core.quantum_operation.QuantumOperation)) – A list of quantum operations, for which the backend should be prepared.