Operations

Native gates for IonQ hardware as PennyLane operations.

class ionizer.ops.GPI(phi, wires, id=None)

The single-qubit \(GPI\) rotation

\[\begin{split}GPI(\phi) = \begin{bmatrix} 0 & e^{-i\phi} \\ e^{i\phi} & 0 \end{bmatrix}.\end{split}\]
Parameters:
  • phi (float) – rotation angle \(\phi\)

  • wires (Sequence[int] or int) – the wire the operation acts on

  • do_queue (bool) – Indicates whether the operator should be immediately pushed into the Operator queue (optional)

  • id (str or None) – String representing the operation (optional)

adjoint()

Create an operation that is the adjoint of this one.

Adjointed operations are the conjugated and transposed version of the original operation. Adjointed ops are equivalent to the inverted operation for unitary gates.

Returns:

The adjointed operation.

static compute_matrix(phi)

Canonical matrix representation in computational basis.

Parameters:

phi (tensor_like or float) – rotation angle

Returns:

canonical matrix

Return type:

tensor_like

Example

>>> GPI.compute_matrix(0.3)
array([[0.        +0.j        , 0.95533649-0.29552021j],
       [0.95533649+0.29552021j, 0.        +0.j        ]])
num_wires = 1

Number of wires the operator acts on.

class ionizer.ops.GPI2(phi, wires, id=None)

The single-qubit \(GPI2\) rotation

\[\begin{split}GPI2(\phi) = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & -ie^{-i\phi} \\ -ie^{i\phi} & 1 \end{bmatrix}.\end{split}\]
Parameters:
  • phi (float) – rotation angle \(\phi\)

  • wires (Sequence[int] or int) – the wire the operation acts on

  • do_queue (bool) – Indicates whether the operator should be immediately pushed into the Operator queue (optional)

  • id (str or None) – String representing the operation (optional)

adjoint()

Create an operation that is the adjoint of this one.

Adjointed operations are the conjugated and transposed version of the original operation. Adjointed ops are equivalent to the inverted operation for unitary gates.

Returns:

The adjointed operation.

static compute_matrix(phi)

Canonical matrix representation in computational basis.

Parameters:

phi (tensor_like or float) – rotation angle

Returns:

canonical matrix

Return type:

tensor_like

Example

>>> GPI2.compute_matrix(0.3)
array([[ 0.70710678+0.j        , -0.33900505-0.62054458j],
       [ 0.33900505-0.62054458j,  0.70710678+0.j        ]])
num_wires = 1

Number of wires the operator acts on.

class ionizer.ops.MS(wires, id=None)

The two-qubit Mølmer-Sørensen (MS) operation.

In general this is a parametrized operation, but the IonQ hardware permits only this version, where both parameters are 0.

\[\begin{split}MS = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 0 & 0 & -i \\ 0 & 1 & -i & 0 \\ 0 & -i & 1 & 0 \\ -i & 0 & 0 & 1 \\ \end{bmatrix}.\end{split}\]
Parameters:
  • wires (Sequence[int] or int) – the wire the operation acts on

  • do_queue (bool) – Indicates whether the operator should be immediately pushed into the Operator queue (optional)

  • id (str or None) – String representing the operation (optional)

static compute_matrix()

Canonical matrix representation in computational basis.

Parameters:

phi (tensor_like or float) – rotation angle

Returns:

canonical matrix

Return type:

tensor_like

Example

>>> MS.compute_matrix()
array([[ 0.70710678+0.j        ,  0.        +0.j        ,
         0.        +0.j        , -0.        -0.70710678j],
       [ 0.        +0.j        ,  0.70710678+0.j        ,
        -0.        -0.70710678j,  0.        +0.j        ],
       [ 0.        +0.j        , -0.        -0.70710678j,
         0.70710678+0.j        ,  0.        +0.j        ],
       [-0.        -0.70710678j,  0.        +0.j        ,
         0.        +0.j        ,  0.70710678+0.j        ]])
num_wires = 2

Number of wires the operator acts on.