Quantum Program Formats¶
The Classiq synthesis process produces a general, abstract circuit able to run on multiple backends. However, to execute on hardware, you must provide a circuit in a particular format, as specified by the hardware provider. The format may include language and specific gates supported by the device. Therefore, it is necessary to transform the circuit generated by Classiq to the required execution format. Do this with the to_program command.
circuit = model.synthesize() program = circuit.to_program() executor = Executor(...) result = executor.execute(program)
Classiq encourages you to use the automatic to_program command. It chooses the format according hardware data if it was provided during the synthesis process. You can also construct the object manually, if, for example, you want to run a circuit synthesized for one device on another device.
from classiq.execution import ( QuantumInstructionSet, QuantumProgram, ) circuit = model.synthesize() program = QuantumProgram( code=circuit.transpiled_circuit.qasm, syntax=QuantumInstructionSet.QASM )
Note that you may need to specify the format in the synthesis preferences for it to be available. The transpiled circuit contains versions of the program decomposed to basis gates.