Operations

This file contains the Strawberry Fields quantum operations that decompose the BosonOperator and QuadOperator from OpenFermion.

These operations are used directly in BlackBird code, complementing existing operations.

For example:

prog = sf.Program(3)
eng = sf.Engine("gaussian")

H1 = BosonOperator('0^ 0')
H2 = QuadOperator('q0 p0') + QuadOperator('p0 q0') - QuadOperator('p2 p2')

with prog.context as q:
    GaussianPropagation(H1) | q[0]
    GaussianPropagation(H2, t=0.5, 'global') | q

state = eng.run(prog).state

The global argument indicates to Strawberry Fields that the Hamiltonian should be applied to the entire register, with the operator indices indicating the mode the operator acts on.

If ‘global’ is not provided, it is assumed that the Hamiltonian should only be applied locally, to the qumodes specified on the right. In this case, the number of operator indices must match the number of qumodes the Hamiltonian is applied to.

To see the gates applied, simply run eng.print_applied():

>>> eng.print_applied()
Rgate(-1)   | (q[0])
Rgate(-0.3927)  | (q[2])
BSgate(-1.571, 0)   | (q[1], q[2])
Rgate(-3.142)   | (q[0])
Sgate(-2, 3.142)    | (q[0])
Sgate(-0.8814, 3.142)   | (q[1])
Rgate(-1.963)   | (q[1])
BSgate(-1.571, 0)   | (q[1], q[2])
Rgate(3.142)    | (q[0])

Blackbird quantum operations

GaussianPropagation(operator[, t, mode]) Propagate the specified qumodes by a bosonic Gaussian Hamiltonian.
BoseHubbardPropagation(operator[, t, k, mode]) Propagate the specified qumodes by a Bose-Hubbard Hamiltonian.

Code details

class sfopenboson.ops.GaussianPropagation(operator, t=1, mode='local')[source]

Propagate the specified qumodes by a bosonic 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 operation calculates the corresponding Gaussian symplectic transformation via the following relation:

\[S = e^{\Omega A t}\]

where

\[\begin{split}\Omega=\begin{bmatrix}0&I_N\\-I_N&0\end{bmatrix}\in\mathbb{R}^{2N\times 2N}\end{split}\]

is the symplectic matrix.

Depending on whether the resulting symplectic transformation is passive (energy preserving) or active (non-energy preserving), the Clements or Bloch-Messiah decomposition in Strawberry Fields is then used to decompose the Hamiltonian into a set of CV gates.

Parameters:
  • operator (BosonOperator, QuadOperator) – a bosonic Gaussian Hamiltonian
  • t (float) – the time propagation value. If not provided, default value is 1.
  • mode (str) – By default, mode='local' and the Hamiltonian is assumed to apply to only the applied qumodes (q[i], q[j],…). For instance, a_0 applies to q[i], a_1 applies to q[j]. If instead mode='global', the Hamiltonian is instead applied to the entire register, i.e., a_0 applies to q[0], applies to q[1], etc.
decompose(reg)[source]

Return the decomposed commands

class sfopenboson.ops.BoseHubbardPropagation(operator, t=1, k=20, mode='local')[source]

Propagate the specified qumodes by a Bose-Hubbard Hamiltonian.

The Bose-Hubbard Hamiltonian has the form

\[H = -J\sum_{i=1}^N\sum_{j=1}^N A_{ij} \ad_i\a_j + \frac{1}{2}U\sum_{i=1}^N \a_i^\dagger \a_i (\ad_i \a_i - 1) - \mu \sum_{i=1}^N \ad_i \a_i + V \sum_{i=1}^N\sum_{j=1}^N A_{ij} \ad_i \a_i \ad_j \a_j.\]

where:

  • \(A\) is a real symmetric matrix of ones and zeros defining the adjacency of each pairwise combination of nodes \((i,j)\) in the \(N\)-node system,
  • \(J\) represents the transfer integral or hopping term of the boson between nodes,
  • \(U\) is the on-site interaction potential,
  • \(\mu\) is the chemical potential,
  • \(V\) is the dipole-dipole or nearest neighbour interaction term.

BoseHubbard Hamiltonians can be generated using the BosonOperator manually, or on a (periodic/non-peridic) two-dimensional lattice via the function openfermion.hamiltonians.bose_hubbard (see the OpenFermion documentation).

In Strawberry Fields, the Bose-Hubbard propagation is performed by applying the Lie-product formula, and decomposing the unitary operations into a combination of beamsplitters, Kerr gates, and phase-space rotations.

Parameters:
  • operator (BosonOperator, QuadOperator) – a bosonic Gaussian Hamiltonian
  • t (float) – the time propagation value. If not provided, default value is 1.
  • k (int) – the number of products in the truncated Lie product formula.
  • mode (str) – By default, mode='local' and the Hamiltonian is assumed to apply to only the applied qumodes (q[i], q[j],…). For instance, a_0 applies to q[i], a_1 applies to q[j]. If instead mode='global', the Hamiltonian is instead applied to the entire register, i.e., a_0 applies to q[0], applies to q[1], etc.
decompose(reg)[source]

Decompose the operation into elementary operations supported by the backend API.

See strawberryfields.backends.base.

Parameters:reg (Sequence[RegRef]) – subsystems the operation is acting on
Returns:decomposition as a list of operations acting on specific subsystems
Return type:list[Command]