Skip to main content
Welcome to Classiq. This guide walks you through your first quantum program and introduces the core Classiq workflow: modeling, synthesis, execution, and result analysis. You can get started with Classiq in one of the following ways:
  • Studio Python: code in Python directly in the browser. No local installation required.
  • Local Python SDK: code in Python from your local environment, notebook, or preferred editor.
  • Qmod in the Classiq Platform: write Qmod directly in the browser-based Model Editor.
To use Classiq, you need a Classiq account. Register through the Classiq Platform or follow the registration guide.
Both paths use the same core workflow: In this example, you create a small quantum program that introduces the basic Classiq workflow. The program allocates a one-qubit quantum number, applies a Hadamard gate to place it in superposition, assigns a classical value to a second quantum number, and adds the two values into a third quantum number. The model uses three output variables:
  • x: a one-qubit quantum number prepared in superposition.
  • y: a quantum number assigned the value 2.
  • z: a quantum number that stores the expression x + y.
Because x is placed in superposition, execution samples two possible arithmetic outcomes:
  • When x = 0, z = 2.
  • When x = 1, z = 3.
By the end of this example, you will have:
  • Created a simple Qmod model
  • Synthesized it into a quantum program
  • Executed it
  • Verified that the results show the expected relation between x, y, and z
Choose your path:
  • Use Python in Classiq Studio if you want to work with Python in a setup-free, cloud-based coding editor.
  • Use the Python SDK locally if you want to work in notebooks or scripts in your local development environment.
  • Use Qmod-native syntax in the Classiq Platform if you want to write Qmod directly in the browser-based Model Editor.
All paths produce the same expected behavior.
Use the Classiq Studio if you want to build, synthesize, execute, and inspect quantum programs directly in your browser while still coding in Python - no need to install anything.Open the Classiq Studio and create the arithmetic model in a new file:
from classiq import *

@qfunc
def main(x: Output[QNum], y: Output[QNum], z: Output[QNum]):
    allocate(1, x)
    H(x)
    y |= 2
    z |= x + y 

qprog = synthesize(main)

show(qprog)
Visualization of the quantum circuit of a Bell state in light mode.The program visualization displays the synthesized quantum program. A Hadamard gate is applied to the quantum number x, and an arithmetic block is applied between x, y, and z to perform the equation z=x+yz = x + y.To execute the quantum program, run:
res = sample(qprog)

print(res)
Example output:
xyzcountsprobabilitybitstring
02210490.51220711
1239990.48779300
Your exact counts may differ, but the measured results should contain only (x,y,z)=(0,2,2)(x, y, z) = (0, 2, 2) and (x,y,z)=(1,2,3)(x, y, z) = (1, 2, 3), with roughly equal probabilities. This is the result of the arithmetic operation executed by the quantum program.In this path, you used synthesize to compile the high-level model into a quantum program, show to visualize it, and sample to execute it and inspect the measurement results.

What this example introduced

This first program introduced the main ideas you will use throughout Classiq:
  • A quantum function defines reusable quantum logic.
  • main is the entry point of a Qmod model.
  • allocate initializes quantum variables.
  • Quantum gates such as H that manipulates quantum information.
  • Synthesis compiles a high-level model into a quantum program.
  • Execution runs the quantum program and returns measurement results.
  • Result analysis helps you verify that the program behaves as expected.

Next steps

Choose your next tutorial based on your goal: You can also join the Classiq Community Slack for support, questions, and discussions.