2
$\begingroup$

I just started programming in Q# and I wonder if the coding for Q# in classical computer would be the same as coding in a quantum computer. Obviously, these 2 kinds of computers work differently, so I guess the language must be working differently as well. Does this affect the coding part in any way (syntax, dealing with operations and variables etc.)?

$\endgroup$
6
$\begingroup$

Running programs on a quantum computer will indeed require some routines which are not required for running them on a classical simulation. Two easiest examples are error correction (a classical simulation is perfect but a quantum device will be noisy and will require error correction to produce useful results) and translating logical qubits and gates to physical ones (in a simulation you can do any gate on any pair of qubits, but a physical device will be limited to certain set of primitive gates and a certain connectivity scheme).

However, the person writing high-level quantum code is likely uninterested in such low-level routines (unless they are researching them specifically), same as a person writing this answer doesn't really want to care about the addresses of the bytes storing it on their computer. High-level programming languages (in particular Q#, since you asked about it) aim to provide a high-level abstraction for the programmer and delegate low-level routines to the compiler. This also allows to run the same code on the simulators (for debugging and resource estimation purposes) and then to take it to a quantum device without modifications.

$\endgroup$
2
$\begingroup$

As far as working is concerned, you are right. A quantum computer works entirely differently than a classical simulator for the same. Whether there will be any difference in the "coding part" depends on the specific cases. While you cannot get a real quantum computer yet, a lot of online tools are available for cloud Quantum Computation. IBM's Qiskit, for instance, would have no difference in the coding part in the cloud quantum and the classical simulation. All you change is you import another library for the API usage. You can check the same for Rigetti's pyQuil.

$\endgroup$

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.