All Questions
Tagged with or programming programming
227 questions
12
votes
3
answers
5k
views
Big Endian vs. Little Endian in Qiskit
I've noticed that Q# favors Little Endian. Meaning that most operations are designed for this type of encoding.
Is is it the same with Qiskit?
12
votes
1
answer
9k
views
Evaluating expectation values of operators in Qiskit
I'm wondering how in Qiskit one can calculate the expectation value of an operator given as a WeightedPauli (or, at least, of a single ...
51
votes
8
answers
3k
views
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.
29
votes
5
answers
13k
views
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?
15
votes
2
answers
1k
views
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 ...
19
votes
1
answer
15k
views
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 ...
33
votes
6
answers
15k
views
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}{...
18
votes
3
answers
1k
views
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 ...
14
votes
3
answers
1k
views
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{...
10
votes
2
answers
2k
views
Transpilation into custom gate set in qiskit
In qiskit, I can transpile a given circuit into a some predefined gate set as follows (just an example)
...
9
votes
1
answer
9k
views
How to create an arbitrary state in QISKit for a local_qasm_simulator?
I would like to play with a quantum circuit local_qasm_simulator in QISKit, but I do not want to implement a separate quantum circuit that would prepare an initial ...
6
votes
2
answers
651
views
Simple Hadamard Circuit gives incorrect results?
I am running the simplest Hadamard circuit possible - one qubit, initialised to 0, apply H gate, measure in Z basis. When I run the circuit on the simulator I obtain the expected result (50% in 0, 50% ...
29
votes
4
answers
8k
views
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' ...
15
votes
1
answer
8k
views
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 ...
13
votes
2
answers
2k
views
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 ...
12
votes
4
answers
5k
views
How to quickly calculate the custom U3 gate parameters $\theta, \phi$ and $\lambda$ for any unitary?
In IBM Qiskit and Quantum Experience, the custom U3 gate is defined as
$$
U(\theta, \phi, \lambda) =
\begin{pmatrix}
\cos\left(\frac{\theta}{2}\right) & -e^{...
9
votes
1
answer
4k
views
Phase-Shift Gate in Qiskit
How to implement the phase shift gate in qiskit or ibmq?
Phase Shift Gate : $$\begin{pmatrix}e^{ia} && 0 \\ 0 && e^{ia}\end{pmatrix} = e^{ia}I$$
6
votes
5
answers
2k
views
How do I get the Unitary matrix of a circuit without using the 'unitary_simulator'?
I am using jupyter notebook and qiskit. I have a simple quantum circuit and I want to know how to get the unitary matrix of the circuit without using 'get_unitary' from the Aer unitary_simulator. i.e.:...
6
votes
2
answers
814
views
How can I find a Clifford+T approximation of an arbitrary one qubit gate in Qiskit?
I know the Solovay-Kitaev algorithm can achieve this. Is there an implementation of this or any other algorithm for the same task in Qiskit? Or perhaps some other library that interfaces well with ...
3
votes
1
answer
654
views
Counting in Q#: number of solutions
I have this program derived from Microsoft Quantum Katas for counting (see here):
...
2
votes
2
answers
640
views
Why IBM Quantum Experience is giving different results under ibmq_qasm_simulator and ibmq_16_melbourne?
I am trying to run following 6 qubit quantum circuit and I am getting different results under ibmq_qasm_simulator and ibmq_16_melbourne (both involving 8192 shots). What is the reason?
...
0
votes
1
answer
402
views
Error while trying to execute the Quantum Circuits in IBMQ
I have been trying to execute the quantum circuit in the backend of the IBM 16 qubit Melbourne machine. I end up getting
...
86
votes
7
answers
40k
views
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 ...
13
votes
2
answers
738
views
Hamiltonian simulation with complex coefficients
As part of a variational algorithm, I would like to construct a quantum circuit (ideally with pyQuil) that simulates a Hamiltonian of the form:
$H = 0.3 \cdot Z_3Z_4 + 0.12\cdot Z_1Z_3 + [...] +
- ...
13
votes
6
answers
2k
views
Resources for quantum algorithm basics
I have just started to learn about quantum computing, and I know a little bit about qubits. What is a resource where I can learn a basic quantum algorithm and the concepts behind how it works?
10
votes
1
answer
2k
views
How efficient is Qiskit's unitary decomposition?
In Qiskit's extension package we have the UnitaryGate module that you can initialize using a unitary matrix and then add it to your circuit. How efficiently is this ...
10
votes
1
answer
4k
views
Can I remove gates from a QuantumCircuit?
Suppose I want to implement run several circuits one after another, but they are constructed in a similar fashion. I could reinstantiate a QuantumCircuit for each ...
8
votes
3
answers
1k
views
Compiling a classical function to a quantum circuit in practice
It can be shown that any classical function $f$ can be implemented by a quantum circuit $Q_f$, so that
$$
\sum_{x}|x,0^k\rangle \xrightarrow{\mathit{Q_f}} \sum_{x}|x,f(x)\rangle
$$
where $f$ has $k$ ...
6
votes
1
answer
2k
views
How to get subspace of quantum circuit?
How can I get a subspace of a quantum circuit? More precisely, I'm dealing with quantum circuit with data qubits ('q') and ancilla qubits ('anc'), such as $(q_0,q_1,...,q_n,anc_0,..anc_m)$.
After some ...
6
votes
2
answers
2k
views
How many shots should one take to get a reliable estimate in a quantum program?
When testing my quantum programs, I wonder how many shots I must take to get a specific accuracy.
Are there any papers that you can recommend that analyze this?
6
votes
3
answers
9k
views
How can I obtain transformation matrix of a quantum circuit in the Qiskit?
I need to draw a quantum circuit in Clifford+T library and obtain automatically its transformation matrix. Is there any feature on Qiskit in this case?
6
votes
1
answer
2k
views
What is the difference between Qiskit execute and the IBMQJobManager?
I was researching how to submit multiple pulse schedules/circuits in the same job and came across 2 methods:
Executing Experiments with qiskit.execute
and ...
5
votes
1
answer
692
views
How can noise on a device be simulated using measured noise parameters?
The real devices used as backends for Qiskit have calibration data that quantifies errors ($T_1$ and $T_2$, gate fidelities, etc). This can be accessed by, for example
...
4
votes
1
answer
1k
views
How to use external .csv data file in quantum support vector machine qiskit python code?
I am new to python programming and Qiskit. I would like to ask can we use sklearn for adding external .csv data file before Qiskit libraries, or without sklearn, we can do or is there any other Qiskit ...
4
votes
1
answer
290
views
How to make a half adder for x number of qubits with min. cost?
How to make a half adder for N inputs and getting the output on another x+1 output. Where x ...
4
votes
1
answer
941
views
API error when trying to access IBM Quantum Computer using IBMQ API Token
I'm trying to write a code so that if the token exists then it loads the account or else it asks the user for the API token. Below is the code for reference:
...
4
votes
3
answers
1k
views
How to plot custom gate labels in Qiskit?
How can I create a custom gate in qiskit that is plotted using latex formatting (or another type of formatting)? For example the following code generates a circuit diagram
...
4
votes
1
answer
1k
views
What is the difference between Qiskit Terra, Aer, Ignis and Aqua?
I am going through the Qiskit tutorials and they have an article on each of the above 4. however, As a beginner, I am not very clear. Could anyone share some insights on these?
3
votes
2
answers
391
views
IBM Quantum Experience API Without QISKit
I am a computer science master's student who is doing research in the field of quantum computing. I have an IBM quantum experience account(https://quantum-computing.ibm.com/) and as such I was ...
3
votes
3
answers
2k
views
Qiskit: Get approximate execution time
The IBMQ web interface shows both queue position and an approximate execution time for every pending job (see image below). Is there a way to retrieve this information via Qiskit? I know that ...
3
votes
2
answers
1k
views
Qiskit: count the type of gates on the qubit with the largest number of gates in a multi-qubit circuit
I would like to know the number and type of all the gates on the wire/qubit with the largest operations in a quantum circuit with multiple qubits. Is there any inbuilt functionality, or what is the ...
3
votes
2
answers
1k
views
Conjugate transpose of a U-gate
I want to be able to create the circuit depicted below, but running the code below results in an empty circuit when viewing the job afterwards.
...
2
votes
1
answer
1k
views
Visualize full UCC circuit in qiskit
I am experimenting with the UCC module in qiskit nature. From pyscf, I got 1-body and 2-body integrals (I need to use custom integrals) and thus created a mapped ...
2
votes
1
answer
960
views
Decomposition of an arbitrary gate using given matrix in Qiskit
If I have an arbitrary non-unitary matrix of say
$$
U = \begin{pmatrix}
1.5 & 0 & 0 & 0 \\
0 & 0 & 0 & 1.6 \\
0 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 \\
\end{...
1
vote
2
answers
632
views
Quantum GAN implementation
Can anyone provide a good link to understand how to implement qgan using pytorch in qiskit. Trying to understand this ( https://qiskit.org/documentation/machine-learning/tutorials/...
1
vote
1
answer
2k
views
How to code a projector operator in qiskit?
I'm new to qiskit and I want to know how do I define a projector operator in qiskit? Specifically, I have prepared a 3 qubit system, and after applying a whole lot of gates and measuring it in a state ...
1
vote
2
answers
638
views
qiskit textbook code throws RuntimeError: IBMBackend.run() is not supported in the Qiskit Runtime environment
I am trying to run the quantum communication algorithm from qiskit textbook "Entangled States" using my IBM API key, however, it throws the error ...
1
vote
1
answer
155
views
Bit Flip, Separable state and Several Question about Cirq
1)I want to use noise model for my state and bit_flip is not defined on cirq.
...
1
vote
2
answers
438
views
IBM Q - Individual Run Results
In Qiskit, is there a way to get the individual results from each shot on the IBM quantum device (instead of simply the summary statistics)? The result JSON file provides the count of all the 1024 ...
1
vote
1
answer
646
views
A problem with application of multi controlled rotation gates [closed]
This message pops up when I run an mcrx gate
The mcrx gate needs a single qubit as target.
Here is a part of code I run:
...