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
53 views

Reducing circuit initialization complexity

I'm encoding data into a QuantumCircuit via the Initialize method for QFTs. In doing this and transpiling for IonQ backends, I'm getting rather complex circuits. Is there a way to encode this data ...
user avatar
1 vote
0 answers
16 views

What actually StatePreparation perform in qiskit?

I used this method to initialize classical data in a circuit. I would like to know what's under the hood and the complexity of this procedure, but I can't find anything on the internet which suits my ...
user avatar
0 votes
1 answer
32 views

Computational cost of a circuit in Qiskit

I would like to see, in terms of complexity, the cost of a circuit. For example: I have written two algorithm that does the same thing, but in one of them I initialize data differently, so I would ...
user avatar
1 vote
1 answer
29 views

QiskitError: 'Sum of amplitudes-squared does not equal one.'

I'm coding a 429 element length string to compare to other same length strings, but I keep getting that error. I used ljust to fill the string to a 512 element ...
user avatar
  • 13
2 votes
1 answer
33 views

What's the paper referenced by qiskit.compiler.transpile? My tranpile solution is wrong from the perspective of fidelity

Here I want to transpile a standard 3 qubit Quantum Fourier Transform circuit into a implementable circuit. The implementable 3 qubit circuit (qubit0, qubit1, qubit2) should have no SWAP gate and ...
user avatar
1 vote
1 answer
32 views

Qiskit - MultiCX gate mcxgate

