Questions tagged [programming]

For any questions whose answer is expected to require code or programming notions. For questions about a specific framework (e.g. qiskit or cirq) please also include a more specific tag. If your question is about installation or any specific framework error, consider posting it in https://stackoverflow.com/ instead.

Quantum programming languages with tags on this site include:

More tags will hopefully be added in the future and creating tags on other quantum programming languages for appropriate questions is also encouraged.

1731 questions
87
votes
7 answers

What programming languages are available for quantum computers?

From this question, I gathered that the main quantum computing programming languages are Q# and QISKit. What other programming languages are available for programming quantum computers? Are there certain benefits to choosing particular ones? EDIT: I…
Pro Q
  • 1,003
  • 1
  • 8
  • 9
51
votes
8 answers

Resources to get started programming quantum computers for non-physics majors

I come from a non-physics background and I am very much interested in pursuing Quantum Computing - especially how to program them. Any guidance on how to get started will be very helpful.
Koder101
  • 1,027
  • 1
  • 10
  • 15
37
votes
3 answers

How do you write a simple program for a D-Wave device?

I would like to know how a job for a D-Wave device is written in code and submitted to the device. In the answer it would be best to see a specific example of this for a simple problem. I guess that the "Hello World" of a D-Wave device would be…
James Wootton
  • 11,700
  • 1
  • 35
  • 74
34
votes
6 answers

How do I build a gate from a matrix on Qiskit?

I'm creating a gate for a project and need to test if it has the same results as the original circuit in a simulator, how do I build this gate on Qiskit? It's a 3 qubit gate, 8x8 matrix: $$ \frac{1}{2} \begin{bmatrix} 1 & 0 & 1 & 0 & 0 & 1 & 0 & -1…
Nillmer
  • 785
  • 1
  • 5
  • 13
30
votes
5 answers

How can I implement an n-bit Toffoli gate?

I want to create a Toffoli gate controlled by n qubits, and implement it in QISKit. Can this be done? If so, how?
Ali Javadi
  • 1,652
  • 1
  • 9
  • 11
29
votes
4 answers

Are quantum computers just a variant on Analog computers of the 50's & 60's that many have never seen nor used?

In the recent Question "Is Quantum Computing just Pie in the Sky" there are many responses regarding the improvements in quantum capabilities, however all are focussed on the current 'digital' computing view of the world. Analog computers of old…
21
votes
3 answers

What would a very simple quantum program look like?

After reading the "first programmable quantum photonic chip". I was wondering just what software for a computer that uses quantum entanglement would be like. Is there any example of code for specific quantum programming? Like pseudocode or…
Didix
  • 815
  • 10
  • 21
20
votes
1 answer

How to measure in another basis

I am new to qiskit and I have to simulate a quantum circuit. I read this documentation https://qiskit.org/textbook/ch-states/single-qubit-gates.html where it is left as an exercise to the reader to write a function to measure in the $|+i\rangle$ and…
thedumbkid
  • 329
  • 1
  • 2
  • 11
18
votes
3 answers

Does a complete list of open quantum software projects exist?

An answer to Is there any source which tabulates quantum computing algorithms for simulating physical systems? mentions the Quantum Algorithm Zoo, a list of quantum algorithms. Several answers to Programming quantum computers for non-physics majors…
agaitaarino
  • 3,907
  • 2
  • 13
  • 42
15
votes
3 answers

How to calculate an Expected Value of some operator acting on qubits?

I'm trying to implement the Variational Quantum Eigensolver in Qiskit. Suppose, I have an operator $A = \sigma_1^z\sigma_2^z$ acting on some two-qubit state $|\psi\rangle$. After a measurement I get a set of probabilities corresponding to states…
C-Roux
  • 928
  • 2
  • 9
  • 20
15
votes
1 answer

How many logical qubits are needed to run Shor's algorithm efficiently on large integers ($n > 2^{1024}$)?

First, I know there are differences in logical qubits and physical qubits. It takes more physical qubits for each logical qubit due to quantum error. Wikipedia states that it takes quantum gates of order $\mathcal{O}((\log N)^2(\log \log N)(\log…
LeWoody
  • 924
  • 1
  • 8
  • 14
15
votes
2 answers

Does a study guide exist that starts from a "purely CS background" and advances towards "making a new quantum programming language"?

I am from a computer science background and I find it difficult to decide on the resources I should focus on while learning quantum computing, since there is so much to read/watch. My ultimate goal is to make a programming language acting as an…
14
votes
2 answers

Automatic compilation of quantum circuits

A recent question here asked how to compile the 4-qubit gate CCCZ (controlled-controlled-controlled-Z) into simple 1-qubit and 2-qubit gates, and the only answer given so far requires 63 gates! The first step was to use the C$^n$U construction given…
14
votes
3 answers

Given circuits preparing $|\psi\rangle$ and $|\phi\rangle$, what's a circuit preparing $|\psi\rangle+|\phi\rangle$?

Given a quantum circuit $C_1$ that generates a state $\vert\psi\rangle$ and another circuit $C_2$ that generates $\vert\phi\rangle$, is there a way to construct a circuit that outputs $$\frac{1}{\sqrt{2}}(\vert \psi\rangle +\vert\phi\rangle)$$ using…
13
votes
2 answers

Does quantum computing already possess the level of abstraction to be explicable even without knowledge of physics?

Currently, quantum computer science (in contrast to classical computer science) can mostly only be understood if one has a good inside knowledge of physics, or more precisely quantum physics. Only then one can really understand the explanations of…
1
2 3
99 100