What's Classiq?
Your entry-point for creating & running quantum programs.
Classiq allows you to design, optimize, analyze, and execute any quantum program. The platform is suited for quantum experts allowing flexible design and deep optimization of quantum programs. It is also a great way to learn quantum computing, with a Library of algorithms and applications, and intuitive visualization.
Classiq has two interfaces:
1.Web-based IDE at platform.classiq.io
2.Python SDK
Quick installation via the command line:
pip install classiq
And authentication within Python:
import classiq
classiq.authenticate()
You can transition directly between the two interfaces at any stage of the development. This allows you to do (almost) everything in the IDE or (almost) everything in the SDK, and combine and interchange between the two.
Here is a high-level breakdown of the steps:
- Design - write your quantum algorithm using Classiq's QMOD language. Qmod is built for describing quantum programs without pre determining the implementation details. It is intuitive and powerful.
- Optimize - Send your algorithm to Classiq's synthesis engine (compiler) that comes up with the optimal quantum program for your algorithm, according to the constraints and preferences you apply.
- Analyze the quantum program with the Classiq's visualizer tool in order to view the circuit level implementation of your algorithm.
- Execute it on Classiq's simulators or on any quantum computer and simulators available via the cloud.
Design
As developers, we are interested in the functionality of the quantum program. Classiq's Qmod language is designed to allow a full description of the program functionality, without determinting the implemtation details. This allows for a more flexible and powerful description of the quantum program, and later enables optimizing the program implementaion (see optimization)
Classiq introduces a native quantum programming language, Qmod
, that naturally captures the core concepts of quantum algorithms. There are two ways to design in Qmod
:
- Directly, via the Classiq IDE using the Qmod native syntax
- With the Classiq Python SDK package that gives access to the Qmod language via Python
# Deutsch-Jozsa Algorithm
from classiq import *
@qfunc
def constant_function(x: QNum, res: QBit):
res ^= x < (2**x.size)
@qfunc
def prepare_minus(out: Output[QBit]):
allocate(1, out)
X(out)
H(out)
@qfunc
def apply_oracle(x: QNum):
aux = QBit("aux")
within_apply(
within=lambda: prepare_minus(aux), apply=lambda: constant_function(x, aux)
)
@qfunc
def main(x: Output[QNum]):
allocate(4, x)
hadamard_transform(x)
apply_oracle(x)
hadamard_transform(x)
quantum_model = create_model(main)
Optimization
Describing the program functionality without specifing the implementation is the only way forward. Most quantum algorithms and functional building blocks can be implemented in many ways, and a full program can be implemeted in countless possibilities. Some circuits have more auxiliary qubits that result in shorter circuit depth, others have a minimal number of qubits but longer circuits, some have all the qubits connected to each other, and others have limited connectivity. Implementation decisions are interconnected and must be managed globally.
As developers, you want optimal implementation for your algorithms according to your definitions. The Classiq synthesis engine enables exactly this. You design your algorithm in Qmod and then you synthesize (compile) it with your constraints and preferences. Classiq's technology will output the best solution available.
quantum_program = synthesize(quantum_model)
Analysis
Once a quantum program is created, no doubt you would like to analyze the result. Your questions could take different forms and levels of hierarchies.
-
Are the blocks connected in the right way?
-
Are the auxiliary qubits reused as desired?
-
What is the gate level implementation?
The Classiq visualization tool allows explore these questions and is enabled by the high-level functional design of the quantum algorithm. You can access the tool directly in the IDE using the Quantum Program tab, or in the Python SDK using the show(quantum_program)
command:
show(quantum_program)
Opening: https://platform.classiq.io/circuit/d8b09e26-17eb-4a4f-9bba-1390df4a8026?version=0.42.1
Execution
The final step of the quantum algorithm flow is running it to receive the results and then post-process them. There are two possibilities for quantum computing execution nowadays: on real quantum computers (QPU's) and on simulators (classical computers that simulate small quantum computers). With Classiq you can access both! Several simulators are available for free with Classiq, and there is straightforward access to the majority of quantum processors and simulators available via the cloud through all major cloud providers such as IBM Quantum, Amazon Braket, and Azure Quantum. You can send for execution directly in the IDE or via the SDK. In both cases, you can access all your jobs in the IDE Jobs tab.
execute(quantum_program)
ExecutionJob(id='ac0c5cd7-e0a2-4a36-891f-7121ad3b5a44')
Getting Started
-
Continue on to Classiq 101!
-
A comprehensive Library of examples, built with Classiq.
-
Become part of the vibrant Classiq community by joining the Classiq Community Slack.
write_qmod(quantum_model, "whats_classiq")