Support for the powering modifier of OpenQASM 3.0 #27
Labels
Core
Anything related to the Core library and IR
enhancement
New feature or request
good first issue
Good for newcomers
Milestone
The new OpenQASM standard introduces gate modifiers in order to more efficiently describe quantum circuits. Any modifier
mod
can be applied to a gateg
viamod @ g
. For more details, see Section 4.2 in https://arxiv.org/pdf/2104.14722.pdf or the Live Specification.The powering modifier
pow(r)
can be used to represent the r-th power of any gateg
viapow(r) @ g
, wherer
can either be an integer or a floating point number.The case where
r
is a floating point number needs to be handled by computing the principal logarithm of the unitary that representsg
. This might be tricky in general.The case where
r
is an integer can be naively solved by repeatedly applyingg
. Ifr <0
,pow(r) @ g
can be translated toinv @ pow(-r) @ g
. Several simplification might be possible here, e.g., the powers of phase gates can easily be computed by appropriately scaling the respective parameter. In its simplest formpow(2) @ s = z
.At the very least, support for the case where
r
is an integer shall be provided which provides much greater flexibility for describing circuits in a standardized way.Tasks
The text was updated successfully, but these errors were encountered: