Questions tagged [circuit-construction]

For questions about the construction of complex circuits using elementary quantum gates.

Filter by
Sorted by
Tagged with
1
vote
1answer
24 views

Why I am getting transpilation error while executing the following IBM Quantum Experience code?

While executing the following circuit (consisting 16 qubit and 4 classical bits) I am getting "Error in transpilation process. [1003]" error. I have a group of 2 operations (you can observe circuit ...
1
vote
1answer
40 views

Can we add two classical registers in IBM Quantum Experience?

Suppose I have 01 and 11 in classical register 1 and 2 respectively in IBM quantum experience circuit. I want 01 + 11 = 00 mod 4. Can it be done?
1
vote
1answer
25 views

Toffoli gates with Hadamard coins (QISKIT)

I am creating the following circuit with Qiskit (2Toffoli gates controlled with coins) And to set the coins for one iteration of the circuit i do the following : ...
2
votes
0answers
54 views

XX, YY, ZZ circuit representations?

Is there a good primer or set of lectures\examples that show entirely how to take a given matrix and developing a circuit that represents it. I am trying to implement a program to find the lowest ...
1
vote
1answer
55 views

How to make circuit of a 32 X 32 matrix?

I have a 32 X 32 matrix show in the picture below and I want to make a circuit for this matrix. Also in the picture below to the matrix picture I have written the each column in bra-ket notation to ...
5
votes
2answers
71 views

How to prepare mixed states on a quantum computer?

I am a little bit confused by density matrix notation in quantum algorithms. While I am pretty confident with working with pure states, I never had the need to work with algorithm using density ...
3
votes
2answers
118 views

If an auxiliary qubit is allowed, how to construct toffoli gate in easier way?

We know if we don't use auxiliary, the construction of Toffoli gate will be: However, if now you are allowed to use one auxiliary qubit, how to realize a CCNOT in a simplier way? (Can we only use X,Y,...
1
vote
1answer
45 views

Achieve a control gate with 2 hadamard coins

I want to implement two Toffoli gates with 4 qubits: 3 serving as control qubits (the 2 hadamard coins and one other qubit) and the last one as target qubit and 3 qubits (2 coins 1 target qubits) as ...
1
vote
1answer
75 views

Simpler implementation of the Toffoli gate on IBM Q for special circumstances

On current quantum hardware, a depth of circuit is constrained because of noise. In some cases, results are totally decoherent and as a result meaningless. This is especially true when Toffoli gates ...
7
votes
2answers
294 views

Minimum number of CNOTs for Toffoli with non-adjacent controls

I want to decompose a Toffoli gate into CNOTs and arbitrary single-qubit gates. I want to minimize the number of CNOTs. I have a locality constraint: because the Toffoli is occurring in a linear array,...
1
vote
2answers
190 views

How to construct a IBM Quantum Experience circuit for the following state transformation?

Please help me in building IBM Quantum Experience circuit for: $$ M|0\rangle = \frac{1}{2}(|0\rangle+|1\rangle+|2\rangle+|3\rangle) $$ Edit: Is it possible to make a circuit for a general ...
0
votes
2answers
57 views

Swap test to calculate inner product with qiskit for multi-qubit states

Is it possible to perform a controlled swap test with multiple targets with qiskit? I have tried using cswap(ancilla[0],qb1,qb2), where qb1 is an n-qubit register and qb2 is as well
0
votes
0answers
21 views

Vetting the Circuit Gate for a 3 Qubit Entanglement [duplicate]

While I've seen plenty of examples on how to entangle two qubits, I've (unfortunately) not seen any on the generalized version of entangling multiple qubits, nor how you know your circuit is correct. ...
3
votes
1answer
176 views

Implementing QFT for Shor's Algorithm?

I'm studying Shor's algorithm. This diagram shows a calculation of $4^x\mod21$. I don't understand how this expresses $4^x \mod21$. Could you explain this? For example, by showing another calculation ...
2
votes
0answers
32 views

Easiest hash function to implement on Qiskit

Trying to build an Oracle circuit for Grover's algorithm that will try to find a desired input in order to get a certain output of a hash function. Was wondering if there were any 4 or 8 bit hash ...
3
votes
3answers
118 views

Unentangling a qubit from a system: can we convert $\alpha|000\rangle+\beta|111\rangle$ into $\alpha|00\rangle+\beta|11\rangle$?

Let's say I start with the following arbitrary qubits: $$ \color{red}{\vert Q_1 \rangle = \alpha_1 \vert 0 \rangle + \beta_1 \vert 1 \rangle}\\ \color{green}{\vert Q_2 \rangle = \alpha_2 \vert 0 \...
1
vote
1answer
45 views

How to implement modular exponentiation efficiently in Shor's algorithm?

I'm a noob in quantum computing and I'm trying to get Shor's algorithm working on Q# (the language is unrelated). However, I'm stuck on computing $f(x)$s in the quantum circuit. Let $N\sim \log_2(n)$ ...
4
votes
3answers
182 views

Constructing a circuit which performs the transformation $|x,y\rangle \to |x, x + y \bmod 4\rangle$

When faced with exercises like these, I find it hard to know how to construct the circuits due to the amount of input one needs to account for. I have seen the solution provided here however, I don't ...
3
votes
1answer
53 views

Constructing a circuit for $C^1(U)$ for rotation operators with TWO single qubit gates and CNOT gate

This is the exercise 4.23 from Nielsen and Chuang, asking that if it is possible to construct $C^1(U)$ for $U=R_{x,y}(\theta)$ with TWO single qubit gates and CNOT gate. My answer is no, and I would ...
2
votes
1answer
77 views

How to interpret a 4 qubit quantum circuit as a matrix?

This is part of Simon Algorithm (Initial state + some Oracle function) There is a post that explains how to interpret circuits (How to interpret a quantum circuit as a matrix?), but I'm not sure how ...
0
votes
1answer
49 views

How can I build up an arbitrary quantum circuit given a certain unitary matrix operation?

Suppose I want to put a qubit whose initial state is $|0\rangle$ to the final state $\frac{1}{\sqrt{3}}|0\rangle + \sqrt{\frac{2}{3}}|1\rangle$. Well, in that case, the unitary matrix that performs ...
3
votes
0answers
27 views

Stabilizer circuit synthesis via Clifford gates

I have been working with stabilizer codes and I understand the mathematical way that they are described and how to simulate such in a classical computer in order to check their performance. However, ...
18
votes
4answers
2k views

How can I build a circuit to generate an equal superposition of 3 outcomes for 2 qubits?

Given a $2$ qubit-system and thus $4$ possible measurements results in the basis $\{|00\rangle$, $|01\rangle$, $|10\rangle$, $|11\rangle\}$, how can I prepare the state, where: only $3$ of these $4$ ...
2
votes
0answers
50 views

Simulation for the [5,1,3] stabilizer code in Qiskit

Sorry that I keep asking questions for the same subject. It is driving me crazy. I have followed the [5,1,3] stabilizer code circuit designed by Gottesman in page 35 in his paper (also illustrated in ...
2
votes
1answer
116 views

Why is implementation of controlled Hadamard on IBM Q so complex?

With reference to question how to implement CCH gate I easily realized that CH gate can be implemented with $\mathrm{Ry}$ gates and $\mathrm{CNOT}$ followingly: Note $\theta = \frac{\pi}{4}$ for ...
4
votes
2answers
91 views

How to implement the CCH gate in quantum computers available in clouds?

How to implement CCH gate in quantum computers available in clouds? If there is not any gate directly available for it, what are the possible ways to represent CCH?
2
votes
1answer
84 views

How to implement a Fredkin gate using Toffoli and CNOTs?

Inspired by a question Toffoli using Fredkin, I tried to do "inverse" task, i.e. to implement Fredkin gate (or controlled swap). In the end I implemented it with three Toffoli gates. Firstly, I ...
5
votes
1answer
126 views

Can a Toffoli gate be implemented using Fredkin gates?

Even though this seems to be a much asked basic question, I couldn't find a reputed answer to this: Implement a 3-qubit Toffoli gate using 3-qubit Fredkin gates. The best I could do was using 4 ...
6
votes
1answer
115 views

Decomposing a $(w+1)$-qubit permutation gate into $w$-qubit permutation gates, SWAPs and NOTs

Say I have a quantum circuit of $w+1$ qubits with a permutation gate (mapping computational basis states to computational basis states) that does the permutation $(i, i+1)(i+4, i+5)$ on $w+1$ qubits ...
2
votes
1answer
52 views

quantum circuit with feasible gates for state preparation

I have a classical vector of size $2^{n}$ (normalized) and I want to use this value as amplitude for my $n$ qbits, in the canonical basis $|00000\rangle$, $|00001\rangle$ etc. I want to use real ...
5
votes
1answer
141 views

Uncomputation in quantum implementation of a classical algorithm

In Nielsens and Chuangs book, they present a way to implement a reversible version of any classical algorithm (section 3.2.5). In short, they use Fredkin and other simple reversible gates to ...
4
votes
2answers
588 views

How to create a condition on only one classical bit when we have a total of 2 classic bits in the system

I am trying to make a quantum circuit with one qubit and 2 classical bits for each measurment in the system below: I want to make condition on the first bit: if the first collapse to zero so x ...
20
votes
2answers
629 views

Why is it important to eliminate the garbage qubits?

Most reversible quantum algorithms use standard gates like Toffoli gate (CCNOT) or Fredkin gate (CSWAP). Since some operations require a constant $\left|0\right>$ as input and the number ...
1
vote
1answer
65 views

Computing circuit depth in Cirq

I ran into a problem of how to extract circuit depth from Cirq circuit object. In Cirq circuits consist of a list of Moments. Number of moments is not equal to the circuit depth in general case. I ...
1
vote
3answers
88 views

Compiling the Pauli-Z operator to the Rz operator for Hamiltonian simulation

I saw a tutorial on this long ago, but lost it. I know that the Pauli-Z operator compiles to Rz, but how? Here are the steps I remember: First, we have to solve for $U(t)$ in the Schrodinger equation ...
3
votes
1answer
96 views

N&C quantum circuit for Grover's algorithm

In the chapter about the Grover algorithm, it is suggested that the gate which executes the phase shift is given in the following form: Now I have looked at this gate in detail and come to the ...
6
votes
2answers
181 views

How to transform e.g., a 4 by 4 unitary matrix into a quantum circuit

I am new to Quantum Computing. I would really appreciate if some one could offer me some ideas, suggestions and/or useful references to solve the following problem about realizing an arbitrary ...
3
votes
1answer
65 views

How are physical quantum chips made?

So this might be a dumb question, but I have trouble finding any information on the physical aspect of quantum computers. Online you can find only pictures of big bulky things said to be quantum ...
3
votes
2answers
67 views

Quantum circuit for a three-qubit bit-flip code

I know a three-qubit bit-flip code has a common encoding circuit as follows, Further, as in page 35 in Gottesman's paper, the encoding circuit can also be constructed through stabilizer generators. ...
1
vote
0answers
20 views

Methods for encoding non-linear probabilities as data

I am working on translating a computing method I developed to model complex non-linear systems with classical computational methods into a form that is natural to quantum computing. The technique ...
1
vote
1answer
36 views

Minimum number of ancilla qubits to unitarily simulate a measurement?

Let's say I have a ket which is a momentum eigenket $| p \rangle$ and then I measure the position and obtain $|x' \rangle$. $$ | p \rangle = \int | x \rangle \langle x | p \rangle dx \to | x' \...
3
votes
2answers
74 views

Minimum number of ancilla qubits required to make a transformation unitary?

Background The counterpart of a NOT gate is the CNOT gate. They make use of ancilla qubits to achieve this. Question Given an arbitrary non-unitary transformation what are the minimum number of ...
4
votes
2answers
92 views

How to construct the unitary representation of the function $f(x, y, z) = (x \oplus y, y \oplus z)$?

Consider the function $f:\{0, 1\}^3\to\{0, 1\}^2$ with $f(x, y, z) = (x \oplus y, y \oplus z)$. How would you construct its standard unitary representation?
2
votes
0answers
42 views

How to generate the following $n$-level $n$-particle singlet state? [duplicate]

Could you please give a direction/reference towards realising the following using any set of realisable quantum gates $$\boxed{|S_{n}\rangle = \frac{1} {\sqrt{n!}} \sum_{S\in P_n^{n}} ( \,-1) \,^{\...
0
votes
1answer
53 views

Is this interpretation of quantum circuits right?

Just need some clarification: Results derived as the output of "running" a "quantum circuit" constructed from "quantum gates" are distributed in a certain way, based on the design, and the multiple ...
3
votes
2answers
198 views

How to decompose this two-qubit unitary matrix to the standard gate set?

I have read some of the other decomposition questions here however still don't understand how to do it manually. The matrix I wish to decompose is the following for 2 qubits: $M=\frac{1}{\sqrt2}\...
26
votes
2answers
2k views

How is the oracle in Grover's search algorithm implemented?

Grover's search algorithm provides a provable quadratic speed-up for unsorted database search. The algorithm is usually expressed by the following quantum circuit: In most representations, a crucial ...
4
votes
1answer
133 views

Quantum Fourier Transform without SWAPs

The Quantum Fourier Transform from Nielsen and Chuang chapter 5 is pictured here: In the textbook the author refers to "swap gates at the end of the circuit which reverse the order of the qubits". ...
1
vote
2answers
386 views

How to generate a superposition of m-level n-particle states $|j_{0} ,j_{1}, …,j_{n-1}\rangle$ with $\sum_{k=0}^{n-1} j_k \mathrm{mod}\ m \ = \ 0$?

The m level n-particle state $|X_{N}\rangle$ is defined as $$\boxed{|X_{N}\rangle = \frac{1} {m^\frac{n-1}{2}}\sum_{\sum_{k=0}^{n-1} j_k \mathrm{mod}\ m \ = \ 0}|j_{0}\rangle |j_{1}\rangle ....|j_{...
0
votes
1answer
59 views

How to get a large collection of quantum circuits that are valuable to practitioners? [closed]

I want to get a large collection of quantum circuits that matter to practitioners in quantum computing. I want a get many complete quantum circuits. For example, 1 million QASM files. However, I could ...