# Tag Info

Accepted

### What is a "barrier" in Qiskit circuits?

You won't find the barrier in quantum computing textbooks because it isn't a standard primitive of quantum information theory like unitary gates and quantum circuits. The barrier acts as a directive ...
• 1,221

### How do I build a gate from a matrix on Qiskit?

You can build your gate with Operator and unitary function e.g: ...
• 481

### How can I implement an n-bit Toffoli gate?

A simple way to do this is illustrated in Figure 4.10 of Nielsen & Chuang. Where U can be any single-qubit rotation (in this case, an X gate). This circuit works like this: We want to apply U ...
• 1,632
Accepted

### What's meant by the depth of a quantum circuit?

The depth of a circuit is the longest path in the circuit. The path length is always an integer number, representing the number of gates it has to execute in that path. For example, the following ...
• 13.9k

### How can I obtain transformation matrix of a quantum circuit in the Qiskit?

While you can get the unitary matrix representation of a circuit using the unitary simulator as shown in the other answers, there is a much easier way using the ...
• 1,221
Accepted

### Phase-Shift Gate in Qiskit

You can implement the phase shift gate $$P_h(\theta) = \begin{pmatrix}e^{i\theta} & 0\\0 & e^{i\theta}\end{pmatrix}$$ with the X and ...
• 4,987
Accepted

### Evaluating expectation values of operators in Qiskit

Note: This post is a bit older and Qiskit Aqua is now deprecated. Replace all occurences of qiskit.aqua.operators with ...
• 2,953
Accepted

### How to measure in another basis

Yes, your solution is correct. Please find here circuits for measurement in z (computational), y (circular) and x (Hadamard) bases: Source: Quantum Algorithm Implementations for Beginners, pg. 68. ...
• 14.6k
Accepted

### Is Qiskit more popular than cirq? Why?

The answer above, from a Cirq developer, is mostly in the right direction. We (Qiskit / IBM) probably do spend more on outreach and education (I also do not know for sure). Democratization of ...
• 2,239
Accepted

### Big Endian vs. Little Endian in Qiskit

Qiskit uses little-endian for both classical bit ordering and qubit ordering. For classical bits: A 3-bit classical register creg with value ...
• 1,221
Accepted

### How good is basic_device_noise_model() simulating the noise in the quantum computer?

There is no specific paper for this, though information on the model can be found in the Qiskit Aer API documentation and is based on the research of IBMQ quantum computing group. As examples you can ...
• 1,221

### Is Qiskit more popular than cirq? Why?

Completely speculating here, but I think the main differentiator is that IBM has a stated goal of, and spends significant resources on, getting quantum computing into everyone's hands. For example, ...
• 38.5k
Accepted

• 2,953
Accepted

### What does the error rate on the IBMQ website mean？

Readout error: do a bunch (1000's) of experiments preparing the qubit in either the 0 state or the 1 state and then immediately measuring the qubit state after each preparation. Two types of readout ...
• 381

### Transpilation into custom gate set in qiskit

The Qiskit standard gate list You can find the full list of Qiskit standard gates in the module qiskit.circuit.library.standard_gates (documentation). The matrix ...
• 5,813

### How is the Grover-Algorithm applied to a database?

I've been working on this problem as well. As a beginner and a classical programmer (i.e., I don't speak Quantum Mechanics), it is difficult to get an understanding of the concepts without complete ...
• 111
Accepted

### What does fidelity mean?

It might be worth mentioning the physical motivation for these definitions and the concept of fidelity itself. Unlike the classical computers we all know and love, quantum computers are ...
• 366
Accepted

### What is the relationship between Choi and Chi matrix in Qiskit?

( I copied some text from a previous answer of mine) Defining the Choi and $\chi$ matrix The Choi matrix is a direct result of the Choi-Jamiolkowski isomorphism. Some intuition on what this is can be ...
• 5,539
Accepted

### Qiskit CNOT-gate matrix mixup?

Qiskit uses "little endian" bit ordering. That means, if A and B are $2 \times 2$ unitary matrices then $B \otimes A$ (note the order) is equivalent to applying $A$ to first qubit and $B$ to ...
• 10.9k
Accepted

### What are the differences between Qiskit's AerSimulator, QasmSimulator and StatevectorSimulator?

Deprecation Note: The StatevectorSimulator has been superseded by the AerSimulator and will be deprecated in the future. It has ...
• 10.9k
Accepted

### What are theta, phi and lambda in cu1(theta, ctl, tgt) and cu3(theta, phi, lam, ctl, tgt)? What are the rotation matrices being used?

From IBM Q Documentation (the link is hard to find) here is the definition of the generic gate:  U(\theta, \phi, \lambda) = \begin{pmatrix} \cos\left(\frac{\theta}{2}\right) & -e^{i\lambda} \...
• 4,987

### How can I implement an n-bit Toffoli gate?

Qiskit's QuantumCircuit has mct method to build multiple-control Toffoli gate with several modes: basic, basic-dirty-ancilla, advanced, noancilla. For instance Toffoli gate with 3 control qubits: <...
• 481
Accepted

### Can I remove gates from a QuantumCircuit?

Quantum circuits have a data attribute, which is a list of all gates. You can remove elements from this as with any Python list. For example, here's a circuit <...
• 11.3k
Accepted

### How to calculate an Expected Value of some operator acting on qubits?

Qiskit currently supports measurements in the computational basis from Qiskit Terra and Aer, that is, returning 1 if the qubit is in state $|1\rangle$, and ...
• 859
Accepted

### How to selectively apply noise in Qiskit simulations?

Yes you can: When you build a noise model the noise is defined with respect to the name or label of gate objects, so you can use the labelto create multiple versions of a single gate but reference ...
• 1,221
Accepted

### How to create an arbitrary state in QISKit for a local_qasm_simulator?

I think you can use the initialize function as detailed at the section "Arbitrary Initialization" at this tutorial. As an example, this tutorial ...

### How do I build a gate from a matrix on Qiskit?

Here's the circuit for your specific case: I made it manually, by entering the matrix into Quirk, diagonalizing the matrix by adding operations, then simplifying the operations. It's not too hard to ...
• 38.5k