Questions tagged [qiskit]

Qiskit is an open source SDK for working with quantum computers at the level of pulses, circuits and application modules. If appropriate, also use the [programming] tag.

Filter by
Sorted by
Tagged with
0 votes
2 answers
18 views

Expectation value of pauli strings for VQE

I am studying VQE and have boiled it down to a matter of determining the expectation value of pauli strings: $$\langle H \rangle = \sum_i \alpha_i \langle\psi|\hat{P_i}|\psi\rangle.$$ I have been ...
user avatar
0 votes
0 answers
7 views

Generate a SHA256 hash based on random data using Qiskit

I'm learning cryptographic, and I was wondering how can we convert data into a hash using Qiskit quantum computer? For instance, this code below will generate a SHA256 hash based on random data. ...
user avatar
0 votes
0 answers
38 views

Hamiltonian & QubitMappingType cannot be imported from qiskit.chemistry.core

I'm trying to implement the same Jupyter notebook in The Variational Quantum Eigensolver — Programming on Quantum Computers — Coding with Qiskit S2E4;however,I found a problem: Error: ...
user avatar
  • 11
8 votes
2 answers
1k views

Why doesn't Shor's algorithm output a solution for some numbers?

I've been trying to mess around with Qiskit's implementation of Shor's algorithm, and while trying I've noticed that Shor(33), for example, would not output a solution (even with an absurd number of ...
user avatar
0 votes
1 answer
21 views

Validating existing QAOA, deprecated solutions on qiskit

I'm currently evaluating a static QC, QML and QAOA approach to solving a combinational problem. My solution with the static QC and QML approach is finished, and all data has been collected. Now, the ...
user avatar
  • 147
0 votes
0 answers
33 views

IBM Q jobs being cancelled without error or explanation?

While sometimes the jobs run without any problem, and in other cases there are errors that can tell how to troubleshoot, in this case it seems there is no explanation from IBM. Has anyone had similar ...
user avatar
  • 455
0 votes
1 answer
47 views

Qiskit gates out of order?

I'm running the following piece of code and get the following output. ...
user avatar
1 vote
1 answer
121 views

ket zero $|0\rangle = [1,\, 0]$, why a qubit which is initialized with zero is 1 in first basis state?

ket zero $|0\rangle = [1,\, 0]$ The $[1,\, 0]$ is telling us that the probability amplitude for being in the first basis state is $1$, and the probability amplitude for being in the second basis state ...
user avatar
0 votes
2 answers
43 views

understanding QuantumCircuit.x() function

For Code 1 qc.x(0,1) throws error but not for code 2 . Please help me to understand code 1 ...
user avatar
0 votes
1 answer
31 views

what is difference between the following two results

If this question sounds trivial please bear with me as I am beginner in QC. Code 1 ...
user avatar
2 votes
1 answer
31 views

Why do we need to reverse the order of qubits in Quantum Fourier Transform? [duplicate]

Looking at Qiskit's QFT tutorial, their implementation of QFT requires you to swap the qubits at the end (Nielsen and Chuang do this too). I'm wondering why this is the case. Can we flip the gates ...
user avatar
1 vote
0 answers
35 views

How to simulate $H(\theta) = B(\sin\theta S_1^x +\cos\theta S_1^z +\sin\theta S_2^x +\cos\theta S_2^z)+aS_2^zI_z$ on IBM Qiskit

I am trying to simulate this Hamiltonian on IBM Qiskit, for varying values of $\theta$: $H(\theta) = B(\sin\theta S_1^x +\cos\theta S_1^z +\sin\theta S_2^x +\cos\theta S_2^z)+aS_2^zI_z$ Where S is ...
user avatar
2 votes
1 answer
49 views

HHL for non power of 2 matrix

I'm trying to see how HHL does on a series of matrices coming from a linear problem I'm interested in. These matrices are always square, real, and symmteric. They are not, however, very often exactly ...
user avatar
0 votes
0 answers
43 views

Converting sigma model Hamiltonian into a quantum circuit

I would like to ask some specific questions about a paper I'm reading. In 1903.06577, authors are playing with the sigma model hamiltonian, and they are showing how they constructed the time evolution ...
user avatar
  • 101
2 votes
2 answers
88 views

Qiskit compute mean expectation value

I want to calculate the mean expectation value of an PauliSumOp within qiskit after I executed a QAOA Circuit. My approach is the following: ...
user avatar
0 votes
1 answer
26 views

split_dataset_to_data_and_labels in qiskit not working correctly

I am using source code of split_dataset_to_data_and_labels as I am unable to install qiskit-aqua because of error. But in that source code, "keys" is not being identified. I am using qiskit'...
user avatar
1 vote
1 answer
26 views

Unable to import split_dataset_to_data_and_labels and map_label_to_class_name in qiskit

I was using command-: from qiskit.aqua.utils import split_dataset_to_data_and_labels, map_label_to_class_name but it was giving error-: ...
user avatar
0 votes
0 answers
11 views

Idle time or reset, efficiency comparison on Qiskit

As usual in QEC there are ancillary qubits set to the ground state. In a QEC scheme, not necessarily such a qubit is used immediately. In Qiskit framework, i think, all the qubits are initialized to ...
user avatar
0 votes
0 answers
25 views

Quantum Kernel Machine Learning loss function and the plot of kernel?

When I was doing quantum machine learning, after building the quantum kernel, I drew the graph of the loss function changing with the iteration function and the graph of the quantum kernel, but I ...
user avatar
0 votes
1 answer
15 views

Qiskit library.gaussian() does not accept parametric expression

I'm trying to build a gaussian pulse in qiskit where I keep the amplitude as a parameter but for the followig code ...
user avatar
  • 1
1 vote
2 answers
50 views

Can one reset a qubit to the ground state on real IBM quantum processor?

As explained here, IBM provided the possibility to reset a qubit to the ground state within the Qiskit framework. However it is not clear whether this tool is available for any backend or it works ...
user avatar
1 vote
1 answer
18 views

Fail to add amplitude damping error to NoiseModel

I am reading a book named Learn Quantum Computing with Python and IBM Quantum Experience authored by Robert Loredo. When I tried to run the code on Chapter 11, I followed the instruction and wroted ...
user avatar
  • 11
-1 votes
1 answer
38 views

No module named 'qiskit.optimization' on Google Colab

I have qiskit installed in my colab runtime and can import qiskit, but I can not import anything from qiskit.optimization. Am I missing something? EDIT: It seems ...
user avatar
0 votes
1 answer
40 views

How to take Statevector for subsystem?

I want to calculate the 2nd Renyi entropy using the density matrix in Qiskit. To do this, I need to calculate the $Tr(\rho^2)$ for subsystem. The complete system consists of 12 qubits from which I ...
user avatar
1 vote
1 answer
28 views

From Hamiltonian to the Pulse Sequence

I know my Hamiltonian: I know which unitary I want to have. Suppose that I want to have this matrix from Hamiltonian: How can I find the pulse sequence to have this matrix from the Hamiltonian? What ...
user avatar
  • 406
3 votes
0 answers
53 views

How to implement a gate that generate a uniform superposition of all permutation of element

I'm looking for a quantum circuit that permits generating a uniform superposition of all possible permutations for example if we have as input $|0123\rangle$ the output will be the uniform ...
user avatar
4 votes
1 answer
46 views

Qiskit: QAOAnsatz circuit with custom Hamiltonian

I am trying to implement the Quantum Approximate Optimization Ansatz by creating a parametrized subcircuit $$V (α) = e^{−iH_M α_1} e^{−iH_D b_1} ... e^{−iH_M α_n} e^{−iH_D b_n}$$ with the custom ...
user avatar
  • 45
-1 votes
0 answers
24 views

understanding docplex output in portfolio optimization using Qiskit

Can someone please explain the below equation? what are we doing in Obj? Source: https://qiskit.org/documentation/finance/tutorials/01_portfolio_optimization.html ...
user avatar
0 votes
0 answers
23 views

Understanding the penalty term in portfolioOptimization using qiskit

The equality constraint 1ᵀ𝑥=𝐵 is mapped to a penalty term (1ᵀ𝑥−𝐵)² which is scaled by a parameter and subtracted from the objective function Source: https://qiskit.org/documentation/finance/...
user avatar
0 votes
2 answers
35 views

The statevector of three-qubit bit-flip encoding circuit for entangled state

I was trying to implement a three-qubit bit-flip code for shared entangled state. I was curious to analyze this mathematically, but the problem is I can't calculate the statevector after encoding. ...
user avatar
0 votes
1 answer
29 views

Generating a random 32-byte hex integer using Qiskit

Hello I posted here yesterday about generating random 16 digits using Qiskit, and a gentle guy helped me but how about a string? How can I generate random 256 bit key in hex format in a superposition ...
user avatar
1 vote
2 answers
57 views

How do I use the quantum searching algorithm to loop search through a datafile in qiskit?

I have a localhost index.html has a table contains names and address and balances etc... also there is a search bar on the home page to go through the pages, the interesting thing is, there is loooot ...
user avatar
2 votes
1 answer
38 views

Question about mock backends!

I recently learned about the mock backends or the fake backends provided by Qiskit and I was wondering, do they behave the same way IBMQ systems backends like (ibmq_brooklyn)? also, can I depend on ...
user avatar
3 votes
0 answers
31 views

Why does running a pulse schedule for Bell circuit give incorrect counts?

As part of another project I need to be able to run a custom pulse schedule for a bell ciruit and measure the counts. However I am having a problem where running the scheduled circuit is giving counts ...
user avatar
1 vote
1 answer
81 views

When using Qiskit's plot_bloch_vector function, how can I set colors for vectors?

I am able to visualize vectors on a bloch sphere using Qiskit as follows: ...
user avatar
0 votes
1 answer
45 views

Generating a random 16-digits in a superposition state using Qiskit

Im trying to create a script using Qiskit for a days but somehow i couldn't seem to get it done!! Im new to QuantumComputing, so pardon me if i don't explain something properly. I need to create a ...
user avatar
0 votes
0 answers
25 views

Find minimum eigenvalue of an Ising Hamiltonian combined with Error Mitigation

I am currently working on a variation of the Traveling Salesman Problem. For which I use the QUBO(Quadratic Unconstrained Binary Optimization). Within Qiskit there are potent functions to obtain the ...
user avatar
0 votes
0 answers
33 views

How can I get the counts, as well as the solution bitstring from Qiskit VQE?

I just set up a Qiskit VQE algorithm and calculated the eigenstates. However, I'm searching now, how to show up the final, most likely solution-bit-string. And/or to print the counts. I actually ...
user avatar
1 vote
1 answer
109 views

Long execution time to create controlled version of custom unitary gate in Qiskit

I am having troubles with the creation of controlled custom gates in Qiskit. I am using the qiskit.extensions.UnitaryGate object but the execution time to create ...
user avatar
1 vote
1 answer
70 views

Why Qiskit doesn't invert hard coded unitary matrix?

I was expecting Qiskit to do a upside down version of my unitary as it does for other unitary matrices of CNOT and Toffoli gates given in textbooks : if you convert a toffoli matrix from quantum ...
user avatar
0 votes
1 answer
57 views

Trouble re-creating quantum psuedo-telepathy

I am trying to replicate the results from this webpage here utilizing qiskit: http://twistedoakstudios.com/blog/Post6536_implementing-quantum-pseudo-telepathy Since the splitter gate mentioned in the ...
user avatar
  • 1
1 vote
2 answers
63 views

Creating a Qiskit circuit based on output states

I am trying to create a Qiskit circuit that: starting in state |00⟩ generates a 1/2 * (|00⟩ - |01⟩ - |10⟩ + |11⟩) state starting in state |10⟩ generates a 1/2 * (|00⟩ + |01⟩ - |10⟩ -|11⟩) state ...
user avatar
  • 197
2 votes
1 answer
91 views

Creating a Qiskit Circuit sending $|00\rangle$ to $|1,-\rangle$ and $|11\rangle$ to $|0,-\rangle$

I am trying to create a circuit in Qiskit that performs the following transformations: starting in state |00⟩ generates a √(2)/2 * (-|10⟩+|11⟩) state starting in state |11⟩ generates a √(2)/2 * (|00⟩-|...
user avatar
  • 197
2 votes
0 answers
46 views

Creating maximally-entangled state in quantum circuits using Qiskit

I am trying to create a function in Qiskit that, given an integer n, returns a circuit of that size in which all qubits at the output are entangled together in a maximally-entangled state. Some ...
user avatar
  • 197
0 votes
1 answer
51 views

How to do rotations along arbitrary multi-qubit basis

I was trying to implement Trotterization for a $k$-local Hamiltonian simulation using qiskit. For this, say I want to apply $e^{\lambda \sigma^1_z \otimes \sigma^2_z \otimes \sigma^3_z}$ (this being ...
user avatar
0 votes
1 answer
55 views

How to get the matrix of a quantum circuit when the ancilla qubit is set to a specific state?

I would like to get the matrix form of a quantum circuit, representing the operation on normal qubits, after specifying the ancilla qubit at a given state. Is there any way to realize this using ...
user avatar
1 vote
1 answer
46 views

Theta value passed as input to quantum phase estimation: qiskit textbook

I'm trying to understand the Quantum Phase Estimation in the qiskit textbook https://qiskit.org/textbook/ch-algorithms/quantum-phase-estimation.html. I know QPE is used to estimate the $\theta$ given ...
user avatar
1 vote
2 answers
62 views

Qiskit: Count of each gates

I wanted to calculate the count of each gate used in the specific quantum circuit. For example in the below circuit, the result should be something like: ...
user avatar
0 votes
1 answer
38 views

Qiskit histogram to Seaborn

I am running certain circuits in the Aer simulators and I need to present them nicely. I prefer to use the options provided by Seaborn. How can I transfer my Aer data, e.g. histograms, to Seaborn? For ...
user avatar
  • 409
1 vote
0 answers
46 views

VQE Execution error: The ansatz must be parameterized, but has 0 free parameters

I am experiencing some problems with qiskit implementation of VQE. First of all, in initialize an ansatz in one of the following ways: ...
user avatar
  • 65

1
2 3 4 5
29