1
$\begingroup$

The question might be naive, but I'm hesitant to design my algorithm in a complex, Object-Oriented scheme (custom classes, objects etc.). My fear is that current frameworks (e.g. ibmq, qiskit-runtime) don't support it.

Is this the case? Can I verify/reject this?

$\endgroup$

2 Answers 2

2
$\begingroup$

You can consider Qiskit as a classical interface between QPU and classical computer. You use classical programming language to prepare quantum circuit. Before sending the circuit to QPU you are still in classical world and you can do anything Python allows - use all other Python libraries, connect to SQL databases or other data sources etc. Even if you call already prepared algorithms from Qiskit libraries you do so classically. Once you call procedure for running the computation on QPU, your algorithm is transpiled to native quantum gates of particular QPU. This is also classical process. Only after that (again classical) electronic set up QPU and run the algorithm in quantum world. After measurement, you receive classical data and you can post-process them in Qiskit, again classically.

To sum up, you can use any programming paradigm supported by Python. From your point of view, everything is done classically and QPU is just a device controlled by your classical program using Qiskit libraries.

$\endgroup$
3
$\begingroup$

Qiskit doesn't enforce any restrictions on how you organize you code. You can use OOP concepts as long as the result circuit is an instance of QuantumCircuit class or a subclass of it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.