I am looking for some help to understand what I am doing wrong. I am new to QC and I am trying to create circuit that would be in below state - $$\frac{1}{\sqrt{8}}(|000,0\rangle + |001,0\rangle + |...
user avatar
  • 125
1 vote
1 answer
17 views

Qiskit: how to ensure binded parameters in circuit?

I'm not sure how to properly bind parameters in the circuit. I don't know why I got the following traceback even though I used .bind_parameters() in my earlier code here: ...
user avatar
1 vote
0 answers
23 views

How to implement Qiskit QAOA code on a real quantum computer?

I'm trying to run the QAOA code from Qiskit (https://qiskit.org/textbook/ch-applications/qaoa.html) on a real quantum computer. However, it doesn't work. Here starts my code: ...
user avatar
  • 11
1 vote
0 answers
21 views

How do you add spin up and spin down fermions to a FermiHubbardModel class in Qiskit?

I've been programming a FermiHubbardModel class with the Qiskit library for a VQE, but the class only shows input options for the U (onsite) and t (hopping) parameters when I construct a LineLattice. ...
user avatar
  • 11
1 vote
1 answer
34 views

Qiskit implementation for projecting a hermitian operator and finding its eigenvalues

I'm brand new to quantum computing and have been learning Qiskit for a few weeks now. I am attempting to find the number of 0 eigenvalues of the following operator: $$ T = PHP$$ where $P$ is a ...
user avatar
0 votes
0 answers
58 views

Jupyter Notebook not rendering latex code

Working through the Qiskit text and came across this bit of coding on the density matrix page: psi_AB.draw('latex', prefix='|\\psi_{AB}\\rangle = ') which is ...
user avatar
  • 13
1 vote
1 answer
43 views

Qiskit UGate - which angles corresponds to which axes

Qiksit documentation for QuantumCircuit.u(theta, phi, lam, qubit) does not mentions the axis against given angle argument for rotation operation. It just says ...
user avatar
1 vote
1 answer
31 views

Qiskit - MissingOptionalLibraryError pdflatex library is required to use LaTeX circuit drawing

Trying to run below snippet to generate circuit diagram in a Jupyter notebook on Windows. ...
user avatar
1 vote
1 answer
20 views

Qiskit - CircuitError Index 1 out of range for size 1

Below Qiskit snippet throws error - CircuitError: 'Index 1 out of range for size 1.. What's wrong? ...
user avatar
4 votes
1 answer
46 views

CCCRY gate creation

I'm aware there's a few questions about CCCRY gate composition on here but I still have a few questions. I'm following Frank Zickert's book on qiskit and he has defined a CCRY gate as ...
user avatar
0 votes
0 answers
40 views

Cannot compute gradient operator

I am trying to make a VQC with amplitude encoding(2000~ feature ) so i cant use the usual ZZfeature map ..instead i am using RawFeatureVector but when i use it to construct the VQC object it shows ...
user avatar
1 vote
1 answer
46 views

Qiskit textbook: Shor's algorithm

The Qiskit textbook shows the following circuit for implementing the phase $(\frac{s}{r})$ estimation stage of Shor's algorithm for factorizing 15: My understanding is that the register of qubits 8-...
user avatar
1 vote
1 answer
40 views

Qiskit textbook: mod 15 multiplication circuit

The Qiskit textbook shows a circuit for mod 15 multiplication by "a", which for a==2 does the following operations: U.swap(0,1) U.swap(1,2) U.swap(2,3) ...
user avatar
0 votes
0 answers
17 views

Decoy states use in Qiskit [closed]

While implementing quantum key distribution (QKD) from arXiv:quant-ph/0411004, I have tried to create a decoy states for 3 qubits. However, I was not able to create such decoy states from a string?
user avatar
3 votes
1 answer
33 views

Qiskit Runtime: What are the units of job.result().time_taken? Seconds, milli-seconds, micro-seconds?

job = execute(qwalk_circuit, backend='ibmq_16_melbourne', shots=1000) results = job.result() time = job.result().time_taken What are the units of time? And where ...
user avatar
0 votes
1 answer
21 views

Which protocol does the Qiskit textbook use for Quantum Key Distribution?

I've worked through a couple different protocols for quantum key distribution, but when I look at the Qiskit textbook on this page I am unable to determine which one was used in this lesson. If anyone ...
user avatar
  • 13
2 votes
0 answers
43 views

Simulating density matrices in quantum simulators

I would like to load random quantum states sampled from a given density matrix based on its classical probabilities ie based on the definition of the given density matrix: $\rho = \sum_i p_i |\psi _i \...
user avatar
0 votes
0 answers
25 views

is there any difference bwtween PCA in qiskit.aqua and PCA in sklearn?

Is there any difference bwtween PCA in qiskit.aqua and PCA in sklearn? I am working on a data set and did some dimensional reduction on it (using sklearn) to be able to use it in qiskit (near term ...
user avatar
3 votes
1 answer
44 views

Ansatz printing in Qiskit draws a single block

When I try to draw the quantum circuit it is shown in only one block and not the whole circuit. For example using the code: ...
user avatar
  • 33
3 votes
1 answer
67 views

What makes oracle algorithms difficult to design and implement?

Recently, I have paid attention to some oracle algorithms, such as Grover. Generally speaking, an oracle is a kind of black box, and Grover's algorithm constructs an oracle through quantum circuits. ...
user avatar
  • 362
1 vote
1 answer
42 views

How to construct a multi-control quantum gate whose control bit relation is XOR?

So far, the control bits of most control gates have an AND relationship. How to construct a quantum gate whose control bits are XOR with the fewest auxiliary qubits? And then generalize it, is it ...
user avatar
  • 362
0 votes
0 answers
11 views

How to run PegasosQSVC on IBMQ backend

I'm trying to run a PegasosQSVC on one of the IBMQ Quantum computers though the code just throws errors once we reach the training phase ie: PegasosQSVC().fit ...
user avatar
1 vote
0 answers
26 views

How to check if a statevector is made of product of EPR pairs in Qiskit?

I have a statevector of 10 qubits. I want to check if the qubits 0,1 and 2,3 are EPR pairs/Bell pairs. The other qubits (4,5,6,7,8,9) have been measured. There are four possible 2-qubit states that ...
user avatar
2 votes
1 answer
27 views

TranspilerError: 'The input circuit None is not scheduled'

The following error occurs when executing the code to measure the dephasing time(T2). I would appreciate it if someone could give me a solution to this problem. Among the two functions below, ...
user avatar
1 vote
1 answer
24 views

different results between aer_simulator and aer_simulator_statevector using Qiskit opflow circuit sampler

I am using Qiskit's operator flow framework to calculate expectation values of observables. An example composed operator I want to evaluate typically looks like I want to run this circuit on hardware,...
user avatar
  • 41
0 votes
1 answer
30 views

Exponentiating a multi-controlled NOT gate for trotterization

I am trying to exponentiate a multi-controlled NOT gate (MCX) via .exp_i() function for trotterization in Qiskit , but I cannot find such a gate represented in opflow. Is there a convenient way around ...
user avatar
3 votes
1 answer
47 views

How are the experiments ordered in a Qiskit Job?

Using the execute function, assuming the parameter experiments is a list[QuantumCircuit], would each circuit execute on the ...
user avatar
1 vote
0 answers
15 views

Copying a reduced noise model from an IBM device

I need to use the noise model coming from a large IBM device. Nonetheless, I do not need to use the whole Noise Model. I only need the information of let's say qubits [10:15] and [20:25]. That would ...
user avatar
0 votes
0 answers
22 views

Grover Adaptive Search in Qiskit - why ancilla qubit is not used?

I am trying to solve some QUBO tasks with Grover Adaptive Search ("GAS"). For testing purposes, I use a simple task with quadratic part $$ A = \begin{pmatrix}0 & -0.5 \\ -0.5 & 0\end{...
user avatar
0 votes
0 answers
36 views

Finding the Exact Probability Distribution for the Outcomes of a Quantum Circuit with Mid-Circuit Measurements

I would like to find the exact probabilities of the possible outcomes of a circuit that includes mid-circuit measurements. So, as a specific example, consider the following circuit: I would like to ...
user avatar
2 votes
1 answer
60 views

How to calculate the average fidelity of Pauli error channel

This question is related to this and this. I am working on Qiskit to design QEC schemes. My model works with Pauli errors. I would like to give to my Pauli error channel probabilities $p_x,p_y,p_z$ ...
user avatar
1 vote
0 answers
30 views

Grover Diffuser for states with amplitude value 0?

Is ist possible to do the grover amplification while excluding states with amplitude values of zero? I was testing this with the classic grover and two diffrent superpositions. In the first I used the ...
user avatar
1 vote
1 answer
46 views

Using machine learning to determine a good initial mapping for a quantum circuit

I am trying to use a machine learning model to find a good initial mapping for a quantum circuit. I am trying to minimise the number of swap operations i.e. the number of CNOT gates. This is my ...
user avatar
1 vote
1 answer
25 views

Append a controlled Initialize in Qiskit

I would like to create a controlled initialize, I have the following code: ...
user avatar
3 votes
1 answer
38 views

Qiskit: Is there an efficient way to convert custom operator (matrix) to circuits/gates and vice versa?

I'm using qiskit and would like to convert easily between matrix operators and their corresponding circuits. I have 2 types of operators: Permutation matrices (binary entries only) which must be ...
user avatar
  • 137
0 votes
0 answers
23 views

How to write QSVR_Loss function in Python?

I encountered a problem when I was doing quantum support vector machine experiments: when I was doing quantum kernel alignment, I saw that the example given by qiskit was SVC_Loss: https://qiskit.org/...
user avatar
1 vote
1 answer
27 views

Rigetti "Timeout on client tcp://127.0.0.1:5555, method name quil_to_native_quil" error

I am trying to run a relatively large quantum circuit on Rigetti's Aspen-11. I have a reservation for later today, but I am getting an error when running the code. I know that if you use: ...
user avatar
  • 79
0 votes
1 answer
30 views

Generating random circuits with only CNOT gates using qiskit.circuit.random.random_circuit

I am trying to generate a random quantum circuit with 5 qubits using only CNOT gates. I have modified the source code of the qiskit.circuit.random.random_circuit function to only include CNOT gates (...
user avatar
1 vote
1 answer
44 views

Qiskit: Understanding statevector output

I am looking for some help in understanding the state vector output. I am studying myself and found some exercise online. Below question is from one of those exercises - Given two qubits. Both of them ...
user avatar
  • 125
0 votes
1 answer
35 views

Qiskit: evaluating expectation value of S^2 operator

I am trying to obtain the expectation value of the S^2 operator with respect to VQE wave function in an older version of qiskit (0.26). To that end, I tried: ...
user avatar
1 vote
2 answers
91 views

How to initialize a $n$ qubit system in this specific state

Basically, I have $2n$ qubits and I want to initialize them in the state $\frac{|\psi\rangle}{\lVert |\psi\rangle \rVert}$ where $$|\psi \rangle = \sum_{\mathrm{w}\in \{0,1\}^n}|\mathrm{w}\mathrm{w}\...
user avatar
1 vote
1 answer
45 views

Using Qiskit's AerSimulator with an AMD GPU

I have an AMD 6700S that I want to use for Qiskit simulations. The test case below is calculating the QFT. If I set my code up like this: ...
user avatar
1 vote
2 answers
69 views

Are there multiple control quantum gates where the control bit is an OR relationship?

In general, the control bits of a multi-control bit quantum gate are in an AND relationship. Is there a quantum gate that makes the control bits an OR relationship?
user avatar
  • 362
3 votes
1 answer
88 views

Efficiently compute $\langle 0^{\otimes n} | e^{iA} H e^{-iB} |0^{\otimes n} \rangle$ in Qiskit

From this SE question and this Qiskit tutorial, I understand how to compute the expectation such in the form of $\langle \psi|H|\psi\rangle$ or $\langle 0^{\otimes n} |e^{iA} H e^{-iA}|0^{\otimes n} \...
user avatar
-1 votes
0 answers
43 views

Code to sample from a quantum circuit in Python or Qiskit

I am trying to implement the following task using Python and Qiskit, but I am not sure of the code that I need to write. The task is as follows. Input to the code: $n$ qubits. Here is an illustration ...
user avatar

1
2 3 4 5
32