Questions tagged [circuit-construction]
For questions about the construction of complex circuits using elementary quantum gates.
670
questions
2
votes
1
answer
65
views
Constructing a two 3-qubit state involving either X, Y or Z rotation gate
The goal is to construct the state
$|\psi\rangle = \frac{1}{2}|010\rangle + \frac{\sqrt{3}}{2}|101\rangle$
Two issues I am facing:
What is a good choice for initial state?
What is a good choice for ...
1
vote
0
answers
43
views
Construct of a quantum circuit for the projection $|0\rangle\langle0| + |1\rangle\langle1| $ and its generalizations
We can construct a projection over $|0\rangle \langle 0|$ using a quantum circuit with two qubits via the Hadamard test circuit
$$U = H_1 X_2 CZ_{1,2} X_2 H_1 X_1\,, \tag{1}$$
and by performing ...
2
votes
0
answers
24
views
What is the mathematical rationale for the decompose() function of qiskit?
The decompose() function decomposes the encapsulated quantum module into sets of elementary quantum gates. But what is the math behind its operation? For example how is a diag[1,1,1,1,1-1,1,1,1,1] ...
3
votes
1
answer
73
views
Quantum error correction circuit from stabilizer codes
I am trying to familiarize myself with QEC codes and their use in quantum communication. Right now, I am trying to implement some more widely known codes in Qiskit. My main problem is I cannot wrap my ...
1
vote
1
answer
83
views
How to interpret the circuit that measures stabilizers in the 5-qubit error correcting code
I would like to understand the exact role of the following circuit (By Vtomole - Own work, CC BY-SA 4.0) in the 5-qubit QECC.
The image attached (from Wikipedia) is captioned "Quantum Circuit ...
1
vote
0
answers
55
views
Implementing $n$-bit Toffoli gate with $(2n-5)$ and $(4n-12)$ CCNOT gates
Papers such as Diao et al. "A Quantum Circuit Design for Grover’s Algorithm" implement an $n-1$ bit Toffoli gate with $2n-7$ gates and $n-3$ scratch bits. I want to know if there is a way to ...
1
vote
1
answer
59
views
How to interpret the encoding circuit for the 5-qubit QECC
I have a question on circuit which constitutes the sydnrome measurement for the 5-qubit error correcting code. If I focus on just a portion of the circuit:
Reference for image. The full circuit can ...
2
votes
0
answers
46
views
Efficient gate executing the time evolution of a Hamiltonian using Runge-Kutta method
You can find a minimal working example below.
In particular, I want to replace the scipy.linalg.expm() matrix exponential by a Runge Kutta time evolution method as ...
3
votes
1
answer
74
views
How to apply rotation about X and Z in stim?
I have a quantum circuit illustrated in the provided image, where I perform a series of quantum operations followed by a projective measurement..
Using Qiskit, I've already written the code for this ...
0
votes
2
answers
76
views
Help debugging implementation of Draper QFT adder
I am attempting to implement the adder found in this paper.
Here is the code:
...
0
votes
1
answer
46
views
How to find explicit gate decomposition of a circuit implementing a unitary using HamiltonianGate()?
I'm new to Qiskit.
I am trying to construct a gate from HamiltonianGate(), available on Qiskit. The Hamiltonian in question is:
$$H = - \pi\delta(Z_1 - Z_2)
+ 2\pi J ~ \mathbf{I}_1 \cdot \...
2
votes
0
answers
41
views
Generic circuit for signature matrix
Consider a set $ A = \{a_0,a_2,\ldots,a_{k-1}\} \subset [N] := \{0,1,\ldots,N-1\}$.
Consider the diagonal matrix
\begin{equation}
R := I - 2 \sum_{a\in A} |a\rangle\langle a|,
\end{equation}
which is ...
0
votes
1
answer
57
views
How to simulate a $CNOT$ only using a single qubit?
I am looking to do a $CNOT$ on itself, i.e., if the qubit is in $|0\rangle$ it stays in $|0\rangle$ and if it is in $|1\rangle$ it becomes $|0\rangle$. We are allowed to use $H$, $X$, $Z$, and $CNOT$ ...
2
votes
2
answers
136
views
Encoding circuit for $[\![6, 4, 2]\!]$ code
For the famous $[\![4, 2, 2]\!]$ code, there is a circuit to encode two physical states into the logical state (from Roffe's work):
As $[\![m, m-2, 2]\!]$ is a class of error-detection code, I am ...
1
vote
3
answers
158
views
Map $n$ qubit state with complex amplitudes to $n+1$ qubit state with real amplitudes
For the simplest case, consider a single qubit state $|\psi\rangle$, and assume access to a state preparation unitary $V$ satisfying
$$
V|0\rangle = |\psi\rangle
$$
and
$$
V|1\rangle = |\perp\rangle.
...
1
vote
1
answer
57
views
Superposition on a subset of integers [duplicate]
Assuming I have $n$ qubits and I want to create a superposition out of a subset of integers:$$k∈\{1,...,2^n\},$$ how can I create a circuit that creates a uniform superposition of, for example, $k = 3$...
4
votes
1
answer
73
views
Can the oracle for $f:\{0,1\}^n \rightarrow \{0,1\}^m$ be implemented with only $n+m$ qubits?
(Part 1: Required ancilla qubits for a given function's oracle)
The question is that given a Boolean function $f:\{0,1\}^n \rightarrow \{0,1\}^m$, how many ancilla qubits are required to build its ...
4
votes
2
answers
274
views
Given $f: \{0, 1\}^n\to\{0, 1\}^m$, how many qubits are needed to implement the oracle $\mathcal U|x,0\rangle^{\otimes m}=|x,f(x)\rangle$?
Suppose I am given a function $f: \{0, 1\}^n \to \{0, 1\}^m$.
A standard oracle would be of the form $\mathcal{U}|x\rangle|0\rangle^{\otimes m} = |x\rangle|f(x)\rangle$.
I would suspect that this ...
3
votes
0
answers
44
views
Understanding circuit to Hamiltonian embedding where we do not have a separate clock register
I am trying to understand the clock construction given in this paper, to embed a circuit to a Hamiltonian, which doesn't need to access a separate clock register.
The construction, at a high level, ...
0
votes
0
answers
50
views
How to alter the result of (somewhat) randomly generated circuits?
I create randomly generated circuits by iterating through a list of the gate set (in my case [$CX,SX,RZ,X$]) and adding the gate to the circuit. (In the case of the $CX$ gate we look at the topology ...
0
votes
0
answers
41
views
Quantum Crosstalk in gate scheduling with different gates
I am working on quantum crosstalk, specifically on CNOT and SWAP gate operations that lead to crosstalk. I have encountered works that decompose CNOT and SWAP with iSWAP and CZ gates. I would like to ...
3
votes
0
answers
62
views
Amplitude amplification on each register in a product state
let oracle $U_\psi$ prepare a state $\psi$ with success probability $p$. For simplicity assume that $U$ requires a single ancillary qubit and $\psi$ is itself a single-qubit state:
$$
U_\psi |0\rangle|...
0
votes
0
answers
28
views
How to go from a classical LSTM cell to a quantum LSTM cell where the neural network parts in the LSTM cell's gates are replaced by quantum circuits?
The input data I have is a tensor with shape (num_samples, num_timesteps, num_features). A single datapoint in my problem case is a feature vector of dim = 4 which conceptually corresponds to an ...
1
vote
1
answer
121
views
What's a good Clifford+T circuit for a controlled-controlled-SWAP gate?
Mosca and Mukhopadhyay give a Clifford+T circuit for a three-qubit Fredkin (controlled-SWAP) gate:
This uses four $T$ and three $T^\dagger$ gates at a T-depth of four.
What would the T-count and ...
2
votes
2
answers
136
views
Is the plus state a magic state for the Hadamard gate?
Is the plus state $\left|+\right>:=\frac{\left| 0\right>+\left| 1\right>}{\sqrt{2}}$ a magic state for the Hadamard gate $H$? That is, given the ability to perform (controlled) Pauli ...
3
votes
0
answers
55
views
What's an example of a superposition $\sum_i \sqrt{p_i}|i\rangle$ that cannot be prepared efficiently?
As also discussed in (How does the induction step in the Grover-Rudolph scheme to prepare superpositions from probabilities work? and How does the uncomputation step work in the Grover-Rudolph scheme ...
4
votes
1
answer
105
views
How to implement projective measurement from multiple measurements?
In the following paper by Harrow et al.: https://arxiv.org/pdf/1607.03236.pdf, they want to implement a measurement operator that is the average of a set of measurement operators. On page 9, right ...
2
votes
1
answer
66
views
Does subtraction circuit have a class like full or half Carry adder circuit in qiskit? one subtraction circuit code-example in qiskit?
I need a subtraction circuit to calculate Laplacian in edge processing, but I didn't find any class in qiskit.Do I have to write the code myself?
3
votes
1
answer
184
views
How to come up with Simon's Algorithm circuit for this 3 qubit system? (given truth table & s)
I have this truth table, knowing that the S = 110. However, how do I come up with a circuit by recognizing the pattern? It has taken me hours but my 2 brain cells don't seem to get it...
I know there ...
1
vote
1
answer
41
views
Classical control of an entire sub-circuit in cirq
I would like to evolve a quantum state through an entire sub-circuit in my circuit based on classical control. I am aware of the current state of classical control in cirq (https://quantumai.google/...
4
votes
1
answer
85
views
Prepare superposition of quantum states weighted by fidelity with reference state
Given a list of $m$ quantum states $$|\phi_0\rangle, |\phi_1\rangle, ... |\phi_{m-1}\rangle$$
each on $n$ qubits, with unitaries to prepare these ($U_0, U_1, ...$), I'd like to prepare a superposition ...
0
votes
0
answers
92
views
How to implement a PauliSparseOp object in qiskit if its non unitary?
I have a PauliSparseOp object whose matrix is non-unitary, is there a way I can implement this on qiskit? It is written in terms of sum of tensor products of I,X,Y and Z operators.
12
votes
1
answer
672
views
How are quantum algorithms devised?
This is a soft question, but I find it to be a very pertinent one...
Algorithms for Grover's search and Simon's problems seem to come completely out of the blue, and I find it very hard to understand ...
1
vote
1
answer
101
views
Finding the Clifford circuit that implement a particular mapping of Paulis strings
Denote $P_N=\{\tau \}$ the set of Pauli strings,
composed out of tensor products of Pauli matrices $\sigma_i^\alpha$
acting on $N$ qubits, e.g.
$\tau=\sigma^x_1 \otimes \mathbb{1}_2 \otimes \sigma^y_3 ...
2
votes
0
answers
56
views
Reasons for Google's calibration policy of fitting to Alternating Single/Two-qubit gate pattern
In Cirq document that describes 'best practices' for manually optimizing circuits, they recommend to construct a circuit in a pattern that alternate 'single-qubit gates with two-qubit gates in each ...
2
votes
1
answer
287
views
How to express Hadamard gate as a generic trigonometric functions of theta? [duplicate]
Hadamard gate is expressed as $H=R_x(\pi)*R_y(2\theta)$ where $\theta$ is $\pi/4$.
$$H=\begin{bmatrix}
0 & 1\\
1 & 0
\end{bmatrix} \begin{bmatrix}
\cos \theta & -\sin \theta\\
\sin \...
1
vote
1
answer
75
views
Are there low T-count measurement and Clifford correction protocols for diagonal CNOT+T gates other than CCZ?
Famously, the CCZ gate requires 7 T gates to construct unitarily whereas using an ancilla, measurement, and classically-controlled Clifford gates, it can be constructed with only 4 T gates [1212.5069]....
1
vote
1
answer
75
views
How to convert a basic matrix into a quantum circuit?
Classical gates are not invertible, but larger expressions made from those gates can be invertible. One example of an invertible function is the function $f(A,B,C) = X,Y,Z$:
$X = A \ B \ | \ \neg B \ ...
2
votes
1
answer
157
views
How to convert a simple matrix into circuit? [duplicate]
Suppose you have an invertible matrix. How do you convert it into a circuit?
Matrices have dimensions $2^n \times 2^n$, so a circuit representation is desirable.
For example, the matrix below is a ...
1
vote
1
answer
91
views
Controlled unitaries in quantum singular value transformation
tldr -- Building general polynomials with QSVT requires implementing controlled versions of vanilla QSVT circuits. Is this a trivial task? Does it change the complexity? How is it done in practice?
...
0
votes
0
answers
43
views
Qiskit - How to prepare this superposition from general states?
I have two general states represented by circuits $|\psi_A\rangle$ and $|\psi_B \rangle$. I'd like to prepare the superposition
$$
|+^y_{AB}\rangle = \frac{|\psi_A\rangle + i|\psi_B\rangle}{\sqrt{2}},
...
1
vote
1
answer
74
views
Excplicit Description of Hamiltonians?
The wikipedia article for Hamiltonian simulation lists two complexities: gate and query complexity.
These two types of complexity refer to two different things; gate complexity is the asymptotic ...
3
votes
1
answer
245
views
When running an arbitrary quantum circuit, can all of the entanglement be done up front?
I'm trying to think practically about how a circuit might get implemented on a real world quantum computer and have a specific question about circuit set-up. Imagine my computer is such that I can ...
1
vote
1
answer
163
views
How to construct a two-qubit circuit implementing the oracle for Simon's algorithm, in qiskit?
I want to create a two-qubit quantum circuit for a function with these inputs and outputs:
f(00)=10
f(01)=10
f(10)=01
f(11)=01
I do not know how to think about this problem systematically and come up ...
1
vote
2
answers
489
views
Calculating the classical OR gate in a 3 qubit (+1 ancillary qubit) circuit
I have a 2 qubit (+1 ancillary qubit) circuit in Qiskit which calculates the classical OR gate (q0 or q1) as follows:
...
1
vote
0
answers
99
views
Is it possible to design a swap test for three qubits? If it is possible how is it different from 2 and 4 qubits? share the design of the swap test?
Explain the swap test for 2 qubits to find the distance between qubits. Extend the swap test for 3 and 4 qubits. Will the design differ from each other and share the design for both the swap tests?
4
votes
0
answers
52
views
Is circuit cutting equivalent in anyway to quantum teleportation?
I've been introduced recently to circuit cutting, and after seeing the 4 orthogonal measurements with their 8 corresponding initializations but no initial transfer of classical info, the first thing ...
5
votes
0
answers
75
views
What is the computational complexity of decomposing operators in terms of quantum gates?
I have recently worked on a problem involving a rather large Hamiltonian, which I wrote some Python code for its generation following the method in this paper.
No when I used qiskits ...
1
vote
2
answers
70
views
Can a classical circuit of size $2^k$ be modelled by a quantum circuit of size $k$ or vice versa?
There is something fundamental I don’t understand about quantum computing and hence the following question may be very trivial or stupid for which I apologize in advance.
A boolean function $f:\{0,1\}^...
0
votes
0
answers
29
views
Quantum image encryption using NEQR and QTRNG
I have represented a 2x2 grayscale image using NEQR and I generated a key image using QTRNG. After the xor operation between the original and key image, I only need the encrypted image value, to avoid ...