Skip to main content
Share Your Experience: Take the 2024 Developer Survey
7 votes
Accepted

How to get resultant statevector after applying parameterized gates in qiskit?

Is there a way I can get the resultant statevector in temrs of my parameter $\theta$s? I don't think Qiskit itself has this functionality. May be this is because symbolic expressions become nasty ...
Egretta.Thula's user avatar
5 votes

Why isn't $Ry(\pi/2)$ gate equivalent to Hadamard gate?

The algebraic comparison of the operations is, of course, correct. Additionaly, noting that $H$ is Hermitian, we see that $R_y\left(\frac{\pi}{2}\right)$ is not Hermitian, and must be transformed. A ...
inq's user avatar
  • 111
5 votes
Accepted

Qiskit reverse_bits is not equivalent to swapping qubits

The issue is that the qubit values are being mixed together throughout the circuit, so swapping at the end is not enough. However, if you also swap at the beginning of the circuit, the qubit values ...
Nick Mertes's user avatar
5 votes
Accepted

TranspilerError: 'Number of qubits (40) in QAOA is greater than maximum (30) in the coupling_map'

The error is because the number of qubits in the hardware you are selecting, is less than what your QAOA circuit has (in this case 40). All you have to do is change the backend importing code, and ...
Yet another Random Guy's user avatar
5 votes
Accepted

What does Qiskit AerSimulator(memory=True) do?

The parameter memory is used to record and return the measurement outcomes for each shot of the simulation. When you set ...
MonteNero's user avatar
  • 2,646
5 votes

Are Quantum Computers Bad at Addition?

Yes, current quantum computers are bad at addition. A 5-bit adder requires several dozen two-qubit gates. Current state of the art two-qubit gate error rates are between 0.1% and 1%. At the time I am ...
Craig Gidney's user avatar
  • 37.7k
5 votes
Accepted

Quantum circuit not showing when using qiskit with pycharm

By default, qiskit draws the quantum circuit for inline visualization (because inline figures are typlically used with jupyter lab). To fix this issue, you need to ...
Shravan Patel's user avatar
4 votes

Is there an "in place" Toffoli gate?

This isn't possible, since the associated operation wouldn't be unitary if the scalar is $0$, as it would map both $|0\rangle$ and $|1\rangle$ to $|0\rangle$. The operation wouldn't be reversible and ...
Tristan Nemoz's user avatar
  • 6,462
4 votes

Qiskit Runtime forbids reset gate?

Indeed, the problem is that initialize introduces a reset (see docs). ...
luciano's user avatar
  • 5,793
4 votes
Accepted

Quantum Circuit evaluation Qiskit vs. AWS Braket SDK

The reason for the difference is that Qiskit and Braket use different endianness for their qubits; Qiskit is little endian: $$ | q_{n - 1} \ldots q_2 q_1 q_0 \rangle $$ while Braket is big-endian: $$ |...
Cody Wang's user avatar
  • 1,213
4 votes
Accepted

Why do the same circult yields very different results from different IBM backends?

The problem is caused by a different type of noise each QPU suffers from. Nowadays, it is even not easy to produce two completely same qubits, not to mention two identical QPUs. Please, have a look at ...
Martin Vesely's user avatar
4 votes

Where to find the Grover's algorithm for Qiskit 1.0.2?

Grover's algorithm is now part of a separate package qiskit-algorithms that must be installed separately. The documentation for the latest version is here, and here are some examples.
Egretta.Thula's user avatar
4 votes

Can save_statevector() be used on a real quantum computer?

Alternatively, is it the case that this function cannot be utilized on a real quantum computer? Exactly! When you perform a computation on a simulator, it has to keep track of the statevector all ...
Tristan Nemoz's user avatar
  • 6,462
4 votes
Accepted

Should I Stick to an Older Version of Qiskit Due to Tutorial Compatibility Issues?

You should learn the newer qiskit>=1.0.0 version because this newer version is released with emphasis on: High-performance code base: ...
Shravan Patel's user avatar
4 votes
Accepted

weird negative sign in a state vector in qiskit

