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.

Filter by
Sorted by
Tagged with
3
votes
1answer
232 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: ...
3
votes
3answers
1k 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?
3
votes
2answers
766 views

How to initialize a qubit with a custom state in Qiskit Composer

I'm trying to initialize a qubit with a custom state in IBM's Qiskit Composer. I wrote the code in the Qiskit Lab and obtained the QASM code as shown below ...
3
votes
3answers
282 views

Existence of multiple job monitor in qiskit

I can see in example code of qiskit, to implement job monitors on IBM Quantum machines, example uses any of the following ...
3
votes
2answers
209 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
2answers
203 views

How to run VQE experiments on IBMQ Backends?

The VQE.run method only takes a quantum_instance of type QuantumInstance or BaseBackend and ...
3
votes
1answer
344 views

How to perform a time evolution of a quantum state with Qiskit Aqua?

How can we perform a time evolution of a quantum state for a given Hamiltonian with qiskit Aqua operator flow? I'm interested in it due to its higher efficiency.
3
votes
3answers
914 views

How can we construct a square root of NOT gate in Qiskit and IBMQ circuit composer using universal gates?

I have tried it with decomposing controlled S then conjugating with H gate. But I want to construct it using a minimum number of gates.
3
votes
1answer
431 views

How to set up Qconfig.py and where is the file?

How to set up Qconfig.py and where is the file? I mean under which folder? Like /anaconda/lib/python3.6/site-packages/qiskit/.
3
votes
1answer
103 views

Multiplying quantum circuits in cirq using * and computing "expectation values"

I am reading cirq guide about Simulation and there is an example in "Expectation values" paragraph that I don't understand. Everything boils down to the following snippet: ...
3
votes
1answer
121 views

Is running a for loop faster on a quantum computer than a classical computer?

Curious to understand if I run for loop within a quantum algorithm, and lets say I want the quantum algorithm to run in classical run time of O(1). Can this be done?
2
votes
2answers
326 views

Qiskit order of multiplication and tensor product

Section 2.3 of the Qiskit textbook shows us that $$ CNOT|0+\rangle \ = \ \frac{1}{\sqrt2}(|00\rangle + |11\rangle)$$ which I was able to translate to a circuit as such: ...
2
votes
2answers
502 views

