Skip to content

Getting started with quantum program synthesis

The first steps in quantum program synthesis are defining the algorithms, its constraints, and your preferences. These are described in detail in the following sections.

Once your model is fully defined, it's time to synthesize it.

In the IDE, describe the model in the model page. After writing down the model, hit the synthesize button on the bottom right of the page. After the synthesis is done, you will automatically be redirected to the quantum program page.

The synthesis process is initiated by performing the synthesize method on a model. Alternatively, the async method synthesize_async can be used as part of an async code (see Advanced Usage).

from classiq import Output, QBit, allocate, create_model, synthesize
from classiq.qmod.quantum_function import QFunc

def main(res: Output[QBit]) -> None:
    allocate(1, res)

model = create_model(main)
qprog = synthesize(model)