2
$\begingroup$

I am implementing a VQE algorithm where I need controlled phase gate as part of ansatz circuit. I am using Amazon Braket service. Ionq processor however does not support c-phase gate or phase gate. How can I implement it?

The error message is as follows

AlgorithmError: ValidationException: An error occurred (ValidationException) when calling the CreateQuantumTask operation: [line 55] uses a gate: phaseshift which is not supported by the device or defined via a defcal, exit code: 1

$\endgroup$
1

1 Answer 1

3
$\begingroup$

You'll want to write the cphaseshift gate in terms of gates that are supported by the IonQ device through Amazon Braket. For example, the circuit

  • circuit = Circuit().cphaseshift(0, 1, theta)

is equivalent to either of the following circuits, which contain only supported gates:

  • circuit = Circuit().x(0).x(1).rz(1, -theta/2).zz(0, 1, -theta/2).rz(0, -theta/2).x(0).x(1)
  • circuit = Circuit().rz(1, theta/2).cnot(0, 1).rz(1, theta/2).cnot(0, 1).rz(0, theta/2)

So if you replace your usage of cphaseshift with one of the equivalent sequences of gates shown above, it should work. Note that the first example contains only a single 2-qubit gate (zz), which should make it preferable.

Note that you can see the full list of operations supported by any Amazon Braket device by looking at the device properties. For example, to see the supported gates on the IonQ Aria-1 device, you can run:

from braket.devices import Devices
from braket.aws import AwsDevice

device = AwsDevice(Devices.IonQ.Aria1)
device.properties.action['braket.ir.openqasm.program'].supportedOperations

which will return:

['x', 'y', 'z', 'rx', 'ry', 'rz', 'h', 'cnot', 's', 'si', 't', 'ti', 'v', 'vi', 'xx', 'yy', 'zz', 'swap']
$\endgroup$
2
  • 1
    $\begingroup$ Thank you for the help. Can you tell me how did you found out these decompositions for cphase? $\endgroup$
    – F1_light
    Commented Feb 16 at 6:38
  • 1
    $\begingroup$ I found them manually by a bit of trial and error. You could also use a transpiler (e.g. from qiskit) to compile into a desired target gate set. $\endgroup$ Commented Feb 16 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.