Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [circuit-construction]

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

2
votes
1answer
36 views

Deutsch–Jozsa algorithm: why is $f$ constant?

I'm trying to understand how the Deutsch–Jozsa algorithm works with the following circuit: Circuit in Quirk Since we have the top 2 wires measuring $|0\rangle$ with 100% probability, it means $U_f$ ...
4
votes
1answer
116 views

How to complete this teleportation circuit? How to create a copy of $|\psi\rangle$?

This is a quantum circuit. M represents the act of making a measurement on the first two qubits. The circuit is supposed to transfer the state $|\psi\rangle = a |0\rangle + b |1\rangle$ ($a, b \in \...
2
votes
1answer
43 views

Estimation of Z in the quantum Euclidean algorithm

In this paper there is a quantum algorithm that can estimate the distance between a given vector U and a set of vectors V (by taking the mean). In some part of the algorithm, we need to find the sum ...
2
votes
1answer
52 views

Implementing an oracle

Suppose $x$ is an $N=2^n$ elements database. Let's define a $2N$-bit database with $y \in \{0,1\}^{2N}$ indexed by $(n+1)$-bit strings $j=j_1\ldots j_n j_{n+1}$, where \begin{align} y_j=\begin{cases}...
3
votes
2answers
48 views

How can I invert the least significant bit of a certain term of a superposed state?

Say I have $$\dfrac{1}{\sqrt{2}}\bigl(|1\rangle|221\rangle|0\rangle + |3\rangle|73\rangle|2\rangle\bigr).$$ How can I change that into $$\dfrac{1}{\sqrt{2}}\bigl(|1\rangle|221\rangle|1\rangle + |...
2
votes
0answers
29 views

How to simulate a simple circuit to add two numbers in Quirk?

I am new and I don't understand where I should give the input and where I should get the output. Please explain with an example of a circuit run on the Quirk simulator. How to add two numbers?
4
votes
2answers
109 views

POVM three-qubit circuit for symmetric quantum states

I have been reading this paper but don't yet understand how to implement a circuit to determine in which state the qubit is not for a cyclic POVM. More specifically, I want to implement a cyclic POVM ...
5
votes
0answers
113 views

Circuit construction for Hamiltonian simulation

I would like to know how to design a quantum circuit that given a Hermitian matrix $\hat{H}$ and time $t$, maps $|\psi\rangle$ to $e^{i\hat{H}t} |\psi\rangle$. Thank you for your answer.
2
votes
1answer
38 views

Building an N-qubit Controlled S Gate

I've been beating my head against this problem for three days now and I just can't seem to crack it. To construct an N-qubit controlled Unitary gate, I can do something like this (note I'm using ...
4
votes
1answer
57 views

Garbage-Free Reversible Binary-To-Unary Decoder Construction

In designing reversible circuits one of the useful circuits is the decoder. The operation of a decoder is naturally reversible, so it makes sense to be able to create one with no garbage outputs. ...
2
votes
1answer
105 views

Decompose a general two-qubit gate into general controlled-qubit gates

We often seek to decompose multi-qubit unitaries into single-qubit rotations and controlled-rotations, minimising the latter or restricting to gates like CNOTs. I'm interested in expressing a general ...
5
votes
2answers
66 views

Constructing a circuit which performs the transformation $|x,y\rangle$ $\rightarrow$ $|x, x + y\text{ mod } 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
2answers
138 views

SWAP test inputs

I'm using the SWAP test circuit for implementing a qubit registers comparison From the documentation I could find I've understood it can be applied to input qubits |$\alpha\rangle$ and |$\beta\...
2
votes
1answer
55 views

Forming states of the form $\sqrt{p}\vert 0\rangle+\sqrt{1-p}\vert 1\rangle$

I'm curious about how to form arbitrary-sized uniform superpositions, i.e., $$\frac{1}{\sqrt{N}}\sum_{x=0}^{N-1}\vert x\rangle$$ for $N$ that is not a power of 2. If this is possible, then one can ...
6
votes
3answers
431 views

Is there any method of adding two operators in a circuit?

I am trying to reconstruct the time evolution of a Hamiltonian on the quantum computing simulator, quirk. Ideally I would like to generalise this to any simulator. The unitary matrix is $$U(t)=e^{-...
1
vote
1answer
50 views

Measurement of a qubit and storage of the information on a bit

Suppose we have the quantum circuit below with a quantum register of 2 qubits and a classical register of 2 bits. The Hadamard gates and CNOT gate are not important for the question. When we measure a ...
4
votes
1answer
80 views

How to construct a quantum circuit (QIP system) for the graph non-isomorphism problem?

I'm having some trouble understanding quantum interactive proof systems (QIP systems) and the related circuit constructions. Interactive proof systems model these type of situations: Interactive ...
2
votes
2answers
51 views

What's my computational basis if I want to define a unitary operator that implements a function such as $f(i) = 2^{i+1} \text{mod 21}$?

I know I must define $U_f$, the unitary operator, on the computational basis. But what's my computational basis here?
5
votes
1answer
126 views

Status of software packages for quantum compiling

By "quantum compiling", what I mean is classical algorithms to solve the following problem: given a $SU(D)$ matrix $U$ (the goal) and a set of $SU(D)$ unitary matrices $V_1 \cdots V_N$ (the gates), ...
2
votes
0answers
40 views

Implement a circuit as a matrix in ProjectQ

Suppose a have a circuit coded up in ProjectQ, suppose also it is that large to be hard enough to write it down as a unitary matrix by hands (e.g. order-finding, which is rather standard, but turns ...
5
votes
0answers
43 views

Correspondence between the Topological model and Quantum Circuit model

For example, given the $R$ & $F$ gates and Toric codes for a given problem, how to convert this code into the conventional circuit model and vice versa. From the literature developed, it seems ...
4
votes
1answer
86 views

Problem with approximating adiabatic evolution with quantum circuit

I am reading on how to approximate adiabatic evolution with quantum circuit and I had some trouble following the arguments given in the early papers which proves this results. I am mainly following ...
3
votes
1answer
49 views

Programming quantum half adder

While computing the carry bit [C=0 XOR (AB)] I am unable to compute that AB in Qiskit. I don't whether Toffoli gate is available in Qiskit. So does anyone know how to perform AB, which is basically ...
3
votes
1answer
87 views

How to decompose 4 qubits Toffoli-gate into two-qubits CNOT gate?

Can I decompose a 4-qubit Toffoli gate into two qubit CNOT gate without ancillary state?
1
vote
1answer
51 views

Multiple random coin flips without measurements

The question is similar to this one. As suggested in the answer, I can easily do this with just one qubit: I repeatedly Hadamard it and measure in order to have a fair coin flip at every point. The ...
2
votes
1answer
94 views

qiskit - Is there any way to discard the results of a measurement?

I have a circuit composed by n qubits, plus a single one which is an ancilla. I'm making multiple measurements on the ancilla at different stages of the circuit, ...
4
votes
2answers
81 views

How to get all combinations of given input?

I'm stuck with a very specific problem that I'm not sure on how to implement using quantum gates. Suppose I have an n qubit circuit and that I want in output a ...
2
votes
1answer
50 views

Why are these circuits not producing the same output?

I am simulating the phase shift algorithm on the Quirk platform. Even when the endian-ness of the built-in inverse QFT gate is corrected for, the circuits still output different results. Shouldn't the ...
4
votes
1answer
80 views

Implementation of inverse QFT?

When implementing the inverse quantum Fourier transform, in addition to reversing the circuit, does one need to take the conjugate transpose of the phase shift gates in the circuit as well?
2
votes
1answer
43 views

Why are these circuits not producing the expected output?

This circuit was created on the Quirk platform. I'm trying to implement a basic case of phase estimation. For some reason, I'm getting this strange result. When the Inverse QFT is broken down, it ...
2
votes
1answer
45 views
2
votes
1answer
84 views

A quantum circuit with entanglement with Eve

I'm trying to work through a self-made exercise, which may be ill formed as a question. Any general advice in dealing with these types of problems is also much appreciated! I'm looking at a quantum ...
4
votes
1answer
96 views

How to analyze highly entangled quantum circuits?

I came across a quantum circuit very similar to the phase estimation circuit, which is shown below: In the ...
2
votes
1answer
73 views

List of known circuits and their expected output

I've written an API which takes in a circuit scaffold, according to some specifications, and outputs the results of simulating the circuit. The circuit constraints are that the measurements are ...
3
votes
5answers
585 views

What circuit or operation corresponds to the tensor product?

What Clifford gate circuit operating on states $|\psi_1\rangle$ and $|\psi_2\rangle$ prepares the state $|\Psi\rangle=|\psi_1\rangle \otimes |\psi_2\rangle$ ?
2
votes
1answer
86 views

How to you encode a network as an adjacency-list in the quantum-gate model?

I have a network problem that I believe would be represented as an adjacency-list on a quantum circuit. Typically, the list is up for traversing from various perspectives (e.g., shortest-path between ...
5
votes
2answers
92 views

Reversible computation without inverting the circuit

I know that if you have a circuit $U$ that transforms $A → B$, it's possible to construct an inverse, ${U\dagger}(B) → A$. Is it also possible to transform the states with $T_{i,o}$ so that I can use ...
4
votes
3answers
97 views

Can we do adiabatic quantum computing with a quantum circuit model and how?

This is a question that must be asked a lot but is it possible? And if in theory possible, what are the challenges to do it, and what are the drawbacks?
7
votes
0answers
75 views

Is it better to use fewer gates or fewer working qubits? [closed]

I have a script that takes a while to simulate. I can modify it in such a way where I can use fewer qubits at a time, but it will require more iterations of manipulation. I believe this will cut down ...
5
votes
1answer
49 views

Mapping Algebraic Normal Form of Exclusive Sum of Products to Toffoli Network

How does one map an ANF to a toffoli network? Is there a straight-forward procedure for doing this? For example, given the ANF for the Sum function of an adder: $$S = A \oplus B \oplus C \oplus ABC$$ ...
8
votes
1answer
570 views

How to prevent future loops using a control qubit?

I am trying to construct a quantum multiplier using the method described here: https://arxiv.org/abs/quant-ph/0403048. However, it seems that the control qubit would only disable the following gates ...
1
vote
2answers
112 views

How can the state $\lvert0\rangle+M^{-1/2}\sum_{j=1}^M\lvert j\rangle$ be generated?

I was wondering if anybody to help me to generate the following state. It would be preferable if you use only Hadamard, CNOT and T-gates, on $\lceil\log_2(M+1)\rceil$ qubits: $$|\psi\rangle = \frac{1}{...
1
vote
1answer
51 views

Solving a circuit implementing a two-level unitary operation

The circuit below implements the following two-level unitary transformation: $\tilde{U}$ is a unitary matrix: $\tilde{U} = \left[\begin{matrix} a & c \\ b & d \end{matrix}\right]$ where $a, ...
1
vote
1answer
88 views

Applying Group Leaders Optimization to Quantum Belief Systems

Context: I am particularly interested in quantum cognition & would like to use a tool like pyZX to perform the following types of optimizations. In Preparing a (quantum) belief system they "...
5
votes
3answers
124 views

What's an example of building a circuit $U_f$ that implements a simple function $f$?

I'd like to be able to program simple functions into simulators such as QCL. I read that any function $f$ can be implemented, but I don't know how to get say a unitary matrix that implements $f$. $\...
6
votes
1answer
139 views

Understanding the Group Leaders Optimization Algorithm

Context: I have been trying to understand the genetic algorithm discussed in the paper Decomposition of unitary matrices for finding quantum circuits: Application to molecular Hamiltonians (Daskin &...
6
votes
3answers
79 views

$R_z$ gate representations

Why is the $R_z$ gate sometimes written as: $$ R_{z}\left(\theta\right)=\begin{pmatrix}1 & 0\\ 0 & e^{i\theta} \end{pmatrix}, $$ while other times it is written as: $$ R_{z}\left(\theta\...
3
votes
0answers
60 views

Simulating Read only QRAM (constructing an oracle) [closed]

In many algorithms an array that stores a classical data or quantum data is crucial. The QRAM (quantum random access memory) that stores classical data in the circuit has been done. My question ...
6
votes
2answers
130 views

Is there a general method to implement a 'greater than' quantum circuit?

I am interesting in finding a circuit to implement the operation $f(x) > y$ for an arbitrary value of $y$. Below is the circuit I would like to build: I use the first three qubits to encode $|x⟩$, ...
5
votes
2answers
46 views

Fault tolerant quantum measurement: how is implemented the “majority vote”

As a fundamental component for a quantum computation, the measurement needs to be implemented in a fault tolerant way. As indicated in Chuang and Nielsen Quantum Computation and Quantum Information, ...