Source code for qugradlab.systems.skeletons.qubits._qubit_system

 1"""
 2:class:`~qugradlab.systems.skeletons.SkeletalSystem` s of qubits.
 3"""
 4
 5import numpy as np
 6
 7from . import qubit_skeleton
 8from .. import SkeletalSystem
 9from ....hilbert_spaces import _qudit_hilbert_spaces
10
[docs] 11class QubitSystem(SkeletalSystem): 12 r"""A :class:`qugrad.QuantumSystem` for a system of qubits. 13 The Hamiltonian is constructed in the form: 14 $$ 15 H(t) = \sum_{i,j}t_{ij}\sigma^{(i)}_j 16 +\sum_{i,j,k,l}U_{ijkl}\sigma^{(i)}_k\sigma^{(j)}_l 17 +\sum_{m,i,j}a_m(t)h_{mij}\sigma^{(i)}_j 18 +\sum_{m,i,j,k,l}b_m(t)J_{mijkl}\sigma^{(i)}_k\sigma^{(j)}_l 19 $$ 20 where $\sigma^{(i)}_j$ is the $j$th Pauli operator acting on the $i$th 21 qubit, $t_{ij}$ are the single-qubit coefficients for the drift Hamiltonian, 22 $U_{ijkl}$ are the two-qubit coefficients for the drift Hamiltonian, 23 $h_{mij}$ are the single-qubit coefficients for the $m$th control 24 Hamiltonian, $J_{mijk}$ are the single-qubit coefficients for the $m$th 25 control Hamiltonian, $a_m(t)$ are the time-dependent control amplitdues that 26 modulate the $m$th single-qubit control Hamiltonian, and $b_m(t)$ are the 27 time-dependent control amplitdues that modulate the $m$th two-qubit control 28 Hamiltonian. 29 """
[docs] 30 def __init__(self, 31 hilbert_space: _qudit_hilbert_spaces.QubitSpace, 32 single_qubit_drift_coefficients: np.ndarray[complex], 33 two_qubit_drift_coefficients: np.ndarray[complex], 34 single_qubit_ctrl_coefficients: np.ndarray[complex], 35 two_qubit_ctrl_coefficients: np.ndarray[complex], 36 use_graph: bool = True): 37 r"""Creates an instance of a `QubitSystem`. The Hamiltonian is 38 constructed in the form: 39 $$ 40 H(t) = \sum_{i,j}t_{ij}\sigma^{(i)}_j 41 +\sum_{i,j,k,l}U_{ijkl}\sigma^{(i)}_k\sigma^{(j)}_l 42 +\sum_{m,i,j}a_m(t)h_{mij}\sigma^{(i)}_j 43 +\sum_{m,i,j,k,l}b_m(t)J_{mijkl}\sigma^{(i)}_k\sigma^{(j)}_l 44 $$ 45 where $\sigma^{(i)}_j$ is the $j$th Pauli operator acting on the $i$th 46 qubit, $t_{ij}$ corresponds to `single_qubit_drift_coefficients`, 47 $U_{ijkl}$ corresponds to `two_qubit_drift_coefficients`, $h_{mij}$ 48 corresponds to `single_qubit_ctrl_coefficients`, $J_{mijk}$ corresponds 49 to `two_qubit_ctrl_coefficients`, $a_m(t)$ are the time-dependent 50 control amplitdues that modulate the $m$th single-qubit control 51 Hamiltonian, and $b_m(t)$ are the time-dependent control amplitdues that 52 modulate the $m$th two-qubit control Hamiltonian. 53 54 Parameters 55 ---------- 56 hilbert_space: QubitSpace, 57 The Hilbert space of the system of qubits 58 single_qubit_drift_coefficients : NDArray[Shape[hilbert_space.qubits, 3], complex] 59 The single-qubit coefficients for the drift Hamiltonian 60 two_qubit_drift_coefficients : NDArray[Shape[hilbert_space.qubits, hilbert_space.qubits, 3, 3], complex] 61 The two-qubit coefficients for the drift Hamiltonian 62 single_qubit_ctrl_coefficients : NDArray[Shape[n_single_qubit_ctrl, hilbert_space.qubits, 3], complex] 63 The single-qubit coefficients for the control Hamiltonian 64 two_qubit_ctrl_coefficients : NDArray[Shape[n_two_qubit_ctrl, hilbert_space.qubits, hilbert_space.qubits, 3, 3], complex] 65 The two-qubit coefficients for the control Hamiltonian 66 use_graph : bool 67 Whether to use `TensorFlow <https://www.tensorflow.org>`__ graphs 68 during computation, by default ``True`` 69 """ 70 t = qubit_skeleton.second_order_tensor(hilbert_space) 71 u = qubit_skeleton.fourth_order_tensor(hilbert_space) 72 skeletons = [t, u] 73 super().__init__(drift_coefficients = [single_qubit_drift_coefficients, 74 two_qubit_drift_coefficients], 75 drift_skeletons = skeletons, 76 ctrl_coefficients = [single_qubit_ctrl_coefficients, 77 two_qubit_ctrl_coefficients], 78 ctrl_skeletons = skeletons, 79 hilbert_space = hilbert_space, 80 use_graph = use_graph) 81 del skeletons 82 del u 83 del t