We start with the state, $$\sqrt{1/3}|001\rangle + \sqrt{2/3}|111\rangle$$ Then apply $R_y(\pi/2)$ to the first qubit controlled by the second qubit. By linearity, we can calculate the impact of ...
Egretta.Thula's user avatar
3 votes

Mysterious behavior from QisKit's Aer Simulator MPS - how to fix it?

The MPS simulator has a parameter 'mps_log_data' that when set to 'True' stores the bond dimensions, after every operation, into the result.metadata. The bond dimensions represent the entanglement ...
merav-aharoni's user avatar
3 votes

How does the Qiskit AerSimulator performance scale with the circuit depth?

From my point of view, in the worst case, the computational cost scales linearly with the depth of the circuit. The math behind quantum computer simulation is linear algebra and matrix manipulations ...
Saul_better's user avatar
3 votes
Accepted

Problem with Qiskit statevector simulator

This is related to the transpiling of the circuit when it goes through the backend. Since global phase is non-physical, statevectors and unitary operators that differ only by a multiple of a scalar on ...
Joseph Geipel's user avatar
3 votes
Accepted

Is there a way I can create an ansatz such that the number of 1 is same in all the superposition states?

Yes, there is, and you are correct that it can be very useful for Ansatz construction - the algorithm name you are looking for is Dicke state preparation. Dicke states are a uniform superposition of ...
Elijah Pelofske's user avatar
3 votes

Convert qiskit circuit to numpy function with possibly free parameters

This is currently not possible by using Qiskit directly but I developed the qiskit-symb package (as part of the official Qiskit Ecosystem) on top of ...
SimoneGasperini's user avatar
3 votes
Accepted

How to avoid measurement in Quantum Computing?

My advice is to explicitly implement a weak measurement protocol. This means preparing an ancillary state, enacting a weak interaction beween the ancilla and your system that you want to measure, then ...
Quantum Mechanic's user avatar
3 votes

Visualizing Y-gate operation to achieve quantum state

In Qiskit, you can easily get the matrix of any quantum circuit as follows: ...
Egretta.Thula's user avatar
3 votes
Accepted

Are equiprobable state same as superposition state

Superposition states of a qubit are usually of form $$| \psi \rangle = a |0\rangle + b |1\rangle $$ where probabilities of getting state $|0\rangle$ and$ |1\rangle$ after a $Z$-measurement are $$p(0) =...
FDGod's user avatar
  • 2,401
3 votes

Obtaining the unitary matrix of a gate in analytic form in qiskit

I think your best option here is to use array_to_latex from qiskit.visualization module: ...
Egretta.Thula's user avatar
3 votes
Accepted

Is it possible to get step-by-step information about qiskit transpilation?

The standard way to debug transpile is via the callback option. From the documentation: A callback function that will be called ...
luciano's user avatar
  • 5,793
3 votes

How to simulate a $CNOT$ only using a single qubit?

Quantum operations have to be reversible and the operation you described is not reversible. Both 0 and 1 map to 0, so it is a many-to-one function and thus if you are just given 0 you have no ...
amihart's user avatar
  • 41
3 votes
Accepted

How are quasiprobabilities calculated when sampling from a nonsimulated ibm backend

This is indeed due to error mitigation and occurs by default when using the Sampler backend as opposed to the Estimator backend (regardless that both are run on real devices). If you read the page on ...
Quantum Mechanic's user avatar
3 votes
Accepted

How to measure in $\sigma_x$ basis in Qiskit?

It's a bit long for a comment but my goal is to explain that the answer linked as duplicate does indeed answer your question. The measure operation of qiskit ...
Tristan Nemoz's user avatar
  • 6,462
3 votes
Accepted

How is a linear combination of pauli operators applied to a quantum circuit in qiskit?

The operation $\frac{1}{\sqrt{2}}[X - Z]$ is unitary. You can easily check that: ...
Egretta.Thula's user avatar
3 votes
Accepted

Is there a way to perform Zero Noise Extrapolation with qiskit without using the runtime service?

qiskit.primitives Estimator is a reference statevector based implementation. It has no noise (other than it can simulate variance for shot/sampling noise) so it has no such capability. There is an ...
Steve Wood's user avatar
  • 1,488

Only top scored, non community-wiki answers of a minimum length are eligible