2

According to the OPENQASM 2.0 documentation, it's possible to define custom unitary gates using the format:

gate name(params) qargs
{
body
}

where the optional parameter list params is a comma-separated list of variable parameter names, and the argument list qargs is a comma-separated list of qubit arguments.

In my specific case, I'm trying to implement a single-qubit controlled unitary which will act on two qubits. So is there a way to define a custom controlled unitary gate in OPENQASM 2.0? It should work on the new IBM Quantum Experience Beta.

Sanchayan Dutta
  • 17,945
  • 8
  • 50
  • 112

1 Answers1

1

Unfortunately, I'm pretty sure that the functionality you desire does not exist. You'll need to do it by constructing the unitary yourself, for example via this method provided in the answer to another question.

For reference, the full specification for OpenQASM 2.0 can be found here.

James Wootton
  • 11,700
  • 1
  • 35
  • 74