Qiskit: Taking a QUBO matrix into `qubit_op'

I'm trying to solve the maximum independent set problem using Qiskit and the QAOA. I've a nice QUBO Matrix for this simple path graph: as so: My question is, how do I convert this into a general ...
2
votes
1answer
53 views

How to construct a Hamiltonian containing Pauli string by qiskit?

There is a Hamiltonian I want to construct by a Python package, which is the following: $$ H = 5.9I + 0.21Z_0 - 6.12 Z_1 - 2.14(X_0X_1 + Y_0Y_1) + 9.6(I-Z_2) - 3.9(X_1X_2 + Y_1Y_2) $$ It is very easy ...
2
votes
0answers
77 views

Calculating exact expectation values on ibmq_qasm_simulator

In order to calculate the exact expectation value of a Pauli operator in some state using local qasm_simulator, I do ...
2
votes
1answer
176 views

Newbie Project: Calculate a Mersenne Prime with Quantum Computing

I am new to the quantum world and wondering the bounds of which the technology is at the current state of the art: specifically in computing prime numbers. I would like to, if possible, create a ...
2
votes
2answers
186 views

What are the available compilers for Trapped-Ion Quantum Computing Architecture?

I am looking for a compiler to compile a high-level quantum circuit for the Trapped-Ion Quantum Computing architecture, i.e. a compiler that can translate a high-level circuit to native gates of the ...
2
votes
1answer
312 views

How to define custom controlled unitaries in OPENQASM 2.0?

According to the OPENQASM 2.0 documentation, it's possible to define custom unitary gates using the format: gate name(params) qargs { body } where the optional ...
2
votes
1answer
801 views

Module BasicAer not found

After installing qiskit-terra via git (pip install qiskit), all python programs involving the line ...
2
votes
1answer
920 views

qiskit - Is there any way to discard the results of a measurement?

I have a circuit composed by n qubits, plus a single one which is an ancilla. I'm making multiple measurements on the ancilla at different stages of the circuit, ...
2
votes
1answer
68 views

Qiskit IBMQ.load_account fails on version 0.20.0

So when trying to load my account I get this error: ...
2
votes
2answers
386 views

Qiskit error on get_backend()

Im trying to use IBM quantum machine instead of qiskit aer simulator with the following command: backend = IBMQ.get_backend('ibmq_16_melbourne', 'ibm-q') It's ...
2
votes
1answer
226 views

symbolic quantum computing using sympy : how to use arbitrary gate?

I'm trying to use sympy to compute symbolic results of quantum circuits using dirac notation. More specifically, I'd like to use the three rotation gates. I try to implement them in the following way,...
2
votes
1answer
865 views

Updating qiskit doesn't update qiskit version from Spyder

I installed qiskit using directions at https://qiskit.org/documentation/install.html I also have ...
2
votes
2answers
789 views

Maximum number of qubits suppoted by the Qasm simulator

By using the Qiskit qasm-simulator, I want to simulate a quantum circuit of 40 qubits. However, the number of qubits 40 is greater than maximum number (24) for qasm-simulator. Is there any possibility ...
2
votes
2answers
2k views

Cannot load account with Qiskit

I just got started with Qiskit. When I tried to save my account with the API token from IBMQ website, I got the error: ...
1
vote
1answer
65 views

Writing Toffoli Gate Matrix by one and two qubit gate matrices

I am trying to write Toffoli gate matrice by using one and two qubit gates matrices. I follow this circuit link for the circuit I first started to write the matrices of one and two qubit gates: ...
1
vote
1answer
140 views

How to get running time for each circuit executed on IBM's quantum processors in one round?

I want to execute multiple circuits in one round on IBM's backends, especially the 16-qubit one, to save time. For instance, ...
1
vote
3answers
519 views

Trying to get a provider from IBMQ but get 'No provider matches the criteria.'

I have created a circuit and then run the following: provider = IBMQ.get_provider('ibm-q') And this is what I get: ...
1
vote
0answers
89 views

Regarding quantum support vector machine using qiskit [duplicate]

I would like to ask, how can I add my own .csv data file to run a quantum support vector machine using qiskit ? I don't want to use already existing datasets in sklearn, scikit-learn library.
1
vote
2answers
66 views

Setting the $\texttt{state_preparation}$ for $\texttt{AmplificationProblem()}$ in the scope of Grover's algorithm

I am having trouble setting the state_preparation parameter of AmplificationProblem() from ...
1
vote
1answer
70 views

In the job tab, no histogram appears

(Newbie here) Accessing IBM Q Experience on a Windows 7 operating system and using the Google Chorme browser. I can completely assemble my circuit, using the IBM Quantum Composer and when executing it ...
1
vote
1answer
89 views

Composing teleportation circuit in Qiskit Circuit Composer

I'm trying to create the teleportation circuit in IBM Qiskit Circuit Composer. ...
1
vote
1answer
271 views

Qiskit get qubits from statevector

How do I get the amplitude of each qubit, like plot_bloch_multivector(), but not output the tensor product of all qubits. In this case I need output ...
1
vote
2answers
34 views

Why did "job_manager" submit the same job twice and how to fix it?

In order to avoid the problem posted in Why "job_manager" did not submit some of the jobs?, (the current issue is related but quite different, so I think it is more appropriate to ask ...
1
vote
1answer
203 views

How to split a Quantum Circuit on a barrier in Qiskit?

Let's say I have a QuantumCircuit with multiple barriers as shown in the visual below: How would I split up the ...
1
vote
1answer
110 views

Expectation value of an arbitrary observable. My own definition and `cirq` limitations

In my previous question I was struggling with the definition of expectation value of an observable for a circuit. Here is what I have derived after some support (I simplify the definition to 2-qubit ...
1
vote
2answers
189 views

How can the state $\lvert0\rangle+M^{-1/2}\sum_{j=1}^M\lvert j\rangle$ be generated?

I was wondering if anybody to help me to generate the following state. It would be preferable if you use only Hadamard, CNOT and T-gates, on $\lceil\log_2(M+1)\rceil$ qubits: $$|\psi\rangle = \frac{1}{...
0
votes
1answer
128 views

Qiskit HHL algorithm BrokenProcessPool error

I try to run HHL algorithm on qasm_simulator. I took the example from here. I try to solve 8x8 random matrix and adjust some parameters in create_eigs. ...
0
votes
2answers
659 views

'IBMQFactory' object has no attribute 'load_accounts'

I am following this qiskit workshop from https://colab.research.google.com/github/mtreinish/qiskit-workshop/blob/master/Workshop.ipynb . After adding my API key I had encountered the error ...
0
votes
1answer
33 views

Multiple Bipartite Entangled State in Cirq

I am trying to create this state: rho = = q . rho_{1,2} + r . rho_{2,3} + s . rho{1,3} + (1-q-r-s) . rho_separable And I wrote this code: ...
0
votes
1answer
154 views

Producing $|ghz\rangle\langle ghz|$ State in Cirq

I could manage to produce 3 qubit ghz state in Cirq. But I don't know how I can produce $|GHZ\rangle\langle GHZ|$ in Cirq Here is my code for 3 qubit ghz state Can you help me please for improving my ...
0
votes
1answer
56 views

Best way to compute $\langle a|B|a \rangle$ in Cirq, where a is a state obtained running circuit A. And B is a different Quantum Circuit

I am implementing RQAOA in Cirq. After running regular QAOA to find an optimal state a (This I have done successfully). I need to calculate $\langle a|Z_iZ_j|a\...
0
votes
3answers
161 views

Suppress Warnings

I wish to know how to suppress the following warning obtained on qiskit when I try to add two different types of noise to a qubit ...
0
votes
0answers
30 views

How to run Qiskit's transpile in parallel in Windows?

I want to execute qiskit transpile function in parallel. My experiment environment OS is Windows, and the Qiskit version is 0.29.1. I already asked one question here, and I also changed the file ...
0
votes
1answer
66 views

How to assemble two quantum circuits which has each own qubit mapping state?

I'm curious about something. I tried to do some qubit mapping using SABRE algorithm. Suppose I have two quantum circuits and apply SABRE algorithm to both of them. Then each of them has its own qubit ...
0
votes
2answers
370 views

Suppress deprecation warnings from Qiskit

I am running a standard VQE from the example shown in here https://qiskit.org/textbook/ch-applications/vqe-molecules.html, however I keep getting this output constantly (as many times the vqe runs ...
0
votes
1answer
511 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
votes
2answers
186 views

How do you pass input to a circuit? [closed]

I've implemented Grover's search algorithm in qiskit, and I'd like to pass in an input to run through the circuit. How is that done?

1 2
3