# How should I think about circuit metrics like "qubit count," "circuit depth," and "gate count" when dealing with the OpenQASM 3 ctrl modifier?

It seems like circuit metrics like qubit count, circuit depth, and gate count are pretty useful. Qubit count determines whether a it's even possible to run a program on resource-limited quantum computers, circuit depth determines how long qubits need to last (coherence time), and gate count seems like a reasonable measure of the total amount of work done in a circuit (and has implications for fault-tolerance). It should be obvious from looking at a circuit diagram that the gate count is bounded by the qubit count times the circuit depth. (Are there any other important metrics I should be considering?)

From what I've seen, these metrics tend to be used in contexts where gates in a quantum circuit are limited in size; for example, a gate set that includes only single-qubit gates and CNOT gates. This is the gate set used in OpenQASM 2, and I feel like I understand how these metrics can be automatically calculated for an OpenQASM 2 program.

However, OpenQASM 3 is more complicated. It includes a ctrl modifier that can be applied to arbitrary quantum gates, including ones composed from smaller gates. For example, the CCX (Toffoli) gate is defined like this:

gate ccx a, b, c { ctrl @ ctrl @ x a, b, c; }


I know that there are ways to decompose multi-controlled gates like this into a polynomial number of one- and two-qubit gates, but I'm not sure if that's the right way to think about it. In particular, I have the following questions:

1. Are OpenQASM 3 compilers for near-term quantum devices expected to decompose multi-controlled gates into one- and two-qubit gates? If write an OpenQASM 3 program that uses a five-qubit "CCCCX" gate (controlled-controlled-controlled-controlled not) and run it on a near-term quantum computer, should I expect that the compiler will be performing some sort of decomposition into smaller gates? Or is there some clever physical trick that avoids this kind of decomposition?
2. If a decomposition is required, is there a particular decomposition that near-term quantum devices are expected to use? There are multiple ways to decompose a CCCCX gate into smaller gates, some of which use ancillae and some of which don't. It seems that OpenQASM 3 doesn't specify a particular decomposition.
3. Do metrics like "qubit count," "circuit depth," and "gate count" even make sense in a computational model that includes ctrl modifiers? Are there other metrics that are more appropriate in this context? More generally, how can I compare the theoretical performance of two OpenQASM 3 programs without actually running them?
4. Assuming these metrics are appropriate, how should they be computed? Do I simply decompose the circuit into one- and two-qubit gates and then use the metrics of the decomposition? If so, it seems the answer to this question depends on the answer to question 2.

Answers to any of these questions would be appreciated!

• Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
– Community Bot
Nov 21 at 15:58
• Are you saying I shouldn't ask multiple questions in a single post? The questions are all related, and it seems like it would be less useful to divide this post into multiple questions.
– Finn
Nov 22 at 13:38