# Questions tagged [quantum-circuit]

a model in which a computation is a sequence of quantum gates, which are reversible transformations on an n-qubit register (the quantum-mechanical analog of an n-bit register)

544 questions
Filter by
Sorted by
Tagged with
11 views

### Parametric circuits and QASM3 in Qiskit v1.1.0

I am currently exploring Qiskit v1.1.0 and its handling of QASM3. The following snippet demonstrates the creation of a parametric circuit and the generation of its corresponding QASM3 code. ...
• 267
1 vote
44 views

### State and observable decomposition into a sequence of native/universal gates

Given a quantum register $q_{0},\dots, q_{n-1}$ composed of $n$ qubits, I wonder if there exists a general mathematical framework to generate the quantum circuit to put this quantum register in a ...
• 191
37 views

### Defining quantum computer without reference to a classical computer

In the definition of an "efficient quantum computer", there is a uniformity condition that suggests to me that the notion of an efficient quantum computer is not independent of the notion of ...
• 499
21 views

### Solving variables in symbolic unitary to get a desired real-valued unitary using qiskit or qympy, qiskit-symb/pytket

I am trying to decompose a 4x4 unitary into 2 qubit circuit using U3 and CNOT gates but the circuit implementation qiskit gives me is not optimized. So I started looking at qiskit-symb and qympy to ...
1 vote
150 views

### How to implement a quantum multiplier in Qiskit 1.0

I am looking at the homepage of Qrisp, and they have an example of how to multiply two registers with Qiskit: ...
1 vote
33 views

### Verifying block encoding by computing inner products

Assume that we know each matrix element $A_{ij}$ of a $n$-qubit matrix $A$, and we are given an $(n+m)$-qubit unitary $U_A$ that we would like to verify is a $(1,m)$-block encoding of $A$. To do this, ...
• 549
75 views

### Why is the matrix representation of CNOT gate valid

$\begin{bmatrix}1&0&0&0\newline 0&1&0&0\newline 0&0&0&1\newline 0&0&1&0\end{bmatrix}$ Obviously, given any $4\times 1$ matrix, it fixes the first two ...
1 vote
33 views

### Will my custom gate actually spin when I run it on real hardware?

I am trying to create a custom gate using Qiskit Pulse and use it in my quantum circuit. Below is the code I have written so far. ...
• 11
1 vote
86 views

### An equivalent classical circuit for Hadamard gate

In principle, we can simulate any Quantum circuit via a classical circuit. However, this simulation could be inefficient. (Church-Turing thesis) Together, Hadamard and Toffolli are universal gate sets ...
• 681
47 views

### Unable to extract the quantum registers information from qiskit quantum circuit data

Consider the following code: ...
31 views

### methodology for design quantum circuits according to a given unitary

This is a general question. Given an arbitratry unitary matrix. How to desigin a quantum circuit to implement it? I am not asking for a specific unitary matrix, but for a general methodology to tackle ...
• 151
13 views

### How to plot a histogram of a pulse-level quantum circuit simulation in QuTiP?

