Auxillary functions¶
This module contains auxiliary functions for extracting the parameters of quadratic and Bose-Hubbard Hamiltonians.
Quadratic Hamiltonian functions¶
quadratic_coefficients (operator) |
Return the quadratic coefficient matrix representing a Gaussian Hamiltonian. |
Bose Hubbard functions¶
BoseHubbardError |
Custom error function for invalid Bose-Hubbard Hamiltonians. |
extract_tunneling (H) |
Extracts the tunneling terms from Bose-Hubbard Hamiltonians. |
extract_onsite_chemical (H) |
Extracts the onsite interactions and chemical potential terms from Bose-Hubbard Hamiltonians. |
extract_dipole (H) |
Extracts the dipole terms from Bose-Hubbard Hamiltonians. |
trotter_layer (H, t, k) |
Returns a single Trotter layer for a Bose-Hubbard Hamiltonian. |
Code details¶
-
sfopenboson.auxillary.
quadratic_coefficients
(operator)[source]¶ Return the quadratic coefficient matrix representing a Gaussian Hamiltonian.
A Gaussian Hamiltonian is any combination of quadratic operators that can be written in quadratic form:
\[H = \frac{1}{2}\mathbf{r}^T A\mathbf{r} + \mathbf{r}^T \mathbf{d}\]where \(A\in\mathbb{R}^{2N\times 2N}\) is a symmetric matrix, \(\mathbf{d}\in\mathbb{R}^{2N}\) is a real vector, and \(\mathbf{r} = (\x_1,\dots,\x_N,\p_1,\dots,\p_N)\) is the vector of quadrature operators in \(xp\)-ordering.
This function accepts a bosonic Gaussian Hamiltonian, and returns the matrix \(A\) and vector \(\mathbf{d}\) representing the quadratic and linear coefficients.
Parameters: operator (QuadOperator) – a bosonic Gaussian Hamiltonian Returns: a tuple contains a 2Nx2N real symmetric numpy array, and a length-2N real numpy array, where N is the number of modes the operator acts on. Return type: tuple (A, d)
-
exception
sfopenboson.auxillary.
BoseHubbardError
[source]¶ Custom error function for invalid Bose-Hubbard Hamiltonians.
-
with_traceback
(tb)[source]¶ This method sets argument
tb
as the new traceback for the exception and returns the exception object. See the Python documentation for more details.
-
-
sfopenboson.auxillary.
extract_tunneling
(H)[source]¶ Extracts the tunneling terms from Bose-Hubbard Hamiltonians.
Parameters: H (BosonOperator) – A Bose-Hubbard Hamiltonian. Returns: Returns a length-2 list of the form [[(i, j),...], t]
where[(i, j),...]
is a list containing pairs of modes that are entangled by beamsplitters due to tunneling, andt
(float) is the tunneling coefficient.Return type: list
-
sfopenboson.auxillary.
extract_onsite_chemical
(H)[source]¶ Extracts the onsite interactions and chemical potential terms from Bose-Hubbard Hamiltonians.
Parameters: H (BosonOperator) – A Bose-Hubbard Hamiltonian. Returns: Returns a tuple containing two lists; the first list is the onsite interaction, and the second list is the chemical potential. Each list is a length-2 list of the form [[i,j,...], t]
where[i,j,...]
is a list containing modes operated on, and t is the onsite coefficient U or chemical potential mu.Return type: tuple(list, list)
-
sfopenboson.auxillary.
extract_dipole
(H)[source]¶ Extracts the dipole terms from Bose-Hubbard Hamiltonians.
Parameters: H (BosonOperator) – A Bose-Hubbard Hamiltonian. Returns: Returns a length-2 list of the form [[(i, j),...], V]
where[(i, j),...]
is a list containing pairs of modes that are entangled due to nearest-neighbour interactions, andV
(float) is the dipole coefficient.Return type: list
-
sfopenboson.auxillary.
trotter_layer
(H, t, k)[source]¶ Returns a single Trotter layer for a Bose-Hubbard Hamiltonian.
Parameters: - H (BosonOperator) – A Bose-Hubbard Hamiltonian.
- t (float) – the time propagation duration.
- k (int) – the number of products in the truncated Lie product formula.
Returns: - A dictionary containing the items:
'BS': (theta, phi, modes)
corresponding to beamsplitters with parameters(theta, phi)
acting on the list of modes provided.'K': (kappa, modes)
corresponding to Kerr gates with parameterkappa
acting on the list of modes provided.'R': (r, modes)
corresponding to rotation gates with parameterr
acting on the list of modes provided.'CK': (kappa, modes)
corresponding to a cross-Kerr interactions with parameterkappa
acting on the list of modes provided.
Return type: dict