The local Braket device

The local device of the PennyLane-Braket plugin runs quantum computations on the local Braket SDK. This could be either utilizing the processors of your own PC, or those of a Braket notebook instance hosted on AWS.

This device is useful for small-scale simulations in which the time of sending a job to a remote service would add an unnecessary overhead. It can also be used for rapid prototyping before running a computation on a paid-for remote service.

Usage

After the Braket SDK and the plugin are installed you immediately have access to the local Braket device in PennyLane.

To instantiate the local Braket simulator, simply use:

import pennylane as qml
device_local = qml.device("braket.local.qubit", wires=2)

You can define and evaluate quantum nodes with these devices just as you would with any other PennyLane device.

For example:

@qml.qnode(device_local)
def circuit(x, y, z):
    qml.RZ(z, wires=[0])
    qml.RY(y, wires=[0])
    qml.RX(x, wires=[0])
    qml.CNOT(wires=[0, 1])
    return qml.expval(qml.PauliZ(0)), var(qml.PauliZ(1))

When executed, the circuit will perform the computation on the local machine.

>>> circuit(0.2, 0.1, 0.3)
array([0.97517033, 0.04904283])

Device options

You can set shots to 0 to get exact results instead of results calculated from samples.

Supported operations

The device support all PennyLane operations and observables, with the exception of the PennyLane QubitUnitary and Rot gates and Hermitian observable.

The PennyLane-Braket plugin provides the following framework-specific operations for PennyLane, which can be imported from braket.pennylane_plugin.ops:

braket.pennylane_plugin.CPhaseShift(phi, wires)

Controlled phase shift gate phasing the \(| 11 \rangle\) state.

braket.pennylane_plugin.CPhaseShift00(phi, wires)

Controlled phase shift gate phasing the \(| 00 \rangle\) state.

braket.pennylane_plugin.CPhaseShift01(phi, wires)

Controlled phase shift gate phasing the \(| 01 \rangle\) state.

braket.pennylane_plugin.CPhaseShift10(phi, wires)

Controlled phase shift gate phasing the \(| 10 \rangle\) state.

braket.pennylane_plugin.ISWAP(wires)

ISWAP gate.

braket.pennylane_plugin.PSWAP(phi, wires)

Phase-SWAP gate.

braket.pennylane_plugin.XY(phi, wires)

Parameterized ISWAP gate: https://arxiv.org/abs/1912.04424v1

braket.pennylane_plugin.XX(phi, wires)

Ising XX coupling gate: https://arxiv.org/abs/1707.06356

braket.pennylane_plugin.YY(phi, wires)

Ising YY coupling gate: https://arxiv.org/abs/1707.06356

braket.pennylane_plugin.ZZ(phi, wires)

Ising ZZ coupling gate: https://arxiv.org/abs/1707.06356