Tensor network simulation
qiskit_addon_aqc_tensor.simulation
This module provides an interface to tensor-network simulation that is agnostic to which backend is used.
Currently, there is a single implementation, which uses the Qiskit Aer matrix-product state (MPS) simulator as its backend.
Available backends
Functions
The following functions provide a common interface that can be used with any supported backend. Regardless of which backend you use, you will invoke these functions as a common interface.
In each function below, the documentation shows every distinct implementation available for that function. The addon will choose which implementation to use based on the types of the arguments that you provide. (This paradigm is called “multiple dispatch”.)
tensornetwork_from_circuit
tensornetwork_from_circuit(qc, settings, /)
Create a tensor-network state by simulating a quantum circuit.
The type of tensor-network state will correspond to the type of the settings
object. For instance, a QiskitAerSimulationSettings
will result in this function returning a QiskitAerMPS
.
tensornetwork_from_circuit(qc: qiskit.circuit.quantumcircuit.QuantumCircuit, settings: qiskit_addon_aqc_tensor.simulation.aer.simulation.QiskitAerSimulationSettings | plum.type.ModuleType[qiskit_aer.AerSimulator], /, *, out_state: numpy.ndarray | None = None) → qiskit_addon_aqc_tensor.simulation.aer.state.QiskitAerMPS
Parameters
- qc (QuantumCircuit)
- settings (TensorNetworkSimulationSettings)
Return type
tensornetwork_from_circuit(qc: qiskit.circuit.quantumcircuit.QuantumCircuit, settings: qiskit_addon_aqc_tensor.simulation.quimb.QuimbSimulator, /) → quimb.tensor.Circuit
Parameters
- qc (QuantumCircuit)
- settings (TensorNetworkSimulationSettings)
Return type
Return type
Parameters
- qc (QuantumCircuit)
- settings (TensorNetworkSimulationSettings)
apply_circuit_to_state
apply_circuit_to_state(qc, psi, settings, /, *, out_state=None)
Apply a quantum circuit to a tensor network state.
The input state (psi
) is not modified.
Return type
Returns
The new state.
Parameters
- qc (QuantumCircuit)
- psi (TensorNetworkState)
- settings (TensorNetworkSimulationSettings)
- out_state (ndarray | None)
apply_circuit_to_state(qc: qiskit.circuit.quantumcircuit.QuantumCircuit, psi: qiskit_addon_aqc_tensor.simulation.aer.state.QiskitAerMPS, settings: qiskit_addon_aqc_tensor.simulation.aer.simulation.QiskitAerSimulationSettings | plum.type.ModuleType[qiskit_aer.AerSimulator], /, *, out_state: numpy.ndarray | None = None) → qiskit_addon_aqc_tensor.simulation.aer.state.QiskitAerMPS
Parameters
- qc (QuantumCircuit)
- psi (TensorNetworkState)
- settings (TensorNetworkSimulationSettings)
- out_state (ndarray | None)
Return type
apply_circuit_to_state(qc: qiskit.circuit.quantumcircuit.QuantumCircuit, circ0: plum.type.ModuleType[quimb.tensor.Circuit], settings: qiskit_addon_aqc_tensor.simulation.quimb.QuimbSimulator, /, *, out_state: numpy.ndarray | None = None) → quimb.tensor.Circuit
Parameters
- qc (QuantumCircuit)
- psi (TensorNetworkState)
- settings (TensorNetworkSimulationSettings)
- out_state (ndarray | None)
Return type
Apply a quantum circuit to a tensor network state.
The input state (psi
) is not modified.
Returns
The new state.
Parameters
- qc (QuantumCircuit)
- psi (TensorNetworkState)
- settings (TensorNetworkSimulationSettings)
- out_state (ndarray | None)
Return type
compute_overlap
compute_overlap(psi_1, psi_2, /)
Compute overlap of two quantum states: .
NOTE: Unlike numpy.dot
, implementations of this method will perform complex conjugation on the first argument.
Parameters
- psi_1 (
TensorNetworkState
) – first quantum state. - psi_2 (
TensorNetworkState
) – second quantum state.
Return type
Returns
complex dot product value.
compute_overlap(mps1: qiskit_addon_aqc_tensor.simulation.aer.state.QiskitAerMPS, mps2: qiskit_addon_aqc_tensor.simulation.aer.state.QiskitAerMPS, /) → complex
Parameters
- psi_1 (TensorNetworkState)
- psi_2 (TensorNetworkState)
Return type
compute_overlap(circ1: plum.type.ModuleType[quimb.tensor.Circuit], circ2: plum.type.ModuleType[quimb.tensor.Circuit], /) → complex
Parameters
- psi_1 (TensorNetworkState)
- psi_2 (TensorNetworkState)
Return type
Abstract classes
These are abstract classes, implemented by each backend.