How to calculate quantum cost of a reversible logic circuit? I am trying to develop new reversible logic synthesis algorithm. But I need a good quantum cost measure for a synthesized circuit to compare my results with existing ones.
For now I'm using RCViewer+ software to calculate quantum cost of a circuit. Unfortunately, I was told that this software is based on an outdated technique and that I should use "T-count for fault tolerant logical-level implementations".
My questions are:


*

*Which quantum cost measure is the most up-to-date and widely used?

*Is there any software to calculate it automatically?


*

*if yes, which input format for a circuit should I use?

*if no, where can I read about this cost measure and how to calculate it manually?



If it is matter, my software produces circuits consisting of Toffoli gates with multiple control inputs, both positive and negative ones.
 A: Thanks to Dr. Dmitry Maslov, now I'm able to answer my own question.
Among all quantum cost metrics the most popular are:


*

*The number of elementary quantum gates required for an implementation of a reversible circuit. The calculation of this cost metric is based on the following papers:


*

*"Elementary gates for quantum computation".

*"Quantum Circuit Simplification Using Templates".

*"Quantum Circuit Simplification and Level Compaction".


The table with Toffoli gates cost can be found here. In short, the cost of a Toffoli gate of size $k$ in a circuit with $n$ inputs is $QC = 2^k$, if $k=n$, $QC = 24n - 88$ if $k \leq n - 1$ and $QC = 12n - 34$ if $k \leq \frac{n+3}{2}$.
The quantum cost of generalized Toffoli gates with at least one positive control is the same as those with all positive controls. The quantum cost of generalized Toffoli gates with all negative controls is increased by 2.
RCViewer+ is capable to calculate this quantum cost automatically. A circuit's file should be in the TFC format.

*The number of $T$ gates required for an implementation of a reversible circuit using Clifford+$T$ gates ($T$-count). This cost metric is used for fault tolerant circuits, because the cost of any Clifford gate is very low compared to the cost of a $T$ gate. But unlike the previous cost metric, this one is not universal: if a circuit with $n$ inputs has a Toffoli gate of size $n$, it cannot be implemented using Clifford+$T$ gates and without an ancillary line. Hence, it is not possible to calculate the $T$-count cost for such circuit if no ancillary line is available.
The calculation of this cost metric is based on the following paper:


*

*"On the advantages of using relative phase Toffolis with an application to multiple control Toffoli optimization" (thanks to @igael for mentioning it).


In short, the $T$-count cost of a Toffoli gate of size $k$ in a circuit with $n$ inputs is $QC = 8k - 16$, if $k \leq \lfloor \frac{n+3}{2}\rfloor$. Otherwise, one should apply the Lemma 7.3 from "Elementary gates for quantum computation", obtain four new Toffoli gates and calculate their cost by the formula. If $k = n$, then one ancillary line is required to apply this cost calculation.
A Toffoli gate with negative control lines has the same $T$-count cost as the Toffoli gate without them, because NOT and CNOT gates don't require any $T$ gate for their implementation.
For now, there is no any software capable to calculate this cost metric automatically. RCViewer+ can calculate the quantum cost in "2-qubit cost model", which is close to the $T$-count, but the formula it used for the calculation is $QC = 10k - 25$ (see "Reversible Circuit Optimization via Leaving the Boolean Domain").
I've written a simple Python script to calculate the $T$-count cost of a reversible circuit, consisting of Toffoli gates. A file with its description should be in the TFC or the REAL format. Hope it will be useful for someone.