The qutip_qip package allows for pulse-level quantum circuit simulation, compared to for instance the gate-level quantum circuit simulation found in Qiskit (to understand the difference, scroll to the ...
• 101
775 views

### Where do I create my first circuit?

I want to get the result of this code: ...
72 views

### Interpretation of a circuit that yields the same result for initializations $|+\rangle$ and $|-\rangle$

How can I interpret a quantum circuit that results in the same state for the initialization $\newcommand{\ket}[1]{|#1\rangle}\newcommand{\bra}[1]{\langle #1|}\ket{+}$ and $\ket{-}$? For example, the ...
• 311
1 vote
21 views

### Highly-efficient $n(n+1)$?

Appendix G of this paper provides a highly-efficient way of squaring integer numbers. (LMK if anything more advanced is already available.) I'm wondering if this approach can be easily modified to ...
• 1,971
1 vote
37 views

### A maximally distant unitary from a parameterized circuit

I have a parameterized circuit that includes a certain number of rotation gates, each parameterized by an angle. By sampling over these angles, I can obtain various unitaries. What are the unitaries ...
• 141
42 views

### Is there a fix for the varying numerical gradients calculated in the optimizer with qiskit?

I am currently trying to train a quantum circuit on Qiskit using an Azure QPU. I have some parameterized gates that I optimize using ADAMs. However, as the output of the circuit $f(x)$ is not ...
• 53
49 views

### Showing the Toffoli gate can be constructed from one-qubit gates using computer matrix multiplication

I need help coming up with the code that I can use in a computer algebra system like Sage, Python, or Mathematica that can evaluate the circuit. I am not a programmer and used ChatGPT to try to help ...
• 371
32 views

### Two Quantum State Density Matrices with Unequal Off-Diagonal Elements but Equal Magnitudes

I recently read Kitaev's paper on magic state distillation. I want to verify whether the circuit for the [5,1,3] encoder can map a single qubit state T_0 to the logical state T_1 in the encoded space. ...
21 views

### Difficulties Encountered in Simulating Quantum Purification Circuits for Magic State Distillation

Recently, I've been studying Kitaev's paper on magic state distillation. Referring to Nathan Babcock's presentation, I wrote a program in MATLAB to simulate the purification circuit. Instead of the ...
18 views

### How can I find out how compatible a quantum circuit is to a backend without executing the circuit

Say I have multiple backends, I need a score to determine how well a backend is suitable for that particular circuit, I have it's noise model too, I tried transpiling the circuit and calculating noise ...
1 vote
53 views

### Quantum circuit of stateful oracle

Suppose I have operator $U_f$ that maps state $|x\rangle|y\rangle|0\rangle$ to another state $|x\rangle|y\rangle|f(x, y)\rangle$. The function $f$ has its internal state, that changes on each ...
14 views

### Sampled weights in Qiskit Circuit Knitting Toolbox

From the Qiskit Circuit Knitting Toolbox: "Each weight with absolute value above a threshold of 1/num_samples will be evaluated exactly. The remaining low-...
• 473
137 views

### How to analyse a quantum circuit with an uncertain gate F?

The following quantum circuit consists of two CNOT gates in the middle of the circuit. The two-qubit input quantum register $|x\rangle$ is an arbitrary quantum state and can be set by the user. The ...
• 21
46 views

### How to use the classical expressions for qiskit for real backends?

I would like to build a quantum circuit that executes a gate based on mid-circuit measurements. In particular I want to create a $n$ qubit GHZ state using the scheme formulated to this question:https:/...
• 143
78 views

### How to introduce non-linearity into a quantum circuit?

What are the known ways to encode or introduce non-linear functions/operators into a quantum circuit?
• 143
1 vote
36 views

### How to suppress long parameters list that appears in the initialize gate?

Below is a simplified code which I am using for a quantum circuit. ...
27 views

### BQSkit Selecting Starting Circuit Structure

Background On the BQSKit repository, there is a nice example of using the qfactor algorithm to instantiate a 3-qubit Toffoli circuit. For this to work, however, it is first necessary to specify an ...
• 197
38 views

### Proof that if W is the image of a Unitary operator with an $n^O(1)$ size quantum circuit, then $R_W$ has an $n^O(1)$ circuit as well

I have been working on the following problem Suppose $H$ is the Hilbert space of n qubits. Let $W_0$ be the subspace of $H ⊗ H$ with basis $|x_0⟩$, x = 0,...,N −1 where $N = 2^n$. Suppose $U$ is a ...
1 vote
105 views

### How to convert QUBO (with non-zero diagonal elements) to Maxcut?

I want to solve QUBO with non-zero diagonal elements in matrix Q using QAOA. But I want to solve for a large enough problem size (30+ variables) and hence want to divide my circuit into subcircuits. ...
• 21
45 views

### Why are qubits initialized to $|0\rangle$ in parametrized quantum circuits?

Given a paramterised quantum circuit with adjustable gates, why do you need (why is it common) to initialise the qubits of the circuit at $|0\rangle$. What is the classical interpretation of this?
• 53
78 views

### Layout error with after compilation with custom Qiskit pass manager

I am trying to implement the custom Qiskit pass manager from this paper. The code from the authors is provided here on GitHub. I am able to get the pass manager working, and a compiled circuit is ...
• 121
1 vote
59 views

### Simulating Large Quantum Systems with Single T-Gate in Qiskit: Memory Error Beyond Certain Qubit Threshold

I'm currently conducting experiments on unitary t-designs, utilizing random Clifford and T gates within the Qiskit framework. My goal is to simulate quantum circuits that involve the application of a ...
44 views

### In what limit does the estimator sample variance converge to the Cramer-Rao bound?

In the context of a single phase estimation problem of a quantum photonics experiment (related post). For example consider a 3-photon quantum circuit (such as the Mach-Zehnder which depends on some ...
• 911
71 views

### Getting rid of extra qubits without changing phase

If I have the state $\frac{1}{\sqrt2}|0000\rangle + \frac{e^{i\phi}}{\sqrt2}|1111\rangle$ and need to get $\frac{1}{\sqrt2}|0\rangle + \frac{e^{i\phi}}{\sqrt2}|1\rangle$, does anyone have any ideas ...
1 vote
29 views

### qml.StronglyEntanglingLayers custom CNOT placement

The qml.StronglyEntanglingLayers function works great for what I need. However, I'd like to modify so that for each layer, only the first qubit is the control and the rest are targets of the control ...
73 views

### Help finding mistake when modifying $T$ injection protocols

I am a little confused about where I am going wrong when computing the action of the following circuit: My understanding is that the CNOT gate acts on the second qubit as a control and the first ...
• 597
1 vote
199 views

### How do I get the unitary matrix of a circuit?

I'm studying on this textbook but the library has changed meanwhile and running those instructions on my IBM quantum learning notebook will result in errors. What's the current way to draw the unitary ...
• 13
155 views

### Can you decompose a 4-qubit Toffoli gate (CCCX) into basic gates without an ancillary state?

I have a problem relevant to the circuit depth of a $\text{CCCX}$ gate, but I can't find any literature on decomposing this gate into basic gates without an ancillary qubit. Is this possible, and are ...
154 views

### Hello world program in Qiskit 1.0 [closed]

How do I write a "Hello world" program in Qiskit 1.0, which should be run on IBM cloud and require less than 600 seconds for implementation?
51 views

### How to decompose a permutation matrix into two-level unitary matrices?

Assume a have a SBox and want to make quantum circuit for it. The unitary transform matrix for a SBox is special - a permutation matrix. I found an algorithm to decompose any unitary matrix into two-...
• 93
1 vote
143 views

### What is the formula for the matrix representation of a general controlled gate?

Suppose I have $n$-qubit circuit. I have a single-qubit gate (e.g. a Pauli gate) at qubit $a$ and it is controlled by the qubit $b$. What is the matrix representation for this controlled gate? The ...
• 113
1 vote
56 views

### Circuit equivalence for cotrolled-controlled-$R_y$ gate

Could someone explain the following equivalence to me? I can build an example for the case when the first two lines of qubits are equal to 1. However, what happens if they are both equal to 00, 01 or ...
• 129
36 views

### Synthesizing quantum circuits from unitary matrices vs quantum state vectors, and determining qubit entanglement

I'm studying how to build quantum circuits and understand qubit entanglement. The following are my two confusing questions. I would greatly appreciate any assistance or insights regarding these ...
129 views

### How to calculate a density matrix of a given circuit?

I want to find the density matrix of the following quantum circuit, is it correct: [[0.12499999+0.j 0.12499999+0.j 0.12499999+0.j 0.12499999+0.j 0.12499999+0.j 0.12499999+0.j 0.12499999+0.j 0....
1 vote
98 views

### How to find an equivalent circuit without ancilla qubits?

$\newcommand{\ket}[1]{|#1\rangle}$ I have the following quantum circuit: (The inner qubits are both initialized to $|i\rangle$. $U$ is a arbitrary quantum gate.) But I am only interested in the ...
• 311
57 views

### Modelling Mach-Zehnder and saturating Cramer-Rao bound

I am simulating (using Mathematica) a Mach-Zehnder interferometer, with photon counting measurements at the end (based on the setup described in the recent post) for the input state \$|\psi\rangle:=|0,...
• 911
47 views

### Unexpected Rotations in QFT Implementation with Qiskit vs. Expected Behavior in Quirk

I'm working on implementing the Quantum Fourier Transform (QFT) using Qiskit. I've encountered an issue where unexpected rotations occur in the presence of a Hadamard circuit, which contrasts with the ...