Classiq's New Pauli Operator Syntax
Classiq’s Qmod quantum programming language fully supports classical structs, similar to common classical programming languages. We recently added a specialized syntax for constructing Pauli operators, a classical struct that appears frequently in quantum computing. For example, the following Qmod Python expression
H = 0.5 * Pauli.Z(0) * Pauli.Y(1) * Pauli.X(2) + 0.8 * Pauli.X(1)
describes a Pauli operator with two terms, 0.5⋅X⊗Y⊗Z
and 0.8⋅I⊗X⊗I
. These Pauli operators can be used, for instance, as an argument to Classiq’s Suzuki-Trotter function and also to describe the observable when estimating the expectation value.
For example, the following model creates a Pauli operator using the new syntax and send it to suzuki_trotter
:
from classiq import *
@qfunc
def main() -> None:
q = QArray(length=4)
allocate(q)
H = 0.5 * Pauli.Z(0) * Pauli.Y(1) * Pauli.X(2) + 0.8 * Pauli.X(1)
suzuki_trotter(H, 1, 1, 1, q)
After synthesizing the model, we can analyze the resulting circuit on the Classiq Platform:

Classiq’s Qmod quantum programming language fully supports classical structs, similar to common classical programming languages. We recently added a specialized syntax for constructing Pauli operators, a classical struct that appears frequently in quantum computing. For example, the following Qmod Python expression
H = 0.5 * Pauli.Z(0) * Pauli.Y(1) * Pauli.X(2) + 0.8 * Pauli.X(1)
describes a Pauli operator with two terms, 0.5⋅X⊗Y⊗Z
and 0.8⋅I⊗X⊗I
. These Pauli operators can be used, for instance, as an argument to Classiq’s Suzuki-Trotter function and also to describe the observable when estimating the expectation value.
For example, the following model creates a Pauli operator using the new syntax and send it to suzuki_trotter
:
from classiq import *
@qfunc
def main() -> None:
q = QArray(length=4)
allocate(q)
H = 0.5 * Pauli.Z(0) * Pauli.Y(1) * Pauli.X(2) + 0.8 * Pauli.X(1)
suzuki_trotter(H, 1, 1, 1, q)
After synthesizing the model, we can analyze the resulting circuit on the Classiq Platform:
