Hot answers tagged

4 votes
Accepted

Is there a name for a gate that 'moves' one qubit to a new position via multiple SWAP gates?

Note that the first SWAP places qubit $i+1$ at position $i$. The second one places qubit $i+2$ at position $i+1$. Eventually, the qubit number $k$ will be at place $k-1$ for $k>i$, while qubit $i$ ...
user avatar
4 votes
Accepted

How to implement subplots (several blochsphere plots) using qiskit?

Function plot_bloch_vector accepts matplotlib.axes.Axes to use for rendering the bloch sphere. So, you can create a ...
user avatar
4 votes

training parametric circuits in Qiskit

It focuses on selecting the gradients because this code is from the Qiskit Global Summer School on Machine Learning from 2021, from a lecture on how to train quantum circuits! If you follow the full ...
user avatar
  • 2,253
3 votes

QuantumCircuit with list of qbits as an argument

If I am understanding the question correctly, this would be one approach: ...
user avatar
  • 1,833
3 votes

How to get precise angle values in Qiskit while using initialize() function to generate arbitrary quantum state?

This is probably not the only way to do it, but you can always look at the QASM file. You can do it with qc.qasm(formatted=True), which will show you the underlying ...
user avatar
3 votes
Accepted

How to actually send Qiskit code to the que to be ran on an IBM Quantum Computer?

1. Load your account and select provider The Qiskit IBMQ account object is the local reference for accessing your IBM Quantum account, and all of the providers, ...
user avatar
  • 1,833
3 votes
Accepted

A fundamental question on multiple rotation of a qubit using $SU(2)$

There is more than one issue in your code. You switched ϕ and θ in the function that convert polar coordinates to cartesian ...
user avatar
3 votes
Accepted

Noise model correspondence to qiskit implementation for $CNOT$ gate

Reading the documentation for depolarizing_error, they are not the same. Under two-qubit depolarizing noise the $X \otimes X$ error case is as likely as the $X \...
user avatar
  • 22.5k
3 votes

How to estimate Qiskit circuit runtime before sending to run on IBM real quantum device?

You can try to use Qiskit pulse, see: https://qiskit.org/textbook/ch-quantum-hardware/calibrating-qubits-pulse.html#4.2-Measuring-$T_2$-using-Hahn-Echoes- Based on https://quantumcomputing....
user avatar
  • 507
2 votes
Accepted

QV circuits fail to execute in real devices

As per Qiskit's release notes, under "IBM Q Provider 0.12.0"[1] qiskit.providers.ibmq.IBMQBackend.run() method now takes one or more ...
user avatar
2 votes

QV circuits fail to execute in real devices

By doing some error tracking, you'll find that TypeError: 'QasmQobj' object is not iterable` was raised from ...
user avatar
  • 1,833
2 votes

Train a quantum circuit whose parameters are not the input (Qiskit/PyTorch)

Writing a circuit where the trainable parameters are not directly related to the input is doable. You could set an initial parameters (angles in the most cases) by yourself instead of encoding the ...
user avatar
  • 23
2 votes

For the same operator, when I use qiskit's VQE and QAOA solutions, the results are completely different

I recommend use the new released version, but you can still plot out iteration with graph and compare them, see what happen. choose of optimizer, depth, max iteration will effect the result. reference:...
user avatar
  • 507
2 votes

What’s the difference between the DriveChannel and the Control Channel?

Each instruction type has its own set of operands. As you can see above, they each include at least one Channel to specify where the instruction will be applied. Channels are labels for signal lines ...
user avatar
  • 507
2 votes

How can I write if conditions on quantum registers using qiskit

If "some operations" in your question means quantum operations, then you can use Gate.c_if() to apply a gate based on a value in a classical register as ...
user avatar
2 votes
Accepted

Why does Parity mapping allow 2 qubit reduction?

There is a relatively intuitive way to understand 2-qubit reduction using the parity mapping. It uses that the number of $\alpha$ (spin up) and $\beta$ (spin down) electrons are conserved (because the ...
user avatar
  • 374
2 votes
Accepted

How to implement Projector Control-Not in Qiskit?

From PhD thesis of András Gilyén, Quantum Singular Value Transformation & Its Algorithmic Applications[1], page 19 Projector-controlled NOT gate. For an orthogonal projector $\Pi$ we will ...
user avatar
2 votes
Accepted

Calculating the probability of a result after measurement using Ry, Rz, and Rx matrices

$Ry$ gate is described by following matrix $$ Ry(\theta) = \begin{pmatrix} \cos(\theta/2) & -\sin(\theta/2) \\ \sin(\theta/2) & \cos(\theta/2) \end{pmatrix}. $$ If your qubit was in state $...
user avatar
2 votes
Accepted

Qiskit custom multi controlled gate

I think you are looking about this: ...
user avatar
  • 507
2 votes
Accepted

how to get the backend_status using qiskit?

We use Job_monitor to get the status of a job (IBMQJob instance) To get the status of an IBMQ backend, we use ...
user avatar
1 vote

Why does qiskit's density matrix output obscure the text, can it make this picture better?

recommend using plot_state_hinton instead of plot_state_city, for better view of it. I guess it is a bug or something that makes ...
user avatar
  • 507
1 vote
Accepted

Implementing deutsch_problem(seed=None) and deutsch() from qiskit text

This is how I do it, I tried to append gate directly with to_gate, remember to transpile or decompose the label gate before run simulator. if you want to get unitary of the gate, you can use Operator ...
user avatar
  • 507
1 vote

How to get precise angle values in Qiskit while using initialize() function to generate arbitrary quantum state?

Qiskit stores Instruction parameters in params attribute. So, you can access these values as follows: ...
user avatar
1 vote

How to get precise angle values in Qiskit while using initialize() function to generate arbitrary quantum state?

you can extract it directly like this, I recommend using transpile to decompose all to ry gate instead, where draw() will show decimal place without round it to 3 ...
user avatar
  • 507
1 vote
Accepted

How to select parts of qubits for visualization

You can do that with snapshot_density_matrix Example: ...
user avatar
  • 507
1 vote
Accepted

How can I plot a complex alpha in qiskit?

I suggest you can learn to look at Qiskit documentation, and figuring out how to solve the exercises by yourself. https://qiskit.org/documentation/apidoc/visualization.html This is the way how I do ...
user avatar
  • 507
1 vote

Quantum SVM with large feature set

Maybe this article can help you: 'Automatic design of quantum feature maps', Sergio Altares-López, Angela Ribeiro and Juan José García-Ripoll, 19 August 2021 - https://doi.org/10.1088/2058-9565/ac1ab1....
user avatar
1 vote

Why does Parity mapping allow 2 qubit reduction?

The Parity mapper 2-qubit reduction uses the Z2Symmetry logic in Qiskit. For any qubit ...
user avatar
1 vote

How to initialise own values instead of using Tsp.create_random_instance

The method Tsp.create_random_instance() creates a random instance of the TSP problem. Internally, it uses NetworkX's function ...
user avatar
1 vote
Accepted

Hadamard on first qubit for two qubit state doesn't output what it should on Qiskit

This is because Qiskit uses little-endian[1] for bit ordering. So, $|01\rangle$ means that first qubit in the state $|1\rangle$ and second qubit in the state $|0\rangle$. For more details see the ...
user avatar

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