View on GitHub
Open this notebook in GitHub to run it yourself
Quantum Resources Are Valuable, Yet Limited
Quantum computers offer tantalizing promises to those who can harness their power. And although today’s computers are not quite able to solve real-world problems, those who are able to optimize for the available hardware can reap rewards sooner than those who wait. The MCX gate is an important quantum gate used in a variety of circuits, such as the Grover operator, logical AND operator, state preparation algorithms, and arithmetic comparators. The ability to adapt implementations of MCX gates to meet the hardware constraints—limited qubit count, fidelities, gate count, and so on—is not trivial.Creating a 14-Control MCX Gate with Classiq
To create an MCX gate with 14 control qubits using Classiq, we first define a quantum function calledmy_mcx whose arguments are an array of qubits (of any size) for control and a single qubit argument for the target:
main function that executes our my_mcx function with 14 qubits allocated to the control argument:
Constraints object and synthesize our model, create a quantum program, and view it:
Output:
qprog object and print its depth:
Output:
Optimizing MCX for Every Occasion
Classiq automatically optimizes the quantum circuit and each MCX gate to a plethora of possible situations. To characterize each setting we pass our constraints and preferences to the synthesis request using theConstraints and Preferences objects.
For Different Hardware
Output:
For CX Gates
Output:
Beyond 14 Controls
The power of the Classiq synthesis engine is far greater than creating optimized, 14-control MCX gates in an instant. For example, the following code creates an MCX gate with 50 control qubits:Output: