1
$\begingroup$

I'm working on a Hybrid classical-quantum linear solver. For this, they make a loop on a quantum circuit (ie. below), and each time they change the value of the classical register and apply a X gate on the quantum register conditioned on the state of the classical register. quantum circuit

Therefore, I ask myself, is there a way to initialize the classical register ?

$\endgroup$
  • 1
    $\begingroup$ You cant make classical bits as a controller and make qubits as a target. But you can use if conditional statement to apply x gate on the qubits. $\endgroup$ – Aman Jul 22 at 18:12
1
$\begingroup$

Classical registers are typically used for capturing measurement results, and may also be used for conditionally applying quantum operation. See: https://github.com/Qiskit/openqasm/blob/master/spec/qasm2.rst

Given the problem you described, one approach would be to have a classical program that iteratively: 1) defines and executes a quantum circuit on a quantum processor or simulator 2) reads the results from the classical registers for guidance in defining the circuit for the next iteration

$\endgroup$
0
$\begingroup$

You might find this section of the documentation helpful, it goes over initializing and using registers.

https://qiskit.org/documentation/terra/quantum_circuits.html

$\endgroup$
  • $\begingroup$ I already read it, but they don't talk about classical register initialization. $\endgroup$ – lufydad Jul 23 at 8:27
  • $\begingroup$ What about this post: quantumcomputing.stackexchange.com/questions/1413/… $\endgroup$ – mico Jul 23 at 12:25
  • $\begingroup$ In this post, they initialize the quantum register not the classical register. $\endgroup$ – lufydad Jul 24 at 15:03
  • $\begingroup$ Why dont u initialize qubits and measure them by the classical registers and finally reset the qubits. $\endgroup$ – Aman Jul 24 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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