diff --git "a/stack_exchange/QC/QCQ&A 2020.csv" "b/stack_exchange/QC/QCQ&A 2020.csv" new file mode 100644--- /dev/null +++ "b/stack_exchange/QC/QCQ&A 2020.csv" @@ -0,0 +1,62450 @@ +Id,PostTypeId,AcceptedAnswerId,ParentId,CreationDate,DeletionDate,Score,ViewCount,Body,OwnerUserId,OwnerDisplayName,LastEditorUserId,LastEditorDisplayName,LastEditDate,LastActivityDate,Title,Tags,AnswerCount,CommentCount,FavoriteCount,ClosedDate,CommunityOwnedDate,ContentLicense +10001,2,,2151,2/26/2020 15:51,,4,,"

A lot of focus in quantum machine learning in the near term revolves around variational quantum algorithms (you'll also see them called variational quantum circuits or parameterized quantum circuits), as well as their extensions to hybrid classical-quantum models. Though the field is evolving pretty fast, this recent review article gives a fairly good overview:

+ +

Benedetti et al (2019). Parameterized quantum circuits as machine learning models

+ +

I would certainly recommend it over the Nature paper mentioned above if you are intereted in the emerging near-term viewpoint.

+ +

We've also been curating a number of explanatory QML materials and code demos over at pennylane.ai/qml which might be helpful for people trying to learn the field.

+",10193,,,,,2/26/2020 15:51,,,,0,,,,CC BY-SA 4.0 +10002,2,,9992,2/26/2020 15:53,,0,,"

I don't know about quantum gates but here is a link to some ressources of a company which produces randomness using light noise (should be the same principle), you can maybe find something looking at some technical data or white papers here

+",8746,,,,,2/26/2020 15:53,,,,0,,,,CC BY-SA 4.0 +10003,2,,9997,2/26/2020 16:05,,2,,"

This video does a good job of explaining quantum computing using a coin analogy. Also, I know they are older than a baby, but books such as Quantum Computing for Babies do a good job of simplifying the concepts so that anyone can understand them!

+",5955,,,,,2/26/2020 16:05,,,,0,,,,CC BY-SA 4.0 +10004,2,,9999,2/26/2020 16:06,,5,,"

The normal interpretation of the controlled-not is certainly only relevant to the standard basis. In fact, if you choose a different basis, such as the $|\pm\rangle$ basis, then the role is entirely reversed, due to the circuit identity +

+ +

So, you might complain that the name is not fair if it only applies to one particular basis. But you have to give it some name to distinguish it from the other gates, and calling it the same as you would call it in classical computation is more than reasonable.

+ +

Yes, as you say, it is a permutation matrix (I guess this is what you mean by 'swap') but that hardly distinguishes it from many other permutation matrices.

+ +

By the same token, consider the single-qubit $X$ matrix. Also called the bit-flip. In the computational basis, it flips bit values. But in a different basis, such as the Hadamard basis, it doesn't.

+ +

I should also mention that I don't think your calculation of your circuit is correct. If you start with the collection $\{|00\rangle,|01\rangle,|10\rangle,|11\rangle\}$, the controlled-Hadamard maps these to $\{|00\rangle,|01\rangle,|1+\rangle,|1-\rangle\}$, and the swap then maps them to $\{|00\rangle,|10\rangle,|+1\rangle,|-1\rangle\}$, which is not what you stated. When you apply the controlled-not on these, some of them (the latter two) will be entangled.

+ +

Let me run through one specific example: cNOT applied to $|+1\rangle$. The way that I work this out is the expand it as $(|0\rangle+|1\rangle)|1\rangle/\sqrt{2}$. I apply the controlled-not by using linearity and thinking about exactly the description of how it works on basis states: $|01\rangle\mapsto|01\rangle$ and $|11\rangle\mapsto|10\rangle$, so the output is $(|01\rangle+|10\rangle)/\sqrt{2}$.

+",1837,,,,,2/26/2020 16:06,,,,7,,,,CC BY-SA 4.0 +10006,1,10008,,2/26/2020 17:51,,2,134,"

I would like to know how to know in which state a qubit is (I am talking about single-qubit errors), because in order to apply a non unitary gate in the simulator I have to renormalize the state or the corresponding non unitary Kraus operator (the non unitary gate in my circuit). Therefore I need to know in which state the circuit it. I am of course talking about the simulator, which in fact is classical and therefore it must be a way to know the state at each point of the circuit.

+",9887,,55,,10/28/2020 9:24,10/28/2020 9:24,How do I know in which state the qubit is in each step of the circuit for the simulator in qiskit?,,1,0,,,,CC BY-SA 4.0 +10007,2,,9984,2/26/2020 18:02,,1,,"

I don't know why this doesn't work with Matrix, but a fix for this would be to use ImmutableMatrix instead

+ +
from sympy import Symbol, sin, cos, I, ImmutableMatrix
+from sympy.physics.quantum import qapply
+from sympy.physics.quantum.qubit import Qubit
+from sympy.physics.quantum.gate import UGate
+
+theta = Symbol('theta')
+
+Ry_mat = ImmutableMatrix([[cos(theta/2), -sin(theta/2)],
+                        [sin(theta/2),cos(theta/2)]])
+Rx_mat = ImmutableMatrix([[cos(theta/2), -I*sin(theta/2)],
+                        [-I*sin(theta/2) ,cos(theta/2)]])
+
+Ry = UGate((0,), Ry_mat)
+Rx= UGate((1,), Rx_mat)
+c = Ry* Ry
+
+print(qapply(c*Qubit('00'))) # -sin(theta/2)**2*|00> + 2*sin(theta/2)*cos(theta/2)*|01> + cos(theta/2)**2*|00>
+
+
+ +

I've filed an issue for your problem. In the meantime, use ImmutableMatrix.

+",362,,,,,2/26/2020 18:02,,,,0,,,,CC BY-SA 4.0 +10008,2,,10006,2/26/2020 18:03,,3,,"

You can take snapshots of the statevector of the circuit when you use the 'qasm_simulator'. You simply append snapshot instructions into your circuit where you would like to see the statevector, and then can see the values in the result object that is returned. You add a snapshot instruction using

+ +
from qiskit.extensions.simulator import snapshot
+qc.snapshot('my_label')
+
+",5955,,,,,2/26/2020 18:03,,,,3,,,,CC BY-SA 4.0 +10009,1,10010,,2/26/2020 18:36,,5,487,"

I am trying to understand Deutsch-Jozsa algorithm. It is mentioned as the first algorithm to demonstrate exponentially faster performance compared to classical algorithms for the same problem.

+ +

What I find missing in most explanations is why the quantum algorithm can be analyzed using the same complexity analysis as that of classical algorithms. It doesn't seem like an apple to apple comparison to me.

+ +

More concretely:
+ 1. Classical solutions require at-least $2^{n-1}+1$ evaluations of the black-box function where $n$ is the number of classical bits.
+ 2. Deutsch-Jozsa algorithm requires a single evaluation of the black-box function. However, it takes as input $n$ qubits.

+ +
    +
  1. $n$ qubits is not the same as $n$ classical bits. They require exponentially more information to simulate.
  2. +
  3. The black-box function is not the same in both cases since one deals with classical bits whereas the other deals with qubits.
  4. +
+ +

Considering we've changed the input as well as the function, how can we compare these two solutions and make the claim that one is exponentially faster than the other?

+",10147,,,,,2/27/2020 10:29,How can we compare quantum algorithms against classical equivalents?,,2,1,,,,CC BY-SA 4.0 +10010,2,,10009,2/26/2020 22:49,,4,,"

Scott Aarsonson answers your question. There is a difference between the relativized world where the models of computation we are studying have access to oracles and the unrelativized one where there are no oracles. When we claim that ""One is exponentially faster than the other"" in the Deutsch-Jozsa sense, we are saying that ""One is exponentially faster than the other relative to an oracle"".

+",362,,,,,2/26/2020 22:49,,,,2,,,,CC BY-SA 4.0 +10011,2,,10009,2/26/2020 23:15,,1,,"

Computational complexity is a concept used to analyze algorithms independently from the physical resources used to implement them. In computational complexity, we generally consider a number of input $n$ and we express the complexity by a function of the number of input $f(n)$, characterizing the resources needed for the computation, typically, time or space.

+ +

In quantum computing the inputs are qubits, and so complexity of an algorithm is a function of $n$, If we have $n$ qubits in input. The nature of the input does not influence the complexity of the algorithm. It is true that simulation of quantum computers has an exponential complexity for time and space resources on a classical computer but analysis of quantum algorithms are supposing the existence of an actual quantum computer.

+ +

Taking the case of the Deutsch-Jozsa algorithm, for $n$ qubits in input, we need $\mathcal{O(n)}$ gates, $\mathcal{O(n)}$ measurement as well and the application of an oracle, which I think also has $\mathcal{O(n)}$ complexity in time but that would ask for confirmation. Globally, we need $\mathcal{O(n)}$ operations. In the case of a classical computer we need $\mathcal{O}(2^n)$ operations so you can see that there's an exponential speedup for the quantum computer.

+ +

Of course complexity is concerned with the asymptotic behavior in the increasing number of inputs and a classical computer can perform better if we take practical consideration into accounts such as constant time needed for operations on small number of inputs, or the actual long time of preparation needed for qubits.

+ +

Another consideration for treating complexity in quantum computers is the need for additional qubits for error correcting codes. While it shouldn't influence the complexity in time it does influence the resources needed in space.

+ +

This wikipedia article mentions that the Shor's algorithm without correcting codes requires between $L$ and $L^2$ qubits for factoring a number with $L$ bits, but requires to multiply by another factor $L$ the number of qubits needed with quantum error correcting codes.

+",10065,,10065,,2/27/2020 10:29,2/27/2020 10:29,,,,3,,,,CC BY-SA 4.0 +10012,1,,,2/27/2020 1:39,,3,207,"

I want to know the fidelity (or error rate) of the preparation of $|0\rangle$. How can I obtain it?

+",10200,,55,,6/24/2021 22:29,6/24/2021 22:29,How can I find the fidelity of the preparation operation $|0\rangle$ of IBMQ?,,1,2,,,,CC BY-SA 4.0 +10013,2,,9996,2/27/2020 6:46,,2,,"

You can play with the circuit's data. First write:

+ +
print(circ.data)
+
+ +

or

+ +
from pprint import pprint
+pprint(vars(circ.data))
+
+ +

Then you'll understand the structure and how to modify it.

+",7659,,,,,2/27/2020 6:46,,,,4,,,,CC BY-SA 4.0 +10014,1,10015,,2/27/2020 9:47,,5,466,"

It is well known that circuit

+ +

+ +

can be replaced with this circuit

+ +

+ +

The situation is even easier in case of controlled $\mathrm{Z}$ where gate controlled by $q_0$ and acting on $q_1$ have same matrix as one controlled by $q_1$ and acting on $q_0$. This means that replacing gate controled by qubit ""below"" with one controlled by qubit ""above"" does not need any additional gate.

+ +

I was thinking about general case, i.e. how to replace general controlled gate $\mathrm{U}$ with controlling qubit ""below"" by the gate controlled by qubit ""above"". The very basic idea is to apply swap gate, then controlled $\mathrm{U}$ with controlling qubit ""above"" and then again swap gate. This is right approach because $\mathrm{U}$ gate controlled by qubit ""above"" is described by matrix

+ +

$$ +\mathrm{CU_{above} =} +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & u_{11} & u_{12} \\ +0 & 0 & u_{21} & u_{22} +\end{pmatrix} +$$

+ +

and the gate controlled by qubit ""below"" has this matrix

+ +

$$ +\mathrm{CU_{below} =} +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & u_{11} & 0 & u_{12} \\ +0 & 0 & 1 & 0 \\ +0 & u_{21} & 0 & u_{22} +\end{pmatrix}. +$$

+ +

It can be easily checked that $\mathrm{CU_{bellow}} = \mathrm{SWAP} \cdot \mathrm{CU_{above}} \cdot \mathrm{SWAP}$.

+ +

Swap gate can be implemented with three $\mathrm{CNOT}$, two controlled by qubit ""above"", one controlled by qubit ""below"". However, the latter can be converted to $\mathrm{CNOT}$ controlled by qubit ""above"" with help of Hadamards. Ultimatelly, all $\mathrm{CNOT}$s in swap gate are controlled by qubit ""above"".

+ +

So, this is a desired general approach how to convert a gate controlled by qubit ""below"" to one controlled by qubit ""above"". However, application of two swap gates increases depth of the circuit.

+ +

My question are these:

+ +
    +
  1. Is there a simpler general approach how to convert a gate controlled by qubit ""below"" to one controlled by qubit ""above""?
  2. +
  3. Are there other specific construction for other controlled gates similar to approach for controlled $\mathrm{X}$ and $\mathrm{Z}$? For example for controlled $\mathrm{Y}$, $\mathrm{H}$, $\mathrm{Ry}$ etc.
  4. +
+",9006,,,,,2/27/2020 10:15,General approach for switching control and target qubit,,1,0,,,,CC BY-SA 4.0 +10015,2,,10014,2/27/2020 10:00,,5,,"

Any controlled-$U$ where $U^2=I$ is straightforward. This is because you can write $U=VZV^\dagger$. So, we can think of controlled-$U$ as $V^\dagger$ on target, then controlled-phase, then $V$ on target.

+ +

Given the symmetry of controlled-phase, all you have to do is switch which qubits the single-qubit unitaries are applied to. + +This clearly contains your two stated cases ($U=X,Z$) as special cases ($V=H,I$).

+ +

About the case of more general $U$, I've never thought about it... My first instinct is that given any controlled-$U$ can be decomposed in terms of two controlled-nots and three single-qubit gates, and it seems most likely that it would take that to reverse the action, you'd be better off just directly implementing controlled-$U$ with the switched control/target assignment, and ignoring the fact that you already have controlled-$U$ in the other direction!

+",1837,,1837,,2/27/2020 10:15,2/27/2020 10:15,,,,0,,,,CC BY-SA 4.0 +10016,1,,,2/27/2020 10:08,,4,473,"

I have run a program on an IBM quantum experience machine which involves 5 qubits. Obviously when I measure the whole system I have 32 results but the machine only represents 20 in the histogram. In this situation the program tells you to download the results. The problem is that when I pick ""Download PNG"" or ""Download SVG"" it continues to show me a 20 results histogram. There is another option that is to pick ""Download results"" but it downloads two .json documents which I'm not sure I know how to change into a histogram.

+",10202,,5955,,2/27/2020 13:15,2/27/2020 13:15,How can I get the entire histogram in a 5 qubit program done in IBM quantum experience machine?,,1,0,,,,CC BY-SA 4.0 +10017,2,,10016,2/27/2020 10:55,,5,,"

By clicking on Downloand you get two .json files as you mentioned. The results are saved in the file with suffix results.

+ +

When you open the file in Notepad or any other text editor, you can find results in this form:

+ +
""results"":[{""data"":{""counts"":{""0x0"":28,""0x1"":39,""0x10"":35,""0x11"":28,""0x12"":25,""0x13"":32,""0x14"":22,""0x15"":36,""0x16"":42,""0x17"":33,""0x18"":35,""0x19"":23,""0x1a"":34,""0x1b"":24,""0x1c"":29,""0x1d"":43,""0x1e"":34,""0x1f"":31,""0x2"":37,""0x3"":32,""0x4"":31,""0x5"":33,""0x6"":39,""0x7"":35,""0x8"":37,""0x9"":29,""0xa"":29,""0xb"":25,""0xc"":30,""0xd"":29,""0xe"":40,""0xf"":25}},
+
+ +

States which are described by binary numbers in the graph on the result page in IBM Q interface are here described by hexadecimal numbers and showed together with number of occurences, for example:

+ +
""0x13"":32
+
+ +

This means that value $13_{16}=19_{10}=10011_2$ occured 32 times.

+ +

You can extract these data from .json file manually, change hexadecimal numbers to binary and plot a histogram. For example, you can do it in Excel - hexadecimal numbers can be converted to binary ones with function HEX2BIN and then you can use bar graph instead of histogram.

+",9006,,,,,2/27/2020 10:55,,,,2,,,,CC BY-SA 4.0 +10018,1,,,2/27/2020 16:17,,3,51,"

Recently, I have heard that the theory of modular representation can be involved with error correction in quantum information theory. However, from a point of view of mathematician, I am still quite unclear how modular representations can be used in error correction, could anyone here give some explanation? Some good references will also be helpful.

+",5693,,55,,10/28/2020 9:24,10/28/2020 9:24,How is the theory of modular representation involved with error-correction?,,0,1,,,,CC BY-SA 4.0 +10019,1,,,2/27/2020 19:32,,18,3335,"

Probably each company (Google, Amazon, Intel, IBM, Microsoft, D-Wave and so on) uses a mix of subatomic particles and technologies. I would like to know which particles/technologies are used by each company.

+ +

Are there specific reasons to choose a particular technology?

+",9797,,-1,,2/28/2020 15:40,11/9/2020 15:01,Which subatomic particle does each company use in quantum computing?,,1,0,,,,CC BY-SA 4.0 +10020,2,,10019,2/27/2020 20:45,,32,,"

Google, IBM and Rigetti use transmon qubits; these are basically fancy LC circuits where a Josephson junction and capacitor connect two superconducting islands. Because of this, they are also often referred to as superconducting qubits. The qubit states are the various charge levels that can exist on the circuit; since the lowest two levels are separated in energy with respect to the higher levels, a two-level system arises. There are also other designs that encode the qubit in the charge levels, collectively they're therefore also known as the charge qubits.

+

Intel also used superconducting qubits, but lately has also been interested in quantum dot qubits. A quantum dot is like a $0$-dimensional island on which a single electron can be placed; since the electron is a fermion it has only two natural states (and therefore makes a good qubit). The encoding can also be different, by encoding the qubit into two rather than one electron in the quantum dot (making use of the orthogonality of the singlet and triplet states). The go-to method of building a quantum dot is by using semiconductors (like silicium, known as the go-to material in classical computing); therefore they are also known as semiconducting qubits. Note that due to their extensive usage in classical computing, the engineering field of semiconductors is (at least relatively) very well developed.

+

Microsoft is trying a different route: they are trying to built a topological quantum computer. This is a different type of quantum computer where the qubits are encoded in topological states of matter, using quasi-particles known as (non-Abelian) anyons. A likely candidate for a physical implementation is a Majorana fermion, which can act as an anyon. Such a Majorana fermion is its own anti-particle; no physical Majorana fermion (as opposed to the 'normal' Dirac fermion, e.g. electrons) has ever been found, but it could be realized as a quasi particle; a delocalized pair of electrons on a super-conducting bridge. It is worth noting that this is a considerably harder design than your 'run of the mill' transmons etc, but these topological states are intrinsically protected to many types of noise, thereby reducing or even omitting the need for quantum error correction. They live in the middle of the conductance-free gap of this superconductor, so that relatively small excitations (i.e. not pushing them out of that gap) are not 'allowed'.

+

D-Wave's systems is based on a yet more different method of quantum computing: the adiabatic quantum computer or quantum annealer. The way computations are performed on these computers are not alike the circuit model (which is the most used model, exploited by transmons, super-conducting and semi-conducting qubits and the like). Moreover, the qubits themselves act very differently, and the comparison of 'adiabatic-syle' qubits and 'circuit-type' qubits is not a good or well-defined comparison. An adiabatic quantum computer needs many more qubits to have the same computational power as a circuit-based quantum computer, but they are (at least on paper) equally powerful (in terms of complexity classes). That means that the overhead is on paper is at most always polynomic. In an adiabatic quantum computer, the calculation's answer is encoded into the ground state of the entire system. It might therefore feel intuitive that these machines are particularly suited for optimization problems. It is also notable that there is still open discussion on whether the D-Wave-machines are 'universal' quantum computers, in the sense that they can do everything that an adiabatic QC needs to be able to do to be equivalent to a gate-based quantum computer. If you are familiar with the Ising model (basically a quantum annealer can calculate (the value of) the ground state of any Ising interaction): D-Wave's machines are not (yet) able to have any possible interaction term between qubits - they are able to do $\sigma_{z}\sigma_{z}$ interactions, but they also need either $\sigma_{x}\sigma_{x}$ or $\sigma_{y}\sigma_{y}$ interactions.

+

There are also other types of qubits (that are not used by any of the companies you listed). Two to look out for are:

+
    +
  • Trapped-ion qubits. Qubits are encoded into states of ions; these ions are trapped by optical tweezers (light) and therefore localized and isolated. They (more or less) make use of the gate-based model of quantum computation; some restrictions apply because generally they can only be realized in a one-dimensional fashion. A big advantage is that the cooling requirements of this design is considerably less severe; room-temperature realizations are as far as I understand it not out of the question.

    +
  • +
  • Photonic quantum computation. Qubits are encoded into degrees of freedom of photons (=light), most often the polarization; time-bin encoding is also often used, especially when considering flying qubits. These photonic machines normally use the computation model of measurement based or one-way quantum computation, which is comparable to the circuit model but creates all entanglement in the beginning of the computation. This design also has the added benefit of not needing to cool the system. However, to be able to scale one needs many coherent photon-resources (where a laser won't do), which is a tough resource.

    +
  • +
+

There is no clear best implementation (yet). Transmon qubits are the most mature by most standards, but they are relatively big which will give big implications and problems when these devices will be scaled to include millions of qubits. Semiconducting qubits are a very interesting candidate because they are much smaller and implemented on (the very well developed technology of) semiconductors, but not much has been developed. Trapped ions are promising as well, but they can only be manufactured in a line (as a one-dimensional array of qubits). I'm interested to see what will happen with photonic quantum computers; they can be very promising but not many large companies are working on them; the measurement based model of QC is less popular. +A topological quantum computer is the dream of many, but for now it seems out of reach in the near future, due to the exceedingly exotic nature of its design.

+",8141,,8141,,11/9/2020 15:01,11/9/2020 15:01,,,,0,,,,CC BY-SA 4.0 +10022,1,10026,,2/28/2020 9:15,,1,190,"

I was trying to implement the 2-qubit Grover algorithm without the auxiliary bit. Before finding the gate symbol for the controlled $\mathrm{Z}$, I worked with the controlled $\mathrm{Rz}$. The gate glossary states: "" $\mathrm{Z}$ is equivalent to $\mathrm{Rz}$ for the angle $\pi$"". So I thought the controlled $\mathrm{Rz}$ with angle $\pi$ should be equal with the controlled $\mathrm{Z}$ gate. However, I get very different results in the browser state-vector representation.

+ +

So my question is, should they be equivalent?

+ +

Here are my circuits: + +

+",5461,,9006,,2/28/2020 12:03,2/28/2020 12:46,Are $\mathrm{cRz}$ with angle $\pi$ and $\mathrm{cZ}$ equal on the IBM Quantum Experience?,,1,0,,,,CC BY-SA 4.0 +10023,1,,,2/28/2020 9:40,,1,185,"

Why do all tutorials that use QSVM from qiskit Aqua library have the number of features equal to 2?

+",10213,,55,,7/27/2020 13:43,7/27/2020 13:43,Is there a limited number of features for QSVM in Qiskit-Aqua?,,1,0,,,,CC BY-SA 4.0 +10024,1,10025,,2/28/2020 11:03,,2,102,"

Every qubit is a realization of some two-level quantum system with $\left| 0 \right\rangle$ and $\left| 1 \right\rangle$ states. These states have their energies $E_0$ and $E_1$ respectively. By solving the Schrödinger equation for the two-level quantum system one can show time evaluation of the $\left| 0 \right\rangle$, $\left| 1 \right\rangle$ and $\left| + \right\rangle$ states:

+ +

$$ +\left| \psi_0(t) \right\rangle = e^{-i \frac{E_0}{\hbar} t} \left| 0 \right\rangle \\ +\left| \psi_1(t) \right\rangle = e^{-i \frac{E_1}{\hbar} t} \left| 1 \right\rangle \\ +\left| \psi_+(t) \right\rangle = \frac{1}{\sqrt{2}}\left( e^{-i \frac{E_0}{\hbar} t} \left| 0 \right\rangle + e^{-i \frac{E_1}{\hbar} t} \left| 1 \right\rangle \right)= +\frac{e^{-i \frac{E_0}{\hbar} t}}{\sqrt{2}} \left(\left| 0 \right\rangle + e^{-i \frac{E_1 - E_0}{\hbar} t} \left| 1 \right\rangle \right) +$$

+ +

My question is about the relative phase $\varphi = e^{-i \frac{E_1 - E_0}{\hbar} t}$. This $\phi$ acts as a phase gate and changes the quantum state. Is this relative phase important and how in real quantum computers we should deal with it? One problem that I see is the following circuit:

+ +

+ +

After the measurement, the state should be $\left| 0 \right\rangle$, because $HH = I$. But If $t$ is such that the $\varphi = \pi$ then we will measure $\left| 1 \right\rangle$. We can forget about it if $\varphi(t) << \pi$ in the whole computational time. Otherwise, we should make sure that the time between gates should be $2\pi$.

+ +

Is this a problem and if yes how IBM, Google or etc. deal with this problem when constructing the circuits? How I understand the frequency $(E_1 - E_0)/\hbar$ value is important and for example, the ibmq_armonk qubit's frequency is equal to ~4.97428 GHz (qiskit_textbook), so should we take into account this value when we play with ibmq_armonk by using OpenPulse?

+",9459,,9459,,2/28/2020 11:46,2/28/2020 11:46,How to deal with the relative phase from the evaluation of the not interacting qubit?,,1,0,,,,CC BY-SA 4.0 +10025,2,,10024,2/28/2020 11:21,,1,,"

The could be a problem, but it depends on how you're realising your qubits. Some realisations are configured so that $E_0=E_1$, and then there's no problem.

+ +

There is (at least from the theoretical perspective) a simple fix: if you're supposed to be waiting a time $t$, then, instead:

+ +
    +
  • wait time $t/2$
  • +
  • apply bit flip
  • +
  • wait time $t/2$
  • +
  • apply bit flip.
  • +
+ +

This exchanges the roles of 0 and 1 for half the time so that they end up with equal phases.

+ +

Alternatively, you just take this into account and apply compensating phase gates inside your circuit.

+",1837,,,,,2/28/2020 11:21,,,,4,,,,CC BY-SA 4.0 +10026,2,,10022,2/28/2020 12:02,,1,,"

I realized that $\mathrm{Rz}(\lambda)$ is implemented in following way on IBM Q:

+ +
gate crz(lambda) a,b
+{
+  u1(lambda/2) b;
+  cx a,b;
+  u1(-lambda/2) b;
+  cx a,b;
+}
+
+ +

Setting $\lambda =\pi$, a matrix describing construction above is following: +$$ +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & -i & 0 \\ +0 & 0 & 0 & i \\ +\end{pmatrix} +$$

+ +

This is not problem when the gate is not controlled as $i$ is a global phase, however, it matters for controlled gates.

+ +

I also checked that these values are really returned for computation basis states in state vector visualization on IBM Q.

+ +

Conclusion is that controlled $\mathrm{Rz}(\pi)$ is not equivalent to controlled $\mathrm{Z}$ on IBM Q.

+ +

Note that application of single qubit $\mathrm{Rz}(\pi)$ returns same results as single qubit $\mathrm{Z}$.

+ +
+ +

Solution:

+ +

To make controlled $\mathrm{Rz}(\pi)$ behave as expected, you have to put controlled global phase gate before $\mathrm{Rz}(\pi)$. You can do that by application single-qubit gate $\mathrm{U1}(\pi/2)$ on controlling qubit of $\mathrm{Rz}(\pi)$, i.e. $q_0$ in your case.

+",9006,,9006,,2/28/2020 12:46,2/28/2020 12:46,,,,18,,,,CC BY-SA 4.0 +10027,2,,10023,2/28/2020 12:57,,3,,"

Here is a tutorial that uses three classes! If you want to use more than two classes, you need a multiclass_extension which is provided as a parameter to the QSVM

+ +
svm = QSVM(feature_map, training_input, test_input, total_array,
+          multiclass_extension=AllPairs(_QSVM_Estimator, [feature_map]))
+
+ +

As shown in the tutorial. There are a few multiclass extensions to choose from, which are all here.

+",5955,,,,,2/28/2020 12:57,,,,0,,,,CC BY-SA 4.0 +10028,1,10097,,2/28/2020 14:18,,2,156,"

IBM offers its platform IBM Q for free with certain constraints, such as available quantum processors and number of jobs running in parallel.

+ +

I was wondering whether there is the same possibility on D-Wave quantum annealers. I looked at D-Wave web page but I was not able to find any useful information.

+ +

Does anyone have any experience with D-Wave and possibility to at least sign up for free to some trial version?

+",9006,,55,,3/5/2020 9:14,3/5/2020 9:14,Is it possible to use D-Wave systems for free?,,1,0,,,,CC BY-SA 4.0 +10029,1,,,2/28/2020 16:12,,0,135,"

Sender (Alice) wants to exchange private encryption key with Bob using BB84 protocol. She generate a binary string (1010100010010111),and encode using Hadamard gate and identity gate (HHHIIHIHHIIIHIIH).

+ +

What is the quantum state she transmits to reciever (Bob)?

+",9700,,55,,10/28/2020 9:24,10/28/2020 9:24,What is the quantum state transmitted to Bob in BB84 protocol?,,1,2,,,,CC BY-SA 4.0 +10030,1,10033,,2/28/2020 16:19,,1,117,"

when i try to call the VQE from qiskit I get an error of dimmismatch. The input matrix is of a 16x16 shape and I could not find out what where I introduce the error. In the picture The input matrix and the qubit0p is shown. I get the same error when trying to use QAOA as well

+ +

Thank you for taking the time.

+ +
             self.C = self.C[:,:len(self.C[0])]
+                    self.B = self.B[:,:len(self.B[0])]
+                    print(""Input:"",self.C)
+                    qubitOp = MatrixOperator(self.C)                    
+                    print(qubitOp) 
+                    backend = Aer.get_backend('statevector_simulator')
+                    var_form = RYRZ(qubitOp.num_qubits,10)
+                    optim = COBYLA()
+                    vqe = VQE(qubitOp, var_form, optim)
+                # Runs the VQE over the backend defined above.
+                    result_vqe = vqe.run(backend)
+
+                    print(qubitOp) # prints operator properties 
+                    print('energy', result_vqe['energy'], '\n')
+                    print(result_vqe)
+
+ +

Here is the error

+ +
ValueError                                Traceback (most recent call last)
+<ipython-input-1-03f1f6dbe796> in <module>
+     76 print_state(state)
+     77 
+---> 78 bundle_adjust(state)
+     79 print(""= Bundle Adjusted State ="")
+     80 print_state(state)
+
+<ipython-input-1-03f1f6dbe796> in bundle_adjust(state)
+     39 
+     40     # note: intervene here with other optimizers
+---> 41     o.optimize()
+     42 
+     43     # normalize scale (note: ~ is __invert__, *noisy is __imul__)
+
+~\Bachelor-Project\BA\optimizerVQE3.py in optimize(self)
+     65     # run optimization
+     66     def optimize(self):
+---> 67         for event in self.optimize_it():
+     68             pass
+     69 
+
+~\Bachelor-Project\BA\optimizerVQE3.py in optimize_it(self)
+    131 
+    132                 # Runs the VQE over the backend defined above.
+--> 133                     result_vqe = vqe.run(backend)
+    134 
+    135                     print(qubitOp) # prints operator properties
+
+~\Anaconda3\lib\site-packages\qiskit\aqua\algorithms\quantum_algorithm.py in run(self, quantum_instance, **kwargs)
+     65                 quantum_instance.set_config(**kwargs)
+     66             self._quantum_instance = quantum_instance
+---> 67         return self._run()
+     68 
+     69     @abstractmethod
+
+~\Anaconda3\lib\site-packages\qiskit\aqua\algorithms\adaptive\vqe\vqe.py in _run(self)
+    314         if self._auto_conversion:
+    315             self._operator = \
+--> 316                 self._config_the_best_mode(self._operator, self._quantum_instance.backend)
+    317             for i in range(len(self._aux_operators)):
+    318                 if not self._aux_operators[i].is_empty():
+
+~\Anaconda3\lib\site-packages\qiskit\aqua\algorithms\adaptive\vqe\vqe.py in _config_the_best_mode(self, operator, backend)
+    236                                 ""achieve the better performance. We convert ""
+    237                                 ""the operator to weighted paulis."")
+--> 238                     ret_op = op_converter.to_weighted_pauli_operator(operator)
+    239         return ret_op
+    240 
+
+~\Anaconda3\lib\site-packages\qiskit\aqua\operators\op_converter.py in to_weighted_pauli_operator(operator)
+     86                                list(itertools.product(possible_basis, repeat=num_qubits)),
+     87                                task_kwargs={""matrix"": operator._matrix},
+---> 88                                num_processes=aqua_globals.num_processes)
+     89         for trace_value, pauli in results:
+     90             weight = trace_value * coeff
+
+~\Anaconda3\lib\site-packages\qiskit\tools\parallel.py in parallel_map(task, values, task_args, task_kwargs, num_processes)
+    142     results = []
+    143     for _, value in enumerate(values):
+--> 144         result = task(value, *task_args, **task_kwargs)
+    145         results.append(result)
+    146         _callback(0)
+
+~\Anaconda3\lib\site-packages\qiskit\aqua\operators\op_converter.py in _conversion(basis, matrix)
+     36 def _conversion(basis, matrix):
+     37     pauli = Pauli.from_label(''.join(basis))
+---> 38     trace_value = np.sum(matrix.dot(pauli.to_spmatrix()).diagonal())
+     39     return trace_value, pauli
+     40 
+
+~\Anaconda3\lib\site-packages\scipy\sparse\base.py in dot(self, other)
+    361 
+    362         """"""
+--> 363         return self * other
+    364 
+    365     def power(self, n, dtype=None):
+
+~\Anaconda3\lib\site-packages\scipy\sparse\base.py in __mul__(self, other)
+    478         if issparse(other):
+    479             if self.shape[1] != other.shape[0]:
+--> 480                 raise ValueError('dimension mismatch')
+    481             return self._mul_sparse_matrix(other)
+    482 
+
+ValueError: dimension mismatch
+
+
+ +

+",10218,,,,,2/28/2020 17:37,VQE with error dim. mismatch using qiskit.aqua.vqe,,1,0,,,,CC BY-SA 4.0 +10031,1,,,2/28/2020 17:01,,3,527,"

In HHL algorithm, how do we implement matrix $A$ (where $A|x\rangle = |b\rangle$) in the circuit?

+",9973,,9006,,2/28/2020 22:50,3/2/2020 8:41,Implementation of matrix A in HHL algorithm circuit,,1,0,,,,CC BY-SA 4.0 +10033,2,,10030,2/28/2020 17:37,,0,,"

The matrix you are printing seems to have 30 entries in each. When converting to Paulis form to run it expects the dimension to be a power of 2.

+ +

This code below (based on yours) does run when given a 16x16.

+ +
import numpy as np
+from qiskit import Aer
+from qiskit.aqua.algorithms import VQE
+from qiskit.aqua.components.optimizers import COBYLA
+from qiskit.aqua.components.variational_forms import RYRZ
+from qiskit.aqua.operators import MatrixOperator
+
+np.random.seed = 75
+matrix = np.random.rand(16, 16)
+qubitOp = MatrixOperator(matrix)                    
+print(qubitOp) 
+backend = Aer.get_backend('statevector_simulator')
+var_form = RYRZ(qubitOp.num_qubits,10)
+optim = COBYLA()
+vqe = VQE(qubitOp, var_form, optim)
+result_vqe = vqe.run(backend)
+
+print(qubitOp) # prints operator properties 
+print('energy', result_vqe['energy'], '\n')
+print(result_vqe)
+
+
+",9831,,,,,2/28/2020 17:37,,,,0,,,,CC BY-SA 4.0 +10034,1,,,2/28/2020 21:52,,3,59,"

I'm reading the paper Implementation of the Quantum Fourier Transform. On page 4, they write

+
+

To a first approximation, decoherence during the course of the QFT attenuates the entire density matrix. This is shown in figure 2.

+
+

I know that the word "attenuate" means to dampen or reduce the force of something. Since density operators have trace one, perhaps this means that the QFT decreases the trace of the density operator.

+

My question is: What is meant by attenuate here?

+",6118,,2293,,3/1/2021 22:54,3/1/2021 22:54,"What does ""decoherence attenuates the density matrix"" mean?",,0,3,,,,CC BY-SA 4.0 +10035,2,,10029,2/28/2020 22:48,,4,,"

Application of Hadamard gates changes states $|0\rangle$ and $|1\rangle$ followingly:

+ +
    +
  • $\mathrm{H}|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$
  • +
  • $\mathrm{H}|1\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$
  • +
+ +

Identity operator does not change the state in any way, i.e. $\mathrm{I}|0\rangle = |0\rangle$ and $\mathrm{I}|1\rangle = |1\rangle$.

+ +

Hence if gates $\mathrm{HHHII}\dots$ are applied on input string of qubits $|10101\dots\rangle$, the result is state $|-+-01\dots\rangle$.

+",9006,,,,,2/28/2020 22:48,,,,0,,,,CC BY-SA 4.0 +10036,2,,10031,2/28/2020 23:01,,3,,"

A Hermitian matrix $A$ is implemented as series of controlled gates $\mathrm{e}^{iAt}$ for some $t$. This gate can be then implementend with controlled $\mathrm{U3}$ gate on IBM Q.

+ +

Note that original paper on HHL algorithm (see link below) provides a ""trick"" how to convert any matrix to Hermitian one and apply HHL algrithm.

+ +

For example, for Hermitian matrix $A$, type 2x2, there are two gates with $t=\frac{\pi}{2}$ and $t=\frac{\pi}{4}$ controlled by two different qubits.

+ +

Please see these articles for more information how to implement HHL algorithm:

+ +
    +
  1. Original paper by Harrow, Hasidim and Lloyd: Quantum algorithm for linear systems of equations
  2. +
  3. Practical implementation for 2x2 matrix: Quantum circuits for solving linear systems of equations
  4. +
  5. Another demonstration of practical implementation (pgs. 49-51): Quantum Algorithm Implementations for Beginners
  6. +
+ +

I would recommend the third article for the best understanding how to implement HHL algorithm in practice.

+",9006,,9006,,3/2/2020 8:41,3/2/2020 8:41,,,,4,,,,CC BY-SA 4.0 +10037,1,10039,,2/29/2020 12:05,,1,221,"

I'm running VQE algorithm from qiskit aqua on statevector_simulator and each time I run it I get different results which are sometimes correct and sometimes not. I'm not sure if I'm setting parameters correctly.

+ +

Here is my code:

+ +

The qubitOp is generated with DOcplex module.

+ + + +
max_trials = 80
+depth = 1
+entanglement='full'
+
+slsqp = SLSQP(maxiter=max_trials)
+ry = RY(qubitOp.num_qubits, depth=depth, entanglement=entanglement)
+vqe = VQE(qubitOp, ry, slsqp)
+provider = IBMQ.get_provider('ibm-q')
+backend = Aer.get_backend('statevector_simulator')
+quantum_instance = QuantumInstance(backend,seed_simulator=seed, seed_transpiler=seed, optimization_level=0)
+res = vqe.run(quantum_instance)    
+
+",10234,,9006,,3/1/2020 9:44,3/1/2020 9:44,Qiskit statevector_simulator returns different results,,1,0,,,,CC BY-SA 4.0 +10039,2,,10037,2/29/2020 13:49,,5,,"

VQE has an initial_point parameter, which is the starting point it uses for the optimization. In the absence on one being provided (or suggested via the variational form) it will pick a random one. You can seed Aqua, like you did the simulator, so it will end up with the same random one each time, to get a predictable outcome. Add the following to do this before using any Aqua algorithms etc.

+ +
from qiskit.aqua import aqua_globals
+
+aqua_globals.random_seed = seed
+
+ +

Now since your result varies it suggests anyway that you are not reaching a minimum and the optimization loop is ending early. More iterations of the optimizer may be needed and/or you may need to look at the variational form, say larger depth with what is being used.

+",9831,,9831,,2/29/2020 13:55,2/29/2020 13:55,,,,0,,,,CC BY-SA 4.0 +10043,1,,,2/29/2020 20:07,,1,110,"

Cirq has two in-built realizations of quantum hardware, which are realized as GridQubit() and LineQubit() classes (naming convention is slightly disturbing:).

+ +

GridQubit device mimics connectivity of Google's quantum chips (Bristlecone, Sycamore) and qubits are arranged in a 2D grid with nearest-neighbor couplings. +https://github.com/quantumlib/Cirq/blob/master/cirq/devices/grid_qubit.py

+ +

LineQubit device represents chips with 1D geometry, where qubits are arranged in a line and again only nearest-neighbor qubits are coupled.

+ +

Is there any possibility to specify a custom hardware coupling map? E.g. to specify adjacency matrix of new connectivity graph?

+ +

It seems that a user has to create his/her own device class for such functionality.

+",7896,,,,,2/29/2020 20:22,Cirq: creating a new device with custom coupling topology?,,1,0,,,,CC BY-SA 4.0 +10044,2,,10043,2/29/2020 20:22,,2,,"

Generally, yes, it is expected that you would define your own device and perhaps your own qubits in order to make custom topologies.

+ +

There is currently a graph device package in the ""contrib"" package, which allows you to specify the connectivity graph for a device. But as with anything in contrib it may be a bit clunky and could disappear/change from version to version.

+ +
import cirq.contrib.graph_device
+
+",119,,,,,2/29/2020 20:22,,,,0,,,,CC BY-SA 4.0 +10045,1,,,3/1/2020 4:51,,3,37,"

My understanding is the Helstrom measurement distinguishes between 2 pure quantum states.

+ +

Is there a measure similar to the Helstrom measurement which can distinguishes between more than 2 pure quantum states? Or can the Helstrom measurement be generalized to do this?

+",10241,,55,,10/28/2020 9:23,10/28/2020 9:23,Is there a measure similar to the Helstrom measurement which can distinguish between more than 2 pure quantum states?,,0,1,,,,CC BY-SA 4.0 +10047,1,10048,,3/1/2020 16:19,,0,152,"

Someone on research gate said the answer was no

+ +
+

Our brain is a neural network with a very complex connectome. Any system is in a sense a computer adhering quantum mechanics, but what is known about human brain doesn’t tell us it uses quantum-mechanical effects such as entangled states and superposition states as en essential element of computation.

+
+ +

So the human brain is more like a classical computer Or is the brain not like a Turing machine?

+",,user10151,,,,3/2/2020 4:34,Do biological brains compute using quantum mechanics?,,2,2,,3/2/2020 23:23,,CC BY-SA 4.0 +10048,2,,10047,3/1/2020 21:10,,1,,"

As far as we know - and I know, so correct me anyone if there's research to the contrary - the neuron interactions in the brain are well within the classical regime.

+ +

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC5681944/

+",6253,,,,,3/1/2020 21:10,,,,2,,,,CC BY-SA 4.0 +10049,1,,,3/1/2020 21:54,,1,96,"

Consider a Hamiltonian $H = \sigma_x \otimes \sigma_z$ +Construct the time evolution operator $U(t) = \mathrm{e}^{-\frac{iHt}{\frac{h}{2\pi}}}$ [Hint:Write down the expansion of $\mathrm{e}^x$ and use the property of $H^2$]

+ +

This was one of my assignment problems and I really couldn't make sense of what the hint implied and ended up getting $H^2 = I$ and don't really know how and where to use this.

+",10247,,55,,7/26/2020 18:08,7/26/2020 18:08,Constructing a time evolution operator $e^{it H}$ for $H^2=I$,,2,2,,,,CC BY-SA 4.0 +10050,1,10056,,3/1/2020 23:16,,9,1068,"

Suppose we have the Fredkin gate with

+ +

$$ + F= + \left( {\begin{array}{cc} + 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ + \end{array} } \right) +$$

+ +

But how is it possible to ""see"" what its action is without making any matrix multiplication?

+ +

In this document, on solving 4.25, they claim that the action of $F$ is, in the computational basis, $F|0,y,z\rangle=|0,y,z\rangle$ and $F|1,y,z\rangle=|1,z,y\rangle$. But how is it possible to know this beforehand? I feel that I am missing this mental ""gymnastic"" that I feel is crucial for developing algorithms.

+",5620,,734,,3/2/2020 14:09,3/2/2020 14:09,"How can I see, without math, the action of a gate in matrix form?",,3,0,,,,CC BY-SA 4.0 +10051,2,,10050,3/2/2020 0:51,,1,,"

We care about $F$'s action on the basis states, where basis states are represented by

+ +

\begin{equation}\begin{pmatrix} 1\\0\\0\\0\\0\\0\\0\\0 \end{pmatrix}, \begin{pmatrix} 0\\1\\0\\0\\0\\0\\0\\0 \end{pmatrix}, \ldots, \begin{pmatrix} 0\\0\\0\\0\\0\\0\\0\\1 \end{pmatrix}\end{equation}

+ +

It should be fairly easy to see that on most basis states, this gate will act as the identity. The only exceptions are $(0,0,0,0,0,1,0,0)^T$ and $(0,0,0,0,0,0,1,0)^T$, which get swapped.

+ +

States of the form $|0yz\rangle$ are those with a one in one of the first four rows. Clearly these don't get swapped.

+ +

States of form $|1yz\rangle$ have a one in one of the last four rows. Look how they get mapped:

+ +

\begin{align} +|1yz\rangle :=|100\rangle &\mapsto |100\rangle = |1zy\rangle\\ +|1yz\rangle :=|101\rangle &\mapsto |110\rangle = |1zy\rangle\\ +|1yz\rangle :=|110\rangle &\mapsto |101\rangle = |1zy\rangle\\ +|1yz\rangle :=|111\rangle &\mapsto |111\rangle = |1zy\rangle\\ +\end{align}

+ +

as desired. What might be tripping you up is the fact that mapping $|100\rangle$ to $|100\rangle$ (and similarly for $|111\rangle$) can technically be thought of as swapping the last two bits.

+ +

What's the intuition? This gate is very close to being diagonal. It's easy to see the action of a diagonal matrix on a vector (especially a vector with only one nonzero entry, i.e. computational basis states), so my first instinct was to look at that action, and then assess where it deviates from diagonality and try to figure out what that deviation actually does.

+",6118,,,,,3/2/2020 0:51,,,,0,,,,CC BY-SA 4.0 +10052,2,,10049,3/2/2020 0:56,,1,,"

The exponential of an operator is defined with respect to its series expansion. The fact that $H^2=I$ will simplify this expansion greatly.

+",332,,9006,,3/2/2020 5:42,3/2/2020 5:42,,,,0,,,,CC BY-SA 4.0 +10053,2,,10049,3/2/2020 0:59,,2,,"

Here is a hint:

+ +

You are correct that $H^2 = I$. Let's set $a:=\frac{-2it\pi}{h}$ for simplicity. Then the definition of the matrix exponential gives us

+ +

$$U(t) = \sum_{n=0}^\infty \frac{a^n}{n!}H^n$$

+ +

Can you use $H^2 = I$ to help evaluate this?

+",6118,,,,,3/2/2020 0:59,,,,0,,,,CC BY-SA 4.0 +10054,2,,10047,3/2/2020 4:34,,2,,"

There is evidence that quantum coherence and it's role in chemical reactivity is responsible for the magnetic field sensing in migratory birds, the so called avian compass, https://arxiv.org/abs/1206.5946v1.

+ +

Similar quantum effects and chemistry could very well be occuring and playing a role in the brain, though as far as I know there isn't anything published in that direction. And even if there is a role for quantum coherent effects, it is likely a far cry from how we think about quantum computing.

+",9579,,,,,3/2/2020 4:34,,,,0,,,,CC BY-SA 4.0 +10055,2,,10050,3/2/2020 8:10,,2,,"

For a 0/1 matrix, the sort of protocol that I use is to write out the basis in the standard order. For three qubits, this is: 000,001,010,011,100,101,110,111 (the numbers 0 to 7 written in order in binary). You can list these next to the rows and the columns. Now, a given 1 entry in the matrix has a specific row and column (and there is only one of these for each row and column). The matrix acts to transform the column label into the row label.

+ +

So, for example, the first 4 elements $0xy$ all transform into themselves (because that part of the matrix is identity). Whereas 110 (penultimate column) transforms into 101, the 6th row.

+",1837,,,,,3/2/2020 8:10,,,,0,,,,CC BY-SA 4.0 +10056,2,,10050,3/2/2020 8:46,,10,,"

Besides the already given answers note that there is indeed some ""mental gymnastics"" involved here. As soon as you're getting more acquainted with quantum computing, you know some of your usual gates, including the $\mathsf{SWAP}$ gate that appears in your question: +\begin{align} +\mathsf{SWAP} = \begin{bmatrix} + 1 &0 &0 &0 \\ + 0 &0 &1 &0 \\ + 0 &1 &0 &0 \\ + 0 &0 &0 &1 \\ +\end{bmatrix} +\end{align}

+ +

Now, how do we see that the Fredkin gate corresponds to a controlled $\mathsf{SWAP}$ gate? Looking closer at the Fredkin gate shows us that it has a block structure where the upper left block is an identity matrix and the lower right block is the $\mathsf{SWAP}$ gate: +\begin{align} +\mathsf{Fredkin} = \mathsf{CSWAP} = \begin{bmatrix} + \mathbb{I} & 0 \\ +0 & \mathsf{SWAP} +\end{bmatrix} +\end{align}

+ +

And this structure is in fact general! All gates that are controlled on the first qubit have this block structure. Consider for example the well known $\mathsf{CNOT}$ gate +\begin{align} +\mathsf{CNOT} = \begin{bmatrix} + 1 &0 &0 &0 \\ + 0 &1 &0 &0 \\ + 0 &0 &0 &1 \\ + 0 &0 &1 &0 \\ +\end{bmatrix}= \begin{bmatrix} + \mathbb{I} & 0 \\ +0 & X +\end{bmatrix} +\end{align} +which is an identity matrix on the upper left (hence the $\mathsf{C}$ in $\mathsf{CNOT}$) and a Pauli $\mathsf{X}$ gate -- which is the quantum $\mathsf{NOT}$ gate -- on the lower right.

+ +

So why is this the case? As pointed our by DaftWullie, we assume that the basis vectors in our Hilbert space correspond in ascending order to our basis states, i.e. +\begin{align} +000, 001, 010, 011, 100, 101, 110, 111 +\end{align} +for three qubits. If we want to perform an arbitrary unitary $\mathsf{U}$ on the second and third qubit controlled by the first qubit, the corresponding matrix must act trivially (i.e. as identity matrix) on the first 4 basis vectors, just because for them the control bit is $0$. On the last 4 basis vectors, the control bit is $1$ and the operation $U$ is thus performed on these basis vectors. As the control bit must not change under the whole operation, the basis states starting with $0$ and the basis states starting with $1$ can not mix, yielding the overall matrix structure +\begin{align} +\mathsf{CU} = \begin{bmatrix} + \mathbb{I} & 0 \\ +0 & \mathsf{U} +\end{bmatrix} +\end{align}

+",10250,,-1,,3/2/2020 14:09,3/2/2020 14:09,,,,2,,,,CC BY-SA 4.0 +10057,1,,,3/2/2020 14:00,,6,261,"

I would like to check something.

+

Consider I am working on cQED (superconducting qubits), or ion trapped, or silicon qubits (I would like to exclude "exotic for me" quantum computing like photon based, or topological Q.C).

+

The fastest you perform a gate, the less the noise has the time to act for noise "per unit time" acting (not all noise can be modelled this way but it can often be).

+

It is thus important to perform gate "the fastest possible".

+

My question is thus: What is limiting gate speed ?

+

About limitations I know: for superonducting qubit too short pulses are not a good solution as it might excite the system into higher than qubit level (making it leave the computational space). I would like to know what are the main limitations in general because I guess this is not the only one.

+",5008,,5008,,11/12/2020 23:18,12/13/2020 9:07,What limits speed of quantum gates?,,1,2,,,,CC BY-SA 4.0 +10058,1,10149,,3/2/2020 14:31,,1,277,"

In article Quantum computational finance: Monte Carlo pricing of financial derivatives the authors said that:

+ +

Firstly:

+ +
+

While a practical quantum computer has yet to become + a reality, we can exhibit the speedup of our quantum + algorithm for options pricing numerically, and compare + its performance with the classical Monte Carlo method.

+
+ +

Secondly:

+ +
+

However, to showcase the + quadratic speed up, we here perform phase estimation by + using a single qubit rotated according to $\mathrm{e}^{i\theta\sigma_x /2}$, where $\theta$ is the predetermined phase.

+
+ +

If my understanding is correct, it is possible to simulate efficiently a circuit consisting only of Clifford gates. Since an inverse QFT is employed in the circuit, at least one $\mathrm{T}$ should be use here (QFT for three or more qubits). However, in the second quotation the authors claim that they used only a single qubit gate for phase estimation which reduced number of qubits in the inverse QFT and avoided the use of non-Clifford gates.

+ +

So my questions is: Have the authors used Clifford gates only in their construction or am I missing something? So far, I have thought that simulation of quantum computer cannot bring any speedup even in case only Clifford gates are employed.

+",9006,,9006,,3/3/2020 5:45,3/10/2020 11:47,Is it possible to demonstrate a quadratic speed-up of a quantum algorithm on a classical computer?,,1,1,,,,CC BY-SA 4.0 +10059,1,10060,,3/2/2020 17:25,,5,255,"

Consider the standard quantum teleportation scheme. Let the first register hold the state $\newcommand{\ket}[1]{|#1\rangle}\ket\psi$ to be teleported, and the second register be the one shared between the two parties. We can then summarise the protocol as follows:

+ +
    +
  1. Start with the state $\ket{\psi}_1\ket{0,0}_{23}$
  2. +
  3. Apply the unitary $U\equiv \operatorname{CNOT}(H\otimes I)$ between second and third register, thus evolving $\ket{00}$ to $\ket{\Psi^+}\simeq \ket{00}+\ket{11}$.
  4. +
  5. Apply $U^{-1}$ between first and second registers.
  6. +
  7. Measure the first two registers in the computational basis, and observe that for every outcome there is a local operation that can be applied to the third register that gives back $\ket\psi$.
  8. +
+ +

My question is about the choice of this specific unitary $U$: +Consider the following generalisation of the teleportation scheme:

+ +

+ +

Here, we again start with $\ket\psi\otimes\ket{0,0}$, but now apply some unitary $B$ between second and third register and then $B^{-1}$ between first and second. We then measure the first two registers in the computational basis.

+ +

What are the possible unitaries $B$ such that this circuit works as a teleportation protocol? More specifically, for what choices of $B$ can we always find a unitary to apply to the third register to get back $\ket\psi$ regardless of the measurement results $a,b$?

+ +

Intuitively, $B$ must be some gate creating maximal entanglement between the qubits, but requiring that $B$ sends $|00\rangle$ to a maximally entangled state is also not enough. As a counterexample, we can consider the following $B$: +$$B\equiv \begin{pmatrix} + 0&0&1&0 \\ + 1/\sqrt2 & 1/\sqrt2 & 0 & 0 \\ + 1/\sqrt2 & -1/\sqrt2 & 0 & 0 \\ + 0 & 0 & 0 & 1 +\end{pmatrix}.$$ +It is not hard to check that with this choice teleportation is not possible, despite the two parties sharing a maximally entangled state. For example, the outcome $a=b=1$ projects the third qubit to $\ket0$, which contains no information about $\ket\psi$.

+",55,,55,,5/12/2020 9:11,4/16/2022 18:18,Generalising the standard quantum teleportation protocol: what are the possible unitaries?,,2,3,,,,CC BY-SA 4.0 +10060,2,,10059,3/3/2020 1:48,,6,,"

A necessary and sufficient condition on the unitary $B$ is that its columns all correspond to maximally entangled states.

+ +

There also does not need to be any relationship between the two unitaries labeled $B$ and $B^{-1}$ in your figure: as long as you start with a maximally entangled state of systems 2 and 3, and then measure systems 1 and 2 with respect to an orthonormal basis of maximally entangled states, there will be an operation (which depends on the measurement outcome) on system 3 that recovers the original state.

+ +

Moreover, this is all true not only for qubits, but for any single dimension $d$ shared by systems 1, 2, and 3.

+ +

These facts were proved by Werner:

+ +
+

R. Werner. All teleportation and dense coding schemes. Journal of Physics A 34: 7081-7094, 2001 (link to paper).

+
+",1764,,55,,3/3/2020 10:48,3/3/2020 10:48,,,,4,,,,CC BY-SA 4.0 +10062,2,,2667,3/3/2020 5:58,,4,,"

I enrolled to Introduction to Quantum Computing on Coursera.

+

The course provides basics of quantum computing mathematical model and then introduce basics algorithms: Deutch-Jozsa algorithm, Simon algorithm, quantum Fourier transform, Shor algorithm and Grover algorith.

+

The course requires understanding of linear algebra, necessary basics of quantum mechanics are explained during the course.

+

Interestingly, the course shows how to build single-purpose quantum computer for implementation of Deutsch-Jozsa algorithm.

+

The course if for free unless you want a certificate. In that case it costs $49.

+",9006,,-1,,6/18/2020 8:31,3/3/2020 5:58,,,,0,,,,CC BY-SA 4.0 +10063,2,,2667,3/3/2020 6:22,,4,,"

Maybe be a bit of left field but I found Peter Wittek - may he Rest In Peace - course on edX quite good.

+ +

https://www.edx.org/course/quantum-machine-learning

+",6253,,6253,,3/3/2020 22:32,3/3/2020 22:32,,,,0,,,,CC BY-SA 4.0 +10064,2,,2667,3/3/2020 7:40,,4,,"

Currently there are not much courses available. However you can start with following courses:

+ +
    +
  • Quantum Information Science II (From edX): To build up the concepts you can go through this series of courses.
  • +
  • Introduction to Quantum Computing (From Coursera): This course touches differences of quantum computers and conventional computers very well. Then going through a little quantum physics, it will land you on some specific quantum algorithms. To be very fair it is a good resource for the topics it cover but in no means suffices the needs of someone truely in quantum computing.
  • +
  • Quantum 101: Quantum Computing and Quantum Internet (From edX): This Professional Certificate will touch on all of these layers: from the devices which bridge the gap between the quantum chip and the classical control hardware, to the mathematical aspects of some quantum algorithms. +The program is divided into two parts: this MOOC, the first part, will talk about the materials, four different qubits and operations on these qubits. The second MOOC, ""Architecture, Algorithms, and Protocols of a Quantum Computer and Quantum Internet"". By completing both parts, you will have a complete overview of all building blocks of a quantum computer.
  • +
  • The Quantum Internet and Quantum Computers: How Will They Change the World? (From edX): After completing the above professional certificate you can continue on to this course. This course will provide you with a basic understanding of quantum computing and the quantum internet. You’ll explore various application areas, such as quantum chemistry, quantum machine learning, encryption and secure communication, factorization, and blind quantum computation.
  • +
+ +

Then, to focus a particular area, you can go for:

+ +
    +
  • Quantum Machine Learning (From edX): It will cover topics like : Distinguish between quantum computing paradigms relevant for machine learning, Assess expectations for quantum devices on various time scales, Identify opportunities in machine learning for using quantum resources, Implement learning algorithms on quantum computers in Python
  • +
  • Quantum Cryptography (From edX): This will cover: Fundamental ideas of quantum cryptography, Cryptographic concepts and tools: security definitions, the min-entropy, privacy amplification, Protocols and proofs of security for quantum key distribution, The basics of device-independent quantum cryptography +Modern quantum cryptographic tasks and protocols
  • +
+",8796,,,,,3/3/2020 7:40,,,,0,,,,CC BY-SA 4.0 +10065,1,10068,,3/3/2020 15:10,,5,235,"

I'm a bit confused about which is the correct sign in the unitary evolution operator of a beam splitter.

+ +

In paper Digital quantum simulation of linear and nonlinear optical elements author uses the following expression:

+ +

$$U_{ij} = e^{i\epsilon_{ij}\left(b_j^\dagger a_i + b_j a_i^\dagger \right)} $$

+ +

where $i,j$ refers to the beam splitter modes (so, what is the meaning of $a$ and $b$?)

+ +

However, Nielsen & Chuang use (on page 291) the following equation for the same thing: +$$ U = e^{\theta\left(a^\dagger b - a b^\dagger\right)},$$ +where the latter term in the exponent has a minus sign.

+ +

How can I relate both equations? Are they the same?

+ +

Lastly, can you recommend me any book which deals with beam splitter and related stuff? I have not found any good reference.

+",9716,,55,,3/4/2020 10:48,3/4/2020 10:48,What is the correct sign in the unitary evolution operator of a beam splitter?,,2,0,,,,CC BY-SA 4.0 +10066,1,,,3/3/2020 20:32,,1,103,"

How would you explain, pictorially and without too much overhead, an interaction between the qubits on this model using Cirq?

+ +

I am interested in trying to map accurately the ansatz on Cirq to a graph using Python network's library.

+ +

I know this is a bit open-ended. What I am looking for are suggestions and examples to take a look at - besides the obvious one at Cirq's docs.

+ +

Thank you.

+",6253,,5955,,3/4/2020 9:32,3/18/2020 20:57,"Ising Model, Graphs, and Cirq",,0,5,,,,CC BY-SA 4.0 +10067,1,,,3/3/2020 22:51,,2,238,"

I'm fairly new to the Qiskit API. I was wondering if I could get some assistance with trying to implement our technique of projecting out a new Hamiltonian from the ground-state Hamiltonian. The technique is discussed in our preprint.

+ +

There are two main challenges that I'm confronted with:

+ +
    +
  1. The qiskit constructed Hamiltonian by default consist of only the non-zero Pauli strings. How can this be changed to allow for adding and removing terms that may be initial zero.
  2. +
  3. How and where would one dynamically modify each Pauli coefficient in the Hamiltonian? For example it appears something like qubitop.aer_pauli[i,:] = 1.0 + 0.0j +should work, but I'm not sure this is complete or an appropriate approach.
  4. +
+ +

This would enable us to then use the VQE routines with Qiskit to further verify this method.

+ +

I'm looking to make these modification to the Qiskit source code just need some guidance.

+",10265,,9006,,3/4/2020 5:08,3/4/2020 15:33,Modifying Qiskit Hamiltonian,,1,0,,,,CC BY-SA 4.0 +10068,2,,10065,3/3/2020 23:32,,4,,"

First, the operators $a$ and $b$ ($a^{\dagger}$ and $b^{\dagger}$) are the annihilation (creation) operators of the two photonic modes in your problem. For an introduction to the subject I recommend you to look for some decent lecture notes on quantum optics. A well readable introductory book is Mark Fox's ""Quantum Optics -- An Introduction"" and a more advanced read is Grynberg, Aspect and Fabre's ""An Introduction to Quantum Optics"". But the parts you are interested in are possibly well explained in Nielsen and Chuang. Also this document I found while googling might be of interest.

+ +

But back to the original question: why does the paper you mention and the Wikipedia article define the beamsplitter as +\begin{align} +U = \mathrm{e}^{i \theta (b^{\dagger} a + b a^{\dagger})} +\end{align} +with a plus sign, contrary to Nielsen and Chuang?

+ +

The truth is, both operators are ""correct"", they just describe polarizing and non-polarizing beamsplitters. The beamsplitters usually encountered in labs are polarizing, so that the reflected photon obtains an additional phase shift.

+ +

This is actually explained quite neatly in Box 7.3 of Nielsen and Chuang, where they show that there is an isomorphism between the transformation of two photonic modes and $SU(2)$. The plus convention corresponds to a Pauli $X$ rotation, where the minus convention corresponds to a Pauli $Y$ rotation. As pointed out before, there is an additional phase shift, embodied by the phase operator +\begin{align} +S = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix} +\end{align} +that can be used to relate the two transformations. For that see Page 51 of ""Introduction to Optical Quantum Information Processing"" by Kok and Lovett.

+",10250,,,,,3/3/2020 23:32,,,,0,,,,CC BY-SA 4.0 +10069,2,,10065,3/4/2020 0:30,,0,,"

Just replace $a$ by $a'=ia$, this maps one unitary to the other.

+",491,,,,,3/4/2020 0:30,,,,0,,,,CC BY-SA 4.0 +10070,1,10071,,3/4/2020 5:38,,3,336,"

I am following Nielsen and Chuang, section 2.2.5:

+ +
+

A projective measurement is described by an observable, $M$, a Hermitian + operator on the state space of the system being observed. The + observable has a spectral decomposition, $$M = \sum_m mP_m$$ + where $P_m$ is the projector onto the eigenspace of $M$ with eigenvalue $m$. The possible outcomes of the measurement correspond to the eigenvalues, $m$, of the observable.

+
+ +

My question is how can we view a the projective measurement of two qubits in the standard (Z) basis using this formalism. In this measurement the projectors are +$$\left|00\right\rangle \left\langle 00\right|, \left|01\right\rangle \left\langle 01\right|, \left|10\right\rangle \left\langle 10\right|, \left|11\right\rangle \left\langle 11\right|$$

+ +

But how can I find them if I only know of the observable, which in this case is $Z\otimes Z$ if I understand correctly?

+ +

This observable has only two eigenvalues: $+1$ and $-1$. The eigenvalue $+1$ corresponds both to $\left|00\right\rangle$ and $\left|11\right\rangle$, so it seems to me I need a ""stronger"" observable, which can differentiate those two states, or I'm missing a something elementary in the definition of projective measurements.

+",9918,,9006,,3/4/2020 7:44,3/4/2020 12:18,Viewing two-qubit measurement as a projective measurement,,2,0,,,,CC BY-SA 4.0 +10071,2,,10070,3/4/2020 7:49,,3,,"

$Z\otimes Z$ is an observable which specifies a measurement but, as you have realised, it's not specific enough to fix it as being the measurement you want. There's no unique way of doing this, but you could use something like +$$ +2Z\otimes I+I\otimes Z +$$ +If you work this out, you'll see it's diagonal, with distinct elements on each diagonal, which is what you need.

+",1837,,,,,3/4/2020 7:49,,,,0,,,,CC BY-SA 4.0 +10072,1,,,3/4/2020 9:14,,1,67,"

What is the implementation of quantum superdense coding protocol if the sender and receiver share the entangled state +$ +\frac{1}{\sqrt{2}} (\left| 01 \right> - \left| 10\right>) +$?

+",9700,,55,,3/5/2020 15:53,3/5/2020 15:53,What is the implementation of the state in superdense coding?,,1,0,,,,CC BY-SA 4.0 +10075,1,10078,,3/4/2020 12:18,,3,735,"

As defined, CNOT should for the two input states $|0\rangle = \pmatrix{1 \\ 0}$ and $\pmatrix{\alpha \\ \beta}$ should result in the second state unchanged: $\pmatrix{\alpha \\ \beta}$. However, to me it does not seem to be the case.

+ +

The matrix for CNOT is defined as:

+ +

$$\pmatrix{1\;0\;0\;0 \\ 0\;1\;0\;0 \\ 0\;0\;0\;1 \\ 0\;0\;1\;0}$$

+ +

Now, I am not sure how to interpret the two input states, it makes sense to me to use their XOR as the input:

+ +

$$\pmatrix{1 \\ 0} \otimes \pmatrix{\alpha \\ \beta} = \pmatrix{ \alpha \\ 0 \\ \beta \\ 0 }$$

+ +

Now:

+ +

$$\pmatrix{1\;0\;0\;0 \\ 0\;1\;0\;0 \\ 0\;0\;0\;1 \\ 0\;0\;1\;0} \pmatrix{ \alpha \\ 0 \\ \beta \\ 0 } = \pmatrix{\alpha \\ 0 \\ 0 \\ \beta}$$

+ +

which is a state impossible to write as XOR of two states. Besides obviously being different from the first one, even though it should not have changed.

+ +

How is that?

+",10270,,9006,,3/4/2020 13:04,3/4/2020 13:04,How does the CNOT gate work?,,2,0,,,,CC BY-SA 4.0 +10076,2,,10070,3/4/2020 12:18,,2,,"

An observable having degenerate eigenvalues means that it doesn't completely collapse the system. For example, $Z\otimes Z$ would describe a type of measurement in which you are only asking whether the state is in the span of $\{|00\rangle,|11\rangle\}$ or in the span of $\{|01\rangle,|10\rangle\}$. This means that, for example, this type of measurement would leave a state such as $|00\rangle+|11\rangle$ unperturbed, but make a state like $|00|\rangle+|01\rangle$ collapse in either $|00\rangle$ or $|01\rangle$.

+ +

If you want to model a measurement which distinguished between all elements of the computational basis, you can use any non-degenerate observable. The specific eigenvalues will only depend on what you want to do with your observations.

+",55,,,,,3/4/2020 12:18,,,,0,,,,CC BY-SA 4.0 +10077,1,10091,,3/4/2020 13:03,,4,274,"

I'm trying to implement an modular adder mentioned here with qiskit. I have already built the $\Phi ADD$ gate. But in order to build a modular adder like in figure 5 in the paper, I need to build a doubly-controlled $\Phi ADD$ gate. Qiskit offers a method to transfer a circuit to a controlled gate, but now I need a doubly controlled gate. I know I can use something like this, but that need an additional qubit, which is undesired. I also know that I can use this method, but I don't know how to implement the square root of $\Phi ADD$ gate. Is there any other method to do this (creating a doubly-controlled gate from the $\Phi ADD$ gate I built without adding any additional qubits)?

+",9153,,9153,,3/4/2020 13:39,3/4/2020 17:42,Make a doubly controlled gates from existing operations,,1,5,,,,CC BY-SA 4.0 +10078,2,,10075,3/4/2020 13:03,,6,,"

The problem is tensor product which you have calculated wrongly. A correct calculation is this:

+ +

$$ +\begin{pmatrix} 1 \\ 0 \end{pmatrix} +\otimes +\begin{pmatrix} \alpha \\ \beta \end{pmatrix} += +\begin{pmatrix} \alpha \\ \beta \\ 0 \\0 \end{pmatrix} +$$

+ +

If you now apply CNOT gate you have

+ +

$$ +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0 \\ +\end{pmatrix} +\begin{pmatrix} \alpha \\ \beta \\ 0 \\0 \end{pmatrix} += +\begin{pmatrix} \alpha \\ \beta \\ 0 \\0 \end{pmatrix}, +$$

+ +

which means that the second qubit is unaffected.

+",9006,,,,,3/4/2020 13:03,,,,0,,,,CC BY-SA 4.0 +10079,2,,10075,3/4/2020 13:03,,3,,"

Where you say ""xor"", you should mean (and, indeed, you're using the notation for) the tensor product. However, you have not calculated the tensor product correctly. You should be getting $[\alpha,\beta,0,0]^T$ before application of the cnot, and hence $[\alpha,\beta,0,0]^T$ after the action of the cnot as well.

+",1837,,,,,3/4/2020 13:03,,,,0,,,,CC BY-SA 4.0 +10080,2,,10072,3/4/2020 13:22,,2,,"

If you apply $\mathrm{X}$ on second qubit, you will get state +$$ +\frac{1}{\sqrt{2}}(|00\rangle - |11\rangle) +$$

+ +

After that you can apply $\mathrm{Z}$ on second qubit as well to get Bell state $\beta_{00}$: +$$ +\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle) +$$

+ +

Now you can employ superdense conding as usual.

+ +

Note: matrix description of above mentioned operations is $(\mathrm{I}\otimes\mathrm{Z})(\mathrm{I}\otimes\mathrm{X})$.

+ +

Here is a circuit for doing all mentioned above:

+ +

+ +

A first part prepares state $|\psi_0\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$. This is an initial state you questioned about. Second part changes $|\psi_0\rangle$ to $\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$, i.e. Bell state $\beta_{00}$. Now you can apply superdense coding as usual - this is symbolized by gates $\mathrm{X}$ and $\mathrm{Z}$ (of course, application of these gates depends on two bits you want to encode, e.g. for encoding string 00 you will apply neither gate). Last part is measuring in Bell basis - again usual part of superdense coding.

+",9006,,9006,,3/4/2020 14:48,3/4/2020 14:48,,,,4,,,,CC BY-SA 4.0 +10081,1,10084,,3/4/2020 13:59,,3,211,"

What will happen if the 'blackbox' function $f$ in Deutsch's algorithm is designed in such a way that it takes millions of years to deliver result if input is $x = 1$ and few seconds if the input is $x = 0$?

+ +

How long would it take the oracle $U_f$ to calculate $f$ for all inputs? My understanding is that $U_f$ has such quantum properties, that given a state $|\psi \rangle$ as a superposition of two qubits it will apply $U_f$ (and thus apply internally $f$) to each base state of $|\psi \rangle$ simultaneously.

+ +

In the scenario I've described $f$ will, however, take different execution times for different inputs. Will then there be a delay until all base states are evaluated by $ U_f$ (or more precisely by $f$)?

+",10264,,,,,3/4/2020 14:30,What happens with the oracle $U_f$ if you have different blackbox execution times for different inputs?,,1,0,,,,CC BY-SA 4.0 +10082,1,10085,,3/4/2020 14:00,,2,289,"

If I download calibration of a quantum processor on IBM Q website I see these parameters:

+ +
    +
  • T1
  • +
  • T2
  • +
  • frequency (GHz)
  • +
  • readout error
  • +
  • single qubit U2 error rate
  • +
  • CNOT error rate
  • +
+ +

T1 and T2 are relaxation and dephasing times, respectively.

+ +

What are the other parameters?

+",9006,,5955,,3/4/2020 14:26,3/4/2020 14:33,IBM Q calibration parameters,,1,0,,,,CC BY-SA 4.0 +10083,2,,10067,3/4/2020 14:14,,1,,"
    +
  1. The FermionicOperator, when its mapped to a Qubit Operator, indeed drops paulis that are below a given threshold. If you wanted to keep all the paulis, regardless of their weights then you could alter your local copy to comment the thresholding out in the one and two body mapping routines. As far as I am aware a weighted paulis list given to WeightedPauliOperator will be kept in its entirety. It has methods to simplify and chop but unless these are called the pauli list should be preserved.

  2. +
  3. The operator contains a list of paulis which you can retrieve. You could copy that and create a new operator with a modified list. I am not sure how dynamic you need this to be. VQE will build parameterized circuits which depend on the number of paulis (or pauli groups if using TensorProductBasis (TPB) operator). Adding or removing while VQE is running (were you to modify internals of VQE to add/remove dynamically would cause problems unless the parameterized circuit cache it holds was removed and rebuilt as needed). Given you keep the number of paulis the same you should be able to alter their weights within the given operator.

  4. +
+",9831,,9831,,3/4/2020 15:33,3/4/2020 15:33,,,,0,,,,CC BY-SA 4.0 +10084,2,,10081,3/4/2020 14:25,,3,,"

One implements $U_f$ with one circuit that acts on qubit(s) in the superposition state. This means that no matter what is the input (basis state in the superposition), we act on the qubits with the same circuit and it takes the same execution time (the same number of gates in the circuit) for all possible inputs. So, how I understand, the scenario of different times of execution depending on the inputs is not possible. We always apply the same set of gates that implement the $U_f$.

+",9459,,9459,,3/4/2020 14:30,3/4/2020 14:30,,,,4,,,,CC BY-SA 4.0 +10085,2,,10082,3/4/2020 14:26,,6,,"
    +
  • frequency (GHz): The frequency(energy) associated with the transition between the qubit's ground state ($|0\rangle$) and first excited state ($|1\rangle$).
  • +
  • readout error: The probability of preparing a $|0\rangle$($|1\rangle$) and measuring a $|1\rangle$($|0\rangle$), ie., of having an error in your readout
  • +
  • single qubit U2 error rate: The average error per gate of a single qubit gate, this is $1 - \mathrm{average\_gate\_fidelity}$.
  • +
  • CNOT error rate: The average error per gate of a two-qubit gate.
  • +
+",9863,,9006,,3/4/2020 14:33,3/4/2020 14:33,,,,2,,,,CC BY-SA 4.0 +10086,1,10087,,3/4/2020 15:27,,1,158,"

I am trying to set up my qiskit environment but I seem to have run in trouble that I have no idea how to solve. I have installed the qiskit packages as can be seen by running pip list:

+ +

+ +

however whenever I try to import qiskit.visualization an error occurs:

+ +

+ +

and I don't understand why since it was suppose to be installed as qiskit module is installed. Any idea where this error comes from?

+",5620,,5620,,3/4/2020 15:49,3/4/2020 15:49,Qiskit visualizations module not installed but qiskit package installed. Why?,,1,0,,,,CC BY-SA 4.0 +10087,2,,10086,3/4/2020 15:41,,3,,"

You are running a very old version of qiskit, I would recommending updating and this error should go away. You can do this by running pip install qiskit --upgrade

+",5955,,,,,3/4/2020 15:41,,,,3,,,,CC BY-SA 4.0 +10088,1,,,3/4/2020 15:55,,1,112,"

I have updated qiskit to the newest version using pip install qiskit --upgrade and all was done successfully, and when I write pip list on the command line I get:

+ +

+ +

As I should. But then I run help(""modules"") on a jupyter notebook and get:

+ +

+ +

which I don't understand why are there no other modules. And obviously import qiskit throws an error as well. Any idea how to solve this?

+ +

PS: This is a follow-up from this question

+",5620,,,,,3/4/2020 16:06,"Why doesn't qiskit appear in ""help(""modules"")"" even though it is installed in python environment?",,1,9,,,,CC BY-SA 4.0 +10089,2,,10088,3/4/2020 16:06,,-2,,"

A workaround to fix this is to manually add the qiskit install location to your python path in the notebook. You can find the path by running pip show qiskit in a terminal, which will return a field called Location. In the notebook then add the following lines

+ +
import sys
+sys.path.append('the location')
+
+",5955,,,,,3/4/2020 16:06,,,,2,,,,CC BY-SA 4.0 +10091,2,,10077,3/4/2020 17:26,,2,,"

Here is an example of creating a doubly controlled version of the simplest circuit with one gate (Qiskit's $u1$ gate).

+ +
from qiskit import *
+from qiskit.aqua.utils.controlled_circuit import get_controlled_circuit
+import numpy as np
+
+q_reg = QuantumRegister(3, 'q')
+qc_u1 = QuantumCircuit(q_reg)
+qc_cu1 = QuantumCircuit(q_reg)
+qc_ccu1 = QuantumCircuit(q_reg)
+
+qc_u1.u1(np.pi/2, q_reg[0])
+
+qc_cu1 = get_controlled_circuit(qc_u1, q_reg[1])
+
+qc_ccu1 = get_controlled_circuit(qc_cu1, q_reg[2])
+
+print(qc_cu1.qasm())
+print(qc_ccu1.qasm())
+
+ +

And yes, even for this simplest gate, the printed result looks horrible XD (a lot of gates), because it uses generic procedures to create the controlled version of the given circuit. Maybe optimizing the circuit at the end will reduce the gate number and make it a more readable circuit.

+ +

Just an answer about the doubly controlled circuit, don't know much about the links and the problem that you have introduced.

+",9459,,9459,,3/4/2020 17:42,3/4/2020 17:42,,,,5,,,,CC BY-SA 4.0 +10092,1,10093,,3/4/2020 18:30,,-1,50,"

When you have a quantum circuit and use QuantumCircuit.data you get a list with objects of this type (this is the one for a X gate acting on qubit 0 y a 2 qubits Quantum Circuit):

+ +

(qiskit.extensions.standard.x.XGate object at 0x0000019B8DEC2EB8, [Qubit(QuantumRegister(2, 'q'), 0)], [])

+ +

The first element represents the operation. What does the sequence of digits 0x0000019B8DEC2EB8 mean? I suppose it has something to do with the location or the time, but I do not know how to obtain each digit. I need to know exactly how to reproduce one of these sequences myself.

+ +

Thank you so much in advance.

+",9887,,55,,10/28/2020 9:23,10/28/2020 9:23,What do the numbers of the operation object in QuantumCircuit.data outputs?,,2,0,,,,CC BY-SA 4.0 +10093,2,,10092,3/4/2020 19:04,,0,,"

That is the address in memory (represented as a hexademical number) of that specific gate object. It can be used to differentiate that specific X gate object from a different X gate object. Other than that it general is not useful, and it's definitely not something you would ever need to manually reproduce.

+",5529,,,,,3/4/2020 19:04,,,,1,,,,CC BY-SA 4.0 +10094,2,,10092,3/4/2020 19:09,,1,,"

These numbers are memory addresses of the Gate objects in python. Instances of any python class will have them (though they may not always be shown):

+ +
>>> class B():
+...   def __init__(self):
+...     pass
+...
+>>> B()
+<__main__.B object at 0x106e63d30>
+>>> B()
+<__main__.B object at 0x106e63da0>
+
+ +

They don't have any meaning in the context of the QuantumCircuit and they'll essentially be random every time you recreate your circuit. (Really, they shouldn't be included in the display of the Gate object).

+ +

Why do you need to know how to reproduce these sequences? There's probably another way to accomplish your goal.

+",10274,,,,,3/4/2020 19:09,,,,1,,,,CC BY-SA 4.0 +10096,1,,,3/4/2020 20:52,,1,48,"

I had written earlier to propose an econometric modeling application that may lend itself to a quantum computing approach, and was asking how best to proceed.

+ +

The model would be centered around the interdependencies of industries within an economy. This approach, known as input-output economic modeling, is used to quantify the output of an industrial sector given inputs from a another sector. As the inputs/outputs change over time, the result is change in demand, which in turn provides a measure of industrial sector's well-being.

+ +

The recent Black Swan event that caused an unimaginable labor crisis for the chief provider of the economy's supply chain, has shed new light on the risk of outsourcing dependency, and the effect on global economics. This is new territory. So, the question becomes: How can we monitor the global industrial interdepencies in a timely fashion to create a valuable commercial early warning system? Given the stochastic nature of the problem, I imagined input-output econometric modeling might provide a leaping off point for an application suited to this new computing approach.

+ +

Does this make sense?

+ +

Thank you

+ +

Rich Z

+",10275,,9006,,3/6/2020 19:23,3/6/2020 19:23,Application Query,,0,1,,3/4/2020 22:30,,CC BY-SA 4.0 +10097,2,,10028,3/5/2020 3:46,,2,,"

You can use D-Wave leap. +It is free for sign up, and you can get trial access time.

+",9563,,,,,3/5/2020 3:46,,,,0,,,,CC BY-SA 4.0 +10098,1,,,3/5/2020 12:54,,7,643,"

If a given quantum circuit has $n$ qubit inputs and a certain number of gates, how can we represent the whole circuit in matrix form? Here's an example:

+ +

+ +

I am sorry, I am confused on how to express the circuit above in matrix form. Especially on how I'll be a able to take into consideration the circuit lines affected by a Toffoli gate? How does the matrix representation of the first Toffoli gate (read from left to right) differ to the matrix representation of the second Toffoli gate since they have different control and target lines. Also what's the difference of the matrix representation of the NOT gate applied to the first circuit line to a NOT gate applied to the second line?

+ +

Thank you.

+",10282,,55,,3/5/2020 23:07,3/6/2020 11:19,How to represent an $n$-qubit circuit in matrix form?,,2,1,,,,CC BY-SA 4.0 +10099,1,,,3/5/2020 18:58,,5,190,"

(This is basically a reference request)

+ +

I am wondering if there are any results out there on to what accuracy a given unitary can be approximated with an element drawn from a t-design.

+ +

To elaborate a bit, consider the Haar measure over $U(d)$. This integrates over all the unitaries in $U(d)$. So we could say that given some fixed unitary $U_0$, there is an element in the set of unitaries integrated over by the Haar measure which approximates $U_0$ well (this is trivial of course, since $U_0$ itself occurs in the integration).

+ +

Now consider a $t$-design. The $t$-design is a finite set of unitaries which has some special properties - namely summing over that set approximates doing a Haar integral. Heuristically, the set of unitaries in the $t$-design looks like the full set of unitaries. So now given some specific unitary $U_0\in U(d)$, is it the case that some element of the $t$-design must be close to $U_0$?

+",8468,,16606,,6/4/2022 12:47,6/4/2022 12:47,Approximating unitaries with elements from a t-design,,1,5,,,,CC BY-SA 4.0 +10100,2,,10098,3/5/2020 19:19,,6,,"

The overall matrix can be built from the knowledge of the matrices representing each element of the circuit (in your example, the Toffoli and single-qubit gates) by simple matrix multiplication.

+ +

To obtain the matrix representation of a Toffoli gate acting between three qubits, a good way to start is by first writing down its bra-ket representation. This amounts to writing down how the gate operates on the various elements of the computational basis. +In this case, this would amount to

+ +
    +
  1. List all the elements of the computational basis of five qubits, that is, all bit-strings of length $5$: $|00000\rangle,|00001\rangle,|00010\rangle$ etc.
  2. +
  3. Determine how the gate under consideration acts on each one of these states. For example, the first Toffoli in the circuit sends $|00000\rangle$ to $|00000\rangle$, but $|11000\rangle$ to $|11100\rangle$.
  4. +
  5. Write down the operation as a sum of operators of the form $|q_p\rangle\!\langle p|$, where $|p\rangle$ ranges over all computational basis elements, and $q_p$ is the element obtained by acting with the gate over $|p\rangle$.
  6. +
+ +

To obtain the matrix representation, you now build the matrix whose $p$-th column has a single $1$ at the position $q_p$ (note that the bra-ket representation of the gate is not actually necessary here, it's just a way to write down the action of the gate in a systematic way, but can be skipped once you are familiar with the process).

+ +

For example, the action of the first Toffoli gate in your circuit can be written as +$$ + |11100\rangle\!\langle 11000| + |11000\rangle\!\langle 11100| + (\text{identity over all other elements}). +$$ +The matrix representation is then the matrix which only differs from the diagonal by its acting off-diagonally in the positions corresponding to $|11000\rangle$ and $|11100\rangle$. Note that which positions correspond to these states partly depends on the notation you are using. A standard notation is to list computational basis states as if you were counting in binary, so $|00000\rangle\to 0$, $|00001\rangle\to 1,...,|11000\rangle\to 2^4 + 2^3=24$, etc.

+ +

This trick will work to find the matrix representation of any gate which acts as a permutation over computational basis elements.

+",55,,,,,3/5/2020 19:19,,,,0,,,,CC BY-SA 4.0 +10101,1,10104,,3/5/2020 20:38,,2,82,"

In his essay ""Why now is the right time to study quantum computing"" Aram Harrow writes, after describing the action of the $\sqrt{NOT}$ gate, that:

+ +
+

However, if we apply $\sqrt{NOT}$ a second time before measuring, then we always obtain the outcome 1. This demonstrates a key difference between quantum superpositions and random mixtures; placing a state into a superposition can be done without any irreversible loss of information.

+
+ +

I'm confused by what he meant here. How does the existence of a $\sqrt{NOT}$ gate in quantum computation demonstrate a difference in irreversibility as opposed to classical computation?

+",5710,,9006,,3/5/2020 22:16,3/6/2020 0:30,What does the $\sqrt{NOT}$ gate have to do with irreversibility?,,3,0,,,,CC BY-SA 4.0 +10102,2,,10101,3/5/2020 21:51,,3,,"

He's saying that there is a unitary matrix $U$ (quantum operation) with the property that $U^2$ is a bit flip, but there is no stochastic matrix (random operation) $S$ such that $S^2$ is a bit flip.

+ +

In terms of reversibility, the key thing is that the state $U|0\rangle$ is perpendicular to the state $U|1\rangle$ for any $U$. For classical operations that is not always true. For example, for the ""coin flip"" operation $S$ it is the case that $S|0\rangle = S|1\rangle$. This implies that there can be no inverse operation $S^\dagger$ such that $\forall k: S^\dagger S|k\rangle = |k\rangle$.

+",119,,119,,3/5/2020 23:47,3/5/2020 23:47,,,,1,,,,CC BY-SA 4.0 +10103,1,,,3/5/2020 22:55,,4,121,"

The Solovay-Kitaev theorem shows that we can approximate arbitrary unitary transformations with polynomially many quantum gates. Can we approximate the resulting state vectors in the same way by specifying the quantum states of pairs (or possibly more) of qubits? I.e. if we have $\psi_{i,j}$ be the approximate state of the qubits $i$ and $j$, is this enough to approximate the entire quantum state?

+ +
+ +

Cross-posted on physics

+",9305,,55,,3/6/2020 9:20,3/6/2020 9:20,Is there an analog for the Solovay-Kitaev Theorem for approximating quantum states?,,0,2,,,,CC BY-SA 4.0 +10104,2,,10101,3/6/2020 0:23,,2,,"

I wouldn't say it's the existence of the $\sqrt{NOT}$ gate that demonstrates reversibility per se. It's the specific example that Harrow is using.

+ +

When you measure the output of applying a $\sqrt{NOT}$ gate to a $|0\rangle$, it looks just like a coin flip. It could be either $|0\rangle$ or $|1\rangle$ with a 50% chance. So far, nothing has been demonstrated that a random mixture can't do. A random mixture is perfectly capable of replacing a single bit with the results of a coin flip.

+ +

When you apply $\sqrt{NOT}$ a second time, the $\sqrt{NOT}$ gate recovers the initial information. But recovering information would be impossible if there was simply a random mixture. That's the demonstration of the key difference between superposition and random mixture. Information used in the creation of a superposition can be recovered; information lost in a random mixture cannot be.

+",9995,,,,,3/6/2020 0:23,,,,0,,,,CC BY-SA 4.0 +10105,2,,10101,3/6/2020 0:30,,3,,"

The point is just that the gate $U := \sqrt{\rm{NOT}}$ naively appears to to scramble all the information about an initial classical state, because it takes both the initial states $|0\rangle$ and $|1\rangle$ to states that have 50/50 probabilities of being measured to 0 or 1. So classically, one would expect that these superposition states $U|0\rangle$ and $U|1\rangle$ would be identical, and that the procedure that prepared them - applying the gate $U$ to a computational basis state - would have irreversably erased all the information about the initial state. But the secret sauce of quantum coherence - i.e. the different relative complex phases in the amplitudes - means that the apparently-scrambled states $U|0\rangle$ and $U|1\rangle$ are actually physically distinct, and applying the gate $U$ again makes the apparently-erased information ""reappear"" by transforming the apparently-identical states into manifestly distinct states. The point is that unitary operations like $U$ never actually destroy any information about the initial state, even if they might naively appear to.

+",551,,,,,3/6/2020 0:30,,,,0,,,,CC BY-SA 4.0 +10106,2,,10098,3/6/2020 11:04,,4,,"

As mentioned in answer by qIS, you should decompose the circuit to steps. In case no gate is applied in the circuit, you have to replace this empty place with identity operator $I$ acting on one qubit.

+ +

Note, that symbol $CCNOT$ is used for Toffoli gate.

+ +

Here are matrices describing each step:

+ +
    +
  1. $S_1 = I \otimes X \otimes I \otimes I \otimes I$
  2. +
  3. $S_2 = CCNOT \otimes I \otimes I$
  4. +
  5. $S_3 = X \otimes X \otimes I \otimes I \otimes I$
  6. +
  7. $S_4 = CCNOT_{1,2 \rightarrow 4} \otimes I $. Matrix $CCNOT_{1,2 \rightarrow 4}$ is a Toffoli gate controlled by first and second qubit but acting on fourth qubit. If you follow construction proposed by qIS you will get matrix shown below.
  8. +
  9. $S_5 = I \otimes I \otimes X \otimes X \otimes I$
  10. +
  11. $S_6 = I \otimes I \otimes CCNOT$
  12. +
+ +

The last step to obtain matrix desribing whole circuit is to do matrix multiplication $S_{6}S_{5}S_{4}S_{3}S_{2}S_{1}$.

+ +

Matrix $CCNOT_{1,2 \rightarrow 4}$:

+ +

+",9006,,9006,,3/6/2020 11:19,3/6/2020 11:19,,,,0,,,,CC BY-SA 4.0 +10107,1,10108,,3/6/2020 11:54,,2,137,"

I am running vqe algorithm in qasm_simulator and cannot get the optimal solution. +Are there any methods for finding the optimal value of depth for variational form and max_iter for optimizer parameters? What exactly does the depth parameter?

+",10234,,,,,3/6/2020 13:45,Finding optimal values of depth and max_trials parameters in vqe algorithm,,1,4,,,,CC BY-SA 4.0 +10108,2,,10107,3/6/2020 13:45,,1,,"

Depth is the number of repetitions of the basic circuit of the variational form. By adding more repetitions the expectation is that it can cover a larger part of the Hilbert space and hopefully include the solution space that a shallower one could not. Now each basic circuit has parameters so it can be varied. Adding more repetitions adds more parameters and results in a larger parameter space for the optimization which thus can get more difficult for the optimizer as it increases.

+ +

max_trials is used by SPSA that you are using. You may need to increase this number to allow the optimizer enough to find a minimum. SPSA will always go to that limit before returning.

+ +

I take it the solution is found ok on a state_vector simulator, its just when you try qasm simulator that you are having difficulty finding the solution.

+",9831,,,,,3/6/2020 13:45,,,,1,,,,CC BY-SA 4.0 +10109,1,10124,,3/6/2020 23:08,,2,507,"

I am trying to wrap my head around he quantum_info module on qiskit, since most of the functions on qiskit.tools are going to be deprecated, but I am very confused with the Statevector and DensityMatrix objects. For example, with this snippet of code:

+ +
simulator = BasicAer.get_backend('statevector_simulator') # the device to run on
+result6 = execute(circuit6, simulator).result()
+outputstate6 = result6.get_statevector(circuit6, decimals=3)
+probability = np.abs(np.array(outputstate6))**2
+outstatevector=quantum_info.states.Statevector(outputstate6)
+print(type(outstatevector))
+print(type(outputstate6))
+print(outputstate6)
+print(quantum_info.entropy(outputstate6))
+
+ +

I get:

+ +
<class 'qiskit.quantum_info.states.statevector.Statevector'>
+<class 'numpy.ndarray'>
+[0.447+0.j 0.   +0.j 0.632+0.j 0.632+0.j]
+
+ +

as expected but then I get the error on quantum_info.entropy(outputstate6):

+ +
QiskitError: 'Input quantum state is not a valid'
+
+ +

How can I solve this?

+",5620,,55,,10/28/2020 9:22,10/28/2020 9:22,How to calculate the Von Neuman entropy on qiskit with the module quantum_info?,,1,2,,,,CC BY-SA 4.0 +10110,1,10112,,3/7/2020 5:47,,4,1324,"

I have a quick question: Is the qubit state $|\psi\rangle$ the same as $-|\psi\rangle$?

+",9835,,2879,,3/7/2020 8:12,3/13/2020 18:47,Negative of a qubit state,,3,3,,,,CC BY-SA 4.0 +10111,2,,10110,3/7/2020 7:34,,6,,"

Yes.

+ +

The factor $e^{i\phi}$ of the state $e^{i\phi}|\psi\rangle$ (which in this case is $-1$) is called a ""global phase"". It does not have physically observable consequences (i.e., you can not come up with an experiment to figure out what the global phase of a state is) and can be safely ignored.

+",2879,,,,,3/7/2020 7:34,,,,0,,,,CC BY-SA 4.0 +10112,2,,10110,3/7/2020 7:36,,9,,"

States $|\psi\rangle$ and $-|\psi\rangle$ differ in global phase only and thus they are indistinguishable. So, the answer is: state $-|\psi\rangle$ is the equivalent to $|\psi\rangle$.

+ +

The global phase in this case is $\pi$ because $\mathrm{e}^{i\pi} = -1$.

+",9006,,9006,,3/13/2020 18:47,3/13/2020 18:47,,,,6,,,,CC BY-SA 4.0 +10113,2,,10110,3/7/2020 8:43,,7,,"

They are physically indistinguishable, also their density matrices are the same because $$\big(-|\psi\rangle\big)\big(-\langle\psi|\big) = |\psi\rangle \langle\psi|$$ +But mathematically they are two different vectors. And it's better to not forget about this when doing calculations.

+",5870,,,,,3/7/2020 8:43,,,,1,,,,CC BY-SA 4.0 +10115,1,10117,,3/7/2020 19:48,,3,1589,"

The question is quite straightforward, I have some two qubit state and I want to measure it in the Bell basis. This question answers me partly, but I still have some doubts because, I thought that just reversing back the transformation would give me the desired mapping from:

+ +

$$ +|\Phi^+\rangle \to |00\rangle \\ +|\Phi^-\rangle \to |01\rangle \\ +|\Psi^+\rangle \to |10\rangle \\ +|\Psi^+\rangle \to |11\rangle \\ +$$

+ +

but it does't seem to work as I thought it would:

+ +

+

+ +

By doing the math I understand that it should give this, but what I don't understand is my reasoning to why it is so. That is, why was I wrong thinking that the above circuit would return all the measurements in the $|00\rangle$?

+",5620,,,,,3/8/2020 22:40,How to measure in the bell basis?,,2,0,,,,CC BY-SA 4.0 +10116,1,10122,,3/7/2020 19:53,,4,956,"

I understand that given a pure state $ |\psi\rangle$, we can express it in terms of two angles $\theta$ and $\varphi$ such that $|\psi\rangle = \cos(\theta/2)|0\rangle + \mathrm{e}^{i\varphi}\sin(\theta/2)|1\rangle $, and this is derived by converting from $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$ into their representations in terms of $r\mathrm{e}^{i\theta}$, and then factoring and rearranging that.

+ +

But how do I convert between the two representations given arbitrary states? I know that $|0\rangle = (\theta,\varphi) = (0,0), |1\rangle = (\pi,0), |+\rangle = (\pi/2, 0)$ etc, but how do I get it for an arbitrary state $|\psi\rangle$?

+ +

So far, I have:

+ +
    +
  1. If $\alpha$ is complex, shift the entire state by phase $\bar{\alpha}$, where $\bar\alpha$ is the complex conjugate of $\alpha$, to end up with $\alpha\bar\alpha |0\rangle + \bar\alpha\beta|1\rangle$
  2. +
  3. Use the formulas:
  4. +
+ +

$$ +\theta = 2 \arccos(\alpha\bar\alpha) \\ +\varphi = ??? +$$

+",10304,,55,,11/13/2021 1:42,11/13/2021 1:42,How to get the Bloch sphere angles given an arbitrary qubit?,,1,4,,,,CC BY-SA 4.0 +10117,2,,10115,3/7/2020 20:08,,1,,"

I have found my mistake, and hopefully it may help more people. It lies on the fact that $(AB)^\dagger=B^\dagger A^\dagger$. Having done so, my result is as expected. But any more enlightening answer is more than welcome.

+",5620,,,,,3/7/2020 20:08,,,,0,,,,CC BY-SA 4.0 +10118,2,,10115,3/7/2020 23:38,,1,,"

Generally, if you want to inverse a quantum algorithm you simply read it from other side and replace all quantum gates with their inverses, i.e. conjugate transposed operators.

+ +

So, if your original algorithm is described by series of gates $A_{n}A_{n-1}\dots A_2A_1$, the inverse algorithm is $A_{1}^\dagger A_{2}^\dagger \dots A_{n-1} ^\dagger A_{n} ^\dagger $.

+ +

In your case, you use an algorithm $CNOT(H\otimes I)$ for transforming initial state to Bell state. So, to measure in Bell basis you have to applied inverse $(H^\dagger\otimes I^\dagger)CNOT^\dagger = (H\otimes I)CNOT$ because $I^\dagger=I$, $H^\dagger = H$ and $CNOT^\dagger = CNOT$.

+ +
+ +

Added by Davit Khachatryan:

+ +

Also, if one has an arbitrary quantum state in the Bell basis:

+ +

$$ +|\psi \rangle = c_{\Phi^+}|\Phi^+\rangle + c_{\Phi^-}|\Phi^-\rangle + c_{\Psi^+}|\Psi^+\rangle + c_{\Psi^-}|\Psi^-\rangle +$$

+ +

where $c_{\Phi^+}$, $c_{\Phi^-}$, $c_{\Psi^+}$ and $c_{\Psi^-}$ are the corresponding aplitudes in the Bell basis. After applying $(H\otimes I)CNOT$ we will have:

+ +

$$ +|\psi \rangle = c_{\Phi^+}|00\rangle + c_{\Phi^-}|10\rangle + c_{\Psi^+}|01\rangle + c_{\Psi^-}|11\rangle +$$

+ +

Note that $c$ coefficients that were in correspondence with Bell states now correspond to the computational states. So, this is letting us have the mapping from Bell states to computational states.

+",9006,,9459,,3/8/2020 22:40,3/8/2020 22:40,,,,0,,,,CC BY-SA 4.0 +10119,1,,,3/8/2020 0:47,,1,104,"

I implemented a solver for the Job Shop Problem, based on quantum annealing, on a D-Wave machine.

+ +

I have a problem, that even though minimal energy solutions exist, they are only chosen once. I set the nbr of reads to 1000, but the responses still look like this:

+ +
0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 ... 41 energy num_oc. ...
+0    1  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0 ...  1 -144.0       1 ...
+1    0  1  0  0  0  0  0  0  0  0  0  0  0  0  1  0 ...  1 -136.0       1 ...
+2    1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0 ...  1 -134.0       1 ...
+15   1  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0 ...  0 -133.0       1 ...
+16   1  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 ...  0 -133.0       1 ...
+138  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0 ...  0 -131.0       1 ...
+3    1  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0 ...  1 -129.0       1 ...
+4    0  1  0  0  0  0  0  0  0  0  0  1  0  0  0  0 ...  0 -127.0       1 ...
+
+ +

Should't the lowest energy solution, get picked more than once, just by chance?

+ +

On multiple runs, I now always get a different, kind of random result it seems.

+ +

I tried playing around with the chain strength, up to a point where no chains are breaking anymore, so I think it should be at a good spot right now.

+ +

Do you have any idea, what the issue might be?

+",9950,,,,,3/8/2020 17:34,Quantum Annealing - Random results on big N,,1,0,,,,CC BY-SA 4.0 +10120,1,,,3/8/2020 5:57,,2,26,"

I am trying to understand the random quantum circuit sampling arguments for recent Google experiment, but struggling to understand why there exists a family of quantum circuit whose output distribution is #P-hard to calculate exactly. Papers in this topics just show how to reduce average case random circuit sampling to exact random circuit sampling, but does not provides details of the #P-hardness of exact quantum circuit sampling. Could anybody provide detailed arguments for the fact that there exists a family of quantum circuit whose output distribution is #P-hard to calculate exactly?

+ +

Thanks.

+",10307,,,,,3/8/2020 5:57,How do we know that there exists a quantum circuit whose output distribution is #P-hard to calculate?,,0,0,,,,CC BY-SA 4.0 +10121,1,,,3/8/2020 14:53,,2,63,"

Given some partial states $\rho_{AB}$ and $\sigma_{AC}$, is there a general procedure to construct a state $\delta_{ABC}$ such that the following sum of trace distances

+ +

$$||\text{Tr}_C(\delta_{ABC}) - \rho_{AB}||_1 + ||\text{Tr}_B(\delta_{ABC}) - \sigma_{AC}||_1$$

+ +

is minimal? That is we want a joint state that under partial traces is as close as possible to some given targets. In particular, when there is entanglement in both $AB$ and $AC$, I'm not sure how to proceed.

+",4831,,,,,3/9/2020 14:13,"Given partial states, can one construct the best estimate of the full state?",,1,0,,,,CC BY-SA 4.0 +10122,2,,10116,3/8/2020 15:09,,3,,"

As in if given $ |\psi\rangle=\alpha |0\rangle+\beta |1\rangle$, and you want it in the form $\cos(\theta/2) |0\rangle+e^{i\phi}\sin(\theta/2) |1\rangle$?

+ +

Assume the state is normalised $|\alpha|^2+|\beta|^2=1$.

+ +

I'd first start by multiplying by $\frac{\alpha^*}{|\alpha|}$ which is a phase (complex number unit length), and use $\alpha \alpha^*=|\alpha|^2$.

+ +

$$\frac{\alpha^*}{|\alpha|}|\psi\rangle=|\alpha| |0\rangle+\frac{\beta\alpha^*}{|\alpha|}|1\rangle =\cos(\theta/2) |0\rangle+e^{i\phi}\sin(\theta/2) |1\rangle$$

+ +

So $\theta=2\arccos(|\alpha|)$ or $\theta=2\arcsin(|\beta|)$.

+ +

Then $\frac{\beta\alpha^*}{|\alpha|}=e^{i\phi}|\beta|$ or $\frac{\beta\alpha^*}{|\alpha||\beta|}=e^{i\phi}$,

+ +

so that $\phi=\arg\left(\frac{\beta\alpha^*}{|\alpha||\beta|}\right)$ and it depends on how you want to calculate that, which branch of the loagarithm to take/where to measure angles from.

+ +

You could do something like $\phi=-i\ln\left(\frac{\beta\alpha^*}{|\alpha||\beta|}\right)$ etc.

+ +

In summary try

+ +

$$ +\theta = 2 \arccos(|\alpha|) \\ +\varphi = \arg\left(\frac{\beta\alpha^*}{|\alpha||\beta|}\right) +$$

+",197,,,,,3/8/2020 15:09,,,,2,,,,CC BY-SA 4.0 +10123,1,,,3/8/2020 15:18,,3,89,"

I would like to understand why two qubit gates are generally more noisy.

+ +

If I am interested in single qubit gates, I can have an effective modelling as a master equation:

+ +

$$\dot{\rho}=\frac{1}{i \hbar} [H,\rho]+\gamma \mathcal{D}[\sigma_-] \rho +\gamma^* \mathcal{D}[\sigma_z] \rho$$

+ +

The rate of noise is roughly: $\gamma+\gamma^*$

+ +

With $H=\frac{\hbar \Omega}{2} \sigma_y $ for a $y$ rotation in the interaction picture.

+ +

For a two qubit gate, I would expect a simple model like:

+ +

$$\dot{\rho}=\frac{1}{i \hbar} [H,\rho]+\gamma \left(\mathcal{D}[\sigma^1_-]+\mathcal{D}[\sigma^2_-]\right) \rho +\gamma^* \left( \mathcal{D}[\sigma^1_z] + \mathcal{D}[\sigma^2_z]\right) \rho$$

+ +

With $H=\frac{\hbar g}{2} \left( \sigma_1^+ \sigma_2^-+\sigma_1^- \sigma_2^+ \right)$

+ +

My question is:

+ +

Why are two qubit gates generally noisier ?

+ +

Indeed here with this simple model I would expect the rate noise to simply be $2(\gamma+\gamma^*)$. Thus twice as the one for the single qubit gate. But at the same time we have two qubits so ""per qubit"" the rate of noise is the same.

+ +

Are two qubits gate noisier because they rotate slower ?

+ +

I would like a justified answer (with references) in the context of superconducting qubits.

+",5008,,,,,3/8/2020 15:18,Why are two qubits gates more noisy?,,0,2,,,,CC BY-SA 4.0 +10124,2,,10109,3/8/2020 15:58,,3,,"

Short answer

+ +

You are getting that error because your example does not use a valid (normalized) statevector. If you remove the decimals=3 kwarg where you call result.get_statevector it will work.

+ +

Long Answer

+ +

The Von-Neuman entropy function in the qiskit.quantum_info works with either Statevector or DensityMatrix object inputs, or inputs that can be implicitly converted to those objects (ie a list or np.array for a vector or a square matrix). So you can do any of the following for example:

+ + + +
import numpy as np
+from qiskit.quantum_info import entropy, Statevector, DensityMatrix
+
+# Pure state entropy (Note this is always 0)
+# The following are equivalent:
+
+s1 = entropy([1, 0, 0, 0])  # Statevector as list
+s2 = entropy(np.array([1, 0, 0, 0])) # Statevector as array
+s3 = entropy(Statevector([1, 0, 0, 0]))  # Statevector object
+
+print(s1, s2, s3)
+
+# Mixed state entropy
+# The following are equivalent
+
+s1 = entropy([[0.75, 0], [0, 0.25]])  # Density matrix as list
+s2 = entropy(np.array([[0.75, 0], [0, 0.25]])) # density matrix as array
+s3 = entropy(DensityMatrix([[0.75, 0], [0, 0.25]]))  # Density matrix object
+
+print(s1, s2, s3)
+
+ +

As for your specific issue: the entropy is only well-defined for a valid quantum state, so the function checks the input state is valid. In the case of a statevector this is checking it has norm 1, in the case of a density matrix that it is trace 1 and postive-semidefinite.

+ +

Your example does not have a norm-1 input state because you truncated the decimals when you got the output state from the simulator. You can check this using the statevector object for example:

+ +
# Returns True:
+Statevector([1 / np.sqrt(2), 1 / np.sqrt(2)]).is_valid()
+
+# Returns False:
+Statevector([0.707, 0.707]).is_valid()
+
+ +

Entropy base: Another thing you should keep in mind if you didn't already notice is that the qiskit.quantum_info.entropy function takes logarithms in base 2 by default (and you can use a different base using the base kwarg). The deprecated qiskit.tools.qi.entropy function was always taken in log base e:

+ + + +
import numpy as np
+from qiskit.quantum_info import entropy
+from qiskit.tools.qi import entropy as old_entropy
+
+rho = [[0.75, 0], [0, 0.25]]
+
+s1 = entropy(rho)  # base-2
+s2 = entropy(rho, base=np.e)  # base-e
+s3 = old_entropy(rho)  # base-e
+
+print(s1, s2, s3, s2 == s3)
+```
+
+",8650,,,,,3/8/2020 15:58,,,,0,,,,CC BY-SA 4.0 +10125,2,,10119,3/8/2020 17:34,,1,,"

There is no guarantee the lowest energy solution get picked more often, or even get picked once.

+ +

Many parameters may be tweaked in order to improve your results. I am not sure if you are running time parameters by default but you may tweak more the times (like longer annealing time...).

+ +

Secondly, it may be the case that this problem corresponds to a hard one for the annealer (requires too many qubits when embedding your problem, or/and that this problem has a minimal spectral gap very small where it is more for quantum annealing...). Maybe what you could do is try fixing a few variables from the exact solution, and see if you still miss too often the exact solution. You may also have mistakes when setting your problem as a QUBO, which I would recommend debugging it well in order to be sure.

+ +

Finally, you may try a good classical heuristic for this problem and check you find a good solution, and see if the annealer improves against it.

+",4127,,,,,3/8/2020 17:34,,,,7,,,,CC BY-SA 4.0 +10126,1,,,3/8/2020 21:30,,5,449,"

Let $|\Omega \rangle$ be the maximally entangled state over a bipartite system whose parts are each dimension $d$, i.e. +$$ +| \Omega \rangle \equiv \sum_i^{d}| ii \rangle +$$

+ +

Then one way of writing the Choi representation $J(\Phi)$ of a channel $\Phi: \mathbb{C}^{d\times d} \rightarrow \mathbb{C}^{d\times d}$ that acts on density operators $\rho \in \mathbb{C}^{d \times d}$ is: +$$ +J(\Phi) \equiv (I \otimes \Phi )| \Omega \rangle \langle \Omega | +$$

+ +

If I choose $\Phi_U$ to be a unitary channel (i.e. $\Phi_U (\rho ) = U\rho U^\dagger$) then its Choi representation in this notation would be: +$$ +J(\Phi_U) \equiv (I \otimes U)| \Omega \rangle \langle \Omega |(I \otimes U^\dagger) +$$

+ +

My question is, is there an explicit way to represent compositions of unitaries in terms of the unitaries' respective Choi representations? In other words, if $\Phi_{U\circ V}(\rho) \equiv UV\rho (UV)^\dagger$, how can I ""nicely"" represent $J(\Phi_{U \circ V})$, for example in terms of $J(\Phi_U)$ and $J(\Phi_V)$ and linear operations in $\mathbb{C}^{d^2 \times d^2}$?

+",1939,,55,,9/3/2020 15:03,11/11/2020 14:36,Explicit form for composition of Choi representation quantum channels,,2,1,,,,CC BY-SA 4.0 +10127,1,10130,,3/9/2020 0:39,,3,706,"

Again, I am new to quantum computing and have a CS background, so apologies if this seems like an obvious question or if I seem unclear. $\newcommand{\braket}[1]{\langle #1 \rangle}\newcommand{\bra}[1]{\langle #1 |}\newcommand{\ket}[1]{| #1 \rangle}$

+ +

Let $U_l = \text{exp}(i\frac{\pi}{4}l(z)X)$ where $X$ is the pauli $\sigma_x$ gate and $l(z)$ is either $+1$ or $-1$

+ +

The paper that I've been reading claims that $$U_l^{\dagger}YU_l = \cos(\frac{\pi}{2}l(z))Y + \sin(\frac{\pi}{2}l(z))Z$$ where $Y$ is the pauli $\sigma_{y}$ gate and $Z$ is $\sigma_z$

+ +

Finally, they conclude that $$\bra{z,0}U_l^{\dagger}YU_l\ket{z,0} = \sin(\frac{\pi}{2}l(z)) = l(z)$$ , where $z = z_1,...,z_n$

+ +

When I try this myself, I don't get the same result and I am not able to spot my mistake. Here's my approach:

+ +

$U_l = \text{exp}(i\frac{\pi}{4}l(z)X) = I + e^{i\frac{\pi}{4}l(z)}X$ where $I$ is the identity matrix

+ +

Thus, I have that $$U_l^{\dagger}Y = Y + ie^{-i\frac{\pi}{4}l(z)}Z$$ and therefore $$U_l^{\dagger}YU_l = -ie^{i\frac{\pi}{4}l(z)}Z + ie^{-i\frac{\pi}{4}l(z)}Z$$ which, when we apply Euler's formula, reduces to: $$2\sin(\frac{\pi}{4}l(z))Z$$ which doesn't seem to be correct.

+ +

Could you please help me out? I've been stuck on it for a couple of days now.

+",9407,,2149,,3/9/2020 22:34,3/10/2020 7:44,Similarity Transformations on Pauli Operators in 2-qubit states (eq. 11 - Farhi's QNN Paper),,3,3,,,,CC BY-SA 4.0 +10128,1,10139,,3/9/2020 5:53,,3,580,"

I know there is a documentation for qiskit.aqua.algorithms.Shor that explains that they used this reference for implementing the actual circuit. It says that the number of qubit needed is 2n+3. So to factor N=15, 11 qubits would be needed. I decided to test this using Qiskit with a backend that has up to 15 qubits. But then I get an error saying that I needed 18 qubits to factor N = 15. Is the implementation different from the actual paper referenced? or am I missing something ?

+ +

This is the code I used to factor N=15

+ +
shor = Shor(15,2)
+backend = provider.get_backend('ibmq_16_melbourne')
+quantum_instance = QuantumInstance(backend, skip_qobj_validation=False)
+res = shor.run(quantum_instance)
+print(""The list of factors of {} as computed by Shor is {}."".format(PRIME, res['factors'][0]))
+
+ +

And this is the error i got

+ +
TranspilerError: 'Number of qubits (18) in circuit1 is greater than maximum (15) in the coupling_TranspilerError: 'Number of qubits (18) in circuit1 is greater than maximum (15) in the coupling_map'
+
+",10280,,4127,,3/9/2020 7:04,3/9/2020 12:30,How many Qubits does the qiskit implementation of Shor's Algorithm need to factor N=15?,,1,2,,,,CC BY-SA 4.0 +10129,2,,10127,3/9/2020 7:09,,3,,"

Your assumption that

+ +

$$U_l = \text{exp}(i\frac{\pi}{4}l(z)X_{n+1}) = I_{n+1} + e^{i\frac{\pi}{4}l(z)}X_{n+1}$$

+ +

is invalid. When an operator is in the exponent, it is defined by the power series about $X = 0$ with the operator replaced in the exponential by the eigenvalue. In this case

+ +

$$U_l = 1 + i\frac{\pi}{4}l(z) e^{i\frac{\pi}{4}l(z)x}X_{n+1} - \frac{1}{2!}\frac{\pi^2}{16}l^2(z) e^{i\frac{\pi}{4}l(z)x}X_{n+1}X_{n+1} + ...$$

+ +

Recalling that the pauli matrices square to the identity matrix, you can see that +$$e^{i\theta X} = \cos(\theta) I + i\sin(\theta)X$$ in a totally analogous way to the proof of euler's formula by power series. Which is derivation of the accepted answers starting point.

+ +

In the generic case where such a simplification was not available:

+ +

The easiest way to find $U^{\dagger} Y U$ would be by recalling

+ +

$$ U^{\dagger} Y U = U^{\dagger} (U Y) + U^{\dagger} [Y, U] = Y + U^{\dagger} [Y, U]$$

+ +

Then you would need to find the commutator $[Y,U]$. You could either insert the expansion above in for $U$ and use the linearity of the commutator to work that out, or you could use a form of the use Baker-Campbell-Hausdorf formula (line 2 in the link):

+ +

$$e^{-A}Be^{A} = B + [A,B] + \frac{1}{2!}[A,[A,B]] + \frac{1}{3!}[A,[A,[A,B]]] + ...$$

+ +

Perhaps someone else can come give a more complete answer that works through the algebra, but, if you were to plug in the Pauli commutation relations and collect terms with $Y$ and $Z$ separately, you would get the expansion for $\cos(\frac{\pi}{2} l(z))$ in front of the terms with $Y$ and $\sin(\frac{\pi}{2} l(z))$ in front of $[X,Y] \propto Z$.

+ +

Here's a worked example of using the BCH formula for computing $[x,e^{ixp}]$.

+",2149,,2149,,3/9/2020 21:49,3/9/2020 21:49,,,,2,,,,CC BY-SA 4.0 +10130,2,,10127,3/9/2020 7:47,,3,,"

By taking into account the Euler-like formula for Pauli matrices (see, for example, the formula (4.4) or (4.7) in the M. Nielson and I. Chuang textbook):

+ +

$$e^{i \theta X} = cos(\theta)I + i sin(\theta) X$$

+ +

We can show that:

+ +

$$U_l = e^{i \frac{\pi}{4}l(z) X} = cos(\frac{\pi}{4}l(z)) I + isin(\frac{\pi}{4}l(z)) X$$

+ +

So

+ +

\begin{align*} +U_l^\dagger Y U_l &= \left( cos(\frac{\pi}{4}l(z)) I - isin(\frac{\pi}{4}l(z)) +X \right) +Y \left( cos(\frac{\pi}{4}l(z)) I + i sin(\frac{\pi}{4}l(z)) X \right) = +\\ +&= cos^2(\frac{\pi}{4}l(z))Y + \frac{1}{2}sin(\frac{\pi}{2}l(z)) Z + \frac{1}{2}sin(\frac{\pi}{2}l(z))Z - sin^2(\frac{\pi}{4}l(z))Y = +\\ +&= cos(\frac{\pi}{2}l(z))Y + sin(\frac{\pi}{2}l(z)) Z +\end{align*}

+ +

Also, I am not certain what $\left|z,0\right\rangle$ means, but note that:

+ +

\begin{align*} +\langle 0| U_l^\dagger Y U_l | 0 \rangle = cos(\frac{\pi}{2}l(z)) \langle 0 | Y | 0 \rangle + sin(\frac{\pi}{2}l(z)) \langle 0 | Z |0 \rangle = sin(\frac{\pi}{2}l(z)) +\end{align*}

+ +

An example of ""bra-ket"" calculation:

+ +

$$ +\langle 0 | Y | 0 \rangle = +\begin{pmatrix} +1 & 0 +\end{pmatrix} +\begin{pmatrix} +0 & -i \\ +i & 0 +\end{pmatrix} +\begin{pmatrix} +1 \\ +0 +\end{pmatrix} = 0 +$$

+",9459,,9459,,3/10/2020 7:44,3/10/2020 7:44,,,,3,,,,CC BY-SA 4.0 +10131,2,,10121,3/9/2020 9:40,,1,,"

I would probably set this up as a semi-definite program and throw it at the computer. Basically, your problem is a linear problem in the coefficients of the matrix $\delta_{ABC}$ except for the constraint that $\delta_{ABC}$ is positive semi-definite. This is exactly what semi-definite programming is designed to do.

+ +

Note: the calculation below uses a different 1-norm (my bad). See the comment by Norbert, below.

+ +

It's a bit of a pain to set it all up in the right way (which is why I'm not directly stating the full formula!). You need to do things like let +$$ +M1=\text{Tr}_C(\delta_{ABC})-\rho_{AB} +$$ +and the define variables $x_{ij}$ such that +$$ +M1_{ij}\leq x_{ij},\qquad -M1_{ij}\leq x_{ij} +$$ +with the intent of getting (when we're minimising $x_{ij}$) $x_{ij}=|M1_{ij}|$. Then, you set +$$ +\sum_{j}x_{ij}\leq x\qquad\forall i. +$$ +In effect, $x=\|M_1\|_1$. +If you do something similar with a matrix $M2$, variables $y_{ij}$ and $y$, your final problem is to minimise $x+y$.

+ +

Don't forget to include the constraint $\text{Tr}(\rho_{ABC})=1$. It might be implicit in previous constraints, I'm not sure.

+",1837,,1837,,3/9/2020 14:13,3/9/2020 14:13,,,,5,,,,CC BY-SA 4.0 +10132,2,,6821,3/9/2020 9:44,,0,,"

If one of them $(U)$ is a unitary while the other one $(V)$ is any matrix (with $\| V \| = 1$), then + I think that

+ +

$$f = - tr((U - V)^{\dagger}(U - V))$$ would work well.

+ +

For example, if

+ +
    +
  1. $V = U$, then f would be 0.
  2. +
  3. $V = 0$, then f would be -1.
  4. +
  5. $V = \lambda U$, then f would be $-|1 - \lambda|^{2}$.
  6. +
+ +

and so on.

+",462,,462,,3/9/2020 9:54,3/9/2020 9:54,,,,0,,,,CC BY-SA 4.0 +10133,2,,10126,3/9/2020 9:46,,3,,"

I'm not an expert on this, so there could easily be other ways (I get the impression you'd like to keep it to a $d^2$ dimensional calculation, where I'm taking it up to $d^4$), but what I'd do is calculate: +$$ +J(\Phi_{U\circ V})=\left(I_d\otimes \langle\Omega|\otimes I_d\right)\left(J(\Phi_V)\otimes J(\Phi_U)\right)\left(I_d\otimes |\Omega\rangle\otimes I_d\right). +$$ +I simply think of this as teleporting the output from the first channel ($V$) into the into of the second channel ($U$) so that you get the composite action of $UV$.

+",1837,,1837,,3/9/2020 16:21,3/9/2020 16:21,,,,2,,,,CC BY-SA 4.0 +10134,1,,,3/9/2020 10:01,,5,622,"

Suppose we have an oracle $O_f$ that given an initial state $|x\rangle$ maps it into the following state:
+$$ +O_f : |x\rangle \mapsto e^{if(x)} |x\rangle +$$ +Now, assuming that $f(x) \in [0,1]$, is it possible to construct a quantum circuit $O_p$ such that:
+$$ +O_p : |x\rangle \otimes |0\rangle \mapsto |x\rangle \otimes (\sqrt{f(x)} |0\rangle + \sqrt{1-f(x)} |1\rangle) +$$ +using $O_f$ ? If you can suggest some references, i would appreciate it. Thank you very much.

+",10315,,55,,10/28/2020 9:22,10/28/2020 9:22,Convert a quantum Phase Oracle into a Probability Oracle,,2,1,,,,CC BY-SA 4.0 +10135,2,,6821,3/9/2020 10:10,,0,,"

I think that

+ +

$$f = \frac{tr(A^{\dagger}B)}{\sqrt{tr(A^{\dagger}A)}\sqrt{tr(B^{\dagger}B)}} $$ is a good useful measure.

+ +

Lets say $B = e^{i \phi} A$, then +$tr(A^{\dagger}B) = N e^{i \phi} tr(A^{\dagger}A)$ and $tr(B^{\dagger}B) = tr(A^{\dagger}A)$, thus $f = N e^{i \phi}$

+ +

Also, this measure reduces to the Hilbert Schmidt norm when used for Unitary matrices.

+",462,,,,,3/9/2020 10:10,,,,0,,,,CC BY-SA 4.0 +10136,2,,10134,3/9/2020 10:55,,5,,"

As a bare minimum, you would need access to a controlled version of your oracle. This cannot be created from the oracle itself (I'm sure there's already an SE question about this part, but cannot immediately lay my hands on it).

+ +

A typical construction would allow you to create (Hadamard - controlled oracle - Hadamard) would create an output +$$ +\cos\frac{f(x)}{2}|0\rangle+i\sin\frac{f(x)}{2}|1\rangle, +$$ +which is obviously not what you're asking for. There might be some simple modifications that let you approximate what you're after.

+ +

To get what you're actually asking for, I suspect you have to do some quite sophisticated stuff. Essentially, perform phase estimation to estimate the value of $f(x)$ onto a second register, and use that register as a control to produce the state you want, with an accuracy defined by the size of the register.

+",1837,,,,,3/9/2020 10:55,,,,5,,,,CC BY-SA 4.0 +10137,1,10138,,3/9/2020 12:06,,1,70,"

In his lecture on quantum computing, Scott Aaronson describes polynomial-size quantum circuits,

+ +
+

Now, once we fix a universal set (any universal set) of quantum gates, we'll be interested in those circuits consisting of at most p(n) gates from our set, where p is a polynomial, and n is the number of bits of the problem instance we want to solve. We call these the polynomial-size quantum circuits.

+
+ +

and then using this goes on to give a practical definition of $\sf BQP$:

+ +
+

$\sf BQP$ is the class of languages $L\subseteq\{0, 1\}^*$ for which there exists a uniform family of polynomial-size quantum circuits, $\{C_n\}$, such that for all $x\in\{0, 1\}^n$:

+ +
    +
  • If $x\in L$ then $C_n$ accepts input $|x\rangle|0\cdots0\rangle$ with probability at least 2/3.
  • +
  • If $x\notin L$ then $C_n$ accepts input $|x\rangle|0\cdots0\rangle$ with probability at most 1/3.
  • +
+
+ +

Now, take $G$ to be any standard universal gate set (e.g. the Clifford+$\rm T$ set), and let $L$ be a language that can be computed on $n$ qubits only by using (polynomially many copies of) some general $SU(2^n)$ gate $\rm U$, whose decomposition requires exponentially (in $n$) many gates from the set $G$. Seemingly $L\notin\sf BQP$ as the circuit implementing $\rm U$ is not a polynomial circuit.

+ +

Then, let $G'=G\cup\{\rm U\}$. Clearly, $G'$ is still a universal gate set. However, computing $L$ requires polynomially many gates from $G'$, which would indicate $L\in\sf BQP$.

+ +

This seems like a contradiction. Or more profoundly, the definition of $\sf BQP$ seems to depend on the choice of the gate set. What exactly is going wrong here? And is $L$ an element of $\sf BQP$ or not?

+",2687,,2687,,3/11/2020 9:42,3/11/2020 9:42,$\sf BQP$ and general $\mathrm{SU}(2^n)$ gates,,1,0,,,,CC BY-SA 4.0 +10138,2,,10137,3/9/2020 12:22,,2,,"

I think the issue here is that you've got to be careful with families of circuits. If you're picking a single fixed gate from $SU(2^k)$ for some $k$, then that doesn't necessarily help you with $L$ for $n>k$.

+ +

On the other hand, if you implicitly assumed that you had the circuit from $SU(2^n)$ for all $n$, then you're in contradiction with the definition of the universal set (or should be; the notion isn't defined very carefully): that the set be finite (or, at least, that's the easiest clarification, even if it's not quite true. You could still allow an infinite set of gates if it's, for example, single qubit gates depending on a continuous parameter).

+",1837,,,,,3/9/2020 12:22,,,,1,,,,CC BY-SA 4.0 +10139,2,,10128,3/9/2020 12:30,,3,,"

Well actually when looking at the source code, the construct_circuit method:

+ +
+

quantum register where the sequential QFT is performed

+ +
    self._up_qreg = QuantumRegister(2 * self._n, name='up')
+    # quantum register where the multiplications are made
+    self._down_qreg = QuantumRegister(self._n, name='down')
+    # auxiliary quantum register used in addition and multiplication
+    self._aux_qreg = QuantumRegister(self._n + 2, name='aux')
+
+
+ +

They use indeed $4n + 2$ qubits, so it seems they changed what was proposed in the paper. Some parts were simplified. Check the docstring in the original github repo.

+",4127,,,,,3/9/2020 12:30,,,,1,,,,CC BY-SA 4.0 +10140,2,,10127,3/9/2020 16:42,,2,,"

I see this question and realize you too went through Farhi's paper on Quantun Neural Networks! I encountered this paper when I was applying for the Residency at X and was given this to implement - the other paper, by the way, was the seminal QAOA paper. I spent a lot of time head scratching so I can see the why of this question !

+ +

I know this is not quite an answer, but what I can provide is a colab notebook I did of the paper to illustrate it. I developed from scratch using a toy model to illustrate how and why the label is well defined on that boundary and how SGD can be used to systematically find one of the two states for the readout bit. Feel free to comment on it and provide feedback. It is supposed to be a pedagogical notebook so if there's a lot unclear on it, please let me know! I really would appreciate it.

+ +

I hope it is as helpful as it was for me to develop it!

+ +

https://colab.research.google.com/drive/13vxrg483JYVOCywA1xpYnyYnFwoViOEL#scrollTo=qjRWSk6BThju

+",6253,,6253,,3/9/2020 16:48,3/9/2020 16:48,,,,1,,,,CC BY-SA 4.0 +10141,1,,,3/9/2020 17:16,,2,85,"

I know this perhaps not a suitable topic for this SE - after all, this is about QC knowledge sharing - but I am wondering if this could be a resource for people who are interested in the field, are currently enrolled in college - undergrad and beyond - and would like to know the best way - for their current station in the physics/QC track/journey - to approach/pursue the many opportunities there are out there.

+ +

I really hope the community takes upon this question and this becomes a wiki for people to come and see the feedback from the community to be better prepared to compete for those learning opportunity - specially the internships, which as far as I know, are not that many.

+",6253,,55,,10/28/2020 9:22,10/28/2020 9:22,Guide for Quantum Information and Computing Internships and Learning Opportunities,,1,0,,11/15/2020 23:33,,CC BY-SA 4.0 +10142,1,10143,,3/9/2020 17:44,,2,125,"

What is the best mathematical representation of a quantum system that has some classical registers and some quantum registers?

+ +

I'm asking because I'm considering any ""physical"" process $\pi()$ that takes no input, but that outputs both classical and quantum values, like for example a tuple $(x, \rho)$, with $x \in \{0,1\}^n$ a classical string, and $\rho$ a quantum state on $m$ qubits, and I'd like to find a kind of Kraus representation of $\pi$.

+ +

I wanted to use the usual formalism of CPTP, but it's not clear in which Hilbert space lives $(x, \rho)$... Indeed, usually, a Hilbert space is stable by superposition, but here the first ""register"" cannot be in superposition. Of course, I could say that $x$ is in fact $|x\rangle$ and therefore the output of $\pi()$ is strictly contained in a Hilbert space of size $2^n$, but then $\pi()$ is not simply $\sigma = \sum_i B_i 1 B_i^\dagger$, as I'd also need to ""measure"" $\sigma$ to extract a random $x$, and then set $\rho$ to be the matrix $\sigma$ ""postselected"" on $x$.

+ +

Is there some better representation for such process that makes the difference between quantum outputs and classical outputs?

+",5969,,9006,,3/10/2020 5:12,3/10/2020 5:12,"CPTP, Kraus representation and classical registers",,1,1,,,,CC BY-SA 4.0 +10143,2,,10142,3/9/2020 18:47,,3,,"

CPTP map is a map from operators on one Hilbert space to operators on another Hilbert space (usually we consider only density matrices as inputs and outputs). There are no separated classical registers in this formalism.
+There are some generalizations, though, like this https://en.wikipedia.org/wiki/Quantum_instrument. But in essence the idea is the same as you've described $-$ we model classical register with values $x$ as a quantum register with orthogonal states $|x\rangle$. You can model a measurement in this way, for example. If $\sum_i B_iB_i^\dagger=I$ describes a measurement, then +$$\Phi(\rho) = \sum_i |i\rangle\langle i| \otimes B_i \rho B_i^\dagger = \sum_i |i\rangle\langle i| \otimes \frac{B_i \rho B_i^\dagger}{ \text{Tr}(B_i \rho B_i^\dagger)} \cdot \text{Tr}(B_i \rho B_i^\dagger)$$ +is a corresponding quantum channel where the first quantum register of the output encodes the classical result $i$ and the second register contains the quantum state after the measurement.

+",5870,,5870,,3/9/2020 19:17,3/9/2020 19:17,,,,2,,,,CC BY-SA 4.0 +10144,1,,,3/9/2020 21:41,,4,37,"

I am starting on quantum computing and I got to entropy measurements, but that has me stuck because there seems to be a lack of resources for newcomers on those concepts and their utility. Does anyone know any good reference on them?

+",5620,,55,,10/27/2020 9:17,10/27/2020 9:17,What are good resources for newcomers on entropy measurements?,,0,1,,4/27/2022 13:56,,CC BY-SA 4.0 +10146,2,,10134,3/9/2020 23:09,,1,,"

Given controlled access to the phase oracle, this is possible with surprisingly small overhead by avoiding phase estimation altogether. The technique you are after relies on applying ""quantum singular value transformations"" to objects that are known as ""block encodings"", and it was invented by Gilyén et al. in 2018. The idea was originally introduced in this paper, Appendix B, which builds on techniques from this paper. Alternatively, you can have a look at this master's thesis, Circuit 6.2.5.

+ +

It appears that there is a slight error in the statement of the latter reference, as the action of $Q_f$ in the box referred to should actually be:

+ +

$$Q_f : |x\rangle \otimes |0\rangle^{\otimes 3} \mapsto |x\rangle \otimes \left(\sqrt{\frac12 + \frac14f(x)}|0\rangle^{\otimes 3} + \sqrt{\frac12 - \frac14f(x)}|\psi(x)\rangle|1\rangle\right).$$

+ +

Similarly, the action of $Q_2$ further down in the box should be:

+ +

$$Q_2 : |0\rangle^{\otimes 3} \otimes |x\rangle \mapsto \left(\frac12\sqrt{\frac12 + \frac14f(x)}|0\rangle^{\otimes 3} + \sqrt{\frac78 - \frac{1}{16}f(x)}|1\rangle|\phi(x)\rangle\right)|x\rangle.$$

+ +

All the rest should be correct as stated.

+ +

Keep in mind that the operation you wish to implement, i.e., the probability oracle of $f$, makes little sense whenever $f$ takes negative values. Moreover, the square root that appears in the probability oracle behaves erratically close to $0$, so it makes sense to assume that the function values of $f$ are bounded away from $0$. Gilyén et al. overcome this by assuming that the values of $f$ are contained in $(\delta,1-\delta)$. The latter reference essentially does the same thing, but overcomes it by assuming that $|f| \leq 1/2$ and implementing the probability oracle of $\frac12 + \frac14f(x)$.

+ +

As a final remark, note that the conversion you are after up to norm error $\varepsilon$ takes $O(\log(1/\varepsilon)^2)$ queries to the phase oracle, which is surprisingly little compared to the number of queries $O(1/\varepsilon)$ you would need if you used phase estimation as an intermediate step. An explanation can be given along the following lines: phase estimation gives you a binary representation of the function value $f(x)$, which you subsequently postprocess to implement the probability oracle. This is a difficult task, as it requires learning the value of $f(x)$ in the process (as you could measure after phase estimation to get a binary value of $f(x)$). The new techniques circumvent writing down such a binary representation of $f(x)$. This is why I like to call the new technique an instance of analog computation, and I refer to subroutines that give you binary representations, like phase estimation, as instances of digital computation.

+",24,,,,,3/9/2020 23:09,,,,0,,,,CC BY-SA 4.0 +10147,2,,10141,3/10/2020 8:50,,1,,"
    +
  1. Play ""Hello Quantum"" it is a game by IBM on App Store and +iTunes
  2. +
  3. Sign up for IBM Q / Quantum Experience - +https://www.ibm.com/quantum-computing/technology/experience - when +you are there bookmark http://qiskit.org and +https://qiskit.org/textbook/preface.html
  4. +
  5. Look for Blogs especially Microsoft's and Jonathan Hui's blogs - they are fantastic! +https://www.microsoft.com/en-us/quantum

    +https://medium.com/@jonathan_hui/qc-quantum-computing-series-10ddd7977abd

  6. +
  7. Eventually make it a habit to look at papers in what interests you at arxiv.org if +Finance is what interests you - start with this paper https://arxiv.org/abs/1807.03890
  8. +
+",5175,,,,,3/10/2020 8:50,,,,0,,,,CC BY-SA 4.0 +10149,2,,10058,3/10/2020 11:47,,2,,"

I have not read the full details of the paper, but have attempted to skim over the most relevant bits to the question (i.e. I could easily have missed something).

+ +

As I read the paper, they are doing some calculation with a fixed size of input, and they repeat it many times (see equation 58). They ask how many times do you have to repeat it to get the same level of confidence in the output as you would with a classical Monte-Carlo. I believe that it is this ""scaling"" that the authors are referring to as giving a quadratic improvement.

+ +

This bears no relation to what we usually think about scaling: how the running time scales with increasing size of input because the input is of fixed size. So, in principle, there's no problem with simulating what they want to simulate, whether it uses Clifford gates or not. So long as it fits in the memory of the computer, you can run it and repeat it many times, and you can count the number of repetitions required.

+",1837,,,,,3/10/2020 11:47,,,,2,,,,CC BY-SA 4.0 +10150,1,,,3/10/2020 13:01,,3,306,"

How to construct Control-Z with square root of swap(up to some single qubit operations)? In some papers it just directly mention that it's possible but didn't tell how to do.

+",10015,,,,,11/20/2020 16:29,How to construct Control-Z with square root of swap?,,2,0,,,,CC BY-SA 4.0 +10151,1,,,3/10/2020 15:51,,3,43,"

Cloud IBMQ simulator ibmq_qasm_simulator can process up to 32-qubit circuits quite fast. However, I could not find any information about the simulator backend properties, e.g. how many cores, what processors, etc.

+ +

Could anybody provide me with this information (or link)?

+",10336,,9006,,3/10/2020 19:24,3/10/2020 19:24,How many cores and what processors are used in the cloud ibmq_qasm_simulator?,,0,0,,,,CC BY-SA 4.0 +10152,1,10155,,3/10/2020 16:25,,2,487,"

I'm using Qiskit and I have a Quantum Circuit (say, circuit) that gives reasonable results when using the simulator, namely

+ +
sim_backend = provider.get_backend('qasm_simulator')
+job = execute(circuit, sim_backend, shots=shots)
+
+ +

However, when switching to the true machine, namely

+ +
sim_backend = provider.get_backend('ibmq_16_melbourne')
+
+ +

I'm experiencing very noisy, meaningless results.

+ +

From my understanding, this is normal and, in these cases, error mitigation is performed by measuring the noise of the quantum circuit and then operating with this knowledge.

+ +

Could someone tell me which Qiskit routine I could use to mitigate noise and how?

+ +

EDIT

+ +

Following the comment by Davit Khachatryan and the answer by Martin Vesely, I have prepared the code below.

+ +
# --- Standard imports
+
+%matplotlib inline
+# Importing standard Qiskit libraries and configuring account
+from qiskit import QuantumCircuit, execute, Aer, IBMQ
+from qiskit.compiler import transpile, assemble
+from qiskit.tools.jupyter import *
+from qiskit.visualization import *
+# Loading your IBM Q account(s)
+provider = IBMQ.load_account()
+
+# --- Imports
+from qiskit import QuantumCircuit, execute, BasicAer
+from qiskit.tools.monitor import job_monitor
+
+import math
+from numpy import linalg as LA
+import numpy as np
+#%config jupy = 'svg' # Makes the images look nice
+
+import time
+
+import matplotlib.pyplot as plt
+
+nBits    = 2
+
+shots    = 8192
+
+# --- Computation of the calibration matrix
+
+from qiskit.ignis.mitigation.measurement import (complete_meas_cal,CompleteMeasFitter)
+from qiskit import *
+
+qr = QuantumRegister(2)
+meas_calibs, state_labels = complete_meas_cal(qr=qr, circlabel='mcal')
+backend = provider.get_backend('ibmq_16_melbourne')
+job = execute(meas_calibs, backend=backend, shots=1000)
+job_monitor(job, interval = 3)
+cal_results = job.result()
+
+meas_fitter = CompleteMeasFitter(cal_results, state_labels, circlabel='mcal')
+print(meas_fitter.cal_matrix)
+
+# --- Execution of the noisy quantum circuit
+
+qc = QuantumCircuit(nBits, nBits)
+qc.x(1)
+
+qc.measure(qc.qregs[0], qc.cregs[0])
+job = execute(qc, provider.get_backend('ibmq_16_melbourne'), shots = shots)
+#job = execute(qc, BasicAer.get_backend('qasm_simulator'), shots = shots)
+job_monitor(job, interval = 3)
+result = job.result()
+print(result.get_counts())
+
+# --- Error correction
+
+# Get the filter object
+meas_filter = meas_fitter.filter
+
+# Results with mitigation
+mitigated_results = meas_filter.apply(result)
+mitigated_counts = mitigated_results.get_counts(0)
+
+print(mitigated_counts)
+
+ +

The noisy quantum circuit returns:

+ +
{'00': 661, '11': 34, '10': 7494, '01': 3}
+
+ +

The error mitigated noise circuit returns:

+ +
{'00': 132.05699755089069, '11': 29.711709316932044, '01': 0.4405790117450936, '10': 8029.790714120432}
+
+ +

Is that what I should expect?

+",10032,,2293,,8/17/2020 2:53,8/17/2020 2:53,Mitigating the noise in a quantum circuit,,2,4,,,,CC BY-SA 4.0 +10153,2,,10150,3/10/2020 17:38,,3,,"

Found by just trying stuff in Quirk:

+ +

+",119,,,,,3/10/2020 17:38,,,,0,,,,CC BY-SA 4.0 +10154,1,,,3/10/2020 18:47,,1,194,"

I'm trying to find the steady-state of a master equation, +$$\dot{\rho}(t) = \mathcal{L}\rho(t),\tag{1}\label{1}$$ +In the form where we vectorise the density matrix and matrixify (??) the Liouvillian super operator $\rho$ is a vector representing a state, $\mathcal{L}$ is the Liouvillian, a complex matrix describing the evolution, which is not necessarily symmetric and $\dot{\rho}$ is the rate of change of $\rho$. To find the steady-state we need to set the LHS of the equation to 0 and solve for $\rho$. +This is just the eigenvector problem, $(\mathcal{L}-\lambda\pmb{I})\rho=0$ for the case where the eigenvalue, $\lambda=0$.

+ +

In many systems I am studying the 0 eigenvalue of $\mathcal{L}$ is degenerate so there should be more than one solution for the original master equation. Ideally, we could find a basis for the degenerate subspace (I assume that this subspace of $\mathcal{L}$ is diagonalizable). Qutip has the function steadystate() which, given a system Hamiltonian and some jump operators uses various numerical methods to find the steadystate. I am relatively new to using numerical methods but the systems I am dealing with are large so requires it. I have tried using the GMRES method to solve equation \eqref{1} with $\dot{\rho}=0$ but this only produces a single solution and does not help me find a basis.

+ +

An alternative approach is to use the function liouvillian() which given the same parameters as steadystate() returns the Liouvillian, L, of the system in matrix form. We can then use L.eigenstate() to find the eigenvectors associated with the zero eigenvalues. A few issues with this is that the zero eigenvalues are never quite zero but just very small, however I'm not sure this is necessarily a problem. The eigenvectors produced appear to be linearly independent, at least in the simple case I'm looking at where the system is only doubly degenerate in the zero eigenvalue, so they could form a basis for this degenerate subspace. Finally, when the Liouvillian is applied to any linear combination of these eigenvectors (as long as the cofactors are not too large) the result is zero. My only problem is that when I apply the Liouvillian to the steadystate produced by the GMRES approach the result is not zero and after some simple checks it does not appear to be in the space spanned by the eigenvectors. Is this necessarily a problem or just an issue of numerical accuracy. Is my approach of using the eigenvectors of the zero eigenvalue as a basis for the steadystate valid?

+ +

Any advice on solving this problem would be much appreciated! Thanks.

+",10338,,,,,3/10/2020 18:47,Numerical methods for finding an eigen basis of a degenerate Liouvillian,,0,3,,,,CC BY-SA 4.0 +10155,2,,10152,3/10/2020 19:20,,2,,"

I will provide some general comments concerning noise in quantum computers.

+ +

Noise in quantum systems is normal phenomena as these systems are probabilistic by nature. Under current state of development, quantum computers unfortunately does not allow to build complex deep circuits.

+ +

You can of course use additional qubits to introduce error correction which can be almost perfect with sufficient number of qubits (so-called threshold theorem). But adding qubits and gates introduces another source of noise, so again depth of circuits is constrained.

+ +

When quantum computers are in higher state of development, error correction will also be able to mitigate noise more effectively than nowadays.

+ +

Concerning the backend you use - Melbourne. My experience is that this processor is very noisy in comparison with others provided in IBM Q. It seems that this is caused by higher number of qubits, so qubits influence each other increasing noise level.

+",9006,,,,,3/10/2020 19:20,,,,3,,,,CC BY-SA 4.0 +10156,1,10163,,3/10/2020 21:14,,2,88,"

When using the BB84 algorithm for QKD, you arbitrarily choose which of two filters (bases) to use when detecting a photon: rectilinear or diagonal. If you choose rectilinear, you can detect polarization with certainty if the photon is rectilinear, i.e., either vertically- or horizontally-polarized.

+ +

But how? A polarization filter that allows transmission of vertically-polarized photons will block horizontally-polarized photons and vice-versa, no? +Perhaps you use a vertically-polarized filter as the rectilinear filter and then the complete lack of a photon indicates horizontal polarization, but how would you distinguish that from, say, absorption of the photon into the fiber?

+",10340,,9006,,3/10/2020 22:33,3/12/2020 9:00,How does a rectilinear filter used for QKD-BB84 detect both horizontal and vertical polarizations?,,1,0,,,,CC BY-SA 4.0 +10157,1,,,3/11/2020 15:11,,2,49,"

Suppose I know a set of stabilizer generators of a qubit quantum code. Is there a systematic (and possibly efficient) way to transform this set of generators to a different set (generating the same code) with lowest possible weights? I suspect that there is no efficient way, because this problem looks very similar to the shortest basis problem of lattices which is conjectured to be very hard.

+",4312,,,,,3/11/2020 15:11,Obtaining low weight stabilizer generators,,0,2,,,,CC BY-SA 4.0 +10158,1,10160,,3/11/2020 15:56,,2,112,"

I have a unitary matrix $U$ and a quantum state $\vert \Psi \rangle$ such that +$$ U \vert \Psi \rangle = e^{i \theta} \vert \Psi \rangle.$$ +I also know that my unitary matrix and my quantum state can be written as $U = U_1\otimes U_2$ and $\vert \Psi \rangle = \vert \Psi_1\rangle\otimes\vert\Psi_2\rangle$ with matching dimensions (i.e. $U_1$ acts on the Hilbert state $\vert\Psi_1\rangle$ belongs to, same for $U_2$ and $\vert\Psi_2\rangle$).

+ +

My first equation then becomes +$$U_1\vert\Psi_1\rangle \otimes U_2 \vert\Psi_2 \rangle = e^{i\theta} \vert \Psi_1 \rangle \otimes \vert \Psi_2 \rangle.$$

+ +

Can I deduce the 3 following assertions from my formula above?

+ +
    +
  1. $U_1 \vert\Psi_1\rangle = e^{i\theta_1}\vert\Psi_1\rangle$
  2. +
  3. $U_2 \vert\Psi_2\rangle = e^{i\theta_2}\vert\Psi_2\rangle$
  4. +
  5. with $\theta = \theta_1 + \theta_2 + 2k\pi$.
  6. +
+ +

The implication seems ""logical"" as we just separate $2$ non-related quantum states from each other, but I do not have enough confidence in my reasoning to accept this result yet. I searched for a mathematical proof, but the closer I found is the following theorem from here:

+ +
+

Theorem: Let $A$ and $B$ be two complex square matrices. If $\lambda$ is an + eigenvalue of $A$ with corresponding eigenvector $x$ and $\mu$ is an + eigenvector of $B$ with corresponding eigenvector $y$, then $\lambda\mu$ is an + eigenvalue of $A\otimes B$ with corresponding eigenvector $x\otimes y$. Moreover, every + eigenvalue of $A\otimes B$ arises as such a product.

+
+ +

that does not fit with my problem (not the good implication and more oriented toward eigenvectors).

+",1386,,5870,,3/11/2020 17:40,3/11/2020 17:40,Is kronecker product identifiable?,,2,3,,,,CC BY-SA 4.0 +10159,1,,,3/11/2020 16:37,,2,62,"

I have been reading papers on graph theory in quantum computing. Mostly, papers explain that they use adjacency matrix to represent the graph. But I could't find the practical simple example to understand it better. Does anybody know about such example?

+",9230,,55,,10/27/2020 9:15,10/27/2020 9:15,"Graphs are represented using oracle, where oracle is the adjacency matrix. Is there any simple example of this?",,0,3,,11/6/2020 12:13,,CC BY-SA 4.0 +10160,2,,10158,3/11/2020 16:48,,3,,"

Let's say I know that +$$ +U_1|\Psi_1\rangle\otimes U_2|\Psi_2\rangle=e^{i\theta}|\Psi_1\rangle\otimes|\Psi_2\rangle. +$$ +Now, let's imagine that $U_1|\Psi_1\rangle=|\phi_1\rangle$ and $U_2|\Psi_2\rangle=|\phi_2\rangle$. So, +$$ +|\phi_1\rangle\otimes |\phi_2\rangle=e^{i\theta}|\Psi_1\rangle\otimes|\Psi_2\rangle. +$$ +Now, I would just read off your desired relations, but as a proof, it depends on how deep we need to go... Let's take the inner product of both sides with $|\phi_1\rangle\otimes |\phi_2\rangle$, and calculate the absolute value. You have +$$ +1=|\langle\phi_1|\Psi_1\rangle|\ |\langle\phi_2|\Psi_2\rangle|. +$$ +Both terms on the right-hand side satisfy $|\langle\phi_1|\Psi_1\rangle|\leq 1$, and can only achieve equality if $|\phi_i\rangle=e^{i\theta_i}|\Psi_i\rangle$ (do you need a detailed proof of that? Think of real unit vectors $\underline{v},\underline{u}$: $\underline{u}\cdot\underline{v}=\cos\gamma\leq 1$, where $\gamma$ is the angle between them.)

+ +

Hence, we get overall equality if +$$ +e^{i\theta}=e^{i\theta_1}e^{i\theta_2}, +$$ +which is true provided +$$ +\theta\equiv\theta_1+\theta_2\text{ mod }2\pi. +$$

+",1837,,,,,3/11/2020 16:48,,,,0,,,,CC BY-SA 4.0 +10161,2,,10158,3/11/2020 17:28,,2,,"

Let $H_1,H_2$ be two Hilbert spaces and for unit vectors $u_1,v_1 \in H_1$ and $u_2,v_2 \in H_2$ we have +$$ +u_1 \otimes u_2 = v_1 \otimes v_2 \in H_1 \otimes H_2. +$$ +Then it must be +$$ +v_1 = \lambda u_1, ~~ v_2 = \frac{1}{\lambda} u_2, +$$ +for some $\lambda \in \mathbb{C}$, $|\lambda|=1$.

+ +

To see why consider a scalar product +$$ +1 = (u_1\otimes u_2, u_1\otimes u_2) = (u_1\otimes u_2, v_1\otimes v_2) = (u_1,v_1)(u_2,v_2). +$$ +Since $|(u_i,v_i)|\leq 1$ it must be $|(u_i,v_i)|=1$ for $i=1,2$. Hence $v_i = \lambda_i u_i$, where $|\lambda_i|=1$. But $u_1 \otimes u_2 = v_1 \otimes v_2 = \lambda_1 u_1 \otimes \lambda_2 u_2 = \lambda_1 \lambda_2 (u_1 \otimes u_2)$, thus $\lambda_1\lambda_2=1$.

+ +

From this you can deduce your 3 assertions, though DaftWullie essentially used this argument directly in his answer.

+",5870,,5870,,3/11/2020 17:33,3/11/2020 17:33,,,,0,,,,CC BY-SA 4.0 +10163,2,,10156,3/12/2020 9:00,,0,,"

I don't know the experimental details, but one option from the theory perspective is that if you know there's supposed to be a photon there, absence of a click conveys the other measurement. Of course, as you say, that's not going to hold up in situations of finite detector efficiency, photon loss during transmission, or even knowing there's been successful photon generation, etc.

+ +

Perhaps a better option is to replace the filter with a polarising beamsplitter. So, one polarisation gets transmitted, and the orthogonal one gets reflected, so that you can direct both components into different detectors.

+",1837,,,,,3/12/2020 9:00,,,,2,,,,CC BY-SA 4.0 +10164,1,10165,,3/12/2020 9:43,,1,112,"

I am using Qiskit - the simple circuits I am writing can either run on the hardware backend (using least_busy) or the QASM simulator backend.

+ +

If I have statements like the following - (random_numbers were generated using QRNG in the circuits - not shown here)

+ +
b = .6
+a = .3
+flt = []
+
+for rn_num in random_numbers:
+     flt.append( b*(a-rn_num) + a * rn_num)
+
+ +

Where are these floating point operations performed? I am connected to IBM Quantum Experience - using Jupyter. Are these operations performed on a traditional machine or a quantum backend?

+ +

My understanding is unless it is related to a Quantum circuit - everything gets executed on a traditional machine (similar to print or sockets?)

+ +

Is there a document that explains this further? I read release notes - I found them a bit ambiguous. I found this comment in Aer 0.3 release note

+ +
+

Increased performance with simulations that require less floating + point numerical precision.

+
+ +

Maybe this note is referring to statevectors in floating point ...??

+",5175,,5955,,3/12/2020 11:30,3/12/2020 11:30,"In Qiskit, where is the floating point operation performed?",,1,0,,,,CC BY-SA 4.0 +10165,2,,10164,3/12/2020 9:54,,2,,"

The Qiskit backends (quantum devices or simulators) work only when you explicitly invoke them, usually with execute. The code in your snippet does not call qiskit, and runs on a traditional machine.

+",7659,,,,,3/12/2020 9:54,,,,0,,,,CC BY-SA 4.0 +10166,1,,,3/12/2020 15:44,,3,323,"

On wikipedia, the article on quantum entanglement gives an example of the computation of a reduced density matrix. I would like to understand precisely what's going on with the computation.

+ +

First the context. We consider two systems A and B respectively belonging to Hilbert spaces $\mathcal{H}_A$ and $\mathcal{H}_B$. +We consider the state of the composite system $| \Psi\rangle \in \mathcal{H}_A \otimes\mathcal{H}_B$.

+ +

We are interested by the reduced density matrix on the subsystem A, given by the following formula :

+ +

$$ \rho_A = \sum_j \langle j |_B ( | \Psi\rangle \langle\Psi| ) |j\rangle_B $$

+ +

Then the article gives the following example . Consider the entangled state :

+ +

$$ | \Psi \rangle =\frac{1}{\sqrt{2}} ( |0\rangle_A |1\rangle_B - |1\rangle_A |0\rangle_B ) $$

+ +

the article says that the reduced density of A is then :

+ +

$$ \rho_A = \frac{1}{2} (|0\rangle_A \langle 0|_A + |1\rangle_A \langle 1|_A)$$

+ +

I wanted to compute it myself using the definition above but I'm having trouble with it.

+ +

The term $| \Psi\rangle \langle\Psi|$ makes sense to me :

+ +

$$ | \Psi\rangle \langle\Psi| =\frac{1}{2} ( |0\rangle_A |1\rangle_B \langle 0|_A \langle 1|_B - |0\rangle_A |1\rangle_B \langle 1|_A \langle 0|_B - |1\rangle_A |0\rangle_B \langle 0|_A \langle 1|_B + |1\rangle_A |0\rangle_B \langle 1|_A \langle 0|_B ) $$

+ +

but then let's consider the first term of the sum in the definition of the reduced density matrix :

+ +

$$ \langle 0|_B | \Psi\rangle \langle\Psi| |0\rangle_B $$

+ +

we then have term such as

+ +

$$ \langle 0|_B |0\rangle_A $$

+ +

and I can't make sense of it. If $\mathcal{H}_A = \mathcal{H}_B$ it's the inner product on $\mathcal{H}_A$ but here I'm confused. Dropping the subscripts I have :

+ +

$$ \langle 0| | \Psi\rangle \langle\Psi| |0\rangle + \langle 1| | \Psi\rangle \langle\Psi| |1\rangle = - \frac{1}{2} (|0\rangle \langle 0| + |1\rangle \langle 1|)$$

+ +

So here there is this minus sign that is not in the given answer of Wikipedia plus I ""lost"" the information on the states. +Could you help me doing the computation correctly ?

+",10065,,9006,,3/12/2020 20:43,3/12/2020 20:43,Computation of a reduced density matrix,,1,0,,,,CC BY-SA 4.0 +10168,1,10170,,3/12/2020 15:58,,1,71,"

Like Distributed Ledger Technologies (DLT) and Blockchain, other than the few quantum algorithms available out there, are quantum computers/algorithms a solution looking for a problem?

+ +

For one, I am ambivalent - with the scarcity of quantum algorithms, I am leaning towards ""a solution looking for a problem"" .

+",166,,9006,,3/12/2020 20:41,3/12/2020 22:36,"Like blockchains, other than the few quantum algorithms available out there, are quantum computers/algorithms a solution looking for a problem?",,1,3,,3/17/2020 20:30,,CC BY-SA 4.0 +10169,2,,10166,3/12/2020 16:28,,2,,"
    +
  1. $\mathcal{H}_A \neq \mathcal{H}_B$, they are two distinct physical systems (even if they have the same dimension).
  2. +
  3. That formula for a reduced density matrix is a shortcut for +$$ +\rho_A = \sum_j \big(I_A \otimes \langle j |_B\big) \cdot | \Psi\rangle \langle\Psi| \cdot \big(I_A \otimes |j\rangle_B \big) +$$ +You can check the dimensions. If $d_A = \text{dim}H_A, d_B = \text{dim}H_B$, then $\langle j |_B$ has size $1 \times d_B$ and $| \Psi\rangle$ has size $d_Ad_B \times 1$. You can't multiply $1 \times d_B$ sized matrix on a $d_Ad_B \times 1$ sized matrix. But $I_A \otimes \langle j |_B$ has size $d_A \times d_Ad_B$, so it fits.
  4. +
+ +

So, for example, you can compute +$$ +\langle 0|_B \big(- |0\rangle_A |1\rangle_B \langle 1|_A \langle 0|_B \big) |0\rangle_B = \big(I_A \otimes\langle 0|_B \big) \cdot \big(- |0\rangle_A \langle 1|_A \otimes |1\rangle_B \langle 0|_B \big) \cdot \big(I_A \otimes |0\rangle_B\big) = - |0\rangle_A \langle 1|_A \otimes \langle 0|_B |1\rangle_B \langle 0|_B|0\rangle_B = - |0\rangle_A \langle 1|_A \otimes 0 = 0 +$$

+",5870,,,,,3/12/2020 16:28,,,,5,,,,CC BY-SA 4.0 +10170,2,,10168,3/12/2020 22:36,,2,,"

I disagree. By no means is there a scarcity of quantum algorithms. Consider for example this review on Quantum Machine Learning. Therein the term qBLAS is contained for Quantum Linear Algebra Subroutines. This term describes all the quantum algorithms that exist for basic linear algebra tasks. Together with the (in)famous Grover Algorithm that gives a quadratic speedup for unstructured search problems and other quantum algorithms one has a large toolbox of generic quantum speedups at one's disposal.

+ +

As linear algebra tasks and search are basically used everywhere, quantum algorithms can yield generic speedups in nearly any field and will therefore be extremely important in the future.

+ +

But in the present NISQ era, we are indeed in a place where one can say that quantum computers are a ""solution looking for a problem"". Why is this the case? State-of-the-art quantum computers have few and noisy qubits, which means that none of the algorithms outlined above can be faithfully implemented.

+ +

Today's quantum computers can already outperform classical computers in very artifical and useless tasks. But people still hope that we can use those devices to do useful stuff. One major candidate are hybrid approaches like the Variational Quantum Eigensolver that can possibly aid quantum chemistry -- but while many such methods are proposed, no evidence exists that they are actually better than classical methods yet.

+ +

So while quantum computers in general are not a solution looking for a problem, today's NISQ devices, in a way, are.

+",10250,,,,,3/12/2020 22:36,,,,0,,,,CC BY-SA 4.0 +10171,2,,6399,3/13/2020 0:05,,2,,"

If you are using the QFT inside a bigger circuit you really can't avoid the swaps in the QFT and/or the invQFT the reason being that the value of qubit x1 dictates the symmetry of the phases in your entire superposition. Pay attention to how the phases look like in the following images:

+

+

+

I think your intuition in question 1 is correct but it will only work in isolation because you are then literally swapping the wires. If you need the outcome of the QFT to be used as input for something else in the circuit you'll have to use swaps at some point.

+

There is a way you can work around this if you separate your input and output registers but this means you need twice as many qubits :) Then you can do something like:

+

+

Quirk link so you can play with it yourself.

+

Note: some people mix up the invQFT with the QFT and so I myself I'm a bit lost but it should be fairly straightforward to adapt this technique to Nielsen's circuit I think.

+

Here is a video where you can see my mental process and how I got to this idea while exploring the QFT myself: https://youtu.be/HlMuFqZ9cSE?t=1158 (minute 19:18)

+

I hope this was helpful! :)

+",7322,,13968,,12/19/2021 3:05,12/19/2021 3:05,,,,0,,,,CC BY-SA 4.0 +10172,1,,,3/13/2020 2:31,,2,517,"

Is my understanding correct that in this example the Hamiltonian measurement is not performed through measuring individual Pauli operators because all its terms are mutually commuting? So, for each run, we just measure all the qubits in the $Z$ basis, and substitute the values into the classical expression?

+ +

But if we added a term like $X_1 Y_2$, we would have to double the number of runs, right?

+",6313,,491,,8/29/2020 19:00,10/21/2022 7:04,VQE Cirq example,,2,0,,,,CC BY-SA 4.0 +10173,2,,10172,3/13/2020 3:38,,0,,"

If we have prepared an arbitrary anzats/trial two-qubit state:

+ +

$$\psi = a |00\rangle + b |01\rangle+ c |10\rangle+ d |11\rangle$$

+ +

And we want to calculate the expectation value of individual Pauli terms of this Hamiltonian that is the two qubit case of the used one in the VQE Cirq example:

+ +

$$ \langle H \rangle = \alpha_1 \langle Z_1 Z_2 \rangle + \alpha_2 \langle Z_1 \rangle + \alpha_3 \langle Z_2 \rangle $$

+ +

Note that:

+ +

\begin{align*} +\langle Z_1 Z_2 \rangle = |a|^2 - |b|^2 - |c|^2 + |d|^2 \\ +\langle Z_2 \rangle = |a|^2 - |b|^2 + |c|^2 - |d|^2 \\ +\langle Z_1 \rangle = |a|^2 + |b|^2 - |c|^2 - |d|^2 +\end{align*}

+ +

So, just by performing measurements in the $Z$ basis will give you all the expectation values for the given $H$, because by these measurements we will obtain all the probabilities ($|a|^2$, $|b|^2$, $|c|^2$ and $|d|^2$). More about these calculations can be found in this answer. If there are other terms like $X_1 Y_2$ one should measure also in different basis (for more info here is my Qiskit tutorial on VQE, where at the end a procedure for finding the expectation value of $X_1 Y_2$ Pauli term is described).

+ +

What I used above is that all three terms have a common orthonormal basis. Maybe this is the crucial criterion, which implies the commutativeness. Here is a theorem from the M. Nielsen and I. Chuang textbook (page 77) about the common orthonormal basis of two commuting Hermitian matrices.

+ +

Theorem 2.2: (Simultaneous diagonalization theorem) Suppose $A$ and $B$ are Hermitian operators. Then $[A, B] = 0$ if and only if there exists an orthonormal basis such that both $A$ and $B$ are diagonal with respect to that basis. We say that A and B are simultaneously diagonalizable in this case.

+ +

P.S. I haven't read the Cirq's implementation, so maybe there will be a better answer.

+",9459,,9459,,4/1/2020 13:00,4/1/2020 13:00,,,,0,,,,CC BY-SA 4.0 +10174,1,,,3/13/2020 14:30,,2,233,"

I have a state psi as an ndarray of shape (2 ** 3,) s.t.

+ +

psi[0]= amplitude of 000

+ +

psi[1] = amplitude of 001.

+ +

So my qubit ordering is reversed w.r.t. qiskit's. To initialize the circuit correctly and apply the IQFT on the first 2 qubits from the left I tried the following code:

+ +
import qiskit as qt
+from qiskit.aqua.circuits import FourierTransformCircuits as QFT
+
+    circuit = qt.QuantumCircuit(3)
+    circuit.initialize( psi, [i for i in reversed(circuit.qubits)])
+
+    QFT.construct_circuit(circuit=circuit, qubits=circuit.qubits[:2], inverse=True)
+
+    backend = qt.Aer.get_backend('statevector_simulator')
+    final_state = qt.execute(circuit, backend, shots=1).result().get_statevector()
+
+ +

From the tests I've run, final_state is not what I expected: defining

+ +

exact = np.kron(IQFT_matrix(2),np.eye(2)).dot(state) with IQFT_matrix(2)= IQFT_matrix for 2 qubits.

+ +
np.testing.assert_array_almost_equal(final_state, exact)
+
+ +

fails. Can you please help me find the problem?

+",10356,,55,,8/12/2020 8:33,12/30/2022 14:05,qiskit: IQFT acting on subsystem of reversed-ordered qubits state,,2,2,,,,CC BY-SA 4.0 +10175,1,10183,,3/13/2020 14:45,,10,959,"

I have two question concerning information content of qubit.

+ +

Question 1: How many classical bits are needed to represent a qubit:

+ +

A qubit can be represented by a vector $q = \begin{pmatrix}\alpha \\\beta \end{pmatrix}, ~~ \alpha, \beta \in \mathbb{C}$. So, we need four real numbers to represent it. But when facts that (i) $|\alpha|^2+|\beta|^2 = 1$ and (ii) two qubits which differ in global phase only are indistinguishable, are taken into account, only two real numbers are necessary (angles on Bloch sphere). Moreover, we can choose a precission of the qubit representation (i.e. number of decimal places in $\alpha$ and $\beta$ or Bloch sphere angles) which influence number of classical bits needed to described the qubit.

+ +

So, it seems to me that the qubit representation cannot be used for measuring qubit information content but only memory consumption in simulation. Am I right?

+ +

Question 2: What is an (effective) information content of qubit:

+ +

A superdense coding enable us to send two classical bits via one qubit. But on the other hand you need two entangled qubits prepared in advance.

+ +

Given these facts, what is an information content of qubit? One or two classical bits? Or do I need to use another angle of view given the fact that qubits are ""continuous"" (i.e. described by complex numbers $\alpha$ and $\beta$)?

+",9006,,55,,10/27/2020 9:14,10/27/2020 9:14,How many classical bits are needed to represent a qubit?,,2,2,,,,CC BY-SA 4.0 +10176,2,,10174,3/13/2020 15:16,,0,,"

There is the parameter do_swaps when you construct the fourier transform circuit.

+ +
do_swaps (bool): Boolean flag to specify if swaps should be included to align
+                 the qubit order of input and output. The output qubits would
+                 be in reversed order without the swaps.
+
+",9831,,,,,3/13/2020 15:16,,,,1,,,,CC BY-SA 4.0 +10177,1,,,3/13/2020 15:55,,2,28,"

The paper, Quantum deletion is possible via a partial randomization procedure claims that it is possible to bypass the no-deleting theorem by a procedure called R-deletion. But this seems to go against the original no-deleting theorem. If not, why so?

+ +

And doesn't the following line from the first paper actually convey a swapping operation which has been categorically excluded by Pati and Braunstein?

+ +
+

But, whatever this state be in our actual realization of R-deletion, we do not recover now, from the linearity of Quantum Mechanics, the result in {1} that $|A_\psi\rangle= \alpha|A_H\rangle +\beta|A_V\rangle$.

+
+",4235,,55,,10/28/2020 9:22,10/28/2020 9:22,Is quantum deletion via a partial randomization procedure possible?,,0,0,,,,CC BY-SA 4.0 +10178,2,,10152,3/13/2020 18:32,,1,,"

As Martin Vesley has mentioned in his answer, there are some error correction techniques that require additional qubits and gates resources, and how we know the resources of nowadays QCs are limited, and that's why those techniques are not so useful today. But in 2017 new error correction techniques were proposed that don't require additional gates/qubits. As stated in the abstract of S. Endo et al [1] paper: two quantum error mitigation (QEM) techniques have been introduced recently, +namely, error extrapolation (proposed by Y. Li and S. C. Benjamin [2] and K. Temme et al [3]) and quasiprobability decomposition (proposed by K. Temme et al [3]). How I understand, this Qiskit tutorial is an implementation of the second technique. The tutorial is written very nicely and intuitively, so I highly recommend it.

+ +

Here I will try to explain the first technique: error extrapolation. We want to estimate something from our circuit, let's call it $E^*$ (can be the expectation value of Hamiltonian or something else). Because of noise we always obtain a different value than $E^*$. Suppose we have a $\lambda$ parameter (in this experimental paper [4] they used pulse duration as a parameter: the gates are implemented via microwave pulses) that we can change and run different experiments with given values of $\lambda$. This give us different values for $E(\lambda)$ from which we will be able to construct the following system of equations:

+ +

\begin{cases} +E(\lambda_1) = E^* + Noise(\lambda_1) +\\ +E(\lambda_2) = E^* + Noise(\lambda_2) +\\ +E(\lambda_3) = E^* + Noise(\lambda_3) +\\ +... +\end{cases}

+ +

By expressing the $Noise(\lambda)$ with some suitable function (e.g. a polynomial function) one can solve the system of equation and find the desired $E^*$ value ""without"" noise. In some cases, it works XD. I mean there should be the satisfaction of some conditions (e.g good fitting of chosen function to the actual noise).

+ +

These techniques are increasing the circuit depth that can be used, but that increment, of course, is not limitless (more insights can be gained from the Fig.2 from the [4] paper).

+",9459,,9459,,3/13/2020 18:46,3/13/2020 18:46,,,,3,,,,CC BY-SA 4.0 +10179,1,10180,,3/13/2020 18:44,,5,1085,"

I'm trying to replicate with qiskit the results of this paper in which basically they implement a quantum version of the Principal Component Analysis applying Quantum Phase Estimation algorithm in order to find eigenvalues and eigenvectors from a covariance matrix.

+ +

Everything works fine for the 2x2 covariance matrix case but when they extend the circuit to the 4x4 case it's not very clear how they modify the phase kickback part of the quantum circuit. +In the picture that shows the general circuit for QPE, some multi-target controlled-U gates are shown:

+ +

+In the 2x2 case this can be made using simple cU3 gates repeated several times as shown in this answer, where the parameters $\theta, \phi, \lambda$ that are needed for the cU3 gate are calculated using the qiskit function euler_angles_1q directly from the $e^{2\pi i\rho}$ 2x2 matrix where $\rho$ is the normalized covariance matrix:

+ +

$\rho=\frac{\sigma}{tr(\sigma)}$

+ +

($\sigma$ is the 2x2 covariance matrix for which we want to find the eigenvalues and the eigenvectors)

+ +

But for the 4x4 case they provide a circuit that does the phase kickback with several U3 gates +

+ +

My question is:

+ +
    +
  1. Since I am a beginner I don't understand how a controlled multi-target gate is decomposed in this chain of gates. Could you please explain me the idea behind this decomposition or give me some resources to start from in order to understand it?
  2. +
  3. Is it possible to decompose a multi-target cU3 gate using only 2 single target cU3 gates?
  4. +
+",10352,,,,,3/14/2020 11:59,How to decompose a multi-target controlled gate?,,1,2,,,,CC BY-SA 4.0 +10180,2,,10179,3/13/2020 19:40,,2,,"

An example of constructing (with help of Qiskit) a controlled version of some simple 4x4 unitary matrix:

+ +

$$ +U = \begin{pmatrix} +\mathrm{e}^{i g_1} & 0 & 0 & 0 \\ +0 & \mathrm{e}^{i g_2} & 0 & 0 \\ +0 & 0 & \mathrm{e}^{i g_3} & 0 \\ +0 & 0 & 0 & \mathrm{e}^{i g_4} \\ +\end{pmatrix} +$$

+ +

where $g_s$ are some given constants. It can be shown that this corresponds to the following circuit:

+ +
from qiskit import *
+
+g_1 = 1.2
+g_2 = 1.5
+g_3 = 0.7
+g_4 = -0.9
+
+q = QuantumRegister(2, ""q"")
+circuit = QuantumCircuit(q)
+
+circuit.cu1(g_4, q[0], q[1])
+circuit.x(q[1])
+circuit.cu1(g_3, q[0], q[1])
+circuit.x(q[0])
+circuit.cu1(g_1, q[0], q[1])
+circuit.x(q[1])
+circuit.cu1(g_2, q[0], q[1])
+circuit.x(q[0])
+
+ +

to obtain the controlled version of the circuit we will use Qiskit's get_controlled_circuit() method:

+ +
from qiskit.aqua.utils.controlled_circuit import get_controlled_circuit
+
+control_qubit = QuantumRegister(1, ""a"")
+controlled_circuit = QuantumCircuit(q, control_qubit)
+
+controlled_circuit = get_controlled_circuit(circuit, control_qubit[0])
+print(controlled_circuit.qasm())
+
+ +

How I understand the steps of the get_controlled_circuit() method: +1) it takes your given circuit +2) changes your gates to Qiskit's basis gates (u1, u2, u3, cx). +3) for each given basis gate it modifies and replaces it with the controlled version of it (it has a ""dictionary of methods"" that implements the controlled circuits for all basis gates).

+ +

So, to sum up. Firstly one needs to decompose the given $U$ operator into gates, then for each gate construct the controlled version of it. In other words, if one has a circuit gate_1 gate_2 gate_3, the controlled version of it will look like this controlled_gate_1 controlled_gate_2 controlled_gate_3. If the control qubit is in the $| 1 \rangle$ state all gates will be executed, and if it is in the $| 0 \rangle$ state nothing will happen (as is expected by definition of the control operations). And if you want to implement a controlled version of $U^n$ operator, you can just apply $n$ controlled $U$ circuits.

+ +

Final Notes: To obtain a circuit from a given unitary matrix is not a trivial problem and I don't know a general solution for that. Usually, in QPE algorithm implementations, one is given a Hamiltonian $H$ operator expressed by a sum of Pauli product terms and the problem is to simulate $e^{iHt}$ unitary operator to estimate the phase $\varphi$, from $e^{iHt} | \psi \rangle = e^{iEt} | \psi \rangle = e^{i 2 \pi \varphi} | \psi \rangle$, where $| \psi \rangle$ is some eigenstate of $H$. The $H$ is given in this form:

+ +

$$H = P_1 + P_2 + P_3 + P_3$$

+ +

where $P_s$ are the Pauli terms (like $X \otimes Y \otimes Y$ or $Z \otimes Y$). Simulation of the $e^{i P t}$ for a given $P$ Pauli term can be done as described in J.D. Whitfield et al [1] paper. If we have all circuits for Pauli terms we will be able to simulate the whole Hamiltonian with the use of Trotterization techniques (more info can be found in [1] paper).

+",9459,,9459,,3/14/2020 11:59,3/14/2020 11:59,,,,3,,,,CC BY-SA 4.0 +10181,1,,,3/13/2020 21:29,,2,187,"

I'm performing QFT using the following code:

+ +
# Importing standard Qiskit libraries and configuring account
+from qiskit import *
+from qiskit.tools.monitor import job_monitor
+provider = IBMQ.load_account()
+
+# --- Imports
+from numpy import linalg as LA
+import numpy as np
+
+
+def qftA(circ, n):
+    """"""n-qubit QFT on the qubits in circ.""""""
+    for k in range(n):
+        j = n - k
+        circ.h(j - 1)
+        for i in reversed(range(j - 1)):
+            circ.cu1(2 * pi / 2**(j - i), i, j - 1)
+    for i in range(n//2):
+        circuit.swap(i, n - i - 1)
+
+# --- Parameters
+nBits    = 2
+shots    = 8192
+pi       = np.pi
+
+# --- Input data
+
+# --- Defining the array coefficients
+coefficients = [0., 1., 3., 1.]
+coefficients = coefficients / LA.norm(coefficients)
+
+# --- Defining the quantum circuit
+circuit = QuantumCircuit(nBits, nBits, name = ""Quantum circuit"")
+
+# --- Quantum circuit initialization
+circuit.initialize(coefficients, range(nBits))
+
+# next, do a qft
+qftA(circuit, nBits)
+circuit.measure(range(nBits), range(nBits))
+
+#sim_backend = provider.get_backend('ibmq_16_melbourne')
+#sim_backend = provider.get_backend('ibmq_vigo')
+#sim_backend = provider.get_backend('ibmq_essex')
+sim_backend = BasicAer.get_backend('qasm_simulator')
+
+job = execute(circuit, sim_backend, shots=shots)
+job_monitor(job, interval = 3)
+result = job.result().get_counts()
+
+print(result)
+
+ +

I have performed a comparison between the simulator and machine results:

+ +
QASM SIMULATOR
+{'00': 4648, '01': 1680, '10': 169, '11': 1695}
+
+MELBOURNE
+{'00': 3850, '01': 2180, '10': 508, '11': 1654}
+
+VIGO
+{'00': 4757, '01': 1937, '10': 308, '11': 1190}
+
+ESSEX
+{'00': 4251, '01': 1495, '10': 883, 11': 1563}
+
+LONDON
+{'00': 4280, '01': 1332, '10': 608, '11': 1972}
+
+BURLINGTON
+{'00': 2880, '01': 1638, '10': 1745, '11': 1929}
+
+IBMQX2
+{'00': 4425, '01': 1381, '10': 763, '11': 1623}
+
+OURENSE
+{'00': 4922, '01': 1766, '10': 353, '11': 1151}
+
+
+ARMONK
+single qubit
+
+ +

So, depending on what I use I obtain different results. Could someone tell me why and suggest remedies?

+ +

EDIT +I have removed the swap at the end of the circuit, as suggested by Davit Khachatrya, and these are the results I achieve

+ +
qasm_simulator
+{'00': 4639, '10': 1651, '01': 201, '11': 1701}
+
+ibmq_16_melbourne
+{'00': 4210, '10': 1828, '01': 531, '11': 1623}
+
+ibmq_vigo
+{'00': 4676, '10': 1697, '01': 406, '11': 1413}
+
+ibmq_essex
+{'00': 4013, '10': 1462, '01': 1010, '11': 1707}
+
+ibmq_london
+{'00': 4341, '10': 1565, '01': 678, '11': 1608}
+
+ibmq_burlington
+{'00': 3798, '10': 1376, '01': 1770, '11': 1248}
+
+ibmqx2
+{'00': 4281, '10': 1481, '01': 621, '11': 1809}
+
+ibmq_ourense
+{'00': 4533, '10': 2037, '01': 293, '11': 1329}
+
+ +

My feeling is that I have now less noisy results.

+",10032,,10032,,3/19/2020 8:44,3/19/2020 8:44,Different QFT results when using Simulator or Quantum Machine,,1,12,,,,CC BY-SA 4.0 +10182,2,,10175,3/14/2020 5:15,,3,,"

It takes an infinite amount of information to specify the state of a qubit. That's for the reason you said: those two angles to specify the point on the Bloch sphere are continuous, and that means you need an infinite amount of precision.

+ +

That being said, only one bit of accessible information is gained by measuring a qubit. If you had enough time and money, and many copies of the same state, you could keep doing measurements on the qubit. With each measurement you would narrow down uncertainty on what the exact state of the qubit is.

+ +

As for superdense coding, it does turn out that transferring one qubit from a system of two can transfer both classical bits, but it's important to remember qubits act a bit nonintuitively in larger systems. It's incorrect to say that one qubit is here and the other is there. They together constitute a two-qubit state, which in general is not divisible into two one-qubit states.

+",1867,,,,,3/14/2020 5:15,,,,0,,,,CC BY-SA 4.0 +10183,2,,10175,3/14/2020 6:14,,7,,"

There are two types of information in physics:

+ +
    +
  • Classical information
  • +
  • Quantum information
  • +
+ +

Physics doesn't answer the question ""What is (classical or quantum) information?"". This is philosophic question, and physics never answers questions of this kind. Instead, physics answers another question ""How (classical or quantum) information is measured?"". The answer is trivial:

+ +
    +
  • Classical information is measured in bits
  • +
  • Quantum information is measured in qubits
  • +
+ +

Then people hear this first time, they think this is just a tautology, but this is not; this is mathematically correct way of thinking about information. We don't use vague terms like ""effective information"" and don't ask vague questions like ""What is an (effective) information content of qubit"".

+ +

Now we come to the question: How these two types of information are related?

+ +

First, how many bits are needed to represent a qubit? We need infinite number of bits to represent a qubit with infinite accuracy; but infinite accuracy is never needed; any practical computational problem requires finite accuracy. You can run quantum algorithms on a classical computer, given the classical computer has enough memory (memory requirements grow exponentially with the number of qubits).

+ +

Another question: how many bits can be transmitted by transmitting one qubit?. Here we have 2 fundamental results: Holevo theorem and Superdense coding.

+",2105,,2105,,3/14/2020 6:48,3/14/2020 6:48,,,,0,,,,CC BY-SA 4.0 +10185,1,10201,,3/14/2020 12:05,,2,141,"

The stabilizers of a given graph all commute, thus it must be possible to diagonalize them simultaneously. If I start with one graph state and write down all its stabilizers is there an easy way to derive a complete eigenbasis of the stabilizers in terms of graph states?

+",5705,,5955,,3/14/2020 12:32,3/16/2020 10:19,Constructing an eigenbasis of graph states for a set of stabilizers,,2,0,,,,CC BY-SA 4.0 +10186,1,10188,,3/14/2020 12:06,,4,2101,"

I have a little difficulty with understanding. How do I properly visualize the change of qubit's basis as a rotation?

+ +

Let's say that we have classical basis vectors, $|0\rangle$ and $|1\rangle$. Now, we can change this basis into the $\{|+\rangle, |-\rangle\}$ one by applying a Hadamard gate:

+ +

$$ H|0\rangle = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \frac{|0\rangle + |1\rangle}{\sqrt{2}} = |+\rangle, $$

+ +

$$ H|1\rangle = \frac{1}{\sqrt{2}}\begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 \\ -1 \end{bmatrix} = \frac{|0\rangle - |1\rangle}{\sqrt{2}} = |-\rangle. $$

+ +

Is there some analogy between the Hadamard gate and classical rotation matrix, which can be defined as

+ +

$$ R(\theta) = \begin{bmatrix} \cos \theta & -sin \theta \\ \sin \theta & \cos \theta \end{bmatrix},$$

+ +

for a rotation in the counterclockwise direction by the angle of $\theta$?

+ +

I think that my problem lies in viewing the vectors $|0\rangle$ and $|1\rangle$ as two perpendicular vectors on a plane of real numbers. But, we are dealing with two vectors of complex numbers, so I guess we shouldn't think of them in this way, but rather than that, use the Bloch sphere?

+",2098,,2105,,3/15/2020 20:06,3/15/2020 20:06,How should I understand the change of qubit's basis as a rotation?,,2,1,0,,,CC BY-SA 4.0 +10187,2,,10186,3/14/2020 12:45,,1,,"

The first postulate of quantum mechanics that can be found in the M. Nielsen and I. Chuang textbook:

+ +

Postulate 1: Associated to any isolated physical system is a complex vector space with the inner product (that is, a Hilbert space) known as the state space of the system. The system is completely described by its state vector, which is a unit vector in the system’s state space.

+ +

So, If one has some state $|\psi\rangle = \alpha |0\rangle + \alpha |1\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix}$, it can be described as a vector in the Hilbert space with $\alpha$ and $\beta$ complex coordinates. Because of normalization $|\alpha|^2 + |\beta|^2 = 1$, the length of that vector is $1$. When we apply a unitary operator the length doesn't change (still $|\alpha'|^2 + |\beta'|^2 = 1$). So unitary operations are just rotations of that vector in the Hilbert space (they don't change the length of it). If we change the basis with a unitary operator then it can be described as a rotation of basis vectors in the Hilbert space (the basis vectors will not change their lengths, they will just point to the other directions).

+ +

As mentioned in the comments, not only this. Like for rotations in the 3D Euclidean space, the inner product of two vectors in the Hilbert space is also preserving under the unitary transformation (Definition 2. or 3. from wiki). For 3D Euclidean space rotations, this also implies that the angles between the vectors are not changing. For basis vectors in the Hilbert space, this means that if they were orthogonal they will stay orthogonal after the unitary transformation.

+",9459,,9459,,3/14/2020 18:34,3/14/2020 18:34,,,,4,,,,CC BY-SA 4.0 +10188,2,,10186,3/14/2020 13:32,,5,,"

Hadamard gate can be interpreted as a rotation in 3D Euclidean space (on Bloch sphere) by angle $\pi$ around X+Z axis.

+ +

The qubit rotation by angle $\theta$ around axis pointed by unit vector $\textbf{n}=\{n_x,n_y,n_z\}$ is described by rotation operator ($X$, $Y$ and $Z$ are Pauli matrices) +\begin{align} +R_{\textbf{n}}(\theta)=&n_xe^{-i\frac{\theta}{2}X}+n_ye^{-i\frac{\theta}{2}Y}+n_ze^{-i\frac{\theta}{2}Z}=\\ +=&\begin{pmatrix} +\cos\frac{\theta}{2}-in_z\sin\frac{\theta}{2}&(-in_x-n_y)\sin\frac{\theta}{2}\\ +(-in_x+n_y)\sin\frac{\theta}{2}&\cos\frac{\theta}{2}+in_z\sin\frac{\theta}{2} +\end{pmatrix} +\end{align} +If we choose $\theta = \pi$ and $\textbf{n}=\{\frac{1}{\sqrt{2}},0,\frac{1}{\sqrt{2}}\}$, then +\begin{align} +R_{\textbf{n}}(\pi)=&\begin{pmatrix} +-\frac{i}{\sqrt{2}}&-\frac{i}{\sqrt{2}}\\ +-\frac{i}{\sqrt{2}}&\frac{i}{\sqrt{2}} +\end{pmatrix}=-\frac{i}{\sqrt{2}}\begin{pmatrix} +1&1\\ +1&-1 +\end{pmatrix} +\end{align}

+ +

which coincides with Hadamard gate up to the global phase $-i$

+",2105,,2105,,3/15/2020 20:03,3/15/2020 20:03,,,,0,,,,CC BY-SA 4.0 +10189,1,,,3/14/2020 14:10,,2,357,"

Seeing a state of qubit is too complicated in Cirq +I don't want to simulate, I would be happy for debugging, to see the probability/ amplitude of the state of a qubit, without measure and simulate

+ +

Something like:

+ +
circuit = cirq.Circuit()
+msg, R, S = cirq.LineQubit.range(3)
+
+circuit.append([cirq.H(R),cirq.CNOT(R, S)])
+
+print(R.state)
+""R = 0.12|0>+0.58|1>""
+or
+""(0.12,0.58)
+
+ +

Is there anyway to do this?

+",10364,,5955,,3/14/2020 14:20,3/14/2020 18:20,Cirq - Print state of qubit,,1,1,,,,CC BY-SA 4.0 +10190,1,,,3/14/2020 16:33,,1,126,"

Can someone help me in understanding the program on the link given below? +I would really appreciate if someone could give a detailed explanation ...

+ +

https://github.com/quantumlib/Cirq/blob/master/examples/hhl.py

+",10365,,5955,,3/14/2020 17:07,3/14/2020 17:07,Explanation of HHL Cirq implementation,,0,5,,3/15/2020 21:54,,CC BY-SA 4.0 +10191,2,,10189,3/14/2020 18:20,,4,,"

Your mental model of how cirq works is slightly off. You don't invoke operations on a qubit in one line and then check how that qubit changed in another line. You create a circuit in one line and then ask about its properties, such as its effect on a qubit, in another line.

+ +

In this case, you want to ask what the final_wavefunction of your circuit is and then trace out the other qubits. The output of final_wavefunction is just a normal numpy array, which you can then analyze. To avoid a gotcha where qubits not operated on by the circuit are not included in the wavefunction, it's important to specify a qubit_order for final_wavefunction. Cirq also includes methods like wavefuntion_partial_trace_as_mixture which can tell you about specific qubits or subsets of qubits from a wavefunction. The main annoyance there is that because all you have is a numpy array you need to talk in indices instead of in qubits.

+ +

Basically, do this:

+ +
import cirq
+
+msg, R, S = cirq.LineQubit.range(3)
+circuit = cirq.Circuit(cirq.H(R), cirq.CNOT(R, S))
+
+full_wavefunction = cirq.final_wavefunction(
+    circuit,
+    qubit_order=[msg, R, S])
+qubit_mixture = cirq.wavefunction_partial_trace_as_mixture(
+    full_wavefunction,
+    keep_indices=[1])  # offset 1 in qubit order [msg, R, S] is R
+
+for probability, case in qubit_mixture:
+    print(f'{probability:%} {cirq.dirac_notation(case)}')
+
+# prints:
+# 49.999997% |0⟩
+# 49.999997% |1⟩
+
+",119,,,,,3/14/2020 18:20,,,,0,,,,CC BY-SA 4.0 +10192,1,10193,,3/14/2020 18:28,,2,96,"

Considering a 3 qubit system, what does the matrix operation will look like if I apply CNOT on qubit 1 and qubit 2 and then apply CNOT on qubit 1 and qubit 3?

+",10366,,,,,3/17/2020 10:05,2 qubit gate operation on multi qubit systems,,1,1,,,,CC BY-SA 4.0 +10193,2,,10192,3/14/2020 19:02,,1,,"

By taking into account this representation of the CNOT gate:

+ +

$$CNOT = | 0 \rangle \langle 0 | \otimes I + | 1 \rangle \langle 1 | \otimes X$$

+ +

We can write:

+ +

$$CNOT(1, 3) = | 0 \rangle \langle 0 | \otimes I \otimes I + | 1 \rangle \langle 1 | \otimes I \otimes X$$

+ +

$$CNOT(1, 2) = | 0 \rangle \langle 0 | \otimes I \otimes I + | 1 \rangle \langle 1 | \otimes X \otimes I$$

+ +

That's why:

+ +

\begin{align*} +&CNOT(1, 3) CNOT(1, 2) = | 0 \rangle \langle 0 | \otimes I \otimes I + | 1 \rangle \langle 1 | \otimes X \otimes X = \\ +&= +\begin{pmatrix} +1 & 0 \\ +0 & 0 +\end{pmatrix} +\otimes +\begin{pmatrix} +1 & 0 \\ +0 & 1 +\end{pmatrix} +\otimes +\begin{pmatrix} +1 & 0 \\ +0 & 1 +\end{pmatrix} ++ +\begin{pmatrix} +0 & 0 \\ +0 & 1 +\end{pmatrix} +\otimes +\begin{pmatrix} +0 & 1 \\ +1 & 0 +\end{pmatrix} +\otimes +\begin{pmatrix} +0 & 1 \\ +1 & 0 +\end{pmatrix} = +\end{align*}

+ +

$$= +\begin{pmatrix} +1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ +0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ +0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ +0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ +\end{pmatrix}$$

+ +

Answers to the related questions: [1] and [2].

+",9459,,9459,,3/17/2020 10:05,3/17/2020 10:05,,,,2,,,,CC BY-SA 4.0 +10194,1,10196,,3/14/2020 22:56,,2,186,"

I am implementing the teleportation algorithm on IBM Q Experience (GUI interface). Certain operations on the third qubit are only performed if the classical measurement result is 1, for example

+ +
if (c==1) x q[2];
+
+ +

However, it removes all the if statements after it is transpiled (lines 19 and 21). Do you know what I did wrong?

+ +

+",9676,,9006,,3/14/2020 23:11,3/16/2020 14:13,How to implement controlled gate based on measurement (quantum teleportation)?,,2,0,,,,CC BY-SA 4.0 +10195,1,,,3/14/2020 23:00,,3,56,"

What is the cost (number of gates) of $\sum_{i=0}^{N-1}| i \rangle \langle i|\otimes U_i$ in terms of $N$ and the costs of the unitaries $U_i$? Say the gate set consists of arbitrary one-qubit gates and the CNOT. The unitaries $U_i$ act on an arbitrary number of qubits.

+ +

I know, for example, that the Toffoli gate, which is of the above form with $N=4$ and $U_3=X$, can be constructed with $6$ CNOTs.

+",8881,,8881,,3/15/2020 19:35,3/15/2020 19:35,Cost of controlled-$U_i$,,0,4,,,,CC BY-SA 4.0 +10196,2,,10194,3/14/2020 23:08,,3,,"

Currently IBM Q does not support IF statement on real quantum processor. The IF can be used on simulator only. However, there is a theorem stating that quantum gates controlled by classical register can be replaced by those controlled by qubits before measurement.

+ +

So, you can simply replace the statement

+ +
measure q[1] -> c[1];
+if (c == 1) x q[2];
+
+ +

by

+ +
cx q[1], q[2];
+
+ +

i.e. qubit $q_1$ controls CNOT acting on $q_2$.

+ +

Similarly, you can do that for controlled $Z$ gate. In the end, you will get same results as with IF statement.

+",9006,,,,,3/14/2020 23:08,,,,4,,,,CC BY-SA 4.0 +10197,2,,10185,3/15/2020 0:47,,2,,"

I'm not sure I understand the question, since this seems quite straightforward.

+ +

Graph states are Clifford states, so for a state on $n$ qubits, the set of stabilizers has $n$ generators looking like

+ +

$$i^k P_1\otimes\ldots\otimes P_n$$

+ +

where $k\in\{0,1,2,3\}$ and the $P$'s are Pauli $X,Y,$ or $Z$ operators. (For graph states, these stabilizers look like $\{X_v Z_{\text{Nbhd}(v)} : v \in V\}$ )

+ +

Each Pauli has two eigenvectors. If we choose one of them and call it $|\psi_i\rangle$, and call its corresponding eigenvalue $\lambda_i$, for each $P_i$, then $|\psi_1\rangle\otimes\ldots\otimes|\psi_n\rangle$ will be an eigenvector of the stabilizer with eigenvalue $i^k\prod_i \lambda_i$.

+",6118,,,,,3/15/2020 0:47,,,,0,,,,CC BY-SA 4.0 +10198,1,,,3/15/2020 9:58,,0,82,"

Is Quantum Entanglement the one-dimensional spatial relationship between two particles as described by mathematics?

+ +

By one dimensional I mean, when they travel at opposite directions their spin is also opposite (without any spooky communication between the two, just the plain fact of their direction as described by our observations).

+",10370,,55,,3/15/2020 17:31,3/15/2020 17:31,Is Quantum Entanglement the one-dimensional spatial relationship between two particles as described by mathematics?,,1,18,,,,CC BY-SA 4.0 +10199,1,,,3/15/2020 11:26,,5,71,"

The following diagram is from Experimental Realization of a Quantum Autoencoder: The Compression of Qutrits via Machine Learning +

+ +

How this setup works:

+ +

What will be obtained from this set up is the state vector of the input light (I don't use the term 'photon' because it might not be necessary) just before entering stage (c) and its state vector when exiting stage (c). Due to the |H> |V> two different polarization states and two different optical paths (upper one and lower one), there are three bases states (notice that this beam displacer only deflects |v> polarized light so not four bases), so its state vector is 3-dimensional at the input of (c) and is expected to be 2-dimensional at the output of (c) because the autoencoder part is supposed to compress the state vector such that the upper path basis is always 0 valued.

+ +

My question is, why is it necessary to use single photon for this experiment?

+ +

In order to distinguish the statistics of different state vectors, I can just use something to measure the intensity of the output light at the two optical path; specifically for the lower path at output, I use another beam displacer to separate V and H light and measure their intensities separately. With knowing those intensities, I can get the coefficients of each basis and hence known exactly the state vector, or can I?

+",7739,,7739,,3/18/2020 4:43,3/18/2020 4:43,Are single photons necessary for this quantum autoencoder implementation?,,0,7,,,,CC BY-SA 4.0 +10200,2,,10198,3/15/2020 12:51,,2,,"

A qubit is a two-level quantum system and these two-levels in some hardware can be implemented by spins of the electron, but it's not the only option (can be just two ""stabile"" quantum states not essentially associated with spins). In this sense it is not only about the spin (directional) correlation between qubits, it's about state correlation between them. But suppose that we have spin qubits: two quantum levels are two spin directions (up or down) in some chosen direction. An example of an entangled state for two qubits:

+ +

$$| \psi \rangle = \frac{1}{\sqrt{2}}\left( | \downarrow_z \rangle| \downarrow_z \rangle + | \uparrow_z \rangle| \uparrow_z \rangle \right)$$

+ +

This means that if we will do a measurement of spin in the z-direction we will always measure both qubits down or up (nice explanation of the entanglement 2:50 - 4:15 of Anton Zeilinger's presentation). But not only this. A valid question is what is our $|\psi\rangle$ state expressed by spin up and down states in x-direction. In other words what will be the measurement results, if we measure the spin in the x-direction. Note that (video lecture by Allan Adams about spin: especially from 47:45-52:45):

+ +

\begin{align*} +| \uparrow_z \rangle = \frac{1}{\sqrt{2}}\left( | \uparrow_x \rangle + | \downarrow_x \rangle \right) +\qquad +| \downarrow_z \rangle = \frac{1}{\sqrt{2}}\left( | \uparrow_x \rangle - | \downarrow_x \rangle \right) +\end{align*}

+ +

That's why:

+ +

$$| \psi \rangle = \frac{1}{\sqrt{2}}\left( | \downarrow_x \rangle| \downarrow_x \rangle + | \uparrow_x \rangle| \uparrow_x \rangle \right)$$

+ +

So, if we will measure in x-direction we will still have a correlation between the $| \uparrow_x \rangle$ and $| \downarrow_x \rangle$ measurement results of two entangled qubits. The same is true for y-direction. Thus, this is not only about a one-dimensional correlation. And, it is not about where are physically our qubits: they can be in a fixed position, they can be at some distance and no matter what the measurement results should be the same.

+ +

For more, I highly recommend this lecture by Allan Adams (about separable states and entangled states from 28:33-36:02) and this video from Veritasium youtube channel.

+",9459,,9459,,3/15/2020 13:00,3/15/2020 13:00,,,,0,,,,CC BY-SA 4.0 +10201,2,,10185,3/15/2020 13:38,,3,,"

If you start with one graph state, which is an eigenstate of stabilizer (each of which comprises an X tensored with a bunch of Zs), then the other eigenstates of those stabilizers are the original state acted on by Z rotations (take all possible combinations). To see this note the commutation and anticommutation relations between a tensor product of Zs and each stabilizer.

+ +

Consider a stabilizer of the form $K_n=X_nZ_iZ_j\ldots Z_k$, i.e. a graph-state stabilizer with a Pauli $X$ on qubit $n$, and a bunch of $Z$s on some other qubits (related to the graph structure). By definition, the graph state satisfies +$$ +K_n|\psi\rangle=|\psi\rangle +$$ +for all $n$. Now, let +$$ +|\Psi_x\rangle=\left(\bigotimes_{i=1}^nZ^{x_i}\right)|\psi\rangle, +$$ +for $x\in\{0,1\}^n$, a binary string. If we apply the stabilizers to such a state, we get +$$ +K_n|\Psi_x\rangle=K_n\left(\bigotimes_{i=1}^nZ^{x_i}\right)|\psi\rangle=\left\{\begin{array}{cc} +\left(\bigotimes_{i=1}^nZ^{x_i}\right)K_n|\psi\rangle & x_n=0 \\ +-\left(\bigotimes_{i=1}^nZ^{x_i}\right)K_n|\psi\rangle & x_n=1 +\end{array}\right. +$$ +Thus, every $|\Psi_x\rangle$ is an eigenstate of every stabilizer, and with a different pattern of $\pm 1$ eigenvalues (and must therefore be mutually orthogonal).

+ +

While it must be the case that the different states $|\Psi_x\rangle$ are orthogonal, I think it's useful to think about this in terms of the way that the graph states are created. Remember that $|\psi\rangle$ is created from qubits in the $|+\rangle$ state and then have controlled-phase gates applied between them. Now, if I evaluate $\langle\Psi_y|\Psi_x\rangle$, think of this as a calculation +$$ +\langle+|^{\otimes n}CP\cdot Z_{x\oplus y}\cdot CP|+\rangle^{\otimes n} +$$ +where $CP$ represents the collection of controlled phase gates. Pauli $Z$ commutes with controlled phase, which means we can bring the two CPs together and annihilate them, leaving behind +$$ +\langle+|^{\otimes n} Z_{x\oplus y}|+\rangle^{\otimes n}. +$$ +Given that $x\neq y$, there is at least one $Z$, and we know $\langle +|Z|+\rangle=\langle -|+\rangle=0$.

+ +

This way of thinking gives another way of describing the basis of graph states: prepare each qubit in either $|+\rangle$ or $|-\rangle$, and combine with controlled-phases. Each different choice of $\pm$ gives a different graph state in the basis.

+",1837,,1837,,3/16/2020 10:19,3/16/2020 10:19,,,,3,,,,CC BY-SA 4.0 +10202,1,10205,,3/16/2020 10:23,,4,79,"

In the paper ""Quantum Expectation-Maximization for Gaussian Mixture Models"" I encountered the following proposition :

+ +

Consider two vectors x,y and $\theta$ the angle between x and y, $\theta < \frac{\pi}{2}$. Then $||x - y|| \leq \epsilon$ implies $|| |x\rangle - |y\rangle || \leq \frac{\sqrt 2 \epsilon}{||x||}$.

+ +

I'm not sure how to interpret the link between $x$ and $| x \rangle $ ? +In the case x is an integer, for example $x = 4$ then I'd say that $| x \rangle = | 100 \rangle $. But what about $x = 3.5$ or $x = (2.5, 2.5)$ ? +In those cases what $| x \rangle$ would be ?

+",10065,,,,,3/16/2020 12:58,How should I understand the link between $x$ and $| x \rangle $?,,1,0,,,,CC BY-SA 4.0 +10203,2,,10181,3/16/2020 12:09,,1,,"

What I have obtained by running 4 times the same code on ""qasm_simulator"":

+ +
{'00': 4656, '01': 1613, '10': 185, '11': 1642}
+{'00': 4564, '01': 1735, '10': 179, '11': 1618}
+{'00': 4581, '01': 1646, '10': 184, '11': 1685}
+{'00': 4602, '01': 1684, '10': 181, '11': 1629}
+
+ +

Here we don't have noise, but still, the results are different. So, one can expect some variance between the results. In your results, the noisiest result was from +Burlington, then from Melbourne (for Melbourne the reason can be found in this answer). The rest QCs weren't performing comparably bad. You can try to apply the technique that you have used in this question or look to this tutorial for repetition codes. Still, their performance will depend on the circuit depth that you have.

+ +

Other suggestions

+ +

The noise crucially depends on the depth of your circuit. When I tried to run the code on Essex I saw that the gate number was 14 (7 CNOTs that contribute to the noise more than single-qubit gates). We always should try to minimize the gate number. For example, there were three CNOTs at the end of the circuit that implements the swap gate from QFT and they can be deleted, because specifically, for this case, they just swap the output results that can be done by post-processing by a classical computer.

+ +

Also, there can be errors that can be tolerated depending on the algorithm that you use, and in those cases, one even shouldn't worry about the noise.

+",9459,,9459,,3/16/2020 12:38,3/16/2020 12:38,,,,0,,,,CC BY-SA 4.0 +10205,2,,10202,3/16/2020 12:58,,5,,"

Generally it's context-specific what the label means. For example, if $x$ and $y$ are integers, then if $x\neq y$ then $|x\rangle$ and $|y\rangle$ are orthogonal (since they are different binary strings).

+ +

I haven't read the paper you mentioned but in the ""Preliminaries"" section of 3.1, they describe what they mean by $| x\rangle$. Specifically: They assume $x\in \mathbb{R}^d$, and they define +$$|x\rangle = \frac{1}{\Vert x\Vert}\sum_{j=1}^d x_j|j\rangle$$

+ +

So the $|j\rangle$ will be computational basis vectors, i.e. for $j=1$, $|j\rangle = |0\dots 01\rangle$, etc. The components of $x$ give the amplitudes of each of those basis vectors in some superposition.

+ +

With this definition of $|x\rangle$, the ""Claim 3.4"" should follow.

+",4517,,,,,3/16/2020 12:58,,,,1,,,,CC BY-SA 4.0 +10206,2,,10194,3/16/2020 14:13,,1,,"

I contacted @fran-cabrera from the IBMQ team and he could reproduce the bug!

+ +

The problem is with the visualization of the transpiled circuit, not the execution (the result should be correct). The team is working on solving it and they expect to deploy a fix at the end of the week.

+ +

I ran you example in Qiskit and it seems to work

+ + + +
IBMQ.load_account()
+provider = IBMQ.get_provider(group='open')
+device = provider.get_backend('ibmq_16_melbourne')
+
+qasm_string = """"""
+OPENQASM 2.0;
+include ""qelib1.inc"";
+qreg q[3];
+creg c[3];
+h q[1];
+cx q[1],q[2];
+cx q[0],q[1];
+h q[0];
+measure q[1] -> c[1];
+if(c==1) x q[2];
+measure q[0] -> c[0];
+if(c==1) z q[2];
+measure q[2] -> c[2];
+""""""
+
+circuit = QuantumCircuit.from_qasm_str(qasm_string)
+circuit.draw('text')
+
+ +
                         ┌───┐┌─┐          
+q_0: |0>─────────────■───┤ H ├┤M├──────────
+        ┌───┐      ┌─┴─┐ └┬─┬┘└╥┘          
+q_1: |0>┤ H ├──■───┤ X ├──┤M├──╫───────────
+        └───┘┌─┴─┐ ├───┤  └╥┘  ║  ┌───┐ ┌─┐
+q_2: |0>─────┤ X ├─┤ X ├───╫───╫──┤ Z ├─┤M├
+             └───┘ └─┬─┘   ║   ║  └─┬─┘ └╥┘
+                  ┌──┴──┐  ║   ║ ┌──┴──┐ ║ 
+ c_0: 0 ══════════╡     ╞══╬═══╩═╡     ╞═╬═
+                  │     │  ║     │     │ ║ 
+ c_1: 0 ══════════╡ = 1 ╞══╩═════╡ = 1 ╞═╬═
+                  │     │        │     │ ║ 
+ c_2: 0 ══════════╡     ╞════════╡     ╞═╩═
+                  └─────┘        └─────┘   
+
+ +
result = transpile(circuit,
+                   backend=provider.get_backend('ibmq_16_melbourne'),
+                   seed_transpiler=42)
+result.draw('text', idle_wires=False)
+
+ +
                                            ┌──────────┐┌─┐             
+q_0 -> 0 |0>────────────────────────■───────┤ U2(0,pi) ├┤M├─────────────
+            ┌──────────┐          ┌─┴─┐     └───┬─┬────┘└╥┘             
+q_1 -> 1 |0>┤ U2(0,pi) ├──■───────┤ X ├─────────┤M├──────╫──────────────
+            └──────────┘┌─┴─┐┌────┴───┴────┐    └╥┘      ║ ┌────────┐┌─┐
+q_2 -> 2 |0>────────────┤ X ├┤ U3(pi,0,pi) ├─────╫───────╫─┤ U1(pi) ├┤M├
+                        └───┘└──────┬──────┘     ║       ║ └───┬────┘└╥┘
+                                 ┌──┴──┐         ║       ║  ┌──┴──┐   ║ 
+     c_0: 0 ═════════════════════╡     ╞═════════╬═══════╩══╡     ╞═══╬═
+                                 │     │         ║          │     │   ║ 
+     c_1: 0 ═════════════════════╡ = 1 ╞═════════╩══════════╡ = 1 ╞═══╬═
+                                 │     │                    │     │   ║ 
+     c_2: 0 ═════════════════════╡     ╞════════════════════╡     ╞═══╩═
+                                 └─────┘                    └─────┘     
+
+ +

Based on this, I think your example should work in the IQX jupyter notebooks, included in the IBM Quantum Experience.

+",1859,,,,,3/16/2020 14:13,,,,1,,,,CC BY-SA 4.0 +10207,2,,4707,3/16/2020 22:14,,2,,"

Regarding (c) -

+ +

Too see what can go wrong, we'll need to take a step back and look at Shor's Algorithm assumptions.

+ +

Basically, the algorithm says we need to pick a random $X$, find its order $r$, and finally calculate $X^\frac{r}{2} \pmod N$ to get information about $N$.

+ +

$N$ is of the form $2P$, thus by Chinese Remainder Theorm it will only have two roots modulo $N$, and they will have to be the trivial roots $1$ and $N-1$. That happens because $2$ has only one trivial root, unlike other primes.

+ +

Thus for any $X$ you may pick, $X^\frac{r}{2} \equiv \pm 1 \pmod N$, so you will always end up with the trivial roots, which are not enough for deriving factors of $N$ (not even the factor $2$!)

+ +
+ +

Reference - vazirani lecture on Shor's Algorithm

+",10385,,,,,3/16/2020 22:14,,,,0,,,,CC BY-SA 4.0 +10208,1,,,3/17/2020 5:14,,3,46,"

I am trying to derive the Bloch vector $dr$ for a measurement of a observable in any arbitrary direction $\theta$. For context this is the setup and derivation I have for continuous measurement along the $z$ axis.

+ +

The equation of continuous measurement on observable X has the following form:

+ +

$\frac{d \rho}{d t}=\mathcal{D}[X] \rho+\sqrt{\eta} \mathcal{H}[X] \rho \xi(t)$

+ +

$\mathcal{D}[X] \rho=X \rho X^{\dagger}-\frac{1}{2}\left(X^{\dagger} X \rho+\rho X^{\dagger} X\right)$

+ +

$\mathcal{H}[X] \rho=X \rho+\rho X-\left\langle X+X^{\dagger}\right\rangle \rho$

+ +

Kappa is the measurement strength.

+ +

In Bloch Vector form,

+ +

$\rho=\frac{1}{2}\left(I+x \sigma_{x}+y \sigma_{y}+z \sigma_{z}\right)$

+ +

Then,

+ +

$\mathcal{D}[X] \rho=2 \kappa\left(\sigma_{z} \rho \sigma_{z}-\rho\right)$

+ +

$\mathcal{H}[X] \rho=\sqrt{2 \kappa}\left(\sigma_{z} \rho+\rho \sigma_{z}-2 z \rho\right)$

+ +

To find $dx$

+ +

$\frac{d x}{d t}=\frac{d T r\left(\sigma_{x} \rho\right)}{d t}=2 \kappa\left(\operatorname{Tr}\left(\sigma_{z} \sigma_{x} \sigma_{z} \rho\right)-x\right)+\sqrt{2 \kappa \eta}\left(\operatorname{Tr}\left(\left(\sigma_{x} \sigma_{z}+\sigma_{z} \sigma_{x}\right) \rho\right)-2 x z\right) \xi(t)$

+ +

$=-4 \kappa x-\sqrt{8 \kappa \eta} x z \xi(t)$

+ +

$\frac{d z}{d t}=\frac{d \operatorname{Tr}\left(\sigma_{z} \rho\right)}{d t}=2 \kappa\left(\operatorname{Tr}\left(\sigma_{z}^{2} \rho \sigma_{z}\right)-\operatorname{Tr}\left(\sigma_{z} \rho\right)\right)+\sqrt{2 \kappa \eta}\left(\operatorname{Tr}\left(\sigma_{z}^{2} \rho+\sigma_{z} \rho \sigma_{z}\right)-2 z \operatorname{Tr}\left(\sigma_{z} \rho\right)\right) \xi(t)$

+ +

$=\sqrt{8 \kappa \eta}\left(1-z^{2}\right) \xi(t)$

+ +

Now I am trying to find the $\frac{d z}{d t}$ and $\frac{d x}{d t}$, in the case that the $\mathcal{D}[X]$ and $\mathcal{H}[X]$ terms for the same master equation where becomes $X = \cos(\Theta )\sigma _z+\sin(\Theta )\sigma_x$ along measurement angle $\theta$ are:

+ +

$\mathcal{D}[X] \rho=X \rho X^{\dagger}-\frac{1}{2}\left(X^{\dagger} X \rho+\rho X^{\dagger} X\right)$

+ +

$= \cos^2(\Theta )\sigma _z\rho \sigma _z+\sin^2(\Theta )\sigma _x\rho \sigma _x$

+ +

I am confused on what the simplified form of $\mathcal{H}[X]\rho$ will be as my simplification skills are not very strong

+ +

I would also need help in finding $\frac{d T r\left(\sigma_{x} \rho\right)}{d t}$ and $\frac{d T r\left(\sigma_{z} \rho\right)}{d t}$ with the $\sin$ and $\cos$ terms like the above simplification.

+",10390,,55,,10/27/2020 9:13,10/27/2020 9:13,Deriving Bloch vector $dr$ from master equation,,0,0,,,,CC BY-SA 4.0 +10209,1,,,3/17/2020 6:03,,2,87,"

I've started learning Quantum Computing from the Qiskit Textbook and was able to easily understand or work out everything until it came to the working of Quantum Teleportation

+ +

I can understand the procedure of it, but cannot understand why it works and was unable to work out the math of it. I also couldn't find any source that explained this is in a more simplistic manner.

+ +

Here's the procedure that I have copy-pasted from the textbook:

+ +
+

Step 1: Alice and Bob create an entangled pair of qubits and each one + of them holds on to one of the two qubits in the pair.

+ +

The pair they create is a special pair called a Bell pair. In quantum + circuit language, the way to create a Bell pair between two qubits is + to first transfer one of them to the Bell basis ( |+⟩ and |−⟩ ) by + using a Hadamard gate, and then to apply a CNOT gate onto the other + qubit controlled by the one in the Bell basis.

+ +

Let's say Alice owns q1 and Bob owns q2 after they part ways.

+ +

Step 2: Alice applies a CNOT gate on q1 , controlled by |ψ⟩ (the + qubit she is trying to send Bob).

+ +

Step 3: Next, Alice applies a Hadamard gate to |ψ⟩ , and applies a + measurement to both qubits that she owns - q1 and |ψ⟩ .

+ +

Step 4: Then, it's time for a phone call to Bob. She tells Bob the + outcome of her two qubit measurement. Depending on what she says, Bob + applies some gates to his qubit, q2 . The gates to be applied, based + on what Alice says, are as follows :

+ +

00 → Do nothing

+ +

01 → Apply X gate

+ +

10 → Apply Z gate

+ +

11 → Apply ZX gate

+ +

Note that this transfer of information is classical.

+ +

And voila! At the end of this protocol, Alice's qubit has now + teleported to Bob.

+
+",10376,,55,,4/17/2022 8:23,4/17/2022 8:23,How does quantum state teleportation works?,,0,5,,3/26/2020 16:04,,CC BY-SA 4.0 +10210,2,,7054,3/17/2020 8:33,,3,,"

You say you understand the first step where two-qubit unitaries just convert the single-qubit states into lots of sets of two-qubit states. Good.

+ +

Now, you should also work backwards, from the end of the circuit. The rest of the circuit is another layer of two-qubit unitaries followed by single-qubit measurements. Well, you can change that by incorporating the two together. (For example, Hadamard followed by Z-measurement is the same as X-measurement.) So, those change into two-qubit measurements because, by the same argument as the forward reasoning, the single-qubit states that are projected on are converted into sets of two-qubit states.

+ +

The only issue is how to combine the two-qubit states we've produced with two-qubit measurements. Of course, if any two-qubit states and two-qubit measurements match up perfectly, we can take those out straight away and calculate the probabilities of the different outcomes. So, now imagine what happens if you've got two-qubit states on pairs of qubits $(1,2)$ and $(3,4)$, but we want to do a measurement on qubits $(2,3)$. Well, we write down the 4-qubit state across $(1,2,3,4)$ and apply the measurement. Whatever the outcome (of which there are 4, you you can calculate their probabilities), just pick one, and the output state is a pair of qubits $(1,4)$. Now repeat. For example, you might have another entangled state on qubits $(5,6)$, and want to perform a measurement on $(4,5)$. So, this is exactly the same scenario, which we just repeat the same calculation. Eventually, we've done all the calculations.

+ +

While it's not exactly the same, you may also be interested to read the section ""Linearly assembled quantum states can be efficiently simulated on a classical computer"" in this paper, which is where I learned about similar ideas.

+ +

In terms of what happens if you add something to the depth of the circuit, well think about trying to take into account two layers of unitaries on the initial state. The first layer makes two-qubit states as before. The second layer might then combine them together. It could combine all of them together (consider, for example, a set of qubits arranged along a line, each in the $|+\rangle$ state. You first perform controlled-phase gates between pairs $(2n-1,2n)$. Then you perform controlled-phase gates between pairs $(2n,2n+1)$ in the second layer. This state is completely entangled; there is no separability. So the described strategy cannot work (although that doesn't rule out other simulation strategies).

+",1837,,1837,,3/17/2020 8:38,3/17/2020 8:38,,,,0,,,,CC BY-SA 4.0 +10211,2,,4252,3/17/2020 9:51,,0,,"

firstly write CNOT⊗𝐼2 matrix, then change the order of index2 and index3 with matlab. in this way, you can do any number of qubits.

+",10392,,,,,3/17/2020 9:51,,,,1,,,,CC BY-SA 4.0 +10212,1,13915,,3/17/2020 12:36,,7,1277,"

There is a lot of quantum gates in IBM Q Composer, however, only few are implemented physically while others can be composed of them.

+ +

When one looks at description of a quantum processor in IBM Q interface, there is a list of basis gates. For example those are id, u1, u2, u3, cx for Melbourne processor. However, gates $I$, $U1$ and $U2$ are special cases of $U3$. If one removes statement include ""qelib1.inc""; from QASM code, only $CNOT$ and $U3$ gates are left. So, it seems that all single qubit gates are implemented with $U3$ and there is of course two qubits $CNOT$.

+ +

According to IBM Q manual, $U3$ gate is implemented by three frame changes and two $X_{\pi/2}$ pulses.

+ +

My questions are these:

+ +
    +
  1. Which gates are implemented physically on IBM Q? I would expect $CNOT$ and some single qubit gates but which ones?
  2. +
  3. What are frame changes and $X_{\pi/2}$ pulses used for gate implementation?
  4. +
+",9006,,5955,,3/17/2020 12:57,9/26/2020 10:11,Physical implementation of gates on IBM Q,,1,0,,,,CC BY-SA 4.0 +10213,1,,,3/17/2020 16:53,,1,331,"

I want to calculate eigenvectors and eigenvalues for real symmetric matrix or Hermitian matrix. Can I use this: https://qiskit.org/documentation/api/qiskit.aqua.components.eigs.Eigenvalues.html

+",10395,,9006,,3/17/2020 17:43,3/22/2020 21:11,Eigenvalue and eigenvector in Qiskit,,1,0,,,,CC BY-SA 4.0 +10214,1,10217,,3/17/2020 18:28,,1,59,"

I know that we can measure a state in standard basis (Z) where the post measurement state is either $|0\rangle$ or $|1\rangle$. But can you do a 'half-Z' basis measurement? I mean, you only measure with $|0\rangle \langle0|$ or $|1\rangle \langle1|$. So that when you measure $|+\rangle$, you would get $|0\rangle$ or $|1\rangle$ with equal probability. But if you measure $|0\rangle$ in $|1\rangle \langle1|$, then you would not get a detection with certainty. Is there any implementation of this sort of a 'half-basis'?

+",2403,,55,,10/27/2020 9:13,10/27/2020 9:13,Half of Standard Basis Measurement,,1,1,,,,CC BY-SA 4.0 +10215,1,,,3/17/2020 19:23,,4,1465,"

I have a circuit with different structures, now I'm trying to calculate the fidelity between those with the original one. How do I calculate the fidelity? I want also to initialize the state vector by myself. Can someone show how to compute fidelity for the below example?

+ +

For example if I have a circuit like below,

+ +
q = QuantumRegister(2)
+qc = QuantumCircuit(q)
+qc.cu1(3*pi/4, q[0], q[1]);
+print(qc)
+
+ +

and different structure

+ +
q = QuantumRegister(2)
+qc = QuantumCircuit(q)
+qc.h(q[0]);
+qc.h(q[1]);
+qc.cu1(3*pi/4, q[0], q[1]);
+qc.h(q[0]);
+qc.h(q[1]);
+print(qc)
+
+",9778,,5955,,3/18/2020 8:09,8/29/2021 3:27,How to calculate state fidelity in Qiskit?,,1,0,,,,CC BY-SA 4.0 +10216,1,10220,,3/17/2020 19:30,,10,1443,"

(This is related to Exercise 4.44 in Nielsen and Chuang)

+ +

Deutsch quantum gate is basically a $iR_x(\alpha \pi)$ gate with two control qubits. The constant $\alpha$ is an irrational number that allows to perform any rotation $R_x (\theta)$ by sending $|11\rangle$ to the control qubits. In particular, one can (approximately) construct the set $\{ X, CNOT, \text{Toffoli} \}$ by choosing

+ +

$$\alpha \pi \, \approx \, \pi \mod 2\pi,$$

+ +

such that $R_x(\alpha \pi) \approx X$. My question is: how do you reach quantum universality? I guess you should be able to construct the Hadamard ($H$) and phase ($S$) gates, which together with $CNOT$ and Toffoli give quantum universality. Or else you should be able to construct $R_z(\theta)$ since $R_z(\alpha) R_x(\beta) R_z(\gamma)$ or $R_x(\alpha) R_z(\beta) R_x(\gamma)$ give any one-qubit unitary.

+",9895,,9006,,3/17/2020 22:34,8/16/2021 10:02,Why is Deutsch's gate universal?,,2,0,,,,CC BY-SA 4.0 +10217,2,,10214,3/18/2020 6:03,,2,,"

What you're talking about is called a ""projection"". The projection onto basis state $|\psi\rangle$ is given by:

+ +

$P_{\psi} = |\psi\rangle\langle\psi|$.

+ +

Any measurement operator $M$, such as $Z$ can be written as the sum over projectors, weighted by their respective eigenvalues, such that

+ +

$M = \sum_i \lambda_i P_i$

+ +

where $\lambda_i$ is the real-valued eigenvalue associated with outcome $i$, and $\{i\}$ is a set of orthogonal states such that $P_iP_j = \delta_{ij}$. A measurement basis is said to be complete if it has the property

+ +

$\sum_i P_i = I$

+ +

and hence $\{i\}$ forms an orthonormal basis. What you are describing is an ""incomplete"" measurement basis. Because such an operator does not span a complete basis of the space, one property of such a measurement operator is that the sum of probabilities associated with its measurement is less than one (when taken over all input states).

+ +

So, that's some maths, but what does this mean physically? If you imagine a photon in one of two waveguides, such that the $|0\rangle$ state is associated with it being in one waveguide and $|1\rangle$ in the other, then the measurement of the $Z$ operator is as simple as putting a detector at the end of each waveguide. In the case where your measurement operator is only $|0\rangle\langle 0|$, this equates to a system where you only have a a single detector at the end of the first waveguide.

+ +

What happens then? Well, what you would expect, if you put in a $|0\rangle$ state, you detect it with probability 1. On the other hand, you never detect the $|1\rangle$ state. Similarly, in the case of $|+\rangle$, you detect a photon in the first waveguide half of the time.

+ +

I guess the question that leaves us is how to think of this. Personally, I wouldn't think of it like a half-measurement, but just that you have measurement apparatus that has spans a limited basis and so the information it gathers over other basis states is simply incomplete. In the real world, this is always the case anyway. In the aforementioned photon experiment, it is often the case that no photon arrives at either detector due to a scattering event, and at the end of the day all this is telling us is that the measurement apparatus simply doesn't span the set of all possible states the system can take.

+",391,,,,,3/18/2020 6:03,,,,0,,,,CC BY-SA 4.0 +10218,2,,10215,3/18/2020 9:23,,3,,"

There is more information towards the end of the tutorial here but essentially how you do this is you run both circuits on the state_vector simulator and then you can use the function state_fidelity to work out the fidelity between the two states.

+

The code to do this should look something like this

+
from qiskit.quantum_info import state_fidelity
+
+# set up qc1 and qc2
+
+backend = Aer.get_backend('statevector_simulator')
+
+sv1 = execute(qc1, backend).result().get_statevector(qc1)
+sv2 = execute(qc2, backend).result().get_statevector(qc2)
+
+print(state_fidelity(sv1, sv2))
+
+",5955,,18113,,8/29/2021 3:27,8/29/2021 3:27,,,,2,,,,CC BY-SA 4.0 +10220,2,,10216,3/18/2020 10:14,,7,,"

I have thoughts on a couple of different approaches, although I'm sure there'll be simpler options.

+ +

Firstly, imagine you start from a two-qubit state $|00\rangle$, and apply an $R_x$ rotation with an angle equivalent to half that of a Pauli $X$ to the first qubit (I forget which convention N&C is using for their rotation gates). Then apply a controlled-not controlled off the first qubit and targeting the second qubit. Next, apply the inverse of the first rotation. Finally, measure the first qubit. If you get answer $|1\rangle$, the second qubit is in the $|-\rangle$ state. If it isn't, discard and repeat. So, we can produce the $|-\rangle$ state. If you input this as the target qubit of the controlled-controlled-$R_x$ (of arbitrary rotation angle), and have one of the controls in the $|1\rangle$ state, you get an arbitrary $Z$ rotation on the other control qubit.

+ +

So, we know we can do arbitrary $X$ and $Z$ rotations, meaning that you can make any single-qubit unitary. Combine that with controlled-not and you know you have universality.

+ +

A second approach that I had in mind (I've not worked out the details) is to go for encoded universality, in much the same way as you can use to show that computation with real amplitudes is universal. To sketch the idea: for a computation on $N$ logical qubits, you need $N+1$ physical qubits. The extra qubit is a phase register, so if you have $|x\rangle(\cos\theta|0\rangle+\sin\theta|1\rangle)$, that is equivalent to $e^{i\theta}|x\rangle$ in a regular quantum computation (this is the real computation version. I think the definition will need to change slightly here). Now $X$ rotations and controlled-nots are performed exactly as they normally would be in the first $N$ qubits. However, a phase gate is now implemented by a controlled-$X$ rotation, controlled of the qubit that's supposed to be acquiring the phase, targeting the phase qubit. If you can achieve that set of gates, you should be able to compose that for universality.

+",1837,,1837,,3/18/2020 13:35,3/18/2020 13:35,,,,8,,,,CC BY-SA 4.0 +10221,2,,10216,3/18/2020 12:22,,4,,"

A classical proof involves Lie algebra to show that the Deutsch's three Qubits gate is universal for three qubits gates and then showing that we can construct a $ n $ qubits Deutsch's gate using Toffoli gates and three qubits Deutsch's gate only, so the results extends to $n$ qubits.

+

You can find the proof in the caltech's course on quantum computation, page 29 to page 33. It's not an easy read (I mostly don't get it), but it seems complete. I hope it helps.

+

Another lead going your way would be to prove that a combination of Deutsch's three qubits gate can reproduce the Hadamard gate as the set $\{H, T\}$ (with $H$ for Hadamard and $T$ for Toffoli) is universal (proof in A Simple Proof that Toffoli and Hadamard are Quantum Universal by Dorit Aharonov). However I'm not able to tell if a combination of Deutsch's three qubits gate can give a Hadamard gate, it's only speculative.

+",10065,,14843,,8/16/2021 10:02,8/16/2021 10:02,,,,0,,,,CC BY-SA 4.0 +10223,1,10224,,3/18/2020 13:19,,3,105,"

In the Wikipedia's Quantum channel article, it is said that a purely quantum channel $\phi$ (it's not exactly the same phi calligraphy but it's close), in the Schrodinger picture, is a linear map between density matrices acting on two Hilbert spaces. Then properties of this mapping are given and we find the following notation :

+ +

$$I_n \otimes \Phi$$ + We find again this difference of notation in the Heisenberg picture paragraph. +However I believe $\phi$ and $\Phi$ are the same and I don't understand the change of notation between the twos. Is there a difference justifying this change or is it a lack of coherence of the notation ?

+",10065,,9006,,3/18/2020 14:38,3/18/2020 14:54,Confusing notation in Wikipedia's quantum channel article,,1,2,,,,CC BY-SA 4.0 +10224,2,,10223,3/18/2020 14:54,,3,,"

I think it's just notational inconsistency. If you look at the page code, the symbols are generated in two different ways: in the text, someone has just inserted the greek letter symbol (presumably a unicode character) whereas in the equation, they've used LaTeX. They're clearly both supposed to be capital phi.

+",1837,,,,,3/18/2020 14:54,,,,1,,,,CC BY-SA 4.0 +10225,1,,,3/18/2020 18:50,,2,25,"

Currently, I'm learning about topological quantum computers.

+ +

In one of the explained techniques, cooper pairs in superconductors are considered, where a cooper pair with a hole form a Majorana bound state. The pair is at the zero energy level, and as non-zero energies are not allowed, this should protect the Majorana bound state. However, as we have a pair, it is possible for the particles to each have a non-zero and opposite energy. Effectively the total energy is still zero, but each of the particles has non-zero energy.

+ +

If we bring these particles far apart, there will be no interaction between them. Consequently, each of the two cannot move to a non-zero energy, as that would violate the particle-hole symmetry.

+ +

What I don't understand is: +How can the particles be considered independent, such that their energy is protected and the particle remains at zero energy, while we still have the Majorana properties from the interaction of the two particles?

+",2005,,9006,,3/18/2020 22:18,3/18/2020 22:18,Why does non-locality and the particle-hole symmetry not contradict each other?,,0,0,,,,CC BY-SA 4.0 +10227,2,,7054,3/19/2020 5:21,,-1,,"

DaftWullie's answer outlines the idea pretty well, so I wanted to provide some more specifics on the fundamental gadget he describes and lay it out a bit more methodically.

+ +

Once the first step is performed, there exists a quantum state that is distributed over a set of qubits where qubits are at most pairwise entangled. If we now consider simulating the application of an arbitrary set of two and one qubit measurements to this state, then there are six different cases:

+ +
    +
  1. A single-qubit measurement on a single non-entangled qubit.
  2. +
  3. A single-qubit measurement on one qubit of a two-qubit entangled state.
  4. +
  5. A two-qubit measurement on two disentangled qubits, both of which are non-entangled qubits.
  6. +
  7. A two-qubit measurement on an entangled pair of qubits.
  8. +
  9. A two-qubit measurement on two disentangled qubits, where only one is part of two-qubit entangled state.
  10. +
  11. A two-qubit measurement on two disentangled qubits, where both are part of two separate two-qubit entangled states.
  12. +
+ +

For 1, it is easy to see that this is classically simulable, since there are only two probabilities to calculate. Once these are calculated, the target qubit is no longer relevant and may be ignored by the simulation.

+ +

For 2, there are similarly only two probabilities to calculate, except this time, the measurement leaves a single qubit, which may be part of another measurement that can be part of a future instance of cases 1, 3, or 5.

+ +

For 3 and 4, since only four states are needed to span a two-qubit measurement basis, there are only four possible probabilities to calculate, regardless of whether the state is entangled or not. Similarly to 1, once these probabilities are calculated, both qubits may be ignored.

+ +

For 5, again, only four probabilities need be calculated, but this time, after the measurement, a single qubit remains, which similarly can be part of a future instance of cases 1, 3, or 5.

+ +

For 6, we also have four probabilities that need calculating, except now we have the case that the state which exists on the two remaining qubits which are not part of the measurement. This phenomena is known as ""entanglement swapping"". Hence, in the simulation, we apply the measurement and create a two-qubit entangled state that can then be part of a future instance of cases 2, 4, or 6.

+ +

So the algorithm goes as follows:

+ +
    +
  1. Apply the first stage, creating a state with at most pairwise entanglement.
  2. +
  3. For each two- or single-qubit measurement in the second stage, extract the desired measurement outcome probabilities and sample any output state accordingly. Because you never create a state which cannot be later simulated efficiently, this process can be repeated until you have performed all measurements.
  4. +
  5. Any unmeasured qubits are simply discarded.
  6. +
+ +

Adding a third layer breaks this because now it is possible to create a state which is more than pair-wise entangled on which universal quantum computation can be performed. To see this, observe that such a protocol is equivalent to three stages of pairwise entanglement followed by a round of single-qubit measurements. It can then be seen that three such entangling stages are sufficient to produce the trivalent hexagonal cluster state lattice, a state which is universal for measurement-based quantum computation [1] (along with single-qubit measurements and classical communications). Once we have such a state, the final stage could then be used to perform a universal measurement-based quantum computation. Hence, if it were possible to simulate such states efficiently, we would be able to simulate quantum computers efficiently as well, which we do not expect to be true.

+ +

[1] Van den Nest, Maarten, et al. ""Universal resources for measurement-based quantum computation."" Physical review letters 97.15 (2006): 150504. Link here.

+",391,,391,,3/21/2020 16:47,3/21/2020 16:47,,,,0,,,,CC BY-SA 4.0 +10228,1,,,3/19/2020 5:47,,1,238,"

I am trying to implement Quantum Teleportation Algorithm on an actual device, I am using IBM-Q Jupyter notebook for the same purpose.

+ +

The code is as follows:

+ +
import qiskit as qk
+from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit
+from qiskit import execute, Aer
+from qiskit import IBMQ
+from qiskit.visualization import plot_histogram
+%config InlineBackend.figure_format = 'svg'
+
+def apply_secret_unitary(secret_unitary, qubit, quantum_circuit, dagger):
+  functionmap = {
+    'x': quantum_circuit.x,
+    'y': quantum_circuit.y,
+    'z': quantum_circuit.z,
+    'h': quantum_circuit.h,
+    't': quantum_circuit.t
+  }
+  if dagger == 1:
+    functionmap['t'] = quantum_circuit.tdg
+
+  if dagger:
+    [functionmap[unitary](qubit) for unitary in secret_unitary]
+  else:
+    [functionmap[unitary](qubit) for unitary in secret_unitary[::-1]]
+
+secret_unitary = 'hzxhzhx'
+
+qc = QuantumCircuit(3, 1)
+'''
+qc[0] -> The qubit to be teleported
+qc[1] -> entangled state, possessed by alice
+qc[2] -> entangled state, possessed by bob
+'''
+
+apply_secret_unitary(secret_unitary, qc.qubits[0], qc, dagger = 0) 
+qc.barrier()
+qc.h(1)
+qc.cx(1, 2)
+qc.barrier()
+qc.cx(0, 1)
+qc.h(0)
+qc.cx(1, 2)
+qc.cz(0, 2)
+apply_secret_unitary(secret_unitary, qc.qubits[0], qc, dagger = 1)
+qc.barrier()
+qc.measure(2, 0);
+qc.draw(output= 'mpl')
+
+IBMQ.load_account()
+provider = IBMQ.get_provider(hub='ibm-q')
+provider.backends()
+
+from qiskit.providers.ibmq import least_busy
+backend = least_busy(provider.backends(filters = lambda b: b.configuration().n_qubits >= 3 and 
+                                       not b.configuration().simulator and 
+                                       b.status().operational == True))
+job_exp = execute(qc, backend = backend, shots = 8192)
+exp_result = job_exp.result()
+
+exp_measurement_result = exp_result.get_counts()
+print(exp_measurement_result)
+plot_histogram(exp_measurement_result)
+
+ +

The error which the following code gives is:

+ +
IBMQJobApiError: ""'400 Client Error: Bad Request for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs/5e73033786653e0018a2364e/resultDownloadUrl. Cannot get presigned download url., Error code: 3202.'""
+
+ +

I've tried deleting my account and load a new account using a newly generated token but that doesn't seem to work either.

+ +

Clicking the link in the error gives the following error:

+ +
OPERATION_NOT_AVAILABLE
+404 Shared class ""Hub"" has no method handling GET /ibm-q/Groups/open/Projects/main/Jobs/5e72ff01121d5e0018bfe775/resultDownloadUrl.
+code: 2411
+
+ +

perhaps, I am using a method which is now deprecated. How can I tackle this situation?

+",10376,,,,,3/23/2020 14:53,Error while running Quantum Teleportation Algorithm on real device using qiskit on IBM-Q,,3,2,,,,CC BY-SA 4.0 +10229,2,,10228,3/19/2020 9:41,,1,,"

EDIT: I believe this is solved in @IEIrodov's answer below.

+ +

I'm not sure what's causing the issue, but based on similar issues on the qiskit slack channel, I don't think it's something you're doing.

+ +

As a workaround, try running:

+ +
exp_result = job_exp.result()
+exp_measurement_result = exp_result.get_counts()
+print(exp_measurement_result)
+plot_histogram(exp_measurement_result)
+
+ +

Separately in a new cell.

+ +

(also, if you're trying to verify teleportation, you need to apply_secret_unitary on line 42 to qc.qubits[2] instead of qc.qubits[0]).

+",10415,,10415,,3/23/2020 14:53,3/23/2020 14:53,,,,4,,,,CC BY-SA 4.0 +10230,1,,,3/19/2020 10:20,,2,174,"

My goal is to prove that I can synthesise arbitrary unitary from two components.

+ +

In the end, I find a matrix with the form +\begin{equation} + \mathbf{W}_j=\begin{pmatrix} + |\alpha|2\cos{(\phi_{k,2}+\phi_{k,1})}+i|\beta|2\cos{(\phi_{k,2}-\phi_{k,1})} & i|\alpha|2\sin{(\phi_{k,2}+\phi_{k,1})}+|\beta|2\sin{(\phi_{k,2}-\phi_{k,1})}\\ + i|\alpha|2\sin{(\phi_{k,2}+\phi_{k,1})}+|\beta|2\sin{(\phi_{k,2}-\phi_{k,1})} & + |\alpha|2\cos{(\phi_{k,2}+\phi_{k,1})}+i|\beta|2\cos{(\phi_{k,2}-\phi_{k,1})} + \end{pmatrix} +\end{equation} +where $\phi_{k,1}$,$\phi_{k,2}$,$\alpha$ and $\beta$ are parameters.

+ +

Where can I begin to prove that it is an arbitrary unitary?

+",10417,,9006,,3/19/2020 12:13,3/19/2020 22:37,How to prove that a matrix is an arbitrary unitary?,,2,6,,,,CC BY-SA 4.0 +10231,2,,10228,3/19/2020 10:49,,1,,"

I'm not sure what had caused the problem but I was able to solve it and most likely know what the problem was.

+ +

Consider these two lines from my code above:

+ +
job_exp = execute(qc, backend = backend, shots = 8192)
+exp_result = job_exp.result()
+
+ +

Problem with the above lines is that we are not waiting for the actual quantum device to compute and send over the data. To avoid this, we can use a method called job_monitor from qiskit.tools.monitor which when called, let us know whether the job is complete or not.

+ +

After it displays that the job has successfully run we should expect value from result

+ +

Following is the code for the same purpose:

+ +
IBMQ.load_account()
+provider = IBMQ.get_provider(hub = 'ibm-q')
+backend = least_busy(provider.backends(filters = lambda x: x.configuration().n_qubits >= 3
+                                      and not x.configuration().simulator
+                                      and x.status().operational == True))
+print('least busy backend: ', backend)
+
+ +
from qiskit.tools.monitor import job_monitor
+job = execute(qc, backend = backend, shots = 8192)
+job_monitor(job)
+
+ +

Proceed further only after the output to the above cell becomes 'Job Status: job has successfully run' which may take some time depending upon the value of shots.

+ +

After that, you can call result() and get_counts() to get the values:

+ +
result = job.result()
+counts = result.get_counts()
+
+",10376,,,,,3/19/2020 10:49,,,,0,,,,CC BY-SA 4.0 +10232,2,,10228,3/19/2020 11:00,,0,,"

Error 3202 is a networking error when trying to get the requested page. In this case the results for your job.

+",332,,,,,3/19/2020 11:00,,,,0,,,,CC BY-SA 4.0 +10233,2,,10213,3/19/2020 11:02,,1,,"

If that is all you want to do then SciPy is really the way to go. Indeed, qiskit just wraps that functionality when requesting a classical answer. +In SciPy you can use scipy.linalg.eig. You can find examples of using this function in the documentation.

+",332,,10352,,3/22/2020 21:11,3/22/2020 21:11,,,,2,,,,CC BY-SA 4.0 +10234,2,,10230,3/19/2020 15:37,,1,,"

The straightforward method is to compute $ W W^\dagger = W^\dagger W = I $ and to get constraint over your parameters solving this system. I'm going to show you how to do it only for $ W W^\dagger = I$ but it should be very similar for $ W^\dagger W$. I assume here that all your parameters are real.

+ +

first some notation for ease of reading, let's pose :

+ +

$W = \begin{bmatrix} A & B \\ C & D \end{bmatrix} $, $W^\dagger = \begin{bmatrix} A^* & C^* \\ B^* & D^* \end{bmatrix}, I = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$

+ +

this allows us to see easily that : +\begin{align} AA^* + BB^* &= 1 \\ +CC^* + DD^* &= 1 +\end{align}

+ +

using the property over product of complex conjuguates ($zz^* = |z|^2$), the computation for these two equalities is pretty straightforward.

+ +

\begin{align} |A|^2 + |B|^2 &= 1 \\ +|C|^2 + |D|^2 &= 1 +\end{align}

+ +

I let you the details of the computation (The trick is to remember that $cos^2(x) + sin^2(x)=1$) but in the end you should get :

+ +

$$ |\alpha|^2+|\beta|^2 = \frac{1}{4}$$

+ +

for the two equalities. That's your first constraint over your matrix for it to be unitary.

+ +

Then you have the two following equalities :

+ +

\begin{align} AC^* + BD^* &= 0 \\ +CA^* + DB^* &= 0 +\end{align}

+ +

Those ones are a bit more expensive in time to compute, and I'm going to do only the first one. With some observations you can see that 4 terms cancels each other, making the computation quite fast. At the end you should get the equality (only difficulty is to remember the following formula, $\sin(a+b) = \sin(a)\cos(b) + \cos(a)\sin(b)$) :

+ +

$$4 |\alpha||\beta| \sin(2 \phi_2) = 0$$

+ +

which has multiple solutions :

+ +

$(\phi_2 = z \frac{\pi}{2}, \alpha \in \mathbb{R}, \beta \in \mathbb{R}, z \in \mathbb{Z}),(\phi_2 \in \mathbb{R} , \alpha \in \mathbb{R}, \beta = 0), (\phi_2 \in \mathbb{R} , \alpha =0, \beta \in \mathbb{R}) $

+ +

You can do the same for

+ +

$$ CA^* + DB^* = 0$$

+ +

and it should give you a new equality constraint over your parameters.

+ +

For now we have the following non-linear system of constraint :

+ +

\begin{align} |\alpha|^2+|\beta|^2 & = \frac{1}{4} \\ + |\alpha||\beta| \sin(2 \phi_2) & = 0 +\end{align}

+ +

You now need to complete this system by finding new constraint with the last equality I left aside and the ones you'll get by computing $W^\dagger W = I$. I believe you'll get pretty close constraints, maybe one more over $\phi_1$.

+ +

In the end you will get a non-linear system, it should not be too hard to solve by hand, if it is for you, you can use the very useful online systems of equations solver from Wolframalpha. The solutions of this non-linear system will tell you what range your parameters can take such that your matrix is unitary.

+",10065,,,,,3/19/2020 15:37,,,,5,,,,CC BY-SA 4.0 +10235,1,10238,,3/19/2020 19:11,,8,564,"

In ZX-calculus, the CNOT gate is represented by this:

+

+

Can someone show me why this is true, using just the basic rewriting rules? All books/papers I have seen simply take it without proof, but I can't see why it is true.

+",6118,,55,,7/25/2022 5:59,7/25/2022 5:59,Explain the representation of the CNOT gate in ZX-calculus,,1,0,,,,CC BY-SA 4.0 +10236,2,,10230,3/19/2020 20:10,,2,,"

There are multiple ways to show that $W_j$ is not, in general, unitary. The easiest might be to look at the determinant. A basic property of unitary matrices is that their determinant has unit modulus. In this case the determinant reduces to +$$\text{det}(W_j)=4 \, (\vert \alpha \vert^2 - \vert \beta \vert ^2 + i2 \, \vert \alpha \vert \vert \beta \vert \cos(2\phi_{k,2})).$$ +There is nothing in the problem statement constraining this value to unit modulus, and I don't see any natural constraints that can be imposed to make it so.

+ +

There are many other ways to show that $W_j$ is not generally unitary. Hopefully it's clear that if $W_j$ is not generally unitary, it's certainly not an arbitrary unitary.

+",8623,,9006,,3/19/2020 22:37,3/19/2020 22:37,,,,0,,,,CC BY-SA 4.0 +10238,2,,10235,3/19/2020 21:18,,10,,"

I am going to assume that $|0\rangle$ is represented by , and $|1\rangle$ by .

+ +

Then, represents the bit-flip, or NOT gate. What it does is: $|x\rangle\mapsto |x\oplus1\rangle$. This can be verified easily in the graphical calculus, using the ""spider"" rule:

+ +

+ +

and

+ +

+ +

Now, by definition, CNOT controls NOT: $|x_1,x_2\rangle\mapsto|x_1,x_1\oplus x_2\rangle$. In other words, if $|0\rangle$ is fed to the first qubit, the result is $|0\rangle$ on the first qubit, and the identity on the second. If it is fed $|1\rangle$, the result is $|1\rangle$ on the first qubit, and the gate NOT on the second one. Again this can be verified in the graphical calculus:

+ +

+ +

where the first equality is the ""copy"" rule, the second is the ""spider"" rule, and the last one is the fact that a rotation of angle $0$ is the identity.

+ +

Similarly:

+ +

+ +

where the first equality is the ""$\pi$-copy"" rule, and the second is the ""spider"" rule.

+",7422,,,,,3/19/2020 21:18,,,,1,,,,CC BY-SA 4.0 +10239,1,10243,,3/20/2020 5:38,,8,481,"

I have a unitary matrix that I want to construct. I only care what happens to the first computational state, so the first column is specified. So far, I've been assigning each question mark to a variable and solving $UU^T = I$ analytically. But this 6x6 case is out of computational reach for this method.

+ +

Is there any general method, or any clever trick, to help me fill in the rest of matrices such as $U$?

+ +

Note: I actually would prefer if all the entries were real, so technically these are better called orthogonal matrices.

+ +

$U = \frac{1}{\sqrt{5}}\begin{bmatrix} +0 & ? & ? & ? & ? & ? \\ +1 & ? & ? & ? & ? & ? \\ +1 & ? & ? & ? & ? & ? \\ +1 & ? & ? & ? & ? & ? \\ +1 & ? & ? & ? & ? & ? \\ +1 & ? & ? & ? & ? & ? \\ +\end{bmatrix} $

+",1867,,734,,3/21/2020 5:14,3/22/2020 4:16,How can I fill a unitary knowing only its first column?,,2,0,,,,CC BY-SA 4.0 +10240,2,,9956,3/20/2020 6:41,,1,,"

1) This equation is at best confusing, and at worst perhaps even straight-up wrong. Firstly, they use a different edge contraction notation as in the equations description and secondly, as you observe, they appear to have a Z operator acting upon qubit $v^{\prime\prime}$ which is no longer a vertex of the edge-contracted state.

+ +

Perhaps the Z-operators on various qubits do cancel out as desired when applied to the correct qubits, but this is clearly a confusing and non-obvious way of representing the state. Looking at it, I suspect that they have simply mixed up $v$ and $v^{\prime\prime}$, since the operator $Z^k_{v}Z^l_{N_G(v^{\prime\prime})\setminus \{v^\prime\}}$ looks correct to me.

+ +

Assuming this is the case, the reason we can write the state like this can be seen by considering a simpler case. First, we observer that the two-vertex line graph $L_2$ can be written as:

+ +

$$ +\def\ket#1{\lvert #1 \rangle}\def\bra#1{\langle #1 \rvert} +\ket{L_2} = \frac{1}{\sqrt{2}}(\ket{++} + \ket{--}) +$$

+ +

whereas the state associated with the three-qubit line $L_3$ can be written as

+ +

$$ +\begin{aligned} +\ket{L_3} &= \frac{1}{2}(\ket{+++} + \ket{+--} + \ket{--+} + \ket{-+-}) \\ +&= \frac{1}{2}\big[(\ket{++} + \ket{--})_{1,3}\ket{+}_2 + (\ket{+-} + \ket{-+})_{1,3}\ket{-}_2\big] \\ +&= \frac{1}{\sqrt{2}}\sum_{i=0,1}Z_3^i\ket{L_2}_{1,3}(\ket{0} + Z_2^i\ket{1}) +\end{aligned} +$$

+ +

where $L_2 = L_3 \;/\; (1, 2)$. This equation is telling us that if we measure the middle qubit in the $X$-basis, we essentially perform an edge contraction on one of it's connected edges. It is easy to see that applying this twice yields their desired result.

+ +

So yeah, my money is that it's just a typo.

+ +

2) You are correct in asserting that the edge contraction trick would work with only two nodes (up to the $Z$ operators applied to the remaining state). The reason they do this is because the lemma's real purpose is for their proof of theorem 3, in which they seek to produce a graph $\tilde{G}$ of maximum vertex degree 3. This requires adding the extra internal vertex $v^\prime$ with degree two, since if one were not to do this, the subsequent expansions would not serve to reduce the overall degree.

+ +

The best way to see this is to take the example given in Figure 1 and try the subsequent expansions of $v$ and $v^{\prime\prime}$ in the case where $v^\prime$ does and doesn't exist. In the latter case, the expansion of the right node serves to increase the degree of the original node, whereas in the former case the middle node goes from degree 2 to 3. If you repeat this enough times, you will soon see that the centre node is necessary to reduce the overall degree.

+",391,,,,,3/20/2020 6:41,,,,0,,,,CC BY-SA 4.0 +10241,1,10244,,3/20/2020 10:57,,1,128,"

BB84 protocol works followingly:

+
    +
  1. Alice generate $N$ random qubits $a_i$ in state either $|0\rangle$ or $|1\rangle$ . These will be a key. Then she prepares $N$ random bits $b_{i}$. If $b_i=0$, an identity gate is applied and qubit is left in either state $|0\rangle$ or $|1\rangle$. If $b_i=1$ then Hadamard gate is applied changing qubit $a_{i}$ to either state $|+\rangle$ or $|-\rangle$. After that qubits are sent to Bob.
  2. +
  3. Bob generates $N$ random bits. According to the value of $b_{i}^{'}$ he applies either identity or Hadamard gate on received qubit $a_{i}$ and measure it, receiving either 0 or 1.
  4. +
  5. Alice and Bob compare bits $b_i$ and $b_i^{'}$. If they are equal, now classical bit $a_i$ is preserved and become part of the key. About $N/2$ of $a_{i}$ bits are preserved on average.
  6. +
  7. Alice and Bob send each other $N/4$ $a_{i}$ bits to analyze a noise level. In case the level is higher than some threshold (natural noise level of the channel used for a quantum communication), there is a high probability that Eve tried to catch communication between Alice and Bob. In such a case, the current key is dismissed and the process starts again.
  8. +
  9. Alice and Bob reconcile the key obtained in step 4 to ensure that both have the same key, cleaned from noise. At the same time, they have to amplify privacy to hide the key from Eve because this communication is done via the classical channel.
  10. +
+

So, my question is how step 5 is done in practice? To reconcile the key, they have to exchange some information about it. I found that a hash function can be used for concealing information about the key from Eve as much as possible. However, if the information is hidden, how can Alice and Bob repair the key to ensure they have the same one?

+",9006,,7429,,1/21/2021 17:41,1/21/2021 17:41,How to deal with noise in BB84 protocol?,,1,0,,,,CC BY-SA 4.0 +10242,2,,10239,3/20/2020 11:01,,8,,"

Take your vector $\frac{1}{\sqrt{5}}(0, 1, 1, 1, 1, 1)^T$ and five other arbitrary ones but at the same time these vectors have to be linearly independent. After that apply Gram-Schmidt process which produces orthonormal vectors.

+ +

Put these vectors to a matrix and you will get a unitary matrix with the first column equal to $\frac{1}{\sqrt{5}}(0, 1, 1, 1, 1, 1)^T$.

+",9006,,,,,3/20/2020 11:01,,,,0,,,,CC BY-SA 4.0 +10243,2,,10239,3/20/2020 11:34,,7,,"

Martin Vesely's answer is the way to go in general, and especially if you know more than one column. However, if you're given just one column, there's an easier trick for generating a suitable unitary.

+ +

Note that $V=2|v\rangle\langle v|-I$ is a unitary ($V=V^\dagger$ and $V^2=I$). So, the question is whether you can select a $|v\rangle$ such that the first column is the one you gave ($V=U$). So, just calculate $\langle 1|V|n\rangle$ for $n=1$ to 6, and you'll find (up to a possible global phase) +$$ +|v\rangle=\frac{1}{\sqrt{2}}|1\rangle-\frac{1}{\sqrt{10}}\sum_{n=2}^6|n\rangle. +$$ +So now you can write down your unitary: +$$ +\frac{1}{5}\left[\begin{array}{cccccc} +0 & -\sqrt{5} & -\sqrt{5} & -\sqrt{5} & -\sqrt{5} & -\sqrt{5} \\ +-\sqrt{5} & -4 & 1 & 1 & 1 & 1 \\ +-\sqrt{5} & 1 & -4 & 1 & 1 & 1 \\ +-\sqrt{5} & 1 & 1 & -4 & 1 & 1 \\ +-\sqrt{5} & 1 & 1 & 1 & -4 & 1 \\ +-\sqrt{5} & 1 & 1 & 1 & 1 & -4 +\end{array}\right]. +$$

+ +

Just to fill in some details: Your first column can be considered a properly normalised state $|\psi\rangle$, so you are searching for a state that satisfies +$$ +(2|v\rangle\langle v|-I)|1\rangle=|\psi\rangle. +$$ +It's easy enough to manipulate this to find (where I'm making the simplifying assumption that the inner product $\langle 1|\psi\rangle$ is real) +$$ +|v\rangle=\frac{|1\rangle+|\psi\rangle}{\sqrt{2(1+\langle 1|\psi\rangle)}}. +$$

+",1837,,1837,,3/22/2020 4:16,3/22/2020 4:16,,,,2,,,,CC BY-SA 4.0 +10244,2,,10241,3/20/2020 11:37,,2,,"

It is important to note that Step 5 is a classical step.

+ +

Different protocols exist to correct keys, for instance the Cascade- and Winnow-protocols. With this you reveal bits of information in specific ways, due to which you learn if there are errors and where these are located.

+",2005,,,,,3/20/2020 11:37,,,,3,,,,CC BY-SA 4.0 +10246,1,10268,,3/20/2020 12:57,,4,517,"

I have a sort of basic question. I think an operator that acts on $n$-partite states is defined (up to permutation of parties) to be local if it can be written as

+ +

$$A = A_1 \otimes_{i=2}^n \mathbb{I}_i $$

+ +

where the subscript $i$ denotes the party on which an operator acts. This definition ensures that $A$ is acting only on one party (here we are assuming that each party is spatially separated from the rest). So far so good. The problem comes when I consider concatenation of operators. Consider for instance a 3-qubit system, and consider the local operators

+ +

$$\mathcal{O}_1 = Z_1 \otimes \mathbb{I}_2 \otimes \mathbb{I}_3 \, , \quad \mathcal{O}_2 = \mathbb{I}_1 \otimes Z_2 \otimes \mathbb{I}_3 \, , \quad \mathcal{O}_3 = \mathbb{I}_1 \otimes \mathbb{I}_2 \otimes Z_3 \, , $$

+ +

i.e. $\mathcal{O}_i$ applies the $Z$ gate to party $i$ and does nothing to the rest. If Alice performs $\mathcal{O}_1$, then Bob performs $\mathcal{O}_2$ and then Charlie performs $\mathcal{O}_3$, which I understand is a protocol within the LOCC rules (actually no communication is needed at all) then the resulting gate is

+ +

$$ \mathcal{O}_3 \mathcal{O}_2 \mathcal{O}_1 = Z_1 \otimes Z_2 \otimes Z_3 \, ,$$

+ +

which I would say is a non-local operator. How is it that a succession of local operators gives rise to a non local operator?

+",9895,,9895,,3/21/2020 0:31,3/23/2020 15:33,What is a local operator?,,2,0,,,,CC BY-SA 4.0 +10247,2,,10246,3/20/2020 15:25,,3,,"

There are two inequivalent definitions of ""local operator"" used in quantum information theory.

+ +

The first definition is used in the context of communication over a classical channel (e.g. LOCC). In this context, you have a fixed partition of the complete Hilbert space into a tensor product of $k$ different subsystems, and the subsystems are assumed to be so far apart that no entangling operator can ever act on both of them. In this context, a ""local operator"" is defined to be an operator that can be expressed as a tensor product of operators that only act on an individual subsystem, i.e. $\bigotimes_{i=1}^k A_i$, where the operator $A_i$ acts on the $i$th subsystem. Under this definition, the product of local operators is always a local operator, because by definition $\left (\bigotimes_{i=1}^k A_i \right) \left( \bigotimes_{i=1}^k B_i \right) = \bigotimes_{i=1}^k (A_i B_i)$.

+ +

The second definition is primarily used in the context of many-body quantum physics, e.g. topological quantum computing. Here, a local operator isn't defined to act nontrivially on only one qubit, but instead on a fixed number of qubits (generally up to four in practice) that does not depend on the total number of qubits in the circuit. So for example a single operator that acts on all the qubits, or a fixed fraction of the qubits, would not count as local. The idea is that as the number of qubits gets large, the operator acts on a negligible small fraction of the total.

+ +

When thinking about hardware implementations of a quantum computer, there's sometimes also a natural sense in which some qubits are ""next to"" each other. In hardware implementations, it's usually easier to engineer multi-qubit gates that act on qubits that are physically close together. In this case, ""local"" can refer to gates that only act on qubits that are a maximum physical distance away (which will depend on the geometry in which they're laid out). Under this second definition, the product of local operators will in general be non-local if they act on qubits that are sufficiently far apart.

+",551,,551,,3/23/2020 13:06,3/23/2020 13:06,,,,9,,,,CC BY-SA 4.0 +10248,1,10249,,3/20/2020 15:42,,1,370,"

My understanding, for instance from this youtube video, is the following:
+Assuming a state $\psi = \alpha |0\rangle + \beta |1\rangle$, where $\alpha$ and $\beta$ can be complex. I believe any state is always normalized, so that $|\alpha|^2 + |\beta|^2 = 1$. The probabilities can be calculated as follows: $P_0 = |\alpha|^2$ and $P_1 = |\beta|^2$.

+

I am currently switching from Qiskit to Cirq. In Cirq, I simulate a simple 3-qubit circuit (see code below). I get the following state:

+
[0.34538722-0.7061969j  0.29214734-0.14894447j 0.29214737-0.14894448j
+ 0.13474798+0.02354215j 0.29214734-0.14894444j 0.13474798+0.02354215j
+ 0.134748  +0.02354216j 0.03903516+0.04161799j]
+
+

When adding all the squares of the real components, I end up with 0.4313373551216718. This is confusing me, as this appears to be non-normalized.

+

My question: Why does this not add up to 1?

+

Minimal example:

+
import cirq
+import sympy
+import numpy as np
+import math
+
+# qubits
+q = cirq.GridQubit.rect(1, 3)
+q_pi = np.pi/4 # quarter_py
+
+# Create a circuit on these qubits using the parameters you created above.
+circuit = cirq.Circuit(
+  cirq.rx(0.1).on(q[0]), cirq.rx(0.1).on(q[1]), cirq.rx(0.1).on(q[2]), 
+  cirq.ry(q_pi).on(q[0]), cirq.ry(q_pi).on(q[1]), cirq.ry(q_pi).on(q[2]),
+  cirq.rz(q_pi).on(q[0]), cirq.rz(q_pi).on(q[1]), cirq.rz(q_pi).on(q[2]))
+
+simulator = cirq.Simulator()
+results = simulator.simulate(program=circuit, param_resolver=resolver, qubit_order=q).final_state
+print(results)
+
+print(np.sum([math.pow(x.real,2) for x in results]))
+
+",2794,,1859,,11/22/2020 0:02,11/22/2020 0:02,Normalization of the quantum state in Cirq,,2,0,,,,CC BY-SA 4.0 +10249,2,,10248,3/20/2020 17:26,,1,,"

You say ""I believe any state is always normalized, so that $|\alpha|^2 + |\beta|^2 = 1$"", but you don't apply this to your calculation. The summation of squares of the absolute values is what gets the appropriate answer. For a single qubit system, $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$ and $|\alpha|^2 + |\beta|^2 = 1$. For a multiqubit system (3 in your case), $|\psi\rangle = \alpha_{000}|000\rangle + \alpha_{001}|001\rangle ... + \alpha_{111}|111\rangle$ and $|\alpha_{000}|^2 + |\alpha_{001}|^2 + ... + |\alpha_{111}|^2 = 1$. The following will give you what you want.

+ +
import cirq
+import sympy
+import numpy as np
+import math
+
+# qubits
+q = cirq.GridQubit.rect(1, 3)
+q_pi = np.pi/4 # quarter_py
+# Create a circuit on these qubits using the parameters you created above.
+circuit = cirq.Circuit(
+  cirq.rx(0.1).on(q[0]), cirq.rx(0.1).on(q[1]), cirq.rx(0.1).on(q[2]), 
+  cirq.ry(q_pi).on(q[0]), cirq.ry(q_pi).on(q[1]), cirq.ry(q_pi).on(q[2]),
+  cirq.rz(q_pi).on(q[0]), cirq.rz(q_pi).on(q[1]), cirq.rz(q_pi).on(q[2]))
+
+simulator = cirq.Simulator()
+results = simulator.simulate(program=circuit, qubit_order=q).final_state
+results_abs = map(abs, results)
+print(np.sum([math.pow(x,2) for x in results_abs])) # prints 0.9999995465139359 which is ~=1
+
+",362,,362,,3/20/2020 23:19,3/20/2020 23:19,,,,0,,,,CC BY-SA 4.0 +10251,1,,,3/20/2020 21:37,,1,210,"

I'm trying to understand how to read results from an NMR quantum computer.

+ +

According to Nielsen and Chuang:

+ +
+

The principal output is the free induction decay signal $$V(t) = V_0\text{Tr}\left[e^{-iHt}\rho e^{iHt}(iX_k+Y_k)\right]$$

+
+ +

This signal is measured for some period of time, and then the results are Fourier-transformed into a plot like this one

+ +

+ +

My question is: what do these peaks mean? Suppose I want to know how much of my ensemble is in the $|110\rangle$ (or whatever) state, how do I read this off of the plot?

+",6118,,9006,,3/20/2020 22:54,4/21/2020 15:06,Readout using an NMR spectrum,,1,0,,,,CC BY-SA 4.0 +10252,2,,10248,3/21/2020 10:46,,0,,"

The answer from Victory Omole is correct. Some additional background on my mistake: I did not take the square of the absolute value of the complex numbers, but I took the square of the real component of the complex numbers. My error is explained well here. The real component of a complex number $a + bi$ is $a$. The absolute value of a complex number $a + bi$ is $\sqrt(a^2 + b^2)$. As pointed out, this is the difference between x.real and abs(x) in python.

+",2794,,,,,3/21/2020 10:46,,,,0,,,,CC BY-SA 4.0 +10254,1,,,3/21/2020 13:53,,1,252,"

In the notebook ""portfolio optimization"" on IBM's platform the goal is to calculate the optimal stock selection using a classical and a quantum algorithm (VQE). A random portfolio is generated and then a risk factor is set.

+ +

What is the realistic value of this risk factor on the stock market and why do the authors select a risk factor of 0.5? How does it change the selection of the optimal portfolio?

+",10426,,9006,,3/21/2020 16:53,6/23/2022 18:09,What is the risk factor on IBM's portfolio optimization notebook?,,2,1,,,,CC BY-SA 4.0 +10255,2,,10254,3/21/2020 15:29,,2,,"

The objective of the portfolio optimization problem is to trade off expected return ($\mu^T x$) with the risk taken ($x^T \Sigma $x). +This could be achieved by introducing a constraint on the risk, e.g. $x^T \Sigma x \leq R$, for an acceptable risk level $R$ and then maximize the return under this constraint. However, this is not a QUBO, i.e., it cannot be solved directly with VQE or QAOA. A common approach is to penalize the expected return by the weighted risk, which leads to the used objective $\mu^T x - q x^T \Sigma x$, and is a QUBO.

+ +

The actual choice $q=0.5$ in the notebook is arbitrary and just for illustration. +If you solve the problem for different $q$, you'll find different combinations of expected return and risk. E.g. for $q=0$ you consider a risk-neutral investor and the optimal solution would only maximize the expected return independent of the risk. If you increase $q$, the solution gets more and more risk-averse, ie., the return . Solving the problem for a reasonable set of $q$ leads to the so-called efficient frontier of risk and return, i.e., for every risk level, you'll get the maximum expected return that can be achieved.

+ +

In other words, $q$ is an implicit way to control the risk taken in the optimal solution of the resulting optimization problem. In practice, you are usually not interested in $q$ but in the risk and return, thus, you would have to do, e.g., a binary search over $q$ until you find a solution that does not exceed the acceptable level of risk $R$. You'd like to get as close to $R$ as possible while not exceeding it, since this should increase the expected return of the resulting portfolio.

+ +

A more general discussion of the portfolio optimization problem can be found here: +https://en.wikipedia.org/wiki/Modern_portfolio_theory

+",10429,,,,,3/21/2020 15:29,,,,1,,,,CC BY-SA 4.0 +10256,2,,10254,3/21/2020 17:06,,0,,"

You can find some information on another approach to portfolio optimization on quantum computer in this article: Quantum computational finance: quantum algorithm for portfolio optimization.

+ +

The authors deal with minimizing risk descibed by function $w^T\Sigma w$, where $w$ is vector of asset weights and $\Sigma$ is a covariance matrix. The minimization is subjected to requirement on expected return $\mu$: $R^T w = \mu$, where $R$ is vector of historical returns, and budget constraint $\xi$:$P^T w = \xi$ where $P$ is vector of asset prices.

+ +

Since constraints are equalities, Lagrange method can be employed. Moreover, optimized function is quadratic and constraints are linear, hence optimization is converted to solving of system of linear equations. Because of this, it is possible to empoloy HHL algorithm for solving system of linear equation on quantum computer.

+ +

Besides, one of authors of the article, Seth Lloyd designed also HHL algorithm.

+",9006,,,,,3/21/2020 17:06,,,,0,,,,CC BY-SA 4.0 +10257,1,10284,,3/22/2020 8:22,,3,172,"

Reading through the official Qiskit textbook, I fell onto the problem of Deutsch - Jozsa Algorithm, which seemed little mystical to me at first but as I tried out the example of its working, I was unable to work out the last part of it, the example is copy-pasted below:

+

Let's go through a specific example for a two-bit balanced function with hidden bitstring a=3.

+
    +
  1. The first register of two qubits is initialized to |0⟩ and the second register qubit to |1⟩:
  2. +
+

$$|ψ_0⟩=|00⟩_1|1⟩_2 $$

+
    +
  1. Apply Hadamard on all qubits: +$$|ψ_1⟩=\frac{1}{2}(|00⟩_1+|01⟩_1+|10⟩_1+|11⟩_1)\frac{1}{\sqrt{2}}(|0⟩_2−|1⟩_2)$$

    +
  2. +
  3. For a=3, (11 in binary) the oracle function can be implemented as $Q_f=CX_{1a}CX_{2a}$,

    +

    $$|ψ_2⟩=\frac{1}{2\sqrt{2}}[|00⟩_1(|0⊕0⊕0⟩_2−|1⊕0⊕0⟩_2)+|01⟩_1(|0⊕0⊕1⟩_2−|1⊕0⊕1⟩_2)+|10⟩_1(|0⊕1⊕0⟩_2−|1⊕1⊕0⟩_2)+|11⟩_1(|0⊕1⊕1⟩_2−|1⊕1⊕1⟩_2)] $$

    +
  4. +
+

4.Thus:

+

$$|ψ_2⟩=\frac{1}{2\sqrt{2}}[|00⟩_1(|0⟩_2−|1⟩_2)−|01⟩_1(|0⟩_2−|1⟩_2)−|10⟩_1(|0⟩_2−|1⟩_2)+|11⟩_1(|0⟩_2−|1⟩_2)] +=\frac{1}{2}(|00⟩_1−|01⟩_1−|10⟩_1+|11⟩_1)\frac{1}{\sqrt{2}}(|0⟩_2−|1⟩_2)$$ +$$ =\frac{1}{\sqrt{2}}(|0⟩_{10}−|1⟩_{10})\frac{1}{\sqrt{2}}(|0⟩_{11}−|1⟩_{11})\frac{1}{\sqrt{2}}(|0⟩_2−|1⟩_2) $$

+
    +
  1. Apply Hadamard on the first register:

    +

    $$ |ψ_3⟩=|1⟩_{10}|1⟩_{11}(|0⟩_2−|1⟩_2) $$

    +
  2. +
  3. Measuring the first two qubits will give the non-zero 11, indicating a balanced function.

    +
  4. +
+

The main problem in understanding was in the final step, going from :

+

$$ |ψ_2⟩=\frac{1}{2}(|00⟩_1−|01⟩_1−|10⟩_1+|11⟩_1)\frac{1}{\sqrt{2}}(|0⟩_2−|1⟩_2) $$

+

to:

+

$$ |ψ_2⟩=\frac{1}{\sqrt{2}}(|0⟩_{10}−|1⟩_{10})\frac{1}{\sqrt{2}}(|0⟩_{11}−|1⟩_{11})\frac{1}{\sqrt{2}}(|0⟩_{2}−|1⟩_{2}) $$

+

It seems to be some sort of a factorization step, how does that work?

+",10376,,2927,,4/27/2021 23:00,4/27/2021 23:00,Understanding the working of oracle in Deutsch - Jozsa Algorithm,,1,3,,,,CC BY-SA 4.0 +10258,1,,,3/22/2020 9:24,,1,342,"

I am currently simulating some quantum circuits, and want to calculate the probabilities of observing each individual state. I am able to use Cirq for this, and calculate it using $P_{00} = |\alpha|^2$. +Code:

+ +
import cirq
+import sympy
+x0, x1 = sympy.symbols('x0 x1')
+q = cirq.GridQubit.rect(1, 2)
+circuit = cirq.Circuit(
+  cirq.rx(x0).on(q[0]), cirq.rx(x1).on(q[1]), 
+  cirq.ry(3.14/4).on(q[0]), cirq.ry(3.14/4).on(q[1]))
+resolver = cirq.ParamResolver({x0: 0.2, x1: 0.3})
+simulator = cirq.Simulator()
+results = simulator.simulate(program=circuit, param_resolver=resolver, 
+qubit_order=q).final_state
+print(""Internal quantum state:"", results)
+print(""Probabilities of observing each state:"", [abs(x)**2 for x in results])
+
+ +

Output:

+ +
internal quantum state: [0.8377083+0.08743566j 0.3529709-0.11249491j 0.35297093-0.06251574j 0.13120411-0.08743566j]
+probabilities of observing each state: [0.7094002059173512, 0.13724355108492148, 0.12849669756020887, 0.024859516013751914]
+
+ +

However, in multiple tutorials (for instance from TFQ) I see the use of ""expectation_from_wavefunction"":

+ +
z0 = cirq.Z(q[0])
+qubit_map={q[0]: 1, q[1]: 1}
+z0.expectation_from_wavefunction(results, qubit_map).real
+
+ +

output:

+ +
0.6757938265800476
+
+ +

My question: +How can I use expectation_from_wavefunction to obtain the probabilities of observing the individual states ($P_{00}, P_{01}, P_{10}, P_{11}$)?
+Bonus question: why would I favor this approach?

+",2794,,,,,4/22/2020 11:08,"How to calculate the probabilities of observing quantum states using the ""expectation_from_wavefunction"" in cirq (and why)",,2,5,,,,CC BY-SA 4.0 +10259,2,,10258,3/22/2020 14:28,,-1,,"
+

why would I favor this approach?

+
+ +

The Expectation value is defined as $\langle A \rangle= \langle\psi|A|\psi\rangle$ where $\psi$ is the wavefunction and $A$ is the operator. Use ""expectation_from_wavefunction()"" if you don't want to write code that calculates $\langle\psi|A|\psi\rangle$.

+",362,,,,,3/22/2020 14:28,,,,4,,,,CC BY-SA 4.0 +10260,2,,10251,3/22/2020 14:38,,1,,"

With magnetic resonance based quantum computing, the amplitude(integrated area) and relative phase of the read-out spectra tells you the state of the qubits.

+ +

In this particular example, two different carbon qubits are read out simultaneously, while the third qubit, a hydrogen, would need a separate experiment to read out. The spectrum consists of two distinct doublet of doublets each one representing a qubit. The positive phase would represent being in the 1 state, and integrating the doublet of doublets would yield the probability of being in that state. A negative spectra would represent being in the 0 state.

+ +

Though you do need to be careful since the phase in these experiments is arbitrary, so your 1 could very well be a 0, but the relative phase between qubits is not arbitrary. So usually you would also gave an internal phase reference.

+ +

For further reading some of the work from J. A. Jones is a good place to start:

+ +

arXiv:quant-ph/0106067

+",9579,,,,,3/22/2020 14:38,,,,0,,,,CC BY-SA 4.0 +10261,1,10278,,3/22/2020 15:36,,5,304,"

I am interested in resources that would allow me to learn about the physics behind optical quantum computation, and specifically, the physical properties of photonic qubits. I have some good resources on quantum optics, but is there anything more specific (for instance, any good review papers) I should be reading alongside this material?

+",4907,,9006,,3/22/2020 21:10,3/24/2020 5:45,What are some good resources for learning about photonic qubits?,,2,3,,,,CC BY-SA 4.0 +10262,1,,,3/22/2020 21:16,,3,150,"

I'm trying to understand why we do what we do when we teleport a state from Alice's first qubit to Bob's qubit. I understand the initial entanglement, but could use help walking through the program.

+ +

I have a teleportation circuit,

+ +
circuit = QuantumCircuit(3,3)
+
+ +

+ +

First, I create the bell pair for Alice and Bob:

+ +
circuit.h(1)
+circuit.cx(1,2)
+
+ +

+ +

Then, I flip alices first qubit to a 1 state; this is the qubit whose state is to be teleported:

+ +
circuit.x(0)
+
+ +

+ +

Then, my understanding gets fuzzy, and I have a few questions.

+ +

1) I seem to entangle Alice's to-be-teleported state qubit with her qubit that is entangled with Bob's. But what exactly am I doing when I conditionally flip this to-be-teleported qubit and then put a hadamard on it?

+ +
circuit.cx(0,1)
+circuit.h(0)
+
+ +

+ +

and then 2) how does my measurement affect Bob's qubit?

+ +
circuit.measure([0,1],[0,1])
+
+ +

+ +

finally, 3) why do I again conditionally flip Alice's second qubit with Bob's qubit and then conditionally rotate Alice's to-be-teleported qubit with Bob's qubit?

+ +
circuit.cx(1,2)
+circuit.cz(0,2)
+
+ +

+ +

Here is the whole circuit, for reference:

+ +

+",8133,,55,,10/27/2020 9:13,10/27/2020 9:13,How does the teleportation circuit work after the initial entanglement?,,1,0,,,,CC BY-SA 4.0 +10263,2,,10262,3/22/2020 22:33,,3,,"

1) In this step, you connect a teleported qubit with entangled qubits between Alice and Bob. This means, Bob now has an ""access"" to the teleported qubit.

+ +

2) Here you get some information about the teleported qubit and ""partially colapse"" Bob's qubit according to a state of the teleported qubit.

+ +

3) In this last step you bring information about the teleported state via classical channel from Alice to Bob. This is the actual teleportation - Alice's state disapper, it is transformed to classical information and based on this classical data, it is recreated on Bob's side by influencing formelly entangled qubits.

+ +

This description is unfortunately inaccurate because plain English is not sufficient to described such phenomena like a quantaum teleportation. See this thread for mathematical description of the whole teleportation process, it is clearer from my point of view.

+",9006,,,,,3/22/2020 22:33,,,,2,,,,CC BY-SA 4.0 +10264,1,12159,,3/22/2020 23:22,,3,245,"

Consider the standard two-party CHSH scenario. Each party can perform one of two measurements (denoted with $x,y\in\{0,1\}$) and observe one of two outcomes (denoted with $a,b\in\{0,1\}$).

+ +

Let $P(ab|xy)$ be the probability of observing outcomes $a,b$ when choosing the measurements settings $x,y$. Local realistic theories are those that, for some probability distribution over some hidden variable $\lambda$, satisfy +$$P(ab|xy)=\sum_\lambda q(\lambda)P_\lambda(a|x)P_\lambda(b|y).\tag1$$ +Define the local polytope $\mathcal L$ as the set of theories that can be written as in (1). +Note that we identify here a theory with its set of conditional probabilities: $\boldsymbol P\equiv (P(ab|xy))_{ab,xy}$.

+ +

Denote with $E_{xy}$ the expectation values $E_{xy}=\sum_{ab}(-1)^{a+b}P(ab|xy)$. +We then know that all local realistic theories $\boldsymbol P\in\mathcal L$ satisfy the CHSH inequality: +$$\Big|\sum_{xy}(-1)^{xy} E_{xy}\Big| = |E_{00}+ E_{01} + E_{10} - E_{11}| += \left|\sum_{abxy}(-1)^{a+b+xy}P(ab|xy)\right| \le 2.\tag2$$ +Is the opposite true? In other words, do all theories satisfying (2) admit local realistic explanations?

+",55,,55,,5/13/2020 14:46,5/24/2020 12:54,Does the CHSH inequality fully characterise the local polytope?,,3,0,,,,CC BY-SA 4.0 +10265,2,,10264,3/23/2020 9:19,,1,,"

Yes. As you've effectively said, all cases satisfying (2) are in a polytope and therefore convex. All the vertices of that polytope are deterministic strategies, and so every point inside the polytope can be described as a convex combination of these, and that gives you (at least) one such local realistic explanation.

+",1837,,,,,3/23/2020 9:19,,,,14,,,,CC BY-SA 4.0 +10266,2,,10261,3/23/2020 9:20,,2,,"

a good stater i would say is the paper of Knill and Laflamme about LOQC (Linear Optical Quantum computing) from 2001, that says that quantum computing can be achieved with linear optic.

+ +

Photons are really good as they can be used in many way to create qubits (polarisation of course, but also time, frequency, OAM).

+ +

A Ph.D Thesis of Laurent Olislager is available online on the subject of time-frequency photon qubits, that is very interesting !

+",10417,,,,,3/23/2020 9:20,,,,0,,,,CC BY-SA 4.0 +10268,2,,10246,3/23/2020 15:33,,5,,"

This depends on the context in which you're using the operators. You're talking about multiplying them, so I guess you're thinking of, for example, unitaries (and other circuit model elements). In this case, not only are terms $A\otimes I$ local operators, but $A\otimes B$ is also a local operator. For example, on a quantum circuit, two Hadamard gates applied on neighbouring qubits are described as $H\otimes H$.

+ +

It is only when you take sums of local operators that you might create a non-local operator. For example, controlled-not is written as $I\otimes I+(I-Z)\otimes(X-I)/4$, and cannot be written in the form $A\otimes B$, corresponding with the fact that it's entangling. Given that this is the setting I believe you're talking about, everything in your question is considered a local operator.

+ +
+ +

The other context in which this might arrise is a Hamiltonian. If you have a Hamiltonian that is of the form $H=A\otimes I$, that Hamiltonian is local. However, a Hamiltonian $H=A\otimes B$ is not local. There is no contradiction here because you do not combine local Hamiltonians by product, but by adding them together, so there is no expectation that $A\otimes B$ should be local. Ultimately, what you're really thinking about is the resultant evolution, $e^{-iHt}$. There, you can see that $H=A\otimes B$ produces unitaries that are non-local in the previous sense, while if I added local operators, $H=A\otimes I+I\otimes B$, that produces local operators $e^{-iAt}\otimes e^{-iBt}$ in the same sense as before.

+",1837,,,,,3/23/2020 15:33,,,,0,,,,CC BY-SA 4.0 +10269,1,10280,,3/23/2020 16:04,,4,139,"

I'm working on the following problem form Nielsen and Chuang (Ex. 4.40) regarding the universality of Hadamard, phase and $\pi/8$ gates for single qubit gates:

+
+

For arbitrary $\alpha$, $\beta$,

+

$E(R_{\vec{n}}(\alpha), R_{\vec{n}}(\alpha + \beta)) = |1 - exp(i\beta/2)|$, +where $E(U, V) = max_{|\psi\rangle} || (U-V)|\psi\rangle||$

+

Show (using the previous equality) $\forall \epsilon >0$ , $\exists n$, such that $E(R(\alpha)_{\vec{n}}, {R(\theta)_{\vec{n}}}^n) < \frac{\epsilon}{3}$, where $\theta$ is an irrational multiple of $2\pi$.

+
+

My attempt:

+

Prior to the exercise, it discusses how for any arbitrary error $\epsilon > 0$, we can find some multiple $(mod$ $2\pi)$ of irrational $\theta$ (found using the Pigeonhole principle, which I think I understand, and I'm skipping and taking as given), call it $\theta_k \in (0, 2\pi]$, |$\theta_k| < \epsilon$ such that all multiples $(mod$ $2\pi)$ of $\theta_k$ differ by at most $\epsilon$. Thus $\forall \alpha \in [0, 2\pi)$, $\exists m$, such that $|\alpha - (m\theta_k) | =|\alpha - (mk\theta)| < \epsilon$. Let $n = mk$, then

+

$E(R(\alpha), {R_{\vec{n}}}(\theta)^n) = E(R_{\vec{n}}(\alpha), {R_{\vec{n}}}(n\theta)) = E(R_{\vec{n}}(\alpha), {R_{\vec{n}}}(\alpha + (n\theta -\alpha))) < +E(R_{\vec{n}}(\alpha), {R_{\vec{n}}}(\alpha + \epsilon)) = |1 - exp(i\epsilon/2)| = \sqrt{((1 - cos(\epsilon/2))^2 + sin(\epsilon/2)^2} = \sqrt{2(1 - cos(\epsilon/2))} < 2$

+

(which is not correct).

+

I feel like I'm missing something very obvious in this whole exercise. A hint would be appreciated.

+",8765,,-1,,6/18/2020 8:31,3/24/2020 10:40,Error bound on approximating arbitrary rotation gates,,1,2,,,,CC BY-SA 4.0 +10270,1,10271,,3/23/2020 19:35,,2,214,"

The question says it all. Explain any difference in terminology that can be encountered across Physics, Quantum Computing and Mathematics. Thanks!

+",7528,,,,,3/23/2020 20:36,Terminology : Are basis states the same as basis vectors?,,2,0,,,,CC BY-SA 4.0 +10271,2,,10270,3/23/2020 20:29,,4,,"

You are correct that ""basis states"" and ""basis vectors"" essentially mean the same thing, but the terms do have a bit of a different connotation.

+ +

The eigenvectors that span a Hamiltonian matrix are ""states"" in which a quantum mechanical system can exist. The ones with the smallest eigenvalue are ""ground state wavefunctions"", the ones with the next smallest eigenvalue are the ""first excited state wavefunctions"", etc. The eigenvectors of a Hamiltonian matrix are also basis vectors/states, because Hamiltonians are Hermitian.

+ +

However the eigenvectors of a Hermitian matrix arising in some finance application that has nothing to do with quantum mechanics, will be called ""basis vectors"" but not ""basis states"" because they don't necessarily have the meaning of being ""states"" of anything.

+ +

A bigger distinction comes from the fact that not all quantum systems are discrete, for example the position $x$ of a particle is often treated to be a continuous variable. Here we are reminded that the Hamiltonian is not just a ""matrix"" but it's something more general called an ""operator"". There is still an eigensystem associated with this operator, but instead of calling the wavefunctions ""eigenvectors"", we call them ""eigenfunctions"". Eigenfunctions are functions like $\psi(x) = e^{-x^2}$ and you would not usually call this a ""vector"" (although you certainly can if you want to).

+",2293,,,,,3/23/2020 20:29,,,,2,,,,CC BY-SA 4.0 +10272,2,,10270,3/23/2020 20:36,,1,,"

Any quantum state is described by a complex vector of dimension $n$. When you take $n$ linearly independent vectors, they form a basis. The same is true for quantum states as they are described by vectors, hence these states are also called basis.

+ +

So, answer is: yes, basis states are composed of a vector space basis.

+",9006,,,,,3/23/2020 20:36,,,,6,,,,CC BY-SA 4.0 +10273,1,10274,,3/23/2020 21:56,,5,128,"

The question is quite straightforward. In classical computation, there exists several ways to build logical circuits based on thruth tables and Karnaugh maps. Is there anything equivalent for quantum computation?

+ +

Every circuit that I have made is mostly either guessing or saw someone else's answer and paved my way to it.

+",5620,,55,,10/27/2020 9:13,10/27/2020 9:13,Is there a systematic way to build quantum circuits?,,1,3,,,,CC BY-SA 4.0 +10274,2,,10273,3/23/2020 23:09,,4,,"

Designing a logical function for quantum computer is similar to same process for classical one. You can also use truth tables. But you have to design the function to be reversible. Assume you have truth table for logical function $f(x): \{0;1\}^n \rightarrow \{0,1\}$, then reversible equivalent can be build in this way:

+ +

$$ +|x_n\rangle |y\rangle \rightarrow |x_n\rangle |f(x_n) \oplus y\rangle. +$$

+ +

You should do this for all basis quantum states. Then arrange mapping you got to a matrix. Because of construction above, the matrix is unitary. After that you have to decompose the matrix to some basic gates.

+ +

Any unitary 2x2 matrix (i.e. single qubit gate) can be decomposed into three matrices

+ +

$$ +\begin{pmatrix} +\mathrm{e}^{i\alpha} & 0\\ +0 & \mathrm{e}^{-i\alpha}\ +\end{pmatrix} +\begin{pmatrix} +\cos (\theta/2) & \sin(\theta/2)\\ +-\sin (\theta/2) & \cos (\theta/2) +\end{pmatrix} +\begin{pmatrix} +\mathrm{e}^{i\beta} & 0\\ +0 & \mathrm{e}^{-i\beta}\ +\end{pmatrix}, +$$ +$\alpha, \beta$ and $\theta$ being real numbers.

+ +

When you single out $\mathrm{e}^{i\alpha}$ from the first matrix and $\mathrm{e}^{i\beta}$ from the third, you get $U1$ gate (up to global phase) on IBM Q. A matrix in the middle can be implemented with gate $U3$ on IBM Q (or $y$ rotation up to phase). So, this is a universal approach how to build single qubit gate.

+ +

Any contolled gate (with one control qubit) can be decomposed to

+ +

$$ +(I\otimes C) \,CNOT\, (I \otimes B)\, CNOT\, (I \otimes A), +$$

+ +

where $I$ is and 2x2 unit matrix and $ABC = I$.

+ +

See Elementary gates for quantum computation for more information on three and more qubits gates.

+ +

Also these articles could be helpful:

+ + +",9006,,9006,,3/24/2020 11:00,3/24/2020 11:00,,,,5,,,,CC BY-SA 4.0 +10275,1,,,3/24/2020 3:12,,1,92,"

I have a code like this

+ +
public string CalculateMD5Hash(string input)
+{
+
+    MD5 md5 = System.Security.Cryptography.MD5.Create();
+    byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(input);
+    byte[] hash = md5.ComputeHash(inputBytes); 
+
+    StringBuilder sb = new StringBuilder();
+    for (int i = 0; i < hash.Length; i++)
+    {
+        sb.Append(hash[i].ToString(""X2""));
+    }
+    return sb.ToString();
+}
+
+public bool checkHash(){
+ List<string> charset = new List<string>{""0"",""1"",""2"",""3"",""4"",""5"",""6"",""7"",""8"",""9"",""a"",""b"",""c"",""d"",""e"",""f"",""g"",""h"",""i"",""j"",""k"",""l"",""m"",""n"",""o"",""p"",""q"",""r"",""s"",""t"",""u"",""v"",""w"",""x"",""y"",""z""};
+ foreach(var a in charset)
+ {
+     foreach(var b in charset){
+         foreach(var c in charset){
+             foreach(var d in charset){
+                  foreach(var e in charset)
+                  {
+                    string result = a+b+c+d+e;
+                    if(CalculateMD5Hash(result).StartWiths(""9A4F2E9567F170C5""))
+                      return true;
+                  }              
+             }           
+         }
+     }   
+ }
+ return false;
+}
+
+ +

Is this possible to bring this into Q# & run them on Azure Quantum using some of the Q# quantum method?

+",10447,,,,,3/25/2020 3:29,May I deploy my C# code to Q# Azure quantum computing?,,2,0,,,,CC BY-SA 4.0 +10276,2,,10275,3/24/2020 4:18,,2,,"

You cannot deploy C# to Q# Azure platform; Q# Azure platform executes a Quantum Simulator. The C# host program calls Q# operations to be executed on the Quantum Simulator - the code you have here will execute on a traditional computing processor.

+ +

Please read this link - https://docs.microsoft.com/en-us/quantum/quickstart

+ +

And this link more about the Azure Quantum - https://azure.microsoft.com/en-us/services/quantum/

+ +

Please read this article to set the right expectation +https://www.scientificamerican.com/article/how-close-are-we-really-to-building-a-quantum-computer/

+",5175,,5175,,3/25/2020 3:29,3/25/2020 3:29,,,,4,,,,CC BY-SA 4.0 +10277,1,10279,,3/24/2020 5:19,,2,413,"

Say I have the stabilizer $XXI$, and a phase-flipped state $|\psi\rangle$. What does it mean to measure the stabilizer $XXI$?

+ +

What is the math behind ""measurement""?

+",10450,,9006,,3/24/2020 5:51,3/24/2020 8:05,"What does it mean to ""measure a stabilizer""?",,1,0,,,,CC BY-SA 4.0 +10278,2,,10261,3/24/2020 5:45,,2,,"

Here is a handful of Linear Optical Quantum Computation (LOQC) resources I have found useful in the past:

+ +
    +
  • ""Linear Optical Quantum Computing"" (2005) by Kok et. al.: this is probably the best review paper that came out after Knill, Laflamme, and Milburn's 2001 discovery that theoretically-efficient LOQC was possible. It's a pretty thorough but very accessible introduction to the field of LOQC circa 2005. Note that this specifically focusses on ""linear"" photonic quantum computing.
  • +
  • ""Introduction to optical quantum information processing"" (2010) by Kok and Lovett: This book (published by Cambridge university press) covers optical information processing more generally, so it also includes content on the non-linear ""continuous variable"" photonic encodings.
  • +
  • ""Towards practical linear optical quantum computing"" (2015) by Gimeno-Segovia: Chapter 2 of Gimeno-Segovia's thesis does an excellent job of reviewing the literature and progress in LOQC of the previous decade in an accessible way for new readers. The subsequent Chapters 4 to 6 then present the groundbreaking work her and her collaborators did to present a far more efficient scheme for LOQC.
  • +
  • ""Why I am optimistic about the silicon-photonic route to quantum computing"" + (2016) by Rudolph: This takes the work of Gimeno-Segovia, et. al. and presents the key sets of open problems for the field of LOQC, and argues why (and suggestions for how) these can be addressed.
  • +
  • ""Towards realistic architectures for linear optical quantum computing"" + (2019) by Morley-Short: Chapter 2 of Morley-Short's thesis provides a top-to-bottom overview of the entire LOQC architecture (which include the discoveries of Gimeno-Segovia, et. al.) circa 2019, going all the way from single photons to algorithms on quantum error-corrected logical qubits.
  • +
+ +

Note that this does not include much content on the advances of non-linear optical quantum computing since 2010, which may also be of interest.

+",391,,,,,3/24/2020 5:45,,,,1,,,,CC BY-SA 4.0 +10279,2,,10277,3/24/2020 8:05,,3,,"

Measurements can be described by a Hermitian operator, $A$. In this case, $A=X\otimes X\otimes I$. That operator has a spectral decomposition +$$ +A=\sum_i\lambda_iP_i, +$$ +where the $\lambda_i$ are the distinct (real) eigenvalues, and the $P_i$ are projectors onto the different eigenspaces, and satisfy the completeness relation $\sum_iP_i=I$.

+ +

So, basically, we're using $A$ to define the set $\{P_i\}$ which are the projectors in the formalism of projective measurement, i.e. we measure in this basis and get answer $i$ with probability $p_i=\langle\psi|P_i|\psi\rangle$. After the measurement, the system is in the state $P_i|\psi\rangle/\sqrt{p_i}$.

+ +

In your case, since $A^2=I$, you know the eigenvalues are $\pm 1$, and hence you can write +$$ +P_{\pm}=\frac12(I\pm A). +$$

+",1837,,,,,3/24/2020 8:05,,,,0,,,,CC BY-SA 4.0 +10280,2,,10269,3/24/2020 10:40,,3,,"

Firstly, I think there's a reason why the bit in the textbook before the question is using $\delta$ instead of $\epsilon$ for the results. So, replacing what you've written, it should really be +$$ +E<\sqrt{2(1-\cos(\delta/2))} +$$

+ +

Now, start with a double-angle formula: $1-\cos(\delta/2)=2\sin^2(\delta/4)$. Thus, +$$ +E<2\sin(\delta/4) +$$ +Now if you apply the small $\epsilon$ approximation (which should be more obvious following that manipulation), you get +$$ +E<\delta/2. +$$ +Finally, if you want $E<\delta/2$, you simply have to select $\delta=2\epsilon/3$.

+ +

You might ask why you want the factor of $1/3$ in there at all? Why not just leave it as $1/2$? This point is that there's going to be a sequence of three of these rotations, and you want to bound the final error by $\epsilon$.

+",1837,,,,,3/24/2020 10:40,,,,0,,,,CC BY-SA 4.0 +10281,1,10282,,3/24/2020 13:05,,3,308,"

I'm trying to implement the main algorithm described in the Quantum Recommendation Systems paper. In order to do this, I have to create a quantum state $|x\rangle$ corresponding to a real vector stored in QRAM. I used an algorithm described more in detail in another paper, in which one can read:

+ +
+

For the runtime, there are $2^k$ rotations executed at the $k$-th level of the tree, apart from the last level where there are none. For a given level these rotations can be executed in parallel as they are all controlled operations on the same qubit, conditioned on different bit-string values of a shared register. To see this, let $U_x$ be a single qubit rotation conditioned on a bitstring $x \in \{0, 1\}^k$. Then the unitary $\bigoplus\limits_{x\in\{0,1\}^k} U_x$ applied to $|y\rangle\otimes|q\rangle$ achieves the desired parallel operation on the single qubit $|q\rangle$, where $|y\rangle = \sum\limits_{x\in\{0,1\}^k}\alpha_x\,|x\rangle$ is some superposition over bitstrings.

+
+ +

I'm not sure that I understand this notion of parallel execution. In the algorithm, at a given step $k$, one performs on one qubit $2^k$ controlled rotation conditionned on every qubit amongst the first $k-1$. Hence, we can summarize this as one big unitary matrix that acts on the first $k$ qubits, which will look-like $\begin{bmatrix}R_{\theta_1}&0&0\\\vdots&\ddots&\vdots\\0 & 0 & R_{\theta_{2^k}}\end{bmatrix}$, where for a given angle $\theta$, $R_\theta$ is the rotation of angle $\theta$ around the $Y$-axis of the Bloch sphere.

+ +

If we assume that this big operator is applied in $O(1)$, then I understand the notion of parallelism: you don't have to successively apply the $2^k$ controlled gates, so you have a gain in complexity. But then, there is one problem I can't cope with. When you execute an algorithm on a quantum computer, I read that you are only allowed to use a specific set of gates. Hence, a compiler takes your code and transforms it to a compatible code. But am I sure that the compiler will always (or even sometimes) be able to decompose this big gate into a succession of smaller, allowed gates, without breaking the complexity?

+",10454,,,,,3/24/2020 14:08,Building a state with parallel execution,,1,0,,,,CC BY-SA 4.0 +10282,2,,10281,3/24/2020 14:08,,2,,"
+

am I sure that the compiler will always be able to decompose this big gate into a succession of smaller, allowed gates, without breaking the complexity

+
+ +

No, you're not. This is the whole problem with algorithms, be they classical or quantum.

+ +

However, in the specific case you're talking about, there is a nice implementation. Imagine that you want to apply the rotation $R_y(\theta_x)$ if the main register is in the state $|x\rangle$. Let me further more assume that there is a good $t$-bit approximation to the values $\theta_x$ for which there is an efficient classical function. So, I have a function $f(x)$ that outputs the value $\tilde\theta_x$, the $t$-bit approximation to $\theta_x$. Since it's a classical function, I can also write it as a quantum function $V$ that acts as $V|x\rangle|0\rangle=|x\rangle|\tilde\theta_x\rangle$, having introduced an ancilla system of $t$ bits. Implementation of $V$ is efficient because the evaluation of $f$ is efficient.

+ +

Next, I know that if I apply phase gates on the $t$ qubits of the ancilla register (phase $\pi,\pi/2,\pi/4,\pi/8,\ldots$), I can implement $|\tilde\theta_x\rangle\rightarrow e^{i\tilde\theta_x}|\tilde\theta_x\rangle$. If I just inverted my original calculation at this point, $V^\dagger$, then the net effect is $e^{i\tilde\theta_x}|x\rangle\rightarrow|x\rangle$. However, imagine now that I replace the phase gates with controlled-phase gates, controlled off the single qubit target. Then the net effect of the gate is a controlled-phase rotation of angle $\tilde\theta_x$ between the $|x\rangle$ register and the single qubit target. At this point, you're essentially there. You just need a basis rotation (e.g. $(Z+Y)/\sqrt{2}$) on the target qubit to convert the gate from controlled-$Z$ to controlled-$Y$.

+",1837,,,,,3/24/2020 14:08,,,,0,,,,CC BY-SA 4.0 +10284,2,,10257,3/24/2020 15:08,,5,,"

Here the subscripts are of the form $1i$, where $i$ is the label of the subsystem (recall that you are using two qubits for this $\left|\psi\right>_0=\left|00\right>_{1}$). So any product of subscripts can be written as $\left|q_0\right>_{10}\left|q_1\right>_{11}=\left|q_0q_1\right>_{1}$ with $q_0,q_1\in\{0,1\}$ in this convention, which makes sense because $q_0$ occupies the position $0$ and $q_1$ occupies the position $1$ from left to right.

+ +

Also you are right, there is a factorization and you can check this fact expanding the first two terms related to the system $1$ in $\left|\psi_2\right>$ using the convention explained previously:

+ +

$\left|\psi_2\right>=\frac{1}{\sqrt{2}}(\left|0\right>_{10}-\left|1\right>_{10})\frac{1}{\sqrt{2}}(\left|0\right>_{11}-\left|1\right>_{11})\frac{1}{\sqrt{2}}(\left|0\right>_{2}-\left|1\right>_{2})=\frac{1}{2}(\left|0\right>_{10}\left|0\right>_{11}-\left|0\right>_{10}\left|1\right>_{11}-\left|1\right>_{10}\left|0\right>_{11}+\left|1\right>_{10}\left|1\right>_{11})\frac{1}{\sqrt{2}}(\left|0\right>_{2}-\left|1\right>_{2})\\ +=\frac{1}{2}(\left|00\right>_{1}-\left|01\right>_{1}-\left|10\right>_{1}+\left|11\right>_{1})\frac{1}{\sqrt{2}}(\left|0\right>_{2}-\left|1\right>_{2})$.

+ +

I hope this can help you to clarify your problem.

+",10455,,,,,3/24/2020 15:08,,,,0,,,,CC BY-SA 4.0 +10285,1,10289,,3/24/2020 18:54,,1,92,"

In paper Simulating quantum systems on a quantum computer the author mention in section 3, simulating a decay to obtain the ground state, and give the Hamiltonian for that: +$$H=H_1+H_2 + H_{1I}\otimes H_{2I}$$ +My questions are:

+ +
    +
  • Can you explain this Hamiltonian more explicitly, or refer me to a paper doing that?
  • +
  • Are there papers that elaborate this Hamiltonian in a quantum computer?
  • +
  • Are there other Hamiltonians expressing the decay process?
  • +
+ +

Any answer will be more than appreciated, and thank you :)

+",8009,,55,,10/27/2020 9:13,10/27/2020 9:13,Questions about the Hamiltonian of a decay,,1,0,,,,CC BY-SA 4.0 +10286,2,,10275,3/25/2020 1:06,,0,,"

MD5 hashes are not that hard to crack classically, you probably don't need a quantum computer to do that (for your hash prefix, the pre-image is 2435435 with full hash 9a4f2e9567f170c5685b57d8a6c0af6f).

+ +

In general, one can use Grover's search algorithm for breaking hash functions; you'd have to implement the hash calculation in a reversible manner (so that it can be executed on a quantum computer) and try to invert function ""f(x) = 1 if hash(x) = your hash, and 0 otherwise"".

+ +

You can see this excellent answer for an overview of papers that analyze applying Grover's search to breaking various hashes, and a note on practicality of such attacks.

+",2879,,,,,3/25/2020 1:06,,,,2,,,,CC BY-SA 4.0 +10287,1,,,3/25/2020 4:22,,1,102,"

I am new to GitHub/Python - please tell me how can I run programs in https://github.com/Qiskit/qiskit-aqua/tree/master/test and its sub directories in Jupyter. I am connected to IBM Q Expereince. I am looking at class QiskitBaseTestCase and unittest.

+ +

I am reading on unittest - I see a template (sample fixture)

+ +
import unittest
+
+def fun(x):
+    return x + 1
+
+class MyTest(unittest.TestCase):
+    def test(self):
+        self.assertEqual(fun(3), 4)
+
+ +

For something like that including the following is sufficient in Jupyter.

+ +
if __name__ == '__main__': 
+    unittest.main() 
+
+ +

I have tried to copy the https://github.com/Qiskit/qiskit-aqua/blob/master/test/base_test_case.py into Jupyter and start from there - it hasn't helped.

+ +

Please help - how to run the Qiskit test cases in Jupyter?

+",5175,,9006,,3/25/2020 5:08,3/25/2020 5:08,How can I run programs in test folder Github Qiskit,,0,1,,,,CC BY-SA 4.0 +10289,2,,10285,3/25/2020 8:16,,1,,"

This is a very generic description that captures essentially all possibilities of describing the Hamiltonian with a decay process (I supposed one should allow for a general $H_{1,2}$ rather than a simple tensor product of terms)).

+ +

The basic idea is that if you've got a system (""1""), then if you just describe using a Hamiltonian on that system, the evolution is unitary and so you do not get any decay. In particular, the purity of the system is preserved.

+ +

So, the way to describe decay using unitary evolution (i.e. the result of Hamiltonian dynamics) is to go to the ""church of the larger Hilbert space"". You add in an ancilla system (""2"", often referred to as the bath) and have some (unspecified) interaction between the two systems. The overall evolution is unitary, and therefore purity preserving, but the purity of the system 1 by itself is not necessarily preserved. Hence, this can be thought of as some sort of decay.

+ +

Section 8.2.3 of Nielsen & Chuang covers this conceptually, although in a slightly different formalism.

+ +

What those Hamiltonians actually are is up to you. It's not uncommon to pick the ancilla system to be one or more harmonic oscillators (see the wikipedia page for more references). One reason is the infinite Hilbert space that it provides. Finite Hilbert spaces (eventually) lead to revivals of the original state, which is not good if you're trying to describe loss!

+ +
+

Are there papers that elaborate this Hamiltonian in a quantum computer?

+
+ +

This depends what you mean. Are you wanting the description of the noise process that the quantum computer is undergoing? Or are you wanting to implement your own noise process on a quantum computer? For the former, the whole point of noise is that there's an associated, uncontrolled, environment/bath. You will not get a description of that. The best you can hope for is the net effect on just the system. For the latter, you have to pick your noise Hamiltonian, approximate it (because the computer only has a finite Hilbert space) and simulate it using standard Hamiltonian simulation techniques. But there are probably better ways of implementing noise...

+",1837,,,,,3/25/2020 8:16,,,,0,,,,CC BY-SA 4.0 +10290,1,,,3/25/2020 14:36,,3,256,"

I have followed all steps described in https://docs.microsoft.com/en-us/quantum/install-guide/qjupyter

+ +

But I am unable to get through part 3. It is showing syntax error in Python terminal in Jupyter notebook. +I am not seeing Q# terminal in jupyter notebook (New) folder

+ +

Now after so many attempts its showing I am done with this. I think its better to switch to Qiskit.

+ +

+",10471,,10471,,3/30/2020 6:09,10/3/2022 6:06,Installing Q# in jupyter,,1,10,,,,CC BY-SA 4.0 +10291,1,10292,,3/25/2020 15:27,,0,92,"

+ +

I've got this question to answer and from what I can tell, I need to take the square of the absolute value for the probability amplitude.

+ +

In this case I think the answer should be the square of $e^{i\phi} \cos(\theta)$

+ +

When I try to input this answer it returns ""Phi is not a valid variable for this solution""

+ +

How do I go about tackling this question?

+",10472,,734,,3/26/2020 8:28,3/26/2020 8:28,"How can I calculate the probability of a quantum system in superposition to be in the ""up"" state?",,1,1,,,,CC BY-SA 4.0 +10292,2,,10291,3/25/2020 16:24,,2,,"

Your question has most of the components of the answer: indeed you need to take the square of the absolute value for the probability amplitude.

+ +

You have to remember that $\cos \theta$ is a real number, and its absolute value is just $|\cos \theta|$, but $e^{i\phi}$ is a complex number (Euler's formula: $e^{i\phi}=\cos \phi + i \sin \phi$), so its absolute value is 1. The answer will be just $\cos^2 \theta$.

+",2879,,,,,3/25/2020 16:24,,,,1,,,,CC BY-SA 4.0 +10293,1,10297,,3/25/2020 19:12,,2,836,"

I was wondering what was the easiest way to take a qubit Hamiltonian, and get an expectation value estimated with a certain number of shots over a parameterized quantum circuit (or ansatz) with Cirq.

+",4127,,4127,,3/26/2020 6:32,1/18/2022 16:46,Cirq: easiest way to compute qubit Hamiltonian expectation value with number of shots,,1,3,,,,CC BY-SA 4.0 +10294,1,11346,,3/25/2020 19:30,,4,125,"

The max-relative entropy between two states is defined as

+ +

$$D_{\max }(\rho \| \sigma):=\log \min \{\lambda: \rho \leq \lambda \sigma\},$$

+ +

where $\rho\leq \sigma$ should be read as $\sigma - \rho$ is positive semidefinite. In other words, $D_{\max}$ is the logarithm of the smallest positive real number that satisfies $\rho\leq\lambda\sigma$. I would like to understand the following properties of this quantity when the states are bipartite i.e. they live on $H_A\otimes H_B$. In the following, all $\rho$ and $\sigma$ correspond to quantum states (positive semidefinite matrices with unit trace).

+ +

A quantity known as the max-information that $B$ has about $A$ is given by

+ +

$$I_{\max}(A:B)_\rho = \min\limits_{\sigma_B} D_{\max}(\rho_{AB}||\rho_A\otimes\sigma_B)$$

+ +

Let the minimum on the right hand side be achieved by the state $\sigma^\star_B$. My questions are as follows

+ +
    +
  1. Can someone provide an example of a state $\rho_{AB}$ for which $\sigma^\star_B \neq \rho_B$?

  2. +
  3. Is it true that $D_{\max}(\rho_{B}||\sigma^\star_B) \leq D_{\max}(\rho_{B}||\sigma_B)$ for all $\sigma_B$ i.e. is the $D_{\max}$ minimizing state preserved under a partial trace?

  4. +
+",4831,,55,,5/6/2021 12:39,5/6/2021 12:39,Questions about the relation between max-relative entropy $D_{\max}(\rho||\sigma)$ and max-information,,1,0,,,,CC BY-SA 4.0 +10295,1,10296,,3/25/2020 23:13,,1,684,"

I'm wondering how a set of three 0-state qubits, each prepared identically, like so:

+ +

+ +

When considered together, may produce the fraction: + along with their combined states.

+ +

This is the entire circuit. Is this an indication of entanglement? Understanding the algebra here will help me to understand more generally how the entanglement occurs. Thanks in advance.

+ +

+",8133,,2879,,3/26/2020 4:58,3/26/2020 4:58,Simple algebraic explanation for normalizing states,,1,0,,,,CC BY-SA 4.0 +10296,2,,10295,3/26/2020 0:26,,4,,"

The coefficient $\frac{1}{\sqrt{2^3}}$ is the normalization factor: if you have a 3-qubit state that is an equal superposition of 8 basis states, its norm still has to be 1; thus the squared amplitude of each basis state has to be $\frac{1}{8}$, and the amplitude will be square root of that, i.e. exactly $\frac{1}{\sqrt{2^3}}$.

+ +

You can also obtain that coefficient from the expansion into a tensor product below.

+ +
+ +

Speaking of entanglement, these qubits are not actually entangled. You can see that if you try to represent their state as a tensor product of states of 3 individual qubits:

+ +

$$\frac{1}{\sqrt{2^3}}(|000\rangle + |001\rangle + ... + |111\rangle) = \frac{1}{\sqrt2}(|0\rangle + |1\rangle) \otimes \frac{1}{\sqrt2}(|0\rangle + |1\rangle) \otimes \frac{1}{\sqrt2}(|0\rangle + |1\rangle)$$

+ +

Being able to find such representation is exactly the definition of the qubits not being entangled (in other terms, the state is separable).

+",2879,,,,,3/26/2020 0:26,,,,3,,,,CC BY-SA 4.0 +10297,2,,10293,3/26/2020 0:28,,2,,"

tl;dr: You need to compute the average of the parity of the observed bitstrings, with an understanding that the circuit was executed with some appended measurement gates like $V_{measure} U(\theta)$. Check out footnote 3 for an example implementation in Cirq.

+

The core idea of how to do this is fairly simple, but I'm going to provide a series of progressively more complicated examples that emphasize that this computation is very contextual.

+
    +
  1. Compute $\langle Z_0 \rangle$: To do this, you would run your parametrized circuit (call it $U(\theta)$), and then you want to do a weighted average of the bit that you observed. If we use the convention that $Z | 1 \rangle = -1$ and $Z | 0 \rangle = +1$, then computing the expectation value of $Z_0$ with respect to a single-qubit state $| \psi \rangle = c_0 | 0 \rangle + c_1 |1 \rangle$ gives: +\begin{align} +\langle Z_0 \rangle &= \langle \psi | Z_0 | \psi \rangle \\ +&= |c_0|^2 - |c_1|^2 +\end{align}The squared amplitudes $|c_i|$ are the probability $P(i)$ of observing bitstring $i$, so if we want to determine this quantity experimentally we would compute
  2. +
+

\begin{align} +\langle \tilde{Z}_0 \rangle &= P(0) - P(1) \\ +&= \frac{n_0 - n_1}{n_0 + n_1} +\end{align}where the tilde indicates that this is an estimator for the expectation value (and therefore carries along with it some statistical baggage) and $n_i$ is the number of bitstring $i$ that we observed.

+

The above formula makes a lot of intuitive sense if you're used to computing expectation values for Hamiltonians by hand using weighted sums of eigenvalues. However it will be easier later if we recast this as a problem of computing the parity of the bit we observed. To do so, first convert each bit measured as "0" to $1$ and each bit measured as "1" to $-1$. The function that converts individual bits to signed eigenvalues is $f(b) = 1 - 2b$ where $b\in \{0,1\}$. Then the estimator computed for $n$ repetitions of the circuit is:

+

$$ +\langle \tilde{Z}_0 \rangle = \frac{1}{n} \sum_{i=1}^n f(b_0^{(i)}) +$$

+

where $b_k^{(i)}$ is the observed outcome of the k-th qubit for the i-th repetition of the circuit.

+
    +
  1. Compute $\langle X_0 \rangle$ - This task is just another way of saying, "compute $\langle Z_0 \rangle$ in the x-basis". So, if you prepend the measurement with a Hadamard that sends the $|+ \rangle$ state to $|0 \rangle$ state$^1$, i.e. run $H_0 U(\theta)$ as your quantum circuit $^2$ then the computation is identical: +\begin{equation} +\langle \tilde{X}_0 \rangle = \frac{1}{n} \sum_{i=1}^n f(b_0^{(i)}) +\end{equation}

    +
  2. +
  3. Compute $\langle Z_0 Z_1 \rangle$ - this measuring the parity between two bits that we measure: It will be positive if both Z-measurements are the same, and negative otherwise. The basis states that you can measure and their corresponding eigenvalues are: +\begin{align} +|00 \rangle &\rightarrow 1 \\ +|01 \rangle &\rightarrow -1 \\ +|10 \rangle &\rightarrow -1 \\ +|11 \rangle &\rightarrow 1 \\ +\end{align}

    +
  4. +
+

$$ +\langle \tilde{Z_0 Z_1} \rangle = \frac{1}{n} \sum_{i=1}^n f(b_0^{(i)}) f(b_1^{(i)}) +$$

+

Again, this is just computing the average parity of bitstrings measured from the circuit output.

+
    +
  1. Compute $\langle \prod_k \sigma_{k,p(k)} \rangle$ - from (2) we saw that the measurement-based estimation of Pauli products is the same regardless of the identity of the pauli. I'm using the subscript $k, p(k)$ to represent a the Pauli operator on qubit $k$ whose identity is described by $p(k)\in 0, 1, 2, 3$. So given measurements extracted from $V_{measure} U(\theta)$ (your unitary appended by a set of measurement gates), you just need to compute the mean parity over all observed bitstrings by generalizing the previous formula:
  2. +
+

$$ +\langle \tilde{\prod_k \sigma_{k,p(k)}} \rangle = \frac{1}{n} \sum_{i=1}^n \prod_{k=0}^{N-1} f(b_k^{(i)}) +$$

+

This looks complicated, but all it is a general formula for stating the average parity of bitstrings measured from the circuit output for a circuit that has been appended with the appropriate measurement gates.

+
+

1 The change of basis operation from basis $A$ to basis $B$ is generally the inverse of the operation that rotates any given vector in basis $A$ into the corresponding vector in basis $B$ - you're shifting your reference frame, not the vector.

+

2 Read from right to left!

+

3 To do this efficiently in Cirq, I would probably do something like

+
# Compute a pauli product estimator from n repetitions of a circuit prepended by 
+# a measurement unitary over N qubits
+measurement_gates = cirq.Circuit(...)
+results = cirq.Simulator().run(circuit + measurement_gates , repetitions=n)
+
+# get the bool-type measurements, shape (n, N).
+bool_outcomes = results.measurements.get("my_measurement_key") 
+
+#convert to an array of integer representations of the binary arrays, shape (n,).
+int_outcomes = bool_outcomes.dot(1 << np.arange(bool_outcomes.shape[-1] - 1, -1, -1)) 
+
+# Compute the parity of bitstrings averaged over n repetitions.
+expectation_value = np.mean(find_parity(int_outcomes))
+
+

where find_parity is the function defined here.

+",1939,,362,,1/18/2022 16:46,1/18/2022 16:46,,,,2,,,,CC BY-SA 4.0 +10298,1,11864,,3/26/2020 11:36,,10,527,"

I would like to know if exist a quantum algorithm tailored to compute the QR decomposition and SVD of a matrix? Pointers to relevant papers will be very appreciated.

+",10478,,2293,,4/11/2020 18:48,5/5/2020 12:56,Quantum algorithm for QR and SVD matrix decomposition?,,1,3,,,,CC BY-SA 4.0 +10299,2,,2310,3/26/2020 13:00,,1,,"

There's one more way:

+ +

Create two identical qubits on the Bloch sphere (this is start with 0 and apply the same random rotational gate). Then, apply a CNOT gate followed by a Hadamard gate to the first qubit to perform a measurement in the Bell basis. You will measure 00, 01, 10 (which are equivalent to the 3 symmetric Bell states) with equal probability each time.

+ +

This is my implementation of the problem:

+ +

https://colab.research.google.com/drive/1lMVaXrPUXpy7SyySZ4v9blhRQKhKQaAU

+ +

Hope that helps ;)

+",10479,,10479,,3/27/2020 15:24,3/27/2020 15:24,,,,0,,,,CC BY-SA 4.0 +10300,1,,,3/26/2020 13:16,,1,82,"

As part of a Quantum Theory project I have ""constructed"" an arbitrary 3-qubit basis:

+ +

$\left|B_0\right> =\left|000\right>$

+ +

$\left|B_1\right> = \frac{1}{\sqrt{2}}\cos(x)(\left|100\right> + \left|010\right>) + \sin(x)\left|001\right>$

+ +

and so on to $\left|B_6\right>$.

+ +

The states are orthogonal and form a proper basis set.

+ +

However, I would like to know if (and how) such a measurement can be performed.

+ +

I was looking at polarization of light and time-bins qubits experiments, but they only seem to look at creating those states, rather than performing a measurement in this basis.

+ +

Thank you in advance for your answers!

+",10479,,55,,10/27/2020 9:13,10/27/2020 9:13,Constructing and Measuring in an Arbitrary 3-qubit basis,,0,5,,,,CC BY-SA 4.0 +10301,1,,,3/26/2020 23:38,,0,270,"

The question is pretty simple. How can I get an input qubit $|0⟩$ in the state, say $$\cos{\frac{\pi}{10}}|0⟩ + \sin{\frac{\pi}{10}}|1⟩$$ Or any other sine/cosine mix state? Which gates do I need to use?

+ +

Thanks!

+",8400,,8400,,3/26/2020 23:55,3/27/2020 0:02,Qubit in a mix sin/cosine state,,1,1,,,,CC BY-SA 4.0 +10302,2,,10301,3/27/2020 0:02,,2,,"

$$R_y(\theta) = e^{-i\frac{\theta}{2}Y} = \begin{bmatrix} \cos\frac{\theta}{2} & -\sin\frac{\theta}{2} \\ \sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{bmatrix}$$

+ +

This gate might be named slightly differently depending on the source; Wikipedia doesn't seem to know it but this primer on rotations on Bloch sphere lists all rotation gates nicely.

+",2879,,,,,3/27/2020 0:02,,,,2,,,,CC BY-SA 4.0 +10303,1,10304,,3/27/2020 4:52,,2,193,"

A quantum state can be represented as linear combination of 2 states: +

+ +

In Chuang and Nielsens book, it states that because the squared amplitudes sum to 1:

+ +

+ +

That the combination can be rewritten as:

+ +

+ +

My first question is, why exactly is this? And secondly, how is this state represented in the bloch sphere? +

+ +

I am aware that this may be a simple question to many, but a step by step walkthrough of the algebra underlaying the bloch representation of the qubit would be immensely helpful to me and some friends.

+",8133,,9006,,3/27/2020 5:14,3/28/2020 3:24,How is a qubit represented on a bloch sphere?,,1,0,,,,CC BY-SA 4.0 +10304,2,,10303,3/27/2020 5:13,,2,,"

Qubit is described by a vector $|\psi\rangle = \begin{pmatrix} \alpha \\ \beta \end{pmatrix}$ where $\alpha,\beta \in \mathbb{C}$. So, you would need four real numbers for representing it. Because of condition $|\alpha|^2 +|\beta|^2 = 1$, number of degrees of freedom is reduced, so you need only three parameters, hence you can describe the qubit in spacce $\mathbb{R}^3$ and you can express it in spherical coordinates. Since two qubits with same global phase are indistinguishable, you need only two parameters for description of the qubit - those are $\varphi$ and $\theta$.

+",9006,,,,,3/27/2020 5:13,,,,3,,,,CC BY-SA 4.0 +10306,1,10309,,3/27/2020 10:56,,3,1330,"

In Nielsen & Chuang section 1.2 introduces multiple qubits and Hilbert spaces.

+ +
+

More generally, we may consider a system of n qubits. The computational basis states + of this system are of the form $|x_1 x_2 ...x_n\rangle$, and so a quantum state of such a system + is specified by $2^n$ amplitudes. For $n = 500$ this number is larger than the estimated + number of atoms in the Universe! Trying to store all these complex numbers would not + be possible on any conceivable classical computer. Hilbert space is indeed a big place. + In principle, however, Nature manipulates such enormous quantities of data, even for + systems containing only a few hundred atoms. It is as if Nature were keeping $2^{500}$ hidden + pieces of scratch paper on the side, on which she performs her calculations as the system + evolves. This enormous potential computational power is something we would very much + like to take advantage of. But how can we think of quantum mechanics as computation?

+
+ +

Okay, but for a $n=500$ classical bits you still have $n$ amplitudes, just half as many as the quantum counterpart. And $2^{500}$ is still really huge. Does saying ""Hilbert space is is a big place"" (Carlton Caves) really mean anything on its own? What do I need to add to this to really differentiate from the classical counterpart?

+",10485,,2105,,3/27/2020 16:07,3/28/2020 0:47,Why is Hilbert space considered especially large?,,2,6,,,,CC BY-SA 4.0 +10308,2,,10306,3/27/2020 11:33,,2,,"

When you have $n$ qubits (or classical bits as well) you can represent $2^n$ basis states (or numbers in classical sense). Hence you need $2^{n+1}$ real numbers to desribe a quantum state of $n$ qubits (real and imaginary part of amplitude for each member of the state).

+ +

Consider for example $n=3$. In this case, 3 bits can represent numbers 000, 001, 010, 011, 100, 101, 110 and 111, i.e. eight values ($2^3$). The same is true for qubits. Again for 3 qubits you have eight basis states $|000\rangle, |001\rangle, |010\rangle, |011\rangle, |100\rangle, |101\rangle, |110\rangle$ and $|111\rangle$. And so on for $n=4$, $n=5$ etc.

+ +

So with increasing number of qubits, vectors describing quantum states dimension and dimension of matrices describing quatum gates increase exponentially.

+ +

EDIT: I based my answer on typo in question, so here is answer you probably looked for:

+ +

On classical computer you can operate with discrete bits, each described by its value eiher 0 or 1. However, quantum computer is more or less ""continuous"" because qubit is represented by vector $\begin{pmatrix}\alpha \\ \beta\end{pmatrix}$, where $\alpha,\beta \in \mathbb{C}$ (of course with condition $|\alpha|^2+|\beta|^2=1$). So you can save more information to a qubit than to a classical counterpart (in theory infinite amount) and process it.

+ +

However, when you measure a qubit, you get of course only one bit of information as the qubit collapses to either state 0 or 1. But before the measurement, qubit is in a superposition (and can be also entangled with another qubits) which gives quatum computer higher computational performance in many tasks in comparison with classiccal computer because of ""bigger space for computation"".

+ +

To conclude: I would say that saying about Hilbert space size refers to information processing before measurement. Because of ""bigger size of space where computation is done"" on quantum computer in comparison with classical one, quantum computer are faster (or at least equally fast).

+",9006,,9006,,3/27/2020 11:49,3/27/2020 11:49,,,,3,,,,CC BY-SA 4.0 +10309,2,,10306,3/27/2020 16:23,,4,,"

There is no sense in which the classical and quantum state spaces are both exponential in the number of (qu)bits. That misconception comes from conflating two different notions of the ""size"" of the state space. Depending on how you think about it, either the classical space is linear and the quantum space is exponential, or the classical space is exponential and the quantum space is doubly exponential. In either case, the quantum space is exponentially larger than the classical space.

+ +

There are two different ways of quantifying the ""size"" of a state space:

+ +
    +
  1. The total number of possible states that a system can take on.
  2. +
  3. The number of bits of information required to uniquely specify the system's physical state.
  4. +
+ +

The latter quantity is the logarithm (base 2, or another base if you're not using binary) of the former.

+ +

A system of $n$ classical bits can take on $2^n$ different possible values. Specifying the value of each of the $n$ bits by definition specifies the state of the $n$-bit system. So the ""size"" of the state space is $2^n$ according to the first definition and $n$ according to the second definition.

+ +

A quantum system of $n$ qubits is fundamentally different: it assigns an amplitude to each of the possible classical bitstring basis states. You don't have the constraint that every amplitude is zero except for one, as you do in the (deterministic) classical case. In ""theoretical"" quantum mechanics these amplitudes can be arbitrary complex numbers, so we need to provide an infinite amount of information to specify the state of even a single qubit. In order to facilitate counting, let's assume that these amplitudes are discretized to take on $d$ possible values. (The fact that they're complex rather than real isn't really relevant; we can just absorb that distinction into the definition of $d$.) Since each of the $2^n$ complex ampitudes can take on any of $d$ possible values, the total number of possible quantum states is actually a doubly-exponential $d^{2^n}$ by definition 1. If we want to talk about the number of bits required to completely specify a state (definition 2), then it's the log base two of that number, or $2^n \times \log_2 d$, which grows exponentially with $n$.

+ +

The point is that for any vector space (over a finite field), the total number of possible vectors is exponentially large in the dimension of the vector space. I personally think it's rather unfortunate that people tend to use the terms ""size"" and ""dimension"" of a vector space interchangeably, since to me it's more natural to think of the ""size"" of a vector space as referring to the number of distinct vectors, which is actually exponential in the vector space dimension (for a vector space over a finite field).

+",551,,551,,3/27/2020 23:29,3/27/2020 23:29,,,,3,,,,CC BY-SA 4.0 +10312,1,,,3/27/2020 18:20,,2,112,"

I had the following problem with an installation of the Cirq.

+ +

When I typed python -m pip install cirq, I got the following line:

+ +

""Cannot uninstall 'sympy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.""

+ +

The source of this issue was in a new version of 'sympy' (1.23 instead of 1.22).

+ +

I found a simple solution to remove 'sympy' +conda uninstall sympy

+ +

and then wrote this code python -m pip install cirq again. After that, everything works fine.

+ +

Could you correct this bug in the future?

+",10492,,9006,,3/27/2020 23:04,3/27/2020 23:04,A bug during CIRQ installation,,0,6,0,,,CC BY-SA 4.0 +10313,1,10314,,3/27/2020 22:09,,2,573,"

I am wondering what a circuit should look like if I want to prepare the state of the following form: +$$ +|0\rangle^{\otimes n} \mapsto \dfrac{ +|1000\ldots0\rangle + +|0100\ldots0\rangle + +|0010\ldots0\rangle + +\ldots + +|00\ldots001\rangle +}{\sqrt{n}} +$$ +Is this something well-known and trivial?

+ +

ANSWER

+ +

Apparently, this question was asked here.

+ +

The Q# realization is provided in katas 15-17 here.

+",6313,,6313,,3/28/2020 15:54,3/28/2020 15:54,Uniform superposition of states with one qubit set to $|1\rangle$ and others to $|0\rangle$,,1,0,,,,CC BY-SA 4.0 +10314,2,,10313,3/27/2020 23:00,,3,,"

Your state is a generalization of so-called W-state.

+ +

Here is a implementation of the state for three qubits.

+ +

You can also use method described in paper Transformation of quantum states using uniformly controlled rotations for preparing W-state with any qubits you want. +When you use this method, set probability of states $|10\dots0 \rangle$, $|01\dots 0\rangle$,...$|00\dots1 \rangle$ to $\frac{1}{n}$ and probability of other states to zero.

+",9006,,6313,,3/28/2020 7:14,3/28/2020 7:14,,,,0,,,,CC BY-SA 4.0 +10315,1,,,3/27/2020 23:49,,2,259,"

The known decomposition of toffoli gate that can be used on IBM quantum computer is : +

+ +

I want to know any other Toffoli gate decompositions that can be used on IBM quantum computer and have a cost less than 15 gates

+",10495,,9006,,3/28/2020 7:24,3/28/2020 7:24,Decompose Toffoli gate with minimum cost for IBM quantum computer,,0,6,0,,,CC BY-SA 4.0 +10317,1,10318,,3/28/2020 10:25,,7,1428,"

I want to build a circuit which will implement $e^{iAt}$, where $ A= +\begin{pmatrix} +1.5 & 0.5\\ +0.5 & 1.5\\ +\end{pmatrix} +$ and $t= \pi/2 $. +We see that $A$ can be written as, $A=1.5I+0.5X$. Since $I$ and $X$ commute, $e^{iAt}=e^{i(1.5I)t}e^{i(0.5X)t}$.

+ +

Evaluating manually, I get $e^{iAt}=1/2\begin{pmatrix} +e^{2it}+e^{it} & e^{2it}-e^{it}\\ +e^{2it}-e^{it} & e^{2it}+e^{it}\\ +\end{pmatrix}.$

+ +

Question

+ +

How can I decompose the matrix $""1/2\begin{pmatrix} +e^{2it}+e^{it} & e^{2it}-e^{it}\\ +e^{2it}-e^{it} & e^{2it}+e^{it}\\ +\end{pmatrix}""$ into elementary quantum gates

+",10368,,,,,3/30/2020 8:33,Quantum circuit to implement matrix exponential,,3,1,,,,CC BY-SA 4.0 +10318,2,,10317,3/28/2020 12:37,,3,,"

I think this is enough $e^{iAt}= e^{i(1.5I)t} e^{i(0.5X)t}$ for constructing the circuit. From rx and u3: +$$R_x(-t) = e^{i(0.5X)t} \qquad R_x(\theta) = u3(\theta, -\pi/2, \pi/2)$$ +The $e^{i(1.5I)t}$ is a global phase gate that can be implemented via the following circuit for q[0] qubit. Here is the whole circuit for the $e^{iAt}$:

+ +
# Rx part
+circuit.u3(-t, -pi/2, pi/2)
+
+# Global phase part
+circuit.u1(1.5t, q[0])
+circuit.x(q[0])
+circuit.u1(1.5t, q[0])
+circuit.x(q[0])
+
+ +

The more general approach can be found in this paper (especially 4.1 Trotter decomposition).

+",9459,,9459,,3/28/2020 12:53,3/28/2020 12:53,,,,8,,,,CC BY-SA 4.0 +11319,1,,,3/28/2020 16:04,,3,324,"

Question from exam:

+ +

Bob built a quantum computer wiht 10 qubits. All qubits are set to zeroes. Bob performed a quantum Fourier transform on the system and then measured the system.

+ +

what is the probability that the result will be 0 (all qubits are zeroes)?

+",,Taver,9006,,3/28/2020 17:39,3/30/2020 8:37,What is the probability to get all qubits equal zero after QFT,,3,1,,,,CC BY-SA 4.0 +11320,1,12089,,3/28/2020 18:05,,5,203,"

Quantum Money is an old proposal that solves the forgeability problem of traditional banknotes, by leveraging the No-Cloning Theorem.

+ +

Recently, blockchains solved the Double-Spending problem allowing them to be de facto usable as money. Indeed even though on a blockchain you can forge as many coins as you wish, the other participants will not accept your claims.

+ +

Are there any aspect which make quantum money a superior alternative to blockchain digital currencies?

+",7727,,2293,,4/16/2021 22:45,1/11/2023 10:41,Has Blockchain made Quantum Money obsolete?,,2,4,,,,CC BY-SA 4.0 +11321,2,,11319,3/28/2020 18:43,,5,,"

By looking to the circuit for the QFT presented in the M. Nielsen and I. Chuang textbook (Figure 5.1.) we can notice that all controlled rotations can be neglected because for each control rotation gate the control qubits are in $| 0\rangle$ state (for the case described in the question). Here is the Figure from the book:

+ +

+ +

So effectively, in this case, we have only Hadamard gates acting on $n$ qubits. And, of course, Swap gates (will talk about it later). So

+ +

$$H^{\otimes n} |000...0\rangle = \frac{1}{\sqrt{2^n}} \sum_x{|x\rangle}$$

+ +

where $H^{\otimes n}$ is the notation of the $n$ Hadamard gates acting on $n$ qubits that are all in the $|0\rangle$ state, $\sum_x{|x\rangle}$ is the sum of all bit strings (from $|000...0\rangle$ to $|111...1\rangle$). Swap gates at the end of the QFT circuit (not presented in the Figure 5.1.) will not change this state: the final state after the swaps will stay the same. So all bit strings have equal amplitudes $\frac{1}{\sqrt{2^n}}$, and therefore equal probabilities $\left|\frac{1}{\sqrt{2^n}}\right|^2 = \frac{1}{2^n}$. Thus, the answer is: for 10 qubits we will measure all qubits in the $|0\rangle$ state with $\frac{1}{2^{10}} \approx 0.001$ probability.

+",9459,,9459,,3/29/2020 10:32,3/29/2020 10:32,,,,1,,,,CC BY-SA 4.0 +11322,2,,11319,3/28/2020 18:45,,3,,"

When input state to QFT is $|00\dots0\rangle$ then no controlled gates in QFT work as each control qubit is set to $|0\rangle$. However, there are also Hadamard gates on each qubit. As a result, QFT behaves as $H^{\otimes n}$ and produces superposition consisting of all basis state with same probability $\frac{1}{2^n}$, where $n$ is number of input qubits.

+ +

For your case $n=10$, hence probability that state $|00\dots0\rangle$ is preserved after QFT application is $\frac{1}{1024}.$

+",9006,,,,,3/28/2020 18:45,,,,0,,,,CC BY-SA 4.0 +11323,1,11325,,3/29/2020 1:58,,2,217,"

The paper A Fully Fault-Tolerant Representation of Quantum Circuits uses the $P$ gate which is given as: +$$P = \begin{bmatrix}1 & 0\\0 & i\\\end{bmatrix}.$$

+ +

Nielsen and Chuang Quantum Computation and Information 10th edition uses the $S$ gate which is also given as: +$$S = \begin{bmatrix}1 & 0\\0 & i\\\end{bmatrix}.$$

+ +

Why does the same gate has different names?

+",7528,,,,,3/29/2020 6:56,S gate vs P gate?,,1,0,,,,CC BY-SA 4.0 +11324,1,11328,,3/29/2020 2:27,,2,721,"

+ +

Where are magnitude and phase of a qbit on Bloch sphere?

+ +
+

Phase is angle φ. What do you mean by magnitude? Amplitudes? They are given by angle θ - amplitude of |0⟩ is cos(θ/2) and amplitude of |1⟩ is sin(θ/2).

+
+ +

Does it means that Z axis represent magnitude/amplitudes, and X and Y represent phase?

+ +

Why do we need 2 axis (X and Y) to represent phase?

+",8491,,9006,,3/29/2020 6:50,3/29/2020 10:53,"Bloch sphere, where are magnitude and phase of a qbit?",,1,1,,,,CC BY-SA 4.0 +11325,2,,11323,3/29/2020 6:48,,3,,"

Denoting phase gate by $P$ probably comes from its name Phase

+ +

Phase gate is usually denoted by $S$ as you can see from your Nielsen and Chuang book example. Moreoer, symbol $S$ is used also on IBM Q.

+ +

To sum up, it is a matter of a paper's author decission. As I remember, I have seen phase gate denoted by $S$ only.

+",9006,,9006,,3/29/2020 6:56,3/29/2020 6:56,,,,0,,,,CC BY-SA 4.0 +11326,1,11327,,3/29/2020 8:08,,0,80,"

I was going through a Quantum Computation lecture series on YouTube given by Umesh Vazirani. There in Lecture 6.3 he talks about creating a Bell state using a Hadamard and CNOT gate. He seems to be using |0⟩ and |1⟩. Is he talking about measuring a qubit in 0-1 basis and then using the qubits that gave 0 as a result for the |0⟩. Here is an image for reference.

+",11505,,9006,,3/29/2020 8:54,3/29/2020 9:46,Creating Bell states (a question from tutorial),,1,2,,4/13/2020 16:23,,CC BY-SA 4.0 +11327,2,,11326,3/29/2020 9:46,,2,,"

There is no measurement in the picture; the picture shows how to construct 4 Bell states $|\Phi^+\rangle$, $|\Phi^-\rangle$, $|\Psi^+\rangle$ and $|\Psi^-\rangle$ using Hadamard-CNOT circuit.

+",2105,,,,,3/29/2020 9:46,,,,0,,,,CC BY-SA 4.0 +11328,2,,11324,3/29/2020 10:31,,3,,"

An arbitrary 1 qubit pure state can be represented as:

+ +

$$|\psi \rangle = \cos(\theta /2) |0\rangle + e^{i\varphi} \sin(\theta/2) |1\rangle$$

+ +

where $0 \leq \theta \leq \pi$, $0 \leq \phi < 2 \pi$. The amplitude of the $|0\rangle$ state is $\cos(\theta /2)$ and the amplitude of the $|1\rangle$ state is $e^{i\varphi} \sin(\theta/2)$. The phase of the qubit is $\varphi$ as presented in the question. The length of the vector is equal to $|\cos(\theta /2)|^2 + |e^{i\varphi}\sin(\theta /2)|^2 = 1$ (the sum of the probabilities of all measurement outcomes must equal 1). Thus, all points of the imaginary sphere (Bloch sphere) with radius 1 can be regarded as different quantum states.

+ +

$\theta$ and $\varphi$ are both angles and they need planes for defining them. Thus, we need all X, Y, Z axis. $\varphi$ is the angle defined in the XY plane and $\theta$ is the angle defined in the plane that includes Z axis and the vector that represents the quantum state in the Bloch sphere.

+",9459,,9459,,3/29/2020 10:53,3/29/2020 10:53,,,,2,,,,CC BY-SA 4.0 +11329,2,,10317,3/29/2020 10:38,,7,,"

There is actually a nice way to do this in Qiskit, since it has decompositions for single-qubit unitaries built in. The QuantumCircuit.squ method takes a unitary 2x2 matrix $U$ and a qubit and computes the decomposition

+ +

$$ +U = R_Z(\alpha) R_Y(\beta) R_Z(\gamma) +$$

+ +

This is a common decomposition, you can find a proof here https://arxiv.org/pdf/quant-ph/9503016.pdf in Lemma 4.1.

+ +

Here's how to do it in Qiskit:

+ +
import numpy as np
+from scipy.linalg import expm
+from qiskit import QuantumCircuit, QuantumRegister
+
+# define your matrix
+A = np.array([[1.5, 0.5],
+              [0.5, 1.5]])
+t = np.pi / 2
+
+# expm is a matrix exponential 
+U = expm(1j * t * A)
+
+# create a 1 qubit circuit
+q = QuantumRegister(1, name='q')
+circuit = QuantumCircuit(q)
+
+# apply a single-qubit unitary gate, this will do the decomposition
+circuit.squ(U, q[0])
+
+# print the circuit components
+print(circuit.decompose().decompose().draw())
+
+ +

This will print

+ +
        ┌──────────┐┌───────────┐┌───────────┐
+q_0: |0>┤ Rz(pi/2) ├┤ Ry(-pi/2) ├┤ Rz(-pi/2) ├
+        └──────────┘└───────────┘└───────────┘
+
+ +

So your decomposition would be +$$ +e^{iAt} = R_Z\left(\frac{\pi}{2}\right) R_Y\left(-\frac{\pi}{2}\right) R_Z\left(\frac{-\pi}{2}\right) +$$

+ +

with

+ +

$$ +R_Y(\theta) = \begin{pmatrix} +\cos(\theta / 2) & -\sin(\theta / 2) \\ +\sin(\theta / 2) & \cos(\theta / 2) +\end{pmatrix} +$$ +and +$$ +R_Z(\lambda) = \begin{pmatrix} +1 & 0 \\ +0 & e^{i\lambda} +\end{pmatrix} +$$

+ +

You can also drop the last RZ gate if you don't care about the global phase. That's also supported in Qiskit using the up_to_diagonal argument:

+ +
# apply a single-qubit unitary gate, this will do the decomposition
+circuit.squ(U, q[0], up_to_diagonal=True)
+
+# print the circuit components
+print(circuit.decompose().decompose().draw())
+
+ +

which produces

+ +
        ┌──────────┐┌───────────┐
+q_0: |0>┤ Rz(pi/2) ├┤ Ry(-pi/2) ├
+        └──────────┘└───────────┘
+
+ +

Here's the implementation in Qiskit: https://qiskit.org/documentation/_modules/qiskit/extensions/quantum_initializer/squ.html.

+",9800,,,,,3/29/2020 10:38,,,,2,,,,CC BY-SA 4.0 +11330,1,11333,,3/29/2020 13:44,,1,71,"

I’m hoping the quantum community here might weigh in with some thoughts on something that is bothering me regarding quantum entanglement…something that seems as big a disagreement in the quantum world as the Copenhagen theory, and it’s possibly directly related.

+ +

I’m of the belief that quantum entanglement is natural and unavoidable, and that any two quantum particles that “touch” or come near each other will not only entangle, but entangled the rest of their lives. I know at least a few very well-respected quantum theorists and scientists hold this view.

+ +

The opposite, seemingly far more popular side of the argument, believes that entanglement is fairly difficult to do and the entanglement bond is flimsy and easy to break. The former side believes that decoherence is simply the measurement devices getting entangled with the quantum entangled particles we are trying to follow and our inability to track/separate the additional entanglement impacts on the original tracked particles (i.e. like trying to follow a drop of colored dye dropped into an ocean).

+ +

Which side do you fall on, is entanglement easy and hard to avoid or hard to do and easily broken? +Any additional thoughts you could add would be much appreciated.

+ +

I'm thinking about writing an article on this subject and share some of the replies, so if you reply, consider that I may print it in my article.

+",8193,,,,,3/30/2020 7:56,Entanglement - Natural and Unavoidable or Difficult to Do and Flimsy?,,2,3,,4/12/2020 2:13,,CC BY-SA 4.0 +11331,1,11343,,3/29/2020 14:36,,3,132,"

I'm studying Quantum Information Theory by Mark M. Wilde, and I got stuck in solving the exercise 3.8.2 in page 100. The exercise is to show that a pure bipartite state is entangled if and only if it has more than one Schmidt coefficient. The hint below the problem says that

+ +

\begin{equation*} +\max_{|φ\rangle_A,|ψ\rangle_B} |\langleφ|_A ⊗ \langleψ|_B |ϕ\rangle_{AB}|^2 < 1 +\end{equation*}

+ +

if there is more than one Schmidt coefficient for the state $|ϕ_{AB}\rangle$. Also, the hint suggests using the Schwarz inequality. It is clear that one Schmidt coefficient implies a product state, but I cannot figure out how to show the strict inequality above. I appreciate any help.

+",11510,,55,,10/23/2020 6:47,10/23/2020 6:47,More than one Schmidt coefficient implies entanglement?,,2,0,,,,CC BY-SA 4.0 +11332,2,,11331,3/29/2020 15:55,,4,,"

I'd ignore that hint and instead try to prove the contrapositives: show that a pure state is a product state iff it has one (nonzero) Schmidt coefficient.

+",551,,,,,3/29/2020 15:55,,,,1,,,,CC BY-SA 4.0 +11333,2,,11330,3/29/2020 17:13,,6,,"

There is no contradiction. Entanglement indeed is a natural property; it is difficult to keep pure states for a long time, because they tend to interact and get entangled with environment; but it also difficult to obtain a particular entangled state, such as Bell state.

+ +

Uncontrolled entanglement is natural, controlled entanglement requires high technology, and is important for quantum computation.

+",2105,,,,,3/29/2020 17:13,,,,0,,,,CC BY-SA 4.0 +11334,1,11341,,3/29/2020 21:48,,2,45,"

The book An Introduction to Quantum Computing (section 10.4.1 Error Models for Quantum Computing) by Phillip Kaye, Raymond Laflamme and Michele Mosca states the following:

+ +
+

Errors occur on a qubit when its evolution differs from the desired one. This difference can occur due to imprecise control over the + qubits or by interaction of the qubits with an environment. By + ‘environment’, we mean everything external to the qubit under + consideration. A ‘quantum channel’ is a formal description of how + qubits in a given setting are affected by their environment.

+
+ +

I would like to know what is the environment and what are the physical characteristics that describe it.

+ +

Furthermore, does the qubit alone generate noise within itself (assuming that no noise is generated from its environment)?

+",7528,,,,,8/4/2022 10:10,What is the precise definition of the environment a qubit lives in?,,2,0,,,,CC BY-SA 4.0 +11335,1,11340,,3/29/2020 23:30,,3,418,"

The book ""Introduction to Spintronics"" 2nd edition says on page 542 that an arbitrary single qubit rotation and a CNOT comprises a universal gate set. Is this true?

+ +

If so, why isn't this the gate set implemented in commercial quantum computing implementations? The book makes them sound straight-forward to implement in the context of semiconductor quantum dot-based qubits.

+",4943,,,,,3/30/2020 7:35,"Is $R_x$, $R_y$, $R_z$, and $CNOT$ a Universal gate set?",,2,0,,,,CC BY-SA 4.0 +11336,2,,11335,3/30/2020 4:28,,3,,"

Partial answer (universality):

+ +

Set of gates consisiting of CNOT, $S$, $T$ and $H$ allows you to approximate any gate arbitrary accuracy.

+ +

CNOT is part of your set. Sice $S = R_z(\pi/2)$, $T=R_z(\pi/4)$ and $H = R_y(\pi/2)Z = R_y(\pi/2)R_z(\pi)$, your gates are universal.

+ +

Another perspective: $x$,$y$ and $z$ allow you to build any rotation of a qubit, hence any single-qubit gate. Together with CNOT you have universal set of gates.

+ +

Note: calculation above based on definition of gates on IBM Q.

+",9006,,,,,3/30/2020 4:28,,,,0,,,,CC BY-SA 4.0 +11337,1,,,3/30/2020 5:31,,3,75,"

For a particular simulation, I need the initial (physical) state of the QC to represent the equal superposition of all single-occupancy fermionic second-quantized states. In Jordan-Wigner encoding, I can simply prepare the $W_n$ state: +$$ +\begin{alignedat}{8} +&\text{Fermionic state}:\qquad&&(|1000\ldots\rangle+|0100\ldots\rangle+|0010\ldots\rangle+\ldots)/\sqrt{n}\\ +&\text{JW encoded state}:\qquad&&(|1000\ldots\rangle+|0100\ldots\rangle+|0010\ldots\rangle+\ldots)/\sqrt{n} = U_{W_n} (|0\rangle^{\otimes n}) +\end{alignedat} +$$ +How do I prepare such a state in the Bravyi-Kitaev encoding?

+ +

So far I know how to construct:

+ +
    +
  1. The BK code matrix $\beta_n$ (as defined here). For each fermionic state, it gives the corresponding qubit state.
  2. +
  3. A circuit $U_{W_n}$ implementing the $W_n$ transformation — which does the job in the case of JW encoding.
  4. +
+ +

My guess is that I should somehow implement a unitary gate which would do sort of a BK transform of the qubits...

+ +

More generally, given some superposition of the fermionic states (the one which, in the JW language, can be prepared from $|0\rangle^{\otimes n}$ by a known operator $U$), how do I construct the corresponding BK-encoded state?

+",6313,,6313,,3/30/2020 5:38,3/30/2020 5:38,"""$W_n$ state"" in Bravyi-Kitaev encoding",,0,0,,,,CC BY-SA 4.0 +11338,1,11339,,3/30/2020 5:39,,1,810,"

I implemented 2 versions of the entanglement swapping circuit in IBM Q. One is using classical measurement to control X, Z gates. Another is just us C-NOT and Controlled-Z. They should be equivalent. The 1st and 2nd bits were entangled. After teleportation of the 2nd bit to the 4th bit, I expect the 1st and the 4th bit will be entangled. I can see that when using the 2nd method. But not the case for 1st method. Did I make a mistake or there is a bug?

+ +

Method 1:

+ +

+ +

Method 2:

+ +

+",9676,,55,,7/27/2020 12:26,7/27/2020 12:26,Entanglement Swapping Circuit,,2,0,,,,CC BY-SA 4.0 +11339,2,,11338,3/30/2020 6:45,,3,,"

There is a mistake in design of the first circuit. Both $X$ and $Z$ gate work when value 1 is in classical register.

+ +

Gate $X$ should work in case qubit $q_2$ is in state $|1\rangle$. Similarly $Z$ acts when $q_1$ in state $|1\rangle$. Also you have to deal with state when both $X$ and $Z$ have to act. In your case you conditioned both $X$ and $Z$ on c==1. It means that both gates act in case $q_1$ is in state $|1\rangle$. Another mistake come from measuring qubits $q_1$ and $q_2$ in the first circuit while not to measure them in the second one (in this case they are alway zero).

+ +

Please see here QASM commented code producing results you desired:

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+qreg q[4];
+creg c[5];
+
+//teleport
+h q[0];
+h q[2];
+cx q[0],q[1];
+cx q[2],q[3];
+cx q[1],q[2];
+h q[1];
+
+//measuring q1 and q2
+//for controlled gates
+
+measure q[2] -> c[0];
+measure q[1] -> c[1];
+
+//set q1 and q2 to |0> to
+//emulate they are not measured
+reset q[1];
+reset q[2];
+
+//controlled gates
+  //q1 = |0>, q2 =|1>
+if (c==1) x q[3];
+  //q1 = |1>, q2 =|0>
+if (c==2) z q[3];
+  //q1 = |1>, q2 =|1>
+if (c==3) x q[3];
+if (c==3) z q[3];
+
+//measure qubits
+measure q[3] -> c[3];
+measure q[0] -> c[0];
+measure q[1] -> c[1];
+measure q[2] -> c[2];
+
+",9006,,,,,3/30/2020 6:45,,,,1,,,,CC BY-SA 4.0 +11340,2,,11335,3/30/2020 7:35,,5,,"
+

an arbitrary single qubit rotation and a CNOT comprises a universal gate set. Is this true?

+
+ +

Yes. If you want to understand why, don't go with any answers about finite gate sets such as CNOT, H, T because the proof of those usually relies on the proof of the set you've stated (so the whole thing becomes horribly circular). Instead, you have to make some of the constructions yourself. Nielsen & Chuang goes through this in gory detail. Basically, an arbitrary unitary you want can be decomposed in terms of Givens rotation. Each of these, up to a permutation, is basically a controlled-controlled-...-controlled-unitary. So, you need to see how to build such a step out of controlled-not and single-qubit unitaries. As an intermediate step, you'll need Toffoli, and you'll need controlled-$U$.

+ +
+

If so, why isn't this the gate set implemented in commercial quantum computing implementations?

+
+ +

In many cases, it is. Basically, the construction above tells you that you an make an arbitrary single-qubit gate using a sequence such as +$$ +R_z(\theta)R_x(\phi)R_z(\lambda). +$$ +To all intents and purposes this is the u3 command in qiskit, for example.

+ +

There is another, related question: why do people concentrate on finite gate sets such as cNOT, H and T rather than using this continuous set (which is nominally better, because you get exact implementations instead of arbitrarily accurate ones). One of the main reasons is fault-tolerance: when you want to implement error correction, you have to operate on encoded qubits. While the arbitrary rotations might be straightforward to implement at the level of single physical qubits, they're not so easy to implement on encoded qubits.

+",1837,,,,,3/30/2020 7:35,,,,2,,,,CC BY-SA 4.0 +11341,2,,11334,3/30/2020 7:48,,2,,"

The whole point of the system/environment description is that the ""system"" is the bit that you can characterise and control. The environment is the bit that you cannot characterise or control. It could be anything. Ultimately, it's the whole of the rest of the Universe. For your particular physical realisation, you might have some approximation of what the environment might be doing, but it is very much case dependent.

+ +
+

Furthermore, does the qubit alone generate noise within itself (assuming that no noise is generated from its environment)?

+
+ +

That might come down to a matter of definition. All non-unitary evolution can be described by reference to a larger system, i.e. an environment, on which the evolution is unitary. If no noise is generated from the environment, i.e. if the qubit and environment are decoupled, then the evolution of the qubit should be unitary, and there is no noise.

+ +

On the other hand, what about things like the spontaneous emission of an atom? That sounds like a qubit alone generating its own noise. I'm not an expert on this (I'm relying on Wikipedia!) but, basically, if you want to describe this using regular quantum, you have to introduce an environment (e.g. Jaynes-Cummings model). A proper description uses quantum electrodynamics, at which point you possibly could describe it as a qubit generating its own noise.

+",1837,,,,,3/30/2020 7:48,,,,0,,,,CC BY-SA 4.0 +11342,2,,11330,3/30/2020 7:56,,4,,"

I completely agree with kludg's answer. To follow it up:

+
+

entanglement is natural and unavoidable

+

the entanglement bond is flimsy and easy to break

+
+

These two things are intrinsically linked. Entanglement has a property called monogamy. If particle $A$ is entangled to both particles $B$ and $C$, the more it is entangled with $B$, the less it is entangled with $C$. So, another particle comes along and naturally interacts, acquiring a bit of entanglement (natural & unavoidable), the existing entanglement bonds are lessened (i.e. it was flimsy and easy to break).

+

There is a philosophical question that appears regarding the "breaking" of entanglement. As I've just described it, entanglement isn't broken as such, just shifted around, whereas there's this magical process of measurement that does break entanglement. Some would claim that measurement is basically just a unitary process and there isn't actually a collapse, it's just another entangling process (this is, crudely, the many-worlds interpretation). So, according to them, there would be no breaking of entanglement.

+",1837,,-1,,6/18/2020 8:31,3/30/2020 7:56,,,,0,,,,CC BY-SA 4.0 +11343,2,,11331,3/30/2020 8:16,,1,,"

You're asking how to prove +\begin{equation*} +\max_{|φ\rangle_A,|ψ\rangle_B} |\langleφ|_A ⊗ \langleψ|_B |ϕ\rangle_{AB}|^2 < 1 +\end{equation*} +as opposed to actually answering the question?

+ +

To prove this, consider the Schmidt decomposition of $|ϕ\rangle_{AB}=\sum_i\lambda_i|\phi^i_A\rangle|\phi^i_B\rangle$, and let +$$ +|\gamma_A\rangle=\sum_i\lambda_i|i\rangle \langle\varphi|\phi^i_A\rangle,\qquad |\gamma_B\rangle=\sum_i|i\rangle\langle\psi|\phi^i_B\rangle. +$$ +Note that $|\gamma_B\rangle$ has norm 1, $\langle\gamma_B|\gamma_B\rangle=1$ by the completeness relation of the orthonormal basis $|\phi^i_B\rangle$. On the other hand, $|\gamma_A\rangle$ only has norm 1 if $|\phi_{AB}\rangle$ has one Schmidt coefficient, since otherwise $\sum_i\lambda_i^2|\langle\varphi|\psi^i_A\rangle|^2<\sum_i|\langle\varphi|\psi^i_A\rangle|^2=1$.

+ +

Bringing this together for the case of more than one Schmidt coefficient, +$$ +|\langle\varphi\psi|\phi_{AB}\rangle|^2=|\langle\gamma_A|\gamma_B\rangle|^2\leq \langle\gamma_A|\gamma_A\rangle\langle\gamma_B|\gamma_B\rangle<1 +$$ +having used the Schwartz inequality.

+",1837,,,,,3/30/2020 8:16,,,,0,,,,CC BY-SA 4.0 +11344,2,,10317,3/30/2020 8:33,,4,,"

You want to implement +$$ +e^{i3\pi/4}e^{iX\pi/4}. +$$ +I would rewrite this as +$$ +e^{i3\pi/4}He^{iZ\pi/4}H. +$$ +This is the same as +$$ +-HS^\dagger H +$$ +in standard gate terminology.

+ +

If you're only implementing the gate $e^{iAt}$, then you can neglect the global phase and just implement $HS^\dagger H$. Both of these gates are readily implemented in qiskit as sdg and h. OK, you can probably implement the basic rotation directly using rx(pi/2,), but this construction is far more relevant in the following case (keeping the global phase a little nicer):

+ +

If you're wanting to use this inside something like the HHL algorithm where you actually need controlled-$e^{iAt}$, then you implement controlled-$HS^\dagger H$, and follow it up with a $Z$ gate on the control qubit in order to get the no-longer-global phase correct. Furthermore, note that something like HHL required controlled-$e^{i2^kAt}$ for various integers $k$. Well, we've done the $k=0$ case. But from the way I've written things, I think it makes it more obvious that for $k=1$, you're just doing controlled-not ($HS^\dagger HHS^\dagger H=HZH=X$). And you don't have to do anything at all for larger $k$ ($X^{2^{k-1}}=I$ for $k\geq 2$).

+",1837,,,,,3/30/2020 8:33,,,,0,,,,CC BY-SA 4.0 +11345,2,,11319,3/30/2020 8:37,,3,,"

The unitary matrix of the Fourier transform is +$$ +U_{QFT}=\frac{1}{\sqrt{2^n}}\sum_{x,y=0}^{2^n-1}e^{2\pi i\frac{xy}{2^n}}|y\rangle\langle x|. +$$ +So, if I apply this to the input state $|0\rangle$, I get the answer +$$ +U_{QFT}|0\rangle=\frac{1}{\sqrt{2^n}}\sum_{y=0}^{2^n-1}|y\rangle. +$$ +The amplitude for finding the system is state $y=0$ is $1/\sqrt{2^n}$. Hence the probability of this outcome is $1/2^n$ with $n=10$, so the probability is $1/1024$.

+",1837,,,,,3/30/2020 8:37,,,,0,,,,CC BY-SA 4.0 +11346,2,,10294,3/30/2020 13:30,,2,,"
+

Can someone provide an example of a state $\rho_{AB}$ for which $\sigma^\star_B \neq \rho_B$?

+
+ +

Why not start very easily, with a separable state such as +$$ +\rho_{AB}=\left(p_0|0\rangle\langle 0|\otimes \tau_0+p_1|1\rangle\langle 1|\otimes \tau_1\right) +$$ +where $\tau_0$ and $\tau_1$ are different (normalised) single-qubit density matrices. We have that +$$ +I=\min_{\sigma_B}\log\min_{\lambda}\left\{\lambda:p_0|0\rangle\langle 0|\otimes (\lambda\sigma-\tau_0)+p_1|1\rangle\langle 1|\otimes (\lambda\sigma-\tau_1)\geq 0\right\} +$$ +Now, by construction, this devolves into two separate questions: pick the common $\lambda$ and $\sigma$ such that both $\lambda\sigma-\tau_i$ are positive semi-definite. However, this is entirely independent of the $p_i$. Hence, the answer must be independent of the $p_i$. By comparison, $\rho_B$ depends on the $p_i$. Thus, unless the answer is highly degenerate (allowing for all possible linear combinations of the $\tau_i$), it cannot be that $\sigma=\rho_B$.

+ +

For example, if $\tau_0$ and $\tau_1$ are orthogonal, the best choice must be $\sigma=(\tau_0+\tau_1)/2$ with $\lambda=2$. This is certainly not $\rho_B$ for any $p_0\neq 1/2$.

+ +
+

Is it true that $D_{\max}(\rho_{B}||\sigma^\star_B) \leq D_{\max}(\rho_{B}||\sigma_B)$ for all $\sigma_B$ i.e. is the $D_{\max}$ minimizing state preserved under a partial trace?

+
+ +

This cannot be true, right? $D_\max(\rho_B\|\rho_B)=0$. So in any case where $\sigma^\star\neq \rho_B$, $D_\max(\rho_B\|\sigma^\star)>D_\max(\rho_B\|\rho_B)$. We know, for example, that $\lambda\geq 1$ because $\text{Tr}(\lambda\sigma-\rho)=\lambda-1$, and if $\lambda\sigma-\rho$ is going to be non-negative, then the total of the eigenvalues must be non-negative.

+",1837,,,,,3/30/2020 13:30,,,,0,,,,CC BY-SA 4.0 +11347,1,,,3/30/2020 14:07,,3,595,"

I'm trying to understand the quantum monte-carlo algorithm starting at the most basic version. A key step is rotating (Algorithm 1 p.g 8), an ancilla bit by rotation $R$ with respect to the value of a function $f(x)$ where $x$ is a bit string encoded in $|x\rangle$, such that:

+ +

$R|x\rangle|0\rangle = \sum_{x} |x\rangle(\sqrt{1-f(x)}|0\rangle + \sqrt{f(x)}|1\rangle) $

+ +

Starting with the simple function $f(x) \rightarrow y $, where $x \in \{0,1\}^k$ and $y \in [0,1]$, i.e $f(x)$ maps the bit string to its corresponding fractional number, I am trying to find the rotation $R$.

+ +

Initially I was thinking along the lines of using a controlled rotation for each bit $k$ such that $R_y^k|0 \rangle \rightarrow (\sqrt{1-\frac{1}{2^k}}|0\rangle + \sqrt{\frac{1}{2^k}}|1\rangle) $ however the issue here is that successive rotations aren't additive, so for example the the encoding the bit string $|x \rangle = \{1,1\} $:

+ +

$f(\{1,1\}) \rightarrow 0.75$,

+ +

the controlled rotations from the first and second bit would be

+ +

$R_y^1R_y^2|0 \rangle \neq (\sqrt{1-f(x)}|0\rangle + \sqrt{f(x)}|1\rangle)$ .

+ +

which is due to the nonlinearity of $\arccos$

+ +

$\arccos(\sqrt{0.5}) + \arccos(\sqrt{0.25}) \neq \arccos(\sqrt{0.75})$

+ +

The other approach is to have a controlled rotation for each permutation in $\{0,1\}^k$ however this results gates $O(2^K)$ .

+ +

For this simple $f(x)$ what is the best way to derive the circuit for rotation $R$ controlled by $|x \rangle$ and if there is a circuit that only involves $O(K)$ gates.

+ +

Thanks!

+ +

---- Current ideas ----

+ +

1) Linear approximation of $\arccos$ for sufficiently small $a,b$ we can apply a linear correction term to approximate

+ +

$\arccos(a) + \arccos(b) = \arccos(a+b) - \frac{\pi}{2}$

+ +

Generalising this for a $K$ bit system $\{i_1,i_2, \dots i_K\} $ the correction is $-\frac{\pi}{2}(1-\sum_ki_k)$.

+ +

In this case instead of $f(x) \rightarrow y $ it is required that $f(x) \rightarrow \sqrt{y} $, and assuming the linear approximation $O(K)$ rotations are required to map binary representation of $\sqrt{y}$ to the ancilla state

+ +

2) Be lazy and implement a qgan neural network that approximates the rotations. Given a $K$ bit system this only requires $2^K$ training values.

+",6139,,6139,,3/30/2020 19:14,8/20/2021 15:22,Rotations to encode $f(x)$ into ancilla qubit for quantum Monte Carlo,,2,12,,,,CC BY-SA 4.0 +11348,2,,11347,3/30/2020 14:27,,1,,"

Please have a look at article Transformation of quantum states using uniformly controlled rotations, chapters 1 and 2. These provides you with construction of general rotation gate controlled by $n$ qubits with different rotations angles for each basis state $|x\rangle$.

+ +

You also might be interested in some of these articles on quantum computers application in finance. There are a few articles on Monte Carlo.

+",9006,,,,,3/30/2020 14:27,,,,3,,,,CC BY-SA 4.0 +11349,1,11350,,3/30/2020 15:27,,4,672,"

As the title states.

+ +

I am a Machine Learning Engineer with a background in physics & engineering (post-secondary degrees). I am reading the Tensorflow Quantum paper. They say the following within the paper:

+ +
+

One key observation that has led to + the application of quantum computers to machine learning is their ability to perform fast linear algebra on a + state space that grows exponentially with the number of + qubits. These quantum accelerated linear-algebra based + techniques for machine learning can be considered the + first generation of quantum machine learning (QML) algorithms tackling a wide range of applications in both supervised and unsupervised learning, including principal + component analysis, support vector machines, kmeans clustering, and recommendation systems. + These algorithms often admit exponentially faster solutions compared to their classical counterparts on certain + types of quantum data. This has led to a significant + surge of interest in the subject. However, to apply + these algorithms to classical data, the data must first + be embedded into quantum states, a process whose + scalability is under debate.

+
+ +

What is meant by this sentence However, to apply these algorithms to classical data, the data must first be embedded into quantum states?

+ +

Are there resources that explain this procedure? Any documentation or links to additional readings would be greatly appreciated as well.

+ +

Thanks in advance!

+ +

Note: I did look at this previous question for reference. It helped. But if anyone can provide more clarity from a more foundational first principles view (ELI5 almost), I would be appreciative

+ + +",11517,,55,,3/31/2020 10:34,10/16/2020 21:29,What exactly does it mean to embed classical data into a quantum state?,,2,1,,,,CC BY-SA 4.0 +11350,2,,11349,3/30/2020 17:51,,8,,"

First it is instructive to ask oneself: ""how does classical data get into my computer?"" In a classical computer, your data is always stored in bits. Because calculations in base 2 are not very straightforward for most people there are abstractions like int types for integers and float types for rational numbers with the associated math operations readily abstracted for the user -- which means that you can easily add, multiply, divide and so on.

+ +

Now, on a quantum computer you run into a fundamental problem: Qubits are really expensive. When I say really expensive, this does not only mean that building a quantum computer costs a fortune, but also that in current applications you only have a handful of them (Google's quantum advantage experiment used a device with 53 qubits) -- which means that you have to economize your use of them. In machine learning applications you usually use single precision floating point numbers, which use 32 bits. This means a single ""quantum float"" would also need 32 qubits, which means that state of the art quantum computers can't even be used to add two floating point numbers together due to the lack of qubits.

+ +

But you can still do useful stuff with qubits, and this is because they have additional degrees of freedom! One particular thing is that you can encode an angle (which is a real parameter) bijectively into a single qubit by putting it into the relative phase +$$ +| \theta \rangle = \frac{1}{\sqrt{2}}(|0\rangle + \mathrm{e}^{i\theta} |1\rangle) +$$

+ +

And this is the heart of embedding data into quantum states. You simply can't do the same thing you would be doing on a classical computer due to a lack of sufficient qubit numbers and therefore you have to get creative and use the degrees of freedom of qubits to get your data into the quantum computer. To learn more about very basic embeddings, you should have a look at this paper. One particular example I want to highlight is the so-called ""amplitude embedding"" where you map the entries of a vector $\boldsymbol{x}$ into the different amplitudes of a quantum state +$$ +| \boldsymbol{x} \rangle \propto \sum_i x_i | i \rangle +$$ +There is no equals sign because the state needs to be normalized, but for the understanding this is not important. The special thing about this particular embedding is that it embeds a vector with $d$ elements into $\log_2 d$ qubits which is a nice feature in our world where qubits are expensive!

+",10250,,,,,3/30/2020 17:51,,,,0,,,,CC BY-SA 4.0 +11351,1,,,3/30/2020 20:36,,1,49,"

TL;DR: Is it known that QRAC where the ""question"" is random instead of chosen are impossible? More generally what are the methods to prove impossibility games?

+ +

I often face problems for which I want to prove that they are not solvable. Either with probability 1 (like here), but more generally I'm interested on how to find some upper bound (optimal if possible) of these problems.

+ +

As an example, let's consider the following game: I prepare a $|+_\theta \rangle$ with $\theta$ a multiple of $\frac{\pi}{2}$, and the goal is to output $D \in S$, with $S = \{\{0,\frac{\pi}{2}\},\{0,\frac{3\pi}{2}\},\{\pi,\frac{\pi}{2}\},\{\pi,\frac{3\pi}{2}\} \}$, such that $\theta \in D$.

+ +

I'd like now to see the different methods to prove that it's not possible to win this game with probability 1, or, even better, I'd like to find an upper bound, or, even better, prove the optimality.

+ +

So far, I have two methods, but they are not really perfect:

+ +
    +
  • the first method is to write a semi-definite program (SDP), where we write each possible output as a 2x2 POVM $\{E_0, E_1, E_2, E_3\}$, and then we solve agains the constraint that the $E_i$ are positive, sum to 1, and we try to maximize the success probability (which is basically a sum of projections on these POVM). Feeding that into a SDP solver program, we can prove that the optimal probability of success is about $0.85$. The advantage of this method is that if the SDP program is nice, we have optimal bound. The problem is that we need to trust a computer.
  • +
  • another method would be, again, to write the above POVM, and manually try to find some contradiction if the probability of success is equal to 1. The advantage is that we have a proof ""on the paper"". The problem here is that it can be a bit tedious and long to write, and harder to ""automatize"", and it does not prove optimal bounds, just upper bound, or maybe simply impossibility.
  • +
+ +

Then, I tried to look at the Holevo bound, but it seems that I can't find anything interesting, because from $D$ I can extract at most one bit about $\theta$.

+ +

Talking about bounds, I was thinking also to use the Nayak's bound. Unfortunately, this game does not really encode a traditional QRAC (or it's not obvious to me), but it does encode a QRAC where the question asked by Bob is random. Indeed, if we encode a two bit string $m$ such that $00$ is encoded with $|+_0\rangle$, $01$ with $|+_{\pi/2}\rangle$, $11$ with $|+_{\pi}\rangle$ and $10$ with $|+_{3\pi/2}\rangle$, then if we know $D$ we can know for sure one bit of $m$, but we cannot say in advance ""give me the $n$'th bit.

+ +

So here is my question:

+ +

1) is it known that ""randomized"" QRAC are impossible? +2) is there some other bound that could be useful to prove imposibility results?

+ +

Thanks!

+",5969,,5969,,3/31/2020 7:47,3/31/2020 7:47,"Impossibility of QRAC with random question, or more general proof of impossibility",,0,0,,,,CC BY-SA 4.0 +11352,1,,,3/31/2020 5:35,,2,92,"

Hello and sorry if the question is too layman's here. I haven't found an answer when googling.

+ +

I am a programmer with some video encoding background, so I know how much energy is ""wasted"" on encoding. Especially with the 2020's situation when a lot of people are working from home, being on video calls all the time, world's encoding has dramatically increased.

+ +

There's the new H.265 encoder, which does quite a lot of optimizations, but many of them need to search through a lot of possibilities on how to describe objects moving in a scene - direction, light changes, color changes, size changes, ...

+ +

Intuitively, this seems like an ideal application of quantum computing, which, as far as I have read, is good for parallel searching for optimal solution of rather non-discrete problems.

+ +

Is that a correct assumption? Is there any progress in that direction? Or is it still too early to apply the current state of the art to such problems?

+",11522,,11522,,4/1/2020 22:46,4/1/2020 22:46,Is quantum computing apropriate for video encoding?,,0,1,,,,CC BY-SA 4.0 +11353,2,,11338,3/31/2020 6:09,,1,,"

Thanks to Martin Vesely! Now I modify method 1 by using the correct c values. I think I got the right answer. My goal is to see the 1st bit entangled with the 4th bit. As can be seen below, 1st and 4th bits always have the same values. So they are entangled.

+ +

+",9676,,,,,3/31/2020 6:09,,,,1,,,,CC BY-SA 4.0 +11354,1,11355,,3/31/2020 7:41,,5,1093,"

Question1. If there is a state $|\phi\rangle=\frac{1}{\sqrt{2}}(|0\rangle+e^{i\theta}|1\rangle)$, and I want to know the angle $\theta$. What kind of measurement should I do? Could somebody give me the quantum circuit?

+ +

Question2. How to perform a measurement with base $M{{({{\theta }_{k}})}_{\pm }}=\left\{ 1/\sqrt{2}\left( |0\rangle \pm {{e}^{-i{{\theta }_{k}}}}|1\rangle \right) \right\}$ on IBMQ?

+",11523,,9459,,7/26/2020 19:10,7/30/2020 9:48,"Given a state $|\phi\rangle=\frac{1}{\sqrt{2}}(|0\rangle+e^{i\theta}|1\rangle)$, how do I know the angle $\theta$?",,2,7,,,,CC BY-SA 4.0 +11355,2,,11354,3/31/2020 8:53,,5,,"

Answer to the first question:

+

As mentioned in the comments of the question I assume that we can prepare $|\phi \rangle$ as many as we want. Let's calculate the relative phase for this one qubit pure state:

+

$$|\psi \rangle = \frac{1}{\sqrt{2}} \left( |0\rangle + e^{i\theta}|1\rangle\right)$$

+

We are going to execute $2$ different experiments in order to estimate $\theta$. In the first experiment we apply this circuit:

+
circuit_experiment_1.h(q[0])
+circuit_experiment_1.measure(q[0], c[0])
+
+

The state after Hadamard gate:

+

$$H \frac{1}{\sqrt{2}} \left( |0\rangle + e^{i\theta}|1\rangle\right) = \frac{1}{2}\left[(1 + e^{i\theta})| 0 \rangle + (1 - e^{i\theta})| 1 \rangle \right]$$

+

The probabilities of $|0\rangle$ and $|1\rangle$ states:

+

\begin{align*} +P(0) = \frac{1}{4}\left| 1 + e^{i\theta} \right|^2 = \frac{1}{2}(1 + \cos(\theta)) +\\ +P(1) = \frac{1}{4}\left| 1 - e^{i\theta} \right|^2 = \frac{1}{2}(1 - \cos(\theta)) +\end{align*}

+

From here we can see that:

+

$$\theta = \pm \arccos\big(P(0) - P(1)\big)$$

+

because the range of usual principal value arccosine function is equal to $[0, \pi]$. So we will need the second experiment in order to estimate the $sign(\theta)$. But, before that, how to find $P(0)$ and $P(1)$ with the described experiment? We will need to execute the circuit $N$ times (bigger $N$ gives better precision) and take into accout these relations between measurement outcomes and probabilities:

+

\begin{align*} +P(0) = \lim_{N \rightarrow \infty} \frac{N_{0}}{N} +\qquad +P(1) = \lim_{N \rightarrow \infty} \frac{N_{1}}{N} +\end{align*}

+

where $N_{0}$ is the number of $|0\rangle$ measurement outcomes and $N_{1}$ is the number of $|1\rangle$ measurement outcomes. Also, note that:

+

$$\langle X \rangle = \langle \psi | X | \psi \rangle = \langle \psi |H Z H| \psi \rangle = P(0) - P(1)$$

+

So, the formula can be written in this way:

+

$$\theta = \pm \arccos \big( \langle X \rangle \big)$$

+

The sign of the $\theta$

+

Now we should determine the $sign(\theta)$ with this circuit:

+
circuit_experiment_2.sdg(q[0])
+circuit_experiment_2.h(q[0])
+circuit_experiment_2.measure(q[0], c[0])
+
+

The state after applying $S^{\dagger}$ and $H$ gates:

+

$$H S^{\dagger} \frac{1}{\sqrt{2}} \left( |0\rangle + e^{i\theta}|1\rangle\right) = \frac{1}{2}\left[(1 - i e^{i\theta})| 0 \rangle + (1 + i e^{i\theta})| 1 \rangle \right]$$

+

with the same logic:

+

\begin{align*} +P'(0) = \frac{1}{4}\left| 1 - ie^{i\theta} \right|^2 = \frac{1}{2}(1 + \sin(\theta)) +\\ +P'(1) = \frac{1}{4}\left| 1 + ie^{i\theta} \right|^2 = \frac{1}{2}(1 - \sin(\theta)) +\end{align*}

+

So after determining the $P'(0)$ and $P'(1)$ from the second experiment we will find the sign of the $\theta$:

+

$$sign(\theta) = sign(\arcsin\left(P'(0) - P'(1)\right)) = sign(P'(0) - P'(1))$$

+

because the range of usual principal value of arcsine function is $[-\frac{\pi}{2}, \frac{\pi}{2}]$.

+

Also, note that for the expectation value of the $Y$ operator (as can be seen from this answer) we have this relation:

+

$$\langle Y \rangle = \langle \psi| Y | \psi\rangle = \langle \psi| S H Z H S^{\dagger} | \psi\rangle = P'(0) - P'(1)$$

+

By taking this into account and combining two results:

+

\begin{align*} +\theta = sign \big(\langle Y \rangle \big) \arccos \big(\langle X \rangle \big) +\end{align*}

+

An approach for finding the relative phase of an arbitrary pure state is described in this answer.

+

Answer to the second question:

+

Here is the circuit for measuring in $M{{({{\theta }_{k}})}_{\pm }}=\left\{ 1/\sqrt{2}\left( |0\rangle \pm {{e}^{-i{{\theta }_{k}}}}|1\rangle \right) \right\}$ basis. I assume here that $\theta_k$ is given:

+
circuit.u1(theta_k, q[0])    # q[0] is one of the qubits
+circuit.h(q[0])
+circuit.measure(q[0], c[0])   #c[0] is a classical bit
+
+

If the state was $M(\theta _k)_+= 1/\sqrt{2}\left( |0\rangle + e^{-i\theta _k}|1\rangle \right)$, then the outcome of the circuit will be $|0\rangle$, and if it was $M(\theta _k)_-= 1/\sqrt{2}\left( |0\rangle - e^{-i\theta _k}|1\rangle \right)$, then the outcome of the circuit will be $|1\rangle$. So this way we will be able to measure in $M{{({{\theta }_{k}})}_{\pm }}$ basis.

+",9459,,9459,,7/30/2020 9:48,7/30/2020 9:48,,,,6,,,,CC BY-SA 4.0 +11356,2,,11354,3/31/2020 10:23,,3,,"

I would just like to share a code for testing a phase measurement on IBM Q:

+
OPENQASM 2.0;
+include "qelib1.inc";
+
+qreg q[1];
+creg c[1];
+
+//measuring theta in
+//(|0> + |1>*exp(i*theta))
+
+h q[0]; //(|0> + |1>)
+t q[0]; //(|0> + |1>*exp(i*pi/4))
+//s q[0]; //(|0> + |1>*exp(i*pi/2))
+//u1 (pi/8) q[0]; //(|0> + |1>*exp(i*pi/8))
+
+h q[0]; //measurment in Hadamard basis
+
+measure q[0] -> c[0];
+
+

Tested on IBM Q Armonk (1 qubit processor).

+
+

EDIT (based on Davit comment): +To infer a sign of the phase, a measurement in circular basis (i.e. adding $S^\dagger$ gate before Hadamard gate) has to be done as well. Combining results from measurement in Hadamard basis and circular basis gives complete knowledge about the phase.

+",9006,,9459,,7/30/2020 9:18,7/30/2020 9:18,,,,10,,,,CC BY-SA 4.0 +11357,1,11358,,3/31/2020 10:27,,2,130,"

I am implementing a quantum circuit in Qiskit. I create the equal superposition state +$$ +-|00\rangle + |01\rangle + |10\rangle +|11\rangle +$$ +but I want to obtain the quantum state +$$ +|00\rangle - |01\rangle - |10\rangle -|11\rangle . +$$

+ +

In general, when I have $n$ qubits, I want to put a -1 coefficient in front of every state except $|0\rangle^{\otimes n}$. This transformation corresponds to $-I$ matrix. Which gate(s) should I apply to my circuit to have this transformation?

+",7986,,9006,,3/31/2020 17:58,3/31/2020 17:58,Gate corresponding to $-I$,,1,0,,,,CC BY-SA 4.0 +11358,2,,11357,3/31/2020 10:57,,4,,"

Your states differ in global phase only, hence they are indistinguishable (or in other words they are equivalent). Therefore you do not need to apply gate $-I$.

+ +

Note that the global phase is $\pi$ as $-1 = \mathrm{e}^{i\pi}$

+ +
+ +

However, in case the state is produced by controlled gate, global phase cannot be neglected. In that case you can implement controlled $-I$ as $Z \otimes I$, i.e. $Z$ gate is applied on controlling qubit and identity gates on controlled qubits.

+ +

Just to show that $Z \otimes I$ is controlled global phase $\pi$ (or in other words controlled gate $-I$):

+ +

$$ +C(-I) = \begin{pmatrix} I & O \\ O & -I \end{pmatrix} = +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & -1 & 0 \\ +0 & 0 & 0 & -1 \\ +\end{pmatrix}= +\begin{pmatrix}1 & 0 \\ 0 & -1\end{pmatrix} +\otimes +\begin{pmatrix}1 & 0 \\ 0 & 1\end{pmatrix}= +Z \otimes I +$$

+",9006,,9006,,3/31/2020 11:03,3/31/2020 11:03,,,,0,,,,CC BY-SA 4.0 +11360,1,,,3/31/2020 16:37,,6,245,"

I am aware of Oxford's Quantum Foundations mailing list that regularly advertises conferences and openings for academic positions related to quantum theory. What are other mailing lists that advertise stuff like this in the area of quantum computing?

+ +

For the interested: you can subscribe to the Quantum Foundations list by sending an email to quantum-foundations-subscribe@maillist.ox.ac.uk

+ +

Also, this question seems to be related: Resources to keep a track on open Ph.D. positions in specific sub-fields/topics of quantum computing

+",5998,,55,,5/2/2022 16:46,5/5/2022 11:38,What are mailing lists that advertise conferences and academic positions in the area of quantum computing?,,2,0,,,,CC BY-SA 4.0 +11361,1,11365,,3/31/2020 17:18,,3,102,"

My main goal is to learn Quantum annealing and quantum optimization in general. This concept is elaborated in this paper. A better example is this paper. I am particularly interested in reading material where the author describes in detail without skipping any step as to how one maps the cost function of your desired optimization problem into a Hamiltonian that can then be solved using a quantum computer.

+ +

Most papers that do this, such as the ones I just showed, either assume you already know how to do the mapping and skip the mathematical steps, or will assume you are more interested in the stuff from physics pov and hardware pov. I am interested in this problem only from the algorithmic pov. I want to read tutorial style papers written for engineers interested more in the combinatorial maths and equation manipulation stuff laid out in a detailed manner.

+ +

Could you please cite videos/books/papers? If there is prereq to learn mapping costs functions to Hamiltonians then please suggest the quickest possible route for the same?

+",11528,,5955,,3/31/2020 19:28,4/1/2020 6:43,Best route to learn quantum annealing as a beginner,,1,0,,,,CC BY-SA 4.0 +11363,1,11364,,3/31/2020 21:07,,2,159,"

I was reading a wonderful lecture from John Wright on Grover's algorithm. In section 2.3, he makes some simplifications :

+
+

Lastly, we are also going to assume that the data is labeled as $n$-bit boolean strings in $\{0,1\}^n$ rather than being indexed from 1 to $N$

+
+

This is the part that I have trouble understanding. Does that mean that every item in the list is labeled with a binary number ? Or is it something else, because the black box function is said to do this : $$f:\{0,1\}^n \rightarrow \{0,1\}$$ +Which means it either outputs 0 or 1. But then I can't understand the first part. Could someone please explain this to me ?

+

Edit : thanks for all the answers, I will just explain what I didn't understand. Basically, putting a set to a power of $n$ means that you apply the Cartesian product $n$ times. In this case $\{0,1\}^n$ means all the different combinations of bits you can do of size $n$.

+",8746,,15775,,9/5/2021 4:02,9/5/2021 16:33,Need some explanation about a notation in Grover's algorithm,,3,0,,,,CC BY-SA 4.0 +11364,2,,11363,3/31/2020 21:31,,1,,"

A black box function (or so-called oracle) in Grovers algrorithm produces state $|1\rangle$ when an input fulfil some requirements imposed on it (searching conditions). This means that such input is marked.

+ +

Rest of the algorithm increase probability of this input. As a result you have significantly higher probability of this input in comparison with others and this one is that you looked for.

+ +

Regarding your question on labeling. Yes, each input is labeled with binary number as the black box is a logical function. Switching from indexes 1 to $N$ (or rather 0 to $N-1$) to binary number is straighforward as any decimal number can be expressed as a binary string (see here).

+",9006,,,,,3/31/2020 21:31,,,,1,,,,CC BY-SA 4.0 +11365,2,,11361,4/1/2020 6:43,,1,,"

I would recommend the following resources. Quantum annealing is about QUBO/Ising formulations. First thing would be to get familiar with the formulations, and see examples of how do you formulate a few problems:

+ + + +

Then, if you have a specific problem you would like to solve, search for articles related the problem with quantum annealing. Generally, they is always a section on how to formulate as a QUBO/Ising. +Finally, for quantum annealing, the best resource is the D-Wave documentation. They explain many concepts very well, in a logical order.

+",4127,,,,,4/1/2020 6:43,,,,0,,,,CC BY-SA 4.0 +11366,1,11367,,4/1/2020 7:48,,2,1157,"

I'm trying to solve 2 linear equations with the help of HHL algorithm. I've taken $A=\begin{pmatrix} +1.5 & 0.5\\ +0.5 & 1.5\\ +\end{pmatrix}$ and $b=\begin{pmatrix} +1\\ +0\\ +\end{pmatrix}$. I've implemented the circuit here, on quirk.

+ +

Question

+ +

How do I get expectation value of Pauli matrices in the above circuit?

+",10368,,,,,4/1/2020 9:14,"Quantum circuit to get expectation values of Pauli matrices, given state $|\psi\rangle$",,1,2,,,,CC BY-SA 4.0 +11367,2,,11366,4/1/2020 9:14,,4,,"

To find the expectation value of a given Pauli matrix, you just measure in the basis defined by the Pauli matrix. For example, to evaluate the expectation value of the $X$ matrix, you find the basis vectors of the $X$ matrix. These are $|+\rangle$ and $|-\rangle$, with corresponding eigenvalues +1 and -1. You measure in the $|\pm\rangle$ basis many times and find the probability of getting either result, $p_\pm$. Then, finally, the expectation value is $p_+-p_-$ (the numbers multiplying the $p_{\pm}$ terms correspond to the eigenvalues).

+",1837,,,,,4/1/2020 9:14,,,,0,,,,CC BY-SA 4.0 +11368,2,,11363,4/1/2020 11:13,,2,,"

According to this link's definition, $\{0,1\}^n$ is set of all bit strings of length n (all bit strings from $00...0$ to $11...1$). How I understand, the mentioned $f$ function takes an input bit string from $\{0,1\}^n$ set and returns an output bit string from $\{0,1\}^1 = \{0,1\}$ set ($0$ or $1$).

+",9459,,9459,,4/1/2020 13:53,4/1/2020 13:53,,,,0,,,,CC BY-SA 4.0 +11369,1,11371,,4/1/2020 12:00,,1,199,"

I am trying to construct an oracle which should accept 10 or 01 (i.e. $|1\rangle$ should be returned for these input). In the below picture the oracle is between the barrier and after the barrier we have Grover. But something is wrong. After the measurement I get as a result {'10': 260, '01': 248, '00': 274, '11': 242}.

+ +

+",11538,,22385,,11/8/2022 18:58,11/8/2022 18:58,Construct a oracle for XOR,,1,0,,,,CC BY-SA 4.0 +11370,1,,,4/1/2020 12:43,,4,1670,"

I am a newbie to quantum machine learning. I am trying to build a quantum neural network (QNN). What I studied so far about QNN is that input would be qubits and hidden layer parameter can be set using rotation gates. Since we have limited qubits to use as in IBMQ (we can use 5 qubits only), I am unable to understand how the data set is inputed to our quantum circuit (QNN). If anyone can please guide me with that, would be great.

+ +

Thanks

+",11539,,55,,10/23/2020 6:47,10/23/2020 6:47,How is data encoded in a quantum neural network?,,1,2,,,,CC BY-SA 4.0 +11371,2,,11369,4/1/2020 13:27,,1,,"

I tried to simulate on IBM Q. I realized that input states $|01\rangle$ and $|10\rangle$ have oposite phase in comparison with others. This is desired behavior of the algorithm because these states have to be marked. Phase of other two states is intact. Because two states are marked and two do not, average amplitude is zero. When you rotate amplitudes around average (the zero), two states have amplitude say $a$ and two $-a$. When you calculate probabilites based on the amplitudes, you get same probabilities for all input states because $a^2 = (-a)^2$.

+ +

However, if you mark only one state, for example $|11\rangle$ (e.g. Toffoli gate is the oracle), the algorithm behave as desired since average of amplitudes after marking $|11\rangle$ is not zero.

+",9006,,,,,4/1/2020 13:27,,,,0,,,,CC BY-SA 4.0 +11372,1,11378,,4/1/2020 18:20,,2,214,"

In multiples papers or online article on the QAOA algorithm (such as this one), I found notation for the Hamiltonian similar to this one :

+ +

$$ \sum_{ij} \frac{1}{2} (I-\sigma_i^z \sigma_j^z)$$

+ +

I don't know how to interpret the notation $\sigma_j^z$. I guess it has something to do with the Pauli matrix $\sigma_z$ but that's all I can understand.

+",10065,,55,,4/2/2020 12:48,4/2/2020 12:48,What does the notation $\sigma_j^z$ mean for Pauli matrices?,,1,0,,,,CC BY-SA 4.0 +11373,2,,5567,4/1/2020 18:58,,22,,"

An approach for Hamiltonian simulation:

+

Any Hermitian (Hamiltonian) matrix $H$ can be decomposed by the sum of Pauli products with real coefficients (see this thread). An example of 3 qubit Hamiltonian:

+

$$H = 11 \sigma_z \otimes \sigma_z + 7 \sigma_z \otimes \sigma_x - 5\sigma_z \otimes \sigma_x \otimes \sigma_y$$

+

The final circuit for $e^{iHt}$ can be simulated via Trotter decomposition (chapter 4.1 from the paper [1]):

+

$$e^{iHt} \approx \big(\prod_k e^{i c_k P_k t/N }\big)^{N}$$

+

where $t$ is a parameter that can have either positive or negative values, $P_k$ are the Pauli terms, $c_k$ are the coefficients of the corresponding $P_k$s, $H = \sum_k c_k P_k$, $N$ is the Trotter number. By increasing $N$ it is possible to decrease the error of the Trotter decomposition as much as desired [1]. If all $P_k$ Pauli terms are commuting to each other, then we can take $N = 1$ (no Trotter decomposition is needed). For this simulation, we need to know how to simulate individual Pauli products $e^{iP_k t}$. Let's start with the simplest one $e^{i \sigma_z \otimes \sigma_z \otimes ... \otimes \sigma_z t}$ (chapter 4.2 of the paper [1]). Here is the circuit for $e^{i \sigma_z \otimes \sigma_z t}$ from the paper [1]

+

                                                      +

+

Here $R_z$'s argument is $-2t$ ($R_z(-2t) = e^{i\sigma_z t}$). Before showing why this is true let's introduce 2 formulas that we will us. 4.2 exercise from the textbook [2]: Let $t$ be a real number and $A$ a matrix such that $A^2 = I$. Then

+

$$e^{iA t} = \cos(t) I + i \sin(t) A$$

+

For all Pauli terms, this $P_k^2 =I$ is true. So we can use this formula. For CNOT gate we have:

+

$$\mathrm{CNOT} = |0\rangle \langle 0 | \otimes I + |1\rangle \langle 1 | \otimes \sigma_x$$

+

By taking these formulas into account let's show that the circuit implements the $e^{i \sigma_z \otimes \sigma_z t}$ Pauli term:

+

\begin{align*} +e^{i \sigma_z \otimes \sigma_z t} = \cos(t) I + i \sin(t) \sigma_z \otimes \sigma_z +\end{align*}

+

The circuit:

+

\begin{align*} +&\mathrm{CNOT} \left(I \otimes e^{i \sigma_z t}\right) \mathrm{CNOT}= +\big[|0\rangle \langle 0 | \otimes I + |1\rangle \langle 1 | \otimes \sigma_x \big] \\ +&\big[ \cos(t) I\otimes I + i \sin(t) I \otimes \sigma_z \big] +\big[|0\rangle \langle 0 | \otimes I + |1\rangle \langle 1 | \otimes \sigma_x \big] = \\ +&= \cos(t) I + i \sin(t) \sigma_z \otimes \sigma_z +\end{align*}

+

So, the circuit implements what we want:

+

$$ +e^{i \sigma_z \otimes \sigma_z t} =\mathrm{CNOT} \left(I \otimes e^{i \sigma_z t}\right) \mathrm{CNOT} +$$

+

The circuit for the $e^{i \sigma_z \otimes \sigma_z \otimes \sigma_z t}$ Pauli term from the same paper [1]:

+

                                               +

+

This also can be shown the same way. Moreover, this solution can be generalized for $e^{i \sigma_z \otimes \sigma_z \otimes ... \otimes \sigma_z t}$ Pauli term.

+

Now, what if we have one $\sigma_x$ in the tensor product $P = P_1 \otimes \sigma_x^{(n)} \otimes P_2$, where $P_1$ and $P_2$ are also Pauli products, $n$ is the qubit number. Note that:

+

\begin{align*} +e^{iP_1 \otimes \sigma_x^{(n)} \otimes P_2t} &= \cos(t) I + i \sin(t) P_1 \otimes \sigma_x^{(n)} \otimes P_2 = \\ +&= \cos(t) I + i \sin(t) P_1 \otimes \left(H \sigma_z^{(n)} H\right) \otimes P_2 = \\ +&= H^{(n)} e^{iP_1 \otimes \sigma_z^{(n)} \otimes P_2t} H^{(n)} +\end{align*}

+

where $H^{(n)}$ is the Hadamard gate acting on $n$th qubit. The same can be shown for $\sigma_y$:

+

\begin{align*} +e^{iP_1 \otimes \sigma_y^{(n)} \otimes P_2t} = H_y^{(n)} e^{iP_1 \otimes \sigma_z^{(n)} \otimes P_2t} H_y^{(n)} +\end{align*}

+

where $H_y$ is a self-inverse gate (that was suggested here), which has this nice property $\sigma_y = H_y \sigma_z H_y$:

+

$$H_y = \frac{1}{\sqrt{2}}\begin{pmatrix} +1 & -i \\ +i & -1 +\end{pmatrix} +$$

+

Now, we can simulate any Pauli term. For example, the circuit for $e^{i \sigma_y \otimes \sigma_y \otimes \sigma_x}$ will look like this:

+

$$e^{i \sigma_y \otimes \sigma_y \otimes \sigma_x} = \big[ H_y \otimes H_y \otimes H \big] e^{i \sigma_z \otimes \sigma_z \otimes \sigma_z} \big[H_y \otimes H_y \otimes H\big] $$

+

                                       ��  +

+

By applying appropriate rotations we can bring any Pauli term simulation problem to the simplest $e^{i \sigma_z \otimes \sigma_z \otimes ... \otimes \sigma_z t}$ Pauli term simulation problem, which solution we already know. With this approach, we can simulate any Pauli term, thus also any Hermitian operator.

+
+

Addition: $I$ operators in the Pauli product terms

+

Here we will try to show that we can ignore $I$ operators in the Pauli products when we try to construct circuits for them. For example, we will take $\sigma_z \otimes I \otimes \sigma_z$ operator and show that we can forget about the second qubit and simulate the circuit for $e^{i\sigma_z \otimes \sigma_z t}$ applied on the first and third qubits. We should proof that:

+

$$e^{i\sigma_z \otimes I \otimes \sigma_z t} = CNOT^{(1,3)}R_z^{(3)}(-2t)CNOT^{(1,3)}$$

+

For the left side we have:

+

$$e^{i\sigma_z \otimes I \otimes \sigma_z t} = \cos(t) I \otimes I \otimes I + \sin(t) \sigma_z \otimes I \otimes \sigma_z$$

+

For the right side:

+

\begin{align} +&CNOT^{(1,3)}R_z^{(3)}(-2t)CNOT^{(1,3)} = \big[| 0 \rangle \langle 0 | \otimes I \otimes I + | 1 \rangle \langle 1 | \otimes I \otimes X \big] \\ +&\big[ I \otimes I \otimes \big( \cos(t) I + i \sin(t) \sigma_z \big) \big] +\big[ | 0 \rangle \langle 0 | \otimes I \otimes I + | 1 \rangle \langle 1 | \otimes I \otimes X \big]= +\\ +&= \cos(t) I \otimes I \otimes I + \sin(t) \sigma_z \otimes I \otimes \sigma_z +\end{align}

+

So, they are equal to each other: we can forget about $I$ operator for constructing a circuit in this case. This solution can be generalized for $n$ $I$ operators between two $\sigma_z$ terms.

+

Also, let's proof that $I \otimes P \otimes I$ can be simulated by $e^{i I \otimes P \otimes I t} = I \otimes e^{i P t} \otimes I$, where $P$ is some Pauli product:

+

\begin{align} +&e^{i I \otimes P \otimes I t} = \cos(t) I \otimes I \otimes I + i\sin(t) I \otimes P \otimes I +\\ +&= I \otimes \big( \cos(t) I + i \sin(t) P \big) \otimes = I \otimes e^{i P t} \otimes I +\end{align}

+

In this manner, it can be shown for general cases that we can ignore $I$ operators when we simulate Pauli terms in the quantum circuits.

+
+

Qiskit implementations of the ideas described here can be found in this tutorial.

+

[1] J.D. Whitfield, J. Biamonte, and A. Aspuru-Guzik, +Molecular Physics, "Simulation of electronic structure Hamiltonians using +quantum computers" (2011)

+

[2] M.A. Nielsen, I.L. Chuang, Cambridge University Press New York, "Quantum Computation and Quantum Information: 10th Anniversary Edition +10th" (2011)

+",9459,,9459,,7/1/2020 17:34,7/1/2020 17:34,,,,13,,,,CC BY-SA 4.0 +11374,1,11375,,4/1/2020 21:47,,3,216,"

When I run a certain circuit (using several qubits, it is not a very simple one) in IBM quantum experience, I find that sometimes it is transpiled in one way and sometimes in another. And the final results are (quite) different. Specifically, I notice this fact in IBM q-computers with more than 5 qubits.

+ +

Is it possible to avoid this apparently random behaviour? Is it possible to control the way the circuit is transpiled?

+",11544,,,,,4/1/2020 22:23,Why does not ibm-q-experience transpile a circuit always in the same way?,,1,1,,,,CC BY-SA 4.0 +11375,2,,11374,4/1/2020 22:23,,5,,"

The default Qiskit transpiler uses a stochastic swap (StochasticSwap) method to insert the swap gates needed to map the circuit to a given device topology. As the name suggests, this routine uses random numbers in the swap computation, leading to an output that varies. This is an heuristic that is used to get around the fact that computing the optimal answer is NP-hard.

+",332,,,,,4/1/2020 22:23,,,,2,,,,CC BY-SA 4.0 +11376,1,,,4/2/2020 0:27,,1,99,"

I'd like each of my students to run at least one program (however trivial) on a real quantum computer. They can each sign up for accounts on ibm-q-experience. The question is, which of the backends are real and which are simulations? I see the word ""simulation"" in some of their names. Does that mean that any backend without the word ""simulation"" in its name is a real quantum computer?

+",11546,,,,,4/2/2020 0:54,Real backend for my students?,,1,0,,,,CC BY-SA 4.0 +11377,2,,11376,4/2/2020 0:54,,3,,"

The online simulator is called the ibmq_qasm_simulator, all other devices with city names, e.g. ibmq_vigo, are real quantum devices.

+",332,,,,,4/2/2020 0:54,,,,0,,,,CC BY-SA 4.0 +11378,2,,11372,4/2/2020 7:53,,7,,"

What $\sigma^z_i$ means is that you've got a Pauli-$Z$ applied to qubit $i$, and nothing else on the other qubits (i.e. the identity). So, you could expand it as +$$ +I^{\otimes(i-1)}\otimes\sigma^z\otimes I^{n-i} +$$ +if your system has $n$ qubits. A term such as $\sigma^z_i\sigma^z_j$ is then a product of two of these, which is equivalent to the tensor product of $\sigma^z$ on qubits $i$ and $j$ and identity everywhere else. The summation is usually taken over pairs $i,j$ which are nearest-neighbours on some underlying geometry of the qubits.

+",1837,,,,,4/2/2020 7:53,,,,0,,,,CC BY-SA 4.0 +11379,2,,5000,4/2/2020 13:45,,1,,"

If you really want to simulate measurement, that's how I would do it.

+ +

A function that finds probability amplitude associated to each eigenstate.

+ + + +
import numpy as np
+import itertools
+
+from qutip import basis, tensor, snot
+
+def prepareMeasurement(N, psi):
+    # all the spin configurations
+    confs = list(itertools.product([0, 1], repeat=N))
+    # probability distribution
+    P = []
+    for conf in confs:
+        # particular outcome as quantum object
+        psi_ref = tensor([basis(2, m) for m in conf])
+        # probability of this outcome
+        p = np.abs(psi.overlap(psi_ref))**2.
+        # append to the distribution
+        P.append(p)
+    return confs, np.array(P)
+
+ +

Then a function that given this amplitude takes n random measurements.

+ + + +
def simulateMeasurement(confs, P, n):
+    return np.random.choice(range(len(confs)), n, p=P)
+
+ +

We can test it on a little example, let's create an even superposition of all the eigenstates. They should all have same amplitudes.

+ + + +
psi0 = tensor([basis(2, 0), basis(2, 0), basis(2, 0)])
+psif = snot(N=3, target=0)*psi0
+psif = snot(N=3, target=1)*psif
+psif = snot(N=3, target=2)*psif
+
+ +

And this is how we apply our measurement simulation, let's perform 10000 measurements. Let's also calculate counts.

+ + + +
confs, P = prepareMeasurement(3, psif)
+measurements = simulateMeasurement(confs, P, 10000)
+unique, counts = np.unique(measurements, return_counts=True)
+
+ +

Visualize the data in histogram-like form.

+ + + +
import matplotlib.pyplot as plt
+
+fig, ax = plt.subplots()
+ax.bar(unique, height=counts)
+plt.xticks(unique, [""|{0}>"".format(format(m, '03b')) for m in unique])
+ax.set_title('Testing measurement simulation with QuTip')
+ax.set_ylabel('Count')
+ax.set_xlabel('Measurement')
+plt.show()
+
+ +

This is what we're getting

+ +

+ +

I included everything in this public gist repository. Hope it helps!

+",8883,,8883,,4/2/2020 14:03,4/2/2020 14:03,,,,0,,,,CC BY-SA 4.0 +11380,1,,,4/2/2020 14:07,,2,138,"

One can check that, with IBM's circuit composer, $Y$ gate acted on $|0\rangle$ or on $|1\rangle$ returns the same phase of $\pi/2$. Is this a bug?

+ +

+ +

+",11555,,9006,,4/2/2020 21:20,4/2/2020 22:34,Gate Y returns wrong phase in IBM's circuit composer,,2,1,,,,CC BY-SA 4.0 +11697,2,,8850,4/26/2020 21:22,,0,,"

Those two circuits are two different approches in implementing the oracle.

+ +

In the first one, the idea is to implement a function $f$ such that $f(x)=1$ iff $x=|000\rangle$. If the input is $|000\rangle$, then a NOT gate is applied to $q_a$ which is the ancilla qubit. If the ancilla qubit is prepared in state $|-\rangle$, then using phase kickback the sign of the amplitude of the state $|000\rangle$ is flipped.

+ +

In the second one, the sign of the amplitude of the state $|000\rangle$ is flipped directly through controlled Z gate, which adds an overall of phase of -1 if all control qubits are in state 1.

+ +

The reason why we have X gates is to be able to control them. If initially they are all 0, then applying the X gates all of them are in state 1 and we can apply the controlled operations. For instance oracle for 010 would have X gates only on the first and third qubits.

+ +

About your other question, think of the effect of that operation on an arbitrary basis state. If you apply it to state $|0\rangle$, then the output is $|0\rangle$ and the output is $-|x\rangle$ for any other input $|x\rangle$. Think about the converse, where you only flip the amplitude of state $|0\rangle$. Those two operations are indistinguihable and therefore the latter is implemented, which is exactly the same as the oracle implementation where $|000\rangle$ is the marked element. (Check this link:Gate corresponding to $-I$)

+",7986,,,,,4/26/2020 21:22,,,,0,,,,CC BY-SA 4.0 +11698,1,,,4/26/2020 22:27,,1,122,"

How can you take the Tensor Product in IBM Quantum Experience? +For example +$$(X|1⟩) \otimes ((X|1⟩)$$

+ +

I have tried to look up but couldn’t find anything

+",8400,,9006,,4/27/2020 4:30,4/27/2020 4:41,Tensor product IBM on Quantum Experience,,1,0,,,,CC BY-SA 4.0 +11699,1,,,4/27/2020 1:24,,3,231,"

From the Steane syndrome extraction of quantum error correcting code, we use ancilla qubit prepared in logical X/Z basis to detect logical Z/X errors in the logical data state (The CNOT is transversal).

+ +

Every material tell me that it works because X errors will propogate to the left part of ancilla and Z errors will propogate to the right part. However, I'm confused how the measurement works. For example in the left part, even there is no error (Or applying a stabilizer), measuring logical + at Z basis will cause uncertain results, and X error just make thing more complex. Can somebody explain how the measure work and why it can get the syndrome?

+ +

+",11833,,11833,,4/27/2020 1:32,10/7/2022 18:57,Why should we measure in X/Z basis for Z/X errors in Steane syndrome extraction?,,3,2,,,,CC BY-SA 4.0 +11700,1,,,4/27/2020 2:39,,1,187,"

How can you construct the different Bell states? For example $$\frac{|01⟩-|10⟩}{\sqrt{2}}$$

+",8400,,55,,4/27/2020 8:50,4/27/2020 10:18,How can you construct the different two-qubit Bell states?,,2,0,,,,CC BY-SA 4.0 +11701,2,,11700,4/27/2020 4:14,,3,,"

Firstly construct following circuit:

+ +

+ +

Different Bell states are created according to input to the circuit follwingly:

+ +
    +
  • input $|00\rangle$, output: $|\psi\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$
  • +
  • input $|10\rangle$, output: $|\psi\rangle = \frac{1}{\sqrt{2}}(|00\rangle - |11\rangle)$
  • +
  • input $|01\rangle$, output: $|\psi\rangle = \frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$
  • +
  • input $|11\rangle$, output: $|\psi\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$
  • +
+",9006,,,,,4/27/2020 4:14,,,,0,,,,CC BY-SA 4.0 +11702,2,,11698,4/27/2020 4:19,,1,,"

Lets have two general single qubit gates $A$ and $B$. If you apply $A$ on first qubit and $B$ on second qubit, you will get two qubit gate $A \otimes B$. In your case $A = B = X$.

+ +

Just note that $X|1\rangle \otimes X|1\rangle = |0\rangle\otimes|0\rangle$.

+ +

Here is an example of tensor product $S \otimes T$ implementation:

+ +

+ +

As tensor product is not commutative operation, $T \otimes S$ is implemented followingly:

+ +

+",9006,,9006,,4/27/2020 4:41,4/27/2020 4:41,,,,0,,,,CC BY-SA 4.0 +11703,1,11859,,4/27/2020 9:28,,2,150,"

I have executed this circuit and I don't understand why the result is $|11\rangle$ ?

+ +
    +
  • [q[0], q[1]] : solution register
  • +
  • [q[2]] : ancilla register (clause value)
  • +
  • [q[3]] : boolean value of Oracle function
  • +
+ +

+ +

Thanks you

+",10192,,9006,,4/27/2020 17:31,5/5/2020 6:55,Result of Grover on Qiskit simulator,,2,0,,,,CC BY-SA 4.0 +11704,2,,6496,4/27/2020 9:47,,2,,"

In Elementary gates for quantum computation it is conjectured that

+ +
+

based on dimension counting, ... a lower bound on the number of two-bit gates required to produce an arbitrary $n$-bit unitary transformation [is]: $\Omega(n) =\frac19 4^n−\frac13n−\frac19$.

+
+",5280,,,,,4/27/2020 9:47,,,,0,,,,CC BY-SA 4.0 +11705,2,,11700,4/27/2020 10:18,,2,,"

By a combination of Hadamard Gate and CNOT Gate.

+ +

Check the links below:

+ +

https://www.quora.com/What-is-the-matrix-of-a-Hadamard-with-a-CNOT-gate

+ +

https://physics.stackexchange.com/questions/418422/negative-of-quantum-gates-and-entangled-states

+",11708,,,,,4/27/2020 10:18,,,,0,,,,CC BY-SA 4.0 +11706,1,,,4/27/2020 10:27,,2,471,"

Is there a section on the IBM website that shows information about the readout error for the devices of quantum experience? I have only seen the errors for single-qubit (U2) and CNOT gates but nothing involving measurements.

+ +

If not, is there any suggestion about how to measure it? The only thing that comes to my mind is to run the ground state because any circuit would mix readout with gate errors. But I think that the resulting noise might as well be due to other factors like imperfect preparation of the ground state.

+",8388,,9006,,4/27/2020 10:52,4/28/2020 0:59,Readout error in IBM quantum experience processor,,2,0,,,,CC BY-SA 4.0 +11707,2,,11706,4/27/2020 10:51,,2,,"

Go to the first page in IBM Q web interface, click on a quantum processor you are interested in and finally click on link Download calibration.

+ +

You will see a table (CSV file) containing decoherence times $T1$, $T2$, read-out, single-qubit $U2$ error rate and CNOT error rate.

+",9006,,,,,4/27/2020 10:51,,,,0,,,,CC BY-SA 4.0 +11708,2,,11699,4/27/2020 11:24,,4,,"

There is much more information provided here which may help.

+ +

Let me start by clarifying that the aim is not to detect and correct logical errors, but to detect and correct physical errors, i.e. those that occur on single physical qubits rather than the encoded qubit.

+ +

At the macro level, the answer is that if you have an $X$ error (say), you use a controlled-not to propagate it to another qubit where it appears as an $X$ error. Measuring in the $X$ basis cannot see that error. For example, if a single qubit state was in $|+\rangle$, an $X$ error would not change it, and you would be unable to detect the error. On the other hand, if the qubit was initially in $|0\rangle$ then the possibility of a flip would put it in either $|0\rangle$ or $|1\rangle$, which can be detected with a $Z$ measurement. (Put another way, $X$ errors commute with $X$ measurements, so they do not affect each other.)

+ +

More specifically, let's start by thinking about what happens if there is no error. In that case, $|+\rangle$ is the eigenstate of controlled-not, so it never changes. This is what initially threw me trying to think about a $Z$ measurement on this. But of course, it's not logical $Z$ measurement, but physical. So, basically, you'll get a single answer corresponding to one of the basis states used in either to 0 or 1 logical state, with no control over which. Let's call that answer $x$. What we do know is that $H\cdot x=0$, where $H$ is the parity-check matrix of the code (I'm being a bit loose about which of the two it is).

+ +

Now, what happens if there was a single physical $X$ error somewhere on the logical qubit. Controlled-nots (and we should think about the individual physical ones here, not the logical ones) propagate $X$ rotations from control to target. So, instead of getting an answer $x$, we'd get an answer $x\oplus e$ where $e$ is a vector representing the single qubit that had the error. So, now, if you apply the parity-check matrix, you get +$$ +H\cdot(x\oplus e)=(H\cdot x)\oplus(H\cdot e)=H\cdot e. +$$ +The whole point of the parity-check matrices is that they can let you identify any single-qubit $e$. Hence, you know what correction to provide.

+",1837,,,,,4/27/2020 11:24,,,,0,,,,CC BY-SA 4.0 +11709,2,,6915,4/27/2020 15:39,,1,,"

In lecture 4 of O'Donnell's series on quantum computing, he introduces the Elitzur-Vaidman bomb tester, which is an interesting application of the quantum Zeno effect.

+ +

O'Donnell introduces the bomb tester prior to discussing multi-qubit entanglement in lecture 5.

+ +

In the Elitzur-Vaidman tester, a single qubit in a superposition can be used to probe and detect the presence of a bomb, importantly without triggering the bomb. The success probability is naively low, but can be amplified arbitrarily high by rotating the qubit by a small $\epsilon$ amount, and feeding the qubit back through the tester. The bomb only goes off with probability only $\epsilon^2$ for each test.

+ +

This computation of the presence/absence of a bomb certainly requires a qubit in superposition, along with a unitary gate to apply a rotation, along with the Born rule to determine the success probabilities; however, it does not seem to require any entanglement. Furthermore it's not clear to me how the quantum Zeno effect is related to the no-cloning Theorem, or if the no-cloning theorem and the quantum Zeno effect are two sides to the same coin.

+",2927,,2927,,4/27/2020 16:04,4/27/2020 16:04,,,,0,,,,CC BY-SA 4.0 +11710,2,,11703,4/27/2020 15:47,,0,,"

3 out of 4 states are inverted, that leads to the following situation before you do the Grover Diffusion, which mirror around the red line:

+ +

+ +

This will bring the all states to zeros, but not $|11\rangle$...

+",5280,,,,,4/27/2020 15:47,,,,4,,,,CC BY-SA 4.0 +11712,1,,,4/27/2020 17:31,,8,315,"

It is known that Toffoli and Hadamard are Quantum Universal.

+ +

My question is - how to construct (an approximation of) the Deutsch's gate or the $\pi/8$ rotation using Toffoli + Hadamard?

+ +

I've seen several implementations of the Toffoli gate using Hadamard, CNOT and $\pi/8$ gates, but none for the other direction.

+",11782,,11782,,4/27/2020 22:41,4/27/2020 22:41,How to construct Deutsch's gate or $\pi/8$ rotations using Toffoli+Hadamard?,,1,0,,,,CC BY-SA 4.0 +11713,2,,11712,4/27/2020 17:47,,6,,"

Toffoli and Hadamard are computationally universal -- that is, they can be used to carry out any quantum computation. However, they do so by implementing quantum gates in an encoded way. Indeed, this is necessary since both Toffoli and Hadamard have only real entries, so there is no way to obtain quantum gates with complex entries, unless one uses some encoding (see the paper you linked). That means that Toffoli and Hadamard are not universal in the sense that you can use them to construct any gate. In particular, there is no way to actually construct the $\pi/8$ or the Deutsch gate (except for special angles), or to even approximate them.

+",491,,,,,4/27/2020 17:47,,,,8,,,,CC BY-SA 4.0 +11714,1,11723,,4/27/2020 20:07,,1,102,"

I don't have much confidence with density matrices, and I would like to be sure about a property of composition of tensor products operations. Specifically,

+ +

$$ \sum_i \sum_j |a_i\rangle|b_i\rangle\langle c_j|\langle d_j| =$$
+$$ =\sum_i \sum_j |a_i\rangle \langle c_j| |b_i\rangle \langle d_j| $$
+and the reason for this is the following property of the tensor product: +$$(x \otimes y)^T(x \otimes y) = (x^Tx \otimes y^Ty) $$

+ +

Am I right?

+",10062,,10062,,4/29/2020 15:00,4/29/2020 15:00,Composition of tensor product,,1,0,,,,CC BY-SA 4.0 +11715,1,11720,,4/27/2020 23:07,,3,400,"

I ran the following code

+ +

+ +

which adds two 2-digit numbers on different back-ends and the simulator gives the expect result while all real QC's have a problem with the transpiling:

+ +

+ +

In fact, Melbourne was able to return some results but they were quite far from what expected and what the simulator returned. Has anybody encountered a similar problem? I paste below how the result looks when it fails:

+ +

+",11555,,,,,5/1/2021 0:13,Transpiling error in IBM Quantum Experience,,3,0,,,,CC BY-SA 4.0 +11716,2,,11715,4/27/2020 23:34,,4,,"

So without the OpenQASM code to import this is hard (I do not want to input it by hand) to verify what went wrong. However, in the case of unexpected results, it is important to note that every SWAP gate gets decomposed into 3 CX gates, and every CCX (Toffoli) gate becomes six CX gates and a handful of single-qubit gates. So your circuit is already quite long when decomposed. Add to this the need for additional SWAP gates to match the device topology and one can then see that the actual circuit run will have its output greatly affected by noise.

+",332,,,,,4/27/2020 23:34,,,,2,,,,CC BY-SA 4.0 +11717,1,11721,,4/28/2020 0:06,,2,110,"

Let us assume that we have a classical function $f:\{0\,;\,1\}^n\to\{0\,;\,1\}^m$ which is efficiently computable. Then, its oracle is defined with $\mathbf{U}_f\,|x\rangle\,|y\rangle=|x\rangle\,|y\oplus f(x)\rangle$. I quite often read that if $f$ is efficiently computable, then so is $\mathbf{U}_f$. Why is it the case? Where is the computational cost of evaluating $f$ taken into account?

+ +

Since $\mathbf{U}_f$ is a permutation matrix, one can implement it with at most $2^{n+m}$ SWAP gates, but this is not very efficient. What am I missing?

+ +

Another related question is: given a permutation matrix, how can one find the appropriate CNOT/SWAP gates succession to implement it? Even if an efficient solution exists, how does one find it?

+",10454,,,,,4/28/2020 7:45,On the complexity of an oracle for a classical function,,1,0,,,,CC BY-SA 4.0 +11718,1,,,4/28/2020 0:47,,2,39,"

I am a novice in the Quantum Computing field. Recently we were discussing NP-complete problems in Algorithms class and a question arose in my mind which I have stated above, can anyone help me with this?

+",11844,,5955,,4/28/2020 10:02,4/28/2020 10:02,How can we apply Quantum Algorithms (Grover's to be specific) to edge coloring problem?,,0,3,,,,CC BY-SA 4.0 +11719,2,,11706,4/28/2020 0:59,,2,,"

You can also see this directly in Qiskit. To see the cals visually you can do:

+ +
from qiskit import IBMQ
+from qiskit.visualization import plot_error_map
+provider = IBMQ.load_account()
+backend = provider.backends.ibmq_rome
+
+plot_error_map(backend)
+
+ +

+",332,,,,,4/28/2020 0:59,,,,2,,,,CC BY-SA 4.0 +11720,2,,11715,4/28/2020 4:17,,2,,"

I would add that you use 7 qubits, however, with exception of Melbourne the processors have less qubits (for example Armonk has only 1 qubit, Ourense 5 qubits etc.), so you cannot run the algorithm on them.

+ +

Melbourne has 15 qubits, so your algorithm is transpiled without error. Check number of qubits by click on particular processor on main page in IBM Q.

+ +

Note, simulator can be used for algorithms up to 32 qubits.

+ +

Unexpected results on Melbourne are given by too deep circuit.

+",9006,,,,,4/28/2020 4:17,,,,1,,,,CC BY-SA 4.0 +11721,2,,11717,4/28/2020 7:45,,1,,"

There are several different issues all bundled together here.

+ +

First is the concept of classical universality: whatever gate set you choose to specify your classical algorithm in terms of, there's a polynomial conversion to any other gate set. This includes a gate set that comprises reversible classical gates (such as Toffoli). For this, you just need to find a constructive conversion between the two gate sets. So, you can efficiently implement the reversible computation. It also means that you can efficiently implement it on a quantum computer, just by using the quantum computer's version of Toffoli as compared to the classical version (the only difference being that the quantum version accepts superpositions as inputs).

+ +

However, the terminology that you're using is one of oracles. The oracle model is different. There, each use of the oracle counts as ""1"", and you don't count any other gates. You're accepting that the cost of implementing the oracle is (relatively) high to the extent that it's the dominant source, and so the only relevant question is how many times you use the oracle. Part of the point here being that somebody could come up with a different gate sequence for the oracle that takes a different running time, but that doesn't affect the oracle-based analysis.

+",1837,,,,,4/28/2020 7:45,,,,3,,,,CC BY-SA 4.0 +11722,2,,11675,4/28/2020 8:53,,1,,"

A way that's perhaps more compact (if less terse), we can write

+ +

$$ \mathrm{Tr}_B(O_AM)=\mathrm{Tr}_B((O_A\otimes \mathbb 1_B)M)=\sum_i (\mathbb 1_A\otimes \langle i|_B) (O_A\otimes \mathbb 1_B)M(\mathbb 1_A\otimes |i\rangle_B)=\\=\sum_i O_A(\mathbb 1_A\otimes \langle i|_B) M(\mathbb 1_A\otimes |i\rangle_B)=O_A\mathrm{Tr}_B(M)$$

+ +

The only nontrivial thing I used is $(\mathbb 1_A\otimes \langle i|_B) (O_A\otimes \mathbb 1_B)=O_A(\mathbb 1_A\otimes \langle i|_B)$, it's pretty clearly true, but to see it explicitely just write

+ +

$$(\mathbb 1_A\otimes \langle i|_B) (O_A\otimes \mathbb 1_B)= (\mathbb 1_A\otimes \langle i|_B) O_A\otimes\sum_j |j\rangle\langle j|=O_A\otimes\langle i|_B=O_A(\mathbb 1_A\otimes\langle i|_B) $$

+",5125,,,,,4/28/2020 8:53,,,,1,,,,CC BY-SA 4.0 +11723,2,,11714,4/28/2020 9:46,,1,,"

The simple answer is: yes...$ $

+",5280,,,,,4/28/2020 9:46,,,,0,,,4/28/2020 9:46,CC BY-SA 4.0 +11724,1,,,4/28/2020 10:14,,8,97,"

Will two entangled qubits be affected by gravity? I mean if one is near blackhole's horizon and other is on earth will the effect of relativity be experienced on the measurement? will there be any delay or error in measurement?

+",9898,,55,,10/12/2020 21:26,10/12/2020 21:26,Will two entangled qubits be affected by gravity?,,1,2,,,,CC BY-SA 4.0 +11725,2,,11724,4/28/2020 10:35,,3,,"

Let's start with the Bell state $\frac1{\sqrt2}(|01\rangle+|10\rangle)$. Let's further assume that the entire universe (or at least the parts of relevance) are pervaded by a static magnetic field along the $z$-axis, which I relate to the unitary evolution $\exp(-itH_z)$.

+ +

Now let's place one part of the entangled state next to a massive object, such that its own time evolves slower than ours far away.

+ +

As you can see in this QUIRK circuit here, the Bell states changes back and forth between +$$\frac1{\sqrt2}(|01\rangle+|10\rangle)\leftrightarrow\frac{e^{i\phi}}{\sqrt2}(|01\rangle-|10\rangle), $$ +as time goes by with two different speeds. Now you have to come up with a measurement protocol to distinguish these two states by local operations and communications (don't enter the event horizon!)

+ +

Whereas you only catch up a global phase which is not measurable...

+ +

UPDATE

+ +

There is ""Space QUEST (QUantum Entanglement Space Test) mission proposal"" at the arxiv, to ""...Experimentally test decoherence due to gravity"". From the abstract:

+ +
+

Some speculative theories suggest that quantum properties, such as entanglement, may exhibit entirely different behavior to purely classical systems.

+
+",5280,,5280,,4/30/2020 7:50,4/30/2020 7:50,,,,0,,,,CC BY-SA 4.0 +11726,1,11727,,4/28/2020 14:56,,1,321,"

I'm new in quantum computing, I have this question.

+ +

Qubits $x$ and $y$ are in $\mathbb{C}^2$ (column vector) and $A, B$ are unitary matrices ($A$ 8x8 and $B$ 4x4 matrix).

+ +

If I'm not wrong the input of $A$ is $x_1 \otimes x_2 \otimes x_3$ which is in $\mathbb{C}^8$ (column vector). Now given the output $z=A(x_1 \otimes x_2 \otimes x_3)$ how can I extract $y_3$ from $z$ to calculate $y_3 \otimes y_4$ ($x_4 = y_4$) which is the input of $B$?

+ +

+",11847,,55,,4/29/2020 13:14,4/29/2020 13:14,How do I compute the output of quantum circuit involving multiple gates?,,1,4,,,,CC BY-SA 4.0 +11727,2,,11726,4/28/2020 15:19,,1,,"

In general, you cannot just extract the part of the state that corresponds to $y_3$ and $y_4$. Instead, you have to consider the entire state (which you will describe using a 16-element vector), and you apply to it the unitary $I\otimes B$ where $I$ is the $4\times 4$ identity matrix.

+",1837,,,,,4/28/2020 15:19,,,,2,,,,CC BY-SA 4.0 +11381,1,11385,,4/2/2020 15:13,,0,58,"

After placing the Hadamards on the 2 qubits (both initialized in the $|1\rangle$ state) in the circuit, we are given:

+ +

$ |\psi_{b}\rangle = \frac{1}{2}(|0_{1}0_{2}\rangle -|1_{1}0_{2}\rangle -|0_{1}1_{2}\rangle +|1_{1}1_{2}\rangle) $

+ +

the above state is run through the f-cnot, and we are given a superposition:

+ +

$ |\psi_{c}\rangle = \frac{1}{2}(|0_{1}f(0_{2})\rangle -|1_{1}f(1_{2})\rangle -|0_{1}\tilde f(0_{2})\rangle +|1_{1}\tilde f(1_{2})\rangle ) $.

+ +

In order to compute whether the function is balanced or not, we can use some factoring:

+ +

If $ f(0)=f(1) $ we can factor out: +$ |\psi_{c}\rangle = \frac{1}{2}(|0_{1}\rangle -|1_{1}\rangle)(|f (0_{2})\rangle - |\tilde f (0_{2})\rangle) +$

+ +

If $ f(0)=\tilde f(1) $ we can factor out: +$ |\psi_{c}\rangle = \frac{1}{2}(|0_{1}\rangle +|1_{1}\rangle)(|f (0_{2})\rangle - |\tilde f (0_{2})\rangle) +$

+ +

Question:

+ +

How are these two factored-out states for $ f_1 $ and $ \tilde f_1 $, actually pulled out of the original superposition? Like, how are they actually factored?

+",8133,,2879,,4/3/2020 0:30,4/3/2020 0:30,How are the two states factored out of Deutsch's circuit?,,1,5,,,,CC BY-SA 4.0 +11382,1,,,4/2/2020 19:22,,1,74,"

I'm simulating the BB84 protocol using simulaqron. My +problem is that when Alice and Bob measure in the same basis, they +don't get the same result.

+ +

How can I fix this error?

+ +

.

+ +

BB84.py

+ +
from cqc.pythonLib import CQCConnection, qubit
+import numpy as np
+""""""
+BB84 protocol 
+""""""
+
+def prepare_qubits(Sender,receiver,key_bit):
+
+   q=qubit(Sender)
+   S_basis="""" # The sender basis
+
+   if key_bit == 1:  #prepare qubits in |1> state
+    q.X() #apply X gate
+   else:
+    pass
+   # convert  to  Hadamard  basis randomly
+   if 0.5 < np.random.random(): 
+    q.H() #apply hadamard gate
+    S_basis='H'
+   else:
+    S_basis='S'
+    pass
+   Sender.sendQubit(q,receiver)
+
+   return [q,S_basis]
+
+def receive_qubits(Receiver):
+  #R_basis=[] #Receiver basis
+  # Wait to  receive a qubit
+  q=Receiver.recvQubit()
+  C="""" # for basis choice
+  # If we  chose  the  Hadamard  basis
+  # to  measure in, apply H
+  if 0.5 < np.random.random(): 
+   q.H()
+   C='H'
+  else:
+   C='S' #S: Standard Basis
+   pass
+  # Measure  the  qubit  in the  standard
+  # basis  and  store  the  outcome  in m
+  m=q.measure ()
+  return [m,C]
+
+ +

Alice.py

+ +
from cqc.pythonLib import CQCConnection, qubit
+import numpy as np
+from BB84 import *
+from CAC.classical_comm import *
+
+# Establish a connection  to  SimulaQron
+with CQCConnection(""Alice"") as Alice:
+
+ print(""***********************BB84 protocol***************************"")
+ #Alice.closeClassicalServer()
+ m=[] 
+ B=[]
+ S=''
+ n=2 #number of qubits
+ Alice.sendClassical(""Bob"",n)#send the number of qubits
+ key= np.random.randint(0, high=2**n)#to replace with QRNG() function
+ k=np.binary_repr(key,n) #binary representation
+ print(""Alice's random key"",key)
+ print(""Alice's binary key:"",k)
+ print(""*********************************"")
+ for x in k:
+
+  m.append(str(x))
+  s=prepare_qubits(Alice,""Bob"",x) #send BB84 states
+  #receive a confirmation msg from Bob via the CAC
+  B.append(s[1])
+  S+=str(s[1])
+ """"""
+ #send Alice's basis to Bob 
+ ff=S.encode()#conversion to byte
+ Alice.sendClassical(""Bob"",ff)
+ """"""
+
+ print('a basis',B)
+
+ #received Bob's Basis
+ x=Alice.recvClassical()
+ B_basis=list(x.decode())
+ print(""Bob basis received"",B_basis)
+ #print(B_basis.split(""""))
+ aa=sifted_key(B,B_basis,m)
+ print(""sifted key"",aa)
+
+
+
+ listToStr =""[""+','.join(map(str, aa[1]))+""]""
+ ff=listToStr.encode()
+ Alice.sendClassical(""Bob"",ff)
+
+
+ #Close  connection  to  SimulaQron
+ Alice.close()
+
+ +

Bob.py

+ +
from cqc.pythonLib import CQCConnection, qubit
+import numpy as np
+from BB84 import *
+from CAC.classical_comm import *
+import ast
+
+# Establish  connection  to  SimulaQron
+with CQCConnection(""Bob"") as Bob:
+ #Bob.closeClassicalServer() #if I want to use my socket functions
+ n=Bob.recvClassical()[0] #number of qubits given by Bob (""Eve"")
+ key=[]
+ B=''
+ for i in range(0,n):
+  c=receive_qubits(Bob)
+  #send confirmation to Alice via CAC
+  #print(""out meas."",c[0])
+  key.append(c[0])
+  B+=str(c[1]) #Bob basis
+
+ print(""Bob off"",B)
+ #send Basis to Alice
+ print(""bob's initial key :"",key)
+ ff=B.encode()#conversion to byte
+ Bob.sendClassical(""Alice"",ff)
+
+ #receive Alice's basis
+ a=Bob.recvClassical()
+ x=a.decode()
+ res = ast.literal_eval(x)
+ print(""Alice's Basis received"",res)
+ key_s=[]
+
+ for c in res:
+  key_s.append(key[c])
+
+ print(""final sifted key"",key_s)
+Bob.close()
+
+",11560,,9006,,4/2/2020 21:23,4/2/2020 21:23,Why Alice and Bob don't get the same result when they measure in the same basis?,,0,0,,,,CC BY-SA 4.0 +11383,2,,11380,4/2/2020 21:19,,0,,"

Gate $Y$ is described by matrix

+ +

$$ +Y= +\begin{pmatrix} +0 & -i \\ +i & 0 +\end{pmatrix}. +$$

+ +

When it acts on qubit in state $|0\rangle$, it returns state $\begin{pmatrix}0 \\i \end{pmatrix}$, i.e. a phase is $\pi/2$. When you do so on IBM Q a state

+ +
[ 0+0j, 0+1j ]
+
+ +

is returned as you can see in Visualization => State vector menu in IBM Q composer.

+ +

For qubit in state $|1\rangle$, the gate returns state $\begin{pmatrix}-i \\0 \end{pmatrix}$, i.e. the phase is $-\pi/2$. In IBM Q visualization you can see

+ +
[ 0-1j, 0+0j ]
+
+ +

This means that $Y$ gate is implemented correctly on IBM Q.

+ +

Note, do not be confused by color in bar graph, see state vector description below the graph.

+",9006,,,,,4/2/2020 21:19,,,,5,,,,CC BY-SA 4.0 +11384,2,,11380,4/2/2020 22:34,,1,,"

+ +

This is the color scheme for the phase factors supplied by IBM Q. It seems that it is not just the Y gate but any phase larger than pi is incorrectly color coded.

+",11555,,,,,4/2/2020 22:34,,,,0,,,,CC BY-SA 4.0 +11385,2,,11381,4/3/2020 0:29,,1,,"

Let's see how to get from $ |\psi_{c}\rangle = \frac{1}{2}(|0_{1}f(0_{2})\rangle -|1_{1}f(1_{2})\rangle -|0_{1}\tilde f(0_{2})\rangle +|1_{1}\tilde f(1_{2})\rangle ) $ to the case of $ f(0)=f(1) $:

+ +

$$\frac{1}{2}(|0_{1}f(0_{2})\rangle -|1_{1}f(1_{2})\rangle -|0_{1}\tilde f(0_{2})\rangle +|1_{1}\tilde f(1_{2})\rangle ) = \\ += \frac{1}{2}(|0_{1}f(0_{2})\rangle -|1_{1}\color{blue}{f(0_{2})}\rangle -|0_{1}\tilde f(0_{2})\rangle +|1_{1}\color{blue}{\tilde f(0_{2})}\rangle ) = \\ += \frac{1}{2}(|0_{1}\color{blue}{\rangle \otimes |}f(0_{2})\rangle -|1_{1}\color{blue}{\rangle \otimes |}f(0_{2})\rangle -|0_{1}\color{blue}{\rangle \otimes |}\tilde f(0_{2})\rangle +|1_{1}\color{blue}{\rangle \otimes |}\tilde f(0_{2})\rangle ) = \\ += \frac{1}{2}(|0_{1}\rangle \otimes |f(0_{2})\rangle -\color{blue}{|0_{1}\rangle \otimes |\tilde f(0_{2})\rangle-|1_{1}\rangle \otimes |f(0_{2})\rangle} +|1_{1}\rangle \otimes |\tilde f(0_{2})\rangle ) = \\ += \frac{1}{2}\Big(|0_{1}\rangle \otimes \big(|f(0_{2})\rangle - |\tilde f(0_{2})\rangle \big)-|1_{1}\rangle \otimes \big(|f(0_{2})\rangle -|\tilde f(0_{2})\rangle \big) \Big) = \\ += \frac{1}{2} \big(|0_{1}\rangle - |1_{1}\rangle \big) \otimes \big(|f(0_{2})\rangle - |\tilde f(0_{2})\rangle \big) +$$

+ +

And that's exactly the expression in the question. You can see that the number of terms remains the same if you open all brackets, 4.

+",2879,,,,,4/3/2020 0:29,,,,7,,,,CC BY-SA 4.0 +11386,1,11387,,4/3/2020 2:21,,0,261,"

I want to transform binary representation from one to other. Here, I have 2 registers one act as control register and another is target register with the same number of qubits $n$. Consider $n = 3$ qubits state and $N = 2^{n}$,

+ +

\begin{eqnarray} + |\psi_{0}\rangle &=& |i\rangle \otimes \sum_{i = 0}^{N} a_{i}|i\rangle \\ + |\psi_{0}\rangle &=& |i\rangle \otimes (a_{0}|000\rangle + a_{1}|001\rangle + a_{2}|010\rangle + a_{3}|011\rangle + a_{4}|100\rangle + a_{5}|101\rangle + a_{6}|110\rangle + a_{7}|111\rangle) +\end{eqnarray}

+ +

I want a quantum circuit or algorithm ($T_{i}|\psi_{0}\rangle = |\psi_{1}\rangle$) to transform, for example, the target state, +\begin{equation} + |\psi_{1}\rangle = |101\rangle \otimes (a_{0}|000\rangle + a_{3}|001\rangle + a_{2}|010\rangle + a_{1}|011\rangle + a_{5}|100\rangle + a_{4}|101\rangle + a_{7}|110\rangle + a_{}|111\rangle). +\end{equation} +Please note that the amplitude $a_{i}$ still the same as before the operation. +How to realize a quantum circuit like that, I know some special case where the operator will shift a bit to the right or left. However, I want a general form of operator $T$.

+",4729,,4729,,4/3/2020 6:33,4/3/2020 6:33,How to switch bit in the quantum state?,,2,0,,,,CC BY-SA 4.0 +11387,2,,11386,4/3/2020 6:22,,0,,"

What you seem to be asking for is the general construction of an arbitrary permutation. There’s nothing quantum about this; the equivalent question in classical is how to construct an arbitrary reversible circuit of n bits. There are $2^n!$ such circuits, from which it is hopefully obvious that there is not a compact description for the vast majority.

+ +

I should also point out that you have a slight notational issue. For each of the states that you write, you’ve put a projector on the first term in the tensor product. This does not correspond to a state. You probably just meant the ket.

+",1837,,,,,4/3/2020 6:22,,,,4,,,,CC BY-SA 4.0 +11388,2,,11386,4/3/2020 6:23,,0,,"

You can use a method described in Transformation of quantum states using uniformly controlled rotations.

+ +

Authors of the article introduced method how to change an arbitrary state $|a\rangle$ to state $|b\rangle$ with so-called uniformly controlled rotation, i.e. a rotation which rotational angle depends on combination of zeros and ones in controlling register.

+ +

The method uses $Ry$ and $Rz$ gates to achive this. $Ry$ gates are used for changing amplitudes and $Rz$ for changing phase. If you want to change only amplitudes, you can neglected part with $Rz$ gates.

+",9006,,,,,4/3/2020 6:23,,,,0,,,,CC BY-SA 4.0 +11389,1,,,4/3/2020 7:20,,2,58,"

In Google's Quantum Supremacy experiment, they use $f_{sim}$(fermionic-simulation) gates with $\theta=90°$ and $\phi=30°$ as their two-qubit gates. What if we use $\theta=45°$ for the two-qubit $f_{sim}$ gates? What will it do to the experiment's complexity?

+",11562,,2927,,4/3/2020 22:07,4/3/2020 23:40,"In Google's Quantum Supremacy experiment, what if we use $\theta=45°$ for two-qubit $f_{sim}$ gates?",,1,1,,,,CC BY-SA 4.0 +11390,1,11403,,4/3/2020 7:20,,2,365,"

I'm given with a Hamiltonian, $H=H_1+H_2$, where $H_1=\sigma_x\otimes\sigma_z$ and $H_2=\sigma_y\otimes\sigma_y$, and want to built a circuit which will implement $e^{-iHt},t=\pi/6$. We see that as $\sigma_x\otimes\sigma_z$ and $\sigma_y\otimes\sigma_y$ commutes, so $e^{-iHt}=e^{-i(\sigma_x\otimes\sigma_z)t}e^{-i(\sigma_y\otimes\sigma_y)t}.$

+ +

+ +By referring to answer given here,the first circuit is of $e^{-i(\sigma_x\otimes\sigma_z)t}$ and the second implements $e^{-i(\sigma_y\otimes\sigma_y)t}$, where $Y=\frac {1}{\sqrt{2}} \begin{pmatrix} +1&1\\ +i&-i\\ +\end{pmatrix} $

+ +

Note that the bottom qubit corresponds to the first in the tensor product.

+ +

Question

+ +

As $H_1$ and $H_2$ commutes, $e^{-iH_1t}$ and $e^{-iH_2t}$ should also commute. But here, in quirk. Though probabilities are same after both cases, the final state isn't, which indicates $e^{-i(\sigma_x\otimes\sigma_z)t}$ and $e^{-i(\sigma_y\otimes\sigma_y)t}$ are not commuting. What's my mistake here?

+",10368,,10368,,4/3/2020 8:26,4/4/2020 18:31,"Problem with commutation of $e^{-iH_1t}$ and $e^{-iH_2t}$, where $H_1$ commutes with $H_2$",,2,5,,,,CC BY-SA 4.0 +11391,2,,11390,4/3/2020 8:45,,2,,"

You reversed the order of $Y^\dagger$ and $Y$ compared to the answer you linked. Instead of using the ""$Y^\dagger$"" operation that sends the X axis to the Y axis to the Z axis to the X axis, you're doing the reverse. So you're operating on $X \otimes X$ instead of $Y \otimes Y$. (Incidentally, given the confusion w.r.t. the Y axis, it's hard to think of a worse name than Y for a custom operation.)

+ +

Personally I would recommend using self-inverse operations that swap one axis for another, like how the Hadamard swaps X for Z, instead of operations where it's possible to use them in the wrong order. In this case you could use $H_{YZ} = (Y + Z) / \sqrt{2} = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & -i \\ i & -1 \end{bmatrix}$.

+",119,,119,,4/3/2020 10:17,4/3/2020 10:17,,,,2,,,,CC BY-SA 4.0 +11392,1,11393,,4/3/2020 13:00,,2,135,"

In the article Quantum Observables for continuous control of the Quantum Approximate Optimization Algorithm via Reinforcement Learning, the following notation is used to describe an Unitary operation over $n$ qubits :

+ +

$$U(B,\beta) = \prod_{j =1}^n e^{-i \beta \sigma_j^x} $$

+ +

with $\beta$ a real parameter and $\sigma^x_j$ the pauli matrix $\sigma^x$ applied to the $j^{th}$ qubit. I first thought that this should be read as a matrix product, but since it's applied over $n$ qubits, I believe it should be a tensor product, otherwise there's a dimensionality issue. +I wonder if using the classical matrix product $\prod_{j =1}^n$ notation instead of the $\otimes_{j =1}^n$ notation is conventionnal in Quantum computing litterature ? If it is, I would also be interested with some explanation on why it is conventionnal, as I find it confusing.

+",10065,,55,,4/4/2020 16:52,4/4/2020 16:52,"What does the notation $U(B,\beta) = \prod_{j =1}^n e^{-i \beta \sigma_j^x} $ mean in the context of QAOA?",,1,0,,,,CC BY-SA 4.0 +11393,2,,11392,4/3/2020 13:09,,6,,"

I think there are two ways that you could denote the same thing. The first is what is done here: +$$ +\prod_{j =1}^n e^{-i \beta \sigma_j^x} +$$ +The second is +$$ +\bigotimes_{j-1}^ne^{-i \beta \sigma^x}, +$$ +which I imagine is what you're thinking of.

+ +

In the first expression, note the subscript on the Pauli matrix. This means that it's an operator over all $n$ qubits, $$\sigma^x_j=I^{\otimes(j-1)}\otimes \sigma^x\otimes I^{\otimes(n-j)}.$$ +Hence the matrix product does make sense (and because all terms commute, we don't have to worry about ordering).

+",1837,,,,,4/3/2020 13:09,,,,2,,,,CC BY-SA 4.0 +11394,1,,,4/3/2020 15:40,,1,191,"

I am reading Nielsen and Chuang's ""Quantum Computation and Quantum Information"". One important concept about algorithms is how the number of operations scales with the length of the input. I realized I might not be getting what they actually mean by this in Exercise 5.17:

+ +

+ +

Part (1) is OK. In part (2) I think there is a typo. According to the answer to this question, it should read ""$y=\log_2 N$"" rather than just ""$\log_2 N$"". Then, what I understand the algorithm is doing in that step is computing $x=\log_2N/b$ for each $b \leq L$. These are $O(L)$ operations rather than $O(L^2)$ as it claims. Where are the other $O(L)$ operations?

+ +

I have thought perhaps these numbers don't agree because you have to take into account the number of operations required for elementary mathematical operations (see e.g. here), and computing $2^x$ takes more than one operation. But if I take into account the complexity of $2^x$, then I should also take into account the complexity of division in $x = \log_2 N/b$. Moreover, I don't think they are referring to this, because I have read all the chapters until here and I don't remember that they have explained this.

+",9895,,5955,,4/3/2020 16:55,4/3/2020 16:55,Not sure what do Nielsen and Chuang mean by number of operations,,0,3,,,,CC BY-SA 4.0 +11396,2,,11389,4/3/2020 23:40,,2,,"

I asked Sergio Boxio about this and he noted that this is discussed in the supplementary information of the Supremacy paper. In particular, Figure S47 has a plot of the speedup you get due to imbalance in the Schmidt coefficients as the rotation angle drifts:

+ +

+ +

and equations 103, 104, and 105 show how to compute the relevant coefficients:

+ +

+",119,,,,,4/3/2020 23:40,,,,1,,,,CC BY-SA 4.0 +11397,1,11421,,4/4/2020 14:33,,1,195,"

maybe you could help me a little about my calculation of a quantum pure state with purification. +I have this density matrix:

+ +

\begin{equation} +\rho= +\begin{pmatrix} +0.4489 & 0.2304 & 0.2162 & 0\\ +0.2304 & 0.2518 & 0.2399 & 0\\ +0.2162 & 0.2399 & 0.2993 & 0\\ +0 & 0 & 0 & 0 +\end{pmatrix} +\end{equation}

+ +

Then I calculated the Eigenvectors and Eigenvalues of this matrix:

+ +

Eigenvalues: +\begin{equation} +e=[0.79987375 \space\space 0.16872495 \space\space 0.03140131\space\space 0 ] +\end{equation} +Eigenvectors: +\begin{equation} +eigenvectors= +\begin{pmatrix} +0.66857314 & 0.73407551 & 0.11892473 & 0\\ +0.51561267 & -0.34235582 & -0.78545278 & 0\\ +0.53586708 & -0.58645173 & 0.60738854 & 0\\ +0 & 0 & 0 & 1 +\end{pmatrix} +\end{equation}

+ +

After that I used the formula for purification with the computational bases: +$|\Psi\rangle = \sum \sqrt{p_i} |\phi_i\rangle \otimes \lvert\psi_i\rangle$.

+ +

computational bases: +\begin{equation} +computational bases= +\begin{pmatrix} +1 & 0 & 0 & 0\\ +0 & 1 & 0 & 0\\ +0 & 0 & 1 & 0\\ +0 & 0 & 0 & 1 +\end{pmatrix} +\end{equation}

+ +

If I put this all in the equation I got this big $\Psi$

+ +

\begin{equation} +\Psi= +\begin{pmatrix} +0.59794281 \\ +0.21179379 \\ +0.09495786 \\ +0 \\ +0.65652529 \\ +-0.14062656 \\ +-0.10392167\\ +0\\ +0.10636112\\ +-0.3226337\\ +0.10763176\\ +0\\ +0\\ +0\\ +0\\ +0 +\end{pmatrix} +\end{equation}

+ +

Then I checked if the Purifiaction is correct, so I calculated the density matrix of $\Psi$ and then I traced out B and thought the result is the density matrix $\rho$, but this is my result: +\begin{equation} +\rho= +\begin{pmatrix} +0.41140921 & 0.35291256 & 0.00548653 & 0\\ +0.35291256 & 0.461601 & 0.10401436 & 0\\ +0.00548653 & 0.10401436 & 0.12698979 & 0\\ +0 & 0 & 0 & 1 +\end{pmatrix} +\end{equation}

+ +

But this isn´t equal to the density matrix $\rho$. +For the calculation of the partial trace i used the qiskit lib and Python:

+ +
import qiskit.quantum_info
+qubits=[0,1]
+rho= qiskit.quantum_info.partial_trace(psi_density,qubits)
+
+ +

My question is why I didn´t get the origin rho matrix back? Did I make a mistake with the Purity calculation? +I would be glad to get an explanation for this. +edit: For Purifiaction is used this piece of code:

+ +
w, v = LA.eig(rho)
+null_base = np.array([1,0,0,0])
+one_base = np.array([0,1,0,0])
+two_base = np.array([0,0,1,0])
+three_base = np.array([0,0,0,1])
+v_1=v[0]
+v_2=v[1]
+v_3=v[2]
+v_4=v[3]
+v_1_trans = v_1.reshape(-1,1)
+v_2_trans = v_2.reshape(-1,1)
+v_3_trans = v_3.reshape(-1,1)
+v_4_trans = v_4.reshape(-1,1)
+null_base_trans = null_base.reshape(-1,1)
+one_base_trans = one_base.reshape(-1,1)
+two_base_trans = two_base.reshape(-1,1)
+three_base_trans = three_base.reshape(-1,1)
+sum_1 = np.tensordot(v_1_trans, null_base_trans, 0) * np.sqrt(w[0])
+sum_2 = np.tensordot(v_2_trans, one_base_trans, 0) * np.sqrt(w[1])
+sum_3 = np.tensordot(v_3_trans, two_base_trans, 0) * np.sqrt(w[2])
+sum_4 = np.tensordot(v_4_trans, three_base_trans, 0) * np.sqrt(w[3])
+psi=sum_1+sum_2+sum_3+sum_4
+psi=psi.reshape(16,1)
+
+ +

so w are the eigenvalues and v are the eigenvectors. The trans variables just only make column vectors for tensordot.

+",9930,,9930,,4/5/2020 17:56,4/6/2020 7:41,Need some help with Purity calculation,,1,4,,,,CC BY-SA 4.0 +11398,1,11799,,4/4/2020 14:39,,4,117,"

I am working on a circuit for a Grover problem and during that I am trying to minimize the used QuBits.

+ +

The problem is shown in the attached image. In this case the circuit is more or less efficient but with a growing number of input bits (the x register) the ccx grows more complex (cccx, ccccx, ...) and inefficient but more importantly more qubits in y register are needed (one more for each comparison).

+ +

My primary goal is to reduce the used y-QuBits. Can someone think of such a circuit or is it already optimal (I really dont think so).

+ +

+",11571,,9006,,4/4/2020 14:53,5/1/2020 22:19,Quantum circuit CCX optimization for Grover,,1,0,,,,CC BY-SA 4.0 +11399,1,11418,,4/4/2020 15:17,,3,278,"

Recently I read thread on topological quantum computers. If I understood correctly, gates in such computers are based on ""effects"" in two dimensional spaces. Since our space is three dimensional, such topology has to be ""simulated"".

+ +

My questions are:

+ +
    +
  1. Can 2D materials (like graphene) be used for construction of topological quantum computer (i.e. to produce anyons used for computing)?
  2. +
  3. Could you please provide with link to articles on physical implementation of topological quantum computer?
  4. +
+ +
+ +

Cross-posted on Physics SE

+",9006,,9006,,4/25/2020 18:13,2/21/2022 21:06,Topological quantum computer and two dimensional materials,,2,0,,,,CC BY-SA 4.0 +11400,2,,11370,4/4/2020 16:43,,6,,"

There are many possible ways to encode data into a quantum neural network (QNN). In one of the first papers to suggest the use of variational circuits to classify data [1], the authors suggest the following general architecture for a QNN:

+ +

+ +

The circuit starts with the $|0\rangle$ state, encodes a data point $\textbf{x}$ using a circuit $S_\textbf{x}$, and transforms it using a parametrized unitary $U(\theta)$ (using rotations to encode parameters). The result of the classification is then given by the measurement of one of the qubit.

+ +

Now, what does the circuit $S_\textbf{x}$ look like? You have several possibilities, discussed and compared in a recent paper [2]. The two main ones are amplitude encoding and angle encoding.

+ +

Amplitude encoding (also called wavefunction encoding) consists in the following transformation:

+ +

$$ +S_\textbf{x}|0\rangle=\frac{1}{||\textbf{x}||}\sum_{i=1}^{2^n} x_i |i\rangle +$$

+ +

where each $x_i$ is a feature (component) of your data point $\textbf{x}$, and $\{|i\rangle\}$ is a basis of your $n$-qubit space (like $|0..00\rangle, |0..01\rangle,...,|1..11\rangle$). The advantage of this encoding is that you can store $2^n$ features using only $n$ qubits (so in the IBM case, 32 features). The disadvantage is that in general this circuit $S_{\textbf{x}}$ will have a depth of $O(2^n)$ and be very hard to construct.

+ +

Angle encoding (also called qubit encoding) consists in the following transformation:

+ +

$$ +S_{\textbf{x}} |0\rangle=\bigotimes_{i=1}^n \cos(x_i)|0\rangle + \sin(x_i)|1\rangle. +$$ +It can be constructed using a single rotation with angle $x_i$ (normalized to be in $[-\pi,\pi]$) for each qubit, and can therefore encode $n$ features with $n$ qubits (so in your case only $5$ features). But it can be very easily constructed and has a depth of only 1. Note that there is a slight variant of this encoding, referred as dense angle encoding, that can encode $2n$ features in $n$ qubits +$$ +S_{\textbf{x}} |0\rangle=\bigotimes_{i=1}^n \cos(x_{2i-1})|0\rangle + e^{ix_{2i}}\sin(x_{2i-1})|1\rangle. +$$ +by using a phase gate after each rotation.

+ +

The question of what encoding you should use and which one can provide a quantum advantage is still an open research problem, since for the moment, there's no proof or empirical evidence that QNN are useful at all for machine learning tasks.

+ +
+ +

[1] Maria Schuld, Alex Bocharov, Krysta Svore and Nathan Wiebe, Circuit-centric quantum classifiers, 2018

+ +

[2] Ryan LaRose and Brian Coyle, Robust data encodings for quantum classifiers, 2020

+",8545,,,,,4/4/2020 16:43,,,,0,,,,CC BY-SA 4.0 +11401,1,,,4/4/2020 16:52,,2,55,"

When performing a Power-Rabi experiment, e.g in superconducting circuits, we are playing a pulse to a qubit and then reading out its state by playing another pulse to a dispersively-coupled readout resonator. We are repeating this process many times for different amplitudes of the pulse to the qubit, and we can see oscillations in the averaged state of the qubit as a function of the amplitude. This is the Rabi oscillation phenomenon which is very well understood, and has a very simple mathematical model. However, it is rather weird that even though we are increasing the energy flow to the qubit, it is starting to lose energy. Since I expect energy conservation, my question is where this energy is going?

+",5811,,10480,,1/30/2021 7:02,1/30/2021 7:02,Where does the energy go in a Power Rabi experiment with superconducting circuits?,,0,0,,,,CC BY-SA 4.0 +11402,2,,11360,4/4/2020 17:09,,4,,"

You have those two mailing lists in quantum computing:

+ +
    +
  1. Quantum Computing Report, which advertises every week news and job posting from their website
  2. +
  3. Quantum Computing Institute at ORNL mailing list, with news, conferences and job postings in both academia and industry. This one is probably the closer to what you are looking for.
  4. +
+",8545,,,,,4/4/2020 17:09,,,,0,,,,CC BY-SA 4.0 +11403,2,,11390,4/4/2020 18:31,,2,,"

I agree that $Y$ is not the best notation. Actually, in the paper that I was referring in the answer there was a gate $Y$ that was doing the desired job (it was also not a self-inverse gate). I didn't use the gate from the paper, but I kept the notation. Anyway, I like more Craig Gidney's suggestion to use $H_{YZ}$ gate. I will edit my answer to replace Y gate with $H_{YZ}$ (but I will call it just $H_y$ in order to have a short name in the circuits).

+ +

Now, about the question. I tried to do implementation of the circuits with Qiskit and find out that their outputs are the same. But, firstly, note that, my definition of $Y$ gate is different from the definition mentioned in the question. Here are my notations and corresponding Qiskit implementations of those gates:

+ +

\begin{align*} +Y = \frac{1}{\sqrt{2}}\begin{pmatrix} +1 & -i \\ +1 & i +\end{pmatrix} = &u2(0, \pi/2) +\qquad +Y^{\dagger} = \frac{1}{\sqrt{2}}\begin{pmatrix} +1 & 1 \\ +i & -i +\end{pmatrix} = u2(\pi/2, \pi) \\ +&u2 = \frac{1}{\sqrt{2}}\begin{pmatrix} +1 & e^{i\varphi} \\ +e^{i\lambda} & e^{i(\varphi + \lambda)} +\end{pmatrix} +\end{align*}

+ +

Here is the code:

+ +
from qiskit import *
+import numpy as np
+
+simulator = Aer.get_backend('statevector_simulator')
+
+q = QuantumRegister(2, 'q')
+
+circuit_xz = QuantumCircuit(q)
+circuit_xz.h(q[0])
+circuit_xz.cx(q[1], q[0])
+circuit_xz.rz(np.pi / 3, q[0])
+circuit_xz.cx(q[1], q[0])
+circuit_xz.h(q[0])
+
+circuit_yy = QuantumCircuit(q)
+circuit_yy.u2(np.pi/2, np.pi, q[0])
+circuit_yy.u2(np.pi/2, np.pi, q[1])
+circuit_yy.cx(q[1], q[0])
+circuit_yy.rz(np.pi / 3, q[0])
+circuit_yy.cx(q[1], q[0])
+circuit_yy.u2(0, np.pi/2, q[0])
+circuit_yy.u2(0, np.pi/2, q[1])
+
+circuit_xz_yy = circuit_xz + circuit_yy
+circuit_yy_xz = circuit_yy + circuit_xz
+
+result_1 = execute(circuit_xz_yy, simulator).result().get_statevector(circuit_xz_yy)
+result_2 = execute(circuit_xz_yy, simulator).result().get_statevector(circuit_xz_yy)
+
+print(""The first result \n{}"".format(result_1))
+print(""\n The second result \n{}"".format(result_1))
+
+ +

And here is the output:

+ +
The first result 
+[ 0.375+0.64951905j  0.375-0.21650635j  -0.125-0.21650635j  0.375-0.21650635j]
+
+The second result 
+[ 0.375+0.64951905j  0.375-0.21650635j  -0.125-0.21650635j  0.375-0.21650635j]
+
+",9459,,,,,4/4/2020 18:31,,,,0,,,,CC BY-SA 4.0 +11404,1,,,4/4/2020 19:14,,2,60,"

I am trying to find the $T1$ coherence time for different qubits of Rigetti's quantum processor (Aspen 7) using Python. I tried using Specs() but encountered an error.

+",11572,,9006,,4/4/2020 22:17,4/4/2020 22:17,How to get the $T1$ specs for the Rigetti's quantum processor (Aspen 7),,0,1,,,,CC BY-SA 4.0 +11405,1,11407,,4/4/2020 19:48,,2,196,"

I'm working on the development of a new quantum error correction protocol that tries to maximize the coherence of the qubit. Is there a package for python, similar to qutip, that could help me in this process?

+",5065,,5955,,4/4/2020 21:27,8/2/2022 10:16,Is there quantum error correction code package for python,,2,1,,,,CC BY-SA 4.0 +11406,2,,5567,4/4/2020 21:22,,6,,"

Controlled version of $e^{iHt}$:

+

Often in the algorithms (e.g. in HHL or PEA), we want to construct not the circuit for Hamiltonian simulation $e^{iHt}$, but the controlled version of it. For this, we will use the result obtained from the previous answer. First of all, note that if we have $ABC$ circuit, where $A$, $B$ and $C$ are operators, then the controlled version of that circuit will equal $cA$ $cB$ $cC$, where $c$ denotes control version of an operator. From the previous answer we know that $e^{iHt}$ consists of $e^{iPt}$ terms, where $P$ is some Pauli product. So, for solving the problem we should find a way for constructing controlled versions of $e^{iPt}$ terms. Here is a general form for the circuit that implements any given $e^{iPt}$ and the controlled version of it (like was done similarly in this paper [1]):

+ +

where $O_i$ are gates from this set $\{I, H, H_y\}$, and they are chosen differently for each Pauli term (see the previous answer). The right circuit in the picture implements the controlled version of the $e^{iPt}$, because, if control qubit is in the $|0\rangle$ state the $R_z$ gate will not work and the rest gates will cancel each other (they are self-inverse gates).

+

When we are talking about the controlled version of the circuit we shouldn't forget about $e^{iIt}$ term (the global phase in the $e^{iHt}$). We should also construct a circuit that implements controlled version of $e^{iIt}$. Let's call it controlled-global phase ($CGP$) gate and try to implement it. The effect of $CGP$ for controlled qubit $\alpha|0_c\rangle + \beta|1_c\rangle$ acting on multi-qubit $| \psi \rangle$ state:

+

$$ CGP \left( \alpha|0_c\rangle + \beta|1_c\rangle \right) |\psi\rangle = \left( \alpha|0_c\rangle + e^{it}\beta|1_c\rangle \right) |\psi\rangle$$

+

where $t$ is the phase. This action can be done just by one Qiskit's $u1$ phase gate acting on the control qubit [2]:

+

$$u1(t) = \begin{pmatrix} 1 & 0 \\ 0 & e^{it}\end{pmatrix}$$

+

[1] J.D. Whitfield, J. Biamonte, and A. Aspuru-Guzik, +Molecular Physics, "Simulation of electronic structure Hamiltonians using +quantum computers" (2011)

+

[2] M.A. Nielsen, I.L. Chuang, Cambridge University Press New York, "Quantum Computation and Quantum Information: 10th Anniversary Edition +10th" (2011)

+",9459,,9459,,7/1/2020 17:34,7/1/2020 17:34,,,,0,,,,CC BY-SA 4.0 +11407,2,,11405,4/4/2020 21:31,,4,,"

I think that Qiskit might be able to help - it is an open source python library that has loads of different features including allowing you to write quantum circuits and run them on real quantum backends. There are some examples of performing quantum error correction using Qiskit in the textbook.

+",5955,,,,,4/4/2020 21:31,,,,0,,,,CC BY-SA 4.0 +11408,1,,,4/4/2020 22:37,,9,2794,"

For a given state $|\psi\rangle$, how would I work out $\langle\psi|Z|\psi\rangle$ ?

+ +

If I run a quantum circuit and get the counts dictionary on qiskit, I get observables in the Z basis.

+ +

For n=1 qubits, the basis states returned are $|0\rangle$ & $|1\rangle$ with the counts for each state. I would assign +1 to the counts for $|0\rangle$ and -1 to the counts for $|1\rangle$ and work out the Z expectation value.

+ +

For n=2 qubits, $|00\rangle$ & $|11\rangle$ have eigenvalues +1 and $|01\rangle$ &$|10\rangle$ have eigenvalues -1. The Z expectation value is thus [counts(00) + counts(11) - counts(01) - counts (10) ]/ shots where counts(00) is the counts returned for the $|00\rangle$ state.

+ +

This is extended to n = 3,4,5.. qubits.

+ +

My question is how do I calculate this automatically in qiskit?

+",11574,,55,,5/10/2020 7:52,5/25/2020 15:43,Qiskit - Z expectation value from counts?,,2,0,,,,CC BY-SA 4.0 +11409,1,11668,,4/4/2020 23:47,,1,984,"

I am a beginner in quantum computing. I have already computed the sat quantum solver with Grover search and then, I would like to compute the ""minimum search"" of Dür and Hoyer. My question is: Is it possible to encode a list with two registers of qubits?

+ +

If it is possible, I would like to see a general methods with explanations of how to encode a list in a quantum circuit. :)

+ +

Ref: A Quantum Algorithm for Finding the Minimum

+",10192,,55,,7/26/2020 18:07,7/26/2020 18:07,Finding minimum with Grover,,1,3,,,,CC BY-SA 4.0 +11410,1,11423,,4/5/2020 0:45,,1,379,"

It is easy to see how $\theta$ (rotation from the positive z-axis) and $\varphi$ (rotation from the positive z-axis) affect the initial state of the qubit when looking at the Bloch sphere but I have been playing around with different $\lambda$ values and can't see a clear transformation. Geometrically, how does lambda transform the state?

+",11575,,9006,,4/5/2020 6:20,4/6/2020 7:55,$\lambda$ parameter for U3 gate in qiskit Bloch sphere visualisation,,1,1,,,,CC BY-SA 4.0 +11411,2,,11408,4/5/2020 7:26,,4,,"

A function for finding the expectation value for the $Z Z ... Z$ operator. If, for example, one wants to measure the expectation value of the $Z Z I$, instead of $Z Z Z$ than z_index_list should be provided (z_index_list = [1, 2]). Note that I have used the Qiskit's ordering for Pauli labels.

+ +
def expectation_zzz(counts, shots, z_index_list=None):
+    """"""
+    :param shots: shots of the experiment
+    :param counts: counts obtained from Qiskit's Result.get_counts()
+    :param z_index_list: a list of indexes
+    :return: the expectation value of ZZ...Z operator for given z_index_list
+    """"""
+
+    if z_index_list is None:
+        z_counts = counts
+    else:
+        z_counts = cut_counts(counts, z_index_list)
+
+    expectation = 0
+    for key in z_counts:
+        sign = -1
+        if key.count('1') % 2 == 0:
+            sign = 1
+        expectation += sign * z_counts[key] / shots
+
+    return expectation
+
+ +

The cut_counts function that will work if z_index_list is provided:

+ +
def cut_counts(counts, bit_indexes):
+    """"""
+    :param counts: counts obtained from Qiskit's Result.get_counts()
+    :param bit_indexes: a list of indexes
+    :return: new_counts for the  specified bit_indexes
+    """"""
+    bit_indexes.sort(reverse=True) 
+    new_counts = {}
+    for key in counts:
+        new_key = ''
+        for index in bit_indexes:
+            new_key += key[-1 - index]
+        if new_key in new_counts:
+            new_counts[new_key] += counts[key]
+        else:
+            new_counts[new_key] = counts[key]
+
+    return new_counts
+
+ +

For the arbitrary Pauli term $P$ before $ZZ...Z$ basis measurement one can apply a unitary operator $U$, such that:

+ +

$$ \langle \psi |P| \psi \rangle = \langle \psi | U^{\dagger} ZZ...Z U | \psi \rangle$$

+ +

like was described in this answer. Note that in $P$ we can have identities, so, for example, if we have $XIY$, we will need such $U$, that $U^{\dagger} ZIZ U = XIY$.

+ +

Final notes: here I assume that we have only one ClassicalRegister. If we have more then one ClassicalRegister I guess the code should be changed. The indexes are for the measured qubits (one can do fewer measurements than the numbers of the qubits in QuantumRegister), so, in general the z_index_list (and bit_indexes) doesn't coincide with the indexes of the qubits in the QuantumRegister.

+",9459,,9459,,5/25/2020 15:43,5/25/2020 15:43,,,,12,,,,CC BY-SA 4.0 +11414,1,11424,,4/5/2020 16:09,,4,141,"

In the application of QFT for quantum phase estimation (QPE) of a unitary $\mathbf{U}$, one has to perform successive controlled operations using powers of $\mathbf{U}$. In order not to break the complexity, each of the controlled $\mathbf{U}^{2^i}$ gates must have the same complexity when applying them as $\mathbf{U}$.

+ +

Hence, if I want to apply a QPE on a gate whose circuit is known, how should I proceed? If I just concatente the circuit of $\mathbf{U}$ to itself $2^i$ times, applying $\mathbf{U}^{2^i}$ is $2^i$ times as long as applying $\mathbf{U}$, which breaks the complexity.

+ +

I've seen papers and posts about modular exponentiation, but I'm not sure this would work in my case, since I do not work modulo some whole number.

+ +

I understand that fundamentally, what I want to do is to implement a unitary which, given a state $|x\rangle\,|y\rangle$ returns the state $|x\rangle\,\mathbf{U}^x|y\rangle$, but I don't know how should I perform this.

+",10454,,9006,,4/5/2020 21:26,4/6/2020 7:59,How to implement exponentiation of a gate without breaking complexity?,,2,0,,,,CC BY-SA 4.0 +11415,1,11433,,4/5/2020 19:00,,0,149,"

I want to create a parameter dependent gate in qiskit and I need to compute some complex operations as sympy.atan2 or sympy.sin over the parameters but I don't know how

+ +

I've tried

+ +
from qiskit import *
+from qiskit.circuit import Parameter
+import sympy as sy
+x=Parameter('x')
+theta=Parameter('θ')
+phase=sy.atan2(sy.N(x)*sy.sin(theta),sy.cos(theta))
+circuit = QuantumCircuit(3,3)
+circuit.cu1(phase,0,1)
+
+ +

but I obtain

+ +
CircuitError: 'invalid param type atan2 in instruction cu1'
+
+",11581,,9459,,4/5/2020 21:19,4/6/2020 16:11,How to perform operations like sin over Qiskit parameters,,2,0,,,,CC BY-SA 4.0 +11416,2,,11414,4/5/2020 21:34,,0,,"

Partial answer:

+ +

If a operator $U$ is a single qubit rotation around axis $a$ for angle $\theta$ (denote $R_a(\theta)$) you can use additivity of such operator, i.e.

+ +

$$ +[R_{a}(\theta)]^k = R_{a}(k\theta). +$$

+ +

The same is true for global phase gate $[Ph(\theta)]^k=Ph(k\theta)$.

+ +

Overall, you only change the angle and only one gate is applied.

+",9006,,,,,4/5/2020 21:34,,,,0,,,,CC BY-SA 4.0 +11417,1,11419,,4/5/2020 23:16,,0,112,"

In a multi-qubit system I can find the amplitudes of a state and compute probabilities, $\theta$, and $\varphi$. This falls out from simulation with simple numpy arrays. For example, after application of a variety of states, I get the amplitudes for all multi-qubit state $|\psi\rangle$, eg., $|00\rangle$, $|01\rangle$, $|10\rangle$, $|11\rangle$ as 4x1 complex numpy array, representing the tensor product of my 2 qubits.

+ +

These amplitudes and phases corresponds to this display in Quirk:

+ +

+ +

However, Quirk also shows the ""local state"" - per qubit - as a bloch wireframe.

+ +

+ +

How do I compute the Bloch coordinates for this local state, eg., out of my state vector? I believe I can get $\theta$ as the $arccos$ of the measurement probability for $|0\rangle$, which I compute via projection of $|0\rangle \langle 0|$ and $|1\rangle \langle 1|$ onto the density operator of the state? But how do I get the phase?

+ +

Thanks for any pointers!

+",11582,,9459,,4/6/2020 11:35,4/6/2020 11:35,"Find local state and compute Bloch coordinates, like Quirk",,1,0,,,,CC BY-SA 4.0 +11418,2,,11399,4/6/2020 1:36,,1,,"

Microsoft has invested huge resources into engineering topological qubits. Their approach is based on topological Majorana states, which occur at the edges of a topological superconducting chain or at interfaces between such chains. For those who see these words for the first time, a quick mental representation is supplied by a ribbon, which can be twisted a number of times, either clockwise or counter-clockwise. As long as the ends of the ribbon are held fixed, the information stored in the those windings remains safe against external factors. Unfortunately, this is a classical picture that needs to be lifted to the quantum realm. Nevertheless, these ribbons are 1-dimensional and anyons usually occur in 2-dimensions. The trick is to use a network of ribbons, which can be connected and disconnected such that the windings can be passed from one ribbon to another. In fact, there is a trick called the T-junction process, which uses the coupling of three wires to reverse the order of the Majorana anyons in a wire. See

+ +

J. Alicea, Y. Oreg, G. Refael, F. v. Oppen and M. P. A. Fisher, Non-Abelian statistics and topological quantum information processing in 1D wire networks, Nature Physics 7, 412, (2011).

+ +

These exchanges of anyons supply the elementary unitary operations one uses in topological quantum computation. In any case, some news about Microsoft's efforts are highlighted here:

+ +

https://www.cnet.com/news/for-faster-quantum-computing-microsoft-builds-a-better-qubit/

+ +

The sad reality is that: ``One drawback of Microsoft's topological qubit, though, is that they're not available yet."" The word is that the effort towards a topological quantum computer has reached the point of make-or-break and we will definitely hear more news soon from Microsoft.

+ +

Lastly, a comment about graphene and 2-systems. Evidence of non-abelian anyon presence is routinely observed in the dynamics of electrons trapped at the interface between semiconductor films (quantum wells) when subjected to strong magnetic fields. However, manipulating these anyons is an entirely different task. While similar evidence was observed in graphene when subjected to strong magnetic fields,

+ +

https://www.nature.com/articles/s41567-018-0355-x

+ +

graphene is not actively researched for the purpose of topological quantum computation.

+",11555,,11555,,4/6/2020 15:32,4/6/2020 15:32,,,,4,,,,CC BY-SA 4.0 +11419,2,,11417,4/6/2020 4:30,,2,,"
    +
  1. Trace out everything except the qubit you are interested in. Do this by computing the outer product of the state of the target qubit, for each possible value of the other qubits, and summing up all those outer products. This will produce the 2x2 density matrix of the target qubit.

  2. +
  3. Get the x, y, z coordinates of the Bloch vector from the 2x2 density matrix $D$.

    + +

    $D = \begin{bmatrix} a& b^\ast\\b & 1-a \end{bmatrix}$

    + +

    $x = 2 \cdot \text{RealPart}(b)$

    + +

    $y = 2 \cdot \text{ImaginaryPart}(b)$

    + +

    $z = 2 \cdot a - 1$

  4. +
+",119,,119,,4/6/2020 6:07,4/6/2020 6:07,,,,1,,,,CC BY-SA 4.0 +11420,1,11425,,4/6/2020 7:35,,2,85,"

Suppose we are given two unitary matrices $U$ and $V$, with the following guarantee,

+ +

$$||U - V||_1 \geqslant \delta$$ +for some $\delta \geqslant 0$.

+ +

We apply an input density state $\rho$ individually to both $U$ and $V$, resulting in the output state $U\rho U^{\dagger}$ and $V\rho V^{\dagger}$ respectively. Then can we say anything about the trace norm of the output states, i.e,

+ +

$$||U\rho U^{\dagger} - V\rho V^{\dagger}||_1 \geqslant \hspace{1mm} ?$$

+",8748,,55,,10/23/2020 6:47,10/23/2020 6:47,"It two unitaries are delta apart in trace norm, then what is the trace norm of outputs states when the same input state is applied to two unitaries?",,1,4,,,,CC BY-SA 4.0 +11421,2,,11397,4/6/2020 7:41,,1,,"

The fundamental problem is that you've transposed the matrix of eigenvectors compared to what you need. Yes, as you've written it, the eigenvectors are the columns of the matrix. But I think you must be using the rows in your actual code.

+ +

One of the basic checks that I did (and this is crucial whenever you code something) is to be able to do simple test cases where you can check the output. This means knowing how everything works mathematically rather than hoping that the computer will magically take care of it for you. So, what I did when checking your code was to think about the term +$$ +\sqrt{p_1}|\phi_1\rangle|00\rangle. +$$ +This is going to yield amplitudes on the components 0000,0100 and 1000 (which are binary values 0, 4, 8), which therefore correspond to the elements of the vector 1, 5 and 9. If I can't even be bothered to calculate their actual values, I at least know that, relatively, they must have the same relation. So, if the first element of $|\phi_1\rangle$ is bigger than the second, the first element of the output must be bigger than the fifth.

+ +

Eventually, I threw this into Mathematica (there are a couple of irrelevant phases that appear in this calculation compared to yours,

+ +
rho = ({{0.4489, 0.2304, 0.2162, 0},{0.2304, 0.2518, 0.2399, 0},{0.2162, 0.2399, 0.2993, 0},{0, 0, 0, 0}});
+Eigenvalues[rho]
+{vals, vecs} = Eigensystem[rho]
+basis = IdentityMatrix[4];
+Sum[KroneckerProduct[{vecs[[i]]}, {basis[[i]]}]*Sqrt[vals[[i]]], {i, 1, 4}]
+
+ +

This gave me the answer

+ +
{-0.597943, 0.30153, 0.021074, 0., -0.461142, -0.140627, -0.139185, 0., -0.479256, -0.240892, 0.107632, 0., 0., 0., 0., 0.}
+
+ +

You'll notice that there are a few elements that match your answers, but most of them don't. I found the pattern of ones that matched quite telling (basically corresponding to the diagonal elements of the eigenvectors matrix) and, indeed, if I transpose my eigenvectors matrix, I get the answer you got (up to those irrelevant phase factors).

+",1837,,,,,4/6/2020 7:41,,,,1,,,,CC BY-SA 4.0 +11422,1,,,4/6/2020 7:51,,5,813,"

In HHL algorithm, for subroutine involving controlled rotation, after applying $R_y(\theta)$, where $\theta=2\sin^{-1}\left(\frac{C}{\lambda}\right)$ to the ancilla, the state changes to $\sqrt{1-\frac{C^2}{\lambda^2}}|0\rangle+\frac{C}{\lambda}|1\rangle.$

+

Question

+

If $\lambda=1$, then by $\sqrt{1-\frac{C^2}{\lambda^2}}|0\rangle+\frac{C}{\lambda}|1\rangle$ and choosing $C=1$, we get $\theta=\pi$. For $\lambda=2$, $\theta=\frac{\pi}{3}.$ So in general, for each $\lambda$, correspondingly there's a different $\theta$. Since we don't know eigenvalues a priori, how do we account $\theta $s for superpositon of eigenvalues?

+

With respect to the circuit here on page 5, I don't understand how the controlled rotation part works. Will this circuit work when I choose a hermitian matrix $A_{4\times 4}$ such that, one of it's eigenvalues, $\lambda_j=10\neq 2^i,i \in \mathbb{Z}$ ?

+",10368,,10368,,8/17/2020 11:12,12/28/2020 11:34,Problem with controlled rotation in HHL,,2,2,,,,CC BY-SA 4.0 +11423,2,,11410,4/6/2020 7:55,,1,,"

$\lambda$ is also a rotation around the $z$ axis. However, there is an ordering issue. There's a sequence of $z$-rotation ($\lambda$), $y$-rotation ($\theta$), $z$-rotation ($\varphi$).

+",1837,,,,,4/6/2020 7:55,,,,3,,,,CC BY-SA 4.0 +11424,2,,11414,4/6/2020 7:59,,4,,"

As a general rule, just because you can produce controlled-$U$, it does not mean that you can produce controlled-$U^{2^k}$ with the same complexity. Modular exponentiation is a very special case where it turns out that you can.

+ +

It is probably worth noting (iirc) that even if the best way of implementing controlled-$U^{2^k}$ is with $2^k$ controlled-$U$s, phase estimation in this manner still gives a square-root speed-up compared to other methods. It's just that you don't get the exponential speed-up.

+",1837,,,,,4/6/2020 7:59,,,,0,,,,CC BY-SA 4.0 +11425,2,,11420,4/6/2020 8:19,,3,,"

For the way round that you've got your inequalities, I don't think there's much that can be said. To see why, let's consider the first expression +$$ +\|U-V\|_1=\text{Tr}(\sqrt{2I-VU^\dagger-UV^\dagger}). +$$ +Now, $VU^\dagger$ is a unitary, and hence as a spectral decomposition. Let the eigenvectors be $|\lambda_i\rangle$ with eigenvalues $e^{i\lambda_i}$. $UV^\dagger$ has the same eigenvectors, with eigenvalues $e^{-i\lambda_i}$. Hence, the expression simplifies to +$$ +\|U-V\|_1=2\sum_i\left|\sin\frac{\lambda_i}{2}\right|\geq\delta. +$$ +Note that this doesn't tell us anything about an individual $\lambda_i$ (whereas if the inequality were the other way around, we'd know that $\sin\frac{\lambda_i}{2}\leq\delta$ for all $i$). In particular, there could be an $i$ such that $\lambda_i=0$. Let's call this particular vector $|\Lambda\rangle$.

+ +

Next, consider the final calculation you want +$$ +\|U\rho U^\dagger-V\rho V^\dagger \|=\|\rho-U^\dagger V\rho V^\dagger U\|. +$$ +It should now be clear that if $\rho=|\Lambda\rangle\langle\Lambda |$, this value is 0. Actually, it is for any eigenvector, or mixture of eigenvectors, of $VU^\dagger$. Since 0 is always the minimum value, there's clearly no non-trivial lower bound.

+ +
+ +

Having started to think about the follow-up comment, there's an even stronger example of why you can't get anything useful. Let $V=e^{i\theta} U$. Obviously, $\|U\rho U^\dagger-V\rho V^\dagger \|=0$, while $\|U-V\|_1=2N\left|\sin\frac{\theta}{2}\right|$ for $N\times N$ matrices.

+",1837,,1837,,4/6/2020 9:28,4/6/2020 9:28,,,,3,,,,CC BY-SA 4.0 +11426,1,11427,,4/6/2020 8:30,,2,580,"

I have the following simple quantum circuit: +

+ +

This outputs are 00 and 11 for the two qubits. Using matrices, I have applied the H gate to the first qubit (ket 0):

+ +

$\frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\ 1&-1\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix}=\begin{pmatrix}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\end{pmatrix}$

+ +

Is this right? Moreover, I don't understand how to apply the Controlled Not to to resulting matrix. I assume it's applied to a product basis state of the resulting:

+ +

$\begin{pmatrix}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\end{pmatrix}$ and $\begin{pmatrix}0\\1\end{pmatrix}$

+ +

I would be grateful for any help on continuing this, and if anyone could point out if I am wrong with my previous calculations. I appreciate the help in advance.

+",11586,,45,,4/6/2020 21:27,4/6/2020 21:27,Trying to use matrices for Hadamard and Controlled Not gates,,1,0,,,,CC BY-SA 4.0 +11427,2,,11426,4/6/2020 8:50,,2,,"

The application of Hadamard gate on the first qubit is correct.

+ +

Since CNOT is two qubit gate, it has to be described by matrix 4x4, so far you have only 2x2 matrix. However, there is a identity operator $I$ described by unit matrix on the second qubit. Hence the first step in you circuit can be described by matrix $H \otimes I$. Resulting matrix is of type 4x4. Now, you can apply CNOT gate.

+ +

So, first step is

+ +

$$ +H \otimes I = \frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 0 & 1 & 0 \\ +0 & 1 & 0 & 1 \\ +1 & 0 & -1 & 0 \\ +0 & 1 & 0 & -1 \\ +\end{pmatrix}. +$$

+ +

Second step is CNOT gate +$$ +CNOT= +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0 \\ +\end{pmatrix}. +$$

+ +

The whole circuit is described by matrix

+ +

$$ +CNOT(H \otimes I)= \frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 0 & 1 & 0 \\ +0 & 1 & 0 & 1 \\ +0 & 1 & 0 & -1 \\ +1 & 0 & -1 & 0 \\ +\end{pmatrix}. +$$

+ +

If you apply the circuit on input $|00\rangle$ you will get state

+ +

$$ +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 \\ +0 \\ +0 \\ +1 \\ +\end{pmatrix}. +$$

+ +

This is so-called Bell state $\beta_{00}$. If you set inputs $|01\rangle$, $|10\rangle$ or $|11\rangle$, you will get different Bell states.

+ +
+ +

EDIT: a manual how to compute tensor product mechanically

+ +

Based on comments below, here is a manual how to computer tensor product:

+ +

+",9006,,9006,,4/6/2020 10:31,4/6/2020 10:31,,,,16,,,,CC BY-SA 4.0 +11428,2,,11422,4/6/2020 9:16,,4,,"

You don't know the eigenvalues a priori, but you have performed phase estimation, and have (at least a good approximation to) your eigenvalues recorded on a register. If you control off that register, you can use it to decide the angle of the rotation for each eigenvector.

+",1837,,,,,4/6/2020 9:16,,,,8,,,,CC BY-SA 4.0 +11429,2,,11415,4/6/2020 11:35,,0,,"

I think these gates only accept float or np.float as a parameter. Try casting to one of these types, for example phase = float(phase) and it should work.

+",5955,,,,,4/6/2020 11:35,,,,0,,,,CC BY-SA 4.0 +11430,1,11503,,4/6/2020 12:57,,2,99,"

In the paper Quantum Observables for continuous control of the Quantum Approximate Optimization Algorithm via Reinforcement Learning, an Hamiltonian is defined in order to solve the MAXCUT problem :

+ +

$$ C = \sum_{<i,j>} \frac{1}{2} (I -\sigma_i^z \sigma_j^z) = \sum_{<i,j>} C_{i,j} $$

+ +

with $\sigma_j^z$ the pauli matrix $\sigma^z$ applied to the $j^{th}$ qubit. The sum is taken over all adjacent edge in the original graph problem.

+ +

The paper indicates the following result :

+ +

$$ \lim_{p \rightarrow \infty} [\max_{\beta,\gamma} \langle \beta,\gamma |_p C | \beta,\gamma \rangle_p] = \max C $$.

+ +

consider $|\beta,\gamma \rangle_p$ some states produced by the QAOA algorithm and $p$ an integer, their value do not matter for my question.

+ +

The quantity $\max_{\beta,\gamma} \langle \beta,\gamma |_p C | \beta,\gamma \rangle_p$ is clearly scalar, whereas I can't make sense of the expression $\max C$.

+ +

My question is then, what does $\max C$ means in this context ?

+ +

I believe the answer is not given in this paper. I might have the answer from this documentation, where it is said that the Hamiltonian is constructed from the classical function,

+ +

$$C(z_1,...,z_n) = \sum_{<i,j>} \frac{1}{2} (1 -z_i z_j)$$

+ +

Where the sum is taken over all adjacent edges in the original graph problem, with $z_i = 1$ if $z_i \in S$ or $z_i = -1$ if $z_i \in \bar{S}$ (same for $z_j$) with $S$ and $\bar{S}$ the bipartition of the original graph. +I believe the authors of the first paper I linked were referring to this classical function and not to the Hamiltonian when speaking about $\max C$.

+ +

My second guess is that it might refers to some matrix norms but none is defined in the article. +What do you think ?

+",10065,,10065,,4/6/2020 13:39,4/11/2020 18:53,What does the maximum of a Hamiltonian means (in a particular paper)?,,1,4,,,,CC BY-SA 4.0 +11431,1,,,4/6/2020 15:14,,0,64,"

I have a question concerning the placement of quantum circuits on Google devices. Consider the following code:

+ +
import cirq
+q           = [cirq.LineQubit(x) for x in range(5)]
+circuit     = cirq.Circuit(cirq.CNOT.on(q[0],q[3]), cirq.CNOT.on(q[1],q[4]))
+line        = cirq.google.line_on_device(cirq.google.Bristlecone, length=5)
+circuit_opt = cirq.google.optimized_for_xmon(circuit=circuit, new_device=cirq.google.Bristlecone, qubit_map=lambda i: line[i.x])
+simulator   = cirq.Simulator()
+result = simulator.run(circuit, repetitions=1024)
+
+ +

This ad comparable codes yields the error

+ +
ValueError: Non-local interaction: cirq.CZ.on(cirq.GridQubit(0, 5), cirq.GridQubit(1, 7)).
+
+ +

Does Cirq provide a mechanism to automatically place (and route) a generic algorithm in the qubits 0..5 onto a concrete lattice structure?

+ +

Thanks in advance, Matthias

+",11588,,,,,4/6/2020 16:22,Placement of quantum circuits,,1,0,,,,CC BY-SA 4.0 +11432,1,11461,,4/6/2020 16:00,,0,92,"

In order to build a custom noise model in Qiskit Aer, I requested the error parameters from different backends and got 3 (9) parameters for each single-qubit (two-qubit) gate as output. However, I could not find any documentation of what these numbers are actually specifying. Based on a previous stack-exchange question about Qiskit's basic_device_noise_model(), I would guess that the first parameter is giving the gate fidelity. Is this true? What are the other 2 (8) numbers specifying?

+ +

Here is an example for a single-qubit (id) and a two-qubit (cx) gate from the backend orense:

+ +
   {'type': 'qerror',
+   'operations': ['id'],
+   'instructions': [[{'name': 'id', 'qubits': [0]}],
+    [{'name': 'z', 'qubits': [0]}],
+    [{'name': 'reset', 'qubits': [0]}]],
+   'probabilities': [0.9996936442814689,
+    5.460519336879117e-05,
+    0.0002517505251623531],
+   'gate_qubits': [[0]]},
+
+   {'type': 'qerror',
+   'operations': ['cx'],
+   'instructions': [[{'name': 'id', 'qubits': [1]}],
+    [{'name': 'z', 'qubits': [0]}],
+    [{'name': 'reset', 'qubits': [0]}],
+    [{'name': 'z', 'qubits': [1]}],
+    [{'name': 'z', 'qubits': [0]}, {'name': 'z', 'qubits': [1]}],
+    [{'name': 'reset', 'qubits': [0]}, {'name': 'z', 'qubits': [1]}],
+    [{'name': 'reset', 'qubits': [1]}],
+    [{'name': 'z', 'qubits': [0]}, {'name': 'reset', 'qubits': [1]}],
+    [{'name': 'reset', 'qubits': [0]}, {'name': 'reset', 'qubits': [1]}]],
+   'probabilities': [0.9893181752693058,
+    0.0004106923127677822,
+    0.001895703775229592,
+    0.002657456705309657,
+    1.1031810267579292e-06,
+    5.092144099539429e-06,
+    0.005698491726413379,
+    2.365595624250726e-06,
+    1.0919290223224507e-05],
+   'gate_qubits': [[0, 1]]},
+
+",11589,,55,,10/23/2020 6:47,10/23/2020 6:47,Error parameters from Qiskit backends,,1,0,,,,CC BY-SA 4.0 +11433,2,,11415,4/6/2020 16:11,,0,,"

This isn't supported in qiskit-terra yet with parametrized circuits. There is an open issue to add support for adding a parameter sweep with trig functions here:

+ +

https://github.com/Qiskit/qiskit-terra/issues/3908

+",5529,,,,,4/6/2020 16:11,,,,0,,,,CC BY-SA 4.0 +11434,2,,11431,4/6/2020 16:22,,1,,"

There is currently no code in cirq that attempts to rewrite connectivity-violating operations into a series of connectivity-satisfying operations. The reasoning for not including this functionality is basically that it is expected that any such rewriting step will produce a circuit that is longer than any realistic noise budget.

+ +

There are tools that work with cirq that do what you want, such as pytket.

+",119,,,,,4/6/2020 16:22,,,,0,,,,CC BY-SA 4.0 +11435,1,11444,,4/6/2020 16:29,,3,76,"

In the paper Valley qubit in Gated MoS$_2$ monolayer quantum dot, a description of how a $NOT$ gate would be performed on a qubit in the described device is given.

+ +

The authors say that in the described implementation the operation performed is an $iNOT$ gate, and that the Hadamard operation can be implemented by performing half of the $iNOT$ Rabi transition. Particularly, the authors say that $H = e^{i\pi/4}\sqrt{iNOT}$, (actually they say $H = e^{i\pi/4}\sqrt{NOT}$, but I assume this is a typo).

+ +

Most generally, my question is: Does $H = e^{i\pi/4}\sqrt{iNOT}$? I cannot work it out.

+ +

My confusion may stem from my lack of understanding concerning why the implemented operation corresponds to $iNOT$ instead of simply $NOT$. My understanding is that $iNOT = i\sigma_x$. I'd appreciate any insight you have on this as well. Thank you.

+",4943,,9006,,4/6/2020 21:36,4/7/2020 7:26,$H = e^{i\pi/4} \sqrt{iNOT}$?,,1,0,,,,CC BY-SA 4.0 +11436,1,,,4/6/2020 17:05,,9,438,"

One of the main applications of VQE is its application to find the approximation to the ground state energy (smallest eigenvalue of the Hamiltonian) for a particular molecule through an iterative method.

+

To be able to do this, we first need to write the Hamiltonian of the molecule in the second quantization form: +$$ H_{fer} = \sum h_{pq} a_p^\dagger a_q + \sum h_{pqrs} a_p^\dagger a_q^\dagger a_r a_s $$ +then we map $H_{fer}$ to $H_{qubit}$ by one of the maps (JW, parity, BK) so it's easier to calculate the expectation value. That is

+

$$H_{fer} = \sum h_{pq} a_p^\dagger a_q + \sum h_{pqrs} a_p^\dagger a_q^\dagger a_r a_s \rightarrow H_{qubit} = \sum_{i\alpha} h^i_\alpha \sigma^i_\alpha + \sum_{ij\alpha \beta} h_{\alpha \beta}^{ij}\sigma_\alpha^i \sigma_\beta^j + ... $$

+

I understand that the set $\{\sigma^i\}^{\otimes n}$ forms a basis for an $n \times n$ Hermitian operator so it's reasonable to consider the map from $H_{fer}$ to $H_{qubit}$

+

However, the advantage of VQE is to be able to find the min energy in an efficient manner, and to be able to do that one needs to evaluate the expectation value of $H_{qubit}$, that is, $\langle H_{qubit} \rangle$. To be able to do this, you must make sure that $H_{qubit}$ has an efficient decomposition. That is, you don't want to use all $4^n$ terms to describe the Hamiltonian... since this will kill off all the efficiency you want to achieve.

+

So my question is, how do we know that we can always write the Hamiltonian for a particular system in the Pauli matrices basis using only polynomial terms? It turns out that this is true for electronic structure Hamiltonian for a molecule, but why?

+

Given some arbitrary physical system, how do I know whether I can write out a specific Hamiltonian for that system in a polynomial number of terms for the Pauli decomposition? Can you give me an example where this is not the case?

+",9858,,15408,,4/8/2021 14:06,9/6/2021 18:29,Decomposing Hamiltonian into qubit model representation,,2,1,,,,CC BY-SA 4.0 +11437,1,11440,,4/6/2020 19:10,,5,363,"

I recently had an assignment where the question is based on the assumption that we can write any pure state qubit $|\phi \rangle$ as: + $$|\phi \rangle = \gamma |\psi\rangle + \delta |\psi^\perp \rangle$$ +Where $|\psi\rangle$ and $|\psi^\perp \rangle$ are 2 antipodal points on the Bloch sphere: +$$ |\psi\rangle = \cos \frac{\theta}{2} |0\rangle +e^{i\varphi}\sin \frac{\theta}{2} |1\rangle$$ +$$ |\psi^\perp\rangle = \cos \frac{\theta + \pi}{2} |0\rangle +e^{i\varphi}\sin \frac{\theta + \pi}{2} |1\rangle$$

+ +

I have a lingering question about how this actually works. So far I got: +$$|\phi\rangle= \gamma |\psi\rangle + \delta |\psi^{\perp}\rangle$$ +$$= \gamma \left(\cos \frac{\theta}{2} |0\rangle +e^{i\varphi}\sin \frac{\theta}{2} |1\rangle \right) + \delta \left(\cos \frac{\theta + \pi}{2} |0\rangle +e^{i\varphi}\sin \frac{\theta + \pi}{2} |1\rangle \right)$$ +$$ = \left(\gamma \cos \frac{\theta}{2} + \delta \cos \frac{\theta + \pi}{2}\right)|0\rangle + + \left(\gamma e^{i\varphi}\sin \frac{\theta}{2} + \delta e^{i\varphi} \sin \frac{\theta + \pi}{2}\right)|1\rangle$$ +$$\Rightarrow \alpha = \gamma \cos \frac{\theta}{2} + \delta \cos \frac{\theta + \pi}{2}$$ +$$\Rightarrow \beta = \gamma e^{i\varphi}\sin \frac{\theta}{2} + \delta e^{i\varphi} \sin \frac{\theta + \pi}{2}$$ +So $\alpha^2 + \beta^2 = 1$. I'm not sure if I can solve this equation. I wonder if it's solvable or is there a better way to go about understanding writing a pure state in $|\psi\rangle$ and $|\psi^\perp \rangle$ basis. I know that they are orthonormal so intuitively it should work.

+",11520,,11520,,4/6/2020 19:20,4/7/2020 16:01,Represent a pure state in terms of 2 antipodal points on the Bloch sphere,,1,9,,,,CC BY-SA 4.0 +11438,1,11439,,4/6/2020 19:17,,3,284,"

In last year‘s conference ""Quantum For Business 2019"" Iordanis Kerenidis gave a nice talk about quantum machine learning.

+ +

At about time 27:10 he mentions a ""Quantum Data loader"" as an alternativ for QRAM. To me it sounds very concrete but I can not find any reference for it. Has somebody any details about it or did I get this wrong? +I have looked at arxiv papers 1911.01117 and 1812.03584, that he probably referred to in his talk. But these seem to use QRAM explicitely.

+",11587,,,,,4/6/2020 19:57,"QML: ""Quantum Data loader"" instead of QRAM?",,1,2,,,,CC BY-SA 4.0 +11439,2,,11438,4/6/2020 19:57,,2,,"

He generally refers to QRAM. But there are other ways to load data in a quantum computer, generally referred as quantum embeddings or quantum feature maps. They are generally more near-term oriented than QRAM. Yet with a QRAM, you can design an algorithm with the goal of obtaining a possible expression of a speedup against a classical version. +This article, and this one are examples/references you can learn about quantum embeddings and quantum feature maps.

+",4127,,,,,4/6/2020 19:57,,,,1,,,,CC BY-SA 4.0 +11440,2,,11437,4/6/2020 22:24,,3,,"

Two antipodal states in the Bloch sphere (note that $0 \leq \theta \leq \pi$):

+ +

\begin{equation} +|\psi \rangle = \cos \frac{\theta}{2} |0 \rangle + e^{i\varphi}\sin \frac{\theta}{2} |1 \rangle +\\ +|\psi^\perp \rangle = \cos \frac{\pi - \theta}{2} |0 \rangle + e^{i\varphi + \pi}\sin \frac{\pi - \theta}{2} |1 \rangle = \sin \frac{\theta}{2} |0 \rangle - e^{i\varphi}\cos \frac{\theta}{2} |1 \rangle +\end{equation}

+ +

The expression for $|\psi^\perp \rangle$ from the question is different from this $|\psi^\perp \rangle$ by a global phase. The reason why I prefer this notation is that I want to keep Bloch sphere formalism (e.g. $0 \leq (\pi - \theta) \leq \pi$ constrant that is true for $|\psi^\perp \rangle$ presented here). Note that:

+ +

$$\langle \psi | \psi^\perp \rangle = \cos \frac{\theta}{2} \sin \frac{\theta}{2} - \sin \frac{\theta}{2} \cos \frac{\theta}{2} = 0$$

+ +

By doing the same calculations we can obtain for $|\phi\rangle= \gamma |\psi\rangle + \delta |\psi^{\perp}\rangle = \alpha |0\rangle + \beta |1\rangle$:

+ +

\begin{align*} +&\alpha = \gamma \cos \frac{\theta}{2} + \delta \sin \frac{\theta}{2} +\\ +&\beta = \gamma e^{i\varphi}\sin \frac{\theta}{2} - \delta e^{i\varphi} \cos \frac{\theta}{2} +\end{align*}

+ +

Then (here I take into account that $|e^{i\varphi}| = 1$):

+ +

\begin{equation} +|\alpha|^2 = |\gamma|^2 \cos^2 \frac{\theta}{2} + |\delta|^2 \sin^2 \frac{\theta}{2} ++ 2 Re(\gamma) Re(\delta) \cos \frac{\theta}{2}\sin \frac{\theta}{2} + + 2 Im(\gamma) Im(\delta) \cos \frac{\theta}{2}\sin \frac{\theta}{2} +\end{equation}

+ +

\begin{equation} +|\beta|^2 = |\gamma|^2 \sin^2 \frac{\theta}{2} + |\delta|^2 \cos^2 \frac{\theta}{2} - 2Re(\gamma) Re(\delta)\cos \frac{\theta}{2} \sin \frac{\theta}{2} - 2Im(\gamma) Im(\delta)\cos \frac{\theta}{2} \sin \frac{\theta}{2} +\end{equation}

+ +

Because if we have two complex numbers $z_1 = x_1 + i y_1$ and $z_2 = x_2 + i y_2$, then:

+ +

$$|z_1 \pm z_2|^2 = (x_1 \pm x_2)^2 + (y_1 \pm y_2)^2 = |z_1|^2 + |z_2|^2 \pm 2 x_1 x_2 \pm 2 y_1 y_2$$

+ +

After summing the expressions for $|\alpha|^2$ and $|\beta|^2$ we will obtain:

+ +

$$|\alpha|^2 + |\beta|^2 = \left(|\gamma|^2 + |\delta|^2 \right) \left(\sin^2 \frac{\theta}{2} + \cos^2 \frac{\theta}{2} \right) =1$$

+",9459,,9459,,4/7/2020 16:01,4/7/2020 16:01,,,,5,,,,CC BY-SA 4.0 +11441,1,11443,,4/7/2020 5:20,,1,87,"

+I made a simple circuit that we can see. In my view, $|00000\rangle$ should appear in one result, but I didn't see it. why? +

+",8745,,9006,,4/7/2020 7:05,4/7/2020 7:05,"I made a simple circuit on qiskit,but I have some question on this result",,1,0,,,,CC BY-SA 4.0 +11442,1,,,4/7/2020 5:38,,1,307,"

I have installed qiskit through my terminal using pip3 install qiskit. But when I try to import all from it in my coding software, it returns a ModuleNotFound error:

+ +

+ +

When i try to install it in interpreter settings, this error message returns:

+ +

+",11594,,9006,,4/7/2020 5:42,5/30/2020 10:49,Qiskit not installing properly on pyCharm CE,,0,3,,,,CC BY-SA 4.0 +11443,2,,11441,4/7/2020 7:05,,1,,"

The problem is that IBM Q environment does not show all results in case there is more than 16 results (there is maximally 20 columns in the histogram). To get all results, you have to click on Download in the top right corner of a page with results. Two files with extension *.json are downloaded. Then open file ending with _results.json in notepad and look for string results. There will be something like this:

+ +
""results"":[{""data"":{""counts"":""{""0x0"":27,""0x1"":33,""0x10"":36,""0x11"":41,""0x12"":21,""0x13"":32,
+
+ +

Instead of binary numbers, the results are expressed in hexadecimal format.

+ +

The result for state $|00000\rangle$ you were looking for is

+ +
""0x0"":27
+
+ +

This means the number of occurences of $|00000\rangle$ is 27 (I used 1,024 shots).

+",9006,,,,,4/7/2020 7:05,,,,5,,,,CC BY-SA 4.0 +11444,2,,11435,4/7/2020 7:26,,4,,"

It cannot be the case that $H=e^{i\pi/4}\sqrt{iNOT}$. Whatever your interpretation of $iNOT$ (I'd agree with your definition), just square the thing. $H^2=I$, the identity, and so it is certainly not the case that +$$ +I=e^{i\pi/2}iNOT. +$$

+ +

It is true, however, that if you perform the sequence that would give you an operation such as $NOT$ or $iNOT$, and you only evolve for half the time, that gives you something that achieves an equivalent result to the Hadamard. It's usually referred to as a beam-splitter. For example, if a theorist writes about a Mach-Zehnder interferometer, they usually write down a sequence of Hadamard - phase - Hadamard, whereas an experimentalist will use beam splitter - phase - beam splitter. It achieves the same practical task (e.g. identify if the phase is 0 or $\pi$) although the interpretation of the results is different as which output is which gets switched.

+",1837,,,,,4/7/2020 7:26,,,,0,,,,CC BY-SA 4.0 +11445,1,11446,,4/7/2020 9:27,,3,296,"

I've read C-NOT gate entangles qubits, but is it only for C-NOT or any arbitrary CU gate (apart from the likes if CI) entangles qubits?

+",10366,,55,,7/26/2020 17:52,7/26/2020 17:52,Does Controlled-U gate entangle qubits?,,1,2,,,,CC BY-SA 4.0 +11446,2,,11445,4/7/2020 9:52,,10,,"

For any controlled-$U$, if the input state is $|+\rangle|\phi\rangle$ where $|\phi\rangle$ is not an eigenstate of $U$, then the output state is entangled. This immediately deals with trivial cases such as $U=I$ because in that case all states $|\phi\rangle$ are eigenstates, and so it is not entangling. For any other $U$, there is an input state that is separable that is mapped to an entangled state, and hence controlled=$U$ is entangling for any $U\neq I$.

+ +

Proof: Let $|\phi\rangle=\sum_ia_i|\lambda_i\rangle$, where $|\lambda_i\rangle$ are the distinct eigenvectors of $U$. Your gate then evolves +$$ +|+\rangle|\phi\rangle\mapsto\frac{1}{\sqrt{2}}|0\rangle|\phi\rangle+\frac{1}{\sqrt{2}}|1\rangle\sum_ia_ie^{i\lambda_i}|\lambda_i\rangle. +$$ +Since $\sum_ia_ie^{i\lambda_i}|\lambda_i\rangle$ is not proportional to $|\phi\rangle$ (under the assumption that the phases $e^{i\lambda_i}$ are distinct and there are at least two non-zero $a_i$), the state is entangled because it is not a product state.

+",1837,,,,,4/7/2020 9:52,,,,0,,,,CC BY-SA 4.0 +11447,1,11449,,4/7/2020 17:09,,3,178,"

I have been reading the book by Michael A Nielsen and Isaac Chuang and came across the principle of deferred measurement. They showed using this principle how the circuit for quantum teleportation can be changed and measurements taken at last. But wouldn't this imply that we don't need to pass classical information that would make the receiver take the necessary action for transportation of the circuit as it has already happened no matter the outcome of measurement of the first two qubits? Wouldn't that imply that information can be transferred faster than light as there is no need for passing of classical information?

+",11603,,16606,,6/4/2022 12:47,6/4/2022 12:47,Does principle of deferred measurement imply information can travel faster than light?,,1,0,,,,CC BY-SA 4.0 +11448,2,,6962,4/7/2020 17:39,,5,,"

Right, they are quite similar. The Holevo bound is a bound on the amount of accessible information between your quantum system and your classical system. The I(X;B) object written in the HSW theorem wikipedia page is actually this bound, while the $\chi$ there is the Holevo rate, or product state capacity. What HSW showed was that if you took many copies of a system, the asymptotic many system rate of accessible information across a quantum channel can be made to approach the single state Holevo bound.

+ +

Interestingly, Hastings showed that the many state Holevo bound is actually even higher than the single state bound, meaning that the HSW theorem does not demonstrate the ""true"" Holevo bound to be saturated.

+",11604,,,,,4/7/2020 17:39,,,,0,,,,CC BY-SA 4.0 +11449,2,,11447,4/7/2020 17:45,,5,,"

I think faster than light communication is more stubborn than that :-)

+ +

The principle of deferred measurement, to quote Nielsen and Chuang, page 186, is

+ +
+

Measurements can always be moved from an intermediate stage of a quantum circuit to the end of the circuit; if the measurement results are used at any stage of the circuit then the classically controlled operations can be replaced by conditional quantum operations.

+
+ +

To convert teleportation circuit to a measurement-free version, you need to replace fixups applied by Bob based on Alice's measurement results by controlled X and Z gates applied to his qubit with Alice's qubits as controls (as shown in a circuit on page 187). I believe an implementation of controlled gates acting on qubits separated by a significant physical distance (which is a premise of teleportation when discussed in the context of faster-than-light communication) is going to involve some kind of information transfer. If the qubits are close enough to allow applying two-qubit gates to them, we could have just done a SWAP between message qubit and Bob's qubit, without going through all the trouble.

+",2879,,,,,4/7/2020 17:45,,,,1,,,,CC BY-SA 4.0 +11450,1,11542,,4/7/2020 21:04,,3,529,"

There was a similar question asked here, but I feel like mine is even more basic.

+ +

What's the easiest way to implement a circuit $U$ corresponding to a matrix-vector multiplication modulo 2?

+ +

$$ +|x_1x_2x_3\ldots x_n\rangle \mapsto |y_1y_2y_3\ldots y_n\rangle=U|x_1x_2x_3\ldots x_n\rangle +$$ +where +$$ +\begin{pmatrix} +y_1 \\ y_2 \\ y_3 \\ \ldots \\ y_n +\end{pmatrix} += M +\begin{pmatrix} +x_1 \\ x_2 \\ x_3 \\ \ldots \\ x_n +\end{pmatrix} \mod 2 \ . +$$ +Matrix $M$ entries are $0$ and $1$, the multiplication is done modulo 2.

+ +

UPDATE

+ +

The optimal solution in given here.

+ +

For a simple solution see my answer below.

+",6313,,282,,4/14/2020 7:48,4/14/2020 7:48,Matrix mod 2 multiplication,,1,0,,,,CC BY-SA 4.0 +11451,1,11456,,4/7/2020 21:07,,1,48,"

On Wikipedia, one can read the following about Quantum Phase Estimation:

+ +
+

the algorithm estimates the value of $\theta$ with high probability within additive error $\varepsilon$, using $O(1/\varepsilon )$ controlled-$U$ operations.

+
+ +

Why do we need so much qubits? What we want is a $t$-qubits string such that it is equal to the $t$ first bits in the binary writing of $\theta$. We also want this binary writing to be at most at $\varepsilon$ from the true value. Hence, we have that:

+ +

$$\left|\sum_{n=t+1}^{+\infty}\theta_n\,2^{-n}\right|\leqslant\frac{\varepsilon}{2}$$

+ +

In the worst case, both terms are equal and all $\theta_n$ are $1$. Hence, we have:

+ +

$$\sum_{n=t+1}^{+\infty}2^{-n}=\frac\varepsilon2\iff2^{-t}=\frac\varepsilon2\implies t=1+\left\lceil\log_2\left(\frac1\varepsilon\right)\right\rceil$$.

+ +

Hence, we would have $O(\log(1/\varepsilon))$ controlled operations, since we have as much operations as qubits in the first register. Is it Wiki that is wrong, or my calculations?

+ +

Side question: is it some sort of convention to write $O(1/\varepsilon)$ rather than $O\left(\frac1\varepsilon\right)$? I only see the former written, while I find the latter less ambiguous.

+",10454,,,,,4/8/2020 6:09,Why is the number of qubits linear in the inverse of epsilon in Quantum Phase Estimation?,,1,0,,,,CC BY-SA 4.0 +11453,1,,,4/7/2020 21:48,,2,126,"

In the Quantum Recommendation Systems paper, the authors use the Quantum Phase Estimation algorithm in a way that is slightly different from what I've seen so far.

+ +

This is how it is described:

+ +
+

The analysis of phase estimation shows that the algorithm outputs a discrete valued estimate for each eigenvalue that is within additive error $\varepsilon$ with probability at least $0.8$, the probability is boosted to $1 − 1/\mathrm{poly}(n)$ by repeating $O(\log n)$ times and choosing the most frequent estimate.

+
+ +

Given that if we choose an additional number of qubits equal to $3$, the probability that the QPE outputs the correct state is $\frac{11}{12}\approx0.91$, I can use this number of qubits to implement the QPE. The problem is that I have to measure the state to store it in classical memory and thereafter re-building the most frequent one. Hence, I have to reset the output state to $|0\rangle^{\otimes t}$ to apply it once again. But from the no-deleting theorem, I cannot apply some unitary that will map this arbitrary state to $|0\rangle^{\otimes t}$. I can't either use the uncompute trick because of the measurement.

+ +

My idea was, since I know the state this register is currently in, I can add $X$ gates wherever a qubit is in the $|1\rangle$ state. But this means that I would have to add gates in the circuit ""at runtime"", that is:

+ +
    +
  • Performing QPE
  • +
  • Measuring state
  • +
  • Apply X gates accordingly
  • +
  • Repeat
  • +
+ +

Is it realistic? If it is not, what other options do I have to perform such a computation?

+",10454,,,,,4/7/2020 21:48,Repeating Quantum Phase Estimation algorithm,,0,0,,,,CC BY-SA 4.0 +11454,1,,,4/8/2020 1:04,,1,52,"

How qubit phase is build in real hardware?

+ +

On IBM Quantum, D-Wave, etc?

+",8491,,9006,,4/8/2020 4:09,4/8/2020 4:09,How qubit phase is build in real hardware?,,0,0,,,,CC BY-SA 4.0 +11455,1,,,4/8/2020 3:32,,0,66,"

The command load account keeps giving the warning that it can't find a QConfig file. A search for the error message brings me to an answered question. However, this solution also doesn't work, producing the same error:

+

+

How can I solve this?

+",11614,,-1,,6/18/2020 8:31,4/8/2020 15:02,Can't load account on IBM's qiskit,,0,4,,,,CC BY-SA 4.0 +11456,2,,11451,4/8/2020 6:09,,2,,"

The statement that you’ve made about the size of the register that you use for phase estimation (the value of t) is correct. However, you don’t seem to have made any attempt to count the number of gates used in the circuit. To implement the phase estimation you need controlled-U, $U^2$, $U^4$, $U^8$, $U^{16}\ldots$ If you have to make these out of just controlled-$U$, this means using exponentially many of them (in t),

+",1837,,,,,4/8/2020 6:09,,,,1,,,,CC BY-SA 4.0 +11457,1,,,4/8/2020 6:31,,-2,64,"

+ +

Why is this so? Can someone please give me detailed steps with an explanation?

+",11616,,55,,8/19/2020 17:35,8/19/2020 17:35,"In the context of Quantum theory of Information, Typical eigenvectors are permutations of basis vectors. Why?",,1,1,,8/20/2020 7:56,,CC BY-SA 4.0 +11458,2,,11457,4/8/2020 10:47,,1,,"

If I understand your question properly, this is not a general property but it happens to be because we typically choose, in the qubit case for example, operators that anti-commute.

+ +

Let $\sigma_1$ and $\sigma_2$ be two such operators that satisfy $\sigma_i^2=I$ and +$$ +\sigma_1\sigma_2+\sigma_2\sigma_1=0. +$$ +Since they square to identity, the eigenvalues must be $\pm 1$. Now let $|\psi_{\pm}\rangle$ be the corresponding eigenvectors of $\sigma_1$ with eigenvalues $\pm1$. We see that +$$ +(\sigma_1\sigma_2+\sigma_2\sigma_1)|\psi_{\pm}\rangle=0=(\sigma_1\mp I)\sigma_2|\psi_{\pm}\rangle. +$$ +So, $\sigma_2|\psi_{\pm}\rangle$ are the 0 vectors of $\sigma_1\pm I$ respectively, and are hence eigenvectors of $\sigma_1$ with eigenvalues $\mp1$. Thus, $\sigma_2|\psi_{\pm}\rangle=|\psi_{\mp}\rangle$, which is a permutation.

+ +

It might help to visualise what's going on on the Bloch sphere. Pick an axis. Let's say the $z$ axis for the sake of argument. We do a rotation such that two rotations returns everything to the same point it started, i.e. we do a rotation half way around the Bloch sphere. So, any point on the equator is mapped to its antipodal point, corresponding to an orthogonal state. Thus, this $z$ rotation acts as a permutation for any orthogonal basis on the equator, such as the $x$ or $y$ axes.

+ +

This choice is particularly convenient in quantum information because it means that the bases mutually unbiased, which has useful properties in, for example, cryptography applications.

+",1837,,,,,4/8/2020 10:47,,,,0,,,,CC BY-SA 4.0 +11460,1,11462,,4/8/2020 15:22,,4,125,"

I am reading Quantum Computation and Quantum Information by Michael A. Nielsen & Isaac L. Chuang, and I am confused about a concept presented in Section 1.3.7: Quantum Teleportation. The book writes ""While together, Alice and Bob generated an EPR pair, each taking one qubit of the EPR +pair when they separated."" For example, if the EPR pair in question is:

+ +

$|\beta_{00}\rangle=\frac{|00\rangle+|11\rangle}{\sqrt{2}}$

+ +

How can we write mathematically what Alice and Bob each have in their possession?

+ +

This idea comes up again when quantum teleportation is applied to superdense coding in Section 2.3, where again Alice and Bob ""share a pair of qubits in the entangled state $|\beta_{00}\rangle$.

+ +

Thanks in advance!

+",11619,,,,,4/8/2020 15:29,What does it look like to split an EPR pair?,,1,0,,,,CC BY-SA 4.0 +11461,2,,11432,4/8/2020 15:25,,0,,"

Each of those dicts are a QuantumError. You can learn more about the structure of a QuantumError here. That documentation is most likely what you were looking for.

+ +

Each instruction is an operation being applied on the qubit(s) in qubits. Each value in probabilities corresponds to the respective operation in instructions.

+",6180,,,,,4/8/2020 15:25,,,,0,,,,CC BY-SA 4.0 +11462,2,,11460,4/8/2020 15:29,,4,,"

The whole point of an EPR pair is that you cannot write (without losing some information) ""This is what Alice has"" and ""This is what Bob has"". Partial descriptions can be given using reduced density matrices.

+ +

However, if you want to identify which bits Alice and Bob each have, we often use a notation like +$$ +(|0\rangle_A|0\rangle_B+|1\rangle_A|1\rangle_B)/\sqrt{2} +$$ +which helps to emphasise which ket corresponds to the qubits being held by each party.

+",1837,,,,,4/8/2020 15:29,,,,1,,,,CC BY-SA 4.0 +11463,1,,,4/8/2020 18:26,,0,592,"

I am asking this question with reference to this https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/advanced/aqua/finance/optimization/portfolio_diversification.ipynb +Happy to know new resources on portfolio optimization.

+",2566,,9006,,4/8/2020 19:49,9/18/2020 11:29,What is Ising Hamiltonian ? What its role in Portfolio Diversification?,,2,0,,,,CC BY-SA 4.0 +11464,1,11466,,4/8/2020 19:54,,3,152,"

I have implemented a simple CNOT gate using qiskit

+ +

I was expecting a the result the matrix as in the following image (extracted from wikipedia):

+ +

+ + + +
from qiskit import *
+circuit = QuantumCircuit(2, 2)
+circuit.cx(0, 1)
+simulator = Aer.get_backend(""unitary_simulator"")
+result = execute(circuit, backend=simulator).result()
+unitary = result.get_unitary()
+print(circuit.draw())
+print(unitary)
+
+ +

The results in the print are:

+ +

+ +

If you pay attention, it seems the order of the qbits is reversed. I would like to know why this happens and if it's normal because it seems confusing at first glance.

+ +

To be really clear: The matrix in the first image and the second (the result) should be the same.

+",11609,,,,,4/8/2020 20:36,Qiskit unitary representation seems shifted,,2,0,,,,CC BY-SA 4.0 +11465,2,,11464,4/8/2020 20:17,,3,,"

In Qiskit, the bits are reversed order from most textbook definitions. That is to say the zeroth qubit is the farthest to the right in a bitstring or tensor product.

+",332,,,,,4/8/2020 20:17,,,,2,,,,CC BY-SA 4.0 +11466,2,,11464,4/8/2020 20:36,,2,,"

The first matrix is generally seen in books, as you consider computational basis in the order $|0\rangle$, $|1\rangle$, $|2\rangle$, $|3\rangle$ or in bitstrings $|00\rangle$, $|01\rangle$, $|10\rangle$, $|11\rangle$. So basically, you think as $| q_0, q_1\rangle$. This is called little-endian convention.

+ +

But in Qiskit, they use the inverse, aka big-endian convention. And then you have to think that it is actually $| q_1, q_0\rangle$. And what you do is that you define $q_0$ as the control. So when $| q_1 = 1, q_0 = 0\rangle$ that is 1 in big-endian, $CNOT |10\rangle = | 10\rangle$, hence 3. Which explains your second row. +And when $| q_1 = 1, q_0 = 1\rangle$ that is 3 in big-endian, $CNOT |11\rangle = | 01\rangle$, hence 1 and explaining why you get the last row.

+ +

You can find the explanation about the CNOT in Qiskit here.

+",4127,,,,,4/8/2020 20:36,,,,0,,,,CC BY-SA 4.0 +11467,1,,,4/8/2020 20:59,,2,60,"

I was reading a forum where people were talking about a proposed quantum algorithm that solves an NP-complete problem in polynomial time. The algorithm appears to have flaws (after all, none of you have probably heard about it). One comment went like this:

+ +
+

However, there is a rather simple proof that shows that the maximum amount of amplitude which you can transfer from one component of a quantum state to another using a control qubit is fundamentally limited by the Unitarian nature of quantum operations.

+
+ +

I don't understand this comment. The writer does cite the no-cloning theorem without any mention of it. Is that citation referring to this claim? If so, i've never heard the no-cloning theorem stated this way. In any case, I want to investigate the claim.

+ +

I've devised a scenario where a control qubit (4d qudit or 2 qubits, it doesn't matter) acts on an equal superposition of two qubits.

+ +

+ +

Where the gate $G$ is

+ +

$$ +\def\a{\color{#FF33BB}{\frac{1}{2}}} +\def\b{\color{#1C3C93}{\frac{1}{6}}} +\def\c{\color{#37D717}{-\frac{5}{6}}} +$$

+ +

$ G = \begin{bmatrix} +\a &\a &\a &\a &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 \\ +\a &\c &\b &\b &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 \\ +\a &\b &\c &\b &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 \\ +\a &\b &\b &\c &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 \\ +0 &0 &0 &0 &\c &\a &\b &\b &0 &0 &0 &0 &0 &0 &0 &0 \\ +0 &0 &0 &0 &\a &\a &\a &\a &0 &0 &0 &0 &0 &0 &0 &0 \\ +0 &0 &0 &0 &\b &\a &\c &\b &0 &0 &0 &0 &0 &0 &0 &0 \\ +0 &0 &0 &0 &\b &\a &\b &\c &0 &0 &0 &0 &0 &0 &0 &0 \\ +0 &0 &0 &0 &0 &0 &0 &0 &\c &\b &\a &\b &0 &0 &0 &0 \\ +0 &0 &0 &0 &0 &0 &0 &0 &\b &\c &\a &\b &0 &0 &0 &0 \\ +0 &0 &0 &0 &0 &0 &0 &0 &\a &\a &\a &\a &0 &0 &0 &0 \\ +0 &0 &0 &0 &0 &0 &0 &0 &\b &\b &\a &\c &0 &0 &0 &0 \\ +0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &\c &\b &\b &\a \\ +0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &\b &\c &\b &\a \\ +0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &\b &\b &\c &\a \\ +0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &0 &\a &\a &\a &\a +\end{bmatrix}$

+ +

Now, assuming some other part of the circuit sets the control qudit to a given setting, $|setting\rangle = |0\rangle, |1\rangle, |2\rangle $ or $ |3\rangle$, applying the gate $G$ should have the following effect

+ +

$$ +G \Bigg[ |setting\rangle_4 \otimes \frac{1}{2} \Big( |00\rangle + |01\rangle + |10\rangle + |11\rangle \Big) \Bigg] \rightarrow $$

+ +

$$ +\begin{cases} +|setting\rangle \otimes |00\rangle, & |setting\rangle = 0 \\ +|setting\rangle \otimes |01\rangle, & |setting\rangle = 1 \\ +|setting\rangle \otimes |10\rangle, & |setting\rangle = 2 \\ +|setting\rangle \otimes |11\rangle, & |setting\rangle = 3 \\ +\end{cases} +$$

+ +

Essentially, $G$ would have the effect of sending all the amplitude to the state corresponding to $|setting\rangle$, which is precisely what the claim above places limits on due to the unitarity of quantum mechanical operators. It's easy to check that $G$ is unitary, so what is the maximum amount of amplitude transfer?

+",1867,,1867,,4/9/2020 4:04,4/9/2020 4:04,Shifting amplitude from one basis to another with a control qubit,,0,1,,,,CC BY-SA 4.0 +11468,1,,,4/8/2020 23:41,,1,78,"

In quantum circuit, how do you implement the rotation of multi-body interaction, such as $e^{-i\theta\sigma_z^1\sigma_z^2\sigma_z^3}$? I already know the case of less than two-body interaction, but I cannot find any textbook about more than three-body interaction.

+",9894,,9006,,4/9/2020 4:00,4/9/2020 4:45,Rotation of multi-body interaction in quantum circuit,,1,2,,,,CC BY-SA 4.0 +11469,1,11473,,4/9/2020 4:10,,1,254,"

Let's suppose I have a quantum channel given in the Kraus decomposition

+ +

$T(\rho) = \sum_{i} K_i \rho K_i^{\dagger} $

+ +

is there any way to put explicitly these $K_i$ in IBM quantum experience (QE) to run real experiments? Or is only possible to implement quantum channels in IBM QE by using combinations of unitary gates?

+",11626,,,,,4/9/2020 12:55,How can I implement an arbitrary quantum channel in a quantum circuit for real experiments using IBM quantum experience?,,1,0,,,,CC BY-SA 4.0 +11470,2,,11468,4/9/2020 4:45,,3,,"

Here's an image from a previous answer of mine: + +If you replace the $\sigma_1\otimes\sigma_2\otimes\ldots\otimes\sigma_n$ with the tensor product of operators that you want (a single tensor product; a sum of terms needs some extra techniques based on, at its most simplistic, a Trotter expansion), and set the phase of the phase gate, $t$ equal to $-2\theta$, this will do the job up to a global phase.

+ +

Basically, what the circuit does is it entangles the register with the ancilla such that the ancilla is in the state 0/1 or the other register is in a +1 or -1 eigenstate of the operator respectively. That means you can use the ancilla to decide if you need to acquire a phase, before undoing the entanglement.

+",1837,,,,,4/9/2020 4:45,,,,0,,,,CC BY-SA 4.0 +11471,2,,11463,4/9/2020 6:08,,1,,"

The Ising model is a formulation of your problem. Variables are variables $s_i$ that can take +1/-1 values.

+ +

$$ +\begin{equation} + \text{E}_{ising}(s) = \sum_{i=1}^N h_i s_i + \sum_{i=1}^N \sum_{j=i+1}^N J_{i,j} s_i s_j +\end{equation} +$$ +For a quantum form, we use spin operators $\sigma^z$, giving you an Ising Hamiltonian, whose eigenvalues correspond to the previous cost. What we try to achieve for minimization, is find the state $s$ minimizing the Ising model. Which corresponds to finding the minimal eigenvalue or ground state of the Hamiltonian. And this is what research/applications in combinatorial optimization using quantum computers are focusing on.

+ +

In computer science, there is a similar formulation. We use generally QUBO formulations defined on 0/1 variables $x_i$ with a matrix of coefficients $Q$: +$$ +\begin{equation} + f(x) = \sum_{i} {Q_{i,i}}{x_i} + \sum_{i<j} {Q_{i,j}}{x_i}{x_j} +\end{equation} +$$

+ +

It is very easy to go from one formulation to another, using the transformation $s = 2x - 1$. Many problems can be expressed with these two formulations such as Portfolio Optimization.

+ +

For references, you can have a look at (in addition to the notebook you point out):

+ +

Portfolio Optimization: Applications in Quantum Computing +

+ +

Ising formulations of many NP problems +

+ +

D-Wave documentation on Ising/QUBO

+",4127,,,,,4/9/2020 6:08,,,,0,,,,CC BY-SA 4.0 +11472,2,,2056,4/9/2020 10:07,,4,,"

I am not an expert but I read a few papers and here is what I have found. Similarly to NN, people found strategies to avoid this issue with the gradients.

+ +

Basically, for some problems, you can use ansatzes that are inspired by the physics of the problem itself. For example, in quantum chemistry, people use something called unitary coupled clusters. See Quantum computational chemistry and The theory of variational hybrid quantum-classical algorithms.

+ +

However, for many problems, you don't have physical insights. Then, the solution I found in the literature are the following:

+ +
    +
  • Gradually adding layers: basically you start with a low depth ansatz, optimize this one to its local minimum. Then add a layer, optimize again, add another layer etc. The idea is that lower depth ansatz is less prone to this issue. Check ""Variational quantum state diagonalization""
  • +
  • Introducing a local version of the cost function: I haven't fully understood this one, but here is the paper you can check and find more info: ""Variational Quantum Linear Solver: A Hybrid Algorithm for Linear Systems""
  • +
  • Using Hamiltonian Morphing: this method is based on the Adiabatic theorem. If you are trying to solve a linear system $Ax=b$ then you can ""evolve"" the matrix $A$ during the computation as $A(t)=(1-t/T)I+t/T \cdot A$. Where T is a fixed time and t is the time variable of the simulation. I think ""Variational algorithms for linear algebra"" explains it much better than I do.
  • +
+",11551,,9006,,4/9/2020 10:36,4/9/2020 10:36,,,,1,,,,CC BY-SA 4.0 +11473,2,,11469,4/9/2020 12:55,,1,,"

I don't think there is a general method in Qiskit that takes Kraus operators as input and run them on a real device by controlling the noise of the hardware (instead of using a larger Hilbert space for instance). In fact, there is no method to do that with arbitrary unitary gates neither (as far as I know), you need to first decompose your unitary matrix into elementary gates that have an implementation on the hardware.

+ +

So you have two possibilities to implement your channel:

+ +
    +
  • You don't mind using a larger Hilbert space (i.e. some ancilla qubits). Then you have many ways to implement your channel. But there is no general function in Qiskit to do that neither, you need to do the maths and figure out the algorithm yourself. If your Kraus operators are nice enough (for instance unitary), you can try to extend this example in your case. Otherwise, you might need to use an LCU (linear combination of unitary) decomposition or some other techniques.
  • +
  • You really want to use the intrinsic noise of the device. Then, maybe, your channel is implementable using OpenPulse, but you will need to prepare it using some quantum control and it will be hard if you don't have the background.
  • +
+",8545,,,,,4/9/2020 12:55,,,,2,,,,CC BY-SA 4.0 +11474,1,11475,,4/9/2020 13:09,,1,86,"

Let start with a multi controlled Toffoli gate. Looking at the matrix representation (in the binary base), you easily see +$$ +\pmatrix{ +1& 0& 0& 0& 0& 0& 0& 0\\ +0& 1& 0& 0& 0& 0& 0& 0\\ +0& 0& 1& 0& 0& 0& 0& 0\\ +0& 0& 0& 1& 0& 0& 0& 0\\ +0& 0& 0& 0& 1& 0& 0& 0\\ +0& 0& 0& 0& 0& 1& 0& 0\\ +0& 0& 0& 0& 0& 0& 0& 1\\ +0& 0& 0& 0& 0& 0& 1& 0\\ +} +$$ +that it only switches two states: $|111\rangle$ and $|110\rangle$. Conjugating with some $X$ gates on qubit 1 and 2 gives three more pair switches. Similar for the Fredkin gate which switches $|110\rangle$ and $|101\rangle$.

+ +
    +
  1. How to generate any of the $8\cdot 7 $ possible two level switches for three qubits out of elementary gates?

  2. +
  3. And how for general $n$?

  4. +
+ +

For the three qubit case, I tried to e.g. construct a switch of $|000\rangle \leftrightarrow |111\rangle$ by mapping $|110\rangle \mapsto |000\rangle$. To achieve that I conjugated the Toffoli with the following sub circuit: +two CNOTs conjugated by some $X$.

+ +

It worked! I could even construct a switch of $|000\rangle \leftrightarrow |011\rangle$ by extending the above subcircuit (with another Toffoli) the maps $|111\rangle \mapsto |011\rangle$.

+ +

But I'm not sure whether this approach is valid or if I had just a lucky punch...

+",5280,,5280,,4/9/2020 22:00,4/9/2020 22:00,Any two level flip in $n$ qubit system,,1,0,,,,CC BY-SA 4.0 +11475,2,,11474,4/9/2020 16:38,,2,,"

Conjugate by CNOTs to reduce to a case where the two states differ by exactly one bit, and conjugate by NOTs to make all the controls look for 1s instead of 0s.

+ +
    +
  1. Find a bit position t where the two states disagree about a bit. Let s be the state where the bit at t is 0.

  2. +
  3. For each bit position p other than t where the bit is 0 in s, apply a NOT to qubit p.

  4. +
  5. For each bit position p other than t where the two states disagree about a bit, apply a CNOT from qubit t to qubit p.

  6. +
  7. Apply a CCC...CNOT targeting qubit t controlled by all other qubits.

  8. +
  9. Do the same thing as in step (3).

  10. +
  11. Do the same thing as in step (2).

  12. +
+",119,,,,,4/9/2020 16:38,,,,2,,,,CC BY-SA 4.0 +11476,1,11484,,4/9/2020 23:31,,2,76,"

Suppose Alice shares $m$ pairs of maximally entangled states with Bob and $n$ pairs of maximally entangled states with Charlie. It is clear that by measuring their states, Alice can generate correlations with Bob and Alice can also generate correlations with Charlie. If Alice does entanglement swapping, she can also make Bob and Charlie share correlations.

+ +

Is there a way for Alice, Bob and Charlie to jointly share tripartite correlations without communication? The goal is for them to all have outcome ""0"" or all have outcome ""1"".

+ +

EDIT: Just want to emphasize that communication is forbidden. Otherwise, the problem is trivial since the classical outcome ""0"" or ""1"" can be copied and redistributed.

+",4831,,55,,7/27/2020 12:27,7/27/2020 12:27,Can pairwise entanglement be converted into tripartite correlations?,,1,2,,,,CC BY-SA 4.0 +11477,1,16103,,4/10/2020 2:43,,3,209,"

I would like to find the lowest eigenvalue of a $2^n\times 2^n$ real matrix $H$ using the VQE procedure. The measurement part is simple — I just expand $H$ in a sum of all possible $n$-qubit Pauli terms.

+ +

But I have not yet come up with a nice way of preparing an arbitrary $n$-qubit state with real amplitudes. What would be a good ansatz operator $U(\theta_1,\ldots\theta_{2^n-1})$ to do the job?

+ +

(If I were solving the problem in the second-quantized formalism using $2^n$ qubits, I would simply use the Unitary Coupled Cluster with $(2^n - 1)$ single amplitudes — does it have an analogue in such a 'binary' encoding??)

+",8008,,23,,4/17/2020 21:52,2/19/2021 8:06,Ansatz state for finding the lowest eigenvalue of a $2^n\times 2^n$ real matrix using VQE,,3,0,,,,CC BY-SA 4.0 +11479,1,,,4/10/2020 10:13,,1,28,"

I have been experimenting with the measurement mitigation module in Qiskit Ignis lately. I determined a calibration matrix $M$ with the help of CompleteMeasurementFitter(..., qubit_list=qubit_list) (calibration circuits and state labels given by complete_meas_cal(..., qubit_list=qubit_list)).

+ +

I have qubit_list = [0, 1, 2] and

+ +
state_labels = ['000', '001', '010', '011', '100', '101', '110', '111']
+
+ +

If I remember correctly, Qiskit follows the convention that the rightmost character in the state label refers to the first qubit in the list, and so forth. +I want to find the calibration matrix for the qubit subsystem [1, 2] with the subset_fitter() function. When I went through the source code, I struggled with the line where the reduced state labels are computed:

+ +
+
state_labels_reduced = []
+for label in self.state_labels:
+    tmplabel = [label[l] for l in qubit_sublist_ind]
+    state_labels_reduced.append(''.join(tmplabel))
+
+
+ +

qubit_sublist_ind is a list of indices, which maps the reduced qubit list to the original one, in my case:

+ +
qubit_sublist_ind = [1, 2]
+
+ +

What confuses me now is that the quoted code snippet produces

+ +
state_labels_reduced = ['00', '01', '10', '11', '00', '01', '10', '11']
+
+ +

while I would expect

+ +
state_labels_reduced = ['00', '00', '01', '01', '10', '10', '11', '11']
+
+ +

since qubit 0 should refer to the rightmost character in each original state label. I would expect it to be simply stripped off. What is wrong here? Maybe I just confused myself. Thanks for your help!

+",10405,,10405,,4/10/2020 10:18,4/10/2020 10:18,Confusion regarding subset_fitter() functionality from CompleteMeasurementFitter() in Qiskit.Ignis,,0,0,,,,CC BY-SA 4.0 +11480,1,11482,,4/10/2020 11:57,,1,262,"

I understand you can compose a 2 qubit operation as the tensor product of single qubit operations as: U = U1 x U2

+ +

Where U1 applies the the first bit and U2 applies to the second.

+ +

I can compose a 2x2 hadamard as follows for U1 in python and numpy:

+ +
had = hadamard(2, dtype=complex)  / math.sqrt(2)
+
+ +

And an identity for U2:

+ +
id = np.identity(2)
+
+ +

And then take the tensorproduct, U:

+ +
had_id = np.tensordot(had, id, 0)
+
+ +

The resulting matrix is sort of correct:

+ +
[[[[ 0.70710678+0.j  0.        +0.j]
+   [ 0.        +0.j  0.70710678+0.j]]
+  [[ 0.70710678+0.j  0.        +0.j]
+   [ 0.        +0.j  0.70710678+0.j]]]
+ [[[ 0.70710678+0.j  0.        +0.j]
+   [ 0.        +0.j  0.70710678+0.j]]
+  [[-0.70710678+0.j -0.        +0.j]
+   [-0.        +0.j -0.70710678+0.j]]]]
+
+ +

But just isn't composed properly as a 4x4 matrix that can be applied as a 2-qubit operator. If I reshape, reshape(4,4) composes the first 2 inner arrays as the first row. This is not right because the first inner array should be in the first row, but the second inner array should go to the second row.

+ +

I wonder if anyone has any advise how to do this tensor product and get the correct 4x4 matrix for the 2-qubit operator. Otherwise, I suppose I could write a couple of loop to achieve the desired but it just doesn't seem the pythonic and simple way to do things.

+",11634,,,,,4/10/2020 12:12,Taking tensor product of single qubit unitary operation matrices,,1,0,,,,CC BY-SA 4.0 +11481,2,,11477,4/10/2020 12:05,,1,,"

If you don't have any prior on your matrix, you can use the Strongly Entangling Circuit as a very generic ansatz for qubits.

+",8545,,,,,4/10/2020 12:05,,,,0,,,,CC BY-SA 4.0 +11482,2,,11480,4/10/2020 12:12,,3,,"

You can use np.kron instead of np.tensordot:

+ + + +
had_id = np.kron(had, id)
+
+ +

It should give you the 4x4 matrix you're expecting.

+",8545,,,,,4/10/2020 12:12,,,,0,,,,CC BY-SA 4.0 +11484,2,,11476,4/10/2020 16:09,,2,,"

No, it is not possible without communication.

+ +

To see why, consider B and C, and just ignore A -- since they cannot communicate, for anything B and C can do A's presence is irrelevant.

+ +

Then, B and C's measurement outcomes are completely uncorrelated (since they don't share any entanglement, or correlations, just each of them holds a maximally mixed state). Thus, they will see no correlations whatsoever, neither classical or quantum.

+ +
+ +

More technically, you can just write the reduced density operator of B+C jointly, which is the maximally mixed state (obtained by tracing A), which gives completely uncorrelated (and random) measurement outcomes.

+ +
+ +

Finally, note that with communication, A+B+C can prepare any tripartite state they want by using teleportation (A prepares the whole state and teleports B's and C's share to them.)

+",491,,491,,4/10/2020 16:32,4/10/2020 16:32,,,,0,,,,CC BY-SA 4.0 +11486,1,,,4/10/2020 21:04,,6,434,"

I am new to the area of quantum computing, but as I study it I can't help wonder about the role of the Planck's constant. When one studies quantum mechanics one often finds statements that quantum mechanics reduces to classical physics if Planck's constant was taken to be zero. While this statement is a bit vague, there are clear aspects of quantum mechanics that would not hold without a finite non-zero value of the Planck's constant. Uncertainty in ""simultaneous"" measurements of conjugate observables is one, for example. Since in many quantum algorithms measurements are carried out at the end, it appears that the Planck's constant can be chosen to be anything, including, zero, throughout all the unitary transformations of the state up until the end. In that case, what exactly is uniquely quantum about all the unitary transformations of the state? After all, states of classical systems can be defined as elements of Hilbert space. Entanglement and superposition of such classical states would be the result of them being elements of Hilbert space. Bottom line is that I have hard time seeing the reason for ""quantumness"" of quantum computing without the need for setting some non-zero value of the Planck's constant. Thank you.

+ +

QC-Novice

+",11645,,2927,,4/10/2020 22:31,4/12/2020 4:04,Does Planck's constant have any role in quantum computing?,,3,0,,,,CC BY-SA 4.0 +11487,1,,,4/10/2020 21:05,,3,166,"

I have been reading a couple of papers in the arxiv and wanted to get a clarification regarding the relation between these two methods; is one a subset of the other?

+",6253,,,,,4/10/2020 22:50,QAOA Belongs into VQE or the other way around?,,1,1,,,,CC BY-SA 4.0 +11488,1,11489,,4/10/2020 21:26,,2,91,"

A simple question that I cannot seem to figure-out why I cannot achieve the correct result. When I evaluate $$\vert 0 \rangle \otimes \vert + \rangle,$$ +I end up with $$\begin{bmatrix}1\\0\end{bmatrix} \otimes \begin{bmatrix}\tfrac{1}{\sqrt{2}}\\\tfrac{1}{\sqrt{2}}\end{bmatrix} = \begin{bmatrix}1\begin{bmatrix}\tfrac{1}{\sqrt{2}}\\\tfrac{1}{\sqrt{2}}\end{bmatrix}\\0\begin{bmatrix}\tfrac{1}{\sqrt{2}}\\\tfrac{1}{\sqrt{2}}\end{bmatrix}\end{bmatrix} = \begin{bmatrix}\tfrac{1}{\sqrt{2}}\\\tfrac{1}{\sqrt{2}}\\0\\0\end{bmatrix},$$

+ +

where $\vert 00 \rangle$, $\vert 01 \rangle$, $\vert 10 \rangle$, $\vert 11 \rangle$ have $50\%$, $50\%$, $0\%$, $0\%$ probability to be measured, respectively.

+ +

The trivial circuit (if you even consider it a circuit) on algassert suggests that the probabilities when measured are $\vert 00 \rangle = 50\%$, $\vert 01 \rangle = 0\%$, $\vert 10 \rangle = 50\%$, and $\vert 11 \rangle = 0\%$.

+ +

Why is my solution doesn't align with algassert?

+",7528,,9006,,4/10/2020 21:41,4/11/2020 5:10,What is $\vert 0 \rangle \otimes \vert + \rangle$?,,2,5,,,,CC BY-SA 4.0 +11489,2,,11488,4/10/2020 21:50,,3,,"

Your calculation of $|0\rangle \otimes |+\rangle$ is right. For now, forget about calculation and use simple logic. In your setting first qubit is always in state $|0\rangle$ and the second one is in equally distributed superposition of $|0\rangle$ and $|1\rangle$. Hence when you take both qubits together, only states $|00\rangle$ and $|01\rangle$ are possible and both have a probability 50 %.

+ +

There can be a problem with qubits ordering. In $|0\rangle \otimes |+\rangle$ we assume that $|0\rangle$ is the most signigicant qubit, hence it is writen first. However, you can also use another convention when $|0\rangle$ is the least significant qubit, hence it is writen on second place. In this setting you will get results $|00\rangle$ and $|10\rangle$ with a probability 50 % and others with zero percent probability.

+",9006,,,,,4/10/2020 21:50,,,,5,,,,CC BY-SA 4.0 +11490,2,,11486,4/10/2020 22:05,,2,,"

Time evolution of quantum systems is described by Schrodinger equation +$$ +i \frac{h}{2\pi}\frac{\partial}{\partial t}|\psi(t)\rangle = H |\psi(t)\rangle. +$$

+ +

So any change on quantum computer can be described by the equation. Or in other words any quantum gate is described by its Hamiltonian and the equation describe how to the gate acts. When we discretize time, we can describe acting of quantum gate with unitary matrix.

+ +

As you can see in the equation, Planck constant is inseparable part of it and it cannot be neglected. However, you can switch to so-called natural units system where reduced Planck constant (i.e $\frac{h}{2\pi}$), speed of light, gravitational constant, Boltzman constant and others are set to be equal 1. As a result, Planck constant seems not to be presented in equations describing quantum computing.

+",9006,,,,,4/10/2020 22:05,,,,9,,,,CC BY-SA 4.0 +11491,2,,11487,4/10/2020 22:50,,3,,"

QAOA belongs to VQE. Indeed, the idea of VQE is to use a parametrized quantum circuit $U(\theta)$ to minimize +$$\langle 0|U(\theta)^{\dagger}H_PU(\theta)|0\rangle$$ +in order to obtain an approximation of the groundstate of $H_P$. The circuit $U(\theta)$ is called an ansatz, and QAOA uses a particular type of ansatz that can be written +$$U(\theta)=e^{i\beta_1H_P} e^{i\gamma_1H_M}...e^{i\beta_pH_P} e^{i\gamma_pH_M}$$ where $\theta=(\gamma_1,\beta_1,...,\gamma_p,\beta_p)$. Therefore, it can be seen as a special case of VQE

+",8545,,,,,4/10/2020 22:50,,,,0,,,,CC BY-SA 4.0 +11492,1,,,4/11/2020 2:24,,0,526,"

I have been following this tutorial: https://dkopczyk.quantee.co.uk/vqe/

+ +

I am using Cirq to try to teach myself VQE, replicate their results, and also try to understand more about ansatz for molecular simulations - and just for plain fun!

+ +

Here's the thing though, while I can match expectation values, the graph I find for their angle range does not match their result.

+ +

What am I doing wrong and\or not getting about minimization? My code:

+ +
def small_ansatz(parameter_y, qubit):
+  ygate = cirq.YPowGate(exponent=parameter_y)
+  #ygate = cirq.YPowGate(exponent=parameter_y)
+  #yield xgate(qubit)
+  yield ygate(qubit)
+
+#wrapping into a circuit
+
+def psi_circuit(parameter):
+  curr_q = cirq.LineQubit(0)
+  curr_c = cirq.Circuit()
+
+  curr_c.append(small_ansatz(parameter, curr_q))
+
+  curr_c.append(cirq.measure(curr_q, key='q0'))
+  return curr_c
+
+def expectation_value_vqe(param, num_reps):
+  curr_psi = psi_circuit(param)
+  print()
+  #keep the measured keys and values
+
+  curr_simulator = cirq.Simulator()
+  curr_results = curr_simulator.run(curr_psi, repetitions=num_reps) 
+  s_k, s_v= zip(*r.measurements.items())
+
+  #convert into booleans from sp|in values
+  curr_state_values = 1 - 2*np.array(s_v).astype(np.int32)
+
+  #get the expectation value (the average of the counts)
+  #I keep double the variables because I want to remind myself of the distinction between this task and the context 
+  #of Farhi's paper.
+  curr_predicted_label_value = np.mean(curr_state_values)
+  return(curr_predicted_label_value)
+
+ +

And the plot I get for my expectation values for the ansatz: +

+ +

And here is the tutorial:

+ +

Edit: I also implemented this on Qiskit and did obtain the plot to match Grove's.

+ +

+",6253,,6253,,4/11/2020 5:33,4/12/2020 5:57,VQE for Beginners : Using Tutorial and Cirq,,1,0,,,,CC BY-SA 4.0 +11493,2,,11488,4/11/2020 5:10,,1,,"

It appears to me that the algassert output actually agrees with your (correct) math, and that you're simply misreading it. If you read the ""Final amplitudes"" left to right, it says that you have $50\%$ each of getting $\vert 00 \rangle$ or $\vert 01 \rangle$, and $0\%$ of measuring $\vert 10 \rangle$ or $\vert 11 \rangle$.

+",1790,,,,,4/11/2020 5:10,,,,2,,,,CC BY-SA 4.0 +11495,1,,,4/11/2020 11:48,,3,72,"

About the qasm_simulator, does it have on its 32 qubits a qubit connectivity design like as ibmq_16_melbourne or as another real device of IBM Experience and Qiskit?

+",11650,,5955,,4/11/2020 12:15,4/11/2020 12:49,Design connectivity of qasm_simulator,,2,1,,,,CC BY-SA 4.0 +11496,2,,11495,4/11/2020 12:16,,3,,"

There is no qubit connectivity map for the simulator, all qubits are connected to each other to enable you to simulate any 32 qubit program.

+",5955,,,,,4/11/2020 12:16,,,,0,,,,CC BY-SA 4.0 +11497,2,,11495,4/11/2020 12:49,,2,,"

You can control the connectivity using parameters of the execute function. You can obtain the connectivity of a specific device by querying the backend configuration, and pass it to execute. The execution starts with a transpilation step, that modifies the circuit into an equivalent circuit which is valid with the given connectivity. Then the modified circuit is passed to the simulator. The simulator itself is not aware of the connectivity.

+",7659,,,,,4/11/2020 12:49,,,,0,,,,CC BY-SA 4.0 +11498,2,,11492,4/11/2020 13:10,,2,,"

In the tutorial, the RY gate is used. What you are using is different. If you look at the corresponding documentation of that gate, you would see:

+ +
+

Note in particular that this gate has a global phase factor of + e^{i·π·t/2} vs the traditionally defined rotation matrices + about the Pauli Y axis.

+
+ +

This may explain the difference. You can use instead the cirq.ry operation to reproduce the tutorial.

+ +

EDIT

+ +

I tried your code by replacing by cirq.ry :

+ +
ygate = cirq.ry(parameter_y)
+
+ +

And running the following gave me the correct plot:

+ +
params_range = np.linspace(0.0, 2 * np.pi, 25)
+
+data = [expectation_value_vqe(params) for params in params_range]
+
+ +

+",4127,,4127,,4/12/2020 5:57,4/12/2020 5:57,,,,3,,,,CC BY-SA 4.0 +11499,2,,11486,4/11/2020 14:24,,3,,"

I like this question although the question and answers may be a bit vague/a moving target.

+ +

Initially I'll quote Gil Kalai who asked a very similar question on MathOverflow:

+ +
+

the Planck constant plays almost no role (and, in fact, is hardly mentioned) in the literature on quantum computation and quantum information, and I am curious about it.

+
+ +

We can take Marin Vesely's observation and work in the natural units system, as that appears to hide the (dimensioned) $\hbar$ by setting it to $1$, and enabling exponentiation of (dimensionless) time as in the time-dependent Schrodinger equation.

+ +

I think this may depend upon how qubits are embodied, as we must trace this out to find a hidden $\hbar$.

+ +

For example, Carlo Beenakker (whose profile pic is of $\hbar$!) answers Kalai's question. Although I don't understand all of Beennakker's answer, if qubits are embodied as spin states that quantum computing is silent on Planck because:

+ +
+

That is simply a choice (made in the early days of [quantum computing]) to normalize the action $S$ by twice the angular momentum of the electron spin, which is just $\hbar$. So with that choice $S$ is dimensionless and Planck's constant $\hbar=1$, which is why it vanishes from sight.

+
+ +

We can also ponder/embody qubits as polarization states of a photon. There, it's not so clear to me what the action corresponds to; however, that's not to say that Planck's constant is or could be set to $0$.

+ +

For example, what is still fundamentally ""quantum"" are the photons of light itself. That is, if we work with linear optical quantum computing, we can measure non-commuting properties of photon polarization, but we are acting on the individual quanta of light.

+",2927,,,,,4/11/2020 14:24,,,,0,,,,CC BY-SA 4.0 +11500,1,11502,,4/11/2020 17:58,,1,86,"
+

Let $\mathcal{H} =\mathbb{C}^2, \mathcal{M}_1 = \mathbb{C}|0\rangle$ with $|\psi\rangle = \alpha |0\rangle + \beta|1\rangle$. Show $Pr(\mathcal{M_1}) = |\alpha|^2.$

+
+ +

We know that $\mathcal{M_1}$ is a subspace of the Hilbert space $\mathcal{H}$, and that $Pr(\mathcal{M_1}) = \langle \psi| Proj_\mathcal{M}|\psi\rangle.$

+ +

I see that when we first evaluate $Pr(\mathcal{M_1}) = \langle \psi| Proj_\mathcal{M}|\psi\rangle$ we obtain

+ +
+

$\langle \psi| Proj_\mathcal{M}|\psi\rangle = \langle\alpha|0\rangle + \beta|1\rangle|Proj_{\mathbb{C}^0}|\alpha|0\rangle + \beta|1\rangle\rangle = \langle \alpha|0\rangle | \alpha|0\rangle + \beta|1\rangle\rangle$.

+
+ +

At this point I don't see how we can show the desired result. Am I not applying the projection operator with the given notion properly?

+",11648,,55,,8/19/2020 17:34,8/19/2020 17:34,Quantum Expectation Calculation with Orthogonal Projection,,1,0,,,,CC BY-SA 4.0 +11501,1,11521,,4/11/2020 18:23,,7,701,"

I am currently running a simple algorithm using Qiskit and I am running it for various transpiler optimization levels (0-3). I wish to know what exactly occurs differently when for example I run the algorithm with optimization level 1 as compared to when the algorithm is run with optimization level 3. There is general information available on what a transpiler does, however, I cannot find what exactly happens differently in each optimization level.

+",10114,,9006,,4/11/2020 21:56,4/12/2020 19:47,What are the differences between the different transpiler optimization levels in qiskit,,1,0,,,,CC BY-SA 4.0 +11502,2,,11500,4/11/2020 18:45,,2,,"

The definition of projectors can be found on page 70 from M. Nielsen and I. Chuang textbook: Suppose $W$ is a $k$-dimensional vector subspace of the $d$-dimensional vector space $V$. Using the Gram–Schmidt procedure it is possible to construct an orthonormal basis $|1\rangle$,...$|d\rangle$ for $V$ such that $|1\rangle$,...$|k\rangle$ is an orthonormal basis for $W$. By definition:

+ +

$$P = \sum_{i = 1}^k | i \rangle \langle i |$$

+ +

is a projector onto the subspace $W$. End of the quote from the textbook.

+ +

So, for $H = \mathbb{C}^2$ $|0\rangle$ and $|1\rangle$ are orthonormal basis vectors and the $|0\rangle \langle 0|$ will be a valid projector into $M_1$ subspace:

+ +

$$Proj_{M_1} = |0\rangle \langle 0|$$

+ +

Then:

+ +

\begin{equation} +Pr\left(M_1\right) = \langle \psi |Proj_{M_1}| \psi \rangle = \big(\alpha^* \langle 0| + \beta^* \langle 1 |\big)\big(|0\rangle \langle 0|\big) \big(\alpha | 0 \rangle + \beta | 1 \rangle\big) \\ +=\big(\alpha^* \langle 0| 0 \rangle + \beta^* \langle 1 | 0 \rangle \big) \big(\alpha \langle 0 | 0 \rangle + \beta \langle 0 | 1 \rangle\big) = +\alpha^* \alpha = |\alpha|^2 +\end{equation}

+ +

where we took into account:

+ +

\begin{align*} +&\text{ortnormality:}\quad \;\; \langle 0| 0 \rangle = \langle 1| 1 \rangle = 1; +\quad \;\;\;\; \langle 0| 1 \rangle = \langle 1| 0 \rangle = 0 \\ +&\text{$|\psi\rangle$ and $\langle \psi |$:} \qquad |\psi\rangle = \alpha | 0 \rangle + \beta | 1 \rangle; \qquad \langle \psi | = \alpha^* \langle 0| + \beta^* \langle 1 | +\end{align*}

+",9459,,9459,,4/11/2020 19:33,4/11/2020 19:33,,,,2,,,,CC BY-SA 4.0 +11503,2,,11430,4/11/2020 18:53,,3,,"

$C$ is a diagonal matrix, and $\max{C}$ is simply the maximum element (which is also the maximum eigenvalue, since the matrix is already diagonal).

+ +

This is also what is usually meant by ""maximum"" and ""minimum"" in this ""quantum optimization"" literature, which includes adiabatic quantum computing (AQC), quantum annealing, and QAOA.

+",2293,,,,,4/11/2020 18:53,,,,0,,,,CC BY-SA 4.0 +11504,1,,,4/11/2020 21:11,,2,501,"

I just want to use the ""if"" gate in IBM QX circuit composer, but I don't know how.

+",11657,,9006,,4/11/2020 21:33,4/11/2020 21:55,How can I use IF gate in IBM Q composer?,,1,0,,,,CC BY-SA 4.0 +11505,2,,11504,4/11/2020 21:55,,3,,"

IF gate can be used for controlling gates based on value in classical register, i.e. measured values of qubits.

+ +

Lets see at this circuit:

+ +

+ +

In this case qubit $q_0$ is in state $|1\rangle$ and qubit $q_1$ in state $|0\rangle$. After measurement you have value 1 in classical bit $c_1$ and value 0 in classical bit $c_0$. So $c_1c_0 = 10$ in binary or $2$ in decimal numbers. Then IF gate is used with condition $c=2$. Since there is the value 2 in classical register, the condition is fulfiled and gate $X$ linked to IF statement is activated. This leads to negating qubit $q_2$.

+ +

After measurement you have classical register in state $110$, where the first $1$ comes from measuring qubit $q_2$ and $10$ from measuring qubits $q_0q_1$.

+ +

Note 1: IF statement can be used only with simulator. It has not been implemented for real quantum processors yet.

+ +

Note 2: In IBM Q composer you can either use drag and drop method, take IF statement from gates list and put on gate you want to control by classical register or use direct coding in QASM, see below.

+ +

Note 3: Here is a code of above circuit:

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+qreg q[3];
+creg c[3];
+
+x q[0];
+measure q[0] -> c[1];
+measure q[1] -> c[0];
+
+if (c==2) x q[2];
+measure q[2] -> c[2];
+
+",9006,,,,,4/11/2020 21:55,,,,0,,,,CC BY-SA 4.0 +11506,1,11553,,4/12/2020 0:06,,2,136,"

The max-relative entropy between two states is defined as

+ +

$$D_{\max }(\rho \| \sigma):=\log \min \{\lambda: \rho \leq \lambda \sigma\},$$

+ +

where $\rho\leq \sigma$ should be read as $\sigma - \rho$ is positive semidefinite. Consider the following quantity for a bipartite state $\rho_{AB}$ with reduced states $\rho_{A}$ and $\rho_{B}$.

+ +

$$I_{\max}(\rho_{AB}) = D_{\max}(\rho_{AB}||\rho_{A}\otimes\rho_{B})$$

+ +

I would like to know if this satisfies a continuity bound. That is, given $\rho_{AB}\approx_{\epsilon}\sigma_{AB}$ in some distance measure, can we bound $|I_{\max}(\rho_{AB}) - I_{\max}(\sigma_{AB})|$?

+ +
+ +

Motivation for question: Recall the quantum relative entropy $D(\rho||\sigma) = \text{Tr}(\rho\log\rho - \rho\log\sigma)$ with the convention that $0\log 0 = 0$. Let us define the mutual information as follows

+ +

$$I(\rho_{AB}) = D(\rho_{AB}||\rho_{A}\otimes\rho_{B}) = -S(\rho_{AB}) + S(\rho_A) + S(\rho_B),$$

+ +

where $S(\rho) = -\text{Tr}(\rho\log\rho)$ is the von Neumann entropy. In this case, we may use Fannes inequality to find a bound on $|I(\rho_{AB}) - I(\sigma_{AB})|$ in terms of $\|\rho_{AB} - \sigma_{AB}\|_1$. I'm wondering if the move from $D(.||.)$ to $D_{\max}(.||.)$ can be made while still having some Fannes type bound.

+",4831,,55,,7/26/2021 11:31,7/26/2021 11:31,Continuity bounds on $D_{\max}(\rho_{AB}\|\rho_A\otimes\rho_B)$,,1,0,,,,CC BY-SA 4.0 +11507,1,11511,,4/12/2020 1:21,,0,66,"

+ +

This is a picture from Wiki(https://en.wikipedia.org/wiki/Quantum_logic_gate). Can someone give me a simple example by using two qubits?

+ +

+",11523,,23,,7/26/2020 18:07,7/26/2020 18:07,Could someone give an example of this pic?,,1,2,,,,CC BY-SA 4.0 +11509,2,,11486,4/12/2020 3:47,,3,,"

Great question, and David Mermin dedicates an entire section of his great paper "From Cbits to Qbits" to it:

+
+

Like my disapproving colleague, some physicists may be appalled to have finished what purports to be an exposition of quantum mechanics — indeed, of applied (well,gedankenapplied) quantum mechanics — without ever having run into Planck’s constant. How can this be?

+

The answer goes back to my first reason why enough quantum mechanics to understand quantum computation can be taught in a mere four hours. We are interested in discrete (2-state) systems and discrete (unitary) transformations. But Planck’s constant only appears in the context of continuously infinite systems (position eigenstates) and continuous families of transformations (time development) that act on them. Its role is to relate the conventional units in which we measure space and time, to the units in which it is quantum-mechanically natural to take the generators of the unitary transformations that produce translations in space or time.

+

If we are not interested in location in continuous space and are only interested in global rather than infinitessimal unitary transformations, then $\hbar$ need never enter the story. The engineer, who must figure out how to implement unitary transformations acting over time on Qbits located in different regions of physical space, must indeed deal with $\hbar$ and with Hamiltonians that generate the unitary transformations out of which the computation is built. But the designer of algorithms for the finished machine need only deal with the resulting unitary transformations, from which $\hbar$ has disappeared as a result, for example, of judicious choices by the engineers of the times over which the interactions that produce the unitary transformations act.

+

Deploring the absence of $\hbar$ from expositions of quantum computer science is rather like complaining that the I-V curve for a p-n junction never appears in expositions of classical computer science. It is to confuse computer science with computer engineering.

+
+

So basically, quantum algorithms researchers aren't setting $\hbar = 0$, instead, they're implicitly setting it equal to 1, or more precisely they're sweeping it up in the various fixed time constants and so on that determine the gates' operation at the microscopic level, and only considering the value of the dimensionless ratios $(\Delta E) T/\hbar$ that arise from the Schrodinger equation.

+

To put it another way, Shankar lists the four fundamental postulates of nonrelativistic quantum mechanics as (greatly abbreviating):

+
    +
  1. Physical states are represented by vectors in a Hilbert space
  2. +
  3. Measurements yield eigenvalues of the corresponding operator with probability given by the Born rule and change the state to the measured eigenstate.
  4. +
  5. The canonical commutation relation $[x_i, p_j] = i \hbar \delta_{ij}$
  6. +
  7. The Schrodinger equation for time evolution.
  8. +
+

As Mermin points out, by abstracting away the microscopic continuum details of how the qubits and gates actually work at the physical level and representing the gates as unitary operators that act over a finite time span, algorithm developers can usually get away with ignoring $\hbar$. (Although the device engineers certainly need to understand the postulates 3 and especially 4 very well. And $\hbar$ is often buried very shallowly beneath the surface - for example, if your qubits are physically instantiated by the spin states of a spin-1/2 particle or a photon, then the $|0\rangle$ and $|1\rangle$ computational basis states are angular momentum states that differ by $\hbar$ or $2\hbar$.)

+

There is clearly some sense in which postulates 3 and 4 "go away" in the formal limit $\hbar \to 0$ (although we need to very careful what that limit actually means), since they explicitly contain $\hbar$, but postulates 1 and 2 clearly "survive", at least when the limit is taken in the appropriate way. And indeed, any quantum algorithms researcher needs to be extremely familiar with those first two postulates, even if the second two can be abstracted away.

+

Finally, I'll mention that $\hbar$ rarely appears in the gate-based formalism of quantum algorithms, but it comes up all the time in the (even purely theoretical) study of adiabatic quantum computing algorithms, which by their nature are a little more "analog" and more directly tied the underlying physics of the hardware.

+",551,,-1,,6/18/2020 8:31,4/12/2020 4:04,,,,1,,,,CC BY-SA 4.0 +11510,1,11515,,4/12/2020 5:17,,2,79,"

Prove that if

+ +

$\text{Proj}_{M_1}\text{Proj}_{M_2}= \text{Proj}_{M_2}\text{Proj}_{M_1}$ then

+ +

$\text{Pr}(\text{span}[M_1, M_2]) = \text{Pr}(M_1) + \text{Pr}(M_2) − \text{Pr}(M_1 \cap M_2)$.

+ +

In the case where the projection operators are non-commutative, I understand how to show that the above formula is actually false. However, I am unsure of how the commutativity of the projectors implies the above equation. I have included an image from the text to provide the definitions of $M_1$ and $M_2$.

+ +

+",10215,,55,,4/13/2020 7:59,4/13/2020 7:59,"Prove that $P_{M_1}P_{M_2}= P_{M_2}P_{M_1}$ implies $\text{Pr}(\text{span}[M_1, M_2]) = \text{Pr}(M_1)+\text{Pr}(M_2)−\text{Pr}(M_1\cap M_2)$",,1,0,,,,CC BY-SA 4.0 +11511,2,,11507,4/12/2020 6:14,,2,,"

Since Fourier transform and inverse Fourier transform for one qubit is only Hadamard gate, for two qubit case following two circuits are equivalent.

+ +

First circuit (Fourier transform applied on qubit $q_0$)

+ +

+ +

First circuit (inverse Fourier transform applied on qubit $q_1$)

+ +

+ +

Both circuits return state

+ +

$$ +|\psi\rangle = \frac{1}{2}(|00\rangle + |01\rangle + |10\rangle - |11\rangle). +$$

+ +
+ +

EDIT: I have just realized that the gate $F$ is general unitary transformation and not the QFT (I was missleaded by F = Fourier). However, my example is also valid. It is a particular case for two qubits asked for in the question.

+",9006,,9006,,4/12/2020 6:37,4/12/2020 6:37,,,,0,,,,CC BY-SA 4.0 +11512,1,11513,,4/12/2020 8:21,,1,626,"

I understand that starting with

+ +

,

+ +

we can get to $\vert \Phi^+ \rangle$. First, we start with $\vert Q_1 \rangle \otimes \vert Q_2 \rangle = \vert 0 \rangle \otimes \vert 0 \rangle$ and then applying $H$ on $Q_1$ which gives $\left( \frac{1}{\sqrt{2}}\vert 0 \rangle + \frac{1}{\sqrt{2}}\vert 1 \rangle \right)\otimes \vert 0 \rangle$. After $t_1$, we obtain $\frac{1}{\sqrt{2}}\vert 00 \rangle + \frac{1}{\sqrt{2}}\vert 10 \rangle$. Then, we apply the $CNOT$ gate to end up with $$\vert \Phi^+ \rangle = \frac{1}{\sqrt{2}}\vert 00 \rangle + \frac{1}{\sqrt{2}}\vert 11 \rangle.$$

+ +

I am wondering if there is a way to show all of this using the matrix representation of gates. I have tried the following way but I can't seem to get it properly:

+ +

We start with the state $\vert 00 \rangle = \scriptstyle\begin{bmatrix}1\\0\\0\\0\end{bmatrix}$. Between $t_0$ and $t_1$, I applied $$H \otimes I = \begin{bmatrix}\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} & 0 & 0\\\frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} & 0 & 0\\ 0 & 0 & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}\\0 & 0 & \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}}\end{bmatrix},$$ +since we are manipulating $Q_1$ and leaving $Q_2$ unchanged to obtain $\scriptstyle\begin{bmatrix}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\\0\\0\end{bmatrix}$. Lastly, we apply $CNOT$ which gives us $\scriptstyle\begin{bmatrix}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\\0\\0\end{bmatrix}.$

+ +

I am really looking for the matrices required to achieve the desired result.

+",7528,,55,,4/13/2020 7:57,4/13/2020 7:57,"Show how the Bell state arises from the circuit with Hadamard and CNOT, using matrix notation",,1,0,,,,CC BY-SA 4.0 +11513,2,,11512,4/12/2020 9:16,,4,,"

I think the problem of the calculations is in the $H \otimes I$, that should be equal to:

+ +

\begin{equation} +H \otimes I = \frac{1}{\sqrt{2}} +\begin{pmatrix} +1 \cdot I & 1 \cdot I \\ +1 \cdot I & -1 \cdot I +\end{pmatrix} = +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 0 & 1 & 0\\ +0 & 1 & 0 & 1\\ +1 & 0 &-1 & 0\\ +0 & 1 & 0 &-1 +\end{pmatrix} +\end{equation}

+ +

Then if we will apply this to $|00\rangle$ state we will obtain:

+ +

\begin{equation} +H \otimes I |00\rangle= +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 0 & 1 & 0\\ +0 & 1 & 0 & 1\\ +1 & 0 &-1 & 0\\ +0 & 1 & 0 &-1 +\end{pmatrix} +\begin{pmatrix} +1\\0\\0\\0 +\end{pmatrix} = +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1\\0\\1\\0 +\end{pmatrix} +\end{equation}

+ +

Now let's apply the CNOT gate:

+ +

\begin{equation} +CNOT \frac{1}{\sqrt{2}}\big(|00\rangle + |10\rangle\big)= +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 0 & 0 & 0\\ +0 & 1 & 0 & 0\\ +0 & 0 & 0 & 1\\ +0 & 0 & 1 & 0 +\end{pmatrix} +\begin{pmatrix} +1\\0\\1\\0 +\end{pmatrix} = +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1\\0\\0\\1 +\end{pmatrix} = +\frac{1}{\sqrt{2}}\big(|00\rangle + |11\rangle\big) +\end{equation}

+",9459,,,,,4/12/2020 9:16,,,,1,,,,CC BY-SA 4.0 +11514,1,11524,,4/12/2020 9:33,,2,346,"

I recently started developing circuits with Qiskit. I made a 5 qubit circuit in which the fourth qubit at the end of execution must always have value 1: + +When I do the simulation with qasm everything is ok. + +When I start the circuit on ibmq_essex I get results in which the value of fourth qubit is 0. + +I would like to eliminate from the results all the states that have the fourth qubit at 0 and normalize the circuit to eliminate the errors. How can I do? +I have already tried the following set of instructions with Ignis but as you can see from the graph I have not achieved a satisfactory result

+ +
from qiskit.ignis.mitigation.measurement import (complete_meas_cal, CompleteMeasFitter)
+
+cal_circuits, state_labels = complete_meas_cal(qr = circuit.qregs[0], circlabel = 'measerrormitigationcal')
+len(cal_circuits)
+cal_job = execute(cal_circuits, backend = qcomp,shots = 1024, optimization_level = 3)
+job_monitor(cal_job)
+cal_results = cal_job.result()
+plot_histogram(cal_results.get_counts(cal_circuits[5]))
+meas_fitter = CompleteMeasFitter(cal_results, state_labels)
+meas_filter = meas_fitter.filter
+mitigated_results = meas_filter.apply(result)
+device_counts = result.get_counts(circuit)
+mitigated_counts = mitigated_results.get_counts(circuit)
+plot_histogram([device_counts, mitigated_counts], legend=['noisy', 'mitigated'],figsize=(20,15))
+
+ +

+",10335,,9459,,4/13/2020 8:47,4/13/2020 10:15,Different results between qasm_simulator and quantum computer: how to normalize for only few states,,1,3,,,,CC BY-SA 4.0 +11515,2,,11510,4/12/2020 11:40,,3,,"
    +
  1. It follows that $M_1$ is invariant subspace of operator $\text{Proj}_{M_2}$. Indeed, if $v \in M_1$ then +$$\text{Proj}_{M_1}\text{Proj}_{M_2}v=\text{Proj}_{M_2}\text{Proj}_{M_1}v = \text{Proj}_{M_2}v,$$ +so +$$\text{Proj}_{M_1}(\text{Proj}_{M_2}v) = \text{Proj}_{M_2}v,$$ +but this can happen only if $\text{Proj}_{M_2}v \in M_1$.

  2. +
  3. Similarly, it can be proved that $M_1^{\perp}$ is invariant for $\text{Proj}_{M_2}$, and also $M_2,M_2^{\perp}$ are invariant for $\text{Proj}_{M_1}$ by symmetry.

  4. +
  5. Since $M_1$ is invariant for $\text{Proj}_{M_2}$ and $\text{Proj}_{M_2}$ has two eigenspaces $M_2,M_2^{\perp}$, then $M_1$ can be split into +$$ +M_1 = (M_1 \cap M_2) \oplus (M_1 \cap M_2^{\perp}) +$$ +Similarly, +$$ +M_2 = (M_2 \cap M_1) \oplus (M_2 \cap M_1^{\perp}) +$$

  6. +
  7. Now, clearly, $(M_1 \cap M_2^{\perp}) \perp (M_2 \cap M_1^{\perp})$, so +$$ +M_1 + M_2 = (M_1 \cap M_2) \oplus (M_1 \cap M_2^{\perp}) \oplus (M_2 \cap M_1^{\perp}), +$$ +hence +$$ +\text{Pr}(M_1+M_2) = \text{Pr}(M_1 \cap M_2) + \text{Pr}(M_1 \cap M_2^{\perp}) + \text{Pr}(M_2 \cap M_1^{\perp}) = +$$ +$$ += \text{Pr}(M_1) + \text{Pr}(M_2) - \text{Pr}(M_1 \cap M_2) +$$
  8. +
+ +

A more general case is discussed here https://quantumcomputing.stackexchange.com/a/6469/5870

+",5870,,,,,4/12/2020 11:40,,,,2,,,,CC BY-SA 4.0 +11516,1,11585,,4/12/2020 12:32,,0,164,"

There is a quantum circuit with several Controlled NOT and Controlled swap gates, with two 2-qubit input registers X,Y and two 2-qubit output registers X',Y' where we have to find the mapping of the circuit and what operations it performs.

+",11662,,55,,4/9/2021 9:00,4/9/2021 9:00,What do we mean by “derive full operator of a quantum circuit” and to describe the mapping from input quantum registers to output quantum registers?,,1,3,,,,CC BY-SA 4.0 +11517,1,11587,,4/12/2020 17:51,,2,277,"

Scott Aaronson is fond of saying ""Quantum computers do not solve hard search problems instantaneously by simply trying all the possible solutions at once."" That is, they are not non-deterministic Turing Machines.

+ +

However, most descriptions I've read of quantum QFT say that the way it works is by using qubits that are both 0 and 1 at the same time. So is the QFT, which is the basis of Shor's factoring algorithm, an exception Aaronson's aphorism, or is there something else going on that's deeper?

+ +

Based on @MarkS's comment, I gather that the something deeper involves constructive and destructive interference and the Chinese Remainder Theorem.

+",9482,,2293,,5/28/2021 18:05,5/28/2021 18:05,"Quantum computers don't try all the possible solutions, so how does the QFT really work?",,2,5,,,,CC BY-SA 4.0 +11518,1,,,4/12/2020 18:04,,0,86,"

Show that the set of density operators is invariant under +the induced action of $U(H)$ on $End(H)$.

+ +

I know that a density operator must be positive and have a trace equal to one. But I don't know how to prove the invariance under the unitary group.

+ +

I assume I need to show that the set of density operators consists of the same elements even after applying $U(H)$ to $End(H)$, or am I misunderstanding the question entirely?

+",10215,,,,,4/12/2020 18:53,Is the set of density operators invariant under the induced action of the unitary group?,,1,0,,,,CC BY-SA 4.0 +11519,2,,11518,4/12/2020 18:53,,1,,"

I'm not sure what $End(H)$ is but here is a proof that unitaries take density operators to density operators. Let $X$ be a positive semidefinite matrix with unit trace. We have to show that for a unitary $U$, $U^\dagger XU$ is also positive semidefinite with unit trace. Using the cyclicity of trace and $UU^\dagger = I$

+ +

$$Tr(U^\dagger X U) = Tr(XUU^\dagger) = Tr(XI) = Tr(X) = 1$$

+ +

As for positive semidefiniteness, this means that for any $\vert \psi\rangle$, you have $\langle \psi\vert X\vert\psi\rangle \geq 0$. Now we have

+ +

$$\langle \psi\vert U^\dagger XU\vert\psi\rangle = \langle \phi\vert X\vert\phi\rangle \geq 0,$$

+ +

where I have set $\vert\phi\rangle = U\vert\psi\rangle$ and the inequality holds since $X$ is positive semidefinite.

+",4831,,,,,4/12/2020 18:53,,,,1,,,,CC BY-SA 4.0 +11520,1,11531,,4/12/2020 19:45,,2,245,"

I can't seem to find a definition for genuine entanglement but it is being used in an article I'm reading and the references inside but I'm unable to find the precise definition.

+ +

One thing I was able to get to the bottom of is ""So far, genuine multipartite entangled (GME) states in the form of Greenberger-HorneZeilinger (GHZ) states.."", but I do not know what about the GHZ states makes them ""genuinely entangled"".

+ +

Also the way it comes up is ""genuine multipartite entanglement"", which begs the questions (after what is genuine entanglement) why does it only come up in multipartite schemes ($n>2$)?

+ +
+ +

Cross-posted on physics.SE

+",8275,,55,,4/13/2020 14:42,4/13/2020 18:34,What is the definition of genuine entanglement?,,1,4,,,,CC BY-SA 4.0 +11521,2,,11501,4/12/2020 19:47,,7,,"

These levels are provided via ""preset passmanagers"" in Qiskit. These are simple-to-use transpiler pipelines, but you can also build your own passmanager pipeline. You can see what each does by inspecting the documentation for those: +https://github.com/Qiskit/qiskit-terra/tree/master/qiskit/transpiler/preset_passmanagers

+ +

But briefly, level 0 does no explicit optimization, it will just try to make a circuit runnable by transforming it to match a topology and basis gate set, if necessary.

+ +

Level 1, 2 and 3 do light, medium and heavy optimization, using a combination of passes, and by configuring the passes to search for better solutions. Typically more optimality comes at the cost of slower transpilation, as it spends more time searching for a good optimization.

+ +

For example if you look at the difference between level 2 and level 3, in level 2 the transpiler does some commutation analysis to see what gates can be collapsed. In level 3, in addition to that, it does peep-hole optimization by combining a chain of gates on the same qubits and re-synthesizing them with better cost. Also the routing stage of level 3 is more expensive than level 2 (it has a larger search space, as set by parameters of the StochasticSwap and LookaheadSwap passes).

+ +

It is important to keep in mind that these are heuristics. It is possible that, for a specific circuit, you will not see much improvement by increasing the level.

+",2503,,,,,4/12/2020 19:47,,,,0,,,,CC BY-SA 4.0 +11522,1,,,4/12/2020 21:25,,0,204,"

I am interested in using the QASM2Cirq methods to make this gate: u2(0, np.pi, q[0]).

+ +

How can I build that object using Cirq rather than QASM string value passed onto cirq.

+",6253,,,,,4/12/2020 22:22,Implementing U2-Gates on Cirq,,1,0,,,,CC BY-SA 4.0 +11523,2,,11522,4/12/2020 22:22,,3,,"

From the spec, $U_2(\phi, \lambda) = U ( \frac{\pi}{2}, \phi, \lambda)$. We can use Cirq's QasmUGate.

+ +
import cirq
+from cirq.circuits.qasm_output import QasmUGate
+
+q0 = cirq.NamedQubit('q[0]')
+u2_gate = QasmUGate(0.5, 0, 1) # The angles are normalized to the range [0, 2) half_turns
+circuit = cirq.Circuit(u2_gate(q0))
+
+",362,,,,,4/12/2020 22:22,,,,0,,,,CC BY-SA 4.0 +11524,2,,11514,4/13/2020 7:22,,2,,"

The difference between the simulator and quantum hardware is something that can't be avoided, there must be a difference, because of noise. The one thing that I noticed from the histograms is that the state with maximum probability for simulator was '11000' and for quantum hardware, the state with maximum probability was '10000'. I think this difference is caused by the small shots number. I have run the same circuit on ibmq_essex with 8192 shots and here is what I obtained:

+ +

+ +

So shots number can help to improve the results. Measurement error mitigation will help a little bit to improve this result even farther, but maybe the final result will be still unsatisfactory. Also, I want to mention that CNOT gates are noisier then single-qubit gates and in the circuit, we have 4 CNOTs applied on the q[4] qubit, so I guess this has its effect. If q[4] is always '1', then we can just replace CNOTs with X gates applied to the corresponding qubits: this will reduce errors as well. Moreover if q[4] is not linked with some q[n] qubit the quantum compiler will introduce SWAP gates to be able to apply CNOT between q[4] and q[n]. This means that we will have even more CNOTs in the circuit then we have introduced (for more about SWAP and connectivity I recommend this video). Here is the connectivity of ibmq_essex taken from this site:

+ +

+ +

If our q[4] corresponds to 4th qubit in the picture (not sure about this) then I imagine that the quantum compiler will introduce a lot of SWAP gates and, thus, the error will increase just because of not optimally chosen qubit.

+ +

Here is the final circuit after optimization_level=3 (Note how many CNOTs are there):

+ +

+ +

From here, if I am not mistaken, we can deduce that q[4] is the 3rd qubit from ibmq_essex.

+ +

Here is the code that I have used:

+ + + +
from qiskit import *
+from qiskit.visualization import *
+%config InlineBackend.figure_format = 'svg' 
+provider = IBMQ.load_account()
+qpu_backend = provider.get_backend('ibmq_essex')
+
+quantum_register = QuantumRegister(4, 'q')
+ancillary_qubit = QuantumRegister(1, 'a')
+classical_register = ClassicalRegister(5, 'c')
+circuit = QuantumCircuit(quantum_register, ancillary_qubit, classical_register)
+
+circuit.h(quantum_register)
+circuit.u1(-0.0707, quantum_register[0])
+circuit.u1(-0.134, quantum_register[1])
+circuit.u1(-0.236, quantum_register[2])
+circuit.u1(-0.314, quantum_register[3])
+
+circuit.x(ancillary_qubit[0])
+circuit.cx(ancillary_qubit[0], quantum_register[0])
+circuit.cx(ancillary_qubit[0], quantum_register[1])
+circuit.cx(ancillary_qubit[0], quantum_register[2])
+circuit.cx(ancillary_qubit[0], quantum_register[3])
+
+circuit.u1(0.385, quantum_register[0])
+circuit.u1(0.605, quantum_register[1])
+circuit.u1(1.02, quantum_register[2])
+circuit.u1(1.884, quantum_register[3])
+circuit.h(quantum_register)
+
+circuit.measure(quantum_register[0], classical_register[0])
+circuit.measure(quantum_register[1], classical_register[1])
+circuit.measure(quantum_register[2], classical_register[2])
+circuit.measure(quantum_register[3], classical_register[3])
+circuit.measure(ancillary_qubit[0], classical_register[4])
+
+qpu_result = execute(circuit, backend=qpu_backend, shots=8192, optimization_level=3).result().get_counts()
+
+plot_histogram(qpu_result, legend=[qpu_backend],figsize=(10,5))
+
+",9459,,9459,,4/13/2020 10:15,4/13/2020 10:15,,,,2,,,,CC BY-SA 4.0 +11525,1,12003,,4/13/2020 8:20,,7,589,"

Consider the two-qubit Werner state, defined as +$$\rho_z = z |\Psi_-\rangle\!\langle \Psi_-| + \frac{1-z}{4}I, +\quad |\Psi_-\rangle\equiv\frac{1}{\sqrt2}(|00\rangle-|11\rangle),$$ +for $z\ge0$. +Using the PPT criterion, one can see that this state is separable iff $0\le z\le 1/3$.

+ +

I couldn't, however, find a source discussing explicit separable decompositions (in the $z\le1/3$ regime, of course). +Is there a ""nice"" way to find such decompositions?

+",55,,55,,10/15/2021 15:52,10/15/2021 15:52,What is a separable decomposition for the Werner state?,,2,7,,,,CC BY-SA 4.0 +11526,1,11559,,4/13/2020 10:36,,2,98,"

I am working with Aqua sample (qiskit-aqua/test/finance/test_readme_sample.py ) that uses the FixedIncomeExpectedValue and the AmplitudeEstimation.

+ +

It is qiskit 0.18

+ +

This sample was previously working with qiskit 0.16.2 when Statevector_simulator was used for AmplitudeEstimation. Though I used to run into an error ERROR_RUNNING_JOB when running on ibmq_ hardware. I was told to upgrade to qiskit 0.18 to fix that.

+ +

Since the update it now fails in _check_conflicting_argument with the message ""The parameters pass_manager conflicts with the following parameter(s): backend."" as shown below is a stack trace

+ +
    :
+qc = compiler.transpile(circuit, BasicAer.get_backend('qasm_simulator'), pass_manager=p_m)
+
+File ""C:\Users\-----\Anaconda3\envs\qiskite\lib\site-packages\qiskit\compiler\transpile.py"", line 188, in transpile
+        routing_method=routing_method, backend=backend)
+
+File ""C:\Users\------\Anaconda3\envs\qiskite\lib\site-packages\qiskit\compiler\transpile.py"", line 225, in _check_conflicting_argument
+        ""parameter(s): {}."".format(', '.join(conflicting_args)))
+
+TranspilerError: 'The parameters pass_manager conflicts with the following parameter(s): backend.'
+
+ +

Further walk through the stack trace shows the following

+ +
bckend = set_backend('STATEVEC')
+
+ampest = AmplitudeEstimation(m, fixed_income)
+result = ampest.run(quantum_instance=bckend)
+..quantum_algorithm.run()
+....ae.run
+......if _quantum_instance.is_statevector:
+........construct_circuit(measurement = False)
+..........pec = PhaseEstimationCircuit(...)
+..........pec.construct_circuit(measurement = False)
+............._state_n_circuit_factory(qc,q,aux)
+................uncertainty_model.build(...) #fixed_income_....py
+..................cs = Custom(...) #multivariate_distribution.py
+..................extend(cs.construct_circuit('circuit',q))   
+.....................cs.construct_circuit('circuit')
+........................svc = StateVectorCircuit(_state_vector)
+........................sv.construct_circuit(...)
+..........................convert_to_basis_gates()
+............................Unroller(...)
+............................PassManager(...)
+............................compiler.transpile(circuit, BasicAer.get_backend('qasm_simulator)...)
+.............................. transpile (....)
+................................._check_conflicting_argument(...backend=backend)
+
+ +

It is in this _check_conflicting_argument that the error message is raised ""The parameters pass_manager conflicts with the following parameter(s): backend."" and the script stops execution.

+ +

Please let me know what am I missing something here.

+ +

Thank you

+",5175,,5175,,4/14/2020 21:59,4/15/2020 10:36,Error using FixedIncomeExpectedValue sample,,1,6,,,,CC BY-SA 4.0 +11527,2,,11525,4/13/2020 10:57,,1,,"

Separable decompositions for high-dimensional Werner states are discussed in Unanyan et al. (2007). They find decompositions in terms of infinite terms, but from their Eqs. (10) and (11) it seems that these are reducible to finite decompositions (which we know must always exist for finite-dimensional states).

+ +

In the same paper, they also mention that decompositions for the two-qubit case are given in Wootters (1998) and Azuma and Ban (2006). +In the latter in particular they give an explicit decomposition in the appendix. I'll report this decomposition here, only changing slightly the way the decomposition is written to make the expressions more compact.

+ +

We have:

+ +

$$\rho_q = \sum_{i=1}^4 |z_i\rangle\!\langle z_i|, +\,\,\text{ where }\,\, +|z_i\rangle = \sum_{k=1}^4 (H^{\otimes 2})_{ik}e^{i\theta_k}|x_k\rangle.$$ +The (unnormalised) states $|x_k\rangle$ are defined as: +$$\begin{gathered}|x_1\rangle = -i\sqrt{\lambda_+}|\Psi^-\rangle, \\ |x_2\rangle = \sqrt{\lambda_-}|\Psi^+\rangle, \qquad +|x_3\rangle = \sqrt{\lambda_-}|\Phi^-\rangle, \\ +|x_4\rangle = -i\sqrt{\lambda_-}|\Phi^+\rangle, \end{gathered}$$ +where $\lambda_\pm$ are the eigenvalues of $\rho_q$: $\lambda_+=(1+3q)/4$ and $\lambda_-=(1-q)/4$, +$H$ is the Hadamard matrix, and $\theta_k$ are phases satisfying +$$e^{-2i\theta_1} \lambda_+ + (e^{-2i\theta_2}+e^{-2i\theta_3}+e^{-2i\theta_4})\lambda_-=0$$

+ +

This decomposition follows the method outlined in Wootters 1998 (mostly the second page of the PRL version), but I can't say I fully understand it.

+",55,,55,,4/13/2020 12:10,4/13/2020 12:10,,,,1,,,,CC BY-SA 4.0 +11528,1,,,4/13/2020 11:28,,2,114,"
    +
  1. Let's say I have 2 commuting Hamiltonians that are not degenerate, I know it means that they a have a common energy basis, yet does it mean that they also have the same ground state? Or is there any way to learn something about the ground state of one from knowing the ground state of the other? +Assume that they both have similar structure, for example they are both 2 local on a square lattice acting on n particles.

  2. +
  3. Is there a sufficient condition for two Hamiltonians to have the same groundstate?

  4. +
+",11670,,9006,,4/13/2020 12:29,4/14/2020 13:14,Two commuting Hamiltonians,,1,0,,,,CC BY-SA 4.0 +11530,1,,,4/13/2020 13:54,,2,115,"

I know this has been asked before in different ways, however, I am interested in something with a degree of clarity and focus not found in other questions.

+ +
+ +

What I am looking to get is a list of the most promising and impactful applications that Quantum Machine Learning and resources and references that I can use to understand more.

+ +

As a prerequisite I would ask that the 'application' have a real-world use case and associated industry.

+ +
+

i.e. If we are saying that Quantum Machine Learning gives us Quadratic speedups for Unstructured Search Algorithms than it would be prudent to specify that this could accelerate Drug Discovery and/or Materials Development (and then link to things about Grover's Search Algorithm, Unstructured Search Algorithms, etc.).

+
+ +

Thanks in advance for your help!

+ +
+ +

NOTE: I have reviewed the following StackExchange links prior to asking this:

+ + + +

...and the links on this page were used for background info in addition to an Engineering, Machine Learning and Data Science background (and the TF Whitepaper).

+ + +",11517,,11517,,4/13/2020 15:15,4/13/2020 15:15,What Are The Most Promising Real-World Applications For Quantum Machine Learning,,0,4,,,,CC BY-SA 4.0 +11531,2,,11520,4/13/2020 14:57,,2,,"

Following Gühne and Toth (2008) (pag. 18), a pure state is genuinely multipartite entangled if it cannot be written as tensor product of two states in any bipartition. Equivalently, a state is multipartite entangled if all reduced states are mixed (i.e. computing the partial trace with respect to any subsystem gives a mixed state).

+ +

There is only one way to partition a bipartite space, thus the notion of ""genuine"" bipartite entanglement is equivalent to that of ""normal"" entanglement.

+",55,,55,,4/13/2020 18:34,4/13/2020 18:34,,,,0,,,,CC BY-SA 4.0 +11532,1,,,4/13/2020 15:10,,1,52,"

I was reading this article. A brief explanation: Here we have a circuit, the registers are a stepfunction state, an single photon state and a function state. The first two have position operators $X$ and $Y$, respectively.

+ +

but I'm very confused on how can that the set

+ +

$$\{e^{i\frac{\pi}{2}(\hat{X}^2+\hat{P}^2)},e^{it_1\hat{X}}, e^{it_2\hat{X}^2},e^{it_3 \hat{X}^3},e^{i\tau \hat{X}_1\otimes \hat{X}_2}\}$$

+ +

be the universal set. I mean, where did the Y go?

+ +

In this case $\hat{A}=\lambda \mathbb{I}+\sum_{i=1}^n a_i \hat{X}_i + b_i \hat{P}_i + \alpha_i \hat{X}^2_i +\beta_i \hat{P}^2_i$

+ +

I just want a clue about how to start here, thanks everyone.

+",11674,,,,,4/13/2020 15:10,How can I prove the universality of this set of gates?,,0,2,,,,CC BY-SA 4.0 +11533,1,11566,,4/13/2020 15:13,,2,341,"

Where does The Tensorflow Quantum ( TFQ ) library fall on it's maturity curve.

+ +

In other words can we currently leverage the TFQ library to solve real-world problems? Will we need to wait for a TFQ 2.0?

+ +

Does this library, and if not will it ever, have more than just theoretical usefulness?

+ +

Will companies be utilizing TFQ to build systems that can help companies in the wild solve a problem faster/better than if they had utilized classical systems?

+ +
+ +

Tensorflow Quantum White Paper - For Reference

+",11517,,,,,4/15/2020 19:06,How Mature is the Tensorflow Quantum Library,,1,3,,4/18/2020 14:29,,CC BY-SA 4.0 +11534,1,11539,,4/13/2020 15:24,,3,92,"

Consider a four-qubit circuit with the following structure:

+ +

+ +

where the boxes can be arbitrary two-qubit unitary operations, and the time- evolution proceeds from left to right.

+ +

That not every four-qubit unitary can be decomposed in such a way follows from a simple parameter-counting argument: $(2^4)^2\gg 3(2^2)^2$. +However, consider the case in which we have a fixed input state, and want to generate a target output. From the point of view of the number of free parameters, this seems feasible: $2(2^4)< 3(2^2)^2$. +Is it always possible?

+ +

In other words, given a fixed input $|\psi_0\rangle$ and a target $|\psi_t\rangle$, can we always find two-qubit unitaries $U_{12},U_{23},U_{34}$ (acting nontrivially only on the respective subspaces) such that +$|\psi_t\rangle = (U_{12}\otimes U_{34})U_{23} |\psi_0\rangle$ +?

+",55,,,,,4/13/2020 18:22,Can arbitrary four-qubit states be generated via circuits of the form $(U_{12}\otimes U_{34})U_{23}$?,,1,0,,,,CC BY-SA 4.0 +11535,1,11558,,4/13/2020 15:30,,5,248,"

I have seen two different definition of Fidelity in different sources. For example, Nielsen & Chuang QCQI, 10th edition, page 409 defines Fidelity like the following:

+ +

$$ +F(\rho, \sigma) := \operatorname{tr} \sqrt{\rho^{\frac{1}{2}} \sigma \rho^{\frac{1}{2}}} +$$

+ +

An implementation of this definition is also present in this QETLAB library.

+ +

Another definition that I have found is: +$$ +F(\rho, \sigma) := \Big(\operatorname{tr} \sqrt{\rho^{\frac{1}{2}} \sigma \rho^{\frac{1}{2}}}\Big)^2 +$$ +This def is present in the highly regarded Preskill notes and most other places like wiki, quantiki.

+ +

Was this definition changed sometime? TIA.

+",2403,,2403,,4/15/2020 16:24,4/15/2020 16:24,"Is the quantum state fidelity defined as $F(\rho, \sigma)=\text{tr}\sqrt{\rho^{1/2}\sigma\rho^{1/2}}$ or its square?",,1,0,,,,CC BY-SA 4.0 +11538,1,,,4/13/2020 18:09,,2,45,"

Quantum computing has gained media attention about the exponential increase in computational speeds but only when dealing with specific problems which are prone to a quantum computational approach (such as cryptography)

+ +

Why does quantum computing only increase computational speeds for specific problems? Is this an inherent constraint with Quantum Computing or could we see Quantum Computing increase computational speeds “all around” in the future?

+ +

Thank you!

+ +

Ross

+",11671,,,,,4/13/2020 18:09,"Why does quantum computing only offer faster computational times for certain, specific types of problems?",,0,1,,4/14/2020 9:53,,CC BY-SA 4.0 +11539,2,,11534,4/13/2020 18:22,,3,,"

No, it's impossible. It's easier to go backwards. Let $|\psi_t\rangle = \frac{1}{2}\big(|0000\rangle + |0101\rangle + |1010\rangle + |1111\rangle\big)$. The reduced density matrix $\rho_{12}$ of it on qubits $[1,2]$ will be maximally mixed state $\frac{1}{4}I$ (same on qubits $[3,4]$). Unitaries $U_{12}^{-1}$ and $U_{34}^{-1}$ won't change those $\rho_{12}$ and $\rho_{34}$, they will remain as $\frac{1}{4}I$ after the application. But reducing $\frac{1}{4}I$ to a qubit 1 will result in $\frac{1}{2}I$ and $U_{23}^{-1}$ can't change that. So, the reduced matrix of $|\psi_0\rangle$ on qubit 1 must be equal to $\frac{1}{2}I$, but it's not always the case, $|\psi_0\rangle=|0000\rangle$ is a counterexample.

+",5870,,,,,4/13/2020 18:22,,,,7,,,,CC BY-SA 4.0 +11540,1,,,4/13/2020 18:51,,3,65,"

Can anyone please explain me in simple words how the hyperspherical coordinates can be used to parameterise multi-qubit states?

+ +

The state of an $n$-qubit system can be thought of as a point on the $\mathbb{CP}(2^n-1)$, which is not a sphere. Of course, for small dimensions we have some exceptional correspondences (Hopf fibration), but my question is regarding the case of a general $n$.

+",11515,,,,,4/13/2020 18:51,Hyperspherical parametrization of a multi-qubit state,,0,2,,,,CC BY-SA 4.0 +11541,1,11548,,4/13/2020 19:03,,2,244,"

Let's say I have the following state:

+ +

$$ +|\psi\rangle = \sqrt{\frac{2}{3}} |0000\rangle_{a_1b_1a_2b_2} + \sqrt{\frac{1}{6}} \big( |0011\rangle_{a_1b_1a_2b_2} + |1100\rangle_{a_1b_1a_2b_2} \big). +$$ +I measure the $b_1$ subsystem and find it to be $|0\rangle$. Then the post measurement state is: +$$ +|\psi'\rangle = \frac{\sqrt{\frac{2}{3}} }{\sqrt{\frac{2}{3} + \frac{1}{6}}}|0000\rangle_{a_1b_1a_2b_2} + \frac{\sqrt{\frac{1}{6}} }{\sqrt{\frac{2}{3} + \frac{1}{6}}} |0011\rangle_{a_1b_1a_2b_2} +$$ +Now, I want to trace out subsystems $a_1b_1$ and calculate the fidelity of the remaining system $a_2b_2$ with $|\Phi^+\rangle = \frac{1}{\sqrt{2}} (|00\rangle + |11\rangle)$. This value is found to be: +$$ +|\langle \psi' |\Phi^+\rangle|^2 = .9 +$$ +Here is my question. If instead of tracing out subsystems $a_1b_1$, I trace out $a_2b_2$ and calculate the remaining subsystem's fidelity with $|\Phi^+\rangle$, would I find $.9$ again?

+",2403,,,,,4/14/2020 12:40,Fidelity With Bell State Calculation,,1,0,,,,CC BY-SA 4.0 +11542,2,,11450,4/13/2020 20:01,,3,,"

The answer to my question is given here. The solution from the provided paper is extremely efficient (for it requires $O(n^2 / \log n)$ CNOTs instead of the naïve $O(n^2)$ estimate), and is somewhat nontrivial to implement.

+ +

An easy-to-implement solution with $O(n^2)$ CNOTs can be, however, obtained in just a few lines. First of all, one has to perform the LU-decomposition of the desired matrix $M$. This can be done as follows:

+ +
P, L, U = scipy.linalg.lu(M)
+L = np.mod(L, 2)
+U = np.mod(U, 2)
+
+ +

Luckily, for an invertible matrix $M$, the resulting $P,L,U$ matrices will contain binary entries. Here $P$ is a permutation matrix, and $L$ and $U$ are the lower- and upper-triangular matrices, whose product is the original matrix, $M = P \ L \ U$.

+ +

Permutations $P$ can be implemented using SWAPs. Multiplication by a triangular matrix is also quite straightforward, and is done using CNOTs starting from the most occupied row. In other words, for $U$ one should start from the first row: once the first qubit is calculated, it is never used in the following calculation, and so on. If you, say, wanted to transform qubits according to +$$ +M +\begin{pmatrix} +q_0 \\ q_1 \\ q_2 +\end{pmatrix} += +\begin{pmatrix} +1 & 1 & 1 \\ +0 & 1 & 1 \\ +0 & 0 & 1 +\end{pmatrix} +\begin{pmatrix} +q_0 \\ q_1 \\ q_2 +\end{pmatrix} \ , +$$

+ +

the circuit would look like

+ +

+ +

A typical scenario in which one may need to implement such a matrix transformation on qubit registers arises in quantum simulation. Namely, in order to encode a state of a fermionic system using the Bravyi-Kitaev encoding, one needs to perform a matrix transformation of the original qubit registers (which can equivalently be thought of as being Jordan-Wigner encoded).

+ +

Interestingly enough, the Bravyi-Kitaev encoder matrix is lower-triangular from the very beginning [1], so in this particular case there is no need to perform the LU-decomposition.

+",6313,,6313,,4/14/2020 3:27,4/14/2020 3:27,,,,0,,,,CC BY-SA 4.0 +11544,1,11547,,4/13/2020 22:18,,6,3348,"

I'm studying VQE, but there is something I don't get.

+ +

We know (I think) that for a given Hamiltonian the minimum eigenvalue is associated with the ground state. But if we take the Hamiltonian to be Pauli Z, then it has two eigenvalues: 1 associated with state $ |0 \rangle $ and -1 associated with state $|1 \rangle$. +Clearly the minimum eigenvalue is -1 so the ground state should be $|1\rangle$. But the ground sate for a qubit is $|0\rangle$

+ +

What am I getting wrong?

+",7759,,55,,4/14/2020 13:30,9/28/2021 0:24,How is the ground state of a Hamiltonian defined?,,2,0,,,,CC BY-SA 4.0 +11545,1,,,4/14/2020 0:45,,2,951,"

I installed qiskit using directions at https://qiskit.org/documentation/install.html +I also have spyder installed -Spyder 3.3.6 | Python 3.7.7 64-bit | Qt 5.9.6 | PyQt5 5.9.2 | Windows 10

+ +

It works fine i.e. I am able to build from spyder and connect to ibm_q hardware ... +when I run qiskit.__qiskit_version__ it was

+ +
{'qiskit-terra': '0.12.0',
+ 'qiskit-aer': '0.4.1',
+ 'qiskit-ignis': '0.2.0',
+ 'qiskit-ibmq-provider': '0.5.0',
+ 'qiskit-aqua': '0.6.5',
+ 'qiskit': '0.16.2'}
+
+ +

Then I had to update qiskit to 0.18

+ +

so I went to Conda prompt and did pip install qiskit +the installation went through successfully - if I do conda list I see the following

+ +
:
+qiskit                    0.18.0                   pypi_0    pypi
+qiskit-aer                0.5.0                    pypi_0    pypi
+qiskit-aqua               0.6.5                    pypi_0    pypi
+qiskit-ibmq-provider      0.6.0                    pypi_0    pypi
+qiskit-ignis              0.3.0                    pypi_0    pypi
+qiskit-terra              0.13.0                   pypi_0    pypi
+:
+
+ +

I then did a reset of spyder - inspite of that from the IPython console I still see the older version - 'qiskit': '0.16.2'

+ +

I ran print( qiskit.__qiskit_version__) in my script that runs inside Spyder I still see 'qiskit': '0.16.2' - please help what else needs to be done. What am I missing here? Thank you

+",5175,,55,,9/26/2020 22:17,9/5/2021 0:05,Updating qiskit doesn't update qiskit version from Spyder,,1,1,,,,CC BY-SA 4.0 +11546,2,,11545,4/14/2020 1:16,,1,,"

Previously I had run the pip install qiskit --upgrade in the wrong conda environment.

+ +

So here is how I fixed it

+ +
conda activate <to_the_environment_that_Spyder_uses>
+
+ +

then run pip install qiskit --upgrade

+ +

After successful update completion - verify using conda list +here is what i see now

+ +
:
+qiskit                    0.18.0                   pypi_0    pypi
+qiskit-aer                0.5.0                    pypi_0    pypi
+qiskit-aqua               0.6.5                    pypi_0    pypi
+qiskit-ibmq-provider      0.6.0                    pypi_0    pypi
+qiskit-ignis              0.3.0                    pypi_0    pypi
+qiskit-terra              0.13.0                   pypi_0    pypi
+:
+
+ +

From inside the spyder script - for print( qiskit.__qiskit_version__) +I see

+ +
{'qiskit-terra': '0.13.0', 'qiskit-aer': '0.5.0', 'qiskit-ignis': '0.3.0', 'qiskit-ibmq-provider': '0.6.0', 'qiskit-aqua': '0.6.5', 'qiskit': '0.18.0'}
+
+ +

from the IPython console, I get ...'qiskit': '0.18.0'} too

+",5175,,,,,4/14/2020 1:16,,,,0,,,,CC BY-SA 4.0 +11547,2,,11544,4/14/2020 1:40,,11,,"

A couple of points:

+ +
    +
  1. The ground state is by definition the eigenvector associated with the minimum valued eigenvalue.
  2. +
  3. Lets consider the Pauli Z matrix as you have. First, +\begin{align*} +Z = \begin{pmatrix}1 & 0\\ 0 & -1 \end{pmatrix}. +\end{align*} +As this matrix is diagonal, we can immediately see that the eigenvalues are the values on the main diagonal (so 1 and -1), and they are associated with the standard basis vectors $|0\rangle$ and $|1\rangle$ respectively. Thus, since the eigenvector with the lowest associated eigenvalue is the $|1\rangle$ state, the $|1\rangle$ state is the ground state.
  4. +
+ +

Your confusion may have simply been with the definition of the ground state -- it is not always the $|0\rangle$ state, although for some matrices (such as the identity matrix), it can be.

+ +

A potentially elucidating example may be found in considering the Hadmard matrix, +\begin{align*} + H = \frac{1}{\sqrt{2}} + \begin{pmatrix} + 1 & 1\\ + 1 & -1 + \end{pmatrix}. +\end{align*} +The eigenvalues of this matrix are $1, -1$ with the associated eigenvectors $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ and $\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$. Thus, we know that the ground state of the Hadamard matrix is the $|-\rangle \equiv \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$ state.

+ +

Edit: Upon reflection, I realize that you may be asking what the ground state of a qubit is. This question doesn't entirely make sense to me, as the state of a qubit is represented by a vector rather than a matrix (and thus, does not have eigenstates and eigenvalues on its own). If you could clarify your question, I would be happy to address it more directly.

+",5157,,5157,,4/14/2020 17:44,4/14/2020 17:44,,,,5,,,,CC BY-SA 4.0 +11548,2,,11541,4/14/2020 12:40,,3,,"

No, you wouldn't find $0.9$ again. To make the partial trace calculation simpler you can note that the state $|\psi'\rangle$ is separable under the bipartition $a_1b_1 | a_2 b_2$, i.e. $|\psi'\rangle = |00\rangle \otimes (\sqrt{a} |00\rangle + \sqrt{1-a} |11\rangle)$. So irrespective of the value of $a$ we have $\operatorname{Tr}_{a_2b_2}[|\psi'\rangle\langle \psi'|] = |00\rangle\langle 00|$.

+ +

The fidelity calculation should then be relatively straightforward.

+",9854,,,,,4/14/2020 12:40,,,,0,,,,CC BY-SA 4.0 +11549,1,11564,,4/14/2020 12:54,,2,907,"

On the English Wikipedia, $XX$ Ising gates are defined in matrix form as :

+ +

$$ XX(\phi) = \begin{bmatrix}\cos(\phi)&0&0& -i \sin(\phi)\\ +0&\cos(\phi)&-i \sin(\phi) & 0 \\ +0 & -i \sin(\phi) & \cos(\phi) & 0 \\ +-i \sin(\phi) & 0 & 0 & \cos(\phi) \\ +\end{bmatrix}$$

+ +

However, on the French Wikipedia, the $XX$ Ising gates are defined as :

+ +

$$ XX(\phi) = \frac{1}{\sqrt{2}}\begin{bmatrix}1&0&0& -i e^{i \phi}\\ +0&1&-i & 0 \\ +0 & -i & 1 & 0 \\ +-i e^{i \phi} & 0 & 0 & 1 \\ +\end{bmatrix}$$

+ +

From some sources, I believe the right one is the first one. I would like some confirmations about the second definition being an error, and I would be glad to take any explanation on it. In particular, does this matrix in the second definition corresponds to the definition of another gate?

+",10065,,10065,,4/16/2020 9:24,4/16/2020 9:24,Matrix definition of the Ising XX gate,,1,0,,,,CC BY-SA 4.0 +11550,2,,11528,4/14/2020 13:14,,3,,"

It is instructive to remind oneself that in finite dimensions, Hamiltonians are represented by Hermitian matrices and think in terms of these matrices. If two Hamiltonians $H_1$ and $H_2$ commute, then -- as you pointed out -- there exists a common eigenbasis in which they are both diagonal: +$$ +H_1 = \operatorname{diag}(\lambda_1, \lambda_2, \dots, \lambda_n) \qquad +H_2 = \operatorname{diag}(\mu_1, \mu_2, \dots, \mu_n) +$$ +Note that the eigenvalues will not be ordered and that I start enumerating basis states with $|1\rangle$. The groundstate of $H_1$ ($H_2$) in this basis is the basis vector $\boldsymbol{e}_j = |{j}\rangle$ for which $\lambda_j$ ($\mu_j$) is the minimal eigenvalue.

+ +

From this, we can already construct a very simple counterexample to your first question, just consider the two Hamiltonians +$$ +H_1 = \begin{bmatrix} -1 & 0 \\ 0 & 1\end{bmatrix}\qquad +H_2 = \begin{bmatrix} 1 & 0 \\ 0 & -1\end{bmatrix} +$$ +The first has ground state $\boldsymbol{e}_1 = |1\rangle$ whereas the second has groundstate $\boldsymbol{e}_2 = |2\rangle$. The only benefit you get from knowing that the Hamiltonians commute is that you know that one of the eigenstates of $H_1$ will also be an eigenstate of $H_2$. In the non-degenerate case, this means that you could just try all eigenstates of $H_1$ on $H_2$ and you find the groundstate, but nothing more than that.

+ +

This highlights that you can't make non-trivial statements about the groundstate of $H_2$ when knowing the groundstate of $H_1$ in general. I personally don't know if this changes if the Hamiltonians in question have more structure like 2-locality.

+ +

I'm not able to point you to a reference for your second question. Phrasing it in the language of matrices, the question becomes ""Do $H_1$ and $H_2$ have the same eigenvector for their minimal eigenvalue?"". It seems obvious to me that there is no further sufficient condition for this.

+",10250,,,,,4/14/2020 13:14,,,,0,,,,CC BY-SA 4.0 +11553,2,,11506,4/14/2020 14:26,,2,,"

Unfortunately $D_{\max}$ is not a continuous function and so functions built from it tend not to be continuous. For example consider consider the two states

+

$$ +\rho_{AB} = |00 \rangle \langle 00|, +$$ +and +$$ +\tau_{AB}(\epsilon) = (1-\epsilon) |00 \rangle \langle 00 | + \epsilon | 11\rangle \langle 11 |. +$$ +A quick calculation gives $I_{\max}(\rho_{AB}) = 0$ and $I_{\max}(\tau_{AB}(\epsilon)) = \max\{- \log(\epsilon), -\log(1-\epsilon)\}$. So $I_{\max}(\rho_{AB}) \neq \lim_{\epsilon \rightarrow 0} I_{\max}(\tau_{AB}(\epsilon)) = \infty$.

+

However, some authors have studied a smoothed version of $I_{\max}$ (see https://arxiv.org/pdf/1308.5884.pdf).

+",9854,,9854,,7/25/2021 21:18,7/25/2021 21:18,,,,3,,,,CC BY-SA 4.0 +11554,1,16347,,4/14/2020 14:42,,4,368,"

What is the simplest quantum circuit which takes states $|a\rangle$ and $|b\rangle$ as its input, and outputs the superposition $\frac{1}{\sqrt{2}}\left(|a\rangle+|b\rangle\right)$?

+
+

Cross-posted on Physics.SE

+",5600,,55,,3/4/2021 12:21,3/4/2021 13:11,What is the simplest circuit which given $|a\rangle$ and $|b\rangle$ outputs the superposition $\frac{1}{\sqrt{2}}\left(|a\rangle+|b\rangle\right)$?,,1,2,0,,,CC BY-SA 4.0 +11555,1,11561,,4/14/2020 18:00,,2,86,"

I apologize for a simple question, should be quite trivial. How do I construct a circuit for preparing such a state? +$$ +|0\rangle^n \mapsto \cos(\theta)|0...0\underset{i}{1}0...0\rangle + \sin(\theta) |0...0\underset{j}{1}0...0\rangle \ , +$$ +where the $i$th and $j$th qubits are in the $|1\rangle$ state.

+",6313,,,,,4/14/2020 21:48,Preparing a linear combination of two $1$-occupied states,,1,0,,,,CC BY-SA 4.0 +11558,2,,11535,4/14/2020 20:39,,4,,"

Both definitions are used and authors usually make it clear which one they mean.

+ +

Wikipedia also points this out under the Alternative Defintion section.

+",4831,,,,,4/14/2020 20:39,,,,0,,,,CC BY-SA 4.0 +11559,2,,11526,4/14/2020 20:48,,1,,"

The quick answer to your problem is to install Qiskit Aqua directly from GitHub instead of via pip. On the lastest master version, this bug is fixed. You can do this using

+ +
git clone https://github.com/Qiskit/qiskit-aqua
+cd qiskit-aqua
+pip install .
+
+ +

more detailed instructions are given on Qiskit's webpage.

+ +

As to why you're getting this error: This comes from a change in Qiskit Terra which resulted in an incompatibility with the current implementation in Qiskit Aqua. That was fixed in this commit on GitHub. This fix is in the master branch of the repository, however when you're installing via pip you're getting the last stable version, where this fix is not yet included. With the next release of Aqua (this will be 0.7.0) this bug is resolved in the pip version, too.

+",9800,,5955,,4/15/2020 10:36,4/15/2020 10:36,,,,0,,,,CC BY-SA 4.0 +11561,2,,11555,4/14/2020 21:48,,3,,"

Here is an example of such circuit for five qubits.

+ +

+ +

A gate $Ry$ acting on qubit $q_1$ prepares superposition

+ +

$$ +\cos(\theta/2)|0\rangle + \sin(\theta/2)|1\rangle. +$$

+ +

When qubit $q_1$ is in state $|0\rangle$ (with probability $\cos^2(\theta/2)$), qubit $q_3$ is in state $|1\rangle$ thanks to gate $X$.

+ +

When qubit $q_1$ is in state $|1\rangle$ (with probability $\sin^2(\theta/2)$), qubit $q_3$ is in state $|0\rangle$ thanks to gate $X$ and CNOT gate (two negation is equal to no negation).

+ +

Other qubits are not changed and remain in state $|0\rangle$. As a result, the circuit produce state +$$ +\cos(\theta/2)|00010\rangle + \sin(\theta/2)|01000\rangle. +$$

+ +

You can construct similar circuit for any positions $i$ and $j$ simply by putting $Ry$ gate with proper parameter $\theta$ on one qubit, gate $X$ on second qubit and then ""connect"" them with CNOT gate.

+",9006,,,,,4/14/2020 21:48,,,,1,,,,CC BY-SA 4.0 +11562,1,11563,,4/15/2020 4:19,,1,39,"

Problem

+ +

Apply a global phase -1 to all qubits x : Qubit[].

+ +

My solution

+ +

ApplyToEach(R, PauliI, 2.0 * PI(), x)

+ +

However this yields a syntax error.

+ +

From the ApplyToEach doc, it works if the operation has no parameters:

+ +
using (register = Qubit[3]) {
+    ApplyToEach(H, register);
+}
+
+ +

Thank you for your expertise. Happy qubitting!

+",7951,,,,,4/15/2020 5:51,How to use ApplyToEach when operation has parameters?,,1,0,,,,CC BY-SA 4.0 +11563,2,,11562,4/15/2020 5:51,,1,,"

You need to use partial application to specify the rest of the parameters passed to the R gate. The result of partial application will be a gate that takes a single qubit as an argument, and ApplyToEach will be able to apply it to each element of the array:

+ + + +
using (register = Qubit[3]) {
+    let globalPhaseGate = R(PauliI, 2.0 * PI(), _);
+    ApplyToEach(globalPhaseGate, qs);
+}
+
+ +

You can also write this shorter, without using an extra constant to name the gate that is the result of partial application:

+ + + +
using (register = Qubit[3]) {
+    ApplyToEach(R(PauliI, 2.0 * PI(), _), register);
+}
+
+",2879,,,,,4/15/2020 5:51,,,,1,,,,CC BY-SA 4.0 +11564,2,,11549,4/15/2020 7:04,,10,,"

Your first option is the correct one, being related to $e^{-i\phi X\otimes X}$, which is +$$ XX(\phi) = \begin{bmatrix}\cos(\phi)&0&0& -i \sin(\phi)\\ +0&\cos(\phi)&-i \sin(\phi) & 0 \\ +0 & -i \sin(\phi) & \cos(\phi) & 0 \\ +-i \sin(\phi) & 0 & 0 & \cos(\phi) \\ +\end{bmatrix}.$$

+ +

The second option doesn't make a whole lot of sense; it's not even unitary, so it's really not right. It cannot be the definition of a gate.

+",1837,,1837,,4/16/2020 8:48,4/16/2020 8:48,,,,2,,,,CC BY-SA 4.0 +11566,2,,11533,4/15/2020 19:06,,13,,"

First we should take a step back. Is there any machine learning done a quantum computer that cannot be efficiently simulated on a classical computer? The answer currently (2020) is no. In this respect quantum machine learning (which has many variants) is at the fundamental research phase. None of this is at a stage where it is at all considered something that should be mentioned in the same sentence with ""production"".

+ +

The last paragraph is probably a downer, but if you're a researcher it's an upper, because there are lots of open questions. There are a lot of really interesting ideas about how a quantum computer might be useful for machine learning. These differ on whether their data is quantum or classical, and how you put together different classical and quantum building blocks. The question is whether these will be useful for near term quantum computers (which have O(100) qubits and can computer for O(100) clock cycles before noise overwhelms them), and also whether they are interested for error correct quantum computers (think 5-15 years out). This is an area of active research. There is also a big caveat to what I said, and that is that while the quantum computations one might do can be classically simulated, in some cases, where your data is quantum, just being able do some small quantum computation on that quantum data can allow you to do things that you cannot do at all. These tasks are often ""quantum sensor"" problems, and are considered by many to be the first place practical quantum machine learning will be used.

+ +

So what is TensorFlow Quantum? It's a platform for doing research on quantum machine learning algorithms. It can be hooked up to a real quantum device, but where it excels right now is in performing classical simulations of quantum machine learning ideas. In particular it makes it very easy to do quantum machine learning with models that have quantum programs (quantum circuits) and classical machine learning (what people sometimes call hybrid algorithms) mixed together. It is integrated with TensorFlow and also with a framework for writing quantum programs Cirq. It is also backed by a highly efficient classical simulator of quantum programs, qsim. One advantage of TFQ is that it can leverage TensorFlow's ability to scale up training across a large distributed cluster. This, combined with the fast simulator, should allow researchers to quickly explore the space of possible research ideas.

+ +

Note that there are quite a few other quantum machine learning frameworks out there. These are all primarily aimed at helping researchers. Prominent ones are PennyLane and Microsoft's Quantum Machine Learning library in Q#. IBM also has nice tutorials on using their quantum programming framework for quantum machine learning.

+",189,,,,,4/15/2020 19:06,,,,2,,,,CC BY-SA 4.0 +11567,1,,,4/16/2020 2:08,,1,67,"

I am given the following +$\newcommand{\on}[1]{{\operatorname{#1}}}$

+ +
+

Let $|i\rangle$, $1 \leq i \leq \on{dim}\,\mathcal{H_A}, |s\rangle$, $1 \leq s \leq \on{dim}\,\mathcal{H_B}$ be unitary bases. Write $\Lambda = \sum_{i,j,s,t}\Lambda^{\begin{pmatrix}i \\ j\end{pmatrix}}_{ \begin{pmatrix}s \\t \end{pmatrix}}|i\rangle \langle j | \otimes|s\rangle\langle t|$ so $CJ(\Lambda)$ Hermitian implies $\Lambda^{\begin{pmatrix}i \\ j\end{pmatrix}}_{ \begin{pmatrix}s \\t \end{pmatrix}} = \overline{\Lambda}^{\begin{pmatrix}j \\ t\end{pmatrix}}_{ \begin{pmatrix}i \\s \end{pmatrix}}$

+
+ +

I know the following

+ +
+
+
    +
  1. $\Lambda$ is a quantum channel such that $$\Lambda : \on{End}(\mathcal{H_A}) \xrightarrow{} \on{End}(\mathcal{H_B})$$ + Where $\on{End}(\mathcal{H_A})$ refers to the endomorphism over Hilbert space A + $$$$

  2. +
  3. $CJ$ refers to the Choi-Jamiolkowki isomorphism which is of the form: + $$CJ: \on{Hom}(\on{End}(\mathcal{H_A}),\on{End}(\mathcal{H_B)}) \rightarrow \on{End}(\mathcal{H_A^*}\otimes\mathcal{H_B})$$ where $\on{Hom}$ refers to homomorphism (I believe)

  4. +
+
+
+ +

What does the subscript, superscript notation mean on the $\Lambda$s?

+",11648,,55,,10/22/2020 10:51,10/22/2020 10:51,Understanding Quantum Channel and Choi Jamiolkowski Notation,,0,4,,7/18/2020 23:36,,CC BY-SA 4.0 +11568,1,11570,,4/16/2020 7:38,,0,162,"

Learning from the ground up (while great) is an overdose of the mathematics behind quantum computing and is taking way too long to grasp.

+ +

I have a Computer Science / Programming background. I am happy to learn the programming aspects and then go back and learn the math behind it or learn the background math whenever it is necessary while programming.

+ +

I started with MacMahon's book and now on Nielsen and Chuang.. but I feel it is taking longer to get to the application layer.

+",11708,,11708,,4/16/2020 8:09,4/16/2020 8:09,Can I learn Quantum Programming and then go back to learn the Mathematics / Physics behind it later?,,1,0,,,,CC BY-SA 4.0 +11569,1,,,4/16/2020 7:52,,4,130,"

I would like to prepare an ansatz for VQE. +I know UCC ansatz is one of the most useful ansatz, but I would like to reduce the number of CNOT.

+ +

From the matrix of a given Hamiltonian, can we know the ansatz for the given Hamiltonian needs entanglers or not?

+",8673,,,,,4/21/2020 14:20,In which type of Hamiltonian does the ansatz need an entangler in VQE?,,1,0,,,,CC BY-SA 4.0 +11570,2,,11568,4/16/2020 8:06,,1,,"

Quantum computing is completely different paradigm in comparison with classical computers. Therefore an approach to programming quantum computers is different as well. It is not only about learning a new programming language but also about understanding underlying technology. Currently, there is only a little abstraction between quatum algorithms (programs) and quantum hardware. Nowadays, programming a quantum computer is similar to approach used in 1950's when computers were programmed in assembler or even microinstructions (what is different that we have common quantum gates).

+ +

There are some higher programming languages (for example Qiskit based on Python) helping you to load data into a quantum computer and postprocess results. However, quantum algorithm is still expressed on quantum gates level.

+ +

Overall, to be able to program quantum computer and understand why you do so, you should learn at least basic mathematical background of quantum computing.

+",9006,,,,,4/16/2020 8:06,,,,5,,,,CC BY-SA 4.0 +11571,1,,,4/16/2020 8:46,,2,181,"

I try to run HHL algorithm on quantum computer in Qiskit Notebooks on the site. I take it from here https://qiskit.org/textbook/ch-applications/hhl_tutorial.html but it doesn't work. The error message is + ""Credentials are already in use. The existing account in the session will be replaced."" and ""circuits = [qc_qa_c, qc_qa_3cx, qc_qa_5cx]""

+",10395,,2293,,4/17/2020 18:08,4/17/2020 18:08,Problem with HHL algorithm on Qiskit,,1,0,,,,CC BY-SA 4.0 +11572,2,,11571,4/16/2020 10:33,,6,,"

These aren't error messages, they are just outputs. The first message simply means it will be using your credentials for the session. This has probably popped up because you have run IBMQ.load_accounts() more than once. The second message appears to just be the output of the creation of the circuits variable.

+",5955,,,,,4/16/2020 10:33,,,,1,,,,CC BY-SA 4.0 +11573,1,11579,,4/16/2020 11:19,,3,914,"

I want to construct a following 16x16 matrix (system of four qubits)

+ +

$U=\text{diag}(1,1,...,1,e^{-iV},e^{-iV})$

+ +

where $V$ is a constant.

+ +

So this matrix describe these rotations:

+ +

$|1110 \rangle \to e^{-iV}|1110\rangle$

+ +

$|1111 \rangle \to e^{-iV}|1111\rangle$

+ +

No rotation is applied to other computational basis states.

+ +

Following the book Principles of quantum computation and information I can build this $C^4$-$U$ gate: (with ancillary qubits)

+ +

+ +

In my situation, I have to build a $C^3$-$U$ gate, but the procedure is the same.

+ +

My problem is when I have to apply this $C$-$U$ that appears in the middle of the $C^3$-$U$ gate.

+ +

I don't know how to construct the $C$-$U$ gate so that it performs ONLY the rotation $e^{-iV}$ on q[0], leaving the rest of thee qubits (q[1], q[2], q[3]) as they were.

+ +

I understand that if I know how to construct the $C$-$U$, I will have the $C^3$-$U$ gate which represents the matrix I want to implement.

+",10202,,9006,,4/16/2020 13:09,4/21/2020 20:41,Controlled-U gate on IBMQ,,2,3,,,,CC BY-SA 4.0 +11574,1,,,4/16/2020 12:28,,2,68,"

I'm running tomography job like I have done many times before. I send the job, and the job.status() is 'DONE'. But when I ask for job.results() I get the following traceback.

+ +

I'm using version 0.18.0.

+ +
---------------------------------------------------------------------------
+KeyError                                  Traceback (most recent call last)
+/anaconda3/envs/quantum/lib/python3.7/site-packages/qiskit/providers/ibmq/api/clients/account.py in job_result(self, job_id, use_object_storage)
+    245         try:
+--> 246             return self.job_get(job_id)['qObjectResult']
+    247         except KeyError as err:
+
+KeyError: 'qObjectResult'
+
+The above exception was the direct cause of the following exception:
+
+ApiIBMQProtocolError                      Traceback (most recent call last)
+/anaconda3/envs/quantum/lib/python3.7/site-packages/qiskit/providers/ibmq/job/ibmqjob.py in _retrieve_result(self, refresh)
+    675             try:
+--> 676                 result_response = self._api.job_result(self.job_id(), self._use_object_storage)
+    677                 self._result = Result.from_dict(result_response)
+
+/anaconda3/envs/quantum/lib/python3.7/site-packages/qiskit/providers/ibmq/api/clients/account.py in job_result(self, job_id, use_object_storage)
+    248             raise ApiIBMQProtocolError(
+--> 249                 'Unexpected return value received from the server: {}'.format(str(err))) from err
+    250 
+
+ApiIBMQProtocolError: ""Unexpected return value received from the server: 'qObjectResult'""
+
+The above exception was the direct cause of the following exception:
+
+IBMQJobApiError                           Traceback (most recent call last)
+<ipython-input-50-0a8321076fbb> in <module>
+----> 1 experimental_state = StateTomographyFitter(best_full_tomography_job.result(), best_full_tomography_transpiled).fit()
+      2 plot_state_hinton(experimental_state)
+
+/anaconda3/envs/quantum/lib/python3.7/site-packages/qiskit/providers/ibmq/job/ibmqjob.py in result(self, timeout, wait, partial, refresh)
+    253                     'Use job.error_message() to get more details.'.format(self.job_id()))
+    254 
+--> 255         return self._retrieve_result(refresh=refresh)
+    256 
+    257     def cancel(self) -> bool:
+
+/anaconda3/envs/quantum/lib/python3.7/site-packages/qiskit/providers/ibmq/job/ibmqjob.py in _retrieve_result(self, refresh)
+    687                 raise IBMQJobApiError(
+    688                     'Unable to retrieve result for '
+--> 689                     'job {}: {}'.format(self.job_id(), str(err))) from err
+    690             finally:
+    691                 # In case partial results are returned or job failure, an error message is cached.
+
+IBMQJobApiError: 'Unable to retrieve result for job 5e984c5e6ad41d00184b12c1: ""Unexpected return value received from the server: \'qObjectResult\'""'
+
+ +

What does it mean, and what went

+ +

EDIT:

+ +

I now see that when I retrieve a previously ran job, I get a warning message:

+ +
/anaconda3/envs/quantum/lib/python3.7/site-packages/qiskit/qobj/qasm_qobj.py:497: DeprecationWarning: qiskit.qobj.Qobj is deprecated use either QasmQobj or PulseQobj depending on your application instead.
+  experiments=experiments, header=header)
+
+",8069,,8069,,4/16/2020 18:29,4/16/2020 18:29,IBMQJob.result() returns KeyError: 'qObjectResult',,0,8,,,,CC BY-SA 4.0 +11575,1,11604,,4/16/2020 14:35,,1,156,"

I'm using the following piece of python code:

+ +
import matplotlib.pyplot as plt
+from qiskit import *
+from qiskit.tools.visualization import plot_bloch_multivector, plot_histogram
+
+from qiskit import execute, IBMQ, BasicAer
+from qiskit.providers.ibmq import least_busy
+from qiskit.tools.monitor import job_monitor
+
+secret_number = ""1010""
+n = len(secret_number)
+circuit = QuantumCircuit(n+1, n)
+circuit.h(range(n))
+circuit.x(n)
+circuit.h(n)
+circuit.barrier()
+for i,v in enumerate(reversed(secret_number)):
+    if v==""1"":
+        circuit.cx(i, n)
+
+circuit.barrier()
+circuit.h(range(n))
+circuit.barrier()
+circuit.measure(range(n), range(n))
+simulator = Aer.get_backend(""qasm_simulator"")
+sim_result = execute(circuit, backend=simulator, shots=4096).result()
+
+
+IBMQ.load_account()
+provider = IBMQ.get_provider(""ibm-q"")
+# qcomp = provider.get_backend(""ibmq_16_melbourne"")
+qcomp = provider.get_backend(""ibmq_burlington"")
+job = execute(circuit, backend=qcomp, shots=4096)
+job_monitor(job)
+real_result = job.result()
+counts = real_result.get_counts(circuit)
+import collections
+c = collections.Counter(counts)
+
+# printing
+print(circuit.draw())
+print(""result simulation:"")
+print(sim_result.get_counts())
+print(""results (top 5):"")
+print(c.most_common(5))
+
+ +

The results are shown here:

+ +

+ +

As you can see, the expected result is 1010, which is correctly the value that the quantum simulator gives me. However, I find this result on the fifth position for this execution in the real quantum computer. Is this due to noise? How can I get around this?

+ +

As complementary information, I tried the same code with secret_number = ""1011001"" and the ibmq_16_melbourne server. These are the results: +

+ +

As you see. The error is amplified.

+",11609,,11609,,4/16/2020 16:03,4/19/2020 0:45,Bernstein-Vazirani IBMQ error due to probably measurements,,2,4,,,,CC BY-SA 4.0 +11576,1,,,4/16/2020 16:02,,1,56,"

I've created a same circuit that I've executed two different ways on the same computer (ibmq_16_melbourne); First with 1024 Shots and secondly with 8096 Shots

+ +

For the first (1024), I got in results, a ""Running"" time of 8.8s +For the second (8096), I got in results, a ""Running"" time of 35.7s

+ +

What does this ""Running"" field means exactly? Is it not a running execution time on the quantum computer?

+ +

If so, normally, I should got about 70 seconds for the second way. +Why is it shorter?

+ +

Thank you for your help & answers.

+",11714,,5955,,4/17/2020 9:56,4/17/2020 9:56,"Meaning of ""Running"" time field in Results and correlation with the ""shots"" choosen number",,0,4,,,,CC BY-SA 4.0 +11577,2,,11575,4/16/2020 16:02,,0,,"

This is a partial answer, in case somebody is having the same issue as I.

+ +

My code was based on this IBM tutorial video but with the implementation in the real computer, for the video they use the description of the oracle with CX gate. However in the documentation's example, they use the Z gate for reasons that are still unclear to me, since I'm still learning and I don't have the necessary background. Thus, on the question's code, it suffice to replace circuit.cx(i, n) with circuit.z(i) and then you can see the magic in the following picture:

+ +

+ +

The reason why CX gate doesn't work is still unclear to me. It would be nice if anyone can provide some clarification.

+",11609,,11609,,4/16/2020 16:10,4/16/2020 16:10,,,,0,,,,CC BY-SA 4.0 +11578,2,,7117,4/16/2020 18:40,,2,,"

When I tried getting data after using job = backend.retrieve_job('JOB_ID'), I got ""QiskitError: 'Data for experiment ""circuit0"" could not be found.'""

+ +

When I tried using job_info = provider.circuits.client.get_job(job_id), I got ""AttributeError: 'AccountProvider' object has no attribute 'circuits'.""

+ +

What worked for me was job_info={the entire text of the json file downloaded from Results}, and then proceeding as James described above.

+",11715,,5955,,4/16/2020 22:08,4/16/2020 22:08,,,,3,,,,CC BY-SA 4.0 +11579,2,,11573,4/16/2020 21:33,,2,,"

You can implement your gate $U$ with following circuit (note that I denoted qubits differently, i.e. qubits $q_0$, $q_1$ and $q_2$ are controlling qubits and $q_3$ is target qubit):

+ +

+ +

I will start with description of gates acting on qubits $q_2$ and $q_3$. Gate $U1$ is defined as follows +$$ +U1(\theta) = +\begin{pmatrix} +1 & 0 \\ +0 & \mathrm{e}^{i \theta} +\end{pmatrix} +$$

+ +

When gate $U1$ acts on qubit $q_2$ and identity gate $I$ acts on qubit $q_3$, they together +compose so-called controlled global phase gate denoted by matrix

+ +

$$ +U1 \otimes I = +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & \mathrm{e}^{i \theta} & 0 \\ +0 & 0 & 0 & \mathrm{e}^{i \theta} +\end{pmatrix} +$$

+ +

This gate changes a phase of $q_3$ only in case $q_2$ is in state $|1\rangle$.

+ +

However, we want the gate $U$ to act only in case qubits $q_0$, $q_1$ and $q_2$ are all in state $|1\rangle$. This means that gate $U1$ has to be controlled by qubits $q_0$ and $q_1$ as well. Since there is only gate $U1$ controlled by one qubit, we have to use Toffoli gate (logical AND) to indicate whether both qubits $q_0$ and $q_1$ are in state $|1\rangle$. The result of Toffoli gate is stored in ancila qubit $q_4$ and then used for controlling gate $U1$. Finnaly ancila qubit is uncomputed again by Toffoli gate (because this gate is inverse to itself) back to state $|0\rangle$.

+ +

Eventuall, only in case qubits $q_0$, $q_1$ and $q_2$ are all in state $|1\rangle$ (as indicated by $X$ gates in the figure), the gate acts and change the phase as desired.

+ +

A matrix describing the circuits is this +$$ +U = +\begin{pmatrix} +I_4 & O_4\\ +O_4 & U_1 \otimes I \\ +\end{pmatrix} += \text{diag}(1,1\ \cdots, \mathrm{e}^{i\theta},\mathrm{e}^{i\theta}), +$$ +where $I_4$ is 4x4 unit matrix and $O_4$ is 4x4 zero matrix.

+",9006,,,,,4/16/2020 21:33,,,,0,,,,CC BY-SA 4.0 +11580,1,11624,,4/16/2020 22:29,,7,644,"

The Choi-Jamiolkowski of a channel $\newcommand{\on}[1]{\operatorname{#1}}\Lambda : \on{End}(\mathcal{H_A}) \xrightarrow{} \on{End}(\mathcal{H_B})$ is obtained through an isomorphism of the form: +$$ + CJ: + \on{Hom}(\on{End}(\mathcal{H_A}),\on{End}(\mathcal{H_B)}) + \rightarrow + \on{End}(\mathcal{H_A^*}\otimes\mathcal{H_B}), +$$ +Where $\on{End}(\mathcal{H})$ is the set of endomorphisms over the Hilbert space $\mathcal{H}$.

+ +

How does one interpret $CJ(\Lambda)$ ?

+",11647,,55,,10/22/2020 10:51,10/22/2020 12:17,What does it mean to take the Choi-Jamiolkowski of a quantum channel?,,2,3,,,,CC BY-SA 4.0 +11581,1,11608,,4/17/2020 5:41,,3,324,"

Background

+

I am curious to learn more about any work that has been done regarding quantum systems that deal with infinite values. I am primarily interested in photonic quantum computing; however I am open to learning about other systems where infinite values are used.

+

Here are a few snippets that lead me to believe this is a valid concept to consider:

+

In Can we process infinite matrices with a quantum computer?, there is an answer that states:

+
+

If instead of manipulating the quantum information in qubits, your quantum computer were to do operations on qu𝑑its with 𝑑 being infinity, then you'd essentially be processing infinite matrices on a quantum computer.

+
+

Additionally, in another question there is an answer that states:

+
+

To get you started, the fundamental difference between the CV model and the traditional qubit model is that in the CV model, we formally apply operations on infinite-dimensional instead of two-dimensional systems. Of course, in practice, each system can be effectively described by a large but finite-dimensional Hilbert space, but it is more mathematically convenient to describe operators and states on the full infinite-dimensional space.

+
+

In Is quantum computing limited to a superposition of only two states? there is an answer that states:

+
+

In principle, there is no limit to the dimension of the state space of a quantum system. There could even be an "infinite" dimensional separable Hilbert space (in short, separable means denumerable/countable with a one-one onto mapping to the natural numbers).

+
+

From Nonseparable Hilbert space:

+
+

Furthermore, the article on Hilbert spaces contains the following:

+

A Hilbert space is separable if and only if it admits a countable orthonormal basis.

+

In case of field theory, it states:

+

Even in quantum field theory, most of the Hilbert spaces are in fact separable, as stipulated by the Wightman axioms. However, it is sometimes argued that non-separable Hilbert spaces are also important in quantum field theory, roughly because the systems in the theory possess an infinite number of degrees of freedom and any infinite Hilbert tensor product (of spaces of dimension greater than one) is non-separable.

+
+

Questions

+

What systems make use of countable infinities? How are they used?

+

What systems make use of uncountable infinities? How are they used?

+",2645,,55,,9/23/2020 12:21,9/23/2020 12:21,What types of quantum systems use infinite values?,,1,2,,,,CC BY-SA 4.0 +11582,2,,11573,4/17/2020 8:43,,1,,"

In addition to Martin Vesely's answer:

+ +

Here I want to share an alternative way of implementing ccu1(t, q[0], q[1], q[2]) gate, where $t$ is some phase. It can be shown that ccu1 gate can be decomposed in the following way:

+ +
ccu1(t, q[0], q[1], q[2]) =
+
+ +
cu1(t/2, q[0], q[1])
+cx(q[1], q[2])
+cu1(-t/2, q[0], q[2])
+cx(q[1], q[2])
+cu1(t/2, q[0], q[2])
+
+ +

where:

+ +
cu1(t, q[0], q[1]) =
+
+ +
u1(t/2, q[0])
+cx(q[0], q[1])
+u1(-t/2, q[1])
+cx(q[0], q[1])
+u1(t/2, q[1])
+
+ +

As can be found here. So, this implementation of ccu1 gate will require 17 gates in Qiskit and no ancillary qubit. For the version with the ccx gates we will need 35 gates in Qiskit if we will use this decomposition for ccx.

+ +
+ +

EDIT (by Martin Vesely): For graphical illustration, here is the circuit implementing $U$ on IBM Q for $t = \pi$:

+ +

+",9459,,9459,,4/21/2020 20:41,4/21/2020 20:41,,,,4,,,,CC BY-SA 4.0 +11584,1,,,4/17/2020 16:40,,5,498,"

One often reads that the key reason why classical computers (probabilistic or deterministic) are unable to simulate quantum algorithms such as Simon's or Shor's efficiently is that a classical computer needs $2^n$ complex numbers to represent an $n$ qubit state of a quantum computer. While it is true that the dimensionality of the Hilbert space spanned by an $n$ qubit computational basis is $2^n$, it seems to me that the subspaces reachable by many quantum algorithms that employ fixed sequence of unitary gates are substantially smaller.

+ +

Let $n$ be the number of qubits in a quantum computer. Consider an algorithm that starts from some simple initial state (say the 0 for all qubits) and employs a sequence of $kn$ unitary gates ($k$ being some factor), each involving no more than 1 or 2 qubits. One may ask: What is the size of the Hilbert subspace reachable by this algorithm from the initial state? A 2 qubit gate should not need more than 16 complex numbers for its representation and $kn$ such gates in a fixed sequence will not need more than $16kn$ such numbers (in reality the factor will be smaller). The fact that the sequence of gates is a fixed one is important in this argument to avoid branching. Many algorithms including Shor's, Grover's, Simon's are based on fixed gate sequences like this. If the number of gates scales as a polynomial of $n$, the ""size"" of the Hilbert subspace reachable from the initial state should scale as polynomial of $n$ as well. Therefore, I do not see why we would need $2^n$ complex numbers as would be needed to describe the entire Hilbert space. Can someone help explain why? If my thinking is correct, wouldn't this logic be a generalization of Gottesman-Knill theorem and wouldn't it also imply that there exists ""classical"", possibly probabilistic computing, algorithms capable of equalling Simon's and Shor's in efficiency? What am I missing?

+",11645,,9006,,4/17/2020 22:01,4/26/2020 21:03,Does a classical computer really require $2^n$ complex numbers to represent the state of $n$ qubit quantum computer?,,5,3,,,,CC BY-SA 4.0 +11585,2,,11516,4/17/2020 18:14,,2,,"

You only have 4 qubits, so the ""full operator"" is only at most a 16x16 matrix that combines all 7 of those multi-qubit gates. You can derive this ""full operator"" in MATLAB quite easily by using the ""kron"" function to build up the multi-qubit gates from 1-qubit and 2-qubit gates (2x2 and 4x4 matrices respectively), and then doing matrix multiplication.

+ +

As for the second question: ""what operation does this circuit implement"", this will become easier to answer once you figure out the 16x16 matrix see what it does to the four input qubits.

+",2293,,,,,4/17/2020 18:14,,,,0,,,,CC BY-SA 4.0 +11586,2,,11584,4/17/2020 18:24,,5,,"

If you treat the gate sequence as fixed then by the same logic you can treat the actual gates as fixed. No parameters is better than polynomial number of them :)

+ +

But the problem is not with this. Let's say we want to implement Shor's period finding routine. The output of the unitary gate sequence will be some state in $2^n$-dimensional Hilbert space. We do not need to know all those $2^n$ complex parameters of the output. We just need to find some indexes where corresponding complex numbers have highest amplitudes (this is essentially what the final measurement part does). But how can we know what complex numbers have the highest amplitudes without computing all of them? No one knows, although it isn't proved that there is no tricky algorithm to find this efficiently on a classical computer.

+",5870,,,,,4/17/2020 18:24,,,,2,,,,CC BY-SA 4.0 +11587,2,,11517,4/17/2020 18:32,,2,,"

The question asked is:

+ +
+

So is the QFT, which is the basis of Shor's factoring algorithm, an + exception Aaronson's aphorism, or is there something else going on + that's deeper?

+
+ +

And this is the quote you say Scott made:

+ +
+

Scott Aaronson is fond of saying ""Quantum computers do not solve hard + search problems instantaneously by simply trying all the possible + solutions at once.""

+
+ +

I agree with Scott, that quantum computers do not solve search problems ""instantaneously"". If you look at Grover's search algorithm, for example, there is still a lot of work to be done, and a cost of $\mathcal{O}(\sqrt{N})$ gates for searching an $N$ entry database. Wouldn't the number of operations be $\mathcal{O}(1)$ if we were just searching everything simultaneously at once?

+ +

The QFT however, does act on all of its input qubits at once. For example, here's a 2-qubit QFT:

+ +

+ +

So it is indeed acting on all input qubits at once, which is maybe why you think it contradicts Scott's statement, but here's where the loophole is: Scott's quote is only about search problems and QFT is not doing any search. QFT is literally just changing $N$ qubits according to a matrix like the one I showed.

+",2293,,,,,4/17/2020 18:32,,,,4,,,,CC BY-SA 4.0 +11588,1,,,4/17/2020 18:42,,4,535,"

I've been trying to solve exercise 2.73 (p.g 105), and I'm not sure if i'v been overthinking it and the answer is as simple as i've described below or if I am missing something, or i'm just wrong!

+ +

Ex 2.73:

+ +

Let $\rho$ be a density operator. A minimal ensemble for $\rho$ is an ensemble $\{p_i,|\psi_i\rangle\}$ containing a number of elements equal to the rank of $\rho$. Let $|\psi\rangle$ be any state in the support of $\rho$. Show that there is a minimal ensemble for $\rho$ that contains $|\psi\rangle$, and moreover that in any such ensemble $|\psi\rangle$ must appear with probability

+ +

$p_i=\frac{1}{\langle\psi_i|\rho^{-1}|\psi_i\rangle}$

+ +

where $p^{-1}$ is defined to be the inverse of $\rho$, when $\rho$ is considered as an operator acting only on the support of $\rho$

+ +

My answer so far is:

+ +

$\rho$ is positive the therefore has a spectral decomposition $\rho=\sum_k\lambda_k|k\rangle\langle k|$.

+ +

The density operator cann be defined as $\rho=\sum_kp_k|k\rangle\langle k| = \sum_k|\hat{k}\rangle\langle \hat{k}|$, where $|\hat{k}\rangle=\sqrt{\lambda_k}|k\rangle$, and therefore $|k\rangle = \frac{|\hat{k}\rangle}{\sqrt{\lambda_k}} $.

+ +

For any $|\psi_i\rangle = \sum_k c_{ik}|k\rangle$, using the above definition of $|k\rangle$:

+ +

$|\psi_i\rangle = \sum_k \frac{c_{ik}}{\sqrt{\lambda_k}}|\hat{k}\rangle$

+ +

The density operator is given by $\rho=\sum_i|\psi_i\rangle\langle\psi_i|$, therefore

+ +

$\rho = \sum_{i}\sum_{k}\frac{c_{ik}^2}{\lambda_k}|\hat{k}\rangle \langle\hat{k}|$.

+ +

By the definition of $\rho$ is can be seen that $p_i = \sum_{k}\frac{c_{ik}^2}{\lambda_k}$.

+ +

--- reading this back i'm not sure this is correct at all :(

+ +

For the second part working backwards a bit:

+ +

$\langle \psi_i|\rho^{-1}|\psi_i\rangle = \langle \psi_i|\sum_k \left( \frac{1}{\lambda_k}|k\rangle\langle k| \right) |\psi_i\rangle = \sum_k \frac{1}{\lambda_k}\langle \psi_i|k\rangle\langle k |\psi_i\rangle = \sum_{i,k} \frac{1}{\lambda_k}c_{i,k}^2\langle i|k\rangle \langle k |i\rangle $

+ +

Given that $|i\rangle$ is of basis $|k \rangle$, $\langle k |i\rangle = \langle i |k\rangle = 1 $ if $i=k$, therefore

+ +

$\langle \psi_i|\rho^{-1}|\psi_i\rangle = \sum_{k} \frac{c_{i,k}^2}{\lambda_k}$ so

+ +

$p_i = \frac{1}{\sum_{k} \frac{c_{i,k}^2}{\lambda_k}}$

+ +

However the above result does not match with the result I got for $p_i$ in the first part, so one of them is wrong...

+ +

---Update---

+ +

I think the answer of the first part can be corrected, as the density matrix for $\psi_i$ needs to be normalised, and therefore to normalise it

+ +

By the definition of $\rho$ is can be seen that to normalise the trace it is required that $p_i = \frac{1}{\sum_{k}\frac{c_{ik}^2}{\lambda_k}}$.

+ +

Hence $\rho_i= p_i|\psi_i\rangle \langle\psi_i| = p_i\sum_{k}\frac{c_{ik}^2}{\lambda_k}|\hat{k}\rangle \langle\hat{k}| = \sum_{k}|\hat{k}\rangle\langle\hat{k}|$. Which is our original definition of $\rho$.

+",6139,,55,,10/22/2020 10:51,10/22/2020 10:51,Nielsen and Chuang ex 2.73,,2,0,,,,CC BY-SA 4.0 +11589,1,11594,,4/17/2020 18:46,,2,190,"

Here, a cheap verion of a Toffoli, up to a phase flip for $|101\rangle$, is given by

+ +

+ +

with $A=R_y(\pi/4)$. Are there similar versions of cheap implementation of general $C^nNOT$ gates?

+ +

I tried to just extend it the esay way, but found several unwanted off diagonal entries. My goal is a explicite $C^5NOT$.

+ +

So I came across this one for 4 qubits:

+ +

+ +

which I found here. Can anyone help me to build the circuit for 6 qubits out of the description?

+ +

And finally I found this approach: + +but the number of $CNOT$s feels like $2^5$ in my case, which is too high for my purpose.

+",5280,,9006,,4/17/2020 21:15,6/20/2021 5:43,Cheap Toffoli gates with phase errors,,1,5,,,,CC BY-SA 4.0 +11590,2,,11588,4/17/2020 20:47,,1,,"

Define $p_i = \dfrac{1}{\sum_k \dfrac{|c_{ik}|^2}{\lambda_k} }$ and $q_{ik} = \dfrac{\sqrt{p_i}c_{ik}}{\sqrt{\lambda_k}}$ +then

+ +

$$ \sum_k |q_{ik}|^2 = p_i \sum_k \dfrac{|c_{ik}|^2}{\lambda_k} = 1 $$

+ +

And also you have that

+ +

$$ \langle \psi_i| \rho^{-1}|\psi_i\rangle = \sum_k \dfrac{|c_{ik}|^2}{\lambda_k} $$

+ +

Note that I added $|c_{ik}|^2 $ to be mathematically accurate.

+",9858,,9858,,4/17/2020 21:30,4/17/2020 21:30,,,,2,,,,CC BY-SA 4.0 +11592,2,,11584,4/17/2020 21:34,,1,,"

As Danylo Y have answered, the key is you don't need to read out the entire quantum state at the end of the quantum algorithm to get your answer. There is another algorithm, called HHL algorithm, which is design to solve linear system of equations $Ax = b$. It provides an exponential speed up, and uses $O(\log(N))$. If you think about it, it already takes $O(N)$ to write down the entire solution... so writing down all the entries of $x$ would make you lose out all the advantage... the idea is you can translate the problem to about preparing the state $x$ for which we can sample.

+",9858,,,,,4/17/2020 21:34,,,,0,,,,CC BY-SA 4.0 +11593,2,,11477,4/17/2020 21:51,,1,,"

Giving a general $2^n \times 2^n $ Hermitian matrix $H$, it's not guarantee that you can decompose/expand $H$ in polynomial strings of $n$-qubit Pauli matrices. So I don't know if VQE is a good method to find lowest eigenvalues of a matrix... unless you know that you can sum $H$ in polynomial terms of Pauli matrices. Even then, in general, VQE only gonna give you a good answer if you have some intuition about the problem. If you pick a variational form that is hardware efficient, using polynomial number of gates, then you can't expect it explore the entire Hilbert space...

+",9858,,,,,4/17/2020 21:51,,,,0,,,,CC BY-SA 4.0 +11594,2,,11589,4/17/2020 21:51,,1,,"

Based on this thread, below is a code implementing $C^5NOT$ up to a phase for output states $|q_0 q_1 q_2 q_3 q_4 1\rangle$, $q_i \in \{|0\rangle, |1\rangle\}$ (with expection of state $|111111\rangle$). For these states the phase is $\pi$, so returned computational basis state is multiplied by -1.

+ +

Concerning number of CNOTs and $R_y$ gates, I think it is not possible to decrease its number and it rises exponentially with increasing number of qubits.

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+qreg q[6];
+creg c[6];
+
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[3],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[2],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[3],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[1],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[3],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[2],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[3],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[0],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[3],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[2],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[3],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[1],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[3],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[2],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[3],q[5];
+ry(pi/32) q[5];
+cx q[4],q[5];
+ry(-pi/32) q[5];
+cx q[0],q[5];
+
+",9006,,9006,,4/17/2020 21:59,4/17/2020 21:59,,,,3,,,,CC BY-SA 4.0 +11595,2,,11588,4/17/2020 22:12,,3,,"

This formulation of Ex 2.73 looks senseless to me (see the update of this answer).

+ +

In my edition of N&C the statement of Ex 2.73 is different. You are given density operator $\rho$ and linearly independent states $\{|\psi_i\rangle\}$ that span the support of $\rho$, and you have to prove that there are unique numbers $p_i$ such that $\rho = \sum p_i |\psi_i\rangle\langle \psi_i |$ (and $\sum p_i=1$ but this follows trivially from calculating the trace). Those numbers $p_i$ can be computed by +$$p_i=\frac{1}{\langle\psi_i|\rho^{-1}|\psi_i\rangle}.$$

+ +

Such formulation is sensible, but it's just wrong.

+ +

Let $\rho= \frac{1}{3}\big(|0\rangle\langle 0| + 2|1\rangle\langle 1|\big)$ and $|\psi_1\rangle=|+\rangle$, $|\psi_2\rangle=|-\rangle$. It's quite clear that there are no $p_1, p_2$ such that $\rho = p_1|+\rangle\langle +| + p_2|-\rangle\langle -|$, because $|+\rangle$ and $|-\rangle$ are orthogonal, so it has to be a spectral decomposition of $\rho$, but spectral decomposition is unique if eigenvalues are different.

+ +

The only correct formulation I can imagine is the following.

+ +

Let $\rho$ be a density operator and linearly independent states $\{|\psi_i\rangle\}$ span the support of $\rho$. Suppose we are given that $\rho = \sum p_i |\psi_i\rangle\langle \psi_i |$ for some $p_i>0$. Prove that $\sum p_i=1$ and $$p_i=\frac{1}{\langle\psi_i|\rho^{-1}|\psi_i\rangle}.$$

+ +

And the proof is quite simple. Multiply that equation for $\rho$ by $\rho^{-1}|\psi_j\rangle$ from the right. We obtain +$$ +\rho\big(\rho^{-1}|\psi_j\rangle\big) = \sum_i p_i |\psi_i\rangle\langle \psi_i |\big(\rho^{-1}|\psi_j\rangle\big) +$$ +that is +$$ +|\psi_j\rangle = \sum_i \big(p_i \langle \psi_i| \rho^{-1}|\psi_j\rangle\big) \cdot |\psi_i\rangle +$$

+ +

But $\{|\psi_i\rangle\}$ are linearly independent, so it must be $p_j \langle \psi_j| \rho^{-1}|\psi_j\rangle = 1$ and $p_i \langle \psi_i| \rho^{-1}|\psi_j\rangle = 0$ for $i\neq j$.

+ +

Update

+ +

Another fact that can be proved is the following.

+ +

Let $\rho$ be a density operator which has support of dim $m$. Let $|\psi_0\rangle$ be some state from this support. Then there are states $|\psi_1\rangle, .., |\psi_{m-1}\rangle$ from this support such that $\rho = \sum p_i |\psi_i\rangle\langle \psi_i |$, $p_i>0$, $\sum_i p_i = 0$. And by the previous fact we can deduce that $p_i = \frac{1}{\langle\psi_i|\rho^{-1}|\psi_i\rangle}$.

+ +

I guess it's what the editors actually meant.

+ +

The proof is also not hard. Consider $\rho_\epsilon = \rho - \epsilon |\psi_0\rangle\langle \psi_0 |$ for some small $\epsilon>0$. If $\epsilon$ is small enough then $\rho_\epsilon$ will be strictly positive on the support of $\rho$. But if we will raise $\epsilon$ then at some moment $\epsilon = \epsilon^\prime$ it will be $\rho_{\epsilon^\prime} \geq 0$ but not $\rho_{\epsilon^\prime} > 0$. This implies that $\rho_{\epsilon^\prime}$ has the support of dim $m-1$ and we can take $|\psi_1\rangle,..,|\psi_{m-1}\rangle$ as the corresponding eigenvectors of $\rho_{\epsilon^\prime}$.

+",5870,,5870,,4/19/2020 7:28,4/19/2020 7:28,,,,2,,,,CC BY-SA 4.0 +11596,2,,11569,4/17/2020 23:07,,3,,"

I think that $UCC$ ansatz is good for chemistry related problems. However, if you an arbitrary Hamiltonian and want to find its smallest eigenvalue then it's not very obvious what the anstaz form should look like.... it will also depend on how you initialize your state. And if you define an anstaz with polynomial number of gates, you don't expect to be able to explore the entire Hilbert space.

+ +

Also, the important ingredient about VQE applying to chemistry related problems, like finding energies of electronic molecular Hamiltonian, is that this type of Hamiltonian can be written/decompose as the sum of polynomial terms of Pauli matrices.

+ +

$$ H = \sum h_i \sigma_i + \sum h_{ij}\sigma_{i}\sigma_{j} + \cdots $$

+ +

However, this is not true in general. Therefore, you have to be careful about this.

+",9858,,,,,4/17/2020 23:07,,,,4,,,,CC BY-SA 4.0 +11597,2,,11584,4/18/2020 1:39,,2,,"

The issue is that you are confusing the notions of Komogorov complexity and computational complexity. Kolmogorov complexity (roughly) means the smallest amount of data that you need to provide in order to completely specify an object. Computational complexity (roughly) refers to the minimum number of time steps that it takes any Turing machine to convert an input tape with the problem instance to an output tape with the solution to that instance.

+ +

You are correct that any quantum state that can be reached from the all-0 initial state with a fixed-depth circuit by definition has a Kolmogorov complexity that is at most linear in the number of qubits: one can specify the state by simply giving the circuit. So in that sense, only very ""simple"" states can be practically reached by a quantum circuit.

+ +

But that's not the sense that really matters for most purposes. Not all states that are ""simple"" in that sense can be efficiently simulated by a classical computer. Put another way, not all states that are difficult to calculate require a complicated description to specify. As a concrete example, consider the smallest natural number $n$ such that prime-counting function $\pi(n)$ exceeds the logarithmic integral $\mathrm{li}(n)$. Such a number has extremely low Kolmogorov complexity; I just uniquely specified it with one very short sentence. But it has extremely high computational complexity: all the computers in the world could not calculate its value. Some quantum states reachable by shallow circuits are similar.

+ +

(Strictly speaking, what I said above isn't right, because a single number doesn't have a computational complexity; only a problem does. But it conveys the general idea.)

+",551,,,,,4/18/2020 1:39,,,,2,,,,CC BY-SA 4.0 +11598,1,11600,,4/18/2020 6:49,,1,303,"

I'm trying to implement Quantum Phase Estimation from qiskit textbook.

+ +

Below is the implementation circuit taken from the above-mentioned site:

+ +

+ +

The output at position 2 will be as follows:

+ +

$$|\psi _2⟩ = \frac{1}{2^{\frac{n}{2}}} \sum_{k=0}^{2^{n}-1} e^{2\pi i k} |k⟩ ⊗ |\psi⟩ $$

+ +

and after applying inverse QFT, the state becomes:

+ +

$$ | \psi _3⟩ = \frac{1}{2^{n}} \sum_{x=0}^{2^{n}-1} \sum_{k=0}^{2^{n}-1} e^{- \frac{2 \pi i k}{2^{n}}(x-2^n \theta)} |x⟩ ⊗| \psi⟩ $$

+ +

However, the next step claims that the above expression peaks near $ x = 2^n \theta $ which is my point of doubt, why is this the case? Wouldn't the maximum amplitude be when $ x = 0 $ based on simple calculus?

+",10376,,,,,4/18/2020 8:09,How does Inverse QFT work in Quantum Phase Estimation?,,1,0,,,,CC BY-SA 4.0 +11599,1,,,4/18/2020 7:02,,4,186,"

This is my hamiltonian. Solving this by hand, Numpy Python package and VQE algorithm gives the minimum energy eigenvalue -2. If we want to find the minimum energy of this hamiltonian with Quantum annealer we need to transform this into QUBO. This is a 2 qubit hamiltonian, 4x4 hermitian matrix.

+ +

\begin{equation} +H = \begin{pmatrix} +0 & 0 & 0 & 0 \\ +0 & -1 & 1 & 0 \\ +0 & 1 & -1 & 0 \\ +0 & 0 & 0 & 0 +\end{pmatrix} +\qquad +E_{min} = -2 +\end{equation}

+ +
    +
  • What will be the QUBO for this hamiltonian?
  • +
  • What will be the shape of the QUBO matrix? Is it 4X4 or 2X2?
  • +
  • How to convert hamiltonian to QUBO? Please elaborate the mathematical steps.
  • +
+",11727,,9459,,4/18/2020 10:11,4/18/2020 16:25,How to convert a qubit hamiltonian to QUBO and vice versa?,,0,1,,,,CC BY-SA 4.0 +11600,2,,11598,4/18/2020 8:09,,1,,"

The expression you obtain after applying the QFT contains sums of the unit square, $e^{2\pi i/2^n}$, which sum up to 0 if you sum over the full range of $2^n$:

+ +

$$ +\sum_{k=0}^{2^n - 1} e^{\frac{2\pi i}{2^n} k} = 0 +$$

+ +

See here for explanations why this is the case.

+ +

Now the inner sum in the amplitudes will also sum up to 0, if $(x - 2^n\theta)$ is an integer, because that's just multiplication with a constant factor and the sum-to-zero-rule still holds.

+ +

$$ +\sum_{x=0}^{2^n - 1} \sum_{k=0}^{2^n - 1} e^{\frac{2\pi i}{2^n} k (x - 2^n \theta)} +$$

+ +

But: If $(x - 2^n \theta) = 0$, then the exponential will be $e^0 = 1$ and your sum is collapsing to

+ +

$$ +\sum_{x=0}^{2^n - 1} \sum_{k=0}^{2^n - 1} 1 +$$

+ +

Therefore, the amplitudes are 0 if $x \neq 2^n \theta$ and 1 if $x = 2^n \theta$. +Note that the derivation is more complicated if $2^n\theta$ is not an integer.

+ +

The QFT and its derivation is also very well explained in Nielsen and Chuang, chapter 5.1, page 217, I would recommend to look up there if you have any questions!

+",9800,,,,,4/18/2020 8:09,,,,1,,,,CC BY-SA 4.0 +11602,1,11603,,4/18/2020 17:27,,3,247,"

Suppose I know how to implement a 2 qubit gate $C-U$ (i.e controlled U), and I want to implement $CC-U$ using $C-U$ and other 1 or 2 qubit gates, is that possible?

+",8275,,9006,,4/18/2020 22:30,4/18/2020 22:30,Implementing a controlled-controlled-U using controlled-U,,1,0,,,,CC BY-SA 4.0 +11603,2,,11602,4/18/2020 22:29,,6,,"

Yes, generally it is possible by using a three qubits Toffoli gate (or series of Toffoli gates) to evaluate whether all controling qubits are in state $|1\rangle$. If this is a case then $C-U$ gate is applied.

+ +

Here is an example of $CC-H$ (i.e. controlled-controlled Hadamard gate):

+ +

+ +

If qubits $q_0$ and $q_1$ are in state $|1\rangle$, a first Toffoli gate return $|1\rangle$ to qubit $q_2$ and $C-H$ gate acts on qubit $q_3$. Eventually, you have Hadamard gate controlled by two qubits. Qubit $q_2$ is so-called ancila qubit and in the end it has to be in state $|0\rangle$ (so-called uncomputation). This is done by another Toffoli gate because Toffoli is inverse to itself.

+ +

If you want to implement general $C \dots C-U$ gate you can do it followingly:

+ +

+ +

Please note that in some cases you can construct a simpler circuit (i.e with less quantum gates and those being only two qubits). But generally the above mentioned approach works always.

+",9006,,,,,4/18/2020 22:29,,,,0,,,,CC BY-SA 4.0 +11604,2,,11575,4/19/2020 0:14,,2,,"

I am quite certain the problem here is noise. 2-qubit gates such as the CX gate are usually more prone to errors than single qubit gates like the Z gates. Also it really depends on when you run the code because with time these machines also get worse and need recalibration. As I write this answer the CNOT error rate in burlington is 2 orders of magnitude bigger than the error rate for the single qubit gate U2 which is the one probably used to implement the Z gates you useed in the second example.

+ +

+ +

The Oracle for the Bernstein algorithm can be implemented both using CX or Z gates. The CX gates make use of the Phase Kickback effect to create the same effect you can achieve with the Z gates (basically in this case a 180 degrees phase flip) so no black magic here. The issue is not in the gate itself but in the noise of the machines.

+ +

If you still do not believe you can try to copy the noise model from the burlington machine and apply it to the qasm simulator. You will see that you get also really messed up results in comparison to a noiseless run. Try plugging this to your code and see what happens (reference: https://qiskit.org/documentation/apidoc/aer_noise.html)

+ +
from qiskit.providers.aer.noise import NoiseModel
+
+noise_model = NoiseModel.from_backend(qcomp)
+# Get coupling map from backend
+coupling_map = qcomp.configuration().coupling_map
+# Get basis gates from noise model
+basis_gates = noise_model.basis_gates
+
+noisy_result = execute(circuit, Aer.get_backend('qasm_simulator'),
+                 coupling_map=coupling_map,
+                 basis_gates=basis_gates,
+                 noise_model=noise_model,
+                 shots=4096).result()
+
+print(noisy_result.get_counts())
+
+ +

I got the following counts:

+ +
{'0010': 178, '0001': 2, '1000': 316, '1111': 2, '0011': 7, '0110': 1, '1001': 16, '1101': 1, '1100': 4, '1110': 49, '1010': 3331, '0000': 39, '1011': 150}
+
+ +

These results are still better than the results you posted but I'm quite certain the issue here is in the noise and the fact that the first implementation is using CX gates and therefore will experience more trouble than the second one.

+ +

You can also try playing with this: https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html and see if you get any improvements there.

+ +

Hope this is helpful ;)

+ +

edit +I'm not personally aware of other tricks you could play with the hardware here and I've had bad experiences with Burlington in the past as well. You probably can't apply any repetition code either (https://qiskit.org/textbook/ch-quantum-hardware/error-correction-repetition-code.html) because you'd need three times more qubits and Burlington has only 5 so I really feel there's nothing you can do to work around this using that specific device.

+",7322,,7322,,4/19/2020 0:45,4/19/2020 0:45,,,,2,,,,CC BY-SA 4.0 +11605,1,,,4/19/2020 4:08,,1,276,"

I'm running an algorithm on a real quantum device from IBM (ibmqx2), using the QASM and circuit composer, and it just gets the same error over and over again: Instruction not in basis gates: instruction: bfunc, qubits: [].

+ +

Here is the transpiled code:

+ +
qreg q[5];
+
+creg c[4];
+
+
+u3(2.0943951023931953, 1.5707963267948966, 1.5707963267948966) q[0];
+u2(0, 3.141592653589793) q[1];
+cx q[1], q[2];
+cx q[0], q[1];
+u2(0, 3.141592653589793) q[0];
+cx q[2], q[4];
+measure q[0] -> c[0];
+if(c == 1) u1(3.141592653589793) q[2];
+if(c == 1) u1(3.141592653589793) q[4];
+measure q[1] -> c[1];
+if(c == 1) u3(3.141592653589793, 0, 3.141592653589793) q[2];
+if(c == 1) u3(3.141592653589793, 0, 3.141592653589793) q[4];
+measure q[2] -> c[2];
+measure q[4] -> c[0];
+
+ +

It's just a simple teleportation algorithm with an extra qubit. How can that be to not work properly? Does someone knows what may be happening?

+",11738,,9006,,4/19/2020 11:38,4/19/2020 11:38,Error when running an algorithm on real device at IBM Q using QASM,,0,4,,,,CC BY-SA 4.0 +11606,1,13281,,4/19/2020 11:36,,1,77,"

I wrote following code in QASM editor on IBM Q web interface (note ccu1 is controlled-controlled U1 gate):

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+gate ccu1 ( p ) c1, c2, t  {
+  cu1 ( p / 2 ) c1, c2;
+  cx c2, t;
+  cu1 ( - p / 2 ) c1, t;
+  cx c2, t;
+  cu1 ( p / 2 ) c1, t;
+}
+
+qreg q[4];
+creg c[4];
+
+h q[0];
+h q[1];
+h q[2];
+h q[3];
+
+ccu1(pi) q[0],q[1],q[2];
+
+id q[3];
+measure q[3] -> c[3];
+
+ +

When I look to visualization of a state vector, everything is fine. However, when I tried to run the code on simulator I got error ERROR_RUNNING_JOB. There is also a status message Error in transpilation process. [1003] on results page.

+ +

I suspect that the issue is caused by subroutine (a gate statement at the beginning of the code).

+ +

Could anyone please help me solve the issue?

+ +

Note, I know that it is possible to use subroutine in Qiskit, but I am interested in QASM.

+",9006,,5955,,4/20/2020 9:09,8/12/2020 12:54,Subroutines on IBM Q (ERROR_RUNNING_JOB returned),,2,0,,,,CC BY-SA 4.0 +11608,2,,11581,4/19/2020 13:12,,6,,"

You are right, photonic systems are described by an infinite (separable) Hilbert space---the bosonic Fock space---and their formalism makes extensive use of infinite values, both countable and uncountable. The quantum computing paradigm based on this Hilbert space is called continuous-variable (CV) quantum computing, and a lot of different protocols and algorithms have been proposed using this framework, see for instance this recent review by Xanadu (who is developing optical quantum computers with the goal of working with continuous variables). Two important points to note: 1) CV quantum computers could in principle be built with other systems than photons, such as molecular vibrations (phonons), which obey the same equations as photons ; 2) you can restrict the Hilbert space of photons in order to get qubits, for instance by considering only polarization or by encoding qubits into continuous variables. This is the approach taken by the photonic quantum computing company PsiQuantum (as far as I understand).

+ +

Where does CV quantum computing come from?

+ +

There exists tons of equivalent ways to introduce the CV paradigm. The most physical is the quantization of the electromagnetic field: you take Maxwell's equations and you turn the electric and magnetic fields into non-commuting operators. You find that your system now describes a quantum Harmonic oscillator and that the Hamiltonian have infinitely many eigenstates, forming an infinite-dimensional Hilbert space.

+ +

Another more rigorous way to define this Hilbert space is called the second quantization: you define bosonic quantum states as multi-particle states that are invariant when you permute particles, and after some steps, you find that the correct Hilbert space to describe bosons is the so-called Fock space (which is a separable Hilbert space when defined properly).

+ +

Finally, you can formalize bosonic systems in a much more mathematical/computer sciency way, that allows you to talk about complexity theory. Three examples of such formalisms are given in Section 3 of this paper.

+ +

Formalism and infinities

+ +

All those formalisms have a common point: you end up with a separable Hilbert space. And all separable Hilbert spaces are the same up to an isometric isomorphism. Moreover, separable Hilbert spaces have the amazing properties to contain an infinite countable basis, that we can note $(|n\rangle)_{n \in {\mathbb{N}}}$. Therefore, for any state $|\psi\rangle \in \mathcal{H}$, there exists $(a_n)_{n \in {\mathbb{N}}}$ such that +$$|\psi\rangle = \sum_{n=0}^{\infty} a_n |n\rangle$$ +Physically, $|n\rangle$ is a state that contains $n$ indistinguishable photons.

+ +

Using this basis $(|n\rangle)_{n \in \mathbb{N}}$ (called the Fock basis), we can define many important objects of the CV framework, such as the creation and annihilation operators +$$\hat{a}^{\dagger}|n\rangle=\sqrt{n+1} |n+1\rangle$$ +$$\hat{a}|n\rangle=\sqrt{n} |n-1\rangle,$$ +the position and momentum operators (which physically correspond the amplitude of the electric and magnetic fields, not to spatial coordinates) +$$\hat{X}=\frac{1}{\sqrt{2}} (\hat{a}^{\dagger} + \hat{a})$$ +$$\hat{P}=\frac{1}{\sqrt{2}} i (\hat{a}^{\dagger} - \hat{a})$$ +and the number operator +$$\hat{N}|n\rangle = n|n\rangle$$

+ +

Now, you can verify that $\hat{X}$ and $\hat{P}$ are hermitian (infinite-dimensional) operators, and are therefore observables that you can physically measure. Their eigenstates $|x\rangle$ and $|p\rangle$ form two new bases of your Hilbert space, but this time uncountably infinite, i.e. for every state $|\psi\rangle$, there exists a function $x\mapsto \psi(x)$ and a function $p \mapsto \phi(p)$ such that +$$|\psi\rangle = \int \psi(x) |x\rangle dx$$ +$$|\psi\rangle = \int \phi(p) |p\rangle dp$$

+ +

Therefore, the same state can be represented both using countable infinities and uncountable infinities. Which basis you want to choose depends on your measuring device (photon detectors measure in the $|n\rangle$ basis and homodyne detectors in the $|x\rangle$ and $|p\rangle$ bases), the initial state of your algorithm (the output of a laser, called a coherent state---and more generally Gaussian states---are more easily representable with $\hat{X}$ and $\hat{P}$, while single-photons are more easily described in the Fock basis) or on the details of your algorithm (are integral or sums more convenient to analyze it?).

+ +

Algorithms

+ +

We saw what a CV state looks like, what measurements can look like, but what about gates? As usual, any unitary operator (here infinite-dimension matrix) can be seen as a gate. Elementary gates include squeezing, displacement, rotation, etc. and are very well described in the paper of the CV library Strawberry Fields. A particular representation of states called the Wigner function (roughly describing the quasi-probability to find a particle at a certain position and momentum) is often used to describe the effect of those gates.

+ +

Now, what are the applications of CV quantum computing? One of the main area where CV quantum information is used is in quantum communication. Indeed, photons can be transmitted through optical fibers and rarely interact, making it a perfect choice for communication. Moreover, communication protocols such as teleportation and QKD have been ported to CV systems.

+ +

Going back to computation, an important CV algorithm is Boson Sampling, which is mostly considered as a way to demonstrate quantum supremacy, but might have applications such as finding dense subgraphs or simulating molecular vibronic spectra

+ +

Finally, CV quantum computing has been considered in order to solve partial differential equation (porting the HHL algorithm to an infinite-dimensional system), to improve Monte-Carlo algorithms or to do quantum machine learning and variational circuits

+ +

If you are interested to go deeper in understanding continuous variables, apart from all the papers I've cited, you can also read the first section of my master's thesis, which explains all of that in more details and (I hope) in an understandable way.

+",8545,,,,,4/19/2020 13:12,,,,1,,,,CC BY-SA 4.0 +11609,1,11611,,4/19/2020 14:44,,1,114,"

Prove that the density matrix of $|+\rangle$ with respect to basis $\{|+\rangle, |-\rangle\}$ is given by

+ +

$$\rho = \begin{bmatrix} + 1 & 0 \\ + 0 & 0 + \end{bmatrix}.$$

+",8620,,55,,4/21/2020 9:00,4/21/2020 9:00,"What is the density matrix of $|+\rangle$ with respect to basis $\{|+\rangle, |-\rangle\}$?",,1,0,,,,CC BY-SA 4.0 +11610,1,11613,,4/19/2020 14:45,,1,89,"

$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$ +If I make a rotation of $\frac{\pi}{4}$ around the x axis, starting from $\ket{0}$, I expect $\alpha = \frac{\sqrt{2 + \sqrt{2}}}{2}$ and $\beta= \frac{\sqrt{2 - \sqrt{2}}}{2}$ when measured with respect to the computational basis states of $\ket{0}$ and $\ket{1}$. I can verify this is correct empirically using a quantum simulator. I want to measure with respect to new basis states $\ket{+}$ and $\ket{-}$, defined in Quantum Computation and Quantum Information as follows $\ket{+} \equiv \frac{\ket{0}+\ket{1}}{\sqrt{2}}$, $\ket{-} \equiv \frac{\ket{0}-\ket{1}}{\sqrt{2}}$, and corresponding to the poles of the x axis of the Bloch sphere.

+ +

Looking at the Bloch sphere, I would expect to get $\ket{+}$ half of the time, and $\ket{-}$ the other half, and I have been able to empirically verify this. However, according to the mathematics presented in the aforementioned book, I should be able to express this state $\ket{\psi} = \alpha\ket{0} + \beta\ket{1}$, with the $\alpha$ and $\beta$ previously mentioned, as follows:

+ +

$$\ket{\psi} = \alpha\ket{0} + \beta\ket{1} = \alpha\frac{\ket{+} + \ket{-}}{\sqrt{2}} + \beta\frac{\ket{+} - \ket{-}}{\sqrt{2}} = \frac{\alpha + \beta}{\sqrt{2}}\ket{+} + \frac{\alpha -\beta}{\sqrt{2}}\ket{-}$$

+ +

This math seems sound to me, however if I attempt to translate to this new basis using my $\alpha$ and $\beta$, I get

+ +

$$ \frac{\sqrt{2+\sqrt{2}} + \sqrt{2-\sqrt{2}}}{2\sqrt{2}}\ket{+} + \frac{\sqrt{2+\sqrt{2}} -\sqrt{2-\sqrt{2}}}{2\sqrt{2}}\ket{-} $$

+ +

Since $\left(\frac{\sqrt{2+\sqrt{2}} + \sqrt{2-\sqrt{2}}}{2\sqrt{2}}\right)^2 \approx 0.85$ this is not at all what I expect from looking at the Bloch sphere, and does not match what I am able to demonstrate empirically. What am I missing?

+ +

For reference, the important bit of my Q# code I've been using to test this is:

+ +
Rx(PI()/4.0, qubit);
+set state = Measure([PauliX], [qubit]);
+
+",11742,,10473,,4/20/2020 16:13,4/20/2020 16:13,Why don't I get what I expect when measuring with respect to a different basis?,,1,1,,,,CC BY-SA 4.0 +11611,2,,11609,4/19/2020 15:39,,2,,"

You may compute the density matrix for a given pure state $|\psi\rangle$, with +\begin{align*} +\rho = |\psi\rangle \langle \psi|. +\end{align*} +Thus, when you define $\{|+\rangle,|-\rangle\}$ to be your standard basis vectors, you have, +\begin{align*} +\rho = |+\rangle \langle +| = \begin{pmatrix}1 \\ 0 \end{pmatrix}\begin{pmatrix}1 & 0 \end{pmatrix} = \begin{pmatrix}1 & 0 \\0 & 0\end{pmatrix}. +\end{align*}

+ +

Note that in general, when considering some matrix in a given basis, you are considering the definition of that matrix given that the standard basis vectors are the given basis. Thus, when considering the above density matrix, we are operating under the definition that, +\begin{align*} + |+\rangle \equiv \begin{pmatrix}1\\0\end{pmatrix}, |-\rangle \equiv \begin{pmatrix}0\\1\end{pmatrix}. +\end{align*}

+ +

It may help to consider what would happen if we defined the standard basis to be $\{|0\rangle, |1\rangle\}$. In our computation we would have, +\begin{align*} +\rho = |+\rangle \langle +| = \frac{1}{2}\begin{pmatrix}1 \\ 1 \end{pmatrix}\begin{pmatrix}1 & 1 \end{pmatrix} = \frac{1}{2}\begin{pmatrix}1 & 1 \\1 & 1\end{pmatrix}. +\end{align*} +Recall that for an invertible matrix $A$, we may diagonalize it as $A = PDP^{-1}$, where $D$ is a diagonal matrix containing the eigenvalues of $A$, and $P$ consists of its eigenvectors. Diagonalizing the above matrix yields, +\begin{align*} +\rho = \frac{1}{2}\begin{pmatrix}1 & 1 \\1 & 1\end{pmatrix} &= \frac{1}{2}\begin{pmatrix}1 & -1 \\1 & 1\end{pmatrix}\begin{pmatrix}2 & 0 \\0 & 0\end{pmatrix}\begin{pmatrix}1 & 1 \\-1 & 1\end{pmatrix}\\ +&= \begin{pmatrix}1 & -1 \\1 & 1\end{pmatrix}\begin{pmatrix}1 & 0 \\0 & 0\end{pmatrix}\begin{pmatrix}1 & 1 \\-1 & 1\end{pmatrix}. +\end{align*} +And so you can see that the diagonal matrix recovered is indeed the same as the matrix we originally computed. Thus, it may be clear that in $A = PDP^{-1}$, $P^{-1}$ brings us into the basis where its columns are the standard basis vectors, and $P$ brings us out of it.

+ +

Please let me know if this doesn't answer your question.

+",5157,,5157,,4/19/2020 21:55,4/19/2020 21:55,,,,4,,,,CC BY-SA 4.0 +11613,2,,11610,4/19/2020 16:29,,2,,"

I think there should be $-i$ in the expression for $\beta$:

+ +

\begin{equation} +R_x\left(\frac{\pi}{4}\right) |0\rangle= +\begin{pmatrix} +\cos\left(\frac{\pi}{8}\right) & -i \sin\left(\frac{\pi}{8}\right) \\ +-i \sin\left(\frac{\pi}{8}\right) & \cos\left(\frac{\pi}{8}\right) +\end{pmatrix} +\begin{pmatrix} 1 \\ 0\end{pmatrix} = \\ +=\frac{\sqrt{2 + \sqrt{2}}}{2} |0\rangle - i \frac{\sqrt{2 - \sqrt{2}}}{2} |1\rangle +\end{equation}

+ +

So, we will have:

+ +

$$|\psi\rangle = \frac{\sqrt{2 + \sqrt{2}} -i \sqrt{2 - \sqrt{2}}}{2\sqrt{2}} |+\rangle + \frac{\sqrt{2 + \sqrt{2}} + i \sqrt{2 - \sqrt{2}}}{2\sqrt{2}} |-\rangle$$

+ +

Then:

+ +

$$\left|\frac{\sqrt{2 + \sqrt{2}} -i \sqrt{2 - \sqrt{2}}}{2\sqrt{2}}\right|^2 = 0.5 $$

+",9459,,9459,,4/19/2020 16:56,4/19/2020 16:56,,,,2,,,,CC BY-SA 4.0 +11614,1,11615,,4/20/2020 5:37,,1,158,"

I'm a computer science student and soon I will have a math exam. I'm really struggling with this preparation question. Also, includes the following:

+ +
+

How does this demonstrate that we need the “ket” (or the vector) representation of qubits, rather than just describing them in terms of probabilities (eg. “this is a qubit with 50% probability of being 1”)?

+
+ +

Could you help me please? + +

+",11746,,55,,1/18/2021 13:32,1/18/2021 13:32,What happens if $|\psi\rangle$ = $|0\rangle$ or $|\psi\rangle$ = $|1\rangle$ is passed as an input to two Hadamard gates in sequence?,,2,1,,,,CC BY-SA 4.0 +11615,2,,11614,4/20/2020 6:04,,2,,"

The gist of it : If you act two H gates on the qubit you will cancel the rotations thereby obtaining the initial qubit.

+ +

If you only pass one H gate then you have a superposition with a probability amplitude for each quantum state basis vector.

+ +
+ +

Longer explanation:

+ +

Just to illustrate this better I developed the first circuit with $\uparrow$:

+ +

+ +

Which will show the following state population distribution: +

+ +

If we add $X$ gate to the circuit to bit flip $\uparrow$ into $\downarrow$, then we obtain the following:

+ +

+ +

With a similar state population measured counts: +

+ +

Keep in mind the measurement number for this circuit is of 1000 times, so if you dial up this value you can find the distributions to get really close to each other.

+ +

Anyway, the idea I want to hammer home with the $H$ gates is that, it's an unitary, so $HH = H^2 = I$. This is why if you were to operate two of them in sequence, you will get back the original qubit for the $\uparrow$ state:

+ +

+ +

And for the $\downarrow$ state:

+ +

+ +
+ +

Now, when you have time later on and if you are curious:

+ +

We start by defining this as the Clifford Group (of Gates): +\begin{eqnarray} +G &=& \pm \Big \{ I, X, Y, Z \Big \} +\end{eqnarray}

+ +

This group is defined by the following properties:

+ +
    +
  1. Each $\mathbf{M} \in G$ is unitary such that $M^\dagger = M^{-1}$.
  2. +
  3. For each element $\mathbf{M} \in G, M^2 = \pm I$.
  4. +
  5. If $\mathbf{M}^2 = I$, $\mathbf{M}$ is hermitian; otherwise, $\mathbf{M}$ is anti-hermitian.
  6. +
  7. $\forall \, \mathbf{M_i}, \mathbf{M_j} \in G$, their products either commute or anti-commute, $\mathbf{M_i}\mathbf{M_j} = \pm \mathbf{M_j}\mathbf{M_i}$.
  8. +
+ +

It turns out one can represent $H = \frac{1}{\sqrt{2}} \Big ( X + Z \Big )$ operation. Thus it falls under these rules.

+ +

This stuff is really, really, powerful stuff!

+",6253,,6253,,4/20/2020 7:27,4/20/2020 7:27,,,,0,,,,CC BY-SA 4.0 +11616,2,,11614,4/20/2020 6:58,,1,,"

Hadamard gate is desribed by a matrix

+ +

$$ +H = \frac{1}{\sqrt{2}}\begin{pmatrix} +1 & 1 \\ +1 & -1 +\end{pmatrix}. +$$

+ +

If you apply the Hadamard on $|0\rangle$ you will have a superposition +$$ +H|0\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1 \\ 1\end{pmatrix} = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle). +$$ +This superposition is denoted $|+\rangle$.

+ +

Application on $|1\rangle$ leads to a superposition +$$ +H|1\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1 \\ -1\end{pmatrix} = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle). +$$ +This superposition is denoted $|-\rangle$.

+ +

Hadamard gate is inverse to itself, i.e. $HH = I$ (you can verify this by direct matrix multiplication). Hence $HH|0\rangle = |0\rangle$ and $HH|1\rangle = |1\rangle$, i.e. there is no change in input state. This can be generalized to any input state $|\psi\rangle$, i.e. $HH|\psi\rangle = |\psi\rangle$.

+ +
+ +

Now, concerning your particular problem.

+ +

In the first case $|1\rangle$ is returned after application of $H$ this means that input (B) had to be $|-\rangle$. Since $|-\rangle$ is result of application of another $H$, its input (A) had to be $|1\rangle$.

+ +

In the second case $|0\rangle$ is returned after application of $H$ this means that input (B) had to be $|+\rangle$. Since $|+\rangle$ is result of application of another $H$, its input (A) had to be $|0\rangle$.

+ +

Because a probability of measurement either state $|0\rangle$ or $|1\rangle$ is 50 % for both $|+\rangle$ and $|-\rangle$, you cannot distinguish $|+\rangle$ and $|-\rangle$ based only on probabilities, you also need phases (in plain words plus and minus before $|1\rangle$ in the superpositions). Hence you need ""ket"" notatiton and not only probabilities.

+",9006,,9006,,4/20/2020 7:16,4/20/2020 7:16,,,,0,,,,CC BY-SA 4.0 +11617,1,11666,,4/20/2020 9:15,,7,265,"

I've been working on Google quantum supremacy paper for quite some time now and I have a problem in understanding how exactly they simulate their actual random quantum circuit on a classical computer.

+ +

To be specific, in their quantum random circuit each cycle includes a single qubit gate and a two-qubit gate. The single-qubit gate is chosen randomly from a set of three gates. To randomize the procedure of choosing the single-qubit gate there is a pseudorandom number generator which is initialized with a seed according to Supplementary information of the paper (part VII).

+ +

So my question is, when they want to run the simulation of the circuit on a classical computer, how exactly do they choose the single-qubit gate randomly?

+ +

Do they use a separate pseudorandom number generator for their code? If so, how do they compare the simulation results to the actual circuit, because the two are not related at all? Or they use the same pseudorandom number generator? Or none of them and they don't choose the single qubits randomly in the simulation but they look at the physical circuit and trace the gates that have been used in that circuit and then try to perform the exact set of gates on the exact same qubits in their simulation?

+ +

Please if you know where I can find the actual code of the simulation, mention that too. Thank you for your attention!

+",10456,,55,,4/21/2020 9:05,4/23/2020 16:47,What did exactly Google do in simulating a random quantum circuit on a classical computer in supremacy experiment?,,1,4,,,,CC BY-SA 4.0 +11618,2,,11606,4/20/2020 9:32,,2,,"

I don't know if this will help. I have tried the code and it worked:

+ +

I created a new file named ccu1_circuit.qasm with the instruction written in the question. Then in a separate Python file, I have written:

+ +
from qiskit import *
+
+circuit = QuantumCircuit.from_qasm_file('/...The path.../ccu1_circuit.qasm')
+
+backend = BasicAer.get_backend('qasm_simulator')
+print(execute(circuit, backend=backend, shots=1024).result().get_counts())
+
+ +

Here is the output:

+ +

{'1000': 524, '0000': 500}

+ +

Also, I noticed that when I tried to run print(circuit.qasm()) I have found ccu1 in the instructions (not its decomposition written in the .qasm file).

+",9459,,,,,4/20/2020 9:32,,,,3,,,,CC BY-SA 4.0 +11620,1,11621,,4/20/2020 12:52,,3,529,"

How do we create an arbitrary vector of the following form in Qiskit?

+ +

Say, we want to initialize a qubit with a vector, +$$ +\vert \psi \rangle = \frac{1+i}{\sqrt{3}}\vert 0 \rangle - \frac{i}{\sqrt{3}}\vert 1 \rangle +$$

+ +

If I put it in the form +$$ +\vert \psi \rangle = \frac{1+i}{\sqrt{3}}\vert 0 \rangle - \frac{i}{\sqrt{3}}\vert 1 \rangle = cos(\frac{\theta}{2})|0> + e^{i\phi}sin(\frac{\theta}{2})|1> +$$ where
+$0 < \theta < \pi$ and $0 < \phi <2\pi$ +and then calculate $\theta$ and $\phi$

+ +

So, +$$ +cos(\frac{\theta}{2}) = \frac{1+i}{\sqrt{3}}\\ +e^{i\phi}sin(\frac{\theta}{2}) = - \frac{i}{\sqrt{3}} +$$ +Therefore, +$$ +\theta = 2 * \arccos{\frac{1+i}{\sqrt{3}}} \\ +\phi = i * ln(\frac{- \frac{i}{\sqrt{3}}}{sin(\frac{\theta}{2})}) +$$

+ +

Now, I am using the following code..

+ +
#We create the quantum state manually first
+arb_quantum_state = ((1+1.j)/math.sqrt(3))*ket_0 - (1.j/math.sqrt(3))*ket_1
+print(arb_quantum_state)
+
+theta = 2*cmath.acos((1+1.j)/cmath.sqrt(3))
+print('theta : ',theta)
+sinValue = cmath.sin(theta/2)
+print(sinValue)
+phase = -1*(1.j/cmath.sqrt(3))/sinValue
+phi = cmath.log(phase)/1.j
+print('phi : ',phi)
+
+# Use these theta and phi to create the circuit
+circ = QuantumCircuit(1,1)
+#Verify why complex values are not allowed
+#circ.u3(theta.real,phi.real,0,0)
+circ.u3(theta,phi,0,0)
+
+results = execute(circ, backend=Aer.get_backend('statevector_simulator')).result()
+quantum_state = results.get_statevector(circ, decimals=3)
+print (quantum_state)
+
+ +

The above code creates the gate alright, but the execute function is returning the following error,

+ +
TypeError: can't convert complex to float
+
+ +

However, if I use just the real values of theta and phi, then the execute function returns a state vector, which is different than the one it should be.

+",9201,,55,,10/3/2021 11:42,10/3/2021 11:42,How to create states in Qiskit using complex phase angles?,,1,0,,,,CC BY-SA 4.0 +11621,2,,11620,4/20/2020 13:14,,6,,"

The problem is that you're trying to equate $\cos(\theta/2)$ (a real number) with $(1+i)/\sqrt{3}$ (a complex number). The way around this is you need to take into account a global phase $\gamma$ such that +$$ +e^{i\gamma}|\psi\rangle=\cos\frac{\theta}{2}|0\rangle+e^{i\phi}\sin\frac{\theta}{2}|1\rangle. +$$ +To do this, it helps to express your initial state as complex exponentials:

+

As a first step your state can be reduced to +$$ +|\psi\rangle=\sqrt{\frac{2}{3}}\left(\frac{1}{\sqrt{2}} + \frac{1}{\sqrt{2}}i\right)|0\rangle+\frac{1}{\sqrt{3}}\left(0 - i*1\right)|1\rangle +$$ +Then to, +$$ +|\psi\rangle=\sqrt{\frac{2}{3}}e^{i\pi/4}|0\rangle+\frac{1}{\sqrt{3}}e^{i\frac{3}{2}\pi}|1\rangle +$$ +so that we can rewrite it as +$$ +|\psi\rangle=e^{i\pi/4}\left(\sqrt{\frac{2}{3}}|0\rangle+\frac{1}{\sqrt{3}}e^{i\frac{5}{4}\pi}|1\rangle\right). +$$ +Now you can easily see that +$$ +\cos\frac{\theta}{2}=\sqrt{\frac{2}{3}},\qquad \phi=\frac{5\pi}{4},\qquad \gamma=\frac{\pi}{4}. +$$

+",1837,,18230,,10/2/2021 19:36,10/2/2021 19:36,,,,1,,,,CC BY-SA 4.0 +11622,1,11691,,4/20/2020 16:27,,4,837,"

I am trying to perform Quantum process tomography (QPT) on three qubit quantum gate. But I cannot find any relevant resource to follow and peform the experiment. I have checked Nielsen and Chuang's Quantum Computation and Quantum Information book.

+ +

And I found this, the formula to find Chi matrix for 2-qubit gates. Then in the research paperMeasuring Controlled-NOT and two-qubit gate operation there is lucid explanation how to perform the QPT for two qubit gates following Nielsen's suggestion in his book.

+ +

Following aforementioned references I am trying to obtain the formula for Chi matrix in case of 3 qubit gate. Experimentally I have found the matrix in the middle of equation 8.181 in Nielsen's book (it's in the attached image) but am having trouble finding permutation matrix 'P' (the permutation matrix) given in the same equation for three qubits. Can anyone help me explain how can I find it?

+ +

More importantly I want to know whether equation 8.810 of Nielsen's book (given in the attached image) itself should be used for the case of 3 qubit gates as well? If not how to modify it for 3-qubit gate?

+",11753,,8141,,6/9/2020 9:05,5/3/2021 8:48,How to perform Quantum Process Tomography for three qubit gates?,,1,3,,,,CC BY-SA 4.0 +11623,2,,11517,4/20/2020 17:20,,4,,"

In many quantum algorithms, the first step is to compute some problem on all instances at the same time -- if you wish, you compute all solutions at once. But then you are left with a state such as +$$ +\sum_x |x\rangle|f(x)\rangle\ , +$$ +where the information about the solution is contained in $|f(x)\rangle$. (Grover is a bit different, but the oracle still queries all solutions at once, just in a different way.) However, it is completely unclear how to access the solution. This is what makes each algorithm different, and what is the tricky thing to figure out -- how to get the information out by measuring. This is what distinguishes Deutsch-Jozsa, Simon's algorithm, period finding, ... : You need to find a smart way to extract said information.

+ +

Thus, evaluating all function values at once is usually one part of the problem (as e.g. for period finding = QFT = Shor), but this is not sufficient: It must be combined with a smart way of extracting the information, which is only possible in certain cases. Thus, it is very different from a non-determinstic Turing machine.

+",491,,,,,4/20/2020 17:20,,,,0,,,,CC BY-SA 4.0 +11624,2,,11580,4/20/2020 22:39,,8,,"

Let me quote my answer from over at physics.SE:

+ +
+ +

The intuition

+ +

Let us consider a channel $\mathcal E$, which we want to apply to a state $\rho$. (This could equally well be part of a larger system.) Now consider the following protocol for applying $\mathcal E$ to $\rho$:

+ +
    +
  1. Denote the system of $\rho$ by $A$. Add a maximally entangled state $|\omega\rangle=\tfrac{1}{\sqrt{D}}\sum_{i=1}^D|i,i\rangle$ of the same dimension between systems $B$ and $C$:

    + +

  2. +
  3. Now project systems $A$ and $B$ on $|\omega\rangle$:

    + +

    + +

    [This can be understood as a teleportation where we have only consider the ""good"" outcome, i.e., where we don't have to make a (generalized) Pauli correction on $C$, see also the discussion.]
    +Our intuition on teleportation (or a simple calculation) tells us that we now have the state $\rho$ in system $C$:

    + +

  4. +
  5. Now we can apply the channel $\mathcal E$ to $C$, yielding the desired state $\mathcal E(\rho)$ in system $C'$:

    + +

  6. +
+ +

However, steps 2 and 3 commute (2 acts on $A$ and $B$, and 3 acts on $C$), so we can interchange the ordering and replace 2+3 by 4+5:

+ +
    +
  1. Apply $\mathcal E$ to $C$, which is the right part of $|\omega\rangle$:

    + +

    + +

    This results in a state $\eta=(\mathbb I\otimes \mathcal E) +(|\omega\rangle\langle\omega|)$, which is nothing but the Choi state of $\mathcal E$:

    + +

    + +

    (This is the original step 3.)

  2. +
  3. We can now carry out the original step 3: Project $A$ and $B$ onto $|\omega\rangle$:

    + +

    + +

    Doing so, we obtain $\mathcal E(\rho)$ in $C'$:

    + +

  4. +
+ +
+

Steps 4 and 5 are exactly the Choi-Jamiolkowski isomorphism:

+ +
    +
  • Step 4 tells us how to obtain the Choi state $\eta$ for a channel $\mathcal E$
  • +
  • Step 5 tells us how we can construct the channel from the state
  • +
+
+ +

Going through the math readily yields the expression for obtaining $\mathcal E$ from $\mathcal \eta$ given in the question: +$$ +\begin{align*} +\mathcal E(\rho) &= \langle \omega|_{AB}\rho_A\otimes \eta_{BC}|\omega\rangle_{AB}\\ +& \propto \sum_{i,j} \langle i|\rho_A|j\rangle_{A} \langle i|_B\eta_{BC} |j\rangle_B \\ +& = \mathrm{tr}_B[(\rho_B^T\otimes \mathbb I_C) \eta_{BC}]\ . +\end{align*} +$$

+ +

Discussion

+ +

The intuition above is closely linked to teleportation-based quantum computing and measurement based quantum computing. In teleportation-based computing, we first prepare the Choi state $\eta$ of a gate $\mathcal E$ beforehand, and subsequently ""teleport through $\eta$"", as in step 5. The difference is that we cannot postselect on the measurement outcome, so that we have to allow for all outcomes. This is, depending on the outcome $k$, we have implemented (for qubits) the channel $\mathcal E(\sigma_k \cdot \sigma_k)$, where $\sigma_k$ is a Pauli matrix, and generally $\mathcal E$ is a unitary. If we choose our gates carefully, they have ""nice"" commutation relations with Pauli matrices, and we can account for that in the course of the computation, just as in measurement based computing. In fact, measurement based computing can be understood as a way of doing teleportation based computation in a way where in each step, only two outcomes in the teleportation are allowed, and thus only one Pauli correction can occur.

+ +

Applications

+ +

In short, the Choi-Jamiolkowski isomorphism allows to map many statements about states to statements about channels and vice versa. E.g., a channel is completely positive exactly if the Choi state is positive, a channel is entanglement breaking exactly if the Choi state is separable, and so further. Clearly, the isomorphism is very straightforward, and thus, one could equally well transfer any proof from channels to states and vice versa; however, often it is much more intuitive to work with one or the other, and to transfer the results later on.

+",491,,,,,4/20/2020 22:39,,,,0,,,,CC BY-SA 4.0 +11626,1,11628,,4/21/2020 1:01,,0,74,"

I am trying to perform OTOC for my 7 qubit protocol. I need to carefully control and use only 7 qubits but after making measurement in the 16 qubit Melbourne system (ibmq_16_melbourne) my protocol gets transpiled in all of the 16 qubits.

+ +

Is there any way (some codes in qiskit) to use only 7 qubits of the 16 qubits in IBMQ Melbourne, so that it uses only 7 qubits which I have used in the protocol for transpiling and measurement and not more? Or is there any other quantum computer available on which I can do this?

+",11753,,5955,,4/21/2020 9:01,4/21/2020 9:01,How to control the qubits in IBMQ,,1,0,,,,CC BY-SA 4.0 +11627,1,,,4/21/2020 1:01,,2,198,"

I'm trying to understand how to apply tensor products on 3-qubit systems (or well at least 2 qubits). Let's take a basic example:

+

+

where $$\lvert \psi \rangle = \lvert q_2q_1q_0\rangle $$ with $q_2$ being the most significant bit and $q_0$ the least significant (matching the above schematic for the circuit).

+

H matrix (for a single qubit): $$H = \frac{1}{\sqrt{2}}\begin{bmatrix} +1 & 1 \\ +1 & -1 +\end{bmatrix} $$

+

I understand that I need to use the identity matrix and tensor product in order to format the Hadamard matrix (and any other in the circuit) to be applied to 3 qubits. What I do not understand is how, generally, I determine the order of the tensor product? In order words, with the above description, should I do:

+

$$M=(H\otimes I)\otimes I = +\frac{1}{\sqrt{2}} +\begin{bmatrix} +I & 0 & I & 0\\ +0 & I & 0 & I\\ +I & 0 & -I & 0\\ +0 & I & 0 & -I\\ +\end{bmatrix}$$

+

or

+

$$M=(I\otimes I)\otimes H = +\begin{bmatrix} +H & 0 & 0 & 0\\ +0 & H & 0 & 0\\ +0 & 0 & H & 0\\ +0 & 0 & 0 & H\\ +\end{bmatrix}$$

+

More generally, how should I think about why the correct one is the right one? What is the logic I need to understand with regards to the "extension" of my gate's matrices and in which order I need to apply the Identity matrices in the tensor product?

+",11750,,16092,,6/15/2021 16:56,11/7/2022 18:01,IBM quantum circuit - order of tensor product for equivalent matrix,,1,3,,,,CC BY-SA 4.0 +11628,2,,11626,4/21/2020 1:10,,1,,"

The transpiler always expands the input circuits to the size of the target device. This is different than saying you are using all the qubits. This tutorial may be of help: Using the Transpiler

+ +

It shows you how to visually check which qubits you are using on a device

+",332,,,,,4/21/2020 1:10,,,,0,,,,CC BY-SA 4.0 +11629,2,,11627,4/21/2020 3:57,,0,,"

Borrowing from Lenny's Paperback, you can value a product state as follows: +\begin{eqnarray} +|\psi_1\rangle &=& a|0\rangle + b|1\rangle\\ +|\psi_1\rangle &=& c|0\rangle + d|1\rangle\\ +|\psi_3\rangle &=& |\psi_1\rangle \otimes \,|\psi_2\rangle \\ +|\psi_3\rangle &=& ( a|0\rangle + b|1\rangle) \otimes ( c|0\rangle + d|1\rangle) \\ +|\psi_3\rangle &=& ac |0\rangle \otimes |0\rangle + ad |0\rangle \otimes |1\rangle + bc |1\rangle \otimes |0\rangle + bd|1\rangle \otimes |1\rangle +\end{eqnarray}

+

Using this logic into the operators:

+

\begin{eqnarray} +O &=& H \otimes I \otimes I \\ +|\psi\rangle &=& |q_1\rangle \otimes |q_2\rangle \otimes|q_3\rangle \\ +O|\psi\rangle &=& \Big (H \otimes I \otimes I \Big) |q_1\rangle \otimes |q_2\rangle \otimes|q_3\rangle \\ +O|\psi\rangle &=& (H|q_1\rangle)\otimes ( I|q_2\rangle ) \otimes ( I|q_3\rangle ) +\end{eqnarray}

+

And if you want the other operator: +\begin{eqnarray} +O' &=& I \otimes I \otimes H \\ +|\psi\rangle &=& |q_1\rangle \otimes |q_2\rangle \otimes|q_3\rangle \\ +O|\psi\rangle &=& \Big (I \otimes I \otimes H \Big) |q_1\rangle \otimes |q_2\rangle \otimes|q_3\rangle \\ +O|\psi\rangle &=& (I |q_1\rangle)\otimes ( I|q_2\rangle ) \otimes ( H|q_3\rangle ) +\end{eqnarray}

+
+",6253,,16092,,6/15/2021 15:58,6/15/2021 15:58,,,,2,,,,CC BY-SA 4.0 +11631,1,11633,,4/21/2020 4:26,,3,223,"
+

Let $\overline{p}$ be a probability distribution on $\{1,....,d\}$. Then let $\rho = \sum_ip_i|i\rangle\langle i| \otimes \rho_i$.

+
+ +

How should I take the Von-Neumann entropy of $\rho$? I know that Von-Neumann entropy is additive under the tensor product. So

+ +
+

$S(\rho) = S(\sum_ip_i|i\rangle\langle i| \otimes \rho_i) = S(p_i\sum_i|i\rangle\langle i|) + S(\sum_i\rho_i)$

+
+ +

How can I break this down further? My goal is to prove $S(\rho) = S(\overline{p}) + \sum _i p_iS(\rho_i)$ but I would just like help on how to work with the two terms I've broken $S(\rho)$ into

+",11647,,55,,10/12/2020 21:27,10/12/2020 21:27,What is the Von Neumann entropy of $\rho = \sum_ip_i|i\rangle\langle i| \otimes \rho_i$?,,1,0,,,,CC BY-SA 4.0 +11633,2,,11631,4/21/2020 7:23,,7,,"

Operator $\rho$ is not a tensor product, it's a sum of tensor products +$$ +p_1|1\rangle\langle 1| \otimes \rho_1 + p_2|2\rangle\langle 2| \otimes \rho_2 + \dots + p_d|d\rangle\langle d| \otimes \rho_d. +$$ +This is not the same as +$$ +\big(\sum_ip_i|i\rangle\langle i|\big) \otimes \big(\sum_i\rho_i\big), +$$ +so your expansion isn't correct.

+ +

Also in general $S(A+B)\neq S(A)+S(B)$, but in this situation the supports of $|i \rangle\langle i|\otimes \rho_i$ and $|j \rangle\langle j|\otimes \rho_j$ are orthogonal, so we can write +$$ +S(\rho) = S(p_1|1\rangle\langle 1| \otimes \rho_1) + \dots + S(p_d|d\rangle\langle d| \otimes \rho_d) +$$ +Here $p_i|1\rangle\langle 1| \otimes \rho_i$ is not a density matrix because it's scaled, i.e. its trace equals $p_i<1$, so technically $S$ is not defined. But for such matrices we also can define expression $S(M) = -\sum_i \lambda_i\text{ln}\lambda_i$, where $\lambda_i$ are eigenvalues of $M$. It's easy to check that for $c>0$ and density matrix $\rho$ we have $S(c\rho) = cS(\rho) - c\text{ln}c$. So we can write +$$ +S(p_i|i\rangle\langle i| \otimes \rho_i) = p_iS(|i\rangle\langle i| \otimes \rho_i)-p_i\text{ln}p_i = +$$ +$$ += p_i\big(S(|i\rangle\langle i|) + S(\rho_i)\big)-p_i\text{ln}p_i = p_iS(\rho_i)-p_i\text{ln}p_i +$$ +After the summation we will have +$$ +S(\rho) = \sum _i p_iS(\rho_i) - \sum_ip_i\text{ln}p_i = \sum _i p_iS(\rho_i) + S(\overline{p}) +$$

+",5870,,,,,4/21/2020 7:23,,,,3,,,,CC BY-SA 4.0 +11634,1,11635,,4/21/2020 10:07,,1,158,"

I am interested in retrieving the OpenQasm code of a quantum circuit, as it appears on IBM Quantum Experience. This is the code that the quantum machine actually runs. I used to be able to just copy the code from the results tab, but I seem to not be able to do that anymore. Is there any way to retrieve said Qasm code? Thank you in advance.

+",6244,,,,,4/21/2020 12:17,How to get QASM code from IBMQ experience,,1,0,,,,CC BY-SA 4.0 +11635,2,,11634,4/21/2020 10:57,,3,,"

On the results tab, above the circuit diagram, there is an option to see the QASM code +

+ +

[EDIT] You cannot copy and paste code from this tab. You can retrieve the QASM in a text format simply by using Qiskit instead, all you need is the Job ID. This code can be run easily in a notebook in the IBM Quantum Experience. You can do this as follows

+ +
provider = IBMQ.load_account()
+result = backend.retrieve_job('job id')
+qob = result.qobj()
+
+from qiskit.assembler import disassemble
+jobs = disassemble(qob)
+qc = jobs[0][0]
+
+qc.qasm()
+
+",5955,,5955,,4/21/2020 12:17,4/21/2020 12:17,,,,2,,,,CC BY-SA 4.0 +11636,1,11638,,4/21/2020 13:29,,3,116,"

Recently I was reading about the projective measurement in "Quantum Computation and Quantum Information" by Nielsen & Chuang, where they describe the projective measurement as follows:

+
+

Projective measurements: A projective measurement is described by an observable, $M$, a Hermitian operator on the state space of the system being observed. The observable has a spectral decoomposition,

+

$$ M = \sum_m m P_m, $$

+

where $P_m$ is the projector onto the eigenspace of $M$ with eigenvalue $m$. The possible outcomes of the measurement correspond to the eigenvalues, $m$, of the observable. [...]

+
+

Usually, while conducting a measurement on a qubit we are using two projectors, namely $P_0 = |0\rangle \langle 0|$ and $P_1 = |1\rangle \langle 1 |$.

+

For the case of $P_0$ we have two possible eigenvalues:

+
    +
  • 0, with eigenvector $\begin{pmatrix} 0 \\ 0 \end{pmatrix}$,
  • +
  • 1, with eigenvector $\begin{pmatrix} 1 \\ 0 \end{pmatrix} = |0\rangle$.
  • +
+

In the case of $P_1$ we have simmilar eigenvalues:

+
    +
  • 0, with eigenvector $\begin{pmatrix} 0 \\ 0 \end{pmatrix}$,
  • +
  • 1, with eigenvector $\begin{pmatrix} 0 \\ 1 \end{pmatrix} = |1\rangle$.
  • +
+

Because qubit has to be normalized, I guess the eigenstates associated to the 0 eigenvalue cannot be obtained during a measurement. But if we would like to stick to the definition $M = \sum_m m P_m$ for $m = \{0,1\}$, we would get

+

$$ M = 0 \cdot P_0 + 1 \cdot P_1 = P_1,$$

+

which I think is incorrect.

+

Because of that, isn't the formulation of an observable as $M = \sum_m m P_m$ a little bit misleading? Shouldn't it be defined as

+

$$ M = \sum_m \lambda_m P_m,$$

+

where $\lambda_m$ is the eigenvalue associated to the appropriate state? Then we would get

+

$$ M = \lambda_0 P_0 + \lambda_1 P_1 = 1 \cdot P_0 + 1 \cdot P_1 = \mathbf{I}. $$

+",2098,,-1,,6/18/2020 8:31,4/21/2020 13:39,Help in understanding the usage of eigenvalues in the definition of the projective measurement,,1,1,,,,CC BY-SA 4.0 +11637,1,11641,,4/21/2020 13:35,,2,382,"

Usually, while conducting a measurement on a qubit we are using two projectors, namely $P_0 = |0\rangle \langle 0|$ and $P_1 = |1\rangle \langle 1 |$.

+ +

For the case of $P_0$ we have two possible eigenvalues:

+ +
    +
  • 0, with eigenvector $\begin{pmatrix} 0 \\ 0 \end{pmatrix}$,
  • +
  • 1, with eigenvector $\begin{pmatrix} 1 \\ 0 \end{pmatrix} = |0\rangle$.
  • +
+ +

In the case of $P_1$ we have simmilar eigenvalues:

+ +
    +
  • 0, with eigenvector $\begin{pmatrix} 0 \\ 0 \end{pmatrix}$,
  • +
  • 1, with eigenvector $\begin{pmatrix} 0 \\ 1 \end{pmatrix} = |1\rangle$.
  • +
+ +

I guess, that due to the noralization condition we cannot obtain the $\begin{pmatrix} 0 \\ 0 \end{pmatrix}$ states. So the only possible outcomes of a measurement are states $|0\rangle$ and $|1\rangle$ both with eigenvalue 1.

+ +

So what is the interpretation of this eigenvalue? Is it something like the ""amount of information"" stored in a qubit?

+",2098,,,,,4/22/2020 13:27,What's the interpretation of the eigenvalues of qubit's projective operators?,,3,0,,,,CC BY-SA 4.0 +11638,2,,11636,4/21/2020 13:39,,2,,"

From the perspective you're coming at it from, yes your definition sounds more reasonable. However, you're not supposed to be starting from the projectors and making an observable. You're supposed to be starting from the observable and using it to specify the projectors. For example, let's take $M=Z$, the standard Pauli matrix. $Z$ has eigenvalues $\pm 1$, so +$$ +Z=P_+-P_-, +$$ +and we associate +$$ +P_+=|0\rangle\langle 0|,\qquad P_-=|1\rangle\langle 1|. +$$ +Now it is true that later you might choose to change the labels on your projectors. In this specific case, it is more common to see them written as $P_0$ and $P_1$. However, what the operator is essentially telling you is ""your measurement device will give you an answer either +1 or -1, and these are the corresponding projectors"" and so the meaning is sensible and consistent across all observables you might choose.

+",1837,,,,,4/21/2020 13:39,,,,0,,,,CC BY-SA 4.0 +11640,1,11644,,4/21/2020 14:25,,1,127,"

In classical logic circuit consisting of AND, OR and others, common gates can be realized by electrnic signal. Each time cycle can run a function unit like the picture below.

+ +

Now I have read many paper and try to understand how to simulate quantum circuits on classical computer. They just tell me the circuits can be changed by ""HT circuit (Hadmard+ Toffoli)"". However, they don't tell me how to simulate a Hadmard gate and how to simulate the entangled state after Hadmard gate.

+ +

Is that means we can just translate the Quantum circuit to something just like a traditional circuit and run each function unit in a time cycle?

+ +

+",11765,,9006,,4/22/2020 7:27,4/22/2020 8:00,A question about quantum circuit simulation on PC,,1,2,,,,CC BY-SA 4.0 +11641,2,,11637,4/21/2020 14:59,,2,,"

The eigenvalues are just labels for the outcomes of the measurement. They don't necessarily have any physical meaning.

+ +

See this answer for a more detailed understanding.

+",4831,,,,,4/21/2020 14:59,,,,0,,,,CC BY-SA 4.0 +11642,2,,11637,4/21/2020 15:23,,1,,"

Projectors have eigenvalues 0 and 1 by definition. There's nothing more to interpret here...

+ +

(Note that the projectors have eigenvectors of 0 eigenvalue which are non-trivial, which are orthogonal to the eigenvectors with eigenvalue 1.)

+",1837,,,,,4/21/2020 15:23,,,,0,,,,CC BY-SA 4.0 +11643,2,,50,4/21/2020 21:14,,3,,"

The exact amount of memory required to simulate a quantum computer classically varies wildly depending on the quantum algorithm being simulated. If information about the quantum algorithm is known in advance, special consideration can be given and drastically improve the memory consumption. For example:

+ +
    +
  • If the circuit does not generate entanglement, classical simulation is linear.
  • +
  • If the circuit can be partitioned such that no qubits in one section are entangled with any other section, classical simulation is $2^{m}$ where m is the number of qubits in the largest section.
  • +
  • If the number of CNOT gates in a circuit is less than the number of qubits minus 1, the above case occurs. (If there are 64 qubits and only 22 CNOTs, not every qubit can be entangled with every other).
  • +
+ +

The memory consumption can also depend on the simulation algorithm used. The most common is to store the quantum state as a vector of complex single precision floating point numbers and transform them based off the matrix form of the gate. This method is very computationally fast, most of the time is spent rotating memory from RAM to disk for large number of qubits. However there do exist other simulation algorithms which use less space.

+ +

It is possible to calculate each final amplitude independently, requiring only linear memory. Unfortunately, the time requirements for this type of algorithm are incredibly high because there is no memory to store intermediate results; each amplitude may recompute some parts of the simulation leading to wasted time.

+ +

If you are looking to calculate the amount of memory required to simulate a circuit which there is no information known about using the vector method, the formula is: 8 bytes * $2^n$

+ +

For 48 qubits that would be: 8 bytes * $2^{48}$ = 2 petabytes.

+ +

For 64 qubits that would be: 8 bytes * $2^{64}$ = 131,072 petabytes.

+ +

8 bytes comes from the fact that each amplitude is stored as a complex float, 4 bytes for the real and imaginary components. Increase to 16 bytes for double precision.

+",11769,,,,,4/21/2020 21:14,,,,0,,,,CC BY-SA 4.0 +11644,2,,11640,4/22/2020 8:00,,2,,"

There are more ways to simulation of a quantum computer on classical one. For example, you can introduce different noise models to simulate quantum fluctuations. However, I will give you an example of simulator I implemented in MatLab. In this simulator I assume no noise, i.e. ideal quantum computer is simulated and returned results follow a theory.

+ +

The basics idea behind the simulator is to use Deutsch model of qunatum computing. This means that each quantum gate is described by unitary matrix $U$ of type $N \,\text{x}\, N$ and quantum state by complex unit vector $|\psi\rangle$ (i.e. $|\psi\rangle \in\mathbb{C}^N$$|\,|\psi\rangle\,| = 1$). Note that $N = 2^n$ where $n$ is a number of qubits involved.

+ +

Now, lets look at matrix representation of Hadamard gate you are looking for:

+ +

$$ +H = \frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 1 \\ +1 & -1 +\end{pmatrix}. +$$

+ +

There is many gates in quantum computing, see this list for their matrix representation.

+ +

Acting of quantum gate $U$ on quantum state $|\psi\rangle$ is described by matrix multiplication, i.e. $U|\psi\rangle$.

+ +

For example, lets have a qubit in state $|0\rangle = \begin{pmatrix}1\\0\end{pmatrix}$ and apply Hadamard gate:

+ +

$$ +H|0\rangle = \frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 1 \\ +1 & -1 +\end{pmatrix} +\begin{pmatrix}1\\0\end{pmatrix} += +\frac{1}{\sqrt{2}} +\begin{pmatrix}1\\1\end{pmatrix} +$$

+ +

So, now your qubit is in superposition of states $|0\rangle$ and $|1\rangle$. Note that in your question, you are talking about entangled state after Hadamard. This gate does not produce entangled state but superposition as I mentioned above.

+ +

To produce entangled state, you need controlled gate, for example CNOT (controlled NOT) acting on two qubits. This gate is descibed by matrix +$$ +\text{CNOT} = +\begin{pmatrix} +1 & 0 & 0 & 0\\ +0 & 1 & 0 & 0\\ +0 & 0 & 0 & 1\\ +0 & 0 & 1 & 0\\ +\end{pmatrix} +$$

+ +

The gate negate second qubit (so-called target qubit) in case the first qubit (control qubit) is in state $|1\rangle$ otherwise it does nothing.

+ +

Here is an example of simple circuit (note: the figure was taken from Wiki):

+ +

.

+ +

Lets now have a look on how simulate the circuit with approach introduced above. Firstly Hadamard gate is applied on first qubit and nothing on second qubit. The nothing means there is a identity operator described by unit matrix $I$. This step of algorithm is expressed as

+ +

$$ +H \otimes I = +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 1 \\ +1 & -1 +\end{pmatrix} +\otimes +\begin{pmatrix} +1 & 0 \\ +0 & 1 +\end{pmatrix} +=\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 0 & 1 & 0\\ +0 & 1 & 0 & 1\\ +1 & 0 & -1 & 0\\ +0 & 1 & 0 & -1\\ +\end{pmatrix} +$$

+ +

Note that the symbol $\otimes$ means tensor product.

+ +

Second step in the circuit is CNOT gate. To get matrix description of whole circuit all steps have to be multiplied, i.e. the circuit is depicted by matrix $\text{CNOT} (H \otimes I)$.

+ +

To get final state of the cirucit after application on input, we have to multiply the input state with matrix describing the circuit. The input is state $|00\rangle = |0\rangle \otimes |0\rangle = \begin{pmatrix}1 \\0\\0\\0\end{pmatrix}$, i.e. both input qubits are in state $|0\rangle$. Hence we have

+ +

$$ +\text{CNOT}(H \otimes I)|00\rangle = +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1\\0\\0\\1 +\end{pmatrix} += +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1\\0\\0\\0 +\end{pmatrix}+\frac{1}{\sqrt{2}} +\begin{pmatrix} +0\\0\\0\\1 +\end{pmatrix}= +\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle). +$$

+ +

After measurement, the output state will be either $|00\rangle$ or $|11\rangle$, both with probability $\frac{1}{2}$ because $\Big(\frac{1}{\sqrt{2}}\Big)^2 = \frac{1}{2}$.

+",9006,,,,,4/22/2020 8:00,,,,0,,,,CC BY-SA 4.0 +11645,1,,,4/22/2020 8:46,,3,123,"

In supremacy paper and part D of section VII of supplementary information (below), it is said that there is a pseudo-random number generator that is initialized with a seed called $s$; And then the single-qubit gates are selected from the set of three gates $\sqrt{X} , \sqrt{Y},\sqrt{W}$ according to this random number.

+ +

D. Randomness

+ +
+

Single-qubit gates in every cycle are chosen randomly + using a pseudo-random number generator (PRNG). The + generator is initialized with a seed s which is the third + parameter for our family of RQCs. The single-qubit gate + applied to a particular qubit in a given cycle depends onlyon s. Consequently, two RQCs with the same s apply the + same single-qubit gate to a given qubit in a given cycle + as long as the qubit and the cycle belong in both RQCs + as determined by their size n and depth m parameters.

+ +

Conversely, the choice of single-qubit gates is the sole + property of our RQCs that depends on s. In particular, + the same two-qubit gate is applied to a given qubit pair + in a given cycle by all RQCs that contain the pair and + the cycle.

+
+ +

and in part E:

+ +
+

Single-qubit gates in the first cycle are chosen independently + and uniformly at random from the set of the three gates above. In subsequent cycles, each single-qubit + gate is chosen independently and uniformly at random + from among the gates above except the gate applied to + the qubit in the preceding cycle. This prevents simplifications of some simulation paths in SFA. Consequently, + there are $3^n2^{nm}$ possible random choices for a RQC with + n qubits and m cycles.

+
+ +

What I understand from the experiment and this answer is that we have a circuit, we have an input state , and after passing this input state through the circuit, we do a measurement, and a ket consisting of zeros and ones ($e.g. |{10010101..10>}$) is obtained. Now we are repeating the experiment for many times again and again in exactly the same way and with exactly the same circuit (if I'm wrong correct me), which means that the random number you produce must again produce the same series of numbers, which is possible by initializing $s$ to the previous value.

+ +

After repeating the measurements on exactly the same circuit (for example, one million times), you can draw a bar chart (see the picture below) and get the distribution function approximately and then compared the distribution to the simulation distribution as it's mentioned in this lecture note.

+ +

+ +

and in the caption of this picture it's said:

+ +
+

Lastly, we measure the state of every qubit. The measurement is repeated many times + in order to estimate the probability of each output state. Here, we plot the measured probabilities for two instances after 10 + coupler pulses (cycles).

+
+ +

Now my question is, why do we use random numbers at all when we actually have to measure the output of the same circuit many times? Why don't we choose single-qubits gates according to a pattern like two-qubit gates?

+ +

Did Google do what I explained here for supremacy experiment or I'm missing something? That is, a specific circuit of certain single-qubit gates on a certain qubits and then two-qubit gates in each cycle and then go to the next cycle and after for example 20 cycles (for supremacy experiment) then measuring the state of each qubit and repeat the whole process with exactly the same circuit (same as I explained above) many times? If so, has Google actually do the experiment only on one circuit (I mean do the 1 million measurement on one specific circuit) or tested different circuits (with different value $s$) to verify the experiment?

+ +

If this is not the case, and each time after a measurement and obtaining a ket consisting of zeros and ones $s$ changes, and as a result, the circuit changes, and then the measurement is done, and this is repeated many times, and then from these measurements that the distribution is obtained, how is this distribution useful? because the measured kets are practically for different circuits.

+ +

What role does this randomness play in making things difficult? When it is practically pseudo-random and therefore structured, and by knowing $s$ (the seed) you can get the rest of the numbers, because according to this answer, what I understand is that the main difficulty is not because of the single-qubits gates are randomly chosen, but the main difficulty is because of the high dimension of the problem and the matrix multiplication in these dimensions are difficult to perform for a classical computer.(I've already read this answer but I don't quite understand)

+ +

And the last question is, what does instance mean in the figure above? Is the bar chart of each instance obtained by repeating a large number of measurements on a same circuit with the same value $s$?

+",10456,,10456,,4/22/2020 8:59,4/24/2020 0:05,What is the role of choosing the single-qubits randomly in Google quantum supremacy experiment?,,1,2,,,,CC BY-SA 4.0 +11646,2,,10258,4/22/2020 11:02,,-1,,"

The expectation value that the system provided me with was 0.6757938265800476. This was in a range of [-1,1]. Mapping this to a range of [0,1]: (0.6757938265800476+1)/2=0.837896913290024. The expectation value was the expectation value for qubit 0. This implies that it observed qubit 0 in state 0 83.7896913290024% of the time, and 1-0.837896913290024 in state 1.

+ +

The system also printed the following probabilities:
+$P_{00} = 0.7094002059173512$
+$P_{01} = 0.13724355108492148$
+$P_{10} = 0.12849669756020887$
+$P_{11} = 0.024859516013751914$

+ +

The probability to observe qubit 0 (indexing right to left) in state 0:
+$ E_{q0} = 0.8378969 = 0.7094002 + 0.1284966 = P_{00} + P_{10}$

+ +

To answer the question ""How can I use expectation_from_wavefunction to obtain the probabilities of observing the individual states"": you can't. You can only relate this particular expectation value (with Pauli Z) to a set of state probabilities, but not to individual ones without extra information (such as observables in different computational basis)

+ +

""Why would I favor this approach"": access to the internal quantum state is not realistic with quantum system, and would require more computation.

+ +

P.S. this is my current interpretation which I expect to be right on a high level. I think I still have details wrong, such as parts of the explanation. Very open to opinions.

+",2794,,2794,,4/22/2020 11:08,4/22/2020 11:08,,,,0,,,,CC BY-SA 4.0 +11647,1,,,4/22/2020 13:26,,1,420,"

I have been trying to run a circuit on ibmq_16_melbourne. But the result shows ERROR_RUNNING_JOB. The run status says: +'Circuit runtime is greater than the device repetition rate [8020]'.

+

Here are a few circuit details:

+

Size (total number of gates): 14137
+Depth: 7836
+Qubits: 14
+Shots: 64

+

Gate count: [('u1', 7506), ('cx', 5850), ('u2', 678), ('x', 73), ('cswap', 18), ('h', 6), ('measure', 6)]

+

It runs fine on the qasm_simulator. I could not find how to deal with this kind of error. Can some tell what does it mean and how to fix it?

+",11777,,104,,11/29/2020 14:46,11/29/2020 14:46,Error while running the circuit on a real device on IBMQ,,1,0,,,,CC BY-SA 4.0 +11648,2,,11637,4/22/2020 13:27,,0,,"

If you think of a projector $P$ as representing a kind of ""yes/no"" question you can ask to a state, you can understand the $1$s as marking the eigenstates (more precisely, the eigenspace) corresponding to the ""yes"" answer. +What I mean by this is that any (orthogonal) projector represents a measurement with two possible outcomes: either you find your state to be in the $+1$ eigenspace of the projector (i.e. $\ker(P-I)$), or you don't.

+ +

I would note that from a purely informational perspective, the value of these eigenvalues doesn't make any difference. If you were to perform a measurement corresponding to some other observable with some $\lambda$s and $\mu$s where $P$ has $1$s and $0$s, you would collapse the state in exactly the same way. The only difference is in the numbers/labels you attach to the measurement results ($0$ and $1$ for a projector, some other $\lambda\neq\mu$ for another operator). +The only thing that really matters (at least as far as the way the state is collapsed by the measurement is concerned) is the way the operator splits the Hilbert space in different eigenspaces.

+",55,,,,,4/22/2020 13:27,,,,0,,,,CC BY-SA 4.0 +11649,2,,11647,4/22/2020 14:58,,3,,"

This error means that the circuit is too deep, you need to reduce the depth of the circuit in order to get it to run. This means that you need to reduce the number of gates you are using.

+ +

If you have not already, I would suggest running it through the transpiler using a higher optimization level before you run it to see if this reduces the gate count. You can do this by doing execute(your_circuit, backend, optimization_level=3)

+ +

Alternatively, you can continue running the circuit on the simulator, but add a NoiseModel to make it more like a run on a real device. There is more information about how to do that here.

+",5955,,5955,,4/26/2020 13:16,4/26/2020 13:16,,,,5,,,,CC BY-SA 4.0 +11650,1,,,4/22/2020 23:32,,3,221,"

I'm trying to find a way to check if a given quantum circuit is essentially a classical one (up to changes in phase).

+ +

Given a description of a quantum circuit by a list (of size $l$) of ordered operations of Hadamard gates and Toffoli gates (i.e, specifying the specific qubits on which they are operated) operating on $n$ qubits, is there an efficient (polynomial in $l,n$) algorithm that finds whether the computation of the circuit on a quantum state which is not a superposition?

+ +

That is, check if for $\forall x \in\{0,1\}^n \ \exists y\in\{0,1\}^n$ such that $U|x⟩=|y⟩$, for $U$ that is represented by the given list.

+",11782,,11782,,4/23/2020 7:34,5/23/2020 22:00,How to check if a quantum circuit is deterministic?,,2,10,,,,CC BY-SA 4.0 +11651,1,11655,,4/23/2020 0:59,,3,261,"

$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$ +In Quantum Computation and Quantum Information the authors make the following statement ""[G]iven any basis states $\ket{a}$ and $\ket{b}$ for a qubit, it is possible to express an arbitrary state as a linear combination $\alpha\ket{a} + \beta\ket{b}$ of those states."" They go on to say that if the states are orthonormal, then one can perform a measurement with respect to the $\ket{a}\!, \ket{b}$ basis.

+ +

My question is does this imply that any two distinct pure states $\ket{a}$ and $\ket{b}$ form a basis for the Bloch sphere? (I apologize if this might make more sense in reference to a Hilbert space or some other vector space but I haven't gotten to that point in the book yet and have no experience with it otherwise).

+ +

It appears that any two distinct pure states are linearly independent, so I would suspect yes, but I do not believe I know enough to prove it.

+ +

For example, I attempted to try to transform the state defined by $\ket{\psi} = \frac{\sqrt{2 + \sqrt{2}}}{2}\ket{0} + \frac{\sqrt{2 - \sqrt{2}}}{2}\ket{1}$ into the basis $\{\ket{0}\!, \ \ket{+}\}$ where $\ket{+} = \frac{\ket{0} + \ket{1}}{\sqrt{2}}$. I obtained the following: +$$ +\begin{align*} +\ket{\psi} &= \alpha\ket{0} + \beta\ket{1} = \alpha\ket{0} + \beta(\sqrt{2}\ket{+}-\ket{0}) = (\alpha - \beta)\ket{0} + \sqrt{2}\beta\ket{+}\\ +&= \frac{ \sqrt{2+\sqrt{2}} - i\sqrt{2-\sqrt{2}} }{2}\ket{0} + \frac{i\sqrt{2}\sqrt{2 - \sqrt{2}}}{2} \ket{+} +\end{align*} +$$

+ +

This basis is neither orthogonal nor normal, so we would not be able to make a measurement with respect to it, however I believe that this is still a valid way to represent a state.

+ +

As the requirement that the basis be orthonormal in order to perform a measurement with respect to it implies that such bases exist, +I would be interested in an example of orthogonal but not normal basis. I believe that taking two orthogonal bases (antipodal with respect to the bloch sphere), then scaling them, would be sufficient to realize this type of example.

+ +

I would also be interested in an example of a normal but not orthogonal basis, however no simple examples come to mind (it may be that there are no simple examples).

+",11742,,,,,4/23/2020 10:05,Do any two distinct pure states form a basis?,,3,0,,,,CC BY-SA 4.0 +11652,1,11658,,4/23/2020 4:32,,0,210,"

I am running my old qiskit code after a very long time it's not running now showing error wrong color format 'ansibrightred' and I don't know why?

+ +
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
+
+circuit = QuantumCircuit(2,2)
+circuit.h(0)
+circuit.cx(0,1)
+circuit.measure([0,1], [0,1])
+
+",8527,,5955,,4/23/2020 8:03,4/28/2020 19:33,AssertionError: wrong color format 'ansibrightred',,1,1,,,,CC BY-SA 4.0 +11653,2,,11651,4/23/2020 5:21,,0,,"

I will start by saying that if you have a vector space $\mathcal{V}$ with dim $V = N$, then this space is spanned by a basis comprised of $N$ linearly independent vectors. And any vector in this space can be described as a linear combination of these basis elements. So yes, I am inclined to say that $|a\rangle, |b\rangle$, standing for $|0\rangle, |1\rangle$ can form the basis for the 2-level system.

+ +

I am a bit confused on the statement regarding mapping $ \mathcal{B} =\{ |0\rangle , |1\rangle\}$ into $ \mathcal{B'} =\{ |+\rangle , |- \rangle \}$. My understanding is that in order to map your original basis into this new basis you need $H$ gate applied to your qubit.

+ +

Provided: +\begin{eqnarray} +H|0\rangle &=& |+\rangle \\ +H|1\rangle &=& |-\rangle \\ +H \Big ( \alpha|0\rangle + \beta |1\rangle \Big ) &=& \alpha H|0\rangle + \beta H|1\rangle\\ +H |\psi\rangle &=& \alpha |+\rangle + \beta |-\rangle +\end{eqnarray}

+ +

Given that $ |+\rangle = \frac{|0\rangle + |1\rangle}{\sqrt{2}}, |-\rangle = \frac{|0\rangle + |1\rangle}{\sqrt{2}}$ you can see that given that the initial basis was indeed orthonormal, so is this new basis.

+ +

Which is to say, I am not sure you can just change old basis for the new basis without applying the rotation which effectively does that change.

+ +

But of course, I can be wrong.

+",6253,,9006,,4/23/2020 10:05,4/23/2020 10:05,,,,0,,,,CC BY-SA 4.0 +11654,2,,11651,4/23/2020 6:51,,2,,"

Generally set of $n$ linearly indepedent vectors forms basis of a space with dimension $n$. However, in QC the basis has to be orthonormal to be able to distinguish basis states in a measurement and to have fulfilled condition $\sum_{i=1}^n|x_i|^2=1$, where $x_i$ is a vector member.

+",9006,,,,,4/23/2020 6:51,,,,0,,,,CC BY-SA 4.0 +11655,2,,11651,4/23/2020 7:16,,4,,"

Your statements about bases are correct. For a qubit, any two distinct states can be used as a basis such that linear combinations of them can describe any state that you want. (If you want to describe something larger, you need more states.)

+ +

First, a comment about the term ""distinct"". Are states +$$ +\frac{|0\rangle+|1\rangle}{\sqrt{2}},\qquad{\text{and}}\qquad \frac{1+i}{2}|0\rangle+\frac{1+i}{2}|1\rangle +$$ +distinct? Clearly, they are not equal (which is the way I would usually take the meaning). However, they should not be considered distinct in the way that you need to take the meaning here. This is because the two states are the same up to an irrelevant global phase.

+ +

With that taken care of, let me expand on the proper explanation (which is basically just a generalisation of the argument you gave): Let's say I have a state of a qubit $|\psi\rangle$. I would like to express it in terms of two basis states $|\phi_0\rangle$ and $|\phi_1\rangle$ which are not orthogonal. To help, I can define a state $|\phi^\perp\rangle$ which is orthogonal to $|\phi_0\rangle$. This means that I can write +$$ +|\psi\rangle=\alpha|\phi_0\rangle+\beta|\phi^\perp\rangle +$$ +and also +$$ +|\phi_1\rangle=\gamma|\phi_0\rangle+\delta|\phi^\perp\rangle, +$$ +where $\delta\neq 0$. So we can trivially substitute +$$ +|\psi\rangle=\alpha|\phi_0\rangle+\frac{\beta}{\delta}\left(|\phi_1\rangle-\gamma|\phi_0\rangle\right), +$$ +and hence we can always express $|\psi\rangle$ in terms of $|\phi_0\rangle$ and $|\phi_1\rangle$, as desired, and this is a perfectly valid way to decompse the state. Your case of $|0\rangle$ and $|+\rangle$ is the perfect example of this.

+ +

You start, then, to talk about measurement in your question. Measurement is an entirely separate topic. Yes, writing a state with regards to a particular decomposition can be helpful when calculating measurement outcomes, but it's by no means a necessary procedure. (I'd argue that most of the time, the reason why we use an orthonormal basis is that it makes all calculations, such as inner products, easier, not specifically those associated with measurement.) Equally, the states for that don't need to be orthogonal. The orthogonality is a feature of projective measurements but if you were using POVMs, for example, the most natural basis could well be non-orthogonal.

+ +

An example with an orthogonal but not normal basis is trivial - whatever normalisation factor you put on the basis states you compensate for with the coefficient. However, in quantum, you should (essentially) always be using normalised states.

+",1837,,,,,4/23/2020 7:16,,,,3,,,,CC BY-SA 4.0 +11656,1,11657,,4/23/2020 11:02,,3,48,"

A qubit $\vert \psi \rangle = \alpha \vert 0 \rangle + \beta \vert 1 \rangle \in \mathcal{H}^2$. A more general form of $n$-qubits is an element in +$$\mathcal{H}^{\otimes 2^{n}} = +\underbrace{\mathcal{H}^2\otimes\mathcal{H}^2\otimes\ldots\otimes\mathcal{H}^2}_{n \text{ times}}.$$ +Is it possible to have a qubit to be in $\mathcal{H}^{\otimes 2^{n}+1}$ i.e. in an odd dimension?

+",7528,,,,,4/23/2020 11:15,Can a qubit live in $\mathcal{H}^{\otimes 2^{n}+1}$?,,1,5,,,,CC BY-SA 4.0 +11657,2,,11656,4/23/2020 11:15,,7,,"

Sure. This is actually what physicists do when they make a qubit - often they don't have a system of just two levels but many levels. It's just that they choose to only use some of those levels. The simplest case, for example, is the atomic $\Lambda$ system. This has 3 levels. The two lowest energy levels are used as the qubit basis. There's a third level which isn't part of the qubit, but is made use of for making the gates.

+",1837,,,,,4/23/2020 11:15,,,,2,,,,CC BY-SA 4.0 +11658,2,,11652,4/23/2020 11:17,,3,,"

That error is caused by running qiskit-terra 0.13.0 with pygments installed, but below the optional dependency minimum version of 2.4: https://github.com/Qiskit/qiskit-terra/blob/master/setup.py#L117. However, you've found a bug in terra, an error should only be shown if you are using the optional functionality (circuit.qasm() with formatted=True set or using the circuit library jupyter widget). I've pushed up a fix to address this edge case in: https://github.com/Qiskit/qiskit-terra/pull/4229

+ +

In the meantime while waiting for that to get into a release, you can workaround this issue by either installing pygments>=2.4 or uninstalling pygments. Either will fix the error.

+",5529,,5529,,4/23/2020 12:14,4/23/2020 12:14,,,,0,,,,CC BY-SA 4.0 +11659,1,11661,,4/23/2020 11:28,,1,93,"

I computed SAT formula with the Grover search algorithm on the Qiskit simulator with default parameters, but I don't understand why the incorrect solutions don't have a probability of 0?

+ +

The SAT formula is $(x_1 \vee x_2) \wedge (x_2 \vee x_3)$.

+ +

+",10192,,9006,,4/23/2020 13:33,4/23/2020 14:50,Results of SAT on the Qiskit simulator,,1,2,,,,CC BY-SA 4.0 +11660,1,,,4/23/2020 11:56,,1,41,"

I want to implement this thing: +Operator([[3, Pauli([1,0,0], [0,0,0])], [2, Pauli([0,0,0],[0,0,3])]])

+ +

But while doing this there is an error in ""qiskit.aqua.operator"" +How can we fix this?

+ +

The main problem is to run this notebook completely without any error: +https://gitlab.com/qosf/qml-mooc/-/blob/master/qiskit_version/07_Variational_Circuits.ipynb

+ +

If anybody had able to complete this notebook then my all doubts would be cleared.

+",11790,,5955,,4/23/2020 12:32,4/23/2020 12:32,Error in qiskit.aqua.operator,,0,1,,,,CC BY-SA 4.0 +11661,2,,11659,4/23/2020 13:43,,3,,"

It seems that the algorithm works well. Your formula returns zero for inputs 000, 001 and 100. Those values have very low probability in comparison with others states in histogram you provided. Since there is some level of noise, the probabilities are not zero for 000, 001 and 100.

+ +

Note that even the simulator on IBM Q generates some noise because of finite precision of the simulator.

+ +

Overall, there is no mistake.

+",9006,,9006,,4/23/2020 14:50,4/23/2020 14:50,,,,4,,,,CC BY-SA 4.0 +11662,2,,11650,4/23/2020 13:46,,0,,"

Following up on @Martin's suggestions, there might be a $\mathsf{BQP}$ algorithm to test for what you want, as long as you allow for your input circuit $U$ to be only ""close to"" a classical permutation matrix, that is, ""close to"" having a $1$ in each row/column.

+ +

For example, let $\vert x\rangle$, $\vert y\rangle$ be computational basis states, and let $\vert w\rangle$ be some monkey state (perhaps also in superposition).

+ +

We have $U\vert x\rangle=\alpha\vert y\rangle+\beta\vert w\rangle$. As long as $\alpha^2\gg\beta^2$ for each computational basis, we can choose random computational basis $\vert x\rangle$, apply $U\vert x\rangle$, and measure a small number of times.

+ +

If we always measure the same $y$ for the same input $\vert x\rangle$, and never $w$, then we can conclude, at least for that basis state $\vert x\rangle$, that $\alpha^2\gg \beta^2$; that is, the $x$ row of $U$ has a single $1$ at the $y$ column.

+ +

We can repeat to amplify, by choosing another basis state. I don't think we need to explore a lot of the $2^n$ states to get some confidence that $U$ is effectively a permutation matrix.

+ +

I think if you want to do a lot better than this, you might run against the BBBV-theorem, because you'd be looking for a tagged input (unless there are classical tests about the number of Hadamard's like described in the comments.)

+",2927,,,,,4/23/2020 13:46,,,,4,,,,CC BY-SA 4.0 +11663,1,11665,,4/23/2020 14:09,,3,2539,"

According to paper Ising formulations of many NP problems an unconstrained quadratic programming problem +$$ +f(x_1, x_2,\dots, x_n) = \sum_{i}^N h_ix_i + \sum_{i < j} J_ix_ix_j +$$ +can be expressed as Hamiltonian +$$ +H(x_1, x_2,\dots, x_n) = -\sum_{i}^N h_i\sigma^z_i - \sum_{i < j} J_i\sigma^z_i\sigma^z_j, +$$ +where $\sigma^z_i$ is Pauli $Z$ gate applied on $i$th qubit whereas other qubits are left without change.

+ +

I tried to prepare Hamiltonian for simple function +$$ +f(x_1,x_2) = 5x_1+x_2-2x_1x_2 +$$

+ +

as +$$ +H = -(5 Z \otimes I + I \otimes Z - 2 Z \otimes Z) = \text{diag}(-4,-6,2,8). +$$

+ +

So the minimal eigenvalue is -6 and associated ground state is $|01\rangle = (0, 1, 0, 0)^T$ which is correct as $f(x_1,x_2)$ minimal value is 1 for $x_1 = 0$ and $x_2 = 1$.

+ +

However, when I changed $-2x_1x_2$ to $-7x_1x_2$ and the Hamiltonian changed to $\text{diag}(1,-11,-3,13)$, the ground state remainded $|01\rangle$, however, in this case the function has minimum in $x_1 = 1$ and $x_2 = 1$ (i.e. the ground state should be $|11\rangle = (0,0,0,1)^T$).

+ +

What did I do (or understand) wrong?

+",9006,,6253,,4/23/2020 17:55,10/15/2020 11:26,How to convert QUBO problem to Ising Hamiltonian?,,1,3,,,,CC BY-SA 4.0 +11664,2,,11645,4/23/2020 16:05,,2,,"

It's my understanding that in Google's quantum computational supremacy experiment, they have executed exactly the same random circuit up to 1M times, e.g up to 1M instances. They must perform that many experiments in order to have a chance of proving that they would have executed the experiment perfectly, at least (greater than or equal to) the fidelity to which they quote.

+ +

Furthermore it's my understanding that the circuit is chosen randomly because they wish to show to the world that they do not have a potential back-door, which would enable them rapid simulation.

+ +

For example, I think of their random single-qubit gates as akin to 'nothing-up-my-sleeve numbers'. These are numbers used in cryptographic protocols to indicate that the protocols are unlikely to have been designed with a nefarious purpose.

+ +

If, instead of random single-qubit gates, they had applied a pattern as you suggest, then the world might be able to allege that they designed their pattern to precisely enable efficient simulation.

+",2927,,2927,,4/24/2020 0:05,4/24/2020 0:05,,,,0,,,,CC BY-SA 4.0 +11665,2,,11663,4/23/2020 16:12,,5,,"

Maybe this will help. Let's take a simple case:

+

$$f(x_1, x_2) = -2x_1 x_2$$

+

Then it is minimum when $x_1 = x_2 = 1$. Now let's take this Hamiltonian:

+

$$H_f = -2Z \otimes Z$$

+

The Hamiltonian is minimum when we have either $|00\rangle$ or $|11\rangle$ states. So this Hamiltonian doesn't correspond to the $f(x_1, x_2)$. Instead this one looks better:

+

$$H_f = -2 \left(\frac{I - Z}{2}\right) \otimes \left(\frac{ I - Z}{2}\right)$$

+

Because in this case, $f(x_1, x_2)$ is equal to the $H_f$'s eigenvalue for the $|x_1 x_2\rangle$ eigenstate. And, consequently, if $x_1$ and $x_2$ correspond to the minimum value of $f(x_1, x_2)$, then $|x_1 x_2\rangle$ will be the eigenstate with the minimum eigenvalue for $H_f$. This is right, because the operator $\frac{I - Z}{2}$ has $|x=0 \rangle$ and $|x=1 \rangle$ eigenstates with corresponding $0$ and $1$ eigenvalues.

+

So, for the $f(x_1, x_2) = 5 x_1 + x_2 - 2 x_1 x_2$ we can introduce the following Hamiltonian:

+

\begin{equation} +H_f = 5 \frac{I - Z}{2} \otimes I + I \otimes \frac{I - Z}{2} - 2 \frac{I - Z}{2} \otimes \frac{I - Z}{2} = \\ +=\frac{5}{2} I \otimes I - 2 Z \otimes I - \frac{1}{2} Z \otimes Z = +\text{diag}(0, 1, 5, 4) +\end{equation}

+

Note that $H_f|x_1 x_2\rangle = f(x_1, x_2) |x_1 x_2\rangle$. For optimization problems we can ignore $\frac{5}{2}I \otimes I$ term. In that case all eigenvalues will be shifted with the same $-\frac{5}{2}$ value. With or without $\frac{5}{2}I \otimes I$ term the eigenstates with minimum or maximum eigenvalues will stay at the same "places".

+
+

This procedure will also work for more general cost functions $f(x)$ (not necessarily QUBO $\rightarrow$ Ising Hamiltonian). Here is an answer about this.

+",9459,,9459,,10/15/2020 11:26,10/15/2020 11:26,,,,4,,,,CC BY-SA 4.0 +11666,2,,11617,4/23/2020 16:47,,4,,"

All quantum circuits can be simulated on a classical computer, but not all circuits take the same amount of time to simulate. If information about the circuit is known in advance, certain patterns may be exploited to significantly reduce time or memory consumption. The hardest type of circuit to simulate is one in which all qubits are entangled and there is no observable pattern in the applied gates to use a shortcut.

+ +

However, there are also limitations on the circuit for the quantum computer as well. Current quantum processors are noisy so: the smaller the depth, the more accurate the quantum processor is. Small errors can accumulate with each gate applied which could lead to a totally wrong answer at the end.

+ +

So to have a classical simulation compete with a quantum computer, the ideal circuit is highly entangled, contains no patterns, and has a small depth. This is why they used the circuit architecture discussed near Fig. 3 in the paper.

+ +

Every circuit has a probability distribution which it creates. Quantum computers approximate this distribution by running the same circuit many times and recording the output of each run. Google ran their circuits $5\times10^6$ times to get a close enough estimation of the distribution. Classical computers only need to simulate the circuit once since they don't collapse when measured like quantum computers.

+ +

The pseudorandom generator actually has to do with something else: experiment repeatability. If you handcraft the ideal circuit and want to run the experiment again, you'll need to create a new one by hand. So for every instance of the experiment, they generated a new circuit using a different seed for the pseudorandom generator which produces a different probability distribution.

+ +

A high level overview of the experiment looks like this:

+ +
for seed in numInstances:
+    circuit = generateCircuit(seed)
+    qDist = quantumExecution(circuit)
+    cDist = classicalSimulation(circuit)
+
+ +

If qDist $\approx$ cDist then the quantum processor is accurate. For any instance of the experiment, if the quantum processor was faster than the classical simulation then quantum supremacy is declared.

+ +

As for the actual code used in the simulation, to my knowledge Google has yet to publish it. They have mentioned in the paper that they used a Schrödinger algorithm to simulate lower qubit counts and a Schrödinger/Feynman hybrid for the experiments of 43 qubits and higher because it does not used as much memory.

+",11769,,,,,4/23/2020 16:47,,,,0,,,,CC BY-SA 4.0 +11667,1,11671,,4/23/2020 19:42,,3,188,"

I am reading the chapter about phase kickback from ""An Introduction to Quantum Computing"" by Kaye, Laflamme, Mosca. I understand why $U_f :|x \rangle |-\rangle \rightarrow (-1)^{f(x)} |x\rangle |-\rangle$ is correct. But then it is written that $U_f$ can be thought as a 1-qubit operator $\hat{U}_{f(x)}$ acting on the second qubit controlled by the state $|x\rangle$. I don't get why this is true and why the circuits below are equivalent.

+ +

+ +

For instance if $f(0)=1$, then $U_f:|0\rangle|-\rangle \rightarrow - |0\rangle |-\rangle$, but this is not the case for the circuit given on the right since if $|x\rangle=0$, no operation is applied on the second register.

+ +

Can someone show me what I am missing?

+",7986,,,,,4/24/2020 7:42,Phase Kickback and Controlled Operations,,1,0,,,,CC BY-SA 4.0 +11668,2,,11409,4/23/2020 20:36,,1,,"

This article purpose a method to encode a list in quantum circuit.

+ +

An example for the list : [1, 3, 0, 2] and the Grover search, where is 0 ? +

+ +

And the result : index 2 +

+",10192,,,,,4/23/2020 20:36,,,,0,,,,CC BY-SA 4.0 +11670,1,11681,,4/24/2020 1:23,,1,199,"

Given any initial condition or value A, A leads to B after a procedure of physics or nature P. Now is there any turing machine or quantum computer that can simulates P,converting A into B? In other word, is any cause-effect relation in nature computable?

+",9402,,55,,10/22/2020 10:50,10/22/2020 10:50,Can every process in nature be simulated by a Turing Machine or a quantum computer?,,1,3,,,,CC BY-SA 4.0 +11671,2,,11667,4/24/2020 7:42,,1,,"

Without a bit more context of how they use the notation in the rest of the book, I'm not certain, but the way I would interpret that is saying ""if the control qubit is 0, apply unitary $\hat U_{f(0)}$ on the target. if the control qubit is 1, apply $\hat U_{f(1)}$ on the target"".

+ +

If this is to be the case, let's see what the action is supposed to be. As you say, +$$ +|x\rangle|-\rangle\rightarrow (-1)^{f(x)}|x\rangle|-\rangle. +$$ +You also have to check the action on the other basis state, +$$ +|x\rangle|+\rangle\rightarrow|x\rangle|+\rangle. +$$ +So, to summarise, if $x$ is 0, the unitary on the second qubit is +$$ +|+\rangle\langle +|+(-1)^{f(0)}|-\rangle\langle -|. +$$ +If $x$ is 1, the unitary on the second qubit is +$$ +|+\rangle\langle +|+(-1)^{f(1)}|-\rangle\langle -|. +$$ +So, if we defined $U_y$ as +$$ +\hat U_y=|+\rangle\langle +|+(-1)^{y}|-\rangle\langle -|, +$$ +then this would be consistent with my statement.

+",1837,,,,,4/24/2020 7:42,,,,2,,,,CC BY-SA 4.0 +11672,1,11753,,4/24/2020 10:12,,2,116,"

I have an issue, perhaps with normalization with the following state. For $\alpha^2 + \beta^2 =1 $, the probabilities in this state does not sum up to 1.

+ +

$$|\psi\rangle := \frac{1}{2}\left[\alpha\left(|0\rangle(|x\rangle+|x'\rangle\right) + \beta \left(|1\rangle(|x\rangle-|x'\rangle \right)\right] $$

+ +

as $p(0)=\frac{2\alpha^2+2\alpha^2\langle x|x'\rangle}{4}=\alpha^2(\frac{1+\langle x|x'\rangle}{2})$ and $p(1)=\frac{2\beta^2 - 2\beta^2\langle x | x'\rangle}{4} = \beta^2\frac{1-\langle x | x'\rangle}{2}$.

+ +

And $p(0)+p(1) = \frac{\alpha^2 + \beta^2 + \alpha^2\langle x| x'\rangle- \beta^2\langle x | x'\rangle }{2} = \frac{1 + (\alpha^2 - \beta^2) \langle x | x'\rangle}{2}$

+ +

Long version:

+ +

I created the state as follows:

+ +
    +
  • $|0\rangle |0\rangle$
  • +
  • Hadamard on first qubit $\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)|0\rangle$
  • +
  • Controlled operations: if 0 on first register I create state $|x\rangle$ otherwise I create state $|x'\rangle$ on second qubit. $\frac{1}{\sqrt{2}}(|0\rangle|x\rangle+|1\rangle|x'\rangle)$

  • +
  • Now a perform a second Hadamard gate and re-group the terms:

  • +
+ +

$$ \frac{1}{2}\left[\left(|0\rangle(|x\rangle+|x'\rangle\right) + \left(|1\rangle(|x\rangle-|x'\rangle \right)\right] $$

+ +
    +
  • Now I am ready to do a rotation on the $Y$-axis of $\alpha$ on the first qubit. This leads to: +$$ \frac{1}{2}\left[\alpha\left(|0\rangle(|x\rangle+|x'\rangle\right) + \beta \left(|1\rangle(|x\rangle-|x'\rangle \right)\right] $$
  • +
+ +

Perhaps I am doing something wrong with the normalization? But I don't need any normalization factor as $\alpha^2+\beta^2=1$

+ +

Thank you.

+",10062,,9006,,4/24/2020 11:02,4/29/2020 18:59,Probabilities does not sum up to 1 in simple circuit,,1,1,,,,CC BY-SA 4.0 +11673,1,,,4/24/2020 16:18,,4,306,"

+ +

I am seeking help to identify the oracle gates listed in this example. I understand that the right-most one is a toffoli gate, but what are the other ones? Specifically, I do not understand what a black versus white circle means for gate representation. This example comes from Nielsen and Chuang page 256

+",11805,,,,,4/24/2020 18:33,Help Identifying a Gate In Nielsen and Chuang,,1,0,,,,CC BY-SA 4.0 +11674,2,,11673,4/24/2020 16:58,,6,,"

Here are the corresponding decompositions of each gate with use of Toffoli and $X$ gates:

+ +

+ +

The first one applies $X$ gate on the third qubit if control qubits are in the $|00\rangle$ state. The second one applies $X$ gate on the third qubit if control qubits are in the $|01\rangle$ state. The third one applies $X$ gate on the third qubit if control qubits are in the $|10\rangle$ state. The fourth one is the Toffoli gate that applies $X$ gate if control qubits are in the $|11\rangle$ state. In all other cases, they do nothing. The black (white) circle means that the corresponding qubit should be $|1\rangle$ $(|0\rangle)$ to satisfy the condition of the gate. Multiple circles are for multiple conditions on the control qubits.

+ +

For more info look at Figure 4.11 and 4.12 and corresponding descriptions in the same book.

+",9459,,9459,,4/24/2020 18:33,4/24/2020 18:33,,,,0,,,,CC BY-SA 4.0 +11675,1,,,4/24/2020 20:40,,0,112,"

Can someone help me with the following question?

+ +
+

Let $M$ be a general operator on the composite system $\mathcal{H}_A\otimes \mathcal{H}_B$ and let $O_A$ be an operator on $\mathcal{H}_A$. Using the definition of a partial trace that was given in class, together with the properties of the full trace, prove that $Tr_B(O_AM) = O_ATr_B(M)$.

+
+ +

I got stuck here:

+ +

$$M = \sum\limits_{\alpha}M^{(A)}_{\alpha}\otimes M^{(B)}_{\alpha}; O_AM = (O\otimes\mathbb{1}_B)M = \sum\limits_{\alpha}OM_\alpha^{(A)}\otimes M_\alpha^{(B)}\rightarrow$$ +$$Tr_B(O_AM) = Tr_B\left(\sum\limits_{\alpha} OM_\alpha^{(A)}\otimes M_\alpha^{(B)}\right)=\sum\limits_\alpha Tr_B\left(OM_\alpha^{(A)}\otimes M_\alpha^{(B)}\right)$$$$=\sum\limits_\alpha OM_\alpha^{(A)}Tr\left(M_\alpha^{(B)}\right)$$

+ +
+ +

Editor's note: the $\mathbb{1}_B$ actually looked more like $\mathbb{R}$ except with a 1; however, I couldn't get the font to work properly in mathjax. Apologies.

+",11808,,55,,10/22/2020 10:50,10/22/2020 10:50,Prove that $\operatorname{Tr}_B(O_A M)=O_A\operatorname{Tr}_B(M)$,,2,1,,,,CC BY-SA 4.0 +11676,1,,,4/24/2020 22:27,,5,179,"

Background

+ +

Shannon's source coding theorem tells us the following. We shall consider a binary alphabet for simplicity. Suppose Alice has $n$ independent and identically distributed instances of a random variable $X\in \{0, 1\}$. Let us call this string $M$. There exists an encoding scheme that allows her to compress this into $m = H(X)$ bits, where $H(X)$ is the Shannon entropy, such that she can later decode it to some $\tilde{M}$. The error she makes will vanish as $n\rightarrow \infty$ i.e. in that limit $\tilde{M} = M$.

+ +

Schumacher compresssion is the correct quantum analogue of this. We shall consider qubits for simplicity. Suppose Alice has $n$ independent copies of some qubit state $\rho$ i.e. she holds $\rho^{\otimes n}$. There exists an encoding scheme that allows her to compress these registers into $m = S(\rho)$ qubits, where $S(\rho)$ is the von Neumann entropy, such that she can later decode it to $\tilde{\rho}^n$. As $n\rightarrow\infty$, the error will vanish and $\tilde{\rho}^n = \rho^{\otimes n}$.

+ +

The quantum case is interesting because $\rho^{\otimes n}$ may be entangled with some inaccessible system $R$. The encoding and decoding scheme should work such that these correlations are preserved.

+ +

Question: What does the encoded state look like?

+ +

In the classical case, the encoded string is necessarily a uniformly randomly chosen $m$ bit string. Were this not the case, Alice could compress it further. What is the correct analogue of this result for the quantum case? What we know is that this state must still retain correlations with the inaccessible register $R$ and must have von Neumann entropy of exactly $m$ bits.

+ +

My guess

+ +
    +
  1. Is it a uniformly random $m$ qubit pure state? Since the state has to maintain entanglement with $R$ in general, this cannot be the answer.
  2. +
  3. A uniformly randomly chosen $m$ qubit mixed state? This seems more plausible and the set of choices depends on how much entanglement the input state $\rho$ shares with $R$.
  4. +
+",4831,,4831,,4/24/2020 23:34,4/24/2020 23:34,Schumacher compression - comparing with Shannon compression,,0,0,,,,CC BY-SA 4.0 +11677,1,,,4/25/2020 1:17,,2,542,"

I am trying to compute the square root of the Y gate. +$$Y_\theta =\begin{pmatrix} +\cos\theta & -\sin\theta \\ +\sin\theta & \cos\theta +\end{pmatrix}$$

+ +

There are many ways for doing this. I am keen on just doing the good old diagonalization and taking the square root of the eigenvalues. I compute the determinant of $Y-\lambda I$ and I set it to zero, and I get: $(cos\theta-\lambda)^2 + sin^2\theta=0$. This cannot have solutions, as a square cannot be negative.

+ +

What am I doing wrong?

+",10062,,55,,4/27/2020 8:52,4/27/2020 8:52,How do I compute the square root of the $Y$ gate?,,1,1,,,,CC BY-SA 4.0 +11679,2,,11675,4/25/2020 7:14,,2,,"

Firstly, just because an operator $M$ is defined on a composite space, it does not mean that the operator itself has a tensor product structure. You need +$$ +M=\sum_{i,j,k,l}M_{ij,kl}|ij\rangle\langle kl| +$$ +Now let +$$ +O=\sum_{i,k}O_{i,k}|i\rangle\langle k|. +$$ +With these in place, you just calculate the two sides of the equation and see if they're the same. (In a strict mathematical sense, this is not the best way to present the answer, but it's the best way to start to understand it before working out a sequence so that you can start from the left-hand side and finally arrive at the right-hand side.)

+ +

So, I can work out the product +\begin{align*} +\Phi=(O\otimes I)M&=\left(\sum_{i,k}O_{i,k}|i\rangle\langle k|\otimes\sum_j|j\rangle\langle j|\right)\left(\sum_{j,k,l,m}M_{kj,ml}|kj\rangle\langle ml|\right) \\ +&=\left(\sum_{i,j,k}O_{i,k}|ij\rangle\langle kj|\right)\left(\sum_{j,k,l,m}M_{kj,ml}|kj\rangle\langle ml|\right) \\ +&=\sum_{i,j,k,l,m}O_{i,k}M_{kj,ml}|ij\rangle\langle ml|. +\end{align*} +Taking the partial trace of this, I get +$$ +\text{Tr}_B\Phi=\sum_{i,j,k,m}O_{i,k}M_{kj,mj}|i\rangle\langle m| +$$ +(basically summing over indices $j=l$).

+ +

Now, I need to compare this to +$$ +O\cdot\text{Tr}_B(M)=\left(\sum_{i,k}O_{i,k}|i\rangle\langle k|\right)\left(\sum_{j,k,m}M_{kj,mj}|k\rangle\langle m|\right)=\sum_{i,j,k,m}O_{i,k}M_{kj,mj}|i\rangle\langle m|, +$$ +so the two are the same.

+",1837,,1837,,4/27/2020 8:40,4/27/2020 8:40,,,,2,,,,CC BY-SA 4.0 +11680,2,,11677,4/25/2020 9:10,,5,,"

There are various ways of finding the square root of a gate. As the Pauli matrix $Y$ is self adjoing, we can use the Euler formula: +$$R_y(\theta) = e^{-i\frac{\theta}{2}Y} = \cos\frac{\theta}{2}I -i \sin\frac{\theta}{2}Y $$

+ +

Now is easy to see that $\sqrt{R_y(\theta)}$ is just $R_y(\theta/2)=e^{-i\frac{\theta}{4}Y} $. This gives +$$\sqrt{R_y(\theta)}=\begin{pmatrix} +\cos(\theta/4) & -\sin(\theta/4) \\ +\sin(\theta/4) & \cos(\theta/4) +\end{pmatrix}$$

+ +

It is simple to check (using various trigonometric identities) that this is the correct answer. To match the angles in the question, it suffices to take $\theta/2$ instead of $\theta$, i.e.:

+ +

$$\sqrt{R_Y(\theta)} =\begin{pmatrix} +\cos(\theta/2) & -\sin(\theta/2) \\ +\sin(\theta/2) & \cos(\theta/2) +\end{pmatrix}$$

+",1644,,9006,,4/25/2020 22:25,4/25/2020 22:25,,,,0,,,,CC BY-SA 4.0 +11681,2,,11670,4/25/2020 13:50,,5,,"

As far as we know, yes. This is essentially the Church-Turing thesis. Note that this is not a mathematical result, but more of a definition of what it means to be computable. You can find plenty of discussions about this around. A few notable examples are:

+ +
    +
  1. What would it mean to disprove Church-Turing thesis? (on cstheory)
  2. +
  3. Extended Church-Turing Thesis [and QC] (on cstheory)
  4. +
  5. Why do we believe the Church-Turing Thesis? (on math)
  6. +
  7. Can a Turing machine simulate a quantum computer? (here)
  8. +
+",55,,,,,4/25/2020 13:50,,,,6,,,,CC BY-SA 4.0 +11682,1,,,4/25/2020 14:50,,0,513,"

First a definition: Let there be a quantum like that consists of $2^n=N$ partitions each of size $n=\log_2 N$: $$|x_0\rangle|x_1\rangle\cdots|x_{n-1}\rangle = |x_0x_1\dots x_{n-1}\rangle $$

+ +

Like in most state preparation schemes I start from $|00\dots0\rangle|00\dots0\rangle\cdots|00\dots0\rangle$ (where every $00\dots0$ represents a binary with $n$ bits, and I don't say that I permute $0$'s, it's just my initial state!). Is there an efficient way to generate to following quantum state: +$$ +\sum_{\pi_k\in S_N} |\pi_k(x_0x_1\dots x_{n-1})\rangle, +$$ +where $\pi(x_0x_1\dots x_{n-1})$ are all possible $n!$ permutations of $n$ elements. The final state is permutationally invariant under all permutations, but I'm not sure if this can be used for the generation.

+ +

I prefer implementations without measurements and no ancilla.

+ +

Update: A worked out example, another one and an inefficient way

+ +

Starting from the $2$ qubit state $|00\rangle$ I'd like to end with $\frac1{\sqrt 2}(|01\rangle+|10\rangle)$, which is accomplished by the following circuit:

+ +

+ +

Everything unitary! Since it was addresed in on of the answers: What happens to $|10 \rangle$? It revertibly maps to $\frac1{\sqrt 2}(|01\rangle-|10\rangle)$.

+ +

Let's try with $n=4$:

+ +
    +
  1. Let's start again with $$|00\rangle|00\rangle|00\rangle|00\rangle$$
  2. +
  3. Create a superposition in the first register: +$$ +\frac1{\sqrt 4}(|00\rangle+|01\rangle+|10\rangle+|11\rangle)|00\rangle|00\rangle|00\rangle$$
  4. +
  5. Pick one, lets say $|11\rangle$. We need to split the second register in an equal superposition of 3 levels, but in a controlled way. So every unitary in the linked answer needs to be performed controlled by the first register, i.e. doubly controlled. There are four of these operations. Here is the circuit for register 1 and 2:
  6. +
+ +

+ +

where I condensed the controlled-split-into-3 gate into a easy-to-replicate block. The Toffoli's after the block take care of the fact that we need to split into varying sets of 3, according to the first register.

+ +

EDIT Since they only idle around, I ommitted the third and forth register (qubits 5 to 8) in this step.

+ +
    +
  1. Along the same line for the third register, where we apply $4\cdot3=12$ operations, which split the third register in 2 levels vontrolled by the first and second register.
  2. +
  3. Another $24$ operations for the forth register or maybe less because we can skip those who have to end on a $|0\rangle$, because it is already there...
  4. +
+ +

The final state I would get with this procedure, written in decimal basis is +$$\tiny +|3210\rangle+|2310\rangle+|3120\rangle+|1320\rangle+|2130\rangle+|1230\rangle+|3201\rangle+|2301\rangle+|3021\rangle+|0321\rangle+|2031\rangle+|0231\rangle+|3102\rangle+|1302\rangle+|3012\rangle+|0312\rangle+|1032\rangle+|0132\rangle+|2103\rangle+|1203\rangle+|2013\rangle+|0213\rangle+|1023\rangle+|0123\rangle +$$ +and in qubit representation: +$$\tiny +|11100100\rangle+|11100001\rangle+|11011000\rangle+|11010010\rangle+|11001001\rangle+|11000110\rangle+|10110100\rangle+|10110001\rangle+|10011100\rangle+|10010011\rangle+|10001101\rangle+|10000111\rangle+|01111000\rangle+|01110010\rangle+|01101100\rangle+|01100011\rangle+|01001110\rangle+|01001011\rangle+|00111001\rangle+|00110110\rangle+|00101101\rangle+|00100111\rangle+|00011110\rangle+|00011011\rangle +$$

+ +

This approach extends to an exponential number of multiply controlled operations. Does anyone know if there is a more efficient one?

+",5280,,5280,,4/28/2020 14:00,1/14/2023 17:49,Generate a quantum state that sums up all permutations of elements,,2,4,,,,CC BY-SA 4.0 +11683,2,,11682,4/25/2020 15:47,,2,,"

We start with the state $\vert x_1, x_2, ... x_n\rangle$ and wish to obtain the state $\frac{1}{\sqrt{n!}}\sum\limits_{k=1}^{n!}\hat{\pi}_k\vert x_1, x_2, ... x_n\rangle$.

+ +

First note that the operation is not a unitary operation. You cannot reverse it since the symmetrized state has lost information about the original $\vert x_1, x_2, ... x_n\rangle$. Therefore, the best you can achieve is the state +$$\frac{1}{\sqrt{n!}}\sum\limits_{k=1}^{n!}\vert k\rangle\otimes\hat{\pi}_k\vert x_1, x_2, ... x_n\rangle.$$

+ +

The general idea to achieve this is by introducing $\log(n!)$ auxilliary qubit registers and defining control swap gates. I do not know if Qiskit has an efficient way to do this.

+",5669,,5669,,4/25/2020 15:54,4/25/2020 15:54,,,,4,,,,CC BY-SA 4.0 +11685,2,,11682,4/25/2020 23:47,,2,,"

The operation as you have specified it is not reversible. For example, it would map $|a\rangle|b\rangle$ to the same state it maps $|b\rangle|a\rangle$ to. However, if you require that the list of input numbers is sorted and all elements are unique then it is possible and is explained in Improved Techniques for Preparing Eigenstates of Fermionic Hamiltonians by Berry et al.

+ +

The basic idea is to first produce a ""sorting magic state"" by sorting a list of 'random' integers using a reversible sorting network. Each integer in the list is initialized so that its qubits are a bunch of $|+\rangle$ states. After applying the sorting network to the integers, you will get as output the sorted list of integers and also ancillae related to how the comparisons played out within the sorting network. The ancillae are your magic state. To ensure the sorted list of integers is not entangled with this state, you measure it and confirm there are no duplicates in the list. If there are, restart the magic state preparation procedure.

+ +

Once you have your ""sorting magic state"", all you have to do is run the sorting network backwards. Except instead of feeding in the list of sorted integers that was used to produce the magic state, you instead feed in the sorted list of values you want to turn into a uniform superposition of all permutations in that list.

+",119,,9006,,4/26/2020 6:37,4/26/2020 6:37,,,,4,,,,CC BY-SA 4.0 +11686,1,,,4/26/2020 0:30,,1,195,"

I am quite new to Quantum Computing. If we have an input-state $|00⟩$. How could you transform it into the state $$\frac{1}{2}(|00⟩ + |01⟩ + |10⟩ + |11⟩)$$

+",8400,,10473,,5/16/2020 10:11,5/16/2020 10:11,How to transform $|00\rangle$ into $\frac{1}{2}(|00⟩ + |01⟩ + |10⟩ + |11⟩)$?,,1,0,,,,CC BY-SA 4.0 +11687,2,,11686,4/26/2020 1:52,,11,,"

Consider the state $\frac{1}{2}(|00⟩ + |01⟩ + |10⟩ + |11⟩)$. This admits a factorisation $$\begin{align*}\frac{1}{2}(|00⟩ + |01⟩ + |10⟩ + |11⟩)&=\frac12\{|0\rangle\otimes(|0\rangle+|1\rangle)+|1\rangle\otimes(|0\rangle+|1\rangle)\}\\&=\frac12\{(|0\rangle+|1\rangle)\otimes(|0\rangle+|1\rangle)\}\\&=\left(\frac{|0\rangle+|1\rangle}{\sqrt2}\right)\otimes \left(\frac{|0\rangle+|1\rangle}{\sqrt2}\right)\\&=H|0\rangle\otimes H|0\rangle\end{align*}$$ where $H$ is the Hadamard gate and $\otimes$ is the tensor product.

+ +

Thus all you have to do is apply parallel Hadamard gates to two copies of $|0\rangle$ and the resulting state is the one you desire.

+ +

More compactly $$H(|0\rangle)\otimes H(|0\rangle)=(H\otimes H)(|0\rangle\otimes|0\rangle)=H_2|00\rangle$$ where $$H_2=H \otimes H = \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} \otimes \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} = \frac{1}{2} \begin{bmatrix} 1 & 1 & 1 & 1 \\ 1 & -1 & 1 & -1 \\ 1 & 1 & -1 & -1 \\ 1 & -1 & -1 & 1 \end{bmatrix}$$

+",14,,14,,4/26/2020 2:01,4/26/2020 2:01,,,,2,,,,CC BY-SA 4.0 +11688,1,11689,,4/26/2020 5:15,,2,349,"

There have been a few other questions about this section of Nielsen and Chuang, but when working through the output of the circuit, there are some inconsistencies that are probably due to some mistep/false assumption of mine, and I can't seem to figure it out.

+ +
+

Suppose we have the Hamiltonian + $$ H = Z_1 ⊗ Z_2 ⊗ \cdots ⊗ Z_n,\tag{4.113}$$ + which acts on an $n$ qubit system. Despite this being an interaction involving all of the system, indeed, it can be simulated efficiently. What we desire is a simple quantum circuit which implements $e^{-iH\Delta t}$, for arbitrary values of $\Delta t$. A circuit doing precisely this, for $n = 3$, is shown in Figure 4.19. The main insight is that although the Hamiltonian involves all the qubits in the system, it does so in a classical manner: the phase shift applied to the system is $e^{-i\Delta t}$ if the parity of the $n$ qubits in the computational basis is even; otherwise, the phase shift should be $e^{i\Delta t}$. Thus, simple simulation of $H$ is possible by first classically computing the parity (storing the result in an ancilla qubit), then applying the appropriate phase shift conditioned on the parity, then uncomputing the parity (to erase the ancilla).

+ +

+
+ +

Considering the case of n=3, let's say we had $|\psi\rangle = a|000\rangle + b|110\rangle$. The above circuit is supposed to apply $e^{-iZ\otimes Z\otimes Z \Delta t}$ to the three qubits. Using what I've read on tensor products,

+ +

$$e^{-iZ\otimes Z\otimes Z t}|\psi\rangle = e^{Z\otimes Z\otimes (-iZ \Delta t)}(a|000\rangle + b|110\rangle)$$

+ +

$$= a(e^Z|0\rangle e^Z|0\rangle e^{-iZ \Delta t}|0\rangle)+b(e^Z|1\rangle e^Z|1\rangle e^{-iZ \Delta t}|0\rangle)$$

+ +

Using Taylor Series, I found that +$$e^Z|0\rangle = e|0\rangle$$ +$$e^Z|1\rangle = \frac{1}{e}|1\rangle$$ +$$e^{-iZ \Delta t}|0\rangle = e^{-i\Delta t}$$

+ +

$$e^{-iZ\otimes Z\otimes Z t}|\psi\rangle = a(e|0\rangle e|0\rangle e^{-i \Delta t}|0\rangle)+b(\frac{1}{e}|1\rangle \frac{1}{e}|1\rangle e^{-i \Delta t}|0\rangle)$$ +$$= ae^2e^{-i \Delta t}(|0\rangle |0\rangle |0\rangle)+b\frac{1}{e^2}e^{-i \Delta t}(|1\rangle |1\rangle |0\rangle) \tag{eq. 1}$$

+ +

Once I did this, I attempted to evaluate what the circuit above, presented in Nielsen and Chuang, does to the vector $|\psi\rangle$.

+ +

$$|\psi \rangle = (a|000\rangle + b|110\rangle)|0\rangle$$

+ +

Since both $|000\rangle$ and $|110\rangle$ are even, we apply $e^{-iZ\Delta t}$ to the aux 4th qubit, so we get:

+ +

$$|\psi \rangle = (a|000\rangle + b|110\rangle)e^{-iZ\Delta t}|0\rangle$$

+ +

And since we know that $e^{-iZ\Delta t}|0\rangle =e^{-i\Delta t}|0\rangle$

+ +

$$|\psi \rangle = (a|000\rangle + b|110\rangle)e^{-i\Delta t}|0\rangle$$ +$$= a(e^{-i\Delta t})(|000\rangle) + b(e^{-i\Delta t})(|110\rangle) \tag{eq. 2}$$

+ +

But this equation 2 isn't equivalent to equation 1! What exactly am I missing here? The output of the circuit isn't matching up with what happens when I actually put the state $|\psi\rangle$ through that transformation.

+",11644,,11644,,4/26/2020 18:00,4/26/2020 18:00,Question Regarding Simulating Hamiltonian With Quantum Circuit,,1,2,,,,CC BY-SA 4.0 +11689,2,,11688,4/26/2020 10:28,,5,,"

I think the problem is in this assumption:

+ +

$$e^{-i Z \otimes Z \otimes Z t} |110\rangle = e^{Z}|1\rangle e^{Z}|1\rangle e^{-iZt}|0\rangle$$

+ +

It shouldn't be right, because, at least, $e^{Z}$ is not a unitary transformation (normalization is changed).

+ +

Now let's try to find out the actual action of the operator. Note that in all calculations I have replaced $\Delta t$ with $t$.

+ +

From 4.2 exercise from M. Nielsen and I. Chuang textbook: Let $t$ be a real number and $A$ a matrix such that $A^2 = I$. Then

+ +

$$e^{i A t} = \cos(t) I + i \sin(t) A$$

+ +

So, by taking into account that $\left[Z \otimes Z\otimes Z\right]^2 = I $, the action of the operator on $|011\rangle$ will be:

+ +

\begin{equation*} +e^{-i Z \otimes Z \otimes Z t} |110\rangle = \left( \cos(t) I - i \sin( t) Z Z Z \right) |110\rangle = +\\ +=\cos( t) |110\rangle - i \sin(t) Z|1\rangle Z|1\rangle Z|0\rangle = +\\ += \cos(t) |110\rangle - i \sin(t) (-1)|1\rangle (-1)|1\rangle (+1)|0\rangle = +\\ += \left(\cos(t) - i \sin(t)\right) |110\rangle = e^{-i t}|110\rangle +\end{equation*}

+ +

So as one can see if in the bit string we have even a number of $1$s (parity), then the phase will be $e^{-it}$, otherwise, the phase multiplied to the corresponding bit string will be $e^{it}$.

+ +

The circuit presented in the question does parity check with CNOTs: if in the bit string we have an even number of $1$s the target (ancillary) qubit will be in $|0\rangle$ state and:

+ +

$$e^{-i Z t} |0\rangle |\text{even parity}\rangle = e^{-i t} |0\rangle |\text{even parity}\rangle$$

+ +

The second group of CNOTs will not change that state. Otherwise, if in the bit string we have an odd number of $1$s the target (ancillary) qubit will be in $|1\rangle$ state and:

+ +

$$e^{-i Z t} |1\rangle |\text{odd parity}\rangle = e^{i t} |1\rangle |\text{odd parity}\rangle $$

+ +

After the second group of CNOTs (uncomputing the changes in the target qubit) we will have:

+ +

$$e^{i t} |0\rangle |\text{odd parity}\rangle $$

+ +

So the circuit does what we want.

+",9459,,9459,,4/26/2020 12:34,4/26/2020 12:34,,,,2,,,,CC BY-SA 4.0 +11690,1,,,4/26/2020 11:18,,6,81,"

Given a graph $G$ and a set of marked vertices $M$, spatial search problem is the problem of finding a marked vertex. A classical approach is to perform a random walk on the graph to find out a marked vertex, for which the required time is the hitting time of the random walk.

+ +

For discrete time quantum walk, Krovi et al. [1] have proven that the hitting time is quadratically faster than the classical random walk when only 1 element is marked. For continous time quantum walks, a similar result is proven by Chakraborty et al. [2]. Recently, Ambainis et al. [3] have showed that for discrete time quantum walks, the speedup holds even when there are more than 1 marked vertices.

+ +

Are there any special types of graphs for which the spatial search problem can be solved with exponential speedup compared to classical algorithms?

+ +

For instance, for certain types of graphs like the hypercube, random walk spreads exponentially faster [4] but as detecting a marked vertex is not the same thing as finding the marked vertex in the quantum setting, I am not sure if this result implies an exponential speedup for finding a marked vertex.

+ +

[1] Krovi, H., Magniez, F., Ozols, M., & Roland, J. 2016. “Quantum walks can find a marked element on any graph”, Algorithmica, 74(2), 851-907.

+ +

[2] Chakraborty, S., Novo, L., & Roland, J. (2018). Finding a marked node on any graph by continuous-time quantum walk. arXiv preprint arXiv:1807.05957.

+ +

[3] Ambainis, Andris, et al. ""Quadratic speedup for finding marked vertices by quantum walks."" arXiv preprint arXiv:1903.07493 (2019).

+ +

[4] Kempe, Julia. ""Discrete quantum walks hit exponentially faster."" Probability theory and related fields 133.2 (2005): 215-235.

+",7986,,,,,4/26/2020 11:18,Speedup for spatial search problem using quantum walks,,0,2,,,,CC BY-SA 4.0 +11691,2,,11622,4/26/2020 13:00,,6,,"

I am sure that since you are asking this question you probably already understand this, but for future & other's reference let me give a quick recap of what we are trying to achieve.

+

Quantum channels

+

Any process (in an open quantum system) is some map $\Lambda$ from a space of density matrices to a space of density matrices. I write a, because these spaces are not necessarily of the same dimension (for instance, the tracing out a subsystem does not preserve dimension). Any unitary transformation is such a map as well.

+

We generally write $\Lambda(\rho_{\mathrm{in}}) = \rho_{\mathrm{out}}$ when our map transforms $\rho_{\mathrm{in}}$ to $\rho_{\mathrm{out}}$. Furthermore, since we always expect any $\rho_{\mathrm{out}}$ to be an actual physical state (it must be positive semidefinite and must have trace $1$), we impose two constraints on $\Lambda$.

+
    +
  1. Any map $\Lambda$ should be completely positive. This ensures that $\rho_{\mathrm{out}}$ is always positive semidefinite, even if it a subsystem of a larger whole. This constraint is often abbreviated as "CP".
  2. +
  3. Any map $\Lambda$ should be trace preserving: $\mathrm{tr}\big[\Lambda(\rho)\big] = \mathrm{tr}\big[\rho\big]$, $\forall\rho$. This ensures that $\rho_{\mathrm{out}}$ always has unit trace. We abbreviate this constraint as "TP".
  4. +
+

Any map $\Lambda$ that is both CP & TP = CPTP, we call a quantum channel. Sometimes we relax the TP constraint to include trace decreasing maps (consider for instance a measurement); some authors refer to these maps as the more general quantum operations.

+

Different representations of quantum channels

+

A quantum channel can be represented in different ways; I recap three here.

+
    +
  1. The Kraus representation. Nielsen & Chuang refer to this as the operator-sum representation. In mathematical form: +\begin{equation} +\Lambda(\rho) = \sum_{k} A_{k} \rho A_{k}^{\dagger}, +\end{equation} +where $\{A_{k}\}$ are known as the Kraus operators and $k$ is always the same or smaller than the system size $d = 4^{n}$. That is, for any valid map $\Lambda$ there can always be found a Kraus representation with at most $d$ operators. The CP constraint is automatically met here, the trace constraint reads: $\sum_{k} A_{k}^{\dagger} A_{k} \leq I$ (with equality for TP).
  2. +
  3. The Choi matrix, which is a direct result of the Choi-Jamiolkowski isomorphism. Some intuition on what this is can be found in this previous answer. Consider the maximally entangled state $|\Omega \rangle = \sum_{\mathrm{i}}|\mathrm{i}\rangle \otimes |\mathrm{i}\rangle$, where $\{|\mathrm{i}\rangle\}$ forms a basis for the space on which $\rho$ acts. (Note that we thus have a maximally entangled state of twice as many qubits). +The Choi matrix is the state that we get when on one of these subsystems $\Lambda$ is applied (leaving the other subsystem intact): +\begin{equation} +\rho_{\mathrm{Choi}} = \big(\Lambda \otimes I\big) |\Omega\rangle\langle\Omega|. +\end{equation} +As the Choi matrix is a state, it must be positive semidefinite (corresonding the the CP constraint) and must be unity trace (corresponding to the TP constraint).
  4. +
  5. The process- or $\chi$-matrix. We write our map as a double sum: +\begin{equation} +\Lambda(\rho) = \sum_{m,n} \chi_{mn}P_{m}\rho P_{n}^{\dagger}, +\end{equation} +where $\{P_{m}\}$ & $\{P_{n}\}$ form a basis for the space of density matrices$^{1}$; we use the Pauli basis $\{I,X,Y,Z\}^{\otimes n}$ (thereby omitting the need for the $\dagger$ at $P_{n}$). The matrix $\chi$ now encapsulates all information of $\Lambda$; the CP constraint reads that $\chi$ must be positive semidefinite, and the trace constraint reads that $\sum_{m,n}\chi_{mn}P_{n}P_{m} \leq I$ (with equality for TP).
  6. +
+

The goal for quantum process tomography is now to find a representation of an unknown channel $\Lambda$. We focus on the process matrix.

+

Standard QPT

+

Our goal is to find $\chi$ for an arbitrary quantum channel. We give ourselves only the power of inputting different input states $\rho_{\mathrm{in}}$, and measuring the output state $\rho_{\mathrm{out}}$ in different bases with measurement observables $\{M\}$.

+

We always measure in the Pauli basis, and using slight abusive notation we use the Pauli basis as input states as well$^{2}$. A measurement on $\rho_{out}$ in a basis denoted by $P_{j}$ with an input state $P_{i}$ then has expectation value $\lambda_{ij}$: +\begin{equation} +\begin{split} +\lambda_{ij} &= \mathrm{tr}\big[P_{j}\Lambda(P_{i})\big] \\ +&= \mathrm{tr}\big[P_{j}\sum_{mn}\chi_{mn}P_{m}P_{i}P_{n}\big] \\ +&= \sum_{mn}\chi_{mn} \mathrm{tr}\big[P_{j}P_{m}P_{i}P_{n}\big] \\ +&= \sum_{mn} A_{(ij,mn)} \chi_{mn}.\\ +\end{split} +\end{equation} +where $A_{(ij,mn)} = \mathrm{tr}\big[P_{j}P_{m}P_{i}P_{n}\big]$. If we now view all measurement outcomes $\{\lambda_{ij}\}$ as a vector $\overrightarrow{\lambda}$ and if we vectorize $\chi$ to $|\chi\rangle\rangle = \overrightarrow{\chi}$ we get a giant linear system of equations linking the measurement outcomes to the elements of $\chi$: +\begin{equation} +\overrightarrow{\lambda} = A \overrightarrow{\chi}. +\end{equation} +It is now our goal to solve for $\chi$.

+

Intermediary: some notes on the sets $\{P_{i}\}$ and $\{P_{j}\}$

+

The set of states from which we built $\{P_{i}\}$, known as the preparation set, needs to have (at first glance) every Pauli eigenstate for every qubit there is, resulting in $6^{n}$ different states. However, building all the Pauli matrices can be done by using any set of states that form a basis for the space of density matrices. A straightforward choice is to use $\{|0\rangle, |1\rangle, |+\rangle, |+i\rangle\}^{\otimes n}$ - both eigenstates of the $Z$ operator and the +1 eigenstates of the X and Y operator. This results in $4^{n}$ different input states.

+

The set of measurements from which we built all $\{P_{j}\}$ can be as simple as $\{X,Y,Z\}^{\otimes n}$; the "$I$"-measurements can be inferred from the outcomes of those measurements. I link a previous answer of mine on QST where I explain how to built all $\{P_{j}\}$'s from only these measurements; there I explain it in detail for $2$-qubit QST but the generalization to a higher number of qubits is very straightforward.

+

All in all, we thus need $4^{n} \times 3^{n} = 12^{n}$ different pairs of measurement operators and preparation states to perform QPT.

+

Solving for $\chi$

+

Solving for $\chi$ in our system of linear equations can be as straightforward as inverting $A$ ($A$ is indeed invertible). Moreover, by using the Pauli basis, $A$ is also unitary and even Hermitian so $\overrightarrow{\chi}$ is readily calculated as:

+

\begin{equation} +\overrightarrow{\chi} = A \overrightarrow{\lambda}. +\end{equation}

+

This, however, does not respect the CPTP constraints in any way. +Luckily, it can be shown that as long as all measurements that were performed had an actual outcome, the TP constraint on $\chi$ is automatically met when using this method. +However, the CP constraint is not automatically met; this means that the calculated $\chi$ might very well have negative eigenvalues. This stems from statistical noise on our estimates of $\lambda_{ij}$ which can be reduced by performing more repeated measurements. Note however that statistical noise will pretty much always persist (the statistical noise scales exponentially with the number of qubits considered in the QPT, so you need to repeat all measurements exponentially often to gain a constant fidelity. Methods to solve this problem are therefore needed.

+

A very straightforward but also less-then-ideal method of finding a positive semidefinite version of a non-CP $\chi$ is by taking a convex combination with the Identity process such that every eigenvalue of $\chi$ becomes non-negative. Let $\lambda_{\mathrm{min}} < 0$ be the smallest (largest negative) eigenvalue of $\chi$. Then the process matrix $\chi^{*}$ has only nonnegative eigenvalues: +\begin{equation} +\chi^{*} = \frac{1}{\mathrm{tr}[\chi]+2^{2n}|\lambda_{\mathrm{min}}|}\big(\chi + |\lambda_{\mathrm{min}}|I\big) +\end{equation} +The fraction before the sum is a renormalization constant. Of course there are other methods of bringing the eigenvalues to non-negative values, but those will most likely break the TP constraint (this method does in fact not).

+

(I would expect about 1-100 million repetitions per prepare-measure pair for $3$-qubit QPT will bring negative eigenvalues to something small enough for this method to give a okayish-fidelity. As I mentioned, QPT is hard.)

+

There exist more elaborate methods that I won't go into to much detail here. If you are familiar with semidefinite linear programming, solving the equation $\overrightarrow{\lambda} = A \overrightarrow{\chi}$ with $\chi$ subjected to our CPTP constraints is exactly a problem that can be optimized by this method. It should be noted that a proper optimization method will reduce the needed number of repeated measurements (often called shots) drastically when compared to the simple linear inversion mentioned above - I can therefore highly recommend optimalization in one way or another if you have a proper interest in QPT.

+

Another method can be found in this paper, where the authors make use of repeated projection onto the space of CP and TP maps, respectively. Proper proofs that this always converges to a proper minimum I have not yet seen, but I don't rule out the possibility either.

+

Another approach is to use the Choi-Jamiolkowski isomorphism, mentioned above regarding the Choi matrix. Here one would not optimize for a quantum channel, but for a quantum state (i.e. Quantum State Tomography). QST is much more popular and therefore many more optimization methods exist - I won't go into them here. It should be noted that this approach should be treated very carefully, as general quantum states do not always correspond to a proper quantum channel - which means that the optimization method used for the QST process outputs an estimate that is not a valid quantum channel.

+

Further reference or reading

+

My own MSc. thesis (Blatant self-promotion, please excuse me:)) can be found here, where I elaborate more on QPT in chapter 4. Chapter 3 might be a good read as an introduction to the terminology I use in chapter 4. +The text might be a bit convoluted at points but I feel that it introduces most of the basics. I have another text that I like better but I am not sure if I can distribute it; I will check. Furthermore, please feel free to ask me any subsequent questions.

+

Footnotes

+
    +
  1. Note that using a different basis does in fact transform the $\chi$ matrix. We almost always use the Pauli basis though. Also, note that the Paulis are, in fact, not density matrices - but they do form a basis for the space of Hermitian matrices, of which the density matrices are a subset.
  2. +
  3. Of course the Pauli operators are not valid density matrices since they are traceless, but using linearity we can combine the eigenstates of a Pauli operator to make that operator. If $\{|\psi_{+}\rangle\}$ & $\{|\psi_{-}\rangle\}$ are the $+1$- & $-1$ eigenstates of a Pauli operator $P$, we can combine them as such: +\begin{equation} +\Lambda(P) = \sum_{+}\Lambda(|\psi_{+}\rangle\langle \psi_{+}|) - \sum_{-}\Lambda(|\psi_{-}\rangle\langle \psi_{-}|). +\end{equation}
  4. +
+",8141,,8141,,5/3/2021 8:48,5/3/2021 8:48,,,,0,,,,CC BY-SA 4.0 +11692,1,11693,,4/26/2020 13:14,,2,411,"

+ +

The conventional CNOT gate is shown on the right, and the Qiskit version is on the left. Since Qiskit defines it has a flipped representation kindly explain what is happening to the 11 position?

+",8588,,5955,,4/26/2020 13:20,4/26/2020 17:02,Qiskit flipped representation of qubits in CNOT gate?,,1,0,,,,CC BY-SA 4.0 +11693,2,,11692,4/26/2020 14:07,,3,,"

It depends on which qubit is the control qubit. Depending on this we will have different matrix representations. Here is a code that may help to identify the ordering in Qiskit:

+ +
from qiskit import *
+simulator = Aer.get_backend('qasm_simulator')
+
+circuit_cx_01 = QuantumCircuit(2, 2)
+circuit_cx_10 = QuantumCircuit(2, 2)
+
+circuit_cx_01.x(0)
+circuit_cx_01.x(1)
+circuit_cx_01.cx(0, 1)
+circuit_cx_01.measure(0, 0)
+circuit_cx_01.measure(1, 1)
+
+circuit_cx_10.x(0)
+circuit_cx_10.x(1)
+circuit_cx_10.cx(1, 0)
+circuit_cx_10.measure(0, 0)
+circuit_cx_10.measure(1, 1)
+
+result_cx_01 = execute(circuit_cx_01, simulator, shots=1024).result().get_counts()
+result_cx_10 = execute(circuit_cx_10, simulator, shots=1024).result().get_counts()
+
+print(""After cx(0, 1) applied on '11' state \n{}"".format(result_cx_01))
+print(""\nAfter cx(1, 0) applied on '11' state \n{}"".format(result_cx_10))
+
+ +

The output is:

+ +
After cx(0, 1) applied on '11' state 
+{'01': 1024}
+
+After cx(1, 0) applied on '11' state 
+{'10': 1024}
+
+ +

where in the cx(i, j) the i qubit is the control qubit and j is the target qubit. From this, one can see that in Qiskit 0 index corresponds to the rightmost qubit.

+",9459,,9459,,4/26/2020 17:02,4/26/2020 17:02,,,,0,,,,CC BY-SA 4.0 +11694,2,,8850,4/26/2020 15:55,,0,,"

The Boolean oracle applies X gates to the three qubits. This way the state |000⟩ becomes |111⟩. Then the multi-CX gate flips the target qubit if the state is |000⟩, from which you then get |0001⟩, or |x,y,z,0⟩ otherwise.

+ +

The phase oracle flips the phase of your qubits. So when you apply the X gates on the three qubits, what you are doing is essentially getting the state |111⟩ if it was |000⟩, and then mark it by changing the sign in front to negative, so -|111⟩. Then when you add the X gates again, you change it to -|000⟩.

+ +

So basically the phase oracle applies a phase in order to mark your result, whereas a boolean oracle stores the result in an additional qubit, so the choice of gates depends on what you are trying to achieve. For algorithms like Grover's, phase oracles are generally used.

+",9633,,,,,4/26/2020 15:55,,,,0,,,,CC BY-SA 4.0 +11695,2,,11584,4/26/2020 18:31,,2,,"

I believe the issue you are missing is entanglement, which is an essential resource in quantum computing algorithms. Since we generate entanglement between these qubits, we can no longer think of independent subspaces of the Hilbert space where the final state can be represented as a tensor product of these subspaces. This is because an entangled state can't be represented as a tensor product of pure states. Therefore, once you have entanglement the idea of keeping track of only given subspaces and therefore a smaller number of complex numbers is not meaningful, you have to keep track of the entire entangled state.

+ +

You really can not do a lot of meaningful stuff without generating massive amounts of entanglement.

+",11828,,,,,4/26/2020 18:31,,,,0,,,,CC BY-SA 4.0 +11696,2,,11584,4/26/2020 21:03,,0,,"

Consider an $n$ qubit system. For each qubit you need to store 2 complex numbers, making $2n$ numbers in total. But if these qubits are entangled, then you can no longer store those numbers separetely. The overall system of $n$ qubits is represented by a vector of dimension $2^n$ and can not be written as the tensor product of individual vectors.

+",7986,,,,,4/26/2020 21:03,,,,0,,,,CC BY-SA 4.0 +15200,2,,4580,12/19/2020 22:14,,3,,"

For drawing in your browser, there is a demo of the Quantikz.jl package you can use:

+

+

Various programming languages have their own circuit drawing libraries as well. For latex code probably the best choice is Quantikz, and if you are programming in Julia you can create a diagram (png or latex code) with the Quantikz.jl library.

+",5601,,5601,,4/24/2021 19:10,4/24/2021 19:10,,,,0,,,,CC BY-SA 4.0 +15202,2,,15198,12/20/2020 0:20,,3,,"

The first condition is satisfied for example by unitaries of the form $U = e^{i\theta}I_A \otimes U_B$ where $I_A$ is identity on subsystem $A$, $U_B$ is any unitary on subsystem $B$ and the phase factor $e^{i\theta}$ is irrelevant.

+
+

Let us consider the second condition. It turns out that the condition cannot be guaranteed for all states $\sigma_{AB}$. More precisely, there are states $\sigma_{AB}$ such that for every unitary $U$ and every state $\omega_B$ of subsystem $B$ we have $U\sigma_{AB}U^* \ne \sigma_A \otimes \omega_B$. This is a consequence of two facts: that unitary transformations preserve eigenvalues of density matrices and that spectra (sets of eigenvalues) of generic density matrices cannot be reproduced by spectra of product states.

+

More formally, we can state the first fact by saying that for every unitary $U$, $\lambda$ is an eigenvalue of $\rho$ if and only if it is an eigenvalue of $U\rho U^*$.

+

In order to show the second fact, first note that the eigenvalues of an $n \times n$ density matrix lie in an $(n-1)$-simplex. Let $n_A = \dim \mathcal{H}$ and $n_B = \dim \mathcal{H}_B$. If $\lambda^A_i$ denotes the eigenvalues of $\sigma_A$ and $\lambda^B_j$ denotes the eigenvalues of $\omega_B$ then the eigenvalues of $\sigma_A \otimes \omega_B$ are the products $\lambda^{AB}_{ij} = \lambda^A_i \lambda^B_j$. Thus, the eigenvalues of $\sigma_A \otimes \omega_B$ lie in the Cartesian product of two simplices that can be described using $(n_A - 1) (n_B - 1)$ real parameters. On the other hand, the eigenvalues of an arbitrary joint density matrix on systems $A$ and $B$ lie in an $(n_An_B - 1)$-simplex. Thus, by a simple parameter counting argument we see that the set of spectra of product states is a measure zero subset of the spectra of arbitrary states.

+

For a concrete example, suppose that $A$ and $B$ are qubits and that $\sigma_{AB}$ has eigenvalues $0, \frac{1}{4}, \frac{1}{4}, \frac{1}{2}$. Note that there do not exist two sets of numbers $\{\lambda^A_1, \lambda^A_2\}$ and $\{\lambda^B_1, \lambda^B_2\}$ such that

+

$$ +\{\lambda^A_1\lambda^B_1, \lambda^A_1\lambda^B_2, \lambda^A_2\lambda^B_1, \lambda^A_2\lambda^B_2\} = \{0, \frac{1}{4}, \frac{1}{4}, \frac{1}{2}\}. +$$

+

Consequently, there is no unitary $U$ such that $U\sigma_{AB}U^* = \sigma_A \otimes \omega_B$.

+",10480,,10480,,12/20/2020 2:51,12/20/2020 2:51,,,,2,,,,CC BY-SA 4.0 +15203,1,15204,,12/20/2020 0:36,,3,163,"

Let's say you have a circuit that performs a Z-rotation in the first register, and a Y-rotation in second register. How can we express this "moment" in terms of a 4x4 matrix, i.e. a two-qubit gate? My end goal is to express the circuit below in terms of only tfq.util.get_supported_gates :

+
{cirq.X: 1,
+ cirq.XX: 2,
+ cirq.Y: 1,
+ cirq.YY: 2,
+ cirq.Z: 1,
+ cirq.ZZ: 2,
+ cirq.H: 1,
+ cirq.CZ: 2,
+ cirq.CNOT: 2,
+ cirq.SWAP: 2,
+ cirq.ISWAP: 2,
+ cirq.FSimGate(theta=0.123, phi=0.456): 2,
+ cirq.I: 1,
+ cirq.PhasedXPowGate(phase_exponent=0.123): 1,
+ cirq.PhasedISwapPowGate(phase_exponent=0.123): 2}
+
+

But I would like to start by understanding how I would represent just the first stacked Y- and Z-rotation in terms of a 4x4 matrix. For each moment, after I have the matrix representation, I plan to use cirq.two_qubit_matrix_to_operations to decompose this quasi-two-qubit operation into Z/XY/CZ gates.

+

+

Are either of these the correct representation for $Rz(\gamma)$ and $Ry(\theta)$ rotations in registers one and two respectively?

+

1. +$$ \begin{pmatrix} \cos{\theta} & -\sin{\theta} & 0 & 0 \\ \sin{\theta} & \cos{\theta} & 0 & 0 \\ 0 & 0 & e^{-i\gamma/2} & 0 \\ 0 & 0 & 0 & e^{i\gamma/2} \end{pmatrix} $$

+

2. +$$ \begin{pmatrix} e^{-i\gamma/2}\cos{\theta} & 0 & -e^{-i\gamma/2}\sin{\theta} & 0 \\ 0 & e^{i\gamma/2}\cos{\theta} & 0 & -e^{i\gamma/2}\sin{\theta} \\ e^{-i\gamma/2}\sin{\theta} & 0 & e^{-i\gamma/2}\cos{\theta} & 0 \\ 0 & e^{i\gamma/2}\sin{\theta} & 0 & e^{i\gamma/2}\cos{\theta} \end{pmatrix} $$

+",13991,,10480,,4/29/2021 20:41,4/29/2021 20:41,How do you represent one-qubit rotations in two registers as a $4\times 4$ unitary matrix?,,2,0,,,,CC BY-SA 4.0 +15204,2,,15203,12/20/2020 1:15,,5,,"

Note 100% sure if this is what you are asking but when you have a circuit like:

+

+

and you want to write it as a $4 \times 4$ Unitary matrix $U$ then you can do it as:

+

$ U = R_y(a[0]) \otimes R_z(a[1]) $

+

This can be generalized to any size as well. So if you have

+

+

then it can be written as an $8 \times 8$ matrix $U$ as $U = R_y(a[0]) \otimes R_z(a[1]) \otimes H $.

+
+

Note that if $ A = \begin{pmatrix} a_1 & a_2 \\ a_3 & a_4 \end{pmatrix}$ and $ B = \begin{pmatrix} b_1 & b_2 \\ b_3 & b_4 \end{pmatrix}$ then +$A \otimes B = \begin{pmatrix} a_1 \cdot B & a_2 \cdot B\\ a_3 \cdot B & a_4 \cdot B \end{pmatrix} $

+

Update: So to be explicit, we can see that:

+

\begin{align} + R_y(2\theta_1) \otimes R_z(2 \theta_2) &= \begin{pmatrix} \cos\theta_1 & -\sin\theta_1 \\ \sin\theta_1 & \cos\theta_1 \end{pmatrix} \otimes \begin{pmatrix} e^{-i \theta_2} & 0 \\ 0 & e^{i \theta_2} \end{pmatrix}\\ +&= \begin{pmatrix} \cos\theta_1 \begin{pmatrix} e^{-i \theta_2} & 0 \\ 0 & e^{i \theta_2} \end{pmatrix} & -\sin \theta_1 \begin{pmatrix} e^{-i \theta_2} & 0 \\ 0 & e^{i \theta_2} \end{pmatrix} \\ \sin \theta_1 \begin{pmatrix} e^{-i \theta_2} & 0 \\ 0 & e^{i \theta_2} \end{pmatrix} & \cos \theta_1 \begin{pmatrix} e^{-i \theta_2} & 0 \\ 0 & e^{i \theta_2} \end{pmatrix} \end{pmatrix}\\ +&= \begin{pmatrix} \cos\theta_1 e^{-i \theta_2} & 0 & -\sin \theta_1 e^{-i \theta_2} & 0\\ +0 & \cos \theta_1 e^{i \theta_2} & 0 & -\sin\theta_1 e^{i\theta_2}\\ +\sin\theta_1 e^{-i \theta_2} & 0 & \cos \theta_1 e^{-i \theta_2} & 0\\ +0 & \sin \theta_1 e^{i \theta_2} & 0 & \cos\theta_1 e^{i\theta_2}\\ + \end{pmatrix} +\end{align}

+

And if you don't want to do this by hand in the future, then you can do this operation pretty fast in python:

+
import numpy as np 
+import sympy as sym
+
+x1 = sym.Symbol('x1')
+x2 = sym.Symbol('x2')
+i = sym.Symbol('i')
+
+Ry = [[sym.cos(x1), -sym.sin(x1)], [sym.sin(x1),sym.cos(x1)]] 
+Rz = [[sym.exp(-i*x2),0], [0,sym.exp(i*x2)]]
+U = np.kron(Ry,Rz)
+print(U) 
+
+",9858,,9858,,12/20/2020 3:30,12/20/2020 3:30,,,,2,,,,CC BY-SA 4.0 +15205,1,15207,,12/20/2020 3:41,,2,88,"

Given two $d$-dimensional states $QFT|i\rangle(i\in\{0,1,2,...,d-1\})$ and $|\varphi\rangle=|0\rangle$. If I perform $CNOT(QFT|i\rangle,|\varphi\rangle)$, and then perform $QFT^{-1}|\varphi\rangle$, can I get $i$ with measurement on$|\varphi\rangle$ in base $\{|0\rangle,|1\rangle,\ldots,|d-1\rangle\}$?

+",11523,,55,,12/21/2020 23:48,12/21/2020 23:48,A simple question about QFT and CNOT,,1,3,,,,CC BY-SA 4.0 +15206,2,,15170,12/20/2020 3:46,,1,,"

This is really weird and it is probably a bug within the IBM Quantum Experience Circuit Composer.

+

So if you change the gate angle like what you did, by clicking on the gate and change the parameter there directly then it definitely disappeared from the circuit:

+

+
+
+
+

But if you changed the parameters from the QASM Code Editor then the gates DO NOT disappeared:

+

+",9858,,,,,12/20/2020 3:46,,,,0,,,,CC BY-SA 4.0 +15207,2,,15205,12/20/2020 6:03,,2,,"

Yes, with probability $\frac{1}{d}$.

+

Begin by computing the output state

+

$$ +\begin{align} +|\psi\rangle &= (I\otimes QFT^{-1} \circ CNOT \circ QFT \otimes I)|i\rangle|0\rangle \\ +&= (I\otimes QFT^{-1} \circ CNOT)\frac{1}{\sqrt{d}}\sum_{j=0}^{d-1}\omega^{ij}|j\rangle|0\rangle \\ +&= \frac{1}{\sqrt{d}}\sum_{j=0}^{d-1}\omega^{ij} (I\otimes QFT^{-1} \circ CNOT)|j\rangle|0\rangle \\ +&= \frac{1}{\sqrt{d}}\sum_{j=0}^{d-1}\omega^{ij} I\otimes QFT^{-1}|j\rangle|j\rangle \\ +&= \frac{1}{\sqrt{d}}\sum_{j=0}^{d-1}\omega^{ij} |j\rangle \frac{1}{\sqrt{d}}\sum_{k=0}^{d-1}\omega^{-jk}|k\rangle \\ +&= \frac{1}{d}\sum_{j,k=0}^{d-1}\omega^{(i-k)j} |j\rangle|k\rangle +\end{align} +$$

+

where $\omega = e^{2\pi i/d}$. The probability of obtaining result $|l\rangle$ when measuring the second register in the computational basis is

+

$$ +\begin{align} +P_l &= \langle\psi|l\rangle\langle l|\psi\rangle \\ +&= \frac{1}{d^2}\sum_{j',k'=0}^{d-1}\sum_{j,k=0}^{d-1}\omega^{(k'-i)j'}\omega^{(i-k)j} \langle j'|j\rangle\langle k'|l\rangle \langle l|k\rangle \\ +&= \frac{1}{d^2}\sum_{j',k'=0}^{d-1}\sum_{j,k=0}^{d-1}\omega^{(k'-i)j'}\omega^{(i-k)j} \delta_{jj'}\delta_{k'l}\delta_{lk} \\ +&= \frac{1}{d^2}\sum_{j=0}^{d-1}\omega^{(l-i)j}\omega^{(i-l)j} \\ +&= \frac{1}{d}. +\end{align} +$$

+
+

I suppose it may be interesting to consider why we did not obtain $|i\rangle$ with probability 1 as we would have if we had applied $QFT$ and $QFT^{-1}$ on the same register. In the latter case (without $CNOT$), we recover $|i\rangle$ because of interference (constructive on $|i\rangle$ and destructive on $|j\rangle$ for $j \ne i$). However, interference is prevented in the present case (with $CNOT$) by entanglement. Specifically, as the calculation shows, entanglement introduced by the $CNOT$ gate causes different phase factors to land on different kets and therefore prevents their interference.

+",10480,,10480,,12/20/2020 6:34,12/20/2020 6:34,,,,0,,,,CC BY-SA 4.0 +15208,1,15213,,12/20/2020 10:54,,5,111,"

Before the start of a quantum algorithm qubits need to be initialized into a quantum register. How fast can a quantum register of length $n$ be initialized in a way that all possible superpositions of the $N=2^n$ basis states exist with equal amplitudes.

+

I ask because I want to find out if there's a standard procedure to put a quantum register in an equal superposition of all possible states simultaneously. I imagine if there isn't a way to do this at once then it would take much longer to prepare say a quantum register of $N=2^{1024}$ basis states than that with $N=2^{256}$ basis states in an equal superposition.

+",8605,,9006,,12/20/2020 13:41,12/21/2020 17:14,"How instantaneous is state preparation in a quantum register, if all possible superpositions are to be initialized equally?",,2,0,,,,CC BY-SA 4.0 +15209,2,,15179,12/20/2020 12:20,,1,,"

I had to exchange len(qr_state) with num_uncertainty_qubits in the code you posted

+
    # in run_ae_for_cdf
+    ae_var = IterativeAmplitudeEstimation(state_preparation=state_preparation,
+                                          epsilon=epsilon, alpha=alpha,
+                                          objective_qubits=[num_uncertainty_qubits])
+
+

but then for me it seems to work just fine.

+

The output is

+
# executing your script with python -i and then:
+>>> run_ae_for_cdf(1)
+0.03904972139433151
+>>> run_ae_for_cdf(3)
+0.35743729093195115
+>>> run_ae_for_cdf(6)
+0.8437041835749457
+>>> run_ae_for_cdf(70)
+0.9999743710958622
+
+

You have 3 qubits in your system so the largest integer you can represent is 7 ($ = 2^3 - 1$) so for values $\geq 8$ the CDF should be 1. That's because the CDF $F(x)$ is the probability of measuring a state smaller than $x$: +$$ +F(x) = \mathrm{Pr}(\text{measure any state } |i\rangle \text{ with } i \leq x) +$$ +Since $i$ can reach 7 at most, we should see +$$ +F(x) = \begin{cases} \text{some increasing function, if } x \leq 7 \\ +1 \text{, if } x > 7 +\end{cases} +$$

+

With your code you can generate the following plot

+
>>> from matplotlib import pyplot as plt
+>>> i = list(range(20))
+>>> f = [run_ae_for_cdf(val) for val in i]
+>>> plt.axhline(1, color="k", linestyle="-")  # the max we reach
+>>> plt.axvline(8, color="k", linestyle=":")  # from here on it should be 1
+>>> plt.xlabel("x")
+>>> plt.ylabel("CDF, $F(x)$")
+>>> plt.show()
+
+

which seems to meet what we expected.

+

+",9800,,,,,12/20/2020 12:20,,,,1,,,,CC BY-SA 4.0 +15210,1,,,12/20/2020 12:22,,3,156,"

We know that the noise of the $\text{CNOT}$ gate varies depending on the input state before it.

+

What are the gates that I can put in the place of the 4 identity gates above to change the input state that goes to $\text{CNOT}$? +For example, if I just place a Hadamard gate then $|+\rangle$ state is the input to $\text{CNOT}$ and this might be noisier than other states. What are the possible gates that I can put before $\text{CNOT}$ to vary the input state? +I know that $S$, $T$, $S^\dagger$, $T^\dagger$, $X$, $Y$, and $Z$ gates do not change the $|+\rangle$ state if I put them. and if I use a general u3 gate then Qiskit divides it into multiple gate operations and that can be even noisier to start with.

+",12967,,1859,,12/20/2020 19:19,1/13/2023 22:00,What are the possible gates that I can use to vary input states before CNOT?,,1,1,,,,CC BY-SA 4.0 +15211,2,,15208,12/20/2020 13:41,,4,,"

You can prepare equal superposition by application of Hadamard gate on each qubit. The result will be state +$$ +|q\rangle=\frac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n}|i\rangle, +$$ +i.e. the desired equally distributed superposition.

+

As Hadamard gate belongs to Clifford group, it acts quickly. It can be even simulated on classical computer in polynomial time. But the actual duration of Hadamard gate depends on particular physical realization of a quantum processor. Also the instantaneous depends on physical properties of a quantum processor.

+

But overall, preparation of equal superposition is quick in comparison with preparation of general state in which case you generally need non-Clifford gates and depth of a preparation circuit increases exponentially in number of qubits.

+",9006,,,,,12/20/2020 13:41,,,,0,,,,CC BY-SA 4.0 +15212,1,15215,,12/20/2020 15:33,,3,138,"

I am trying to trace out the second qubit of the Werner State: +\begin{align} +W &=\frac{1-s}{4}I_{4}+\frac{s}{2}(|00\rangle\langle{00}|+|11\rangle\langle11|+|11\rangle \langle00|+|00\rangle \langle 11|)\\[0.5em]&= +\left( +\begin{array}{cccc} + (1+s)/4 & 0 & 0 & s/2 \\ + 0 & (1-s)/4 & 0 & 0 \\ + 0 & 0 & (1-s)/4 & 0 \\ + s/2 & 0 & 0 & (1+s)/4 \\ +\end{array} +\right) +\end{align}

+

I write down $I_{4}=|11\rangle \langle11|+|00\rangle \langle00|+|10\rangle \langle10|+|01\rangle \langle01|$ and the result is: +\begin{align} +W&=\frac{1+s}{4}|0\rangle \langle0|\otimes|0\rangle \langle0|+\frac{1+s}{4}|1\rangle \langle1|\otimes|1\rangle \langle1|\\ &+\frac{1-s}{4}|0\rangle \langle0|\otimes|1\rangle \langle1|+\frac{1-s}{4}|1\rangle \langle 1|\otimes|0\rangle \langle0| \\ +&+\frac{s}{2}|0\rangle \langle1|\otimes|0\rangle \langle1|+\frac{s}{2}|1\rangle \langle0|\otimes|1\rangle \langle0| +\end{align}

+

Thus tracing out the second qubit results to: +\begin{align} +W_{A}&=\frac{1+s}{4}|0\rangle \langle0|+\frac{1+s}{4}|1\rangle \langle1|+\frac{1-s}{4}|0\rangle \langle0|+\frac{1-s}{4}|1\rangle \langle1|+\frac{s}{2}|0\rangle \langle1|+\frac{s}{2}|1\rangle \langle0|\\ +&=\frac{1}{2}|0\rangle \langle0|+\frac{1}{2}|1\rangle \langle1|+\frac{s}{2}|0\rangle \langle1|+\frac{s}{2}|1\rangle \langle 0|\\ +&=\frac{1}{2}\left( +\begin{array}{cc} + 1 & s \\ + s & 1 \\ +\end{array} +\right) +\end{align}.

+

However the result in the notes seems to be:

+

\begin{equation} +\left( +\begin{array}{cc} + 1/2 & 0 \\ + 0 & 1/2 \\ +\end{array} +\right) +\end{equation}.

+

I am stuck and I try to find my mistake but i can't. Any help?

+",14166,,14166,,12/20/2020 15:44,12/20/2020 17:43,Partial Trace of Werner State,,2,0,,,,CC BY-SA 4.0 +15213,2,,15208,12/20/2020 16:56,,6,,"

We know that giving a single qubit starting in the state $|0\rangle$, which is a state one can initialize very fast with high fidelity, then we can put it in the superposition state $|\psi \rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$ by applying a Hadamard gate. That is,

+

$$H |0\rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$$

+

And we can do for $N$-qubit by applying each Hadmard gate to each qubit individually. That is,

+

\begin{align} \overbrace{H|0\rangle \otimes H|0\rangle \otimes \cdots \otimes H|0\rangle}^{n \ \textrm{times}} &= \overbrace{ \bigg( \dfrac{|0\rangle +|1\rangle}{\sqrt{2} } \bigg)\otimes \bigg( \dfrac{|0\rangle +|1\rangle}{\sqrt{2} } \bigg) \otimes \cdots \otimes \bigg( \dfrac{|0\rangle +|1\rangle}{\sqrt{2} } \bigg) }^{n \ \textrm{times}} \\ +&= \dfrac{1}{\sqrt{2^{n}}}\big( \overbrace{ |00\cdots0\rangle + |00\cdots1\rangle + \cdots + |11\cdots 1\rangle }^{2^n \ \textrm{terms} } \big)\\ +&= \dfrac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n-1} |i\rangle +\end{align}

+

You can do these $N$ operations of applying Hadamard gate to each qubit in parallel as applying a Hadamard to qubit 1 does not effect the state of qubit 2 and etc. You can see this parallelization in term of quantum circuit as well:

+

+

All these Hadamard gates can be and will be execute at the same time on the quantum processor.

+

Furthermore, each Hadamard gate can be executed pretty quick. In fact, if you execute a circuit with a Hadamard and do a measurement, the measurement process takes much much longer than the execution of Hadamard gate. See the pulse schedule for this particular circuit below: (The pink rectangular boxes indicate the measurement process)

+

+",9858,,9858,,12/21/2020 17:14,12/21/2020 17:14,,,,0,,,,CC BY-SA 4.0 +15214,1,,,12/20/2020 17:04,,1,49,"

Background

+

It is known:

+
+

In all physical systems in which energy is bounded below, there is no +self-adjoint observable that tracks the time parameter t.

+
+

However I don't think this forbids any inequality on how much time has passed can be inferred between the time evolution of an eigenstate (position or momentum) $| x \rangle $ and $U(\Delta t)| x \rangle$ where $| x \rangle $ is the position eigenket and $U$ is a unitary operator for a generic Hamiltonian. In light of that I constructed the following inequality.

+

Question

+

I can show for a position eigenstate $| x \rangle $ if it evolves in time $U(\Delta t) | x\rangle$ (where $U$ is a unitary operator for a generic Hamiltonian). Then one can bound the time elapsed by finding the probability amplitude $| \langle x | U^\dagger(\Delta t)| x + \Delta x \rangle |^2 $ and $| \langle x | U^\dagger(\Delta t)| x \rangle |^2 $ (where $\Delta x$ is the translation in space by an amount $\Delta x > 0$) and knows in advance the rate of change of momentum $|\langle x | \dot p | x \rangle |$ then one can bound $\Delta t$

+

\begin{align} + 2 \hbar \frac{ | \langle x | U^\dagger(\Delta t)| x + \Delta x \rangle | + | \langle x | U^\dagger(\Delta t) | x \rangle| }{\Delta x|\langle x | \dot p | x \rangle | } \geq \Delta t \tag{1} \end{align} +Similarly for a momentum eigenstate $|p \rangle $ and the rate of change of position $|\langle p | \dot x | p \rangle |$:

+

\begin{align} + 2 \hbar \frac{ | \langle p | U^\dagger(\Delta t) |p + \Delta p \rangle | + | \langle p | U^\dagger(\Delta t) | p \rangle| }{\Delta p|\langle p | \dot x | p \rangle | } \geq \Delta t \tag{2} \end{align}

+

Is there any realistic experiment one can do to realise this quantum mechanical watch-stop?

+

Proof

+

Consider the following limit:

+

\begin{align} \lim_{\delta x \to 0} \frac{| x + \delta x \rangle - | x \rangle}{\delta x} = \frac{i}{\hbar}\hat p |x \rangle \tag{3} \end{align}

+

Similarly:

+

\begin{align} \lim_{\delta t \to 0} \frac{U(\delta t)| x \rangle - | x \rangle}{\delta t} = \frac{-i}{\hbar}\hat H |x \rangle \tag{4} \end{align}

+

Hence, we multiply the first two equations (adjoint of one times the other) and substract:

+

\begin{align} +& \lim_{\delta x,\delta t \to 0 }\frac{\langle x |U^\dagger (\delta t)| x + \delta x \rangle - \langle x + \delta x| U(\delta t)| x \rangle-\langle x |U^\dagger (\delta t)| x \rangle + \langle x | U (\delta t) |x \rangle}{\delta x \delta t} \\ &= - \frac{1}{\hbar^2} \langle x | [ \hat H,\hat p] | x \rangle \tag{5} +\end{align}

+

Using Heisenberg's equation of motion:

+

\begin{align} + \lim_{\delta x,\delta t \to 0 }\frac{\langle x | U^\dagger (\delta t)| x + \delta x \rangle - \langle x + \delta x| U (\delta t)|x \rangle}{\delta x \delta t} + - \frac{\langle x | U^\dagger (\delta t) | x \rangle - \langle x |U (\delta t)|x \rangle}{\delta x \delta t} = \frac{i}{\hbar}\langle x | \dot p | x \rangle\tag{6}\end{align}

+

Replacing $\delta x$ and $\delta t$ with finite but small values:

+

\begin{align} + \frac{\langle x |U^\dagger (\Delta t)| x + \Delta x \rangle - \langle x + \Delta x|U (\Delta t)| x \rangle}{\Delta x \Delta t} + - \frac{\langle x |U^\dagger (\Delta t)| x \rangle - \langle x | U (\Delta t)| x \rangle}{\Delta x \Delta t} \approx \frac{i}{\hbar}\langle x | \dot p | x \rangle\tag{7}\end{align}

+

Taking the modulus and using the triangle inequality:

+

\begin{align} +\left | \frac{\langle x |U^\dagger (\Delta t)| x + \Delta x \rangle - \langle x + \Delta x|U (\Delta t)| x \rangle}{\Delta x \Delta t} + \right | + \left | \frac{\langle x |U^\dagger (\Delta t)| x \rangle - \langle x | U (\Delta t)| x \rangle}{\Delta x \Delta t} \right | \geq \frac{i}{\hbar} | \langle x | \dot p | x \rangle | \tag{8} \end{align}

+

Let us consider square of the first term:

+

\begin{align} + T_1^2 = \left | \frac{\langle x |U^\dagger (\Delta t)| x + \Delta x \rangle - \langle x + \Delta x| U (\Delta t)|x \rangle}{\Delta x^2 \Delta^2 t} \right |^2 = \frac{2 | \langle x | U^\dagger (\Delta t) | x + \Delta x \rangle |^2 - \langle x |U^\dagger (\Delta t)| x + \Delta x \rangle^2 - \langle x + \Delta x| U (\Delta t) |x \rangle^2}{\Delta x^2 \Delta t^2} \tag{9} \end{align}

+

We use the following inequality which uses $| \langle x |U^\dagger (\Delta t)| x + \Delta x \rangle| = |z|$, $ \langle x |U^\dagger (\Delta t)| x + \Delta x \rangle = z$ and $ \langle x + \Delta x |U(\Delta t)| x \rangle = z^*$ with $z = a+ib$:

+

\begin{align} + \frac{4 | \langle x| x + \Delta x \rangle |^2 }{\Delta x^2 \Delta t^2} \geq T_1^2 \tag{10} \end{align}

+

Since all quantities are positive:

+

$$ \frac{2 | \langle x| U^\dagger (\Delta t) | x + \Delta x \rangle | }{\Delta x \Delta t} \geq T_1 \tag{11} $$

+

Similarly, we define:

+

\begin{align} + T_2 = \left | \frac{\langle x | U^\dagger (\Delta t) | x \rangle - \langle x | U (\Delta t)|x \rangle }{\Delta x \Delta t} \right | \tag{12} \end{align}

+

Then,

+

\begin{align} + \frac{ 2 | \langle x | U^\dagger (\Delta t) | x \rangle| }{\Delta x \Delta t} \geq T_2 \tag{13}\end{align}

+

Hence, substituting the $T_1$ and $T_2$ inequality:

+

\begin{align} + \frac{2 | \langle x | U^\dagger (\Delta t) | x + \Delta x \rangle | }{\Delta x \Delta t} + \frac{ 2 | \langle x | U^\dagger (\Delta t)| x \rangle| }{\Delta x \Delta t} \geq \frac{1}{\hbar} |\langle x | \dot p | x \rangle | \tag{14} \end{align}

+

Or in terms of $\Delta t$:

+

\begin{align} + 2 \hbar \frac{ | \langle x | U^\dagger (\Delta t)| x + \Delta x \rangle | + | \langle x | U^\dagger (\Delta t) | x \rangle| }{\Delta x|\langle x | \dot p | x \rangle | } \geq \Delta t \tag{15} \end{align}

+

Similarly for momentum eigenkets:

+

\begin{align} + 2 \hbar \frac{ | \langle p | U^\dagger(\Delta t) |p + \Delta p \rangle | + | \langle p | U^\dagger(\Delta t) | p \rangle| }{\Delta p|\langle p | \dot x | p \rangle | } \geq \Delta t \tag{16} \end{align}

+",5045,,5045,,12/28/2020 4:52,12/28/2020 4:52,Is this inequality related to time-energy uncertainty true or testable?,,0,3,,,,CC BY-SA 4.0 +15215,2,,15212,12/20/2020 17:21,,4,,"

$\frac{s}{2}|0\rangle\langle1|\otimes|0\rangle\langle1|+\frac{s}{2}|1\rangle\langle0|\otimes|1\rangle\langle0|$ should disappear when you take the trace over them, as $\langle0|1\rangle$ and $\langle1|0\rangle = 0$

+

Edit: To give a simpler example, if your traced out the second qubit of $$\frac{1}{\sqrt{2}}|00\rangle+|11\rangle$$, then $\frac{1}{2}|00\rangle\langle11|$ and $\frac{1}{2}|11\rangle\langle00|$ would also disappear.

+",4991,,,,,12/20/2020 17:21,,,,0,,,,CC BY-SA 4.0 +15216,1,,,12/20/2020 17:24,,8,374,"

Inequalities cannot be directly converted into a QUBO form. By inequality, I mean something like this:

+

0⩽ Expression ⩽ N.

+

We can introduce a slack variable and convert it to an equality problem:

+

⟹ Expression + s = N +where: +s ∈ Z, +s ∈ [0,N]

+

Since the slack variables, being encoded on a quantum computer, can hold only discrete values(0, 1, 2...N) the expression also must be of a discrete nature and be of the same values(0, 1, 2...N) to satisfy the constraint.

+

How to encode inequality constraints when the expression is discrete but the values of the expression have sporadic (and maybe unknown) intervals(0, 1.2, 1.5, 3.8....N).

+",14221,,2293,,12/16/2021 20:51,1/11/2023 0:09,Inequality constraints on D-Wave (using PyQUBO),,1,1,,,,CC BY-SA 4.0 +15217,2,,15212,12/20/2020 17:29,,2,,"

Note that

+

$$ +\mathrm{tr}_B\left(|0\rangle \langle1|\otimes|0\rangle \langle1|\right) =|0\rangle \langle1| \mathrm{tr} (|0\rangle \langle1|) = |0\rangle \langle1| \, \langle1|0\rangle = |0\rangle \langle1| \cdot 0 = 0 +$$

+

so the two terms marked red below disappear when you take the partial trace

+

$$ +W_{A}=\frac{1+s}{4}|0\rangle \langle0|+\frac{1+s}{4}|1\rangle \langle1|+\frac{1-s}{4}|0\rangle \langle0|+\frac{1-s}{4}|1\rangle \langle1|+\color{red}{\frac{s}{2}|0\rangle \langle1|+\frac{s}{2}|1\rangle \langle0|}. +$$

+

Once these terms are gone, the rest of the calculations yields

+

$$ +\begin{align} +W_{A}&=\frac{1+s}{4}|0\rangle \langle0|+\frac{1+s}{4}|1\rangle \langle1|+\frac{1-s}{4}|0\rangle \langle0|+\frac{1-s}{4}|1\rangle \langle1|\\ +&=\frac{1}{2}|0\rangle \langle0|+\frac{1}{2}|1\rangle \langle1|\\ +&=\frac{1}{2}\left( +\begin{array}{cc} + 1 & 0 \\ + 0 & 1 \\ +\end{array} +\right) +\end{align} +$$

+

as expected.

+
+

There is another way of computing the partial trace from the full density matrix that works particularly well in this case

+

$$ +W_A = \mathrm{tr}_B\begin{pmatrix} + (1+s)/4 & 0 & 0 & s/2 \\ + 0 & (1-s)/4 & 0 & 0 \\ + 0 & 0 & (1-s)/4 & 0 \\ + s/2 & 0 & 0 & (1+s)/4 \\ +\end{pmatrix} = \begin{pmatrix} + \mathrm{tr}\begin{pmatrix} +(1+s)/4 & 0 \\ +0 & (1-s)/4 +\end{pmatrix} & \mathrm{tr}\begin{pmatrix} +0 & s/2 \\ +0 & 0 +\end{pmatrix} \\ +\mathrm{tr}\begin{pmatrix} +0 & 0 \\ +s/2 & 0 +\end{pmatrix} & \mathrm{tr}\begin{pmatrix} +(1-s)/4 & 0 \\ + 0 & (1+s)/4 +\end{pmatrix} +\end{pmatrix} = \begin{pmatrix} +\frac{1}{2} & 0 \\ +0 & \frac{1}{2} +\end{pmatrix}. +$$

+",10480,,10480,,12/20/2020 17:43,12/20/2020 17:43,,,,1,,,,CC BY-SA 4.0 +15218,1,15223,,12/21/2020 11:13,,3,71,"

I'm currently writing my thesis and I'd like to know which computer is based on a superconductive architecture to run some simulations. +Thanks for help in advance.

+",14229,,8141,,12/21/2020 15:27,12/22/2020 17:02,Is every computer in IBM's fleet based on superconductivity?,,1,1,,,,CC BY-SA 4.0 +15219,1,,,12/21/2020 13:59,,2,51,"

Can quantum computers offer Grover-like speed ups in parsing of context-free languages? For instance, general CFLs can be parsed in $O(n^3)$ with standard algorithm like https://en.wikipedia.org/wiki/CYK_algorithm. Could Grover's algorithm be used to speed up the search at each level of the CYK table to produce an $O(n^2)$ algorithm?

+

It doesn't appear anyone has published anything on parsing speed-ups.

+",9305,,55,,12/23/2020 9:03,12/23/2020 9:03,Can quantum computers speed up parsing?,,0,1,,,,CC BY-SA 4.0 +15220,2,,8741,12/21/2020 14:35,,2,,"

QMA verification includes three registers, with appropriate bounds on the length of each register:

+
    +
  • $x$, a (classical) description of the (quantum) circuit used for verification, along with the promised gap;
  • +
  • $\vert w\rangle$, the (quantum) witness provided by Merlin; and
  • +
  • $\vert\eta\rangle$, the ancilla workspace used by Arthur.
  • +
+

It seems as if you are asking what problems may arise (for example, in the strong error-reduction of Marriott-Watrous), if $x$ where quantum rather than classical (for example, if $\vert x\rangle$ where in some superposition of states).

+

But the classical description of the circuit is meant to be agreed-upon by Arthur and Merlin a-priori. If Merlin were to send $\vert x\rangle$ in superposition, Arthur could initially start his verification procedure by measuring $\vert x\rangle$ to get a classical string $x$. Merlin doesn't gain anything by sending $\vert x\rangle$ itself in superposition, and cannot improve his completeness/soundness.

+

Sevag Gharibian has a very good lecture (clocking in at about 2 hours and 40 minutes) on QMA and MW here. I've been enjoying this lecture series very much.

+",2927,,2927,,1/13/2021 22:02,1/13/2021 22:02,,,,0,,,,CC BY-SA 4.0 +15221,1,,,12/21/2020 15:24,,5,340,"

I have some working knowledge in Machine Learning and Deep Learning. I am currently in the process of studying Quantum Computing fundamentals.

+

I would like to know whether there are any Quantum Machine Learning beginner level resources I can read on?

+

Appreciate if any one can share any articles/books/courses/lecture notes I can read in the subject.

+

Thanks a lot!

+",13294,,55,,12/23/2020 9:03,12/25/2020 3:59,Getting started with Quantum Machine Learning,,4,1,,,,CC BY-SA 4.0 +15222,2,,15199,12/21/2020 16:32,,2,,"

Unfortunately Grover does not work for your setup. I guess your Quantum Circuit looks as follows. To 1) mark the states you want to boost, with a negative phase and 2) apply the Grover Diffusion Operator.

+

+

000 : 0.3535533905932739
+001 : 0.35355339059327384
+010 : -0.35355339059327384
+011 : -0.35355339059327384
+100 : -0.353553390593274
+101 : -0.3535533905932739
+110 : -0.35355339059327384
+111 : -0.35355339059327384

+

After having marked the states with a negative phase, the average amplitude will be $\frac{(2/\sqrt{8} - 6/\sqrt{8})}{8} = -0.177$. If you now apply the diffusion operator, you will perform a reflection around that average and receive the following amplitudes:

+
    +
  1. $\left| \psi \right> - 2*(\left| \psi \right> - \left| r \right>) = -0.707$ (for the states with positive amplitude)
  2. +
  3. $-\left| \psi \right> - 2*(-\left| \psi \right> + \left| r \right>) = 0$ (for the states with negative amplitude)
  4. +
+

Since $\left| r \right> = \frac{(2/\sqrt{8} - 6/\sqrt{8})}{8} = \lvert \frac{1/\sqrt{8}}{2} \rvert$

+

That the Grover algorithm seems not to work for cases where you are searching for 6/8 versus searching for 2/8 is not surprising, as I believe that the algorithm was originally invented to search for a single state. In order to boost its amplitude by reflection around the average amplitude of all the states.

+

I also found versions that can search for more than one particular states, like in https://qiskit.org/textbook/ch-algorithms/grover.html.

+

What you could do is to re-phrase the problem and search for the states $\left| 000 \right>$ and $\left| 001 \right>$. Then you immediately know the 'location' of the others.

+",14130,,14130,,12/21/2020 19:18,12/21/2020 19:18,,,,0,,,,CC BY-SA 4.0 +15223,2,,15218,12/21/2020 16:43,,4,,"

Yes. IBM uses superconducting Transmon qubit. Here is a quote from IBM's website:

+
+

At the heart of IBM quantum systems is the transmon qubit. Successive generations of IBM Quantum processors have demonstrated the potential of superconducting transmon qubits as the basis for electrically controlled solid-state quantum computers. With a scalable approach to chip architecture and research into error correction and mitigation, IBM Quantum is at the forefront of developing systems with sufficient quantum volume to demonstrate advantage in real world applications.

+
+

Maybe you are looking for something like this list:

+

+",9858,,9858,,12/22/2020 17:02,12/22/2020 17:02,,,,3,,,,CC BY-SA 4.0 +15224,2,,15221,12/21/2020 16:51,,3,,"

Here is a good resource:

+

Quantum machine learning for data scientists

+
+
+

Here is another one that discusses different techniques people are proposing for QML in the literature and etc.

+

Quantum machine learning:a classical perspective

+",9858,,,,,12/21/2020 16:51,,,,1,,,,CC BY-SA 4.0 +15225,1,15226,,12/21/2020 18:11,,3,112,"

The X gate is given by $\big(\begin{smallmatrix} + 0 & 1 \\ + 1 & 0 +\end{smallmatrix}\big)$ in the computational basis. In the Hadamard basis, the gate is $X_H = \big(\begin{smallmatrix} + 1 & 0\\ + 0 & -1 +\end{smallmatrix}\big) = |+ \rangle \langle +| - |-\rangle \langle-|$. When I apply the gate to the Hadamard basis vectors, the vectors should flip, and they do when I use matrix notation but not when I'm using dirac notation. I know I'm making a mistake somewhere.

+

$X_H |+\rangle = (|+ \rangle \langle +| - |-\rangle \langle-|)|+\rangle = |+ \rangle \langle +|+\rangle - |-\rangle \langle-|+\rangle = |+\rangle(1) - |-\rangle(0) = |+\rangle$ and +$X_H |-\rangle = (|+ \rangle \langle +| - |-\rangle \langle-|)|-\rangle = |+ \rangle \langle +|-\rangle - |-\rangle \langle-|-\rangle = |+\rangle (0) -|-\rangle(1) = -|-\rangle$

+

Meanwhile, in matrix notation,

+

$X_H|+\rangle = \big(\begin{smallmatrix} + 1 & 0\\ + 0 & -1 +\end{smallmatrix}\big) \frac{1}{\sqrt{2}}\big( \begin{smallmatrix} +1 \\ +1 +\end{smallmatrix}\big) = \frac{1}{\sqrt{2}}\big( \begin{smallmatrix} +1 \\ +-1 +\end{smallmatrix}\big) = |-\rangle +$

+

$X_H|-\rangle = \big(\begin{smallmatrix} + 1 & 0\\ + 0 & -1 +\end{smallmatrix}\big) \frac{1}{\sqrt{2}}\big( \begin{smallmatrix} +1 \\ +-1 +\end{smallmatrix}\big) = \frac{1}{\sqrt{2}}\big( \begin{smallmatrix} +1 \\ +1 +\end{smallmatrix}\big) = |+\rangle +$

+",14184,,55,,12/23/2020 9:09,12/23/2020 9:09,Mistake in using dirac notation when applying $X$ gate to vector,,1,0,,,,CC BY-SA 4.0 +15226,2,,15225,12/21/2020 18:30,,2,,"

The basis states should not flip, as these two basis states are the eigenstates of the $X$ gate. The $X$ gate flips the computational basis states, the $Z = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix}$ gate flips the Hadamard basis states.

+

Expressing everything in the computational basis

+

In the computational basis, we have $X = \begin{bmatrix}0 & 1 \\ 1 & 0\end{bmatrix}$. Thus the states (expressed in the computational basis) $|+\rangle = \begin{bmatrix}1 \\ 1\end{bmatrix}$ and $|-\rangle = \begin{bmatrix}1 \\ -1\end{bmatrix}$ are the $+1$ and $-1$ eigenstates respectively, as you can readily check.

+

Expressing everything in the Hadamard basis

+

If you express everything in the Hadamard basis, the $X$ gate becomes $X_{H} = \begin{bmatrix}1 & 0 \\ 0 & -1\end{bmatrix}$.

+

But, the $|+\rangle$ and $|-\rangle$ states should now also be expressed in this basis. That is, $|+\rangle_{H} = \begin{bmatrix}1 \\ 0\end{bmatrix}$ and $|-\rangle_{H} = \begin{bmatrix}0 \\ 1\end{bmatrix}$. It's now obvious that these states are indeed the $+1$ and $-1$ eigenstates of $X$, expressed in whatever basis.

+

To summarize your notation

+

So you dirac notation is correct, and in your matrix notation you expressed the $X$ operator in the Hadamard basis, but the states in the computational basis.

+

But wait, then what are these states if not the $|+\rangle$ and $|-\rangle$ states?

+

So what are the states $\begin{bmatrix}1 \\ 1\end{bmatrix}_{H}$ and $\begin{bmatrix}1 \\ -1\end{bmatrix}_{H}$, i.e. these states in the Hadamard basis? As you showed with your matrix notation, they are those states that are flipped under operation of the $X$ gate - they are the computational basis states/eigenstates of the $Z$ operator!

+

Of course, you can write this out mathematically as well:

+

$$ +\begin{bmatrix}1 \\ 1\end{bmatrix}_{H} = \begin{bmatrix}1 \\ 0\end{bmatrix}_{H} + \begin{bmatrix}0 \\ 1\end{bmatrix}_{H} = \begin{bmatrix}1 \\ 1\end{bmatrix} + \begin{bmatrix}1 \\ -1\end{bmatrix} = \begin{bmatrix}1 \\ 0\end{bmatrix} +$$ +As you can see, I've been very sloppy with the normalization factor - the above equation is a factor of $2$ off.

+",8141,,,,,12/21/2020 18:30,,,,2,,,,CC BY-SA 4.0 +15227,2,,15203,12/21/2020 19:19,,3,,"

The easiest way to get the unitary matrix of a couple of operations in Cirq is the unitary method on the Circuit class. In your case:

+
import cirq
+
+a, b = cirq.LineQubit.range(2) 
+
+theta = 0.4
+phi = 0.123
+u = cirq.Circuit(cirq.rx(phi)(a), cirq.rz(theta)(b)).unitary()
+print(u)
+
+
+

Will give you the 4x4 unitary matrix

+
[[ 0.97821373-0.19829374j  0.        +0.j         -0.01221046-0.06023611j   0.        +0.j        ]
+ [ 0.        +0.j          0.97821373+0.19829374j  0.        +0.j   0.01221046-0.06023611j]
+ [-0.01221046-0.06023611j  0.        +0.j          0.97821373-0.19829374j   0.        +0.j        ]
+ [ 0.        +0.j          0.01221046-0.06023611j  0.        +0.j   0.97821373+0.19829374j]]
+
+",4986,,,,,12/21/2020 19:19,,,,0,,,,CC BY-SA 4.0 +15228,2,,15187,12/21/2020 19:38,,1,,"

You found a bug in the docs, the method is set_state_vector() - I opened https://github.com/quantumlib/Cirq/issues/3623.

+

The methods are only available on the SparseSimulatorStep which is the default simulator in Cirq.

+

They are available in the API docs though set_state_vector has no docstring:

+ +",4986,,,,,12/21/2020 19:38,,,,0,,,,CC BY-SA 4.0 +15229,2,,15178,12/21/2020 20:21,,1,,"

I do not know how the crosstalk matrix works. But the way I understand QBER is the following:

+

QBER is the mismatch probability of the signals sent and receieved between Alice and Bob. Let Alice send 100 signals to Bob. Bob makes his own measurement choices and at the end, they compare their results. Let's say, in 60 of these 100 signals, Bob measured in the 'right' basis, i.e., his result should match Alice's preparation. Meaning, in these 60 cases, if Alice intended to send classical bit 0 (or 1), Bob should receive classical bit 0 (or 1).

+

However, due to some unwanted noise (Eve!), among these 60 cases, some of their results differed. Let in 5 of these 60 cases, Alice wanted to send 0, Bob should have received 0 (because he made the right measurement choice), but got 1. The other case is also possible. I.e., let 7 of the 60 cases, Alice sent a 1, but Bob received 0. The QBER is then: +$$ +QBER = \frac{5}{60} + \frac{7}{60}. +$$

+

Does it help a little? I welcome the community members to comment on this answer to confirm my understanding too!

+",2403,,2403,,12/22/2020 0:35,12/22/2020 0:35,,,,0,,,,CC BY-SA 4.0 +15230,1,15231,,12/21/2020 20:57,,3,102,"

I'm new to QISKIT Aqua and I'm trying to follow the Ground State tutorial to solve the Water molecule ground state, but when I execute the calculations the kernel stops. +I'm using IBM Q Experience jupyter notebooks and the only thing I changed from the original tutorial is the molecule. I Changed it by excluding the previous molecule and adding this to the code:

+
import numpy as np
+
+angle = np.deg2rad(104.45/2)
+dist = 0.9584
+molecule = Molecule(geometry=[['O', [0., 0., 0.]],
+                              ['H', [dist*np.sin(angle), -dist*np.cos(angle), 0.]],
+                              ['H', [-dist*np.sin(angle), -dist*np.sin(angle), 0.]]],
+                     charge=0, multiplicity=1)
+
+",5065,,55,,12/23/2020 9:09,12/23/2020 9:09,Kernel stopping when solving water molecule ground state,,1,4,,,,CC BY-SA 4.0 +15231,2,,15230,12/21/2020 21:26,,3,,"

Here is the working code. Because of the symmetry in water molecule, I used the Z Matrix representation instead of the usual XYZ format. You can and should be able to execute this within the IBM Quantum Experience.

+
import os
+os.environ['QISKIT_SETTINGS']=''
+import matplotlib.pyplot as plt
+%matplotlib inline
+%config InlineBackend.figure_format = 'svg' # Makes the images look nice
+import numpy as np
+from qiskit.aqua import QuantumInstance
+from qiskit.aqua.algorithms import NumPyMinimumEigensolver, VQE, NumPyEigensolver
+from qiskit.aqua.components.optimizers import COBYLA
+from qiskit.aqua.components.initial_states import Custom
+from qiskit import IBMQ, BasicAer, Aer
+from qiskit.chemistry.qmolecule import QMolecule
+from qiskit.chemistry.drivers import PySCFDriver, UnitsType
+from qiskit.chemistry import FermionicOperator
+from qiskit.chemistry.core import Hamiltonian, TransformationType, QubitMappingType
+from qiskit.circuit.library import TwoLocal
+import warnings
+warnings.filterwarnings("ignore",category=DeprecationWarning)
+
+provider = IBMQ.load_account()
+simulator_backend = Aer.get_backend("qasm_simulator")
+hardware_backend = provider.get_backend('ibmq_valencia')
+quantum_instance = QuantumInstance(backend = simulator_backend, shots= 1, optimization_level= 3)
+
+atom_structure = "H; O 1 0.958; H 2 0.958 1 104.47"  
+orbital_reduction=[ ] 
+[unit, charge, spin, basis]= [UnitsType.ANGSTROM, 0, 0, 'sto6g'] 
+driver = PySCFDriver(atom= atom_structure, unit=unit,charge=charge, spin=spin, basis=basis)
+qmolecule = driver.run()
+ferOp = Hamiltonian(transformation = TransformationType.FULL , 
+                    qubit_mapping = QubitMappingType.PARITY,
+                    two_qubit_reduction = True,
+                    freeze_core = True, 
+                    orbital_reduction = [ ], 
+                    z2symmetry_reduction = 'auto')
+qubitOp, aux_ops = ferOp.run(qmolecule)
+
+energy_shift = ferOp._energy_shift
+nuclear_repulsion_energy = ferOp._nuclear_repulsion_energy 
+total_shift = energy_shift + nuclear_repulsion_energy 
+
+print('HF Energy is:' , ferOp._hf_energy )
+print('\n *********************************Exact Eigensolver*************************************** \n')
+exact_result = NumPyMinimumEigensolver(qubitOp).run() 
+ee_result = ferOp.process_algorithm_result(exact_result)
+print(ee_result)
+
+    
+#----------------------- VQE PROCESSED ---------------------------# 
+var_form= TwoLocal(qubitOp.num_qubits, ['ry'], ['cx'], entanglement= 'linear',
+                    reps= 2,skip_unentangled_qubits=True, skip_final_rotation_layer = False, insert_barriers=True,
+                    initial_state = None) 
+
+
+optimizer = COBYLA(maxiter= 50,tol=0.000000001)   
+vqe = VQE(qubitOp, var_form, optimizer, initial_point = None, 
+          include_custom = True, aux_operators=aux_ops)
+vqe_result = vqe.run(quantum_instance)
+vqe_processed_result = ferOp.process_algorithm_result(vqe_result)
+vqe_energy = vqe_result['eigenvalue'] + total_shift
+total_ang_moment = vqe_processed_result['total_angular_momentum'] 
+print('Optimal VQE energy at this step is:', vqe_energy)
+print('The corresponding Total Angular Momentum is', total_ang_moment)
+vqe.get_optimal_circuit().draw('mpl', style = {'name': 'bw'}, scale = 0.75, plot_barriers = False) 
+
+

Ran this gave me the output:

+
HF Energy is: -75.6787913259016
+
+ *********************************Exact Eigensolver*************************************** 
+
+=== GROUND STATE ENERGY ===
+ 
+* Electronic ground state energy (Hartree): -84.916233233599
+  - computed part:      -23.633272241623
+  - frozen energy part: -61.282960991976
+  - particle hole part: 0.0
+~ Nuclear repulsion energy (Hartree): 9.187404411009
+> Total ground state energy (Hartree): -75.72882882259
+Optimal VQE energy at this step is: (-72.69078459811197+0j)
+The corresponding Total Angular Momentum is 1.2057181036792375
+
+

and the optimal circuit: +

+

As you can see this var_form is too long to be executed with good result for the hardware so maybe you can modify it. Changing the entangle_map might help. So instead of using entanglement= 'linear' you can set it to be something else. Note that you can also specify how the CNOT gates are connected. That is if you specify:

+
var_form= TwoLocal(qubitOp.num_qubits, ['ry'], ['cx'], entanglement= [ [0,1],[2,3],[4,5],[6,7] ],
+                    reps= 1,skip_unentangled_qubits=True, skip_final_rotation_layer = False, insert_barriers=True,
+                    initial_state = None) 
+
+

Then you would get something like:

+
     ┌──────────┐ ░       ░  ┌──────────┐
+q_0: ┤ RY(θ[0]) ├─░───■───░──┤ RY(θ[8]) ├
+     ├──────────┤ ░ ┌─┴─┐ ░  ├──────────┤
+q_1: ┤ RY(θ[1]) ├─░─┤ X ├─░──┤ RY(θ[9]) ├
+     ├──────────┤ ░ └───┘ ░ ┌┴──────────┤
+q_2: ┤ RY(θ[2]) ├─░───■───░─┤ RY(θ[10]) ├
+     ├──────────┤ ░ ┌─┴─┐ ░ ├───────────┤
+q_3: ┤ RY(θ[3]) ├─░─┤ X ├─░─┤ RY(θ[11]) ├
+     ├──────────┤ ░ └───┘ ░ ├───────────┤
+q_4: ┤ RY(θ[4]) ├─░───■───░─┤ RY(θ[12]) ├
+     ├──────────┤ ░ ┌─┴─┐ ░ ├───────────┤
+q_5: ┤ RY(θ[5]) ├─░─┤ X ├─░─┤ RY(θ[13]) ├
+     ├──────────┤ ░ └───┘ ░ ├───────────┤
+q_6: ┤ RY(θ[6]) ├─░───■───░─┤ RY(θ[14]) ├
+     ├──────────┤ ░ ┌─┴─┐ ░ ├───────────┤
+q_7: ┤ RY(θ[7]) ├─░─┤ X ├─░─┤ RY(θ[15]) ├
+     └──────────┘ ░ └───┘ ░ └───────────┘
+
+",9858,,9858,,12/22/2020 17:04,12/22/2020 17:04,,,,0,,,,CC BY-SA 4.0 +15232,2,,15190,12/21/2020 23:46,,1,,"

Let $\Phi$ have Kraus representation $\Phi(X)=\sum_a A_a X A_a^\dagger$. +Its Choi then has the form $J(\Phi) = \sum_a \mathrm{vec}(A_a)\mathrm{vec}(A_a)^\dagger$. This works both ways: if the Choi has this form, then the $A_a$ are Kraus operators for $\Phi$ (note that the normalization condition on the Kraus operators translates into the condition $\mathrm{Tr}_1(J(\Phi))=I$ for the Choi).

+

Therefore, if the Choi has rank one, i.e. $J(\Phi)=\mathrm{vec}(A)\mathrm{vec}(A)^\dagger$ for some linear operator $A$, then $\Phi(X)=AXA^\dagger$. This implies that $\Phi$ is an isometric channel.

+",55,,,,,12/21/2020 23:46,,,,0,,,,CC BY-SA 4.0 +15233,1,15238,,12/22/2020 19:20,,2,225,"

I am interested to know whether there is a quick and elegant way of increasing the number of shots (more than 8192 shots) on IBM hardware when running variational algorithms like VQE or QAOA.

+

I know that within Qiskit, I can specify: +backend._configuration.max_shots= shots to change the number of max_shots but this only works for simulator. I can't increase the shots parameter to go over 8192 shots when I set my backend as one of the real hardware. That is, if I specify the following:

+
hardware_backend = provider.get_backend('ibmq_valencia ')
+maxshots = 20000
+hardware_backend._configuration.max_shots= maxshots
+quantum_instance = QuantumInstance(hardware_backend, shots = maxshots, initial_layout = None,
+                                   optimization_level = 3)  
+
+

then upon executing the circuit, I will have an error message:

+
Error is : The number of shots in the Qobj (20000) is higher than the number of shots supported by the device (8192). 
+
+
+

Is there a quick and elegant way to overcome this issue within Qiskit? Thank you!

+",9858,,,,,12/23/2020 7:34,Increase maximum shots on IBM Hardware when running Quantum Variational Algorithms,,1,0,,,,CC BY-SA 4.0 +15234,1,15236,,12/22/2020 22:40,,4,117,"

The fidelity of a qubit is nicely defined here and gate fidelity as "the average fidelity of the output state +over pure input states" (defined here).

+

How can one combine the fidelies of two (or more) gates to get a combined total gate fidelity? As in, if a qubit is operated on by two (or more) gates, how can we calculate the expected fidelity of the qubit (compared to its original state) after being operated on by those gates if all we know is the gate fidelity of each gate?

+

I imagine it is deducible from the definition of qubit fidelity... I haven't been able to figure it out. I also did a lot of searching online and couldn't find anything. I prefer the definition on the wikipedia page: $F(\rho, \sigma)=\left|\left\langle\psi_{\rho} \mid \psi_{\sigma}\right\rangle\right|^{2}$ for comparing the input state to the output state. It is easy to work with. A solution explained in these terms is much preferred.

+",14239,,14239,,12/22/2020 22:48,12/23/2020 2:06,How to Aggregate Multiple Gate Fidelities,,1,0,,,,CC BY-SA 4.0 +15235,1,15257,,12/23/2020 1:38,,7,241,"

Deutsch-Jozsa algorithm can compute if some function $f : \{0,1\}^n \rightarrow \{0,1\} $ is constant. This goes exponentially faster than on classical computers.

+

If we consider the set of all boolean functions $f : \{0,1\}^n \rightarrow \{0,1\} $ is there a characterizations or intuition about the properties of boolean functions, which achieve such a speedup compared to classical computations?

+

Consider for example the AND gate, which ANDs all $n$ inputs. I don't know if this is faster on quantum computer, but if yes what does both functions share in common and if not what is different here compared to the constant testing function?

+",14240,,2927,,12/26/2020 14:20,4/16/2021 23:01,What kind of boolean functions are faster to compute on qc?,,2,0,,,,CC BY-SA 4.0 +15236,2,,15234,12/23/2020 2:06,,2,,"

I don't know if you can exactly compute the combined total gate fidelity since the noise processes reducing the fidelity of each gate individually might compose in nontrivial ways. However if you know the individual gate fidelities and those fidelities satisfy certain properties, then you can bound the total gate fidelity. This is the "chaining property for fidelity" ( e.g. Nielsen and Chuang Section 9.3).

+

Suppose you intend to apply $U_1$ to $\rho$ as the first gate in a sequence, but the actual operation you apply is the CPTP map $\mathcal{E}_1(\rho)$ which is some noisy version of $U_1$. A natural way to measure the error is in the operation you applied is:

+

$$ +E(U_1, \mathcal{E}_1) = \max_\rho D(U_1 \rho U_1^\dagger, \mathcal{E}_1(\rho)) +$$

+

where $D(\rho, \sigma) = \arccos \sqrt{F(\rho, \sigma)}$ is a possible choice for $D$, but you can use any metric over quantum states. Finding the maximum distance between $U_1 \rho U_1^\dagger$ and $\mathcal{E}_1(\rho)$ over density matrices $\rho$ tells you the worst possible outcome you can get from your noisy implementation of the gate. Then, if you define the error similarly for $U_2$ and its noisy implementation $\mathcal{E}_2$ then you can guarantee that

+

$$ +E(U_2 U_1, \mathcal{E}_2 \circ \mathcal{E}_1) \leq E(U_1,\mathcal{E}_1) + E(U_2, \mathcal{E}_2 ) +$$

+

which says that the worst case error for applying both of your gates is no worse than the sum of the worst case errors for applying the gates individually.

+

Unfortunately the fidelity $F(\rho, \sigma) =\text{Tr}( \rho \sigma)$ that you give isn't a proper metric over states so you can't substitute that into the chaining property above.

+",1939,,,,,12/23/2020 2:06,,,,4,,,,CC BY-SA 4.0 +15237,2,,15221,12/23/2020 2:14,,1,,"

The textbook Supervised Learning with Quantum Computers (Schuld and Petruccione) is very pedagogical and gives a broad survey of the field (at least up to 2018). They have a preprint An introduction to quantum machine learning that covers a lot of the same material but with less depth.

+",1939,,,,,12/23/2020 2:14,,,,1,,,,CC BY-SA 4.0 +15238,2,,15233,12/23/2020 7:34,,2,,"

According to my knowledge, 8192 is a maximum of shots. I think that the reason is fair timesharing as nowadays there are many users of IBM Q.

+

To get better results from VQE, I can only recommend to run your task several times and then pick up the best solution, i.e. the one wiht the lowest (highest) value of the optimized function.

+",9006,,,,,12/23/2020 7:34,,,,3,,,,CC BY-SA 4.0 +15239,1,15242,,12/23/2020 8:23,,0,126,"

I was checking this problem from the book. And here is an example, but I think it's wrong. If it is not wrong can you please explain how did they derive it?

+

As per my workout, it should be one. But It seems they are doing something fishy here.

+

+

To be honest I would be surprised if this book is giving wrong solutions.

+",13763,,55,,2/2/2021 10:54,2/2/2021 10:54,Compute the squared overlap between different given qubit states,,1,0,,,,CC BY-SA 4.0 +15240,1,,,12/23/2020 8:41,,4,348,"
from qiskit import *
+
+
+def random_bitstring_generator(bit_number, backend):
+   
+
+    bitstring = ""
+
+    one_qubit_random_bit_generator_circuit = QuantumCircuit(1, 1)
+    one_qubit_random_bit_generator_circuit.h(0)
+    one_qubit_random_bit_generator_circuit.measure(0, 0)
+
+    for _ in range(bit_number):
+        counts = execute(one_qubit_random_bit_generator_circuit, backend, shots=8192).result().get_counts()
+        bit = list(counts.keys())[0]  
+        bitstring += bit
+
+    return bitstring
+
+
+backend = BasicAer.get_backend('qasm_simulator')
+
+print(random_bitstring_generator(1024, backend))
+
+
    +
  1. How can i insert a noise model replicating IBM melbourne quantum machine for the circuit execution on simulator
  2. +
  3. Is there a way to be able export the sequence received as output to an text/csv file
  4. +
+",13172,,55,,12/25/2020 23:38,9/17/2022 2:01,Qiskit: simulate a circuit using a backend noise model,,2,0,,,,CC BY-SA 4.0 +15241,2,,15240,12/23/2020 8:49,,0,,"
    +
  1. https://qiskit.org/documentation/tutorials/simulators/2_device_noise_simulation.html
  2. +
  3. bitstring is a string, you can manipulate it and save it using Python commands.
  4. +
+",7659,,,,,12/23/2020 8:49,,,,0,,,,CC BY-SA 4.0 +15242,2,,15239,12/23/2020 9:02,,2,,"

Let's decompose each of the calculation.

+

By having in mind that $\langle 0 | 0\rangle = \langle 1 | 1\rangle = 1$ and $\langle 0 | 1\rangle =\langle 1 | 0\rangle = 0$, we have: +\begin{align*} &\langle \psi_0 | \psi_1\rangle = \frac{-1}{2} \langle 0 | 0\rangle - \underbrace{\frac{\sqrt{3}}{2}\langle 0 | 1\rangle}_{=0} = -\frac{1}{2} \\ +& \Longrightarrow |\langle \psi_0 | \psi_1\rangle|^2 = \left( \frac{-1}{2} \right)^2 = \frac{1}{4} +\end{align*} +You do the exact same thing for $|\langle \psi_0 | \psi_2\rangle|^2$, the only thing changing being the sign in front of $\frac{\sqrt{3}}{2}$, but since it "becomes" 0, nothing changes.

+

As for the last one :

+

\begin{align*} +\langle \psi_1 | \psi_2\rangle &= \left( \frac{-1}{2} \langle 0 | - \frac{\sqrt{3}}{2}\langle 1 |\right) \left( \frac{-1}{2} | 0 \rangle + \frac{\sqrt{3}}{2} |1 \rangle \right) \\ +&= \frac{1}{4}\underbrace{\langle 0 | 0\rangle}_{=1} - \frac{3}{4}\underbrace{\langle 1 | 1\rangle}_{=1} -\underbrace{\frac{\sqrt{3}}{4}\langle 0 | 1\rangle + \frac{\sqrt{3}}{4}\langle 1 | 0\rangle}_{=0} \\ +&= -\frac{1}{2} \\ +& \Longrightarrow |\langle \psi_1 | \psi_2\rangle|^2 = \left( \frac{-1}{2} \right)^2 = \frac{1}{4} +\end{align*}

+

Please tell me if there is something you don't understand in this, I hope this helps ! :)

+",12396,,,,,12/23/2020 9:02,,,,1,,,,CC BY-SA 4.0 +15243,2,,15240,12/23/2020 10:47,,1,,"
    +
  1. Add this code to your current code. +This creates a simulator backend with the noise model from ibmq_16_melbourne.
  2. +
+
from qiskit.providers.aer import QasmSimulator
+
+provider = IBMQ.load_account()
+ibmq_melbourne = provider.get_backend('ibmq_16_melbourne')
+backend = QasmSimulator.from_backend(ibmq_melbourne)
+
+print(random_bitstring_generator(1024, backend))
+
+
    +
  1. Your output is already a string. If you want to dump that in a file, you can do this (this is a general Python question, not related to Qiskit:
  2. +
+
with open("output.txt", "w") as text_file:
+    text_file.write(random_bitstring_generator(1024, backend))
+
+
+

Note: +If you are trying generate a random number generator, probably you should have a look to qiskit.providers.ibmq.random.

+",1859,,,,,12/23/2020 10:47,,,,0,,,,CC BY-SA 4.0 +15244,2,,14688,12/23/2020 11:09,,2,,"

Short Answer: There is no universal gate that can entangle the output state for any given ? and ??? operators in the circuit given in the question.

+

Long Answer:

+

Say you have the entangle state $|\psi\rangle = \alpha |00\rangle + \beta |11\rangle$ before applying the ??? operator. Let the ??? operator correspond to the matrix $M = \begin{bmatrix}m_1 & m_2 \\ m_3 & m_4\end{bmatrix}$. So once you apply $M$ on the first qubit of $|\psi\rangle$, you get the state $$\hat{|\psi\rangle} = (M\otimes I)|\psi\rangle = \alpha(m_1|0\rangle + m_3|1\rangle)|0\rangle + \beta(m_2|0\rangle + m_4|1\rangle)|1\rangle.$$ Now, we need an operator $U$ that acts on the second qubit of $\hat{|\psi\rangle}$ to give us a state of the form $|\psi'\rangle = \alpha' |00\rangle + \beta' |11\rangle$. Let $U = \begin{bmatrix}u_1 & u_2 \\ u_3 & u_4\end{bmatrix}$. The operation of $U$ on the second qubit of $\hat{|\psi\rangle}$ can be given as $$\begin{align}(I \times U)\hat{|\psi\rangle} &= \big[\alpha(m_1|0\rangle + m_3|1\rangle)(u_1|0\rangle + u_3|1\rangle)\big] + \big[\beta(m_2|0\rangle + m_4|1\rangle)(u_2|0\rangle + u_4|1\rangle)\big] \\ +&= (\alpha~m_1 u_1 + \beta~m_2u_2)|00\rangle + (\alpha~m_1 u_3 + \beta~m_2u_4)|01\rangle\\ +& ~~~~+ (\alpha~m_3 u_1 + \beta~m_4u_2)|10\rangle + (\alpha~m_3 u_3 + \beta~m_4u_4)|11\rangle \end{align}$$

+

Now, notice that if the operator $U$ is such that the amplitudes of $|01\rangle$ and $|10\rangle$ are zero then we achieve an entangled state. Mathematically, we need $$\alpha~m_1 u_3 + \beta~m_2u_4 = 0 ~~\text{ and }~~ \alpha~m_3 u_1 + \beta~m_4u_2 = 0\tag{1}\label{eqn:1}.$$

+

It is a well known fact that any single qubit operator $A$ can be represented as $A = \begin{bmatrix}\cos{(\theta/2)} & -e^{i\lambda}\sin{(\theta/2)}\\ e^{i\phi}\sin{(\theta/2)} & e^{i(\lambda+\phi)}\cos{(\theta/2)}\end{bmatrix}$ (For more information on this check $U_3$ gates.) Using this notation we can write the operators $M$ and $U$ as $$M = \begin{bmatrix}\cos{(\theta_m/2)} & -e^{i\lambda_m}\sin{(\theta_m/2)}\\ e^{i\phi_m}\sin{(\theta_m/2)} & e^{i(\lambda_m+\phi_m)}\cos{(\theta_m/2)}\end{bmatrix} \text{ ; } U = \begin{bmatrix}\cos{(\theta_u/2)} & -e^{i\lambda_u}\sin{(\theta_u/2)}\\ e^{i\phi_u}\sin{(\theta_u/2)} & e^{i(\lambda_u+\phi_u)}\cos{(\theta_u/2)}\end{bmatrix}$$

+

Using this notation and solving for the first equation of ($\ref{eqn:1}$), we get $$\alpha~m_1u_3 + \beta~m_2u_4 = 0 \iff \alpha\cos{(\theta_m/2)}\sin{(\theta_u/2)} = e^{i(\lambda_m+\lambda_u)}\beta\sin{(\theta_m/2)}\cos{(\theta_u/2)} \tag{2}\label{eqn:2}$$ +Similarly for the second equation of ($\ref{eqn:1}$), we get $$\alpha~m_3u_1 + \beta~m_4u_2 = 0 \iff \alpha\sin{(\theta_m/2)}\cos{(\theta_u/2)} = e^{i(\lambda_m+\lambda_u)}\beta\cos{(\theta_m/2)}\sin{(\theta_u/2)}\tag{3}\label{eqn:3}$$

+

So if you apply an operator $U$ that satisfies the conditions ($\ref{eqn:2}$) and ($\ref{eqn:3}$), then the final state will still be an entangled state of the form $\alpha'|00\rangle + \beta' |11\rangle$. If any gate that violates ($\ref{eqn:2}$) and ($\ref{eqn:3}$) is applied to the circuit, then you will not get an entangled state of the form $\alpha'|00\rangle + \beta' |11\rangle$. Hence you will need to know the ? and the ??? gates to get the output in the form $\alpha'|00\rangle + \beta' |11\rangle$ with certainty.

+",9097,,,,,12/23/2020 11:09,,,,0,,,,CC BY-SA 4.0 +15245,2,,15235,12/23/2020 11:14,,3,,"

Deutsch-Jozsa algorithm is about classifying an oracle $f$ as constant/balanced. The complexity of executing the oracle $f$ itself is not directly relevant for that classification. What it is relevant is how many executions of the oracle $f$ are needed to answer the constant/balanced question.

+

An example: Let's take an $f$ with $n=2$. You don't know it yet, but $f$ is defined as the classical XOR gate, therefore it is balanced. You need, classically, to execute $f$ 3 times ($2^{{n-1}}+1$, in the general case) with different inputs in order to have enough information to know that is balance. In contrast, a quantum implementation needs a single execution. Note that the fact that XOR is linear does not play a role here.

+",1859,,1859,,12/23/2020 21:50,12/23/2020 21:50,,,,1,,,,CC BY-SA 4.0 +15246,1,,,12/23/2020 12:46,,1,83,"

+

+

I uploaded a CSV file using import in Quantum Computing Lab folder. It is uploaded, I can see it. When I write "import filename" in my notebook, it shows an error. +I have tried doing the same in my local PC. It is working fine. +What am I doing wrong? Is there any other way to upload a CSV file and use it?

+",14245,,55,,12/25/2020 23:38,12/25/2020 23:38,I am uploading a CSV file but cannot access it in the notebook,,2,4,,12/28/2020 13:38,,CC BY-SA 4.0 +15247,2,,13794,12/23/2020 14:39,,-1,,"

There is another technique to prove the BELL STATE MEASUREMENT. +

+",14137,,,,,12/23/2020 14:39,,,,1,,,,CC BY-SA 4.0 +15248,2,,15221,12/23/2020 14:39,,2,,"

Before introducing quantum machine learning, I strongly suggest that understanding important algorithms like Grover search and quantum Fourier transformation might be critical subroutines for quantum machine learning algorithms. So, if you are not quite familiar with quantum computing, some of the quantum machine learning algorithms might be confusing.

+

This interesting thesis P. Shor has written is recommended. In this paper, Shor proposed three major directions that quantum computing might provide speedup. We can categorize the quantum machine learning into the direction that polynomial speedup for P problems.

+

There are branches of studies combining machine learning and quantum computing. They can be mainly divided into 2 parts: quantum computing implementation of machine learning algorithms(in this phase, some of the features may not be identical) and machine learning methods to facilitate quantum computing. What you are asking seems more likely the first parts, thus I'll focus on that while the 2nd part will be mentioned).

+

When implementing machine learning algorithms on a quantum computer, the classical computer is absolutely needed(to control the quantum operation, e. g., turn on or turn off a specific laser pulse, and maybe data processing, e. g., to analyze the statics of the measurement results).

+

Sometimes the quantum computer(or the quantum annealer) might only be a subroutine. For example, this Lockheed Martin research used quantum annealing to do the Gibbs sampling(they used their D-Wave quantum annealer to train a deep belief network, composed of 4 restricted Boltzmann machines, and the database is a coarse-grained MNIST), and compared with the conditional method, the contrastive divergence(CD), there is a significant improvement. Since after the Gibbs sampling(either quantum annealing or CD), fine-tuning the weight is still needed, so the quantum computing in this work is a subroutine.

+

Then I move on to works that quantum computing plays most of the job, supervised and unsupervised learning are both contained.

+

For supervised learning, first, let's talk about the neural network. The multi-layer and multi-node structure of the neural network enables it to deal with multiple hidden structures while the non-linear activation function makes the learning of the non-linear phenomenon possible. So this contradicts quantum mechanics tremendously since the quantum mechanics should be linear(there are also suggestions that the attenuation of light is non-linear and thus optical quantum computer might provide this ability, see the later cited paper). And in the meantime, the adjustment of the weights( the weights can be expressed as unitary operations) following the formula $\hat w_j(t+1)=\hat w_j(t)+\eta(|d\rangle-|y(y)\rangle)\langle x_j|$ isn't unitary-preserving since matrices composed of the addition of unitary matrices may not be unitary, see this paper as the reference. So I think using a quantum neural network to classify classical data, like MNIST, is impossible.

+

But on the contrary, there are also quantum data. Quantum data is something like unitary matrices that describe quantum states, and thus pairs of density matrices may depict an unknown quantum operation $|\psi\rangle\langle\psi|=U|\phi\rangle\langle\phi|U^\dagger$. A quantum neural network is sufficient to learn the unknown operation, and but it is inefficient(no faster than an already inefficient quantum process tomography).

+

For both supervised and unsupervised learning, this paper gives some analysis. The paper introduced algorithms for quantum k-NN and quantum support vector machine and the main speedup is to accelerate the calculation of classical distances. In the meantime, this paper gives a handful of algorithms that teaches you how to use Grover search to faster the unsupervised algorithms.

+

There is also the quantum mechanical implementation of decision tree algorithms(see this paper). The method may be peculiar for beginners, it is the quantum random walk(although it is the quantum generalization of random walk, I still think these two are not alike).

+

Finally, machine learning facilitated quantum computing. First, there is a recent study that utilizes a machine learning algorithm(I haven't seen the paper so I do not know which algorithm they used) to achieve a Toffoli gate with higher fidelity. This work is called CRAB, it accepts multiple methods to optimize the quantum control of real quantum experiments, the gradient descent(BFGS, BGD) is included.

+

The above is all I know, and I hope this might be helpful.

+",13647,,13647,,12/24/2020 1:07,12/24/2020 1:07,,,,1,,,,CC BY-SA 4.0 +15249,1,,,12/23/2020 15:48,,3,984,"

Edit/summary

+

Everything below this first paragraph is my original question posted several days ago and involves a lot of speculating on a problem I knew less about at the time. The purpose of this first paragraph is mainly to rephrase my question more concisely in light of what I have learned since then. In summary, I had this issue where most code would run fine, except certain code in Qiskit seemed to run unreasonably slowly on the M1 architecture. I was not sure if this was due to Qiskit or one of its dependencies. I was able to track down that it is fermion to qubit operator mapping functions (and anything that utilizes them in any way, such as the UCCSD ansatz variation form) that run slowly. Everything else that I have checked seems to run fine. When I track the performance of lines of code involving these functions with time.perf_counter() and time.process_time(), the perf_counter time will be several times that of process_time, indicating to me that for some reason, the total program run time is much longer than the actual CPU processing time for these specific functions. For Intel-based machines, these two time measures are roughly the same, with perf_counter usually being a fraction of a second more. For code run on the M1 for which there are no run time issues, these two time measures are also roughly the same. Why this happens is a mystery to me and I would be interested in finding out why this happens, if this issue occurs for other functions, and if we can expect this to improve with future versions of Qiskit and other Python open source packages where this problem might also occur. The thing I plan to do next is to see if such fermion to Qubit operator mapping problems happen for other open source quantum computing packages such as OpenFermion as well.

+

Original Question:

+

Recently I upgraded my laptop and got a MacBook Pro with the M1 chip and have been playing around with Qiskit and other python code to make sure that everything runs fine so that I can make an informed decision as to whether or not I should return it. The first thing I did with this machine was to install the latest version of Anaconda, PySCF, and Qiskit. I have been going through the tutorials on the Qiskit documentation site. Everything has been working fine, until I tried to run the noiseless part of the code provided at:

+

https://qiskit.org/documentation/tutorials/algorithms/03_vqe_simulation_with_noise.html

+

If I run this code on the Jupiter notebooks provided by Anaconda, it takes about 10 minutes to finish and activity monitor indicates it uses about 30% of the CPU load on my computer. If I run the same code on the Jupyter notebooks provided by the IBM Quantum Experience Quantum Lab, it finishes in less than a minute and uses up no noticeable load on my CPU. The main bottleneck of this code seems to be on the line:

+

result = vqe.compute_minimum_eigenvalue(operator=H2_op)

+

If I change the backend from qasm_simulator to statevector_simulator, the code completes almost instantaneously. I have also tried running a code I wrote several months ago that calculates the dissociation curves of the first few energy levels of H2 using the QEOM algorithm provided by Qiskit. For both the qasm and statevector simulator backends, the code is painfully slow. For comparison, I ran it on my 2013 MacBook Pro and it was about 30 times faster than the 2020 M1.

+

I have my suspicions as to why this is, but I would like to find out exactly what the issue is. There appears to be no explicit compatibility issues. The python packages install fine and the code will run, but some code seems to run extremely slowly. My understanding is that Python 3.9.1rc1 is optimized for Apple silicon chips, but 3.9.0 and all other previous versions are not and have to use Rosetta 2:

+

https://www.python.org/downloads/release/python-391rc1/

+

The latest version of Anaconda seems to use python 3.8.5, probably because not all of the packages that it comes with are compatible with python 3.9.0 or 3.9.1rc1 yet. Is optimization the issue here or is it something else? If so, can we expected Anaconda to be updated to python 3.9.1rc1 in the near future? If this is the case, I can probably just be patient and wait it out since the IBM Quantum Experience Jupyter notebook servers seem to do the job just fine. (Maybe the code here is run on an external server and this is why, but I'm not sure.) Is the problem something with the backends in Qiskit or with one of the dependencies that variational algorithms in Qiskit use such as the Scipy optimizers? Are there any tests that I could run to find out exactly which packages are the problem? So far the only issues I have found involve variational algorithms on Qiskit, but I will keep searching.

+

Samples of code

+

Below are examples of code taken from the Qiskit tutorials where I seem to have this problem. Code involving Aer not involving chemistry classical and quantum eigenvalue problems seem to not have this problem.

+
from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule
+from qiskit.chemistry.transformations import FermionicTransformation, FermionicQubitMappingType
+from qiskit import BasicAer
+from qiskit.aqua import QuantumInstance
+from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory
+from qiskit.chemistry.algorithms.ground_state_solvers import GroundStateEigensolver
+import time
+
+toc = time.perf_counter()
+molecule = Molecule(geometry=[['H', [0., 0., 0.]],
+                              ['H', [0., 0., 0.735]]],
+                     charge=0, multiplicity=1)
+driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')
+transformation = FermionicTransformation(qubit_mapping=FermionicQubitMappingType.JORDAN_WIGNER)
+vqe_solver = VQEUCCSDFactory(QuantumInstance(BasicAer.get_backend('statevector_simulator')))
+
+calc = GroundStateEigensolver(transformation, vqe_solver)
+toc = time.perf_counter()
+res = calc.solve(driver)
+tic = time.perf_counter()
+print('program completed in {} seconds'.format(tic-toc))
+
+
from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule
+from qiskit.chemistry.transformations import FermionicTransformation, FermionicQubitMappingType
+from qiskit.aqua.algorithms import NumPyMinimumEigensolver
+import time
+
+molecule = Molecule(geometry=[['H', [0., 0., 0.]],
+                              ['H', [0., 0., 0.735]]],
+                     charge=0, multiplicity=1)
+driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')
+transformation = FermionicTransformation(qubit_mapping=FermionicQubitMappingType.JORDAN_WIGNER)
+
+numpy_solver = NumPyMinimumEigensolver()
+
+calc = GroundStateEigensolver(transformation, numpy_solver)
+toc = time.perf_counter()
+res = calc.solve(driver)
+tic = time.perf_counter()
+print('program complered in {} seconds'.format(tic-toc))
+
+

Tests

+

I have run this code on my M1 laptop, 2013 Intel-based laptop, and the IBM Jupyter servers and have used both time.perf_counter() and time.process_time() to track the performance of code on all three machines. On code where the M1 performs fine, these times are roughly the same on all three machines, but on code where the M1 appears to not perform well, perf_counter will be several times that of process_time on the M1. (e.g. CPU time roughly 0.7 seconds and total time 20 seconds for the first code given above) It appears that for certain code in Qiskit, the majority of the time taken to complete the code is spent on something other than CPU processing time and I do not know why. I don't have any other computational tasks going on in the background and CPU load is only about 3% or so when I'm not running code, so I do not think something like having lots of tabs open is responsible for this.

+",14247,,15775,,9/2/2021 19:08,9/2/2021 19:08,Qiskit issues with Apple Silicon?,,1,6,,,,CC BY-SA 4.0 +15251,1,,,12/23/2020 18:22,,0,520,"

So I am reading this book and I found this worked out example which I didn't get. If you understand these bits of pieces, can you please let me know.

+

Question: +

+

Answer: +

+

+
    +
  1. Why is there two H over here? I thought it would be just H * Cnot?
  2. +
  3. Where from do we get these representations?
  4. +
+

+",13763,,,,,1/24/2021 3:02,Explanation of NOT gate in Hadamard basis,,2,2,,1/25/2021 12:15,,CC BY-SA 4.0 +15252,2,,15251,12/23/2020 19:48,,4,,"

If $\left|\psi\right> = \alpha \left|0\right> + \beta \left|1\right>$, then $\alpha = \left<0|\psi\right>$ and $\beta = \left<1|\psi\right>$. A 1-qubit unitary operator can be written as $U = a\left|0\right>\left<0\right| + b\left|0\right>\left<1\right| + c\left|1\right>\left<0\right| + d\left|1\right>\left<1\right|$ and this will correspond to a matrix $\begin{pmatrix}a & b\\c & d\end{pmatrix}$: to see this, notice that through the projection form $U \left|\psi\right> = (a \left<0|\psi\right> + b \left<1|\psi\right>)\left|0\right> + (c\left<0|\psi\right> + d\left<1|\psi\right>)\left|1\right>$. To get the values of the matrix out of $U$ and bras and kets of the computational basis states, notice $U\left|0\right> = a\left|0\right> + c\left|1\right>$ and $U\left|1\right> = b\left|0\right> + d\left|1\right>$: from this, the general matrix form can be given as $U = \begin{pmatrix}\left<0\right|U\left|0\right> & \left<0\right|U\left|1\right> \\\left<1\right|U\left|0\right> & \left<1\right|U\left|1\right> \end{pmatrix}$: this gives the answer to your second question when $X$ is said operator.

+

For the other question, if $T = \begin{pmatrix}\left<+|0\right> & \left<+|1\right> \\\left<-|0\right> & \left<-|1\right> \end{pmatrix}$, then an operator $U$'s form in the new basis is given by $U^T = \begin{pmatrix}\left<+\right|U\left|+\right> & \left<+\right|U\left|-\right> \\\left<-\right|U\left|+\right> & \left<-\right|U\left|-\right> \end{pmatrix}$, and it represents the operation's matrix when $\left|+\right>$ and $\left|-\right>$ are treated as $\begin{pmatrix}1 \\0\end{pmatrix}$ and $\begin{pmatrix}0 \\ 1\end{pmatrix}$ instead of $\left|0\right>$ and $\left|1\right>$. Then, $U^T = T U T^{-1}$ since $T^{-1}$ turns the representation in terms of the new basis back to its representation in the computational basis, $U$ runs the operator in the computational basis, and then $T$ converts it back to the new basis. As stated in the text, $H$ is its own inverse, so $H U_{NOT}H^{-1} = HU_{NOT}H$.

+",7680,,7680,,12/23/2020 23:53,12/23/2020 23:53,,,,5,,,,CC BY-SA 4.0 +15253,1,15269,,12/23/2020 20:00,,7,282,"

If I look at the circuit diagram of the Deutsch–Jozsa Algorithm:

+

+

Now given the fact that Hadamard matrix or gate is its own inverse (see here), shouldn't the output (top wire) simply give back $|0\rangle$?

+",14251,,9006,,12/24/2020 7:41,12/25/2020 2:42,Why isn't output of Deutsch–Jozsa Algorithm simply $|0\rangle$?,,5,0,,,,CC BY-SA 4.0 +15254,2,,15253,12/23/2020 20:25,,3,,"

Not really. You can't cancel the H gates on the first qubit because the order of gates matters. Similiar to matrix multiplication, ABC is not equal to ACB.

+",13209,,,,,12/23/2020 20:25,,,,0,,,,CC BY-SA 4.0 +15255,1,,,12/23/2020 22:33,,1,44,"

We know that for the last step of QRNG: we need to separate quantum and classical noises from each other so we use extractors, after extractor we need privacy amplification step. At this point: +if extractor is a strong extractor we can use it as a privacy amplification too. However I could not understand differences between extractor and privacy amplification. If I use the strong extractor for the second time, will I be able to complete my privacy amplification step? +What will change in privacy amplification? +If what happens, privacy amplification will be completed? +Thanks

+",13548,,13548,,1/1/2021 19:36,1/1/2021 19:36,Differences between Extractors and Privacy Amplification for Quantum Random Generators,,0,0,,,,CC BY-SA 4.0 +15256,2,,15253,12/23/2020 23:46,,7,,"

This is because of what known as Phase kickback.

+

+

The phase of the bottom qubit can kick back and create a relative phase change on the top qubit. This is a very useful and often use trick in quantum computing. In fact, it is fundamental to the Quantum Phase Estimation algorithm.

+",9858,,,,,12/23/2020 23:46,,,,2,,,,CC BY-SA 4.0 +15257,2,,15235,12/23/2020 23:57,,7,,"

Following up on @luciano's answer, I think you are envisioning a quantum computer as being fast at evaluating functions, when in actuality, quantum computers are better at evaluating global properties of functions (and not, necessarily, the function themselves.)

+

For example referring to the Deutsch-Jozsa problem, consider two separate bags containing Boolean functions on $n$ variables.

+
    +
  • In one bag (called "constant") we put in the $2$ functions that either evaluate to $0$ for all $2^n$ inputs, or to $1$ for all $2^n$ inputs; and
  • +
  • In another bag (called "balanced") we put in the functions that evaluate to $0$ for precisely $2^{n-1}$ inputs (and $1$ otherwise).
  • +
+

If we were to scramble the bags and choose a random function, classically we'd have to evaluate the function a couple of times (and worse-case up to $2^{n-1}+1$ times) to know from which bag we grabbed our function. But following the Deutsch-Jozsa algorithm, we only need to evaluate the function once on a quantum computer.

+

This "balanced" vs. "constant" property is a global property of the functions, closer to what a Fourier transform evaluates.

+

ADDED

+

There are $2^{2^n}$ individual Boolean functions with $n$ inputs and $1$ output. However, of all of these, there is only $1$ function on $n$ variables that performs the $\mathsf{AND}$ of all inputs (namely the $\mathsf{AND}$ function), and only $1$ that performs the $\mathsf{XOR}$ of all inputs (namely the $\mathsf{XOR}$ function).

+

Furthermore it's hard to get one's head around the size of the problems to which quantum algorithms provide a significant speedup. But it's my understanding that there's a theorem (modulo a lot of asterisks and extra hypothesis and other details) that the one weird trick that quantum computers can do that classical computers cannot is to quickly take a Fourier transform of the output of some function, and sample the Fourier transform with a probability given by the (square of the) amplitude of the FT. The Deutsch-Jozsa algorithm determines whether the "DC component" of the FT is large ("constant") or small ("balanced").

+",2927,,2293,,4/16/2021 23:01,4/16/2021 23:01,,,,1,,,,CC BY-SA 4.0 +15258,1,15259,,12/24/2020 1:41,,2,453,"

Let's assume that the quantum state of the system is written in a standard basis {$|0\rangle, |1\rangle$} and when we performed a measurement we got $|0\rangle$ as an outcome of measurement so we ensure that the system will be in state $|0\rangle$ after measurement even if we make this measurement (in this basis) many times.

+

My question is, how we get something else than $|0\rangle$ {$|+\rangle$ or $|-\rangle$} when we are measuring in different basis {$|+\rangle, |-\rangle$} despite we didn't change the system?

+",14252,,14252,,1/1/2021 23:42,1/1/2021 23:42,How does the outcome of measurement of a qubit change when we use different basis despite the system hasn't changed?,,1,7,,12/29/2020 23:50,,CC BY-SA 4.0 +15259,2,,15258,12/24/2020 3:01,,4,,"

It is a postulate of quantum mechanics that any device that measures a two-state quantum system (a qubit) must have two preferred states $\{|e_1\rangle, |e_2\rangle \}$ that form an orthonormal basis for the associated vector space (here would be $\mathbb{C}^2$).

+

A measurement on the state $|\psi\rangle$ transforms $|\psi\rangle$ into one of the these basis vectors $|e_1 \rangle$ or $|e_2\rangle$. The probability that the state $|\psi\rangle$ is measured as $|e_1\rangle$ or $|e_2\rangle$ is the square of the magnitude of the amplitude of the component of the state in the direction of the basis vector $|e_1\rangle$ or $|e_2\rangle$ . Hence the name projection.

+

+

If you are in the state $|+\rangle$ and your measurement is in the computational basis, $\{ |0\rangle, |1\rangle \}$, then the probability of observing the state $|0\rangle$ is the magnitude square of the component of the projected vector. When you project the vector $|+\rangle$ onto the vector $|0\rangle$ you get the vector $\dfrac{1}{\sqrt{2}}|0\rangle$. Thus the probability of observing the state $|0\rangle$ is $|1/\sqrt{2}|^2 = \dfrac{1}{2}$. Similarly, $|+\rangle$ can be projected to $|1\rangle$ and the resultant vector is $\dfrac{1}{\sqrt{2}}|1\rangle$, hence the probability of observing $|1\rangle$ is also $\dfrac{1}{2}$.

+

However, if you measure in the basis $\{|+\rangle, |-\rangle \}$ then the projection of $|+\rangle$ onto itself is itself. That is $|+\rangle$ will be just transforms to $|+\rangle$. Thus the probability of observing $|+\rangle$ as $|+\rangle$ in the basis $\{|+\rangle, |-\rangle \}$ is 1.

+

From here we can see that the notion of superposition is basis-dependent. All states are superposition with respect to some bases but not with respect to others. That is, a state $|\psi \rangle = \alpha |0\rangle + \beta |1\rangle$ is only a superposition with respect to the computational basis $\{|0\rangle, |1\rangle \}$ but not a superposition with respect to the bases $\{ \alpha |0\rangle + \beta |1\rangle, \beta^* |0\rangle - \alpha^* |1\rangle \}$.

+

Since measuring a superposition state $|\psi \rangle = \alpha |0\rangle + \beta |1\rangle$ is probabilisitc, it is tempted to say that the state $|\psi \rangle$ is a probabilistic mixture of $|0\rangle$ and $|1\rangle$ and we just don't know which, when in fact, $|\psi \rangle$ is actually a definite state. That is, if we measure $|\psi\rangle$ in certain bases, we will get a deterministic result.

+",9858,,,,,12/24/2020 3:01,,,,2,,,,CC BY-SA 4.0 +15260,2,,15253,12/24/2020 7:38,,3,,"

Just to add that the Oracle in the algorithm causes entanglement among first $n$ qubits and the last one. As you can see, the last qubit is in state $f(x) \oplus y$.This means that it is influenced by values of first $n$ qubits. As a result these qubits are also influenced by the last qubit. So, despite the double application of Hadamard, also first $n$ qubits contains information about the last qubit.

+",9006,,,,,12/24/2020 7:38,,,,0,,,,CC BY-SA 4.0 +15261,2,,15253,12/24/2020 8:37,,2,,"

This answer is a little supplementation of @Martin Vesely.

+

It has been proven that "it is not possible to build a fixed, general quantum computer which can be programmed to perform an arbitrary quantum computation" by this paper.

+

To be more specific, suppose $|d\rangle$ is a data register $|P\rangle$ is a program(control) register, and denote the quantum program, which is a unitary operation act on both $|d\rangle$ and $|P\rangle$, by $\hat G$, there is not general guarantee that $\hat G(|d\rangle\otimes|P\rangle)=(\hat U|d\rangle)\otimes|P\rangle$ is possible, where $\hat U$ acts solely on $|d\rangle$.

+

If the $U_f$ is your question is such a quantum program $\hat G$(the upper qubit is the program register in your case), then the repeated implementation of Hadamard gate can cancel each other at last, but apparently, this is not the case.

+",13647,,,,,12/24/2020 8:37,,,,0,,,,CC BY-SA 4.0 +15262,1,15296,,12/24/2020 14:44,,3,233,"

I am following Preskill notes.

+

What I want to understand is why it is in general enough to be able to correct n-qubit Pauli errors to say that an arbitrary error can be corrected.

+

I call: $\mathcal{M}(\rho)=\sum_a M_a \rho M_a^{\dagger}$ an error map, $C$ the code space.

+

A CPTP recovery operation exists if and only if, the Kraus operator of the error map verify the Knill-Laflamme condition:

+

$$\forall (i,j) \in C : \langle \overline{i} | M_{\delta}^{\dagger} M_{\mu} | \overline{j} \rangle = C_{\delta \mu} \delta_{ij}$$

+

With $C_{\delta \mu}$ an Hermitian matrix and $\langle \overline{i} | \overline{j} \rangle=\delta_{ij}$ (the family $| \overline{i} \rangle$ forms an orthonormal basis of $C$).

+

My question

+

From this condition, and the fact any Kraus operator can be decomposed as a sum of n-qubit Pauli matrices, Preskill seem to say that it shows that if one is able to correct against Pauli error it is able to correct against an arbitrary error (that verifies Knill Laflamme condition of course).

+

I call $\mathcal{E}$ the set of n-qubit Pauli operators on which we can decompose any of the $M_a$'s.

+

He says on page 10, just below (7.26)

+

"since each $E_a$ in $\mathcal{E}$ is a linear combination of $M_{\mu}$'s, then"

+

$$\forall (i,j) \in C: \langle \overline{i} | M_{\delta}^{\dagger} M_{\mu} | \overline{j} \rangle = C_{\delta \mu} \delta_{ij} \Rightarrow \forall (i,j) \in C: \langle \overline{i} | E_{a}^{\dagger} E_{b} | \overline{j} \rangle = C_{ba} \delta_{ij}$$

+

And I don't understand this. I could imagine $\mathcal{M}(\rho)=U \rho U^{\dagger}, U \notin \mathcal{E}$ (a unitary error that is not strictly a Pauli one). Wouldn't this be a counter example in which the Pauli matrix on which the error can be decomposed cannot in turn be expressed in function of Kraus operator.

+

To say things more shortly: is there an easy way to show that if one is able to correct Pauli error we can show it is equivalent to Knill Laflamme condition?

+",5008,,10480,,12/25/2020 16:34,12/27/2020 10:06,Arbitrary error correctable iff Pauli error are: misunderstanding from Preskill notes,,1,3,,,,CC BY-SA 4.0 +15263,1,,,12/24/2020 15:09,,4,52,"

Context of my question

+

I call: $\mathcal{M}(\rho)=\sum_a M_a \rho M_a^{\dagger}$ an error map, $C$ the code space.

+

A CPTP recovery operation exists if and only if, the Kraus operator of the error map verify the Knill-Laflamme condition:

+

$$\forall (i,j) \in C : \langle \overline{i} | M_{\delta}^{\dagger} M_{\mu} | \overline{j} \rangle = C_{\delta \mu} \delta_{ij}$$

+

With $C_{\delta \mu}$ an Hermitian matrix and $\langle \overline{i} | \overline{j} \rangle=\delta_{ij}$ (the family $| \overline{i} \rangle$ forms an orthonormal basis of $C$).

+

From this condition we can distinguish two cases:

+
    +
  • Non degenerated quantum code: $C_{\delta \mu}=\delta_{\delta \mu}$
  • +
  • Degenerated quantum code otherwise
  • +
+

Additional remarks

+

There always exist a set of Kraus operator such that $C_{\delta \mu} = C_{\delta} \delta_{\delta \mu}$: using the freedom to choose the Kraus we can show that diagonalizing $C$ on the rhs, is equivalent to take another set of equivalent Kraus operator on the lhs. I can edit with the derivation if necessary but it is really just a matter of writing the thing. Thus for any map $\mathcal{M}$, we can in principle have a set of Kraus satisfying:

+

$$\forall (i,j) \in C : \langle \overline{i} | M_{\delta}^{\dagger} M_{\mu} | \overline{j} \rangle = C_{\mu} \delta_{\delta \mu} \delta_{ij}$$

+

The distinction between degenerated and non degenerated can then be rephrased as:

+
    +
  • Non degenerated quantum code: $C_{\mu}=1$
  • +
  • Degenerated quantum code otherwise
  • +
+

My question

+

Because of this last remark, it shows that there always exist a set of Kraus operator such that an error map satisfying Knill-Laflamme condition would bring two different codeword to two orthogonal subspace (we can generalize by linearity to any two vector living in $C$).

+

Thus for me what remains is that the "conceptual" difference between degenerated and non degenerated code is that:

+

Whatever the Kraus we use to represent the map, each Kraus of a non degenerated code will always put two different error into two orthogonal subspace.

+

For degenerated code it is not always the case but there exists a set of Kraus such that it is the case. And for those the difference is that the length of the vector will be modified in a different manner for each different kind of Kraus.

+

Would you agree ?

+

Can we give a physical meaning to this change in length when we work with "the good Kraus" for degenerated code ?

+",5008,,,,,12/24/2020 15:09,Degenerated vs non degenerated code: for both there always exist Kraus bringing to different orthogonal subspaces?,,0,0,,,,CC BY-SA 4.0 +15264,2,,15210,12/24/2020 17:23,,0,,"

Contrary to what you have mentioned in the question, when you use a $u_3$ gate, Qiskit does not break it up into multiple gates. In fact $u_3$ gate is one of the basis gates for all Qiskit backends and all the single qubit gates are ultimately implemented as $u_1, u_2$ or $u_3$ gates (You can check more about those gates here). Since $u_3$ gate is the most generalized single qubit gate, using $u_3$ gates in place of the $I$ gates will give you more freedom to vary you input to the $CNOT$ gate.

+",9097,,,,,12/24/2020 17:23,,,,1,,,,CC BY-SA 4.0 +15265,2,,15246,12/24/2020 17:35,,0,,"

So I went to the IBM Quantum Experience to download a calibration data for Valencia just to have csv file. +

+

Then I was able to read it in the Jupyter notebook through the IBM Quantum Lab environment as shown below:

+

+",9858,,,,,12/24/2020 17:35,,,,0,,,,CC BY-SA 4.0 +15266,2,,15199,12/24/2020 19:37,,0,,"

If you recall from the analysis of Grover's algorithm, if the success probability of obtaining an item of interest is $\sin^2(\theta)$ just before a Grover iteration, then just after one iteration of Grover's iterate the probability of obtaining an item of interest goes from $\sin^2(\theta)$ to $\sin^2(3\theta)$.

+

Now in the case in the question, you mark $6$ out of $8$ items, i.e., you have $6$ items of interest out of the total $8$ elements. So the probability of obtaining an item of interest on measurement is $\sin^2(\theta) = \frac{6}{8} = \frac{3}{4}.$ So we get $\theta = \sin^{-1}{\sqrt{\frac{3}{4}}} = \frac{\pi}{3}$ in radians. Then after one iteration of Grover's algorithm, the success probability of obtaining an item of interest becomes $\sin^2(3\cdot \frac{\pi}{3}) = 0$. In such a scenario, if you measure the state obtained after one iteration of Grover's iterate, you would not see any item of interest. Notice that this is exactly as remarked in the question. After one iteration, you see none of the $6$ elements that you have marked.

+",9097,,,,,12/24/2020 19:37,,,,0,,,,CC BY-SA 4.0 +15267,2,,15199,12/24/2020 20:18,,2,,"

This is a well known behavior of Grover's algorithm. +It is described in "Quantum Computation and Quantum Information" book under section 6.1.4

+
+

[...] the number of iterations needed by the search algorithm +increases with $M$, for $M ≥ N/2$. Intuitively, this is a silly property +for a search algorithm to have: we expect that it should become easier +to find a solution to the problem as the number of solutions +increases.

+
+

You will find also a workaround for this issue:

+
+

[...] by adding a single qubit $|q\rangle$ to the search index, doubling the number +of items to be searched to $2N$. A new augmented oracle $O'$ is +constructed which marks an item only if it is a solution to the search +problem and the extra bit is set to zero.

+
+",9474,,,,,12/24/2020 20:18,,,,0,,,,CC BY-SA 4.0 +15268,2,,13880,12/24/2020 22:15,,2,,"

There are no effective bounds on how small or how large the smallest non-zero eigenvalue can become upon taking the partial trace, other than the obvious constraint that it must be in $(0, 1]$.

+
+

Let $\lambda_{min}(\rho)$ denote the smallest non-zero eigenvalue of operator $\rho$.

+

Fix a real $p \in (0, \frac{1}{2}]$ and consider the pure two-qubit state

+

$$ +|\psi\rangle = \sqrt{p}|00\rangle + \sqrt{1 - p}|11\rangle. +$$

+

Note that $\rho_{AB} = |\psi\rangle\langle\psi|$ has eigenvalues $0, 0, 0, 1$ so $\lambda_{min}(\rho_{AB}) = 1$.

+

On the other hand,

+

$$ +\rho_A = \mathrm{tr}_B(\rho_{AB}) = p|0\rangle\langle 0| + (1 - p)|1\rangle\langle 1| +$$

+

has eigenvalues $p, 1 - p$ and so $\lambda_{min}(\rho_A) = p$.

+

Consequently, not only can partial trace decrease the value of $\lambda_{min}$ (as already noted in the comments), but there is no positive lower bound on $\lambda_{min}(\mathrm{tr}_B\rho)$. More precisely, for any $\epsilon > 0$ we can find a state $\rho_{AB}^\epsilon$ such that $\lambda_{min}(\rho_{AB}^\epsilon) = 1$ yet $\lambda_{min}(\mathrm{tr}_B \rho_{AB}^\epsilon) = \epsilon$.

+
+

In order to find a bound on how much larger the smallest non-zero eigenvalue can become after taking the partial trace, fix a real $p \in (0, \frac{1}{2}]$ and consider the state

+

$$ +\rho_{AB} = p|00\rangle\langle 00| + (1 - p)|01\rangle\langle 01| = |0\rangle\langle 0| \otimes (p|0\rangle\langle 0| + (1 - p)|1\rangle\langle 1|). +$$

+

Note that its eigenvalues are $0, 0, p, 1-p$ and so $\lambda_{min}(\rho_{AB}) = p$.

+

On the other hand,

+

$$ +\rho_A = \mathrm{tr}_B(\rho_{AB}) = |0\rangle\langle 0| +$$

+

has eigenvalues $0, 1$ and so $\lambda_{min}(\rho_A) = 1$.

+

Consequently, upon taking the partial trace $\lambda_{min}$ can increase all the way to the maximum $1$ regardless of $\lambda_{min}$ of the original state.

+",10480,,10480,,12/24/2020 22:21,12/24/2020 22:21,,,,0,,,,CC BY-SA 4.0 +15269,2,,15253,12/25/2020 0:11,,4,,"

It may naively seem that gates like $U_f$ whose action is defined as

+

$$ +U_f|x\rangle|y\rangle = |x\rangle|y\oplus f(x)\rangle +$$

+

have no effect on the first register holding the state $|x\rangle$. This naive perception originates in our classical intuition. We see that the operation does not change the contents of the first register and in the classical world this is equivalent to having been unaffected by the operation. However, in quantum mechanics interactions can have other more subtle effects beyond changing register values. Specifically, they can introduce entanglement.

+

As a consequence, one cannot move the second Hadamard on the first register through $U_f$ to cancel it with the first Hadamard (or vice versa) as that would change the entanglement produced by $U_f$ and therefore would perform an inequivalent operation. Moreover, entanglement affects the interference patterns in a way that can have measurable effects on the output distribution of each register.

+
+

It is instructive to see how things play out in a concrete case. We will use the CNOT gate

+

$$ +CNOT|x\rangle|y\rangle = |x\rangle|y \oplus x\rangle \tag1 +$$

+

which is a simple variant of $U_f$. For simplicity, consider the action of a Hadamard on the first qubit followed by a CNOT followed by another Hadamard on the first qubit. This is simpler than Deutsch-Jozsa algorithm, but serves to demonstrate how entanglement may prevent the first register from reading $|0\rangle$ with certainty. We have

+

$$ +\begin{align} +(H \otimes I) \circ CNOT \circ (H \otimes I) |0\rangle |0\rangle &= \frac{1}{\sqrt{2}}(H \otimes I) \circ CNOT (|0\rangle + |1\rangle)|0\rangle \\ +&= \frac{1}{\sqrt{2}}(H \otimes I) (|0\rangle|0\rangle + |1\rangle|1\rangle) \\ +&= \frac{1}{2} \left[|0\rangle + |1\rangle)|0\rangle + (|0\rangle - |1\rangle)|1\rangle\right] \\ +&= \frac{1}{2} \left[|0\rangle|0\rangle + |1\rangle|0\rangle + |0\rangle|1\rangle - |1\rangle|1\rangle\right] \\ +&= \frac{1}{2} \left[|0\rangle(|0\rangle + |1\rangle) + |1\rangle\color{red}{\underline{(|0\rangle - |1\rangle)}}\right] \\ +\end{align} +$$

+

where we collected the terms that correspond to the first qubit in the $|0\rangle$ and $|1\rangle$ states. Compare the calculation to what happens in the absence of the CNOT gate

+

$$ +\begin{align} +(H \otimes I) \circ (H \otimes I) |0\rangle |0\rangle &= \frac{1}{\sqrt{2}}(H \otimes I) (|0\rangle + |1\rangle)|0\rangle \\ +&= \frac{1}{2} \left[|0\rangle + |1\rangle)|0\rangle + (|0\rangle - |1\rangle)|0\rangle\right] \\ +&= \frac{1}{2} \left[|0\rangle|0\rangle + |1\rangle|0\rangle + |0\rangle|0\rangle - |1\rangle|0\rangle\right] \\ +&= \frac{1}{2} \left[|0\rangle(|0\rangle + |0\rangle) + |1\rangle\color{red}{\underline{(|0\rangle - |0\rangle)}}\right] \\ +\end{align} +$$

+

where as before we collected the terms corresponding to the first qubit in the $|0\rangle$ and $|1\rangle$ states. In the absence of CNOT, destructive interference zeroes out the amplitude of the $|1\rangle$ state (see the last underlined expression). However, in the presence of CNOT interference is prevented because the amplitudes reside on different kets due to entanglement introduced by the CNOT gate (see the earlier underlined expression).

+

Therefore, in the presence of CNOT, it is possible for the first register to read $|1\rangle$ even though naive reading of $(1)$ might suggest this should not happen.

+
+

Note that gates such as

+

$$ +U_c|x\rangle|y\rangle = |x\rangle|y\oplus f(c)\rangle +$$

+

where the change to the second register's value is independent of the contents of the first register do not generate entanglement. In this case it is possible to write the action of the gate as $U_c = I \otimes V$ for a unitary $V$ and so the two Hadamards on the first register would cancel.

+",10480,,10480,,12/25/2020 2:42,12/25/2020 2:42,,,,0,,,,CC BY-SA 4.0 +15270,2,,15221,12/25/2020 3:59,,1,,"

In addition to Quantum Computation and Quantum Information by Nielson & Chuang, I would recommend the UC Berkeley CS191 lecture notes and Quantum Computer Science (An Introduction) by Mermin.

+",13991,,,,,12/25/2020 3:59,,,,1,,,,CC BY-SA 4.0 +15271,2,,5936,12/25/2020 10:32,,1,,"

Say you have two bases $B_1$ and $B_2$. Let $U$ be the unitary that transforms the orthonormal basis vectors in $B_1$ to the basis vectors in $B_2$. So, it is obvious that $U^{\dagger}$ will be the unitary that transforms the basis vectors in $B_2$ to that in $B_1$. For instance let $B_1 = \{|0\rangle, |1\rangle\}$ (the computational basis) and let $B_2 = \{|\uparrow\rangle, |\downarrow\rangle\}$ where $|\uparrow\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\ i\end{pmatrix}$ and $|\downarrow\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\ -i\end{pmatrix}$. Notice that the matrix $U = \frac{1}{\sqrt{2}}\begin{bmatrix}1& 1\\ i & -i\end{bmatrix}$ is the matrix that transforms the basis vectors in $B_1$ to that in $B_2$, i.e., $U|0\rangle = |\uparrow\rangle$ and $U|1\rangle = |\downarrow\rangle$. So we also have $U^{\dagger}|\uparrow\rangle = |0\rangle$ and $U^{\dagger}|\downarrow\rangle = |1\rangle$. Also notice that $U\neq U^{\dagger}$.

+

For notational convenience, let $$|0\rangle = \begin{pmatrix}1\\ 0\end{pmatrix}_{B_1} ~~\text{ and }~~~~ |1\rangle = \begin{pmatrix}0\\ 1\end{pmatrix}_{B_1}.$$ Also let, $$|\uparrow\rangle = \begin{pmatrix}1\\ 0\end{pmatrix}_{B_2} ~~\text{ and }~~~~ |\downarrow\rangle = \begin{pmatrix}0\\ 1\end{pmatrix}_{B_2}.$$ Now, if you have a state $|\psi\rangle$ in basis $B_1$, say $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$ we can represent this as $|\psi\rangle = \begin{pmatrix}\alpha \\ \beta\end{pmatrix}_{B_1}$. Now notice that the state $|\psi\rangle$ can also be given as $$|\psi\rangle = \alpha|0\rangle + \beta|1\rangle = \alpha U^{\dagger}|\uparrow\rangle + \beta U^{\dagger}|\downarrow\rangle = U^{\dagger}(\alpha|\uparrow\rangle + \beta|\downarrow\rangle).$$ This in vector notation can be given as $$|\psi\rangle = U^{\dagger} \begin{pmatrix}\alpha'\\ \beta'\end{pmatrix}_{B_2}=\begin{pmatrix}\alpha\\ \beta\end{pmatrix}_{B_1}.$$

+

So for a state that is given in basis $B_1$, to represent the state in $B_2$ basis, we apply $U^{\dagger}$ on the state vector corresponding to the basis $B_1$. Similarly for a state that is given in basis $B_2$, to represent the state in $B_1$ basis, we apply $U$ on the state vector corresponding to the basis $B_2$ where $U$ is the matrix that transforms the basis vectors of basis $B_1$ to the basis vectors of the basis $B_2$.

+",9097,,4991,,2/19/2022 21:13,2/19/2022 21:13,,,,0,,,,CC BY-SA 4.0 +15272,2,,15246,12/25/2020 10:37,,0,,"

File names are case sensitive. Shared_capstone_Model_csv.csv is not the same as Shared_Capstone_Model_csv.csv. Change open code for Shared_Capstone_Model_csv.csv (note the C in Capstone).

+",1859,,,,,12/25/2020 10:37,,,,0,,,,CC BY-SA 4.0 +15273,2,,15003,12/25/2020 23:30,,1,,"

Let $\Phi$ be a channel and denote with $\newcommand{\ketbra}[1]{\lvert #1\rangle\!\langle #1\rvert}J(\Phi)\equiv (\Phi\otimes I)\mathbb P_m$ its Choi representation, where $\mathbb P_m\equiv\lvert m\rangle\!\langle m\rvert$ and $\lvert m\rangle\equiv\sum_i \lvert ii\rangle$.

+

Given arbitrary operators $A_a$, we have a representation $\Phi(X)=\sum_a A_a X A_a^\dagger$ if and only if $J(\Phi)=\sum_a \mathrm{vec}(A_a)\mathrm{vec}(A_a)^\dagger$, where $A_a\in\mathrm{Lin}(\mathcal X,\mathcal Y)$ and $\mathrm{vec}(A_a)\in\mathcal Y\otimes\mathcal X$ are related by $\mathrm{vec}(A_a)_{ij}=(A_a)_{ij}$ (to relate with your notation, $\mathrm{vec}(A_a)\equiv\lvert A_a\rangle\!\rangle$ and $\mathrm{vec}(A_a)^\dagger\equiv\langle\!\langle A_a\rvert$).

+

This follows from simple index juggling. Or from +$$(\Phi\otimes I)\mathbb P_m = \sum_{aij} A_a|i\rangle\!\langle j| A_a^\dagger\otimes |i\rangle\!\langle j| = \sum_a \mathrm{vec}(A_a)\mathrm{vec}(A_a)^\dagger.$$

+

Now the question is, suppose $\Phi(X)=\sum_a B_a X B_a^\dagger$. Are $A_a$ and $B_a$ unitarily related?

+

Given an operator $H$ which decomposes as +$$H=\sum_a |u_a\rangle\!\langle u_a| = \sum_a |v_a\rangle\!\langle v_a|,\tag1$$ +we must have $|u_i\rangle = \sum_j c_{ij} |v_j\rangle$ for some coefficients $c_{ij}$, as otherwise the two expressions would result in operators with different ranges/supports. The coefficients must then satisfy +$$\sum_{ijk}c_{ij}\bar c_{ik} |v_j\rangle\!\langle v_k| = \sum_i |v_i\rangle\!\langle v_i|.$$ +If the $|v_a\rangle$ are orthogonal, then multiplying the expression by $\langle v_a|$ and $|v_b\rangle$ we get $\sum_i c_{ia}\bar c_{ib} = \delta_{ab}$ for all $a$. This is equivalent to $C^\dagger C=I$, which means that $C$ is an isometry (has orthonormal columns). Note that there might be different numbers of elements in the two decompositions of (1), meaning $C$ needs not be a squared matrix, and thus not necessarily a unitary operator.

+

Now, any positive semidefinite operator $H$ has such a decomposition in terms of orthogonal vectors (its eigendecomposition). Therefore if there is any pair of sets of vectors such that (1) is satisfied, both of these will have to be unitarily related to the vectors in the eigendecomposition of $H$, and thus unitarily related between themselves.

+",55,,55,,5/13/2022 8:53,5/13/2022 8:53,,,,1,,,,CC BY-SA 4.0 +15274,1,15277,,12/26/2020 4:33,,2,194,"
    +
  1. If q4-7 are all supposed to be eigenstates of the operation, why is it just that q7 is in $|1\rangle$? Shouldn't all qubits 4 to 7 be in the $|1\rangle$ state to kick back phases from the $Rz$ gates applied? +

    +
  2. +
  3. I'm trying to see what's inside each of those controlled operations, and as observed below it's a bunch of swap gates. How do swap gates do any meaningful computation? How do they kickback an important phase? I was expecting same quantum gates applied on the eigenstate such that an important phase gets kicked up, so I don't see the point in swap gates. +

    +
  4. +
+",13449,,55,,1/6/2021 14:23,6/15/2021 3:50,Shor's implementation problem on qiskit,,3,0,,,,CC BY-SA 4.0 +15275,1,15276,,12/26/2020 5:44,,2,385,"

I'm trying to use the parametrized circuits to run a single model of quantum circuit with different values. Here's part of my code:

+
from qiskit import IBMQ
+provider = IBMQ.load_account()
+sim = provider.backends.ibmq_qasm_simulator
+backend = provider.get_backend('ibmq_qasm_simulator')
+
+probsu = []
+for i in range(L):
+
+    circuit = circuit.assign_parameters({Ei: EWi[i]})
+    circuit = qc(Ei) 
+    
+    job_manager = IBMQJobManager()
+    **MExperiment = job_manager.run(circuit, backend=backend, name='MExperiment')**
+    result = MExperiment.result()
+
+    Ta = '1'*N
+    counts = result.get_counts(circuit)
+    if Ta in counts:
+        prob = counts[Ta]/sum(counts.values())
+    else:
+        prob = 0
+    probsu.append(prob) 
+
+

Where qc(Ei) is a function of the quantum circuit model. EWi is an array of possible parameters that will be used. An error occurred at the line marked with **. Here's what qiskit shows me:

+
CircuitError: "Cannot bind parameters (['Ei']) not present in the circuit."
+
+

I'm not exactly sure, but it looks like parameterization requires the label 'Ei' to appear in the circuit. However, my circuit function takes the argument to accept some input like Ei. Is there a way I can fix this error? Thanks a lot for your help:)

+",12334,,55,,12/14/2021 13:47,12/14/2021 13:47,How can I fix this parametrization error in Qiskit?,,1,0,,,,CC BY-SA 4.0 +15276,2,,15275,12/26/2020 7:28,,1,,"

If you want to create a parametrized quantum circuit in Qiskit, you can do it as follow:

+
%matplotlib inline
+# Importing standard Qiskit libraries
+from qiskit import QuantumCircuit, execute, Aer, IBMQ
+from qiskit.compiler import transpile, assemble
+from qiskit.tools.jupyter import *
+from qiskit.visualization import *
+from iqx import *
+from qiskit.circuit import  ParameterVector
+# Loading your IBM Q account(s)
+provider = IBMQ.load_account()
+
+param_circuit = QuantumCircuit(4)
+params = ParameterVector('a', 4)
+for i in range(4):
+    param_circuit.ry(params[i], i)
+param_circuit.cx(0,1)
+param_circuit.cx(2,3)
+param_circuit.cx(1,2)
+param_circuit.cx(0,1)
+param_circuit.cx(2,3)
+param_circuit.draw('mpl',style={'name': 'bw'},  scale = 1)
+
+

+

You can pass the parameters in this circuit and update them through a classical optimizer etc.

+",9858,,,,,12/26/2020 7:28,,,,0,,,,CC BY-SA 4.0 +15277,2,,15274,12/26/2020 9:04,,1,,"

First question

+

There are two implementation of Shor algorithm. The first one is depicted in this picture:

+

+

In this case, a function $a^x \mod N$ is implemented in $U_f$ gate and you are trying to find period in such function.

+

Another implementation (yours one) uses phase estimation for finding the period. See thsis implementation on Wiki for example.

+

In the first case, all qubits are initialized to $|0\rangle$. In second case as you can see in Wiki link, qubits used as input to an "operator which phase is estimated" are initialized at $|1\rangle$. It seems that part of $X$ gates are included into controlled operators (sorry I have not enought time to reconstruct the opeators).

+

Second question

+

As the operators are controlled ones, bottom qubits are entangled with top qubits which allow phase kick-back. As a result, you are able to measure the phase on top qubits.

+

Concerning swap gate, even such gates are able to perform calculation. You can see here how swap gates implement modular multiplication used in the Shor algorithm.

+",9006,,,,,12/26/2020 9:04,,,,0,,,,CC BY-SA 4.0 +15279,1,,,12/26/2020 11:23,,8,634,"

In the standard model of quantum computation a gate is a unitary that acts on a subsystem. Physically, it can be implemented by some device. Now, any device is also a part of our quantum world, thus it has a quantum state. This quantum state, in theory, can be in superposition with some other state. For example, it can be in a superposition with a state of device that implements different unitary gate.

+

The question is, are there some rigorous theoretical considerations of what superposition of gates is and how we can model its effect on a quantum state?

+",5870,,,,,1/6/2021 7:41,Superposition of quantum gates,,4,5,,,,CC BY-SA 4.0 +15280,1,15282,,12/26/2020 13:53,,3,389,"

How does this circuit map $|x\rangle$ to $|7x \space mod15\rangle$? Looking into Shor's and I thought that phase kickback causes the modular exponentiation part to be mapped onto the measurement qubits through the Fourier basis. +

+",13449,,55,,1/6/2021 15:00,1/6/2021 15:00,How does this represent modular multiplication,,1,0,,,,CC BY-SA 4.0 +15281,1,,,12/26/2020 17:15,,2,101,"

Consider we have a quantum system which has two possible states (as double-slit experiment):

+
    +
  • the photon could be pass through the first slit
  • +
  • the photon could be pass through the second slit
  • +
+

And we decided to represent the first state as $|0\rangle$ and the second state as $|1\rangle$. Assume that the quantum state is in a superposition state $|\psi\rangle=\sqrt(1/2) |0\rangle + \sqrt(1/2) |1\rangle$. So, we have a probability 50% to get $|0\rangle$ as outcome and also a probability 50% to get $|1\rangle$ as outcome.

+

Then we measured the state of the system in the standard basis {$|0\rangle,|1\rangle$} and get $|0\rangle$ as outcome.

+

My question is, how we can get $|+\rangle$ as outcome if we measured in basis {$|+\rangle,|-\rangle$}? in other words, our system has only two states $|0\rangle$ (first slit) and $|1\rangle$ (second slit) so how by changing basis we get state which is not one of the two possible states of our system {$|0\rangle,|1\rangle$}?

+

I know that I miss something important regarding concept of measurement but I am beginner and would like to clearly understand this concept.

+",14252,,55,,1/6/2021 14:59,1/6/2021 14:59,How changing the basis of measurement produces a state which is not in the possible system states?,,1,6,,,,CC BY-SA 4.0 +15282,2,,15280,12/26/2020 17:17,,5,,"

Applying a NOT gate to every qubit in an $n$ bit register performs the transformation $f(x) = 2^n - 1 - x$. In this case that's $f(x) = 16-1-x = -x \pmod{15}$. So the NOT gates are equivalent to negating.

+

The triplets of CNOTs are performing swaps and the swaps implement a right-rotate:

+

+

An $n$ bit right-rotate is equivalent to multiplying by the multiplicative inverse of 2 mod $2^n-1$, which is $8$ in our case.

+

Together these two multiplications multiply by $-1 \cdot 8 = -8 = -8 + 15 = 7 \pmod{15}$.

+

Note that the circuit isn't quite correct. There is a degeneracy where $|0\rangle$ is mapped to $|15\rangle$ instead of $|0\rangle$. In the general case, unexpected information could leak into this degeneracy and decohere when the register is measured. But in the context of Shor's algorithm you know the register has no overlap with $|0\rangle$ so it's fine.

+

Also note that if your qubits are not restricted to linear connectivity, you can make the circuit shallower by running two of the swaps in parallel:

+

+",119,,,,,12/26/2020 17:17,,,,0,,,,CC BY-SA 4.0 +15283,2,,15274,12/26/2020 17:28,,3,,"
+

How do swap gates do any meaningful computation? How do they kickback an important phase? I was expecting same quantum gates applied on the eigenstate such that an important phase gets kicked up

+
+

What makes you think swap gates can't have phase kickback? The swap operation has both +1 and -1 eigenspaces. For example:

+

+",119,,,,,12/26/2020 17:28,,,,0,,,,CC BY-SA 4.0 +15284,1,15297,,12/26/2020 21:36,,4,123,"

I'm running simulations of my quantum circuit, which includes both parametrized variables and random numbers. The question I'm trying to solve is that for each parameterized variable, I will generate a set of quantum circuits, each element of which contains different random numbers. I'm hoping to run each quantum circuit in the set with 100 shots, then carry out some analyses on the counts. I'm not exactly sure how I can do that, here's part of the code I have:

+
from qiskit import IBMQ
+provider = IBMQ.load_account()
+sim = provider.backends.ibmq_qasm_simulator
+backend = provider.get_backend('ibmq_qasm_simulator')
+
+E = np.linspace(-5,5,10)                # Parameters
+circuits = []
+nuni = 10.                              # Number of the circuits in each set. 
+
+for i in range(10):
+    circuitsi = []
+    for j in range (nuni):
+        circuit =  QuantumCircuit(qrz,crz)
+        circuit =  qc(E[i])             # qc is a function with both parameters and random numbers.
+        circuitsi.append(circuit)
+    circuits.append(circuitsi)
+
+for i in range (len(circuits)):
+    for j in range (nuni):
+        circuits[i][j] = transpile(circuits[i][j],backend=backend)
+
+
+for i in range (10):
+    job_manager = IBMQJobManager()
+    MExperiments = job_manager.run(circuits[i], backend=backend, shots = nshot)
+    results = MExperiments.results()
+
+    for j in range (nuni):
+        
+        counts = results.get_counts(circuits[i][j])
+
+

My current code doesn't quite work, I'm wondering am I on the right track? How can I fix my code? Thanks a lot for your help:)

+

Update: My code works, but it takes a really long time to run. I'm still wondering if there's a simpler way to carry out the experiment? Thanks!

+",12334,,55,,12/14/2021 13:47,12/14/2021 13:47,"How can I run a set of circuits, each of which has 100 shots?",,1,0,,,,CC BY-SA 4.0 +15285,1,15287,,12/26/2020 22:13,,2,167,"

Here is the code that I have been using on IBM Q Experience (should be the latest version of Qiskit). From my understanding it seems like the outputs of Hadamard and CNOT gates are reversed in a 2-qubit system in Qiskit: A Hadamard gate operating on state 0 actually acts on state 1 and vice versa, similarly with a CNOT gate. Is there something wrong with my understanding? The comments in my code summarize the output results I find surprising.

+
%matplotlib inline
+# Importing standard Qiskit libraries
+from qiskit import QuantumCircuit, execute, Aer, IBMQ
+from qiskit.compiler import transpile, assemble
+from qiskit.tools.jupyter import *
+from qiskit.visualization import *
+from iqx import *
+
+from qiskit.quantum_info import Statevector
+
+sv01 = Statevector.from_label('01')
+print(sv01)
+plot_state_qsphere(sv01.data)
+
+h0circuit = QuantumCircuit(2)
+h0circuit.h(0)
+h0circuit.draw("mpl")
+
+final01 = sv01.evolve(h0circuit)
+print(final01)
+plot_state_qsphere(final01.data)
+#Shouldn't the output be state 1/sqrt(2) (|01> + |11>)  ???? 
+#And why is the phase on the state |00> pi? 
+#Shouldn't the phase be pi for |01> instead on the qsphere (ambiguous, probably doesn't matter)?
+
+h1circuit = QuantumCircuit(2)
+h1circuit.h(1)
+h1circuit.draw("mpl")
+
+final01 = sv01.evolve(h1circuit)
+print(final01)
+plot_state_qsphere(final01.data)
+#Shouldn't the output be state 1/sqrt(2) (|00> - |01>)  ???? 
+
+#Conclusion of the above. An H gate on qubit 0 seems to apply to qubit 1. An H gate on qubit 1 seems to apply to qubit 0.
+
+sv01 = Statevector.from_label('01')
+print(sv01)
+plot_state_qsphere(sv01.data)
+
+c0xCircuit = QuantumCircuit(2)
+c0xCircuit.cx(0,1)
+c0xCircuit.draw('mpl')
+
+final01 = sv01.evolve(c0xCircuit)
+print(final01)
+plot_state_qsphere(final01.data)
+#Shouldn't this result be  |01> ?
+
+c1xCircuit = QuantumCircuit(2)
+c1xCircuit.cx(1,0)
+c1xCircuit.draw('mpl')
+
+final01 = sv01.evolve(c1xCircuit)
+print(final01)
+plot_state_qsphere(final01.data)
+#Shouldn't this result be  |11> ?
+
+#Conclusion of the above. The cnot (0,1) gate actually acts as a cnot (1,0) gate. The cnot (1,0) gate actually 
+#acts as a cnot (0,1) gate. The states 0 and 1 are flipped somehow.
+```
+
+",14270,,,,,12/27/2020 0:30,How do Hadamard and CNOT gates work on Qiskit SDK? Why is the output reversed?,,1,0,,,,CC BY-SA 4.0 +15286,1,,,12/26/2020 23:05,,3,55,"

Theorem 8.10 in Chapter 8 of Theory of Quantum Information asserts that the Holevo capacity of a quantum channel (between density operators on $\mathbb{C}^d$) can be achieved by an ensemble consisting of ${d^2}$ pure states.

+

The proof for general ensembles is a nice application of the conditions under which the Holevo information is convex (Proposition 5.48) along with Proposition 2.52 which is essentially a consequence of Catheodory's theorem and the space of density operators having real vector space dimension $d^2-1$ and therefore we can always pick the ensemble to have at most $d^2$ states.

+

I can also see that any value achieved by an ensemble of mixed states can be achieved by one of consisting only of pure states. My problem is that I can't see why this optimal pure state ensemble also has the $d^2$ bound on the number of states in the ensemble. Any insight into this argument would be appreciated.

+",11793,,,,,12/26/2020 23:05,Pure state ensembles achieving the Holevo $\chi$-quantity with at most $d^2$ states,,0,0,,,,CC BY-SA 4.0 +15287,2,,15285,12/27/2020 0:30,,1,,"

This has to do with Qiskit uses little-endian for ordering. In Qiskit’s convention, higher qubit indices are more significant (little endian convention).

+

Thus the CNOT (CX) gate matrix representation in Qiskit is actually:

+

$$ + CX\ q_0, q_1 = + I \otimes |0\rangle\langle0| + X \otimes |1\rangle\langle1| = + \begin{pmatrix} + 1 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 1 \\ + 0 & 0 & 1 & 0 \\ + 0 & 1 & 0 & 0 + \end{pmatrix} +$$

+

Here is the link to the Qiskit's documentation.

+",9858,,,,,12/27/2020 0:30,,,,1,,,,CC BY-SA 4.0 +15288,2,,15279,12/27/2020 0:47,,1,,"

Putting something as massive as even the simplest gate-device into a superposition goes beyond currently understood physics. At a "device-scale" general relativistic considerations may become significant because the two device-states will have different mass-distributions and distinct gravitational self-energies.

+

Roger Penrose has worked through the implications of this rigorously and argues that this difference in gravitational self-energy (exceptionally tiny as it may be) ultimately forces one to attempt to superpose states belonging to two different vacua, i.e. two incompatible Hilbert spaces, which is not allowed by quantum mechanics (Section 4.2 of Fashion, Faith, and Fantasy, with ample references therein).

+

This takes the analysis of such a system "outside the normal framework of quantum mechanics, and there does not seem to be an unambiguous way to proceed." Penrose goes on to propose a way to manage the situation, within a framework that borrows heavily from Bohmian mechanics, by quantifying the error introduced by these "illegal" superpositions and treating it as a form of energy uncertainty.

+

The approach outlined by Penrose is manifestly falsifiable, and my understanding is that there are several groups attempting to devise experiments to test it.

+",8623,,8623,,1/5/2021 15:40,1/5/2021 15:40,,,,7,,,,CC BY-SA 4.0 +15289,2,,15281,12/27/2020 0:55,,1,,"

This is a Prologue taken from David McIntyre's Quantum Mechanics textbook (the link should lead you to the pdf version of the textbook) that I thought is pretty neat and shows the counter intuitive of QM. Also, section 1.1 describes the measurement phenomena of QM really nicely. I encourage you to read through it.

+
+

It was a dark and stormy night. Erwin huddled under his covers as he had done numerous times that summer. As the wind and rain lashed at the window, he feared having to retreat to the storm cellar once again. The residents of Erwin's apartment building sought shelter whenever there were threats of tornadoes in the area. While it was safe down there, Erwin feared the ridicule he would face once again from the other school boys. In the rush to the cellar, Erwin seemed to always end up with a random pair of socks, and the other boys teased him about it mercilessly.

+Not that Erwin hadn't tried hard to solve this problem. He had a very simple collection of socks - black or white, for either school or play; short or long, for either trousers or lederhosen. After the first few teasing episodes from the other boys, Erwin had sorted his socks into two separate drawers. He placed all the black socks in one drawer and all the white socks in another drawer. Erwin figured he could determine an individual sock's length in the dark of night simply by feeling it, but he had to have them presorted into white and black because the apartment generally lost power before the call to the shelter.

+Unfortunately, Erwin found that this presorting of the socks by color was ineffective. Whenever he reached into the white sock drawer and chose two long socks, or two short socks, there was a 50% probability of any one sock being black or white. The results from the black short drawer were the same. The socks seemed to have "forgotten" the color that Erwin had determined previously.

+Erwin also tried sorting the socks into two drawers based upon their length, without regard to color. When he chose black or white socks from these long or short drawer, the socks had also "forgotten" whether they were long or short.

+After these fruitless attempts to solve this probem through experiments, Erwin decided to save himself the fashion embarrassment, and he replaced his sock collection with a set of medium length brown socks. However, he continued to ponder the mysteries of the socks throughout his childhood.

+After many years of daydreaming about the mystery socks, Erwin Schrodinger proposed his theory of "Quantum Socks" and become famous. And this is the beginning of the story of the quantum socks.

+Farfetched?? You bet. But Erwin's adventure with his socks is the way quantum mechanics works.

+
+",9858,,,,,12/27/2020 0:55,,,,1,,,,CC BY-SA 4.0 +15290,1,15294,,12/27/2020 3:21,,3,424,"

QFT is often explained through the classical analogue which converts a certain function from the time domain to the frequency domain. When looking at the discrete Fourier transform, it makes sense to see a sin wave become a spike at a certain frequency.

+

However, I don't see how this "frequency domain" notion applies to the quantum fourier transform. How does the Fourier basis represent this frequency domain?

+

If we apply a QFT on a quantum "sin wave" will it output a certain frequency?

+",13449,,,,,12/30/2020 1:46,How does the QFT represent the frequency domain?,,2,1,,,,CC BY-SA 4.0 +15291,2,,15279,12/27/2020 4:28,,4,,"

Gate superposition

+

Superposition is a complex linear combination of pure states with a physical interpretation of coefficients. One aspect of this interpretation concerns the probability of measurement outcomes on a superposition state. Gates are not pure states and generally cannot be measured. Therefore, strictly speaking, there is no such thing as a superposition of quantum gates.

+

Quantum computer in superposition

+

In order to answer the part of the question regarding the operation of a quantum computer which is itself in a superposition of two different programs, we need to adopt a model of the quantum computer. Assume that our computer includes a classical control register that encodes the parameters of a unitary gate to be performed and a quantum data register whose state lives in the Hilbert space $\mathcal{H}_d$. If at time $t_0$ the control register is in state $r$ and the data register is in state $|\psi_0\rangle$ then at a later time $t_1$ the data register is in state

+

$$ +|\psi_1\rangle = U(r) |\psi_0\rangle. +$$

+

We also assume that application of quantum gates to the data register does not change the control register.

+

In this model, a quantum computation is performed by initializing the data register, loading values $r_0, r_1, \dots, r_n$ in order into the control register to effect the desired quantum gates and finally performing a computational basis measurement on the data register. Our model ignores the mechanism which sets the control register.

+

Now, let us do what the question suggested and consider the above quantum computer to be a quantum system. Thus, the state of our control register now lives in the Hilbert space $\mathcal{H}_c$ and the state space of our computer is $\mathcal{H}_c \otimes \mathcal{H}_d$.

+

For simplicity, let us first consider the situation where at time $t_0$ the control register is in a classical state $|r\rangle$ and the data register is in state $|\psi_0\rangle$. By the correspondence principle, at time $t_1$ the computer will be in state

+

$$ +(I \otimes U(r))|r\rangle |\psi_0\rangle = |r\rangle |\psi_1\rangle.\tag1 +$$

+

Note that the states $|r\rangle$ form a basis of $\mathcal{H}_c$. In the case where the control register is binary, these can be identified as the computational basis states in $\mathcal{H}_c$. Now, since these states form a basis, the equation $(1)$ provides us with the full specification of the action of the quantum computer. This operation can be written as a matrix

+

$$ +C = \begin{pmatrix} +U(0) & 0 & 0 & \dots & 0 \\ +0 & U(1) & 0 & \dots & 0 \\ +0 & 0 & U(2) & \dots & 0 \\ +\dots \\ +0 & 0 & 0 & \dots & U(N-1) +\end{pmatrix}\tag2 +$$

+

or more succinctly as the direct sum

+

$$ +C = U(0) \oplus U(1) \oplus \dots \oplus U(N-1)\tag{2'} +$$

+

where $U(k)$ for $k=0, \dots, N-1$ are the gates that our quantum computer can natively perform (this is often called the "gateset").

+

Suppose now that at time $t_0$ the control register is in state

+

$$ +|s\rangle = \alpha |r\rangle + \beta |r'\rangle +$$

+

for appropriate $\alpha$ and $\beta$ and that the data register is in state $|\psi_0\rangle$. By the superposition principle, at a later time $t_1$ the computer will be in state

+

$$ +\begin{align} +C |s\rangle|\psi_0\rangle &= C (\alpha |r\rangle + \beta |r'\rangle)|\psi_0\rangle \\ +&= \alpha \,C |r\rangle|\psi_0\rangle + \beta \,C |r'\rangle|\psi_0\rangle \\ +&= \alpha \,(I \otimes U(r))|r\rangle|\psi_0\rangle + \beta \,(I \otimes U(r'))|r'\rangle|\psi_0\rangle \\ +&= \alpha \,|r\rangle|\psi_1\rangle + \beta\,|r'\rangle|\psi_1'\rangle +\end{align} +$$

+

where $|\psi_1'\rangle = U(r')|\psi_0\rangle$.

+

This operation can be viewed as a quantum analogue of the classical switch statement that selects a unitary to be applied on the data register based on the contents of the control register. It is sometimes called the quantum multiplexor (see e.g. here).

+

However, while the direct sum of the unitary gates and the entangled state of the control and data registers explains what happens in a quantum computer that is in a superposition of two different programs, direct sum of two gates lacks many properties familiar from state superposition. In particular, direct sum of unitary gates has no amplitudes. Also, the superposition of the full quantum computer turns into a mixture when the control register is traced out and so - as pointed out in the comments - the data register itself is not in superposition. Thus, the model above does not define a notion one could call "gate superposition". This is expected as unlike states, unitary evolutions do not superpose. It is also informative to see how other approaches to defining such a notion fail.

+

Naive linear algebra

+

Naively forming a "superposition" of two unitary gates $U$ and $V$ by taking

+

$$ +M = \alpha U + \beta V +$$

+

for $\alpha, \beta \in \mathbb{C}$ such that $|\alpha|^2 + |\beta|^2 = 1$ does not generally result in $M$ unitary. This is a consequence of the fact that the set of unitary operators is not a complex vector space. Similarly to how one can normalize non-zero ket to unit norm, one can also extract the unitary part of a non-singular matrix using the polar decomposition

+

$$ +M = WP +$$

+

where $P$ is positive and $W$ unitary. However, this lacks the physical meaning associated with superposition.

+

State-channel duality

+

One could also seek a way to define gate "superposition" by looking at the superposition of the corresponding states under state-channel duality. Let $|i\rangle$ for $i=1, \dots, d$ denote an orthonormal basis of a $d$-dimensional Hilbert space $\mathcal{H}$ and let $|\psi\rangle = \frac{1}{\sqrt{d}}\sum_{i=1}^d |i\rangle|i\rangle$ be a maximally entangled state. Denote by $U$ and $V$ two unitary gates on $\mathcal{H}$. The corresponding states are

+

$$ +\rho_U = (I \otimes \mathcal{U})(|\psi\rangle\langle\psi|) = \frac{1}{d}\sum_{i,j=1}^d |i\rangle\langle j| \otimes U|i\rangle\langle j|U^\dagger \\ +\rho_V = (I \otimes \mathcal{V})(|\psi\rangle\langle\psi|) = \frac{1}{d}\sum_{i,j=1}^d |i\rangle\langle j| \otimes V|i\rangle\langle j|V^\dagger. +$$

+

Note that $\rho_U$ and $\rho_V$ are pure. Their superposition with amplitudes $\alpha$ and $\beta$ is

+

$$ +\begin{align} +|\psi_M\rangle &= \alpha \left(\frac{1}{\sqrt{d}}\sum_{i=1}^d |i\rangle \otimes U|i\rangle\right) + \beta \left(\frac{1}{\sqrt{d}}\sum_{i=1}^d |i\rangle \otimes V|i\rangle \right) \\ +&= \frac{1}{\sqrt{d}}\sum_{i=1}^d |i\rangle \otimes (\alpha U + \beta V)|i\rangle \\ +&= \frac{1}{\sqrt{d}}\sum_{i=1}^d |i\rangle \otimes M|i\rangle \\ +&= (I \otimes M) |\psi\rangle +\end{align} +$$

+

where as before $M = \alpha U + \beta V$. Note that $|\psi_M\rangle$ is not normalized. In fact, when $M$ is singular, it may be impossible to normalize it. However, even when $|\psi_M\rangle$ can be normalized, it is not necessarily a maximally entangled state. Consequently, it does not map back to a unitary operation via state-channel duality.

+",10480,,10480,,12/28/2020 0:28,12/28/2020 0:28,,,,8,,,,CC BY-SA 4.0 +15292,2,,15290,12/27/2020 6:51,,3,,"

If you apply the $n$-qubit QFT defined as $\frac{1}{\sqrt{N}}\sum_{k = 0}^{N - 1}\sum_{n = 0}^{N - 1}a_n e^{2 \pi i n k/N}\left|k \right>$ acting on a state $\sum_{x = 0}^{N - 1}a_x\left|x\right>$ with $N = 2^{n}$ on a sin wave with a frequency $k$ defined as $\frac{1}{2^{(n - 1)/2}}\sum_{x = 0}^{N -1}\sin(\frac{2 \pi x k}{N})\left|x\right>$ with $n > 1$ and $k \neq 0$ to avoid having only zero values, the result will be $\frac{i}{\sqrt{2}}\left|k\right> - \frac{i}{\sqrt{2}}\left|N - k\right>$. This intuitively matches the regular Fourier transform which gives $\frac{i \sqrt{\pi}}{\sqrt{2}}\delta(\omega - 2 \pi k) - \frac{i \sqrt{\pi}}{\sqrt{2}}\delta(\omega + 2 \pi k)$ for $sin(2 \pi kx)$ if using the modern physics form ($\hat f(\omega) = \frac{1}{\sqrt{2 \pi}}\int_{-\infty}^{\infty}f(t)e^{i \omega t}dt$) and with $\omega$ denoting frequency. On the other hand, the wave $\frac{1}{\sqrt{N}}\sum_{x = 0}^{N - 1}e^{-2 \pi x k/N}\left|x\right>$ that combines a real cosine wave with an imaginary sin wave is much more naturally transformed directly into $\left|k\right>$.

+

The correspondence to the "time variable" in the QFT is not time but rather the computational basis states, but the relationship between the two bases is similar to that of time and frequency. If you take $N$ evenly spaced points on the complex unit circle that together go across the entire circle ($e^{-2\pi i x/N}$ for $x$ from $0$ to $N - 1$ goes through clockwise), then with the probability amplitude $a_k$ each frequency $k$ corresponds to $\frac{a_k}{\sqrt{N}}\sum_{x=0}^{N - 1}e^{-2 \pi i x k /N}\left|x\right>$: the intuitive link to traditional "frequency" is how many times the complex unit circle is fully circled as you go across the basis states. The sum of these for all frequencies returns the original state as usual.

+",7680,,7680,,12/30/2020 1:46,12/30/2020 1:46,,,,0,,,,CC BY-SA 4.0 +15293,1,,,12/27/2020 7:23,,-2,83,"
def random_bitstring_generator(bit_number, backend):
+    
+
+    bitstring = ""
+
+    one_qubit_random_bit_generator_circuit = QuantumCircuit(4,4)
+    one_qubit_random_bit_generator_circuit.h(3)
+    one_qubit_random_bit_generator_circuit.measure(3,3)
+
+    for _ in range(bit_number):
+        counts = execute(one_qubit_random_bit_generator_circuit, backend, shots=8000).result().get_counts()
+        bit = list(counts.keys())[0]  
+        bitstring += bit
+
+    return bitstring
+
+from qiskit.providers.aer import QasmSimulator
+
+provider = IBMQ.load_account()
+ibmq_melbourne = provider.get_backend('ibmq_16_melbourne')
+backend = QasmSimulator.from_backend(ibmq_melbourne)
+
+print(random_bitstring_generator(512, backend))```
+
+Using the above  code,
+I am only getting an output bit string with all 0's even with changing number of shots.
+what is the error leading to incorrect output.
+I am trying to generate a long random sequence 
+
+",13172,,55,,12/30/2021 18:42,12/30/2021 18:42,how to generate a random sequence,,1,1,,12/28/2020 13:37,,CC BY-SA 4.0 +15294,2,,15290,12/27/2020 7:39,,3,,"

The Fourier transform is more general than moving from the time domain to the frequency domain. For example, physicists regularly Fourier transform from position space to momentum space.

+

In both of these examples, the Fourier transform is a basis transformation, i.e. it is transforming the basis vectors used to represent some state without changing the state itself. Likewise, the QFT is simply a basis transformation from the computational basis to the Fourier basis.

+

To see how the QFT relates to more familiar Fourier transforms, it may be helpful to consider how integers are represented over both the computational basis and the Fourier basis. To illustrate, I'll walk through a specific example of the QFT for a four-qubit system.

+

In the computational basis, integers are represented in binary form (with the MSB on the left by convention). So for four qubits +$$\vert 0 \rangle=\vert 0000 \rangle, \;\;\vert 1 \rangle=\vert 0001 \rangle, \;\; \vert 2 \rangle=\vert 0010 \rangle,\;\; ..., \;\; \vert 15 \rangle =\vert 1111 \rangle.$$ +Algebraically this is given by +$$\vert n \rangle=\vert a(2^3)+b(2^2)+c(2^1)+d(2^0) \rangle=\vert abcd \rangle, \;\; a,b,c,d \in \lbrace 0,1 \rbrace, \; n \in \lbrace 0,...,15\rbrace.$$ +On the four Bloch spheres associated with $\vert abcd \rangle$, counting from $\vert 0 \rangle$ to $\vert 15 \rangle$ looks like: + +(Image Source, with $\vert d \rangle=\text{qubit 0}$, $\vert c \rangle=\text{qubit 1}$, ...)

+

You can see that in the Bloch spheres representation, distinct values of $\vert n \rangle$ are distinguished by ordered sets of qubits at either their north pole, $\vert 0 \rangle$, or their south pole, $\vert 1 \rangle$. Intuitively, while counting, the qubit associated with the LSB, $\vert d \rangle$, changes state every step, whereas the qubit associated with the MSB, $\vert a \rangle$, changes state every eighth step. [Note that the Bloch sphere is actually a Riemann sphere (i.e. the complex projective line), so orthogonal states, such as $\vert 0 \rangle$ and $\vert 1 \rangle$, are represented by antipodal points.]

+

The same 16 integers represented over the Fourier basis, $ \text{QFT} \vert n \rangle = \vert \tilde n \rangle =\vert \tilde a \tilde b \tilde c \tilde d \rangle $, is given algebraically by +$$\vert \tilde n \rangle = \tfrac{1}{\sqrt{2^4}}(\vert 0 \rangle + e^{2\pi in/2} \vert 1 \rangle) \otimes (\vert 0 \rangle + e^{2\pi in/2^2} \vert 1 \rangle) \otimes (\vert 0 \rangle + e^{2\pi in/2^3} \vert 1 \rangle) \otimes (\vert 0 \rangle + e^{2\pi in/2^4} \vert 1 \rangle).$$ +Now as we count in the Fourier basis from $\vert \tilde n \rangle = \vert \tilde a \tilde b \tilde c \tilde d \rangle = \vert \tilde 0 \rangle$ to $\vert \tilde {15} \rangle$ all four qubits change state every step, with $\vert \tilde a \rangle$ taking the largest steps (i.e. swapping between $\vert + \rangle$ and $\vert - \rangle$, which is $\frac{1}{2}$ of a turn per step) and $\vert \tilde d \rangle$ taking the smallest steps ($\frac{1}{16}$ of a turn per step).

+

On the four Bloch spheres associated with $\vert \tilde a \tilde b \tilde c \tilde d \rangle$, counting in the Fourier basis appears as each qubit state rotating in the equatorial plane with decreasing frequency from $\vert \tilde a \rangle$ to $\vert \tilde d \rangle$.

+

+(Image Source, with $\vert \tilde d \rangle=\text{qubit 0}$, $\vert \tilde c \rangle=\text{qubit 1}$, ..., $\vert + \rangle = x$)

+

In a single counting sequence from $\vert \tilde 0 \rangle$ to $\vert \tilde {16} = \tilde 0 \, (\text{mod} \, \tilde {16}) \rangle$ the qubits associated with $\vert \tilde a \rangle, \, \vert \tilde b \rangle, \, \vert \tilde c \rangle$, and $\vert \tilde d \rangle$ make exactly $2^3, \, 2^2, \, 2^1$, and $2^0$ full rotations in their respective equatorial planes. Similarly, if we consider "no rotation" in the equatorial plane as the state $H\vert 0 \rangle=\vert+\rangle$, then $\vert \tilde 0 \rangle = \vert ++++ \rangle$ gives all qubits unrotated, while $\vert \tilde {15} \rangle$ gives all qubits at their maximal rotation (in the positive direction). [Note that the single qubit QFT is just the Hadamard gate, $H$. In turn, $H$ is simply the 2-level DFT as noted in this previous answer.]

+

In this example you can see how the high magnitude associated with $\vert a \rangle$ as a constituent of $\vert n \rangle$ in the computational basis corresponds to a high frequency associated with $\vert \tilde a \rangle$ as a constituent of $\vert \tilde n \rangle$ in the Fourier basis, and so forth for $\vert b \rangle \,, \vert c \rangle$, and $\vert d \rangle$. Hopefully this helps to make the analogy between QFT and DFT more tangible.

+

The equations used above were specific to the example of a four-qubit system. They generalize naturally to $N$-qubit systems as +$$\vert n \rangle = {\Big \vert} \sum_{k=0}^{N-1} x_k 2^k {\Big \rangle} = \vert x_0 ... x_{N-1} \rangle, \; x_k = \lbrace 0,1 \rbrace, \, n= \lbrace 0,...,2^N-1 \rbrace,$$ +$$\text{QFT}\vert n \rangle = \vert \tilde n \rangle = \frac{1}{\sqrt{2^N}}(\vert 0 \rangle + e^{2 \pi i n / 2} \vert 1 \rangle) \otimes ... \otimes (\vert 0 \rangle + e^{2 \pi i n / 2^N} \vert 1 \rangle).$$

+

If you're looking for additional familiarity and comfort with the QFT, it's a great exercise to convince yourself that both $\vert n \rangle$ and $\vert \tilde n \rangle$ are orthonormal bases for $\mathbb{C}^{2^N}$. Another great exercise is to convince yourself that +$$QFT = \frac{1}{\sqrt{2^N}} \sum_{n=0}^{2^N-1} \, \sum_{\tilde n=0}^{2^N-1}e^{2 \pi i n \tilde n/2^N} \vert \tilde n \rangle \langle n \vert$$ +is a unitary operator on $\mathbb{C}^{2^N}$. (Note that the validity of either of the statements in these two excercises implies the validity of the other.)

+",8623,,8623,,12/27/2020 12:08,12/27/2020 12:08,,,,0,,,,CC BY-SA 4.0 +15295,2,,15293,12/27/2020 8:05,,1,,"

How about:

+
def random_bitstring_generator(bit_number, backend):
+    bitstring = ""
+
+    one_qubit_random_bit_generator_circuit = QuantumCircuit(1, 1)
+    one_qubit_random_bit_generator_circuit.h(0)
+    one_qubit_random_bit_generator_circuit.measure(0, 0)
+
+    for _ in range(bit_number):
+        counts = execute(one_qubit_random_bit_generator_circuit, backend, shots=1).result().get_counts()
+        bit = list(counts.keys())[0]  
+        bitstring += bit
+
+    return bitstring
+
+backend = BasicAer.get_backend('qasm_simulator')
+random_bitstring_length = 100
+print(random_bitstring_generator(random_bitstring_length, backend) ) 
+
+

This would output something like:

+
0000010000010010001000111010001110001000000100110011110110101010111011001100100001100100001101100000
+
+

Note that the number of shot is 1 since we just creating some random number and not finding the probability of seeing $|0\rangle$ and $|1\rangle$.

+",9858,,,,,12/27/2020 8:05,,,,1,,,,CC BY-SA 4.0 +15296,2,,15262,12/27/2020 10:06,,1,,"

I think it probably helps to explore the specific example you asked about. Let $U$ be the unitary error +$$ +U=\alpha 1+\beta X+\gamma Y+\delta Z +$$ +for some complex parameters $\alpha,\beta,\gamma,\delta$, acting on the first qubit of a multi-qubit system. We could constrain them a bit, but we don't need to. Now imagine you have a state encoded into an error correcting code: +$$ +|\psi\rangle=a|0_L\rangle+b|1_L\rangle. +$$ +If I apply the $U$, then obviously I have the state +$$ +U|\psi\rangle=\alpha|\psi\rangle+\beta X|\psi\rangle+\gamma Y|\psi\rangle+\delta Z|\psi\rangle. +$$ +Now you perform syndrome extraction for you code. You'll have some ancillas that you end up measuring which will tell you what error you have (type and location) assuming no more than one error has happened anywhere. So, effectively, we'd have some state that looks like +$$ +\alpha|\psi\rangle|\text{none}\rangle+\beta X|\psi\rangle|X,1\rangle+\gamma Y|\psi\rangle|Y,1\rangle+\delta Z|\psi\rangle|Z,1\rangle. +$$ +When we measure the ancilla, it will return one of those values. Perhaps $|Y,1\rangle$. In which case, you know your system is in the state $Y|\psi\rangle$ after measurement, and you can correct it by applying $Y$ on qubit 1 as the syndrome extraction told you to.

+

Hopefully you can now see, thanks to linearity + measurement, how the decomposition of any error map in terms of Pauli errors works.

+",1837,,,,,12/27/2020 10:06,,,,7,,,,CC BY-SA 4.0 +15297,2,,15284,12/27/2020 10:45,,1,,"

In your code, circuits is an array of array of quantum circuits and each element of circuits is an array of quantum circuits. In the code, you are using a for loop to run each element of the circuits array individually using the for loop. This runs each of the 10 array of circuits one after the other. However, you can run all the quantum circuits of all the arrays all at once. All you have to do is to construct an array say all_circuits and append all the quantum circuits of each of the circuitsi. Then you can run the simulation using this array of circuits. Once the results are out, you can then post process it to get an array of array of results. So the code after creating all the circuits will be more like the below:

+
all_circuits = []
+for i in range(10):
+    all_circuits += circuits[i][:]
+
+from qiskit.tools.monitor import job_monitor
+qjob = execute(all_circuits,shots=shots,backend=backend)
+job_monitor(qjob)
+result = qjob.result()
+
+counts = []
+for i in range(10):
+    count_i = []
+    for j in range(nuni):
+        count_i.append(result.get_counts(all_circuits[(nuni*i)+j]))
+    counts.append(count_i)
+
+

Since you execute all the circuits at one, this would reduce the time of execution quite a lot. +Also, if you are using execute, you could also skip transpile since transpile will also be performed as a part of execute. This might not decrease the run time but might help in writing the code simpler. I hope this helps.

+",9097,,,,,12/27/2020 10:45,,,,0,,,,CC BY-SA 4.0 +15298,1,,,12/27/2020 18:45,,3,346,"

I am trying to understand how does the gate-level implementation of eigenvalue-inversion step in the HHL algorithm works.

+

I am following this reference, where it is stated (Lemma 4) that this can be accomplished by the use of controlled rotations:

+

$$ U_\theta: |\widetilde{\theta} \rangle |0 \rangle \rightarrow |\widetilde{\theta} \rangle \left(\cos \widetilde{\theta} |0\rangle + sin \widetilde{\theta} |1 \rangle \right ) $$

+

$$U_\theta = \sum_{\widetilde{\theta} \in \{0,1\}^n} |\widetilde{\theta}\rangle \langle \widetilde{\theta}| \otimes \exp \left(-i \widetilde{\theta} \sigma_y \right) $$

+

where $\widetilde{\theta}$ is the n-bit finite precision representation of the angle $\theta$, and $\sigma_y$ the Y Pauli matrix.

+

My question is, how are the rotation angles $\widetilde{\theta}$ for the unitary $U_\theta$ calculated/applied without a-priori knowledge of the eigenvalues $\lambda_j$ of the system matrix $A$?

+

I understand that the state-vector $|\widetilde{\theta} \rangle$ is obtained in the previous step of the algorithm by extracting the eigenvalues $|\lambda_j \rangle$ of $A$ using QPE (and then applying an inverse + arcsin function as described here), but I am not sure how are these angles also applied as the parameters for the controlled-rotation gates (exponent parameter in $U_\theta$.)

+

FYI, I did see this other post where it is stated: "You... ...have (at least a good approximation to) your eigenvalues recorded on a register. If you control off that register, you can use it to decide the angle of the rotation for each eigenvector."

+

So my question is how do you "use it [the register containing $|\widetilde{\theta} \rangle$] to decide the angle of the rotation [$\widetilde{\theta}$ in the $\exp$ function of $U_\theta$]"?

+

Thanks!

+",8731,,8731,,12/27/2020 19:40,12/28/2020 11:25,Gate-level implementation of Eigenvalue-Inversion in HHL,,1,3,,,,CC BY-SA 4.0 +15299,1,,,12/27/2020 18:59,,2,130,"

I am trying to understand Box 2.7 on page 113 of Quantum Computation and Quantum Information book by Nielsen and Chuang. They start out with following wave function:

+

\begin{equation} +\psi = \frac{|01\rangle-|10\rangle}{\sqrt 2} +\end{equation}

+

Now let $\vec{v} = k(2,3,5)$ where $k$ is just normalization factor (equal to $\frac{1}{\sqrt {38}}$) so that length of $\vec{v}$ is 1. Can someone now tell me what does it even mean that Alice will measure $\vec{v} \cdot \vec{\sigma}$ on her qubit?

+

And what happens when Bob measures $\vec{v} \cdot \vec{\sigma}$ on his qubit?

+

I am looking for a worked out answer with numbers in it rather than mathematical symbols.

+",14251,,55,,12/29/2020 11:30,12/29/2020 11:30,EPR Experiment: What does it mean for Alice to measure $\vec{v} \cdot \vec{\sigma}$ on her qubit?,,1,0,,,,CC BY-SA 4.0 +15300,1,15303,,12/27/2020 20:10,,9,1901,"

It seems to me that the "disjunction gate" (aside: is that its proper name?) can be thought of as the combination of three gates, G1, G2, and G3, where G2 is the CCNOT gate, and $G1 = G3 = ¬_a \otimes ¬_b \otimes I_c$. For context, see the bottom two rows of the following figure that I created in draw.io: +

+

Is there a name for the gate $¬_a \otimes ¬_b \otimes I_c$ (the one I'm calling NaNbIc)?

+",14276,,2293,,12/28/2020 4:38,6/2/2021 1:26,Is there a name for the 3-qubit gate that does NOT NOT NOTHING?,,2,1,,,,CC BY-SA 4.0 +15301,1,15305,,12/27/2020 22:47,,8,1284,"

I know that for Steane code, we can implement transversally some gates like cNOT, Hadamard and Pauli.

+

What I am looking for is a resource in which it is explained why implementing those gate give rise to the good logical operation.

+

If this is a result more general than Steane I would be interested in a "general enough" approach showing it.

+",5008,,10480,,3/26/2021 20:20,7/3/2022 20:27,Transversal logical gate for Stabilizer (or at least Steane code),,1,0,,,,CC BY-SA 4.0 +15302,2,,15300,12/27/2020 23:14,,7,,"

Welcome to QCSE. You seem to have gotten some of the gist of quantum gates but don't be surprised if not every such gate is promoted to having a specific, universally recognized name.

+

A reason some gates such as $\mathsf{CCNOT}$ (Toffoli) or $\mathsf{CSWAP}$ (Fredkin) have such a name is because they have been found to be useful and are a shorthand for the specific functions they perform. Indeed, the properties of both the $\mathsf{CCNOT}$ gate and the $\mathsf{CSWAP}$ gates were investigated in the context of reversible (classical) computing as studied in the 70's/early 80's, prior to/parallel to the beginnings of quantum computing.

+

Furthermore other lessons from classical computer engineering may form a context for quantum computing. For example, you properly identified a quantum $\mathsf{SWAP}$ gate, but classically promoting such an operation to a formal "gate" appears to be overkill. A classical computer engineer wishing to implement such a classical $\mathsf{SWAP}$ gate wouldn't likely consider any specific layout of CMOS transistors implementing a swap; rather, she would instead just consider jumping one input around another with a set of vias/metal runners. However, a quantum computer engineer (if there is such a term) would indeed be worried about how she implements the gate by means of the appropriate microwave/laser pulses, for example. A quantum $\mathsf{SWAP}$ is something entirely different from a classical swap; thus it's appropriate for us to give it a formal name.

+

Looking more at your specific gate, each input is a single-qubit gate, and there's no way for any entanglement to be created with such a gate. For example, if each of $\vert a\rangle$, $\vert b\rangle$, and $\vert c\rangle$ were unentangled prior to the operation of the $\mathsf{HOCKING}$ gate, they would be afterwards.

+

Thus don't be surprised if your gate doesn't have a specific, universally recognized name.

+",2927,,2927,,6/2/2021 1:26,6/2/2021 1:26,,,,1,,,,CC BY-SA 4.0 +15303,2,,15300,12/27/2020 23:36,,11,,"

The gate in which you're interested:
+
+would more often be called $X_1X_2I_3$ rather than $¬_a ¬_b I_c$, because we use $X$ to denote the NOT gate more often than we use $¬$.

+

However it is very unlikely that $X_1X_2I_3$ is given a new name, because there's nothing going on other than just two $X$ gates. CNOT has a name because the "C" part in CNOT denotes something that isn't quite so easily captured by something like $X,Y$ or $Z$. It seems that you have some familiarity with classical gates, is there any name for the 3-bit gate that does NOT to the first two bits and nothing to the third?

+",2293,,,,,12/27/2020 23:36,,,,2,,,,CC BY-SA 4.0 +15304,2,,15279,12/28/2020 1:19,,2,,"

This is nothing but a controlled-unitary gate. The only difference to an "ordinary" controlled-unitary is that now, the control qubit is encoded in the overall state of the device that implements the unitary.

+",491,,,,,12/28/2020 1:19,,,,0,,,,CC BY-SA 4.0 +15305,2,,15301,12/28/2020 4:08,,8,,"

Let $\mathcal{H}$ be the Hilbert space of a set of physical qubits and let $S$ be the stabilizer group of a stabilizer code $\mathcal{G} \subset \mathcal{H}$.

+

A transversal operator $U$ on $\mathcal{H}$ implements a logical operator on $\mathcal{G}$ if it maps $\mathcal{G}$ back to itself. This can be established by showing that $U$ does not change the stabilizer group $S$ of $\mathcal{G}$. In order to do this, we need to know how stabilizers transform under unitary gates. Suppose that $g$ is an operator that stabilizes $|\psi\rangle$, i.e. $g|\psi\rangle = |\psi\rangle$. Then

+

$$ +UgU^\dagger U|\psi\rangle = Ug|\psi\rangle = U|\psi\rangle\tag1 +$$

+

and we see that $UgU^\dagger$ stabilizes $U|\psi\rangle$. We will use this fact to demonstrate that certain transversal operators do not change the stabilizer group of stabilizer codes that meet certain criteria. We will also use $(1)$ to determine the action of those transversal operators within the code subspace by analyzing their effect on the logical Pauli operators.

+

Controlled-NOT

+

Claim: If $\mathcal{G}=CSS(C_1, C_2)$ is a Calderbank-Shor-Steane code for classical linear codes $C_1$ and $C_2$, $C_2^\perp \subset C_1$ then transversal CNOT is a logical CNOT on $\mathcal{G}$.

+

Remark 1: There is ambiguity in the use of the $CSS(C_1, C_2)$ notation in the literature. For example, Wikipedia and Nielsen & Chuang put $C_2^\perp$ in the second position rather than $C_2$.

+

Remark 2: The condition $C_2^\perp \subset C_1$ is not an additional restriction on $\mathcal{G}$. It is part of the definition of a CSS code necessary to make sure that the $X$ type and $Z$ type stabilizer generators commute. Consequently, the claim says that CNOT admits transversal implementation for any CSS code.

+

Proof sketch: Let $g_x$ be a tensor product of identity $I$ and Pauli $X$ operators and similarly for $g_z$. Since $\mathcal{G}$ is a CSS code, we can choose stabilizer generators that are either of the form $g_x$ or of the form $g_z$. Calculate that

+

$$ +\mathrm{CNOT} \circ (g_x \otimes I) \circ \mathrm{CNOT} = g_x \otimes g_x \\ +\mathrm{CNOT} \circ (I \otimes g_x) \circ \mathrm{CNOT} = I \otimes g_x \\ +\mathrm{CNOT} \circ (g_z \otimes I) \circ \mathrm{CNOT} = g_z \otimes I \\ +\mathrm{CNOT} \circ (I \otimes g_z) \circ \mathrm{CNOT} = g_z \otimes g_z. +$$

+

Note that if $g_x, g_z \in S$ then all operators on the right hand sides of the four equations above are in $S \times S$. Moreover, every operator in $S \times S$ can be obtained as a composition of operators of the form $g_x \otimes I$, $g_z \otimes I$, $I \otimes g_x$ and $I \otimes g_z$. We conclude that transversal CNOT preserves $S \times S$.

+

By analyzing the action of transversal CNOT on the logical $X$ and $Z$ operators along the same lines as above, we see that the logical operator effected by performing transversal CNOT on the physical qubits is in fact the logical CNOT. $\square$

+

Hadamard

+

Claim: If $\mathcal{G}=CSS(C_1, C_2)$ is a Calderbank-Shor-Steane code where the two classical linear codes are the same $C_1 = C_2$ then transversal Hadamard is a logical Hadamard on $\mathcal{G}$.

+

Remark: The definition of the CSS code requires that $C_2^\perp \subset C_1$, so $C_1$ cannot be arbitrary. It necessarily contains its own dual.

+

Proof sketch: As before, let $g_x$ be a tensor product of identity $I$ and Pauli $X$ operators. We see that

+

$$ +H g_x H = g_z \\ +H g_z H = g_x. +$$

+

where $g_z$ is obtained from $g_x$ by replacing $X$ operators in the tensor product with $Z$ operators. Note that since $\mathcal{G}$ is a CSS code, we can choose stabilizer generators that are either of the form $g_x$ or of the form $g_z$. Moreover, since $C_1 = C_2$, $g_x \in S$ if and only if $g_z \in S$. Consequently, transversal Hadamard preserves the stabilizer.

+

As before, the analysis extends to logical $X$ and $Z$ operators and therefore transversal $H$ on physical qubits implements the logical Hadamard gate. $\square$

+

Phase gate

+

(For completeness we include the phase gate even though it is not mentioned in the question.)

+

Claim: If $\mathcal{G}=CSS(C_1, C_2)$ is a Calderbank-Shor-Steane code where the two classical linear codes are the same $C_1 = C_2$ and $C_2^\perp\subset C_1$ is doubly-even (i.e. all codewords in $C_2^\perp$ have Hamming weight divisible by four) then transversal phase gate $P$ preserves the stabilizer $S$.

+

Proof sketch: Since the phase gate commutes with the Pauli $Z$ operator it is clear that all $g_z$ stabilizers are preserved. For any $g_x$, we have

+

$$ +P g_x P^\dagger = i^{w(g_x)} g_x g_z +$$

+

where $w(g_x)$ is the weight of stabilizer $g_x$, i.e. the number of non-identity factors in it. Since $C_2^\perp$ is doubly-even, we see that

+

$$ +P g_x P^\dagger = g_x g_z. +$$

+

Finally, since $C_1=C_2$ we have $g_z\in S$ and thus $P g_x P^\dagger\in S$. $\square$

+

Note that the transversal phase operator is not necessarily the logical phase gate. However, $C_2^\perp$ is an even code so the transversal $Z$ belongs to the normalizer $N(S)$. Thus, as long as transversal $Z$ is not in the stabilizer we can choose it to play the role of the logical $Z$. Under this choice transversal phase operator commutes with the logical $Z$ and therefore its action on $\mathcal{G}$ is a diagonal gate. Moreover, applying transversal phase operator twice yields the logical $Z$. We conclude that in this case the transversal phase operator is either a logical phase gate or its inverse.

+

Pauli operators

+

Claim: If $\mathcal{G}$ is a stabilizer code, then logical Pauli operators are transversal.

+

Proof sketch: This follows immediately from the fact that logical Pauli operators are chosen from the normalizer $N(S)$ of the stabilizer group $S$ in the $n$-qubit Pauli group $\mathcal{P}_n$ since all operators in $\mathcal{P}_n$ are transversal by definition. $\square$

+

Steane code

+

Steane code is $CSS(C_1, C_2)$ where $C_1 = C_2$ is the Hamming $[7, 4, 3]$ code.

+

Since it is a stabilizer code, Pauli operators are transversal. Since it is a CSS code, CNOT is transversal. Since $C_1 = C_2$, Hadamard is transversal. Since $C_1$ is also doubly-even, the phase gate is transversal.

+

Thus, the entire Clifford group admits a transversal implementation in the Steane code. By Eastin-Knill theorem, we cannot extend the set of transversal gates to a universal gateset. In particular, the $T$ gate does not have a transversal implementation in the Steane code.

+

References

+ +",10480,,10480,,7/3/2022 20:27,7/3/2022 20:27,,,,22,,,,CC BY-SA 4.0 +15306,1,15312,,12/28/2020 9:57,,1,183,"

I have read some papers talking about Pauli operator grouping for simultaneous measurement in VQE. I was wondering can this "simultaneous measurement" approach be used in other variational quantum algorithms? Like variational quantum classifier?

+",9105,,55,,12/29/2020 11:32,9/22/2021 19:35,Applications of pauli operator grouping for simultaneous measurement in VQE,,1,0,,,,CC BY-SA 4.0 +15307,2,,15298,12/28/2020 11:25,,1,,"

Using the register to decide the angle of rotation means the following: you have a register $|\tilde{\theta}\rangle$ (composed of potentially more than one qubit) and you apply rotations of another register controlled on the value of the qubits of $|\tilde{\theta}\rangle$. Different rotations that you apply result in different functions being implemented on your ancilla qubits. But that was possibly already known to you.

+

The question of which rotations to do for applying a specific function is much more complicated, and I am not aware of any general solution. For once, Qiskit has its own implementation of HHL, but I don't know up to which point it is general. There are however, other examples in which it is "easy" to implement, for instance, the eigenvalue inversion function required for HHL. In this paper, the authors implement an approximation of the eigenvalue inversion subroutine (the code in Quil can be found in the associated GitLab repository) that is exact in the case of eigenvalues that are powers of 2. The reason why it is exact for powers of 2 is because in that case the inversion can be written as a combination of bit swaps, so the eigenvalue inversion subroutine is a collection of controlled SWAP gates (a pictorial representation of the circuit is in Fig. 3 in this paper). But, as I said before, I am not aware of general ways of implementing large classes of functions, so far.

+",1917,,,,,12/28/2020 11:25,,,,2,,,,CC BY-SA 4.0 +15308,2,,11422,12/28/2020 11:34,,0,,"

The question of how the eigenvalue inversion subroutine is implemented in general is not solved yet in a satisfactory way, to my knowledge. I myself spent quite some time looking for the classical algorithm implemented in classical computers to try to make it reversible, but even that was lost time. What I am aware of is that Qiskit has its own implementation (although I don't know how general it is), and that there are some papers that propose/implement approximations of the inversion function. For instance, this paper implements an approximation of the eigenvalue inversion subroutine (the code in Quil can be found in the associated GitLab repository) that is exact in the case of eigenvalues that are powers of 2. The reason why it is exact for powers of 2 is because in that case the inversion can be written as a combination of bit swaps, so the eigenvalue inversion subroutine is a collection of controlled SWAP gates (a pictorial representation of the circuit is in Fig. 3 in this paper). It is however very unlikely that this algorithm can be improved further without a huge increase in qubit count, since the next step of the iteration (Fig. 4 in the last paper cited) has an output very nonlinear in the input.

+",1917,,,,,12/28/2020 11:34,,,,0,,,,CC BY-SA 4.0 +15309,1,,,12/28/2020 14:10,,2,65,"

To repeat the titular question: "What is the largest absolute value attainable by an off-diagonal real or complex component of a $4 \times 4$ density matrix?"

+",3089,,,,,12/29/2020 11:01,What is the largest absolute value attainable by an off-diagonal real or complex component of a $4 \times 4$ density matrix?,,1,0,,,,CC BY-SA 4.0 +15310,2,,15309,12/28/2020 15:27,,3,,"

Consider a $2\times2$ Hermitian matrix +$ A \equiv \begin{pmatrix}a & b \\ \bar b & c\end{pmatrix}.$ +For $A$ to be positive semidefinite (PSD), we clearly need $a,c\in\mathbb R$ and $a,c\ge0$. +The eigenvalues are +$$2\lambda_\pm = (a+c)\pm\sqrt{(a-c)^2+4|b|^2}.$$ +For $A\ge0$ we thus need $(a+c)^2 \ge (a-c)^2 + 4|b|^2$ i.e. $ac\ge |b|^2$ and $|b|\le \sqrt{ac}$.

+

Suppose now $\rho$ is some $n\times n$ density matrix. A matrix is PSD iff all its principal minors are. For any $i<j$, we must thus have $|\rho_{ij}|\le \sqrt{\rho_{ii}\rho_{jj}}$.

+

This reduces the problem to figuring out the maximum value of $pq$ over all $p,q\ge0$ such that $p+q\le1$. This is achieved by the choice $p=q=1/2$, and thus +$$\max_{\rho\in\mathrm D(\mathcal H)}|\rho_{ij}| = \frac12,$$ +for $i\neq j$, where $\mathrm D(\mathcal H)$ denotes the set of density matrices over a space of dimensions $\ge2$.

+

In short, the maximum value of any coherence is $1/2$, achieved with a state of the form $|+\rangle\!\langle +|$ (with $|+\rangle$ the Bell state defined over the appropriate subspace).

+",55,,55,,12/29/2020 11:01,12/29/2020 11:01,,,,3,,,,CC BY-SA 4.0 +15312,2,,15306,12/28/2020 17:16,,3,,"

I don't see why not since in VQE the only thing that being done on the quantum computer is the evaluation of $ \langle H \rangle $, where $H$ is some Hermitian matrix. For quantum chemistry purpose, $H$ usually represents the electronic Hamiltonian of the molecular system.

+

Because $\langle H \rangle$ cannot be measured directly on a quantum computer, but instead it must be decompose into linear combination of Pauli strings $P_i \in \{I,X,Y,Z\}^{\otimes N}$. For example, $\langle H \rangle = \langle II \rangle + \langle ZZ \rangle + \langle ZI \rangle + \langle IZ \rangle + \langle XX \rangle $.

+

The number of Pauli strings scales as $O(N^4)$ (this can be reduced through various techniques) so to save the number of evaluations, we grouped the Pauli strings, $P_i$, that commutes with each other. For example, $IXZ$ and $ZXZ$ commute, since $[IXZ, ZXZ] = IXZ\cdot ZXZ - ZXZ \cdot IXZ = 0$. So you can find a whole family of these commutative terms. Then within this family, you can just measure in the $Z$ basis for 1st qubit, $X$ basis for 2nd qubit, and $Z$ basis for 3rd qubit.

+

Thus, this grouping Pauli opertator for simultaneous measurement is not specific to VQE or quantum chemistry application portion of VQE. As long as you are evaluating $\langle M \rangle$ for some matrix $M$ through evaluating the expectation of the linear combination of the Pauli strings then this technique can be applied.

+",9858,,1867,,9/22/2021 19:35,9/22/2021 19:35,,,,5,,,,CC BY-SA 4.0 +15313,2,,15299,12/28/2020 23:54,,1,,"

The Physical System (Background)

+

The system in Box 2.7 is a spin singlet, which physically refers to two electrons coupled such that their spin angular momentum cancels out perfectly. In many regards, two electrons in this state behave as a single particle with zero spin angular momentum.

+

The angular momentum of a classical particle has a continuous spectrum of possible directions and magnitude. In stark contrast, electron spin has only two possible directions (up and down) and one possible magnitude ($\frac{1}{2} \hbar$). In a spin singlet state one electron has up-spin, and the other has down-spin.

+

When two electrons in a singlet state are spatially separated, they continue to behave as a single particle in certain ways. This is the type of the non-local behavior that made many physicists uneasy (notably the EPR authors).

+

The combination of spin and electric charge in an electron gives it a magnetic dipole moment. To determine the spin state of an electron, Stern-Gerlach measurements pass electrons through an inhomogeneous magnetic field such that electrons experience a force dependent on the orientation of their magnetic moment. The result is that electrons with up and down spin are deflected in two distinct directions.

+

Choice of Measurement Basis, $\vec v \cdot \vec \sigma$ (Answer)

+

When Alice and Bob perform a Stern-Gerlach measurement on their respective electrons, they must each choose an orientation of the magnetic field described above. In other words they must pick a $\vec v$, which is equivalent to picking a point on a unit sphere. Here, the Pauli matrices ($\vec \sigma$) can be thought of as a convenient basis for real 3-space.

+

In your example, Alice has chosen +$$A = \vec v \cdot \vec \sigma = \frac{1}{\sqrt{38}} (2,3,5) \cdot \vec \sigma = \frac{1}{\sqrt{38}} \begin{bmatrix} 5 & 2-3i \\ 2+3i & -5 \end{bmatrix}.$$

+

This matrix is called a single particle spin operator and represents the orientation of Alice's magnetic field relative to some agreed coordinate reference frame. This matrix is Hermitian, which means that it is "real" (as opposed to complex or imaginary) in every way that matters. Bob's decision to choose the same orientation means that the joint spin measurement operator is given by +$$A \otimes A = \frac{1}{38}\begin{bmatrix} 25 & 10-15i & 10-15i & -5-12i \\ 10+15i & -25 & 13 & -10+15i \\ 10+15i & 13 & -25 &-10+15i \\ -5+12i & -10-15i & -10-15i & 25 \end{bmatrix}.$$

+

The wavefunction of a singlet states is given by +$$\vert \psi \rangle = \frac{\vert 01 \rangle- \vert 10 \rangle}{\sqrt 2}= \begin{bmatrix} 0 \\ \frac{1}{\sqrt{2}} \\ -\frac{1}{\sqrt{2}} \\ 0 \end{bmatrix}.$$

+

Now we have everything we need to evaluate the wavefunction over the joint spin measurement operator with nothing more than matrix multiplication. +$$\langle \psi \vert A \otimes A \vert \psi \rangle = -1,$$ +where the value $-1$ represents perfect anti-correlation (as claimed in Box 2.7).

+

It's worth noting that this result, and any others obtained in the same manner, is not sensitive to the coordinate reference frame agreed upon by Alice and Bob. As constructed any (non-relativistic) change in coordinate reference frame is effected by a unitary transformation, $A' = U^\dagger A U$, and unitary transformations preserve inner products.

+

If you want to go through the calculations, here's the Matlab script I used to double check it myself.

+
>> A=1/38^.5*[5,2-3i;2+3i,-5]
+
+A =
+
+0.8111 + 0.0000i   0.3244 - 0.4867i
+0.3244 + 0.4867i  -0.8111 + 0.0000i
+
+>> AoA=kron(A,A)
+
+AoA =
+
+0.6579 + 0.0000i   0.2632 - 0.3947i   0.2632 - 0.3947i  -0.1316 - 0.3158i
+0.2632 + 0.3947i  -0.6579 + 0.0000i   0.3421 + 0.0000i  -0.2632 + 0.3947i
+0.2632 + 0.3947i   0.3421 + 0.0000i  -0.6579 + 0.0000i  -0.2632 + 0.3947i
+-0.1316 + 0.3158i  -0.2632 - 0.3947i  -0.2632 - 0.3947i   0.6579 + 0.0000i
+
+>> psi=1/2^.5*[0;1;-1;0]
+
+psi =
+
+     0
+0.7071
+-0.7071
+     0
+
+>> psi'*AoA*psi
+
+ans =
+
+-1.0000
+
+",8623,,8623,,12/29/2020 0:55,12/29/2020 0:55,,,,5,,,,CC BY-SA 4.0 +15314,1,15317,,12/29/2020 6:25,,5,499,"

Show that the Hadamard gate is equivalent to a 180 degree rotation about the axis defined by $(\vec{e_x} - \vec{e_z}) / \sqrt{2}$ where $\vec{e_x}$ and $\vec{e_z}$ are unit vectors pointing along the x and z axes.

+

I can visualize that this is true based off the mapping of the computational basis vectors to the Hadamard basis vectors on the bloch sphere but I don't know how to show this mathematically.

+",14184,,55,,12/30/2020 10:49,12/30/2020 10:49,Show that the Hadamard gate is equivalent to a 180 degree rotation of a certain axis,,2,0,,,,CC BY-SA 4.0 +15316,1,,,12/29/2020 8:35,,5,127,"

Let's say we have the following circuit (picture and code shown below), and now the $q_0$ is an ancilla qubit. If the system of interest has only two qubits, Is there a way to use only $q_{1,2}$ as my ansatz and plug it into the built-in VQE in qiskit?

+

A little more context is the following. I would like to realize a quantum circuit consists of a linear combination of two unitary operators, such as $I+g$ where $I$ is the identity operator and $g$ is the translation operator that moves the qubits as $q_0\rightarrow q_1,q_1\rightarrow q_2,q_2\rightarrow q_0$. According to this paper, https://arxiv.org/abs/1202.5822, it is possible to do so with an ancilla qubit, see Fig. 1 and Eq. 3. But suppose I would like use the resulting circuit as a variational ansatz, how can I do that? If there is an approach to realize $I+g$ without ancilla qubit, I will be very happy to learn that!

+
from qiskit.circuit import ParameterVector
+from qiskit import QuantumCircuit
+theta = ParameterVector( 'theta' , 2 )
+qc = QuantumCircuit( 3 ) 
+q = qc.qubits
+qc.h(q) 
+qc.crx( theta[0] , q[0], q[1] )
+qc.cry( theta[1] , q[1], q[2] )
+qc.draw('mpl')
+
+

+",9816,,55,,4/27/2021 11:01,4/27/2021 11:01,Run VQE for parametrized quantum circuit with ancilla qubits,,0,1,0,,,CC BY-SA 4.0 +15317,2,,15314,12/29/2020 8:50,,3,,"

First confirm that $\vert \psi \rangle = (\vec{e_x} - \vec{e_z}) / \sqrt{2}$ is an eigenvector of $H$. Indeed, the eigenvalues of $H$ are $\pm 1$, and $H \vert \psi \rangle = (-1) \vert \psi \rangle$, confirming this axis is fixed by $H$. An equivalent statement is that $H \vert \psi \rangle = \vert \psi \rangle$, up to global phase.

+

Second, note that $H$ is an involution ($H^2=I$) with both eigenvectors fixed up to global phase, so it's action on the Bloch sphere must be equivalent to a rotation by $\pi$. It's worth pointing out that the Bloch sphere is a complex projective line, not a Euclidean 2-sphere where $\det(H)=-1$ would have signaled a reflection.

+",8623,,,,,12/29/2020 8:50,,,,3,,,,CC BY-SA 4.0 +15318,2,,15110,12/29/2020 13:22,,0,,"

For a boolean-valued result, your code works.

+

If you are looking for a "more quantum mechanical" approach, then the swap trick best suits you.

+

The quantum circuit of the swap trick is as follows:

+

+

(figure comes from the cited paper.) In this circuit, $|\psi\rangle$ and $|\phi\rangle$ are the two states that you want to compare, then the probability that measuring the uppermost qubit(the control qubit) returns a "0" is $\frac{1}{2}+\frac{1}{2}F(|\psi\rangle,|\phi\rangle)$, where is the fidelity I mentioned in the comment.

+

Since you know how to get the state vector from qiskit directly, it is more efficient and accurate to calculate the fidelity(or the trace distance) of the two state vectors.

+",13647,,,,,12/29/2020 13:22,,,,0,,,,CC BY-SA 4.0 +15319,1,15322,,12/29/2020 19:14,,7,1320,"

Qubits exist in a 2D complex vector space, but we can represent qubits on the Bloch sphere as a 3D real vector space. Mathematically, what makes this possible – why don't we need 4 real dimensions?

+",10388,,10480,,12/31/2020 8:04,1/7/2021 19:20,What makes representing qubits in a 3D real vector space possible?,,4,3,,,,CC BY-SA 4.0 +15320,2,,15319,12/29/2020 19:38,,6,,"

That is because we have a condition on the two complex amplitudes. The normalization condition. So it eliminates one real number and hence we can use the Bloch sphere picture. +And its not exactly a 3D real space. Its similar but not exactly same.

+",14291,,,,,12/29/2020 19:38,,,,1,,,,CC BY-SA 4.0 +15321,2,,15319,12/29/2020 19:39,,12,,"

Three real parameters are sufficient due to the constraint that

+

$$ +|\alpha|^2 + |\beta|^2 = 1\tag1 +$$

+

where $\alpha$ and $\beta$ are the two components of a 2D complex vector describing the qubit state. This constraint ultimately derives from the fact that $|\alpha|^2$ and $|\beta|^2$ are probabilities of the two possible outcomes of the computational basis measurement.

+

In order to see how the constraint $(1)$ implies that three real parameters are sufficient write $\alpha = r e^{i\theta}$ and $\beta = s e^{i\zeta}$ and substitute into $(1)$ to get

+

$$ +r^2 + s^2 = 1.\tag{2} +$$

+

This means that $r, \theta, \zeta \in \mathbb{R}$ are sufficient to specify $\alpha, \beta \in \mathbb{C}$ satisfying $(1)$.

+

Note that the global phase is unobservable and can be ignored, so we can in fact choose $\theta = 0$ (i.e. $\alpha\ge 0$). This means that two real parameters are in fact sufficient. This is why a pure state of a qubit can be represented as a point on the 2D Bloch sphere (mixed states occupy the interior).

+",10480,,491,,1/7/2021 19:20,1/7/2021 19:20,,,,2,,,,CC BY-SA 4.0 +15322,2,,15319,12/29/2020 19:44,,12,,"

Mathematically a qubit's coefficients $c_1$, $c_2$ must have the following properties:

+

\begin{align} +|c_1|^2 + |c_2|^2 =1 \tag{1}\\ +|c_1|, |c_2| \in [0,1], \tag{2} +\end{align}

+

because Born's rule tells us that the modulus squared is a (classical) probability, and classical probabilities must add up to exactly 1 and must be 0, 1 or in between 0 and 1.

+

However we know:

+

$$ +\sin^2\theta + \cos^2\theta = 1\tag{3} +$$

+

so we can set $c_1=\sin\theta$ and $c_2=\cos\theta$.

+

However also remember that $|e^{\textrm{i}\phi}|=1$, so we can add that to one of the coefficients, so that: $c_1=\sin\theta$ and $c_2=e^{\textrm{i}\phi}\cos\theta$.

+

Any more factors like $e^{\textrm{i}x}$ for different real-valued angles $x$ won't make a noticeable difference to any measurements, as the angles can be combined with each other, and remember that global phases do not make a difference to any measurements.

+

Therefore there's only two real-valued angles necessary: $\theta$ and $\phi$. We can add more, but they can always be factored out into what is known as a "global phase" which is something that doesn't make any difference in the outcomes of measurements.

+",2293,,2293,,12/30/2020 14:26,12/30/2020 14:26,,,,0,,,,CC BY-SA 4.0 +15323,1,15373,,12/29/2020 21:10,,2,68,"

Suppose we have a PauliWeightedOperator object from Qiskit. Is there any built-in method to convert it to the matrix representation in the computational basis? My search in the docs was not successful.

+",13457,,55,,12/30/2020 10:52,1/2/2021 4:38,Qiskit PauliWeightedOperator in the matrix representation?,,1,0,,,,CC BY-SA 4.0 +15325,1,15326,,12/30/2020 1:23,,3,242,"

+

In the picture above, the last layer with dot-shape, is called 1D ladder of controlled Z gates. It is stated in this paper to show the barren plateau issue. I want to know which is the control qubit, the higher one or the lower one?

+",13968,,55,,1/2/2021 10:31,1/2/2021 10:31,What is the control qubit in this 1D ladder of controlled Z gates?,,1,0,,,,CC BY-SA 4.0 +15326,2,,15325,12/30/2020 1:27,,7,,"

Controlled Z gate is symmetric with respect to the two qubits.

+

Its action in the computational basis is to leave the states $|00\rangle$, $|01\rangle$, $|10\rangle$ unchanged and to flip the phase of the state $|11\rangle$. Consequently, it does not matter which qubit we designate as control: it flips the phase only if both qubits are in state $|1\rangle$.

+

You can also see this from its matrix

+

$$ +CZ = \begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 1 & 0 \\ +0 & 0 & 0 & -1 +\end{pmatrix}. +$$

+

Swapping qubits corresponds to swapping the two middle columns and the two middle rows and in the case of CZ this transformation does not change the matrix.

+",10480,,10480,,12/30/2020 1:33,12/30/2020 1:33,,,,2,,,,CC BY-SA 4.0 +15327,1,15329,,12/30/2020 1:32,,3,309,"

This exercise wants me to prove the equivalence of the two circuits using their mathematical representations.

+

Circuit 1:

+

+

Circuit 2:

+

+

Circuit 1 (q1 CNOT q0) should be represented by $I \otimes P_0 + X \otimes P_1$. Circuit 2 (Hadamard q0 and q1, q0 CNOT q1, Hadamard q0 and q1) should be $(H \otimes H)(P_0 \otimes I + P_1 \otimes X)(H \otimes H)$.

+

I use the following identities +$$P_0 + P_1 = I = P_{+} + P_{-}$$ +$$X = P_{+} - P_{-}$$ +$$Z = P_0 - P_1$$ +$$P_{+} = HP_0H$$ +$$P_{-} = HP_1H$$ +where $P_0, P_1, P_{+}, P_{-}$ are $|0\rangle\langle 0|$, $|1\rangle \langle 1|$, $|+\rangle \langle +|$, and $| - \rangle \langle - |$ respectively.

+

I take circuit 1 and get this: +$$I \otimes P_0 + X \otimes P_1$$ +$$= (P_{+} + P_{-}) \otimes P_0 + (P_{+} - P_{-}) \otimes P_1$$ +$$= P_{+} \otimes (P_0 + P_1) + P_{-} \otimes (P_0 - P_1)$$ +$$= P_{+} \otimes I + P_{-} \otimes Z$$ +$$= HP_0H \otimes I + HP_1H \otimes Z$$

+

Are my circuit representations correct to begin with? If so, should the Z operator be there? Any help would be appreciated.

+",14184,,55,,1/2/2021 10:32,1/2/2021 10:32,Show that the two circuits are equivalent mathematically,,2,0,,,,CC BY-SA 4.0 +15328,1,,,12/30/2020 1:36,,9,211,"

HHL solves the linear equation $Ax=b$ by the quantum state $|x\rangle=A^{-1} |b\rangle$. However, the quantum state $|x\rangle$ is normalized and thus diffs a normalization constant from the solution vector $x$. My question is how to recover the missing normalization constant?

+

Especially, HHL is supposed to be applied to a scenario which does not need $x$ itself by some number $x^T M x$. In this case, normalization constant matters to compute $x^TMx$ by $\langle x|M|x\rangle$.

+",14297,,,,,1/25/2021 8:03,How to recover the normalization constant of the HHL solution,,2,0,,,,CC BY-SA 4.0 +15329,2,,15327,12/30/2020 1:40,,2,,"

Your derivation is correct and is just missing the final step:

+

$$ +\begin{align} +\dots &= HP_0H \otimes I + HP_1H \otimes Z \\ +&= HP_0H \otimes HH + HP_1H \otimes HXH \\ +&= (H\otimes H) (P_0 \otimes I) (H\otimes H) + (H\otimes H) (P_1 \otimes X) (H \otimes H) \\ +&= (H\otimes H) (P_0 \otimes I + P_1 \otimes X) (H \otimes H) +\end{align} +$$

+

where we used the identity $HXH=Z$ which is easy to check.

+",10480,,,,,12/30/2020 1:40,,,,0,,,,CC BY-SA 4.0 +15330,2,,15327,12/30/2020 2:27,,4,,"

You can also just convert it to matrix representation and show that the two matrix are the same.

+

Circuit 1: This have $q_1$ as the controlled qubit and so it has the matrix representation as unitary matrix $U_1$: +\begin{align} +U_1 = CNOT_{q_1, q_0} &= I \otimes |0\rangle\langle0| + X \otimes |1 \rangle \langle 1| = \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0\\ 0 & 1 & 0 & 0 \end{pmatrix} +\end{align} +where $X = \begin{pmatrix} 0 & 1\\ 1 & 0\end{pmatrix}$ and $|0\rangle\langle 0| = \begin{pmatrix} 1 & 0\\ 0 & 0 \end{pmatrix} $ and $|1\rangle\langle 1| = \begin{pmatrix} 0 & 0\\ 0 & 1 \end{pmatrix} $

+
+

Circuit 2: Here we have $U_2 = H\otimes H \cdot CNOT_{q_0, q_1} \cdot H \otimes H$

+

where $H = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1\\ 1 & -1\\ \end{pmatrix}$ and hence +$H \otimes H = \dfrac{1}{2} \begin{pmatrix} 1 & 1 & 1 & 1\\ 1 & -1 & 1 & -1\\ 1 & 1 & -1 & -1\\1 & -1 & -1 & 1 \end{pmatrix} $. +Therefore, +$$U_2 =\begin{pmatrix} 1 & 1 & 1 & 1\\ 1 & -1 & 1 & -1\\ 1 & 1 & -1 & -1\\1 & -1 & -1 & 1 \end{pmatrix} \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0 \end{pmatrix} \begin{pmatrix} 1 & 1 & 1 & 1\\ 1 & -1 & 1 & -1\\ 1 & 1 & -1 & -1\\1 & -1 & -1 & 1 \end{pmatrix} = \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0\\ 0 & 1 & 0 & 0 \end{pmatrix} $$

+
+

Thus, $U_1 = U_2$.

+",9858,,,,,12/30/2020 2:27,,,,0,,,,CC BY-SA 4.0 +15331,2,,15314,12/30/2020 3:10,,3,,"

A brute force way to do this is to use rotation matrices. You can rewrite the Hadamard matrix as +\begin{align} +H &= \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & \text{-}1 \end{pmatrix} \\ +&= \frac{1}{\sqrt{2}}\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 1 & \text{-}1 \\ 1 & 1 \end{pmatrix} \\ +&= R_x(\pi)R_y\left(\frac{\pi}{2}\right) +\end{align}

+

So its just the composition of two rotation matrices. If you write out the $SO(3)$ matrix representations for these rotations you get

+

\begin{align} +R_x(\pi)R_y\left(\frac{\pi}{2}\right) &\rightarrow \begin{pmatrix} +1 & 0 & 0 \\ +0 & \cos \pi & \text{-}\sin \pi \\ +0 & \sin \pi & \cos \pi +\end{pmatrix} \begin{pmatrix} \cos \frac{\pi}{2} & 0 & \sin \frac{\pi}{2}\\ +0 & 1 & 0 \\ +\text{-}\sin \frac{\pi}{2} & 0 & \cos \frac{\pi}{2}\end{pmatrix} \\ +&= \begin{pmatrix} +0 & 0 & 1\\ +0 & \text{-}1 & 0 \\ +1 & 0 & 0\end{pmatrix} +\end{align}

+

You can compare this to the rotation matrix for an arbitrary 3D rotation matrix $R_{\vec{n}}(\theta)$ around a unit vector $\vec{n}$ (see Wikipedia for example) to get an overconstrained system of equations. However in this case its easy to confirm that $\vec{n} = (1, 0, 1)/\sqrt{2}$ and $\theta=\pi$ is the correct choice.

+",1939,,,,,12/30/2020 3:10,,,,0,,,,CC BY-SA 4.0 +15332,1,15333,,12/30/2020 4:08,,3,1367,"

I was reading some material on QC online and I found some material that explains how to show that Bell states are orthonormal but without details.

+

I understand that we need to check $\langle state1|state2\rangle = 0$ but I'm not really sure how to calculate that with Dirac notation.

+

In the link above he somehow omitted the bra and the kets and just used the coefficients directly? I'm not sure I understand... Could someone please clarify a bit more?

+",13569,,13569,,9/26/2021 21:12,9/26/2021 21:12,How to show that Bell states are orthonormal,,3,0,,,,CC BY-SA 4.0 +15333,2,,15332,12/30/2020 4:31,,6,,"

First, note that $|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$ and $|1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$ and therefore $\langle 0 |1\rangle = \begin{pmatrix} 1 & 0 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \end{pmatrix}= 0 $ and similarly, $ \langle 1|0\rangle = 0$. Also note that $|00\rangle = |0\rangle \otimes |0\rangle$, $|01\rangle = |0\rangle \otimes |1\rangle$ etc. Hence, $\langle 00| 11\rangle = 0$, $\langle 00| 10 \rangle = 0$, etc. But $\langle 00| 00\rangle = 1$ and $\langle 11 | 11\rangle = 1$ should be obvious.

+

The four Bell states are:

+

$|\Phi^+ \rangle = \dfrac{1}{\sqrt{2}}\big(|00\rangle + |11\rangle \big) $
+$|\Phi^- \rangle = \dfrac{1}{\sqrt{2}}\big(|00\rangle - |11\rangle \big) $
+$|\Psi^+ \rangle = \dfrac{1}{\sqrt{2}}\big(|01\rangle + |10 \rangle \big) $
+$|\Psi^- \rangle = \dfrac{1}{\sqrt{2}}\big(|01\rangle - |10 \rangle \big) $

+

So therefore we have:

+

\begin{align} +\langle \Phi^- |\Phi^+ \rangle &= \dfrac{1}{\sqrt{2}}\bigg(\langle 00 | - \langle 11|\bigg) \dfrac{1}{\sqrt{2}}\bigg(|00\rangle + |11\rangle \bigg) \\ +&= \dfrac{1}{2} \bigg( \langle 00 |00\rangle + \langle 00 | 11\rangle - \langle 11 | 00\rangle - \langle 11| 11 \rangle \bigg) \\ +&= \dfrac{1}{2}\bigg( 1 + 0 - 0 - 1 \bigg) \\ +&= 0 +\end{align}

+

Similarly,

+

\begin{align} +\langle \Phi^- |\Psi^+ \rangle &= \dfrac{1}{\sqrt{2}}\bigg(\langle 00 | - \langle 11|\bigg) \dfrac{1}{\sqrt{2}}\bigg(|01\rangle + |10 \rangle \bigg)\\ + &= \dfrac{1}{2} \bigg( \langle 00 |01\rangle + \langle 00 | 10\rangle - \langle 11 | 01\rangle - \langle 11| 10 \rangle \bigg) \\ +&= \dfrac{1}{2}\bigg( 0 + 0 - 0 - 0 \bigg) \\ +&= 0 +\end{align}

+

And you can show that this is true for the others.

+",9858,,,,,12/30/2020 4:31,,,,1,,,,CC BY-SA 4.0 +15334,2,,15332,12/30/2020 8:09,,5,,"

The most basic but laborious way of checking that Bell states are orthonormal is to carry out the calculations for all sixteen inner products such as $\langle\Phi^+|\Psi^-\rangle$.

+

One way to do this is to switch from Dirac notation to standard linear algebra by replacing the kets and bras with appropriate column and row vectors. After this conversion you employ the formula for the complex dot product. Alternatively, you can perform the entire calculation in Dirac notation using known orthonormality relations such as those for the computational basis.

+

I suppose you were expecting the notes to use the letter method, but they employed the former. The methods are equivalent and should give you the same result.

+
+

The task can be made a little less laborious and notation more compact by exploiting the fact that the components of all four Bell states make up the columns of the matrix

+

$$ +U = \frac{1}{\sqrt{2}}\begin{pmatrix} +1 & 0 & 0 & 1 \\ +0 & 1 & 1 & 0 \\ +0 & 1 & -1 & 0 \\ +1 & 0 & 0 & -1 +\end{pmatrix}. +$$

+

This way the task of verifying orthonormality of the Bell states becomes the task of checking that $U$ is unitary, i.e. that $U^\dagger U = I$.

+
+

In some contexts (e.g. Nielsen & Chuang, section 1.3.6, p. 26) Bell states are introduced as the output of the quantum circuit

+

$$ +CNOT \circ (H \otimes I) \,|x\rangle|y\rangle\tag1 +$$

+

on the four computational basis states $|0\rangle|0\rangle, |0\rangle|1\rangle, |1\rangle|0\rangle$ and $|1\rangle|1\rangle$ as inputs. This way of defining the states makes the task of checking their orthonormality the easiest: the conclusion follows from the facts that the computational basis states are orthonormal and that unitaries (such as our quantum circuit $(1)$) preserve inner products.

+
+

Finally, Bell states can be represented as simple tensor networks. In this view, $|\Phi^+\rangle$ represents a "cup" and the other three Bell states differ from it by a Pauli operator. Inner product of $A$ and $B$ links up the two open ports of $A$ with the two open ports of $B$ into a closed loop which represents the trace of the product of the operators on it. When the two Bell states in the inner product are the same then the Pauli operators cancel and the result is the trace of $I/2$, i.e. one. Otherwise, it equals the trace of a Pauli operator, i.e. zero.

+",10480,,,,,12/30/2020 8:09,,,,1,,,,CC BY-SA 4.0 +15335,2,,15319,12/30/2020 9:16,,7,,"

For vector representation of any qubit it is true that:

+
    +
  1. it has to be a unit vector
  2. +
  3. global phase does not matter and can be fixed at any value
  4. +
+

As a result two degress of freedom are eliminated and as a result you are left with only two free parameters.

+

Note that although you represent a qubit on Bloch sphere, the sphere has unit radius. So, actually only 2D space is necessary to describe a qubit.

+",9006,,,,,12/30/2020 9:16,,,,2,,,,CC BY-SA 4.0 +15336,2,,15332,12/30/2020 9:28,,4,,"

To avoid long computation of all pair-wise inner products in Bell basis, you can think as follow.

+

Switching from computational basis to the Bell basis is done by transformation +$$ +CNOT(H \otimes I) +$$

+

As any operation on quantum computer (measurement and reset being exceptions), this operation is unitary. A unitary operation preserve angles among vectors and their length (norm).

+

Since computational basis is orthonormal (for two qubits, it is simply 4x4 unit matrix), a unitary operation on this basis has to produce again othonormal basis as all angles and vector lenghts are preserved.

+",9006,,,,,12/30/2020 9:28,,,,0,,,,CC BY-SA 4.0 +15337,2,,6940,12/30/2020 10:25,,1,,"

I think it can be done with the method in this question(The first answer).

+
    +
  1. Prepare $|0\rangle$
  2. +
  3. Apply $V$
  4. +
  5. Apply $U$
  6. +
  7. Apply $V^\dagger$
  8. +
  9. Measure in a basis for which $|0\rangle$ is one of the elements
  10. +
  11. Repeat until you have a suitably accurate estimate of the probability of getting the answer $|0\rangle$.
  12. +
+

Substitue $V$ with $U(\theta)$ will work. +$$U(\theta)|0\rangle = |\psi \rangle$$

+",13968,,,,,12/30/2020 10:25,,,,0,,,,CC BY-SA 4.0 +15338,1,15340,,12/30/2020 13:15,,3,225,"

My question is highly related to this topic

+

It is about defining logical operation on a Stabilizer code.

+

I call $S$ the stabilizer group of a code space $C$, and I assumed it is generated by a family $S=\langle s_1,...,s_p \rangle$. I call $G_n$ the $n$-Pauli matrix group ($n$ being the dimension of the full Hilbert space).

+

A definition of logical operation is as follow:

+

$U_L$ is a logical operation if $\forall |\psi \rangle \in C$, $U_L | \psi \rangle \in C$

+

And, we realize that if $|\psi \rangle$ is stabilized by $g$, $U_L |\psi \rangle$ will be stabilized by $U_L g U_L^{\dagger}$.

+

Questions: which condition to ensure $U_L$ is a logical operation

+

A sufficient condition is to have $U_L S U_L^{\dagger} = S$, which means that $U_L \in N(S)$ (where $N(S)$ is the normalizer of $S$).

+

Indeed, this way we would be certain that $U_L |\psi\rangle$ will be stabilized by $S$ and thus be in the codespace.

+

What disturbs me is that according to the comments here (and some of the sources attached), the logical operation are actually exactly elements of $N(S)$. I see the sufficient condition but not the necessary one.

+

For instance, if $U_L$ is non clifford, for $s \in S$, $U_L s U_L^{\dagger}$ might not even be an n-Pauli matrix, thus $U_L S U_L^{\dagger} \neq S$ as $S \subset G_n$. In this case obviously $U_L$ wouldn't be in the normalizer of $S$. But wouldn't it be possible to have a non n-Pauli matrix that still stabilize appropriately $C$ ?

+

So my question is: Why is it sufficient and necessary to have $U_L \in N(S)$ so that $U_L$ is a logical operation ?

+",5008,,5008,,12/30/2020 18:54,12/30/2020 18:54,Necessary and sufficient condition to define logical operation (stabilizer code),,1,0,,,,CC BY-SA 4.0 +15339,1,15341,,12/30/2020 16:21,,3,371,"

How can one derive the complete list of transversal operators for the 7-qubit Steane code? I can derive the Clifford operators that are transversal, but I do not understand an easy way to check for non-Clifford transversal operators, and some idea on how to do this in general would be helpful. If there is a reference that would help.

+",14301,,10480,,12/31/2020 8:32,12/31/2020 8:32,Understanding transversal gates for the 7 qubit steane code,,1,1,,,,CC BY-SA 4.0 +15340,2,,15338,12/30/2020 16:33,,4,,"

You are correct that there are logical operators (i.e. ones that preserve $C$) outside $N(S)$. Also, your argument is sound and can be stated rigorously as follows. Let $U \in N(S)$. Then for any $s \in S$ we have $UsU^\dagger \in S$. Now, diagonalize $s$

+

$$ +s = VdV^\dagger +$$

+

and define

+

$$ +V(\theta) = V \, \mathrm{diag}(1, \dots, 1, e^{i\theta}) \, V^\dagger. +$$

+

Note that $V(\theta)$ commutes with $s$. Now, define

+

$$ +U(\theta) = U V(\theta) +$$

+

and note that

+

$$ +U(\theta) s U(\theta)^\dagger = UV(\theta)sV(\theta)^\dagger U^\dagger = UsU^\dagger. +$$

+

Thus, we found a continuous, one-parameter group of operators that preserve $C$. It cannot be a subset of $N(S)$ because $N(S)$ is discrete.

+
+

The requirement that $U\in N(S)$ is sufficient, but not necessary for $U$ to be a logical operator. However, when one restricts their consideration to the Pauli group $G_n$ the requirement is both necessary and sufficient.

+

In quantum error correction one sometimes restricts consideration to $G_n$, because of discretization of quantum errors. This result says that if an error correction operation $\mathcal{R}$ recovers from errors in a set $\{E_i\}$ then it recovers from errors $\{F_j\}$ which are linear combinations of $\{E_i\}$. Thus, for the purposes of establishing whether an error is a logical operator (and thus uncorrectable) it is sufficient to consider errors in $G_n$ since every operator can be written as a linear combination of elements of $G_n$.

+

See for example theorem 10.2 on p.438 in section 10.3.1 of Nielsen & Chuang and the discussion following the proof. A good summary is also section IX "Digitization of quantum errors" in https://arxiv.org/abs/0905.2794.

+",10480,,,,,12/30/2020 16:33,,,,3,,,,CC BY-SA 4.0 +15341,2,,15339,12/30/2020 17:16,,2,,"

By Eastin-Knill theorem, no quantum error correcting code capable of detecting arbitrary errors implements a universal gate set transversally (see this paper). Clifford group together with any non-Clifford operator is universal (see this paper). Therefore, if such a code implements all Clifford operators transversally then no operator outside the Clifford group can have a transversal implementation in the code.

+

Now, since the 7-qubit Steane code implements all Clifford operators transversally (see this answer, the introduction in this paper or section 10.6.2 of Nielsen & Chuang), we conclude that no operator outside the Clifford group admits a transversal implementation in Steane code.

+

Thus, your list of transversal operators is already complete.

+",10480,,10480,,12/30/2020 20:13,12/30/2020 20:13,,,,0,,,,CC BY-SA 4.0 +15344,1,,,12/30/2020 23:44,,1,93,"

In quantum fingerprinting, the states are sent to a 3rd party in order to verify if both qubits match or not. To do so, a swap test is needed by the 3rd party.

+

I read some information on swap test including this link here and I noticed that the probability of cswap test is:

+

If $|\phi _{x}\rangle =\ |\phi _{y}\rangle$ then we observe a 0 with $prob(0) = 1$ according to wikipedia.

+

So I was wondering what are the probabilities of a false positive and false negative in quantum fingerprinting?

+

According to what I saw I'm guessing:

+
    +
  • Probability to get a false positive (a 0 even if both states don't match) is 1 - P(getting 0) so it's 0?
  • +
  • Probability of getting a false negative (a 1 even if both states match) is 1/2?
  • +
+

But I'm not sure if my conclusion is correct, could someone please confirm this and give some explanation?

+",13569,,10480,,12/31/2020 10:07,12/31/2020 10:07,What is the probability of error in quantum fingerprinting using cswap test?,,1,0,,,,CC BY-SA 4.0 +15345,2,,15344,12/31/2020 2:07,,2,,"

Conclusion first. The first one is correct, but the scenario is not practical, since it is challenging(or more directly, impossible) to build a perfect channel, so even if the two states are actually the same at the very beginning, what the third party gets are two different states(but highly likely is the channel is a good one).

+

Besides, sometimes we do not hope to get two states that are exactly the same, so the value of the fidelity(for example, 0.5623) is what really needed.

+

This paper gives a detailed reduction using density matrix at SUPPLEMENTARY NOTE 4.

+

I'll just sketch the conclusion. The probability that the measurement of the control qubit is in the $|0\rangle$ state is $p_0=\frac{1}{2}+\frac{1}{2}F(|\phi\rangle,rho)$, where $|\phi\rangle$ is the state vector of one state, and $\rho$ is the density matrix. Thus the fidelity of the two states is $F(|\phi\rangle, rho)=2*p_0-1$.

+

Since by its definition, fidelity can be a number varting continuously from $0$ to $1$, just a few measurements(say three or four times) is never sufficient. If sufficiently many measurements are performed, then we'll have confidence in estimating its value, e.g., if we performed 100 measurements then we know that the decile of the reduced value of fidelity should be reasonable.

+",13647,,,,,12/31/2020 2:07,,,,0,,,,CC BY-SA 4.0 +15346,1,,,12/31/2020 2:25,,1,364,"

Looking for a starter point for a professional training as a Quantum Computer programmer. Is a master in Computer Science XOR Applied Physics a good starting point?

+",14274,,55,,1/2/2021 10:37,1/2/2021 10:37,What is the best learning path for quantum computing?,,1,3,,1/3/2021 12:53,,CC BY-SA 4.0 +15347,2,,13861,12/31/2020 6:48,,2,,"

The standard construction for measurement of arbitrary tensor products of Pauli operators that works in any stabilizer code and that achieves fault-tolerance using the so-called "cat" states $(|0\dots 0\rangle + |1\dots 1\rangle)/\sqrt{2}$ is described in section 10.6.3 in Nielsen & Chuang.

+

However, the quote in the question and the subsequent reference on the following page to the use of "error correcting procedure for the classical linear codes" to process measurement results suggest that the authors refer to the following simpler fault-tolerant scheme that works for any CSS code and obtains the correct logical measurement outcome distribution, but does not produce the appropriate post-measurement state.

+

The key idea behind the scheme is that if we are only concerned with measurement outcome then we can exploit the fact that CSS codes split the stabilizer generators into the $X$ and $Z$ sectors to replace quantum error correction with classical error correction on measurement results.

+

Consider a logical qubit encoded into a block of $n$ physical qubits using a $CSS(C_1, C_2)$ code for two classical linear codes $C_1$ and $C_2$ with $C_2^\perp \subset C_1$. Denote the Hilbert space of the block by $\mathcal{H}$ and the code subspace by $\mathcal{G} \subset \mathcal{H}$ (thus, $\dim \mathcal{G} = 2$ and $\dim \mathcal{H} = 2^n$). Let $S$ be the stabilizer group of $\mathcal{G}$ and $N(S)$ the normalizer of $S$ in the $n$-qubit Pauli group $G_n$.

+

All operators in $G_n$ are transversal, so stabilizers and logical Pauli operators are transversal. Moreover, since $\mathcal{G}$ is a CSS code, we can choose stabilizer generators that are tensor products of identity and $X$ or identity and $Z$. Similarly, we can choose the logical $\overline X$ to be a tensor product of identity and physical $X$ operators and logical $\overline Z$ to be a tensor product of identity and physical $Z$ operators. For a $Z$ type stabilizer generator $g_z$, define $b(g_z) \in \mathbb{Z}_2^n$ to be a binary vector with $0$ in positions corresponding to identity and $1$ in positions corresponding to $Z$. Define $b(\overline Z)$ similarly.

+

First, take the tensor product of per-qubit operators

+

$$ +I_i = \sum_{k_i\in\{0, 1\}}|k_i\rangle\langle k_i|=|0\rangle\langle 0| + |1\rangle\langle 1| \\ +Z_i = \sum_{k_i\in\{0, 1\}}(-1)^{k_i}|k_i\rangle\langle k_i|=|0\rangle\langle 0| - |1\rangle\langle 1| +$$

+

where $i$ identifies a qubit, to compute the $Z$-type stabilizer generators

+

$$ +g_z = \sum_{k \in \mathbb{Z}_2^n} (-1)^{k \cdot b(g_z)} |k_1\rangle\langle k_1|\otimes|k_2\rangle\langle k_2|\otimes\dots\otimes|k_n\rangle\langle k_n|\tag1 +$$

+

and the logical $Z$ operator

+

$$ +\overline Z = \sum_{k \in \mathbb{Z}_2^n} (-1)^{k \cdot b(\overline Z)} |k_1\rangle\langle k_1|\otimes|k_2\rangle\langle k_2|\otimes\dots\otimes|k_n\rangle\langle k_n|\tag2 +$$

+

where $\cdot$ represents the dot product in $\mathbb{Z}_2^n$ (i.e. componentwise multiplication modulo $2$).

+

The procedure begins by measuring each qubit individually in the computational basis. The results form a binary vector $m \in \mathbb{Z}_2^n$ with $m_i \in \{0, 1\}$ corresponding to the measurement outcome on the $i$th qubit. From equation $(1)$ we see that given $m$ we can classically compute the measurement outcomes associated with all $Z$-type stabilizer generators using the formula $(-1)^{m\cdot b(g_z)}$. Next, we employ the classical error correction techniques using the code $C_1$ which is the classical code associated with the $Z$ sector of the stabilizer to identify and correct a certain number of bit flip and measurement errors in $m$ producing a corrected vector of measurement outcomes $m'$. From equation $(2)$ we see that given $m'$ we can compute the outcome of logical measurement using formula $(-1)^{m'\cdot b(\overline Z)}$.

+

Note that this measurement procedure takes the qubits into a product state thus destroying the entanglement that protects the code subspace. Therefore, the post-measurement state is not guaranteed to be in $\mathcal{G}$. In particular, it is neither $|\overline 0\rangle$ nor $|\overline 1\rangle$.

+",10480,,10480,,12/31/2020 8:09,12/31/2020 8:09,,,,0,,,,CC BY-SA 4.0 +15348,1,,,12/31/2020 13:57,,3,62,"

My question is related to this topic

+

I consider working with error correcting code on which I want to define logical operations.

+

Let's assume I want to define a logical operation on logical qubit. In the context of Stabilizer code we would have to make sure that this operation acts in the code space as explained here.

+

But this is not enough, we must also verify that the logical gate, once ensured it preserves the code space does the appropriate operation.

+

Some general requirements

+

I call $A$ the gate I want to implement logically under $A_L$. I call $C$ the code space.

+

One condition I must have is to ensure: $\forall |\psi \rangle \in C, A_L |\psi \rangle \in C$. +But this is not enough, I must "preserve" the action of this operation on the logical space.

+

One necessary condition would be to make sure that:

+

$$ \forall X: [A,X] \rightarrow [A_L,X_L]$$

+

I don't know how to phrase it precisely mathematically but basically it is to say that the commutator of $A$ with any other operator has the same "shape" as in the logical space.

+

And as $n$-Pauli matrices form a basis of $U(n)$, I guess this condition would by linearity be equivalent to say:

+

$$ \forall E \in G_n, [A,E] \rightarrow [A_L, E_L] $$

+

Where $G_n$ is the $n$-Pauli matrices group. But still: is ensuring commutation rule enough or is it only necessary to preserve the meaning of the operation ?

+

My question in the end

+

What is a rigorous way to define logical operation on a quantum error correcting code. And if there are some "nice" equivalent way to define them I would be interested to know them. If we cannot be absolutely general, I will be fine with a definition for Stabilizer codes.

+",5008,,5008,,12/31/2020 14:02,12/31/2020 14:02,Proper definition of logical operation in Q.E.C,,0,0,,,,CC BY-SA 4.0 +15349,1,15355,,12/31/2020 17:13,,10,578,"

As a beginner in quantum computation, I noticed that all quantum algorithms take various gates followed by measuring the qubits in the last step. Is it always the case? Are there any algorithms that take measurements in an intermediate step?

+",14084,,55,,1/2/2021 10:38,7/4/2021 5:48,Are there any algorithms that take measurements in an intermediate step?,,2,0,,,,CC BY-SA 4.0 +15352,2,,15346,12/31/2020 17:42,,3,,"

From my experience, the best entry point to learning Quantum Computing is working through Nielsen and Chuang. This book is a phenomenal introduction to the core concepts in quantum computing, and assumes very little from the reader except "mathematical maturity." Even if you're planning to start a graduate program, I would recommend working through this book during the admissions process.

+

If you're looking for a graduate program, there are programs forming that are specifically focused on QC and related technologies. If QC programming is your goal, I would suggest finding a school that is investing heavily in building a QC department.

+

The schools that I've seen first hand that are deeply invested in quantum computing education are CalTech, MIT, Univ. Chicago, UT Austin, Univ. Maryland, Duke and Berkeley; outside the US, Univ. of New South Wales in Australia, and TU Delft in the Netherlands.

+

New options requiring less commitment than graduate school are also becoming available, like Chicago's Quantum Certificate Program and MIT's QC Fundamentals Course. The government (mostly DOE and NSF) is also now investing heavily in developing a quantum workforce (see, e.g. here, and here), largely to ensure we're competitive with China. There may be opportunities to get your training subsidized by Uncle Sam.

+",8623,,,,,12/31/2020 17:42,,,,0,,,,CC BY-SA 4.0 +15353,1,17756,,12/31/2020 18:59,,0,289,"

I fail to understand the EPR experiment. From Wikipedia:

+
+

Alice now measures the spin along the z-axis. She can obtain one of +two possible outcomes: +z or −z. Suppose she gets +z. Informally +speaking, the quantum state of the system collapses into state I. The +quantum state determines the probable outcomes of any measurement +performed on the system. In this case, if Bob subsequently measures +spin along the z-axis, there is 100% probability that he will obtain +−z. Similarly, if Alice gets −z, Bob will get +z.

+
+

I emphatically do not reproduce above claim. As example I consider measurement of spin along an arbitrary axis. Specially I consider measuring spin along $\vec{v} = \frac{1}{\sqrt{38}}(2,3,5)$ and with input state $\psi = \frac{1}{\sqrt 2}(|01\rangle - |10\rangle)$. Here are my steps:

+
    +
  1. Alice wants to measure spin along $\vec{v}$. This means we create the observable $M = \vec{v} \cdot \vec{\sigma}$ where $\vec{\sigma}$ is the vector of individual Pauli matrices i.e., $\vec{\sigma} = (X , Y , Z)$.

    +
  2. +
  3. $M$ is a $2\times2$ matrix and $\psi$ is a $4\times1$ vector. To make a measurement corresponding to $M$ on the first qubit we need to create a tensor product of $M$ with the $2\times2$ identity matrix $I$. So let $O = M \otimes I$.

    +
  4. +
  5. Now to perform the measurement we will do a eigen decomposition of $O$. Note that gives me 4 eigenvalues not 2. Its true that there are 2 unique eigenvalues $\{+1, -1\}$ and I understand these to mean spin "up" or spin "down".

    +
  6. +
  7. I get following probabilities of the 4 eigenvalues:

    +
  8. +
+
Alice's Eigenvalues (i.e., possible measurement outcomes)
+[-1.00000000000000, -1.00000000000000, 1.00000000000000, 1.00000000000000]
+Alice's probabilities
+[0.452776776413453, 0.0472232235865468, 0.0472232235865468, 0.452776776413453]
+
+
    +
  1. Now suppose Alice measures the first eigenvalue $-1$ (spin "down").

    +
  2. +
  3. We then collapse the wavefunction $\psi$ to one of the corresponding eigenvectors of $O$. Let $\psi^{'}$ be the collapsed wavefunction after Alice's measurement, which is one of the two eigenvectors of $O$ with eigenvalue $-1$.

    +
  4. +
  5. Now Bob will measure spin along the $\vec{v}$ axis on the second qubit. The observable corresponding to this is $O^{'} = I \otimes M$ and input to this observable is $\psi^{'}$.

    +
  6. +
  7. And now the kick: when I simulate Bob's measurement I do not get a spin "up" outcome with 100% probability. I find that there are 2 unique eigenvalues associated with non-zero probabilities.

    +
  8. +
+
Bob's Eigenvalues
+[-1.00000000000000, -1.00000000000000, 1.00000000000000, 1.00000000000000]
+Bob's probabilities
+[0.00892013138361998, 0.0855263157894737, 0.0855263157894737, 0.820027237037433]
+
+

And this is my dilemma.

+

Can someone explain me what it is that I have done wrong? I would like a worked out answer with numbers in it rather than mathematical symbols. An answer showing what needs to be corrected to my code would be even better.

+

Aside: If part of the answer is that $O$ should be $M \otimes M$, I emphatically consider that to be cheating. The experiment states:

+
+

Alice now measures the spin along the z-axis... +the quantum state of the system collapses into state I... +Bob subsequently measures +spin along the z-axis, there is 100% probability that he will obtain +−z. Similarly, if Alice gets −z, Bob will get +z.

+
+",14251,,15820,,7/22/2021 21:06,7/26/2021 9:15,Trouble understanding the EPR Experiment,,2,0,,,,CC BY-SA 4.0 +15354,2,,12964,12/31/2020 21:03,,2,,"

Consider a nearest-neighbor Ising Hamiltonian $$H = \sum_{i=1}^n J_i \sigma_i^z \sigma_{i+1}^z.$$ Let $X = \sum_{i=1}^n \sigma_i^x$. The QAOA ansatz is $$|\mathbf{\beta}, \mathbf{\gamma}\rangle = \exp\left(-i\beta_1 X \right)\exp\left(-i\gamma_1 H \right) \dots \exp\left(-i\beta_p X \right)\exp\left(-i\gamma_p H \right) |+\rangle^{\otimes n}$$ +The expectation value of an operator $A$ under this ansatz is $\langle A \rangle = \langle\mathbf{\beta}, \mathbf{\gamma}|A|\mathbf{\beta}, \mathbf{\gamma}\rangle$.

+

Let's say that $A$ is supported only on sites $2$ and $3$. And consider $p=1$. Then we see that +\begin{align*} +\langle A \rangle &= \langle +|^{\otimes n} \exp(i\gamma_1 H)\exp(i\beta_1 X)A\exp(-i\beta_1 X)\exp(-i\gamma_1 H) |+\rangle^{\otimes n} \\ +&= \langle +|^{\otimes n} \exp\left(i\gamma_1 H\right)\exp\left(i\beta_1 (\sigma_2^x + \sigma_3^x)\right)A\exp\left(-i\beta_1 (\sigma_2^x + \sigma_3^x)\right)\exp\left(-i\gamma_1 H\right) |+\rangle^{\otimes n} \\ +&= \langle +|^{\otimes n} \exp\left(i\gamma_1 \left(J_1 \sigma_1^z \sigma_2^z + J_2 \sigma_2^z \sigma_3^z + J_3 \sigma_3^z \sigma_4^z\right)\right)\exp\left(i\beta_1 (\sigma_2^x + \sigma_3^x)\right)A\\&\qquad\exp\left(-i\beta_1 (\sigma_2^x + \sigma_3^x)\right)\exp\left(-i\gamma_1 \left(J_1 \sigma_1^z \sigma_2^z + J_2 \sigma_2^z \sigma_3^z + J_3 \sigma_3^z \sigma_4^z\right)\right) |+\rangle^{\otimes n} \\ +\end{align*} +where:

+
    +
  • in the second line we used that all the other $\sigma_i^x$ terms commuted through $A$ and canceled, since $A$ is only supported on 2 and 3.
  • +
  • in the third line we used that all the other $\sigma_i^z \sigma_{i+1}^z$ terms in $H$ commute through $A$ and canceled.
  • +
+

Now look at the last line. Imagine if $p=2$. Then we would have another $\exp(-i \beta_2 X)$ to worry about. This time though, the $\sigma_1^z$ and $\sigma_4^z$ terms would get in the way of $\sigma_1^x$ and $\sigma_4^x$ commuting all the way through $A$ and canceling out. And then similarly, when we add the $\exp(-i \gamma_2 H)$ term, the $\sigma_4^z \sigma_5^z$ term would not commute all the way through and cancel, because now we have a $\sigma_4^x$ term that gets in the way. You can imagine doing this again with $p=3$, and so on.

+

So in summary:

+
    +
  • we want to determine the expectation value of some local observable $A$.
  • +
  • when we look at $\langle A \rangle$ at $p=1$, almost all of the terms commute through $A$ and cancel. So only the qubits very close to the support of $A$ actually contribute to $\langle A \rangle$.
  • +
  • for each successive $p$, you get more terms (e.g. $\sigma_i^x$ terms) "in the way", so the full expression for $\langle A \rangle$ includes qubit terms that are less local to $A$.
  • +
  • eventually, all the qubits will contibute to $\langle A \rangle$, even though $A$ itself is only supported locally on a small number of qubits.
  • +
+

Potentially this is everything you already knew. For the TSP specifically, the exact meaning of $p$ depends on the particular Ising/QUBO formulation of the TSP. But certainly $p$ is related to the number of variables that are being taken into account at a time when calculating some observable quantity (this is what we just showed above). With TSP, variables are presumably related to nodes that must be visited, perhaps at a certain time interval. So then trying to optimize $\langle A \rangle$ for some $A$ would only take into account nodes to are somehow $f(p)$-local to $A$, where $f$ is just some monotonically increasing function. But recall with QAOA that you are trying to optimize $\langle H \rangle$. $H$ is composed of a sum of local observables. So I don't think it is right to say that level-$p$ gives you something related to a $p$-locally optimized solution. I think it is much more complicated, because you are optimizing a global sum of a bunch of $f(p)$-local quantities, which is itself still somehow global.

+

So in summary, how exactly $p$ is related to properties of the resulting solution to TSP is very nontrivial. Truthfully, it may be that this is a good thing. If we could say something as definite as "QAOA${}_p$ gives a $p$-locally optimized solution", then we would almost definitely find that classical "$p$"-local greedy methods would compete with and/or outperform QAOA${}_p$. The complicated behavior of how a solution is related to $p$ is potentially a reason that QAOA could give us heuristically better performance than classical approximation methods.

+

This is all just my impression, which could of course be wrong.

+",5467,,5467,,12/31/2020 21:08,12/31/2020 21:08,,,,1,,,,CC BY-SA 4.0 +15355,2,,15349,12/31/2020 21:15,,8,,"

It is not always the case that measurements are at the end of a quantum circuit. Indeed, there are many ideas and techniques that use the classical bits that result from intermediate measurements to control subsequent quantum gates.

+

Here are a few prominent examples:

+
    +
  • quantum teleportation in which one party uses measurements to identify the quantum gates that another party needs to apply to their half of an entangled Bell pair in order to recover an arbitrary input quantum state,
  • +
  • gate teleportation technique for applying a gate $U$ to a quantum state $|\psi\rangle$ using quantum teleportation through a special state chosen so that teleportation output is $U|\psi\rangle$ rather than $|\psi\rangle$,
  • +
  • KLM protocol which uses measurements to perform two-qubit gates in linear optical quantum computing thus overcoming the challenges inherent in making photons interact and enabling universal quantum computation in this model,
  • +
  • quantum error correction using stabilizer codes where measurements are used to detect and identify errors as they are occurring during quantum computation,
  • +
  • fault-tolerant constructions that use magic states to perform gates that do not admit a transversal implementation in a given quantum error correcting code,
  • +
  • measurement-based quantum computing in which computation is performed by a sequence of single-qubit measurements on a specially prepared resource state and in which measurement bases are chosen based on the outcomes of previous measurements,
  • +
  • measurement-based uncomputation which uses measurements followed by classically controlled quantum gates to reduce the cost of uncomputation.
  • +
+

Nevertheless, in many cases the assumption that all measurements are performed at the end of a circuit enables simplified analysis. This assumption is significantly less restrictive than it may first appear due to a powerful principle called the principle of deferred measurement. It is described on p.186 in section 4.4 in Nielsen & Chuang as follows:

+
+

Principle of deferred measurement: Measurements can always be moved from an intermediate stage of a quantum circuit to the end of the circuit; if the measurement results are used at any stage of the circuit then the classically controlled operations can be replaced by conditional quantum operations.

+
+

The specific circuit transformation necessary to move an intermediate measurement towards the end of a circuit depends on the surrounding gates. It is informative to consider concrete examples.

+

Example 1 (replacing classical control with quantum control): A simple, but very useful case occurs when the measurement result is immediately used to control a unitary gate. Consider two qubits $A$ and $B$ in a state $|\psi_{AB}\rangle$. Suppose we measure $A$ in the computational basis and then apply a unitary $U_B$ to $B$ conditioned on the result of the measurement. Neglecting normalization, if we measure $|0_A\rangle$, the state of $B$ is

+

$$ +U_B^0 \langle 0_A|\psi_{AB}\rangle = I_B \langle 0_A|\psi_{AB}\rangle = \langle 0_A|\psi_{AB}\rangle \tag1 +$$

+

and if we measure $|1_A\rangle$ the state of $B$ is

+

$$ +U_B^1 \langle 1_A|\psi_{AB}\rangle = \langle 1_A |U_B|\psi_{AB}\rangle. \tag2 +$$

+

Now suppose we instead apply controlled-$U$ to both qubits with $A$ as control and $B$ as target and then measure $A$ as the final step in the circuit. First note that the unitary of controlled-$U$ with $A$ as control and $B$ as target is

+

$$ +CU_{AB} = |0_A\rangle\langle 0_A| \otimes I_B + |1_A\rangle\langle 1_A| \otimes U_B. +$$

+

Once again, neglecting normalization, if we measure $|0_A\rangle$ the state of $B$ is

+

$$ +\begin{align} +&\langle 0_A|CU_{AB}|\psi_{AB}\rangle \\ +&=\langle 0_A|\left(|0_A\rangle\langle 0_A| \otimes I_B + |1_A\rangle\langle 1_A| \otimes U_B\right)|\psi_{AB}\rangle \\ +&=\langle 0_A|0_A\rangle\langle 0_A|\psi_{AB}\rangle + \langle 0_A|1_A\rangle\langle 1_A|U_B|\psi_{AB}\rangle \\ +&=\langle 0_A|\psi_{AB}\rangle +\end{align}\tag{1'} +$$

+

whereas if we measure $|1_A\rangle$ the state of $B$ is

+

$$ +\begin{align} +&\langle 1_A|CU_{AB}|\psi_{AB}\rangle \\ +&=\langle 1_A|\left(|0_A\rangle\langle 0_A| \otimes I_B + |1_A\rangle\langle 1_A| \otimes U_B\right)|\psi_{AB}\rangle \\ +&= \langle 1_A|0_A\rangle\langle 0_A|\psi_{AB}\rangle + \langle 1_A|1_A\rangle\langle 1_A|U_B|\psi_{AB}\rangle\\ +&= \langle 1_A|U_B|\psi_{AB}\rangle. +\end{align}\tag{2'} +$$

+

Thus, we see that the post-measurement state of $B$ is the same for each outcome of measurement on $A$. We also need to check that the probability of each outcome is the same, but since we neglected normalization the probability is the norm of the corresponding vector and therefore the equality of outcome probabilities follows from the equality of the unnormalized states.

+

Example 2 (replacing measurement with CNOT gate and auxiliary qubit): Another interesting case occurs when an intermediate measurement is sandwiched between two unitary gates. Here, the required circuit transformation involves an auxiliary qubit. Suppose for concreteness that a qubit $B$ starts in $|\psi_B\rangle$ and the original circuit applies a gate $U_B$, followed by a measurement in the computational basis, followed by a gate $V_B$. As before, we neglect normalization. If we measure $|0_B\rangle$ then the post-measurement state of the qubit is

+

$$ +V_B |0_B\rangle\langle 0_B| U_B|\psi_B\rangle \tag3 +$$

+

and if we measure $|1_B\rangle$ then it is

+

$$ +V_B |1_B\rangle\langle 1_B| U_B|\psi_B\rangle. \tag4 +$$

+

The corresponding circuit with terminal measurements is constructed by adding an auxiliary qubit $A$ initialized in state $|0_A\rangle$, replacing the measurement with a CNOT with $B$ as control and $A$ as the target and finally measuring $A$ in the computational basis. The unitary part of the circuit computes

+

$$ +\begin{align} +&(I_A \otimes V_B) \circ CNOT_{BA} \circ (I_A \otimes U_B) |0_A\rangle|\psi_B\rangle \\ +&= (I_A \otimes V_B) \circ \left(I_A \otimes |0_B\rangle\langle 0_B| + X_A \otimes |1_B\rangle\langle 1_B|\right) \circ (I_A \otimes U_B) |0_A\rangle|\psi_B\rangle \\ +&= \left(I_A \otimes V_B|0_B\rangle\langle 0_B|U_B + X_A \otimes V_B|1_B\rangle\langle 1_B|U_B\right) |0_A\rangle|\psi_B\rangle \\ +&= |0_A\rangle \otimes V_B |0_B\rangle\langle 0_B|U_B|\psi_B\rangle + |1_A\rangle \otimes V_B |1_B\rangle\langle 1_B|U_B|\psi_B\rangle +\end{align} +$$

+

so if we measure $|0_A\rangle$ then the post-measurement state of $B$ is

+

$$ +\langle 0_A|0_A\rangle \otimes V_B |0_B\rangle\langle 0_B|U_B|\psi_B\rangle + \langle 0_A|1_A\rangle \otimes V_B |1_B\rangle\langle 1_B|U_B|\psi_B\rangle = \\ +V_B |0_B\rangle\langle 0_B|U_B|\psi_B\rangle \tag{3'} +$$

+

and if we measure $|1_A\rangle$ then the post-measurement state of $B$ is

+

$$ +\langle 1_A|0_A\rangle \otimes V_B |0_B\rangle\langle 0_B|U_B|\psi_B\rangle + \langle 1_A|1_A\rangle \otimes V_B |1_B\rangle\langle 1_B|U_B|\psi_B\rangle = \\ +V_B |1_B\rangle\langle 1_B|U_B|\psi_B\rangle \tag{4'} +$$

+

once again in agreement with the original circuit.

+",10480,,10480,,7/4/2021 5:48,7/4/2021 5:48,,,,5,,,,CC BY-SA 4.0 +15356,1,15357,,12/31/2020 21:21,,3,146,"

The italicized section below is referring to chapter 3 of "Quantum Mechanics: The Theoretical Minimum" by Leonard Susskind and Art Friedman.

+

It is written that the operator that corresponds to measuring spin in the $\hat{n}$ direction is $\sigma_\hat{n} = n_x X + n_y Y + n_z Z$. The book gives an example where $\hat{n}$ lies in the z-x plane, +$$\hat{n} = \begin{pmatrix}\sin(\theta) \\ 0\\ \cos(\theta)\end{pmatrix}$$ +where $\theta$ is the angle between $\hat{n}$ and the $z$ axis. In matrix form, this gives: +$$ \sigma_\hat{n}= +\begin{pmatrix} +\cos(\theta) & \sin(\theta) \\ +\sin(\theta) & -\cos(\theta) +\end{pmatrix} +$$ +with eigenvalues and eigenvectors $[1, +\big(\begin{smallmatrix} +\cos(\theta/2) \\ +\sin(\theta/2) +\end{smallmatrix}\big)]$ +and +$[-1, +\big(\begin{smallmatrix} +-\sin(\theta/2) \\ +\cos(\theta/2) +\end{smallmatrix}\big)]$.

+

So, if a state, $|\psi\rangle$, is pointing in the direction $\hat{n}$, it has an angle of $\theta$ from the Z axis, then it's state vector in the Z basis should be $|\psi\rangle = +\big(\begin{smallmatrix} +\cos(\theta) \\ +\sin(\theta) +\end{smallmatrix}\big) = \hat{n}$.

+

Why do the eigenvectors of $\sigma_n$ not align with the vector for $\hat{n}$? My thinking is that measuring the spin in the direction $\hat{n}$ should leave a state either in $\hat{n}$ or a state orthogonal to $\hat{n}$.

+

My guess is that I'm making a mental error going from the Cartesian system to Bloch Sphere system.

+",11635,,10480,,1/24/2021 22:13,1/24/2021 22:13,Why do the eigenvectors of a spin observable not align with the direction of the spin?,,1,0,,,,CC BY-SA 4.0 +15357,2,,15356,12/31/2020 22:09,,5,,"

The key idea is to distinguish between the physical space and the Hilbert space.

+

The observable $\sigma_{\hat n}$ is associated with the physical space, here modeled as $\mathbb{R}^3$. Consequently, $\sigma_{\hat n}$ has three real components $n_x, n_y$ and $n_z$.

+

The state $|\psi\rangle$ lives in the Hilbert space, here modeled as $\mathbb{C}^2$. Consequently, $|\psi\rangle$ has two complex components. Note that the eigenvectors you found, e.g. $(\cos\frac{\theta}{2}, \sin\frac{\theta}{2})$ happen to have real components, but this is purely accidental. They would have non-zero imaginary part if you considered an observable with non-zero $n_y$.

+

Since $|\psi\rangle$ does not live in the physical space, it does not make sense to ask which physical direction it points along. However, it does make sense to ask which direction $\sigma_{\hat n}$ points along (and the answer is $\hat n$). This is related to the physical significance of the components of vectors in the two spaces.

+

The physical significance of the components of $\sigma_{\hat n}$ lies in specifying the direction along which the spin is measured. It can be thought of as a setting of a measurement device. By contrast, the physical significance of the components of $|\psi\rangle$ lies in determining the probabilities of various measurement outcomes. For example, since the first component of your first eigenvector is $\cos \frac{\theta}{2}$ we know that if we were to measure $\sigma_z$ we would obtain the $+1$ or "spin up" result with probability $\cos^2 \frac{\theta}{2}$.

+",10480,,,,,12/31/2020 22:09,,,,0,,,,CC BY-SA 4.0 +9363,1,,,1/1/2020 0:38,,0,45,"

I am currently an undergrad student in computer engineering in Brazil and I have taken the Quantum mechanics subject as well as I am did a project (the two jupyter notebooks, it's in portuguese though) on quantum computing with a teacher that is currently building one at my college. Apart from the chances I already have of learning about this subject are there other means or opportunities any of you recommend going after?

+",9644,,,,,1/1/2020 0:38,Opportunities in quantum computing for an undergrad,,0,2,,1/1/2020 22:47,,CC BY-SA 4.0 +9364,2,,9357,1/1/2020 9:12,,2,,"

This is just a warning to let you know that the API has changed for the backend configurations such as PulseBackendConfiguration. The dt (qubit drive channel timestep) and dtm (measurement drive channel timestep) parameters were previously specified in nanoseconds, but they are now specified in seconds. If you're not doing anything so advanced as to directly use these parameters, you can safely ignore the warning.

+",1790,,,,,1/1/2020 9:12,,,,1,,,,CC BY-SA 4.0 +9365,1,,,1/1/2020 18:26,,7,370,"

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 if $i$ is odd and the permutation $(i+1, i+2)(i+3, i+4)$ if $i$ is even, for some fixed $i$ in the range $1 \leq i \leq 2^W -2$. Is it possible to decompose the $(w+1)$-qubit permutation gate into some $w$-qubit permutation gates, $\mathrm{SWAP}$s and $\mathrm{NOT}$s? How? (Ideally, I'd like to avoid using $\mathrm{SWAP}$s and $\mathrm{NOT}$s due to certain implementation issues.)

+ +

I think it should be possible because of Lemma $2$ in the appendix of the paper +Generating the group of reversible logic gates (Vos, Ra & Storme, 2002) (PDF):

+ +
+

The subgroup of exchangers $\mathbf{E}_w$, augmented with the $\text{NOT}$ gate and the $\text{CONTROLLED}^{w−2}$ $\text{NOT}$ gate, generates the group of even simple control gates.

+
+ +

but I'm not sure how to construct the circuit.

+",26,,26,,1/2/2020 5:48,1/7/2020 17:24,"Decomposing a $(w+1)$-qubit permutation gate into $w$-qubit permutation gates, SWAPs and NOTs",,1,4,,,,CC BY-SA 4.0 +9366,1,9367,,1/1/2020 20:59,,1,91,"

In N&Chuang, on page 368 is written the following theorem:

+ +
+

The map $\mathcal{E}$ satisfies axioms A1,A2,A3 if and only if + $$\mathcal{E}(\rho)=\sum_k E_k \rho E_k^{\dagger}$$ + Where $\sum_k E_k^{\dagger} E_k \leq I$

+
+ +

The axiom A2 is convex linearity, the axiom A3 is CP, the axiom A1 is:

+ +
+

Axiom A1: $0 \leq Tr(\mathcal{E}(\rho)) \leq 1$

+
+ +

Shouldn't be added in the theorem: $\sum_k E_k^{\dagger} E_k \geq 0$ as well to ensure the fact the trace can never be negative ? So in the end we would have:

+ +

$$0 \leq \sum_k E_k^{\dagger} E_k \leq I$$

+",5008,,55,,2/20/2021 16:24,2/20/2021 16:24,Kraus decomposition for non trace preserving operation: shouldn't we have $0 \leq \sum_k E_k^{\dagger} E_k \leq I$,,1,0,,,,CC BY-SA 4.0 +9367,2,,9366,1/1/2020 21:56,,3,,"

It's true for any matrix $A$ that $A^\dagger A\ge 0$. +It's because $(A^\dagger A v,v)=(Av, Av)$, where $(,)$ is the inner product and $v$ is any vector.

+",5870,,,,,1/1/2020 21:56,,,,0,,,,CC BY-SA 4.0 +9368,1,,,1/1/2020 23:37,,5,469,"

Let's consider $\rho_A$ a density matrix. I introduce a space $B$ and an entangled state $|\Psi\rangle$ (the purification) so that:

+ +

$$\newcommand{\tr}{\operatorname{Tr}}\rho_A = \tr_B(|\Psi\rangle \langle \Psi |_{AB}) $$

+ +

Let's consider another purification of $\rho_A$: a vector $|\widetilde{\Psi}\rangle$. By definition we have:

+ +

$$ \rho_A = \tr_{B}(|\widetilde{\Psi}\rangle \langle \widetilde{\Psi} |_{AB})$$

+ +

I have read that those two states are indeed purification of $\rho_A$ if and only if:

+ +

$$ |\widetilde{\Psi}\rangle = I_A \otimes U_B |\Psi\rangle_{AB} $$

+ +

I understand the sufficient part, but I don't see why it would be necessary for $ |\widetilde{\Psi}\rangle$ to have this form. Could someone explain me how to get this result ? I found the statement but not a proof for this and I don't manage to find it (I'm probably missing something very obvious)

+",5008,,55,,1/3/2020 17:51,1/22/2022 16:24,Why do purifications only differ by a local unitary?,,3,0,,,,CC BY-SA 4.0 +9369,2,,9368,1/2/2020 1:44,,2,,"

It is due to Schmidt decomposition. For some $|\psi \rangle_{AB} \in H_A \otimes H_B$, there exists a decomposition in terms of the orthonormal basis (Schmidt bases) of system A and B. $\lambda_i$ are the Schmidt coefficients calculated from $Tr_B(|\psi\rangle \langle\psi|_{AB})$ whose eigenvalues are $\lambda^2_i$. Given below is the Schmidt decomposition, {$|a_i\rangle$} are the eigenvectors of system A and {$|b_i\rangle$} are the eigenvectors of system B.

+ +

$|\psi \rangle_{AB} = \sum_i \lambda_i |a_i\rangle |b_i\rangle $ where $\lambda_i \geq 0$ and $\sum_i \lambda^2_i =1$

+ +

So, based on the equation you have in the question, there is a purification being done on system B while keeping system A unchanged. Thus, the eigenvectors of A and {$\lambda_i$} should remain fixed in both decompositions. Because we want to preserve {$\lambda_i$}, eigenvalues of system B should be preserved i.e a unitary applied only to system B while identity is applied to A i.e. $I_A\otimes U_B$.

+ +

In conclusion, when the partial trace on system B is done, then this change does not show up in the final purification.

+",2598,,,,,1/2/2020 1:44,,,,3,,,,CC BY-SA 4.0 +9370,1,,,1/2/2020 2:49,,4,157,"

I'm a Computer Scientist undergrad student studying for an exam in Quantum computing. In all of the algorithms I have been studying (Deutsch–Jozsa, Simons, Shors, Grovers) I constantly see multi-qubit Hadamard gates being expended to the normalised sum of all the possible values like so:

+ +

$$\left|x\right>\xrightarrow{\mathbb H^{\otimes n}}\frac{1}{\sqrt{2^n}}\sum_{x=0}^{2^n-1}\left|x\right>$$

+ +

That makes complete sense to me, however, it's when they perform another hadamard transformation on that state that I get a bit confused with the $(-1)^{x·y}$ that gets multiplied with each part of the superposition like so:

+ +

$$\frac{1}{\sqrt{2^n}}\sum_{x=0}^{2^n-1}\left|x\right>\xrightarrow{\mathbb H^{\otimes n}}\sum_{x=0}^{2^n-1}\sum_{y=0}^{2^n-1}\left(-1\right)^{x.y}\left|y\right>$$ +where

+ +

$$x.y = x_0y_0\oplus x_1y_1\oplus x_2y_2\oplus\ldots\oplus x_{n-1}y_{n-1}$$

+ +

I don't quite understand where this $(-1)^{x·y}$ has suddenly appeared from, or I don't have an intuition as to why it is required. My understanding was the performing one Hadamard after another kind of undoes the other?

+ +

Any intuition on this would be extremely helpful!

+ +

For a full reference I was triggered to ask here after seeing this happen in almost all the algorithms I mentioned above, but most recently here: +Deutsch-Jozsa Algorithm

+",9678,,23,,1/10/2020 9:30,1/10/2020 9:30,Why do multi-bit hadamards expands to what they do?,,2,1,,,,CC BY-SA 4.0 +9371,1,,,1/2/2020 4:09,,3,137,"

In the Bernstein Vazirani algorithm, the problem is to find $s$ for $f(x) = s \times x $ , $f : \{0,1 \}^n \to \{0 , 1 \} $. The literature says that the classical randomized algorithms also requires $ \Omega ( n)$ queries. I cannot find a proof for this claim. It seems it has something to do with Yao's principle. Can anybody help me to figure out how to prove this?

+ +

Thanks.

+",9681,,8776,,1/2/2020 10:09,1/2/2020 10:09,Probabilistic query complexity lower bound for Bernstein-Vazirani problem,,1,0,,,,CC BY-SA 4.0 +9372,1,9378,,1/2/2020 4:25,,5,3641,"

I tried to implement three qubit bit flip code in qiskit and need to get the result of measurements and then apply recovery quantum operations conditioned on the measurement results. The following is a simplified version to initialize a circuit:

+ +
q= QuantumRegister(3)
+c= ClassicalRegister(3)
+qc= QuantumCircuit(q, c)
+qc.measure(q,c)
+
+ +

I noticed that this question had a similar question and they transformed the statement

+ +
if(c[0]==0) qc.x(q[0])
+
+ +

into

+ +
qc.x(q[0]).c_if(c[0], 0)
+
+ +

However, I want to have multiple quantum operations conditioned on the if statement

+ +
if c[0]==1 and c[1]==1:
+    qc.x(q[0])
+    qc.x(q[1])
+
+ +

can this work with ""c_if""?

+",9275,,8776,,1/2/2020 9:21,1/2/2020 10:28,How to implement if statement based on measurement results in qiskit?,,1,2,,,,CC BY-SA 4.0 +9373,2,,9370,1/2/2020 8:24,,4,,"

Your first formula is not correct. The correct formula for Hadamard gates for the arbitrary $|x\rangle$ from the calculational basis is (it can be proved by induction): +$$H^{\otimes n}|x\rangle=\frac{1}{\sqrt{2^n}} \sum_{y=0}^{2n-1}{(-1)^{x\cdot y}}|y\rangle$$

+ +

where $x\cdot y=x_0y_0\oplus x_1y_1\oplus x_2y_2\oplus ...\oplus x_ny_n$

+ +

In case $|x\rangle = |0\rangle$ then +$$x\cdot y =0\cdot y = 0$$ +and +$$H^{\otimes n}|x\rangle=H^{\otimes n}|0\rangle=\frac{1}{\sqrt{2^n}} \sum_{y=0}^{2n-1}{(-1)^{0}}|y\rangle=\frac{1}{\sqrt{2^n}} \sum_{y=0}^{2n-1}|y\rangle$$ +in this case +$$H^{\otimes n}H^{\otimes n}|0\rangle=H^{\otimes n}(\frac{1}{\sqrt{2^n}} \sum_{y=0}^{2n-1}|y\rangle)=\frac{1}{\sqrt{2^n}} \sum_{y=0}^{2n-1}H^{\otimes n}|y\rangle=$$ +$$=\frac{1}{\sqrt{2^n}} \sum_{y=0}^{2n-1}(\frac{1}{\sqrt{2^n}} \sum_{z=0}^{2n-1}{(-1)^{z\cdot y}}|z\rangle)=\frac{1}{2^n} \sum_{y=0}^{2n-1}\sum_{z=0}^{2n-1}{(-1)^{z\cdot y}}|z\rangle=\frac{1}{2^n} \sum_{z=0}^{2n-1}\sum_{y=0}^{2n-1}{(-1)^{z\cdot y}}|z\rangle=\frac{1}{2^n} \sum_{z=0}^{2n-1}|z\rangle(\sum_{y=0}^{2n-1}{(-1)^{z\cdot y}})=\frac{1}{2^n} |0\rangle(\sum_{y=0}^{2n-1}{(-1)^{0\cdot y}})+\frac{1}{2^n} \sum_{z=1}^{2n-1}|z\rangle(\sum_{y=0}^{2n-1}{(-1)^{z\cdot y}})=\frac{1}{2^n} |0\rangle(2^n)+\frac{1}{2^n} \sum_{z=1}^{2n-1}|z\rangle(\sum_{y=0}^{2n-1}{(-1)^{z\cdot y}})=|0\rangle+\frac{1}{2^n} \sum_{z=1}^{2n-1}|z\rangle\cdot0=|0\rangle$$

+ +

In the same way it can be proved that: +$$H^{\otimes n}H^{\otimes n}|x\rangle=|x\rangle$$

+",9545,,9545,,1/2/2020 9:58,1/2/2020 9:58,,,,1,,,,CC BY-SA 4.0 +9374,2,,9371,1/2/2020 8:53,,2,,"

I would typically write $s\cdot x$ rather than $s\times x$. However, that's a minor thing. The important issue here is that $s\in\{0,1\}^n$. It has $n$ bits. However, each time you perform the classical function evaluation, you only get one bit of information, because $f$ only has one bit of output (Note that even if you phrase it as a reversible computation, although $n+1$ bits may be involved, $n$ of those contain the information about the input, so there's still only 1 new bit of information). If you only get 1 bit per query, and you need to get $n$ bits, it's going to take you at least $n$ queries.

+ +

(The obvious strategy to ensure that you only need $n$ queries is to choose the $n$ inputs which each consist of $n-1$ 0s and one 1 (in the $n$ different positions), so that the evaluation of $f$ is a different bit of $s$ each time.)

+",1837,,,,,1/2/2020 8:53,,,,0,,,,CC BY-SA 4.0 +9375,1,9525,,1/2/2020 9:46,,3,453,"

I am trying to implement a circuit for searching for the largest eigenvalue and respective eigenvector of an operator, i.e. phase estimation, introduced in article Towards Pricing Financial Derivatives with an IBM Quantum Computer, page 6, figure 3(a).

+ +

The authors of the article use the phase estimation for indentification of the most important component in principal component analysis. In particular, they look for the largest eigenvalue of this matrix

+ +

\begin{equation} +\rho= +\begin{pmatrix} +0.6407 & 0.3288 \\ +0.3288 & 0.3593 +\end{pmatrix} +\end{equation}

+ +

The largest eigenvalue of the matrix is 0.8576 with respective eigenvector $(0.8347; 0.5508)^T$.

+ +

To search for that, the authors proposed following cicuit +

+ +

Note that gates denoted by -1.57 and -0.79 are $S^\dagger$ and $T^\dagger$ respecitvelly. They act on ""bottom"" qubit and they are controlled by ""top"" qubit

+ +

$U3$ operators implement operator $\mathrm{e}^{2\pi i \rho}$ and its powers.

+ +

According to the article, results after measurement should be these:

+ +

+ +

Note that pink bars are results obtained on simulator, while blue ones on IBMQX2 processor.

+ +

Based on these results, the authors concluded that the largest eigenvalue is approximated by value $0.111_2$ (0.875 in decimal which is close to actual value 0.8576).

+ +

I tried to replicate their results with this circuit on IBM Q:

+ +

+ +

Note: please find a code in QASM at the end of the question to see parameters of gates

+ +

I received these results on IBM Q simulator.

+ +

+ +

According to my results, the largest eigenvalue should be zero which does not make sense.

+ +

So, my questions are these:

+ +
    +
  1. Where I did a mistake in circuit implementation? My circuit and the author's seems to be the same.
  2. +
  3. Why the qubit $|q_3\rangle$ is initialized by gates $Ry$ and $Rz$ with parameter $\theta$ equal to 1.00 and 0.33, respectively? I would expect only gate $Ry$ with $\theta = 1.1665$ as this gate produce the eigenvector $(0.8347; 0.5508)^T$. However, replacement of $Ry(1.00)$ and $Rz(0.33)$ with $Ry(1.1665)$ does not change resulting histogram significantly.
  4. +
+ +

Here is a QASM code of my circuit

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+qreg q[4];
+creg c[4];
+
+h q[0];
+h q[1];
+h q[2];
+ry(1.00) q[3];
+rz(0.33) q[3];
+cu3(1.6,-1.12,2.03) q[2],q[3];
+cu3(2.23,0.51,3.65) q[1],q[3];
+cu3(0.8,-4.53,-1.39) q[0],q[3];
+h q[0];
+cu1(-pi/2) q[0],q[1];
+cu1(-pi/4) q[0],q[2];
+h q[1];
+cu1(-pi/2) q[1],q[2];
+h q[2];
+measure q[3] -> c[3];
+measure q[2] -> c[2];
+measure q[1] -> c[1];
+measure q[0] -> c[0];
+
+",9006,,9006,,1/6/2020 5:55,1/13/2020 22:25,Cannot replicate results in article on pricing financial derivatives on IBM Q,,1,4,,,,CC BY-SA 4.0 +9378,2,,9372,1/2/2020 10:28,,5,,"

AFAIK, what you want can't be run on the hardware right now. See this github issue.

+ +

However, you can do this in the simulators. If, for example, c[0] and c[1] make up a two-bit classical register c, you can do this:

+ +
qc.x(q[0]).c_if(c,3)
+qc.x(q[1]).c_if(c,3)
+
+",1790,,,,,1/2/2020 10:28,,,,2,,,,CC BY-SA 4.0 +9379,2,,9243,1/2/2020 11:23,,2,,"

I assume this is not what was intended, but here's one method:

+ +

You already know that you can approximately make $H'=2i\alpha(|x\rangle\langle\psi|-|\psi\rangle\langle x|)$ by using products of terms such as $e^{i\delta|x\rangle\langle x|}$ and $e^{i\delta|\psi\rangle\langle \psi|}$. So, we could simply convert $H'$ into $H$: +$$ +e^{i\pi/2|\psi\rangle\langle \psi|}e^{iH't}e^{-i\pi/2|\psi\rangle\langle \psi|}=e^{e^{i\pi/2|\psi\rangle\langle \psi|}iH'te^{-i\pi/2|\psi\rangle\langle \psi|}}. +$$ +So, let's consider just the exponent: +$$ +e^{i\pi/2|\psi\rangle\langle \psi|}H'e^{-i\pi/2|\psi\rangle\langle \psi|}. +$$ +The term $e^{i\pi/2|\psi\rangle\langle \psi|}$ has the effect +$$ +e^{i\pi/2|\psi\rangle\langle \psi|}|\psi\rangle=i|\psi\rangle, +$$ +while it has no effect on any other (orthogonal) state. If we ignore terms of $O(\alpha)$, we can neglect the overlap between $|\psi\rangle$ and $|x\rangle$, so +$$ +e^{i\pi/2|\psi\rangle\langle \psi|}|x\rangle\approx|x\rangle. +$$ +Hence, the transformation on $H'$ is +$$ +H'\rightarrow2i\alpha(-i|x\rangle\langle\psi|-i|\psi\rangle\langle x|)=2\alpha(|x\rangle\langle\psi|+|\psi\rangle\langle x|), +$$ +exactly as we need (to $O(\alpha^2)$).

+",1837,,,,,1/2/2020 11:23,,,,0,,,,CC BY-SA 4.0 +9380,1,,,1/2/2020 12:34,,2,363,"

Trying quantum teleportation in +https://github.com/Qiskit/qiskit-textbook/blob/master/content/ch-algorithms/teleportation.ipynb

+ +

Succesful runs in 'qasm_simulator', but when switching to IBMQBackend('ibmqx2') I get IBMQJobFailError

+ +

+",9648,,,,,1/2/2020 15:14,Qubit measurement is followed by instructions. Error code: 7006,,2,0,,1/2/2020 17:18,,CC BY-SA 4.0 +9382,2,,9380,1/2/2020 14:36,,2,,"

The error is caused by appending gates onto qubits following a measurement. On qubit 1 and qubit 0, you attach a cx gate after a measurementhas already been placed. This will compile on the simulator, but it is not something that is supported on the real hardware.

+",6180,,,,,1/2/2020 14:36,,,,1,,,,CC BY-SA 4.0 +9383,2,,8441,1/2/2020 14:43,,0,,"

I would also like to bring up the classical concepts of combinatorial logic vs sequential logic.

+ +

Combinatorial logic is that which has no internal state, e.g. registers, memory etc. For this type of logic, there is not use for a clock: input comes in, and output goes out approximately instantaneously.

+ +

Sequencial logic is the opposite. Its internal state gets update with every clock tick.

+ +

Modern computers use a combination of both, which allows to describe a wide range of algorithms in a step by step fashion, storing memory between each instantaneous step.

+ +

In quantum computing however, it is my understanding that you cannot store the internal state of the circuit: one measurement is made, and it instantaneously gives a result essentially instantaneously.

+ +

Therefore, in that sense, a quantum computer is analogous to a combinatorial circuit, and there isn't much sense in having clocks in the quantum computer itself.

+ +

See also: Quantum circuits explain algorithms, why didn't classical circuits?

+",4243,,,,,1/2/2020 14:43,,,,0,,,,CC BY-SA 4.0 +9384,2,,9380,1/2/2020 15:14,,0,,"

You should put measurement after all quantum gates. According to the theory, there is no difference whether gates (in this case CNOTs) are controlled by qubits or classical bits. +I encountered the same problem, see solution here.

+",9006,,,,,1/2/2020 15:14,,,,0,,,,CC BY-SA 4.0 +9385,1,,,1/2/2020 15:49,,6,105,"

A quantum computer running Shor's algorithm would be famously useful for decrypting information encrypted by many classical public-key cryptography algorithms. Is there any reason (either a specific proposed protocol or a general heuristic argument) to suspect that a quantum computer could be useful for encrypting information in a way that's more secure than is possible with a classical computer with comparable resources? Ideally, secure even against attacks by quantum computers?

+ +

I'm not talking about ""physics-based"" quantum encryption schemes like quantum key distribution (discussed here) or other schemes that require transmitting a coherent quantum state over a quantum channel. I'm talking about more traditional ""mathematics-based"" encryption schemes, in which one or both parties have a quantum computer at each end, but they can only transmit the encoded information in the form of classical bit strings over an insecure classical channel (potentially after having transmitted a symmetric key out of band).

+ +

This question is inspired by Scott Aaronson's comments here and here on his blog. Apparently people regularly claim that quantum computers (not QKD) could be useful for encryption, but Prof. Aaronson has never understood why.

+",551,,551,,1/3/2020 5:11,1/3/2020 5:11,Could quantum computers be useful for sending encrypted information over a classical channel?,,1,0,0,,,CC BY-SA 4.0 +9386,1,,,1/2/2020 16:05,,2,155,"

Is it possible to make a quantum Monty Hall problem where the quantum computer wins the game always?

+",9687,,9006,,1/2/2020 19:19,9/30/2020 20:20,Monty Hall Problem in Quantum Computing,,1,2,,10/2/2020 22:30,,CC BY-SA 4.0 +9387,2,,9385,1/2/2020 16:07,,5,,"

This is a purely hypothetical answer - I don't know if anybody has ever studied it, and have not attempted to find out - but think about public key cryptography. Current public key systems are based on the idea that some problems in the complexity class NP are probably hard to solve directly, but there exists a ""proof"" that lets you verify the solution easily. This proof constitutes the decryption key. If you've got it, the message is easy to decrypt. If you haven't, it's hard.

+ +

Now, the current problem is that everybody's favourite example is based on factoring, which is broken by a quantum computer. So, you'd like a quantum-secure replacement. Post-quantum crypto aims to do that via purely classical means. The theory being that if you base it on an NP-complete problem, the ""probably hard to solve"" part is probably still hard for a quantum computer. But you could conceivably base it on a QCMA-complete problem. These are problems for which the simple proof comprises classical data, but the proof is only simple for a quantum computer. This suggests the possibility of a public key cryptosystem where all the messages passed are classical (I have no idea if it's sufficient to have a classical proof to guarantee the existence of a system where all messages are classical, whether there's more to it, or whether it's simply impossible), but they need a quantum computer to encrypt/decrypt.

+",1837,,,,,1/2/2020 16:07,,,,4,,,,CC BY-SA 4.0 +9388,2,,9386,1/2/2020 16:16,,1,,"

In case you were able to design an oracle for right door identification (I am not sure how to do so), you would apply Grover algorithm

+",9006,,,,,1/2/2020 16:16,,,,0,,,,CC BY-SA 4.0 +9389,1,,,1/2/2020 18:23,,2,227,"

If one has two qubits in arbitrary stats and wishes to apply a controlled version of some global phase gate $P(\varphi) = \begin{pmatrix} e^{i\varphi} & 0 \\ 0 & e^{i\varphi} \end{pmatrix}$ one should obtain:

+ +

$$ +\left| \psi_0 \right\rangle \left| \psi_1 \right\rangle = \left(c_{00} \left| 0 \right\rangle + c_{01} \left| 1 \right\rangle \right)\left(c_{10} \left| 0 \right\rangle + c_{11} \left| 1 \right\rangle \right) \xrightarrow{\text{CP} +}$$

+ +

$$ +\xrightarrow{\text{CP}} +c_{00} \left| 0 \right\rangle \left(c_{10} \left| 0 \right\rangle + c_{11} \left| 1 \right\rangle \right) + c_{01} \left| 1 \right\rangle \left(c_{10} e^{i\varphi} \left| 0 \right\rangle + c_{11} e^{i\varphi} \left| 1 \right\rangle \right), +$$

+ +

This example shows that in contrast to global phase gate $P$ which doesn't produce any measurable changes in a qubit state, the controlled version of it ($CP$) makes measurable changes in the state of a system of qubits. So it is ok if $P$ is ignored, but it is not ok if $CP$ is ignored (what is happening in the presented code).

+ +

Here is a code where I use qiskit.aqua.operators.common.evolution_instruction method, where because of (how I understand) ignoring the global phase gate, the $CP$ gate wasn't obtained (the print(qc.qasm()) command shows no gate is added to the circuit):

+ +
import numpy as np
+from qiskit import *
+from qiskit.aqua.operators import WeightedPauliOperator
+from qiskit.aqua.operators.common import evolution_instruction
+
+phase = np.pi
+pauli_dict = {'paulis': [{""coeff"": {""imag"": 0.0, ""real"": phase}, ""label"": ""I""}]}
+identity = WeightedPauliOperator.from_dict(pauli_dict)
+
+pauli_list = identity.reorder_paulis()
+instruction = evolution_instruction(pauli_list, evo_time=1, num_time_slices=1, controlled=True)
+
+q = QuantumRegister(2)
+qc_temp = QuantumCircuit(q)
+qc_temp.append(instruction, q)
+qc = qc_temp.decompose()
+
+print(qc.qasm())
+
+ +

Possible consequences: when I tried to implement IPEA algorithm for $H = \begin{pmatrix} E_1 & 0 \\ 0 & E_2 \end{pmatrix}$ Hamiltonian I was estimating $E_2 - E_1$ instead of estimating $E_2$ eigenvalue. This problem was reported here. Problems may arise also for other quantum algos that use PEA as a subroutine (like HHL algo).

+ +

Is this a problem/bug? Are there alternatives to qiskit evolution_instruction method that don't ignore phase gates (or Pauli I operator)?

+",9459,,55,,6/4/2020 15:05,10/22/2022 20:08,Pauli I in eoh procedure doesn't become a global phase gate in qiskit evolution_instruction method. Possible consequences,,3,0,,,,CC BY-SA 4.0 +9390,2,,9389,1/2/2020 19:23,,0,,"

It seems that this is not a problem/bug. In case the global phase gate $P$ is applied in non-controlled form, final matrix for two qubits ($P$ is acting on second qubit) is +\begin{equation} +I \otimes P = +\begin{pmatrix} +P & O \\ +O & P \\ +\end{pmatrix} +=\mathrm{e}^{i\phi}I +\end{equation} +So, $P$ acts as global phase gate and the phase $\mathrm{e}^{i\phi}$ can be ignored.

+ +

However, matrix of controlled $P$ is as follows +\begin{equation} +CP = +\begin{pmatrix} +I & O \\ +O & P \\ +\end{pmatrix} +\end{equation} +Hence, $CP$ is no longer global phase gate but it prepares entangled state.

+",9006,,,,,1/2/2020 19:23,,,,2,,,,CC BY-SA 4.0 +9391,1,,,1/2/2020 20:28,,2,332,"

If I have either of the following states:

+ +

$$\left|\psi_0\right\rangle = \frac{1}{2}\left|0000\right\rangle + \frac{1}{2}\left|0011\right\rangle + \frac{1}{2}\left|1100\right\rangle + \frac{1}{2}\left|1111\right\rangle$$

+ +

$$\left|\psi_1\right\rangle = \frac{1}{\sqrt{3}}\left|001\right\rangle -\frac{1}{\sqrt{3}} \left|010\right\rangle + \frac{1}{\sqrt{3}}\left|100\right\rangle$$

+ +

How can I check to see whether they are entangled or not? I have seen people say that the state $\left|\psi_1\right\rangle$ is entangled because ""there are correlations between the three qubits"", but I can't find what this really means.

+",9678,,55,,1/10/2020 16:14,1/10/2020 16:14,How to identify entanglement in a given pure state?,,2,5,,,,CC BY-SA 4.0 +9392,2,,9391,1/2/2020 23:00,,3,,"

The definition of an entangled state is one that cannot be decomposed into an arbitrary Kronecker product of individual state vectors corresponding to individual quantum systems. Mathematically speaking, an un-entangled state $|\psi\rangle$ is one that can be written in the following way:

+ +

$$|\psi\rangle \ = \ \displaystyle\bigotimes_n |\psi_n\rangle$$

+ +

Where $|\psi_n\rangle$ is the state of the $n$-th qudit, whatever you want. In the case of an $D$-level discrete quantum system, we can write each $|\psi_n\rangle$ as a normalized linear combination of $D$ orthogonal basis vectors:

+ +

$$|\psi_n\rangle \ = \ \displaystyle\sum_{d} c^n_d |d\rangle \ \ \ \text{with} \ \ \ \displaystyle\sum_d |c^n_d|^2 \ = \ 1$$

+ +

In the case of a qubit, $D \ = \ 2$ and we have $|0\rangle$ and $|1\rangle$ as our basis states. We thus expand $|\psi\rangle$:

+ +

$$|\psi\rangle \ = \ \displaystyle\bigotimes_n \displaystyle\sum_{d} c^n_d |d\rangle$$

+ +

When we expand our tensor product, we will get a linear combination of $D^N$ different state vectors, each with some unknown coefficient. In general, for the $j$-th term of the sum, our coefficient $c_j$ is given by a product of $D^N$ different values of $c^n_d$ (I'm not going to do the explicit expansion for the $j$-th term in the case of a $d$-level quantum system, I don't even want to do the binomial expansion for a $2$-level system):

+ +

$$c_j \ = \ c^{n_{j_1}}_{d_{j_1}} \ c^{n_{j_2}}_{d_{j_2}} \ ... \ c^{n_{j_{D^N}}}_{d_{j_{D^N}}}$$

+ +

But we already know $c_j$, as we know $|\psi\rangle$, and $c_j$ is given by:

+ +

$$c_j \ = \ \langle j | \psi \rangle$$

+ +

Where $|j\rangle$ is the $j$-th basis vector in the expansion. Thus, all we have to do is solve the system of $D^N$ equations for $D^N$ unknowns. If we can in fact do this, then we know that we have an un-coupled (un-entangled) state. If we can't we know our state is entangled!

+ +

If this was slightly confusing an abstract, let's work through a basic example, and prove that the maximally entangled qubit Bell state:

+ +

$$|\psi\rangle \ = \ \frac{|00\rangle \ + \ |11\rangle}{\sqrt{2}}$$

+ +

is in fact entangled using the outlined method. Our goal is to write $|\psi\rangle$ as a tensor product of two individual state vectors:

+ +

$$|\psi\rangle \ = \ \frac{|00\rangle \ + \ |11\rangle}{\sqrt{2}} \ = \ (a|0\rangle \ + \ b|1\rangle) \ \otimes \ (c|0\rangle \ + \ d|1\rangle)$$ +$$\Rightarrow \ (a|0\rangle \ + \ b|1\rangle) \ \otimes \ (c|0\rangle \ + \ d|1\rangle) \ = \ ac |00\rangle \ + \ ad |01\rangle \ + \ bc|10\rangle \ + \ bd|11\rangle$$

+ +

Now, since each of our basis vectors are orthogonal, we can equate the components to get a system of equations:

+ +

$$ac \ = \ \frac{1}{\sqrt{2}}$$ +$$ad \ = \ 0$$ +$$bc \ = \ 0$$ +$$bd \ = \ \frac{1}{\sqrt{2}}$$

+ +

Rearranging, we get:

+ +

$$d \ = \ \frac{1}{\sqrt{2} b} \ \ \ \text{and} \ \ \ a \ = \ \frac{1}{\sqrt{2} c}$$

+ +

So we get:

+ +

$$ad \ = \ \frac{1}{2bc} \ = \ 0$$

+ +

Which is a contradiction (this is not possible). Thus, we cannot express the Bell state as a tensor product of individual state vectors. It follows that the Bell state is in fact entangled.

+ +

If you are into some really hardcore stuff, we can do something similar with a continuous-variable quantum system (qumodes, for instance). In this case, we no longer expand out our state $|\psi_n\rangle$ as a discrete sum of basis states, but as a continuous integral over a continuum:

+ +

$$|\psi_n\rangle \ = \ \displaystyle\int \psi_n(x) |x\rangle dx$$

+ +

We then have:

+ +

$$|\psi\rangle \ = \ \displaystyle\bigotimes_n \displaystyle\int \psi_n(x) |x\rangle dx \ = \ \displaystyle\int \ ... \ \displaystyle\int \displaystyle\bigotimes_n \psi_n(x_n) |x_n\rangle \ dx_1 \ ... \ dx_n$$

+ +

In general, $|\psi\rangle$ is given by:

+ +

$$|\psi\rangle \ = \ \displaystyle\int \ ... \ \displaystyle\int \psi(x_1, \ ..., \ x_n) \displaystyle\bigotimes_n |x_n\rangle \ dx_1 \ ... \ dx_n$$

+ +

And, analogous to the discrete case, we know the function $\psi(x_1, \ ..., \ x_n)$. Thus, in the un-entangled case, we have:

+ +

$$\displaystyle\prod_n \psi_n(x_n) \ = \ \psi(x_1, \ ..., \ x_n)$$

+ +

So instead of finding discrete components, our goal is to find a collection of functions $\psi_j(x_j)$, such that the product of all these functions gives us the general $\psi$. If we can't do this, then our state is entangled. As an example, consider the function:

+ +

$$\psi(x, \ y) \ = \ x \ + \ y \ + \ xy$$

+ +

We want to find $\psi_1$ and $\psi_2$ such that:

+ +

$$\psi_1(x) \psi_2(y) \ = \ x \ + \ y \ + \ xy$$

+ +

We have:

+ +

$$\psi_2(y) \ = \ \frac{x \ + \ y \ + \ xy}{\psi_1(x)} \ = \ \frac{x}{\psi_1(x)} \ + \ \frac{y}{\psi_1(x)} \ + \ \frac{xy}{\psi_1(x)}$$

+ +

Now, $\psi_2(y)$ is a function of only $y$, we can't have $x$ present in any of the terms. We quickly realize that this is impossible, as the only way to get rid of the $x$ in the first term is if $\psi_1(x) \ = \ ax$, but this would mean that the second term contains $x$. This same logic can be applied to all of the terms. In addition, cancellation is obviously of no help here. Thus, the state given as:

+ +

$$|\psi\rangle \ = \ \displaystyle\int \displaystyle\int (x \ + \ y \ + \ xy) |x, \ y\rangle dx dy$$

+ +

must be entangled.

+ +

Edit

+ +

After writing this answer, I came across this question, which is very similar, and already has answers. Despite this, I don't think this question should be closed as my answer discusses a more general approach to this problem.

+",4907,,4907,,1/3/2020 3:30,1/3/2020 3:30,,,,0,,,,CC BY-SA 4.0 +9393,1,9395,,1/3/2020 5:49,,2,226,"

I have been going through the original HHL paper (2009), and I see that they call a linear system of equations ""well behaved"" / ""well-conditioned"", if +$$ |\lambda| \in \left[\frac{1}{\kappa}, 1\right]$$ +where $\kappa$ is the condition number. I am not that strong in Linear Algebra, but it is very obscure to me why they are combining eigenvalues and singular values. Could someone explain why this is being done either in the context of this particular algorithm, or in general?

+",542,,,,,1/3/2020 8:13,HHL Algorithm: Relation between Eigenvalues and condition number,,1,0,,,,CC BY-SA 4.0 +9394,2,,9391,1/3/2020 6:49,,3,,"

Your comments talk about an exam setting. Probably the most reliable thing to do is calculate the partial trace of each qubit. If any of them is mixed, there is entanglement in the system. (I’m not sure that a yes/no question about the existence of entanglement is a good question in a system of more than 2 qubits, but...) In your particular examples, you can gain a lot of efficiency by noticing that there’s a permutation symmetry between the qubits, so that all the reduced density matrices are basically the same. You only have to check one of them.

+",1837,,,,,1/3/2020 6:49,,,,0,,,,CC BY-SA 4.0 +9395,2,,9393,1/3/2020 8:13,,3,,"

In the HHL algorithm, they are solving a linear system $Ax=b$. This is achieved by embedding $A$ into a Hermitian matrix such as +$$ +H=\left(\begin{array}{cc} 0 & A \\ A^\dagger & 0 \end{array}\right). +$$ +If $A$ has singular values $\lambda$, then $H$ has eigenvalues $\pm\lambda$. So to all intents and purposes, they are the same thing in this context.

+ +

For a bit more context, there's basically two things that you need to know about for the algorithm: the spread of the eigenvalues, and how close to 0 the eigenvalues get. The spread is so that you can pick a $t$ such that $e^{iHt}$ has eigenvalues (to be determined by phase estimation) that do not loop past any $2\pi$ boundaries so there's never any ambiguity. i.e. you want $0<t\lambda<\pi$ for all singular values $\lambda$. The second issue is that the main part of the algorithm essentially calculates $1/\lambda$, which is bad news if we've identified $\lambda=0$, so we want to ensure that our phase estimation procedure is accurate enough to be able to detect that the eigenvalues are not 0.

+",1837,,,,,1/3/2020 8:13,,,,1,,,,CC BY-SA 4.0 +9396,1,9397,,1/3/2020 8:24,,2,1225,"

The Hadamard gate is a unitary gate, but how does the matrix times its own conjugate transpose actually result in the $I$ matrix? I am currently looking at it as a scalar, 0.707..., multiplied by the matrix of ones and negative one.

+ +

\begin{equation} +H=\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 1 \\ +1 & -1 +\end{pmatrix} +\end{equation}

+",8133,,9006,,1/3/2020 21:50,4/22/2022 7:47,Why is a Hadamard gate unitary?,,2,3,,,,CC BY-SA 4.0 +9397,2,,9396,1/3/2020 11:08,,8,,"

The Hadamard gate is described by this matrix +\begin{equation} +H=\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 1 \\ +1 & -1 +\end{pmatrix} +\end{equation} +Conjugate transpose of $H$ is again $H$. Hence we have to check if $HH$ is $I$.

+ +

Multiplication goes as follows ($h_{ij}$ denotes elements of resulting matrix):

+ +
    +
  1. $h_{11} = 1\cdot1 + 1\cdot1 = 2$
  2. +
  3. $h_{12} = 1\cdot 1 + 1\cdot (-1) = 0$
  4. +
  5. $h_{21} = 1 \cdot1 + (-1) \cdot 1= 0$
  6. +
  7. $h_{21} = 1 \cdot1 + (-1)\cdot (-1) = 2$
  8. +
+ +

So

+ +

\begin{equation} +HH=\frac{1}{\sqrt{2}}\frac{1}{\sqrt{2}} +\begin{pmatrix} +2 & 0 \\ +0 & 2 +\end{pmatrix} += +\frac{1}{2} +\begin{pmatrix} +2 & 0 \\ +0 & 2 +\end{pmatrix} += +\begin{pmatrix} +1 & 0 \\ +0 & 1 +\end{pmatrix} +=I. +\end{equation}

+",9006,,124,,1/4/2020 21:59,1/4/2020 21:59,,,,3,,,,CC BY-SA 4.0 +9398,2,,9389,1/3/2020 15:22,,0,,"

What does the print(qc.qasm()) yield for you?

+ +

Here is what I get:

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+qreg q2[2];
+Controlled-Evolution^1 q2[0],q2[1];
+
+",7744,,,,,1/3/2020 15:22,,,,3,,,,CC BY-SA 4.0 +9399,2,,9389,1/3/2020 15:31,,0,,"

I just copied and pasted your code above, and that is the output I get from the print() statement. What version of qiskit do you have?

+ +
from qiskit import qiskit_version
+print(qiskit_version)
+
+",7744,,,,,1/3/2020 15:31,,,,7,,,,CC BY-SA 4.0 +9400,2,,9368,1/3/2020 15:41,,6,,"

$\newcommand{\ket}[1]{\vert#1\rangle}$ +First, write $\ket\psi$ and $\ket{\tilde\psi}$ in their Schmidt decomposition: +$$ +\begin{aligned} +\ket\psi &= \sum \lambda_i \ket{a_i}\ket{b_i}\ , \\ +\ket{\tilde\psi} & = \sum \tilde\lambda_i \ket{\tilde a_i}\ket{\tilde b_i}\ . +\end{aligned} +$$ +Let us assume for simplicty that the $\lambda_i$ are non-degenerate. +Since they both have the same reduced density operator $\rho_A$, we have that $\lambda_i=\tilde \lambda_i$ and $\ket{a_i}=\ket{\tilde a_i}$. Now construct $U$ such that $\ket{\tilde b_i}=U\ket{b_i}$ -- this is possible since both are orthogonal bases. Then, we see that +$$ +\ket{\tilde\psi} = (I\otimes U)\ket{\psi} +$$ +-- that is, given two arbitrary purifications of the same $\rho_A$, we have shown they are related by a unitary on the purifying system.

+ +

(In case some $\lambda_i$ are degenerate, the Schmidt decomposition is not unique - you want to choose it such that $\ket{a_i}=\ket{\tilde a_i}$ also for the degenerate $\lambda_i$, which is always possible, since the degenerate eigenvectors must span the same subspace.)

+ +

(Another note: In principle, the purifying system can be larger than the Schmidt rank; in that case, the action of $U$ is only fixed on the subspace spanned by the Schmidt vectors on B.)

+",491,,5870,,1/3/2020 17:14,1/3/2020 17:14,,,,2,,,,CC BY-SA 4.0 +9403,2,,9368,1/3/2020 18:02,,2,,"

If the density matrix $\rho\in\mathrm{Lin}(\mathcal H_A)$ has purification $|\psi\rangle\in\mathcal H_A\otimes\mathcal H_B$, meaning $\rho=\operatorname{Tr}_B(|\psi\rangle\!\langle\psi|)$, then we can write $\rho=\psi\psi^\dagger$ where $\psi$ denotes the "unvectorisation" of $|\psi\rangle$, that is +$$\psi\in\mathrm{Lin}(\mathcal H_B,\mathcal H_A), +\qquad |\psi\rangle=\operatorname{vec}(\psi), +\qquad \psi_{i,j} = \langle i,j|\psi\rangle.$$

+

This means that, if $\psi,\phi\in\mathrm{Lin}(\mathcal H_B,\mathcal H_A)$ represent pure states purifying the same $\rho$, then +$$\psi\psi^\dagger=\phi\phi^\dagger=\rho.$$ +This implies that the singular value decomposition of $\psi$ and $\phi$ must have both singular values and left principal components in common, that is, we can write +$$ + \psi = \sum_k s_k \mathbf u_k \mathbf v_k^*, \\ + \phi = \sum_k s_k \mathbf u_k \mathbf w_k^*, +$$ +for some $s_k\ge0$ (whose square equal the eigenvalues of $\rho$) and orthonormal sets of vectors $\{\mathbf u_k\}_k,\{\mathbf v_k\}_k,\{\mathbf w_k\}_k$, and with $\mathbf v^*$ denoting the dual of $\mathbf v$.

+

Going back to the notation with ket vectors (that is, considering again the vectorifications of $\psi,\phi$), we see that +$$|\psi\rangle = \sum_k s_k (\mathbf u_k\otimes\bar{\mathbf v}_k), +\qquad |\phi\rangle = \sum_k s_k (\mathbf u_k\otimes\bar{\mathbf w}_k),$$ +meaning the purifications only differ by local unitaries.

+",55,,55,,1/22/2022 16:24,1/22/2022 16:24,,,,0,,,,CC BY-SA 4.0 +9404,1,9405,,1/3/2020 18:21,,4,1823,"

If I have the following state:

+ +

$$ +\left| \varphi \right>=\frac{1}{\sqrt{2}}\left(\left(\frac{1+i}{\sqrt{2}} \right)\left| 0 \right> + \left| 1\right>\right) +$$

+ +

How can I find the $\theta$ and $\phi$ values of this qubit on the Bloch sphere?

+",9700,,55,,1/23/2023 13:40,1/23/2023 13:40,Find the $\theta$ and $\phi$ values on the Bloch sphere corresponding to the state $\frac{1+i}{2}|0\rangle+\frac1{\sqrt2}|1\rangle$,,2,0,,,,CC BY-SA 4.0 +9405,2,,9404,1/3/2020 18:54,,3,,"

See below: +$$\left| \varphi \right>=\frac{1}{\sqrt{\sqrt{2}}}\left(\left(\frac{1+i}{\sqrt{2}} \right)\left| 0 \right> + \left| 1\right>\right) += +\frac{1+i}{\sqrt{\sqrt{2}}}\left(\frac{1}{\sqrt{2}}\left| 0 \right> + \frac{1}{\sqrt{2}}\frac{1-i}{\sqrt{2}} \left| 1\right>\right) += +\frac{1+i}{\sqrt{\sqrt{2}}}\left(\cos(\pi/4)\left| 0 \right> + \sin(\pi/4) e^{-i\pi/4} \left| 1\right>\right) += +C\left(\cos(\theta/2)\left| 0 \right> + \sin(\theta/2) e^{i\phi} \left| 1\right>\right)$$

+ +

Therefore +$\theta = \pi/2$ and $\phi=-\pi/4$

+",9545,,542,,1/4/2020 5:29,1/4/2020 5:29,,,,6,,,,CC BY-SA 4.0 +9406,1,9407,,1/3/2020 22:54,,4,104,"

I just learned from the existence of the theoretical Lieb-Robinson bound, which indicates that the speed at which information can be propagated in non-relativistic quantum systems cannot exceed this upper limit. If this is true, then does it mean that the entanglement is not transmitting information? So what does it mean for protocols like BB84 (quantum key distribution)?

+",5324,,55,,11/11/2020 21:37,11/11/2020 21:37,Does the Lieb-Robinson bound constrain the speed of entanglement information transmission?,,1,0,,,,CC BY-SA 4.0 +9407,2,,9406,1/4/2020 7:18,,5,,"

Entanglement does not transmit information, as follows from the No-communication theorem.

+ +

Lieb-Robinson bound is a limit on speed at which perturbation propagates using short-range interactions, for example in spin lattice. I doubt it means something for protocols such as BB84; you can transmit quantum information by sending polarized photons, and photons move at the speed of light; or you can transmit quantum information using quantum teleportation protocol, also limited by the speed of light.

+",2105,,,,,1/4/2020 7:18,,,,0,,,,CC BY-SA 4.0 +9408,1,,,1/4/2020 8:23,,6,305,"

When you enter the field of quantum communications, you run at some point into the concept of superdense coding.

+ +

Basically it is a way to encode classical bits on the qubits of a quantum channel, which sounds interesting in the first place to increase classical throughput by benefitting of the exponential growth of the Hilbert space with multiple qubits.

+ +

Yet when you look at the protocol in more detail, you understand that even though it seems that you have encoded 2 classical bits in 1 qubit, you actually need a second, entangled, qubit to retrieve the information from the 1st qubit.

+ +

So there is no real benefit - if you need to send two photons, you can encode two bits classically.

+ +

So apart from a textbook example, where is the practical interest? Are there more subtle points I am missing? Are there more intricatre protocols to avoid that?

+ +
+ +

Cross-posted on math.SE

+",9704,,55,,11/11/2020 21:37,11/12/2020 6:42,What is the practical interest of superdense coding?,,3,1,,,,CC BY-SA 4.0 +9409,1,,,1/4/2020 9:37,,3,57,"

Can the state of a qubit affect its energy? Please elaborate on your answer

+",9707,,,,,1/6/2020 8:11,Does the energy of a qubit change when it undergoes a collapse?,,1,1,,,,CC BY-SA 4.0 +9410,1,,,1/4/2020 10:26,,-3,193,"

I need to find the coordinate 𝜃 and ϕ values of the quantum state on the bloch sphere +$$ +\left| \varphi \right>=\frac{1+i}{\sqrt{3}} \left| 0 \right> + {\sqrt{\frac{1}{3}}} \left| 1\right> +$$

+",9700,,55,,11/10/2020 17:35,11/10/2020 17:35,"what are the angles 𝜃, and ϕ values of the following quantum state?",,1,1,,1/6/2020 18:00,,CC BY-SA 4.0 +9411,2,,9410,1/4/2020 11:05,,2,,"

You have normalized state +$$|\psi\rangle=\alpha|0\rangle + \beta|1\rangle$$

+ +

First, write the state as +$$|\psi\rangle=\frac{\alpha}{|\alpha|}\left({|\alpha|}|0\rangle + \frac{\beta|\alpha|}{\alpha}|1\rangle\right)$$

+ +

The factor $$\frac{\alpha}{|\alpha|}$$ is a global phase and not important. Now you have +$$\cos{\frac{\theta}{2}}=|\alpha|$$ +which gives the value of $\theta$ and +$$\sin{\frac{\theta}{2}}e^{i\phi}=\frac{\beta|\alpha|}{\alpha}$$ +which gives the value of $\phi$

+",2105,,,,,1/4/2020 11:05,,,,2,,,,CC BY-SA 4.0 +9412,2,,9408,1/4/2020 12:26,,7,,"

No, you need to send only one photon (from the pair). The other party could generate entangled pair and send the entangled photon to you. Or it could be the third party that send both of you your photons $-$ prior to actual communication.
+Even if it's you who generate the entangled pair and share the entangled photon $-$ you could do it way before the time when you need to send the second photon that carry the actual information.

+",5870,,5870,,1/4/2020 12:54,1/4/2020 12:54,,,,3,,,,CC BY-SA 4.0 +9413,1,9450,,1/4/2020 12:54,,6,851,"

I realized that Quantum Random Access Memory (qRAM) was proposed to make quantum computers more similar to classical one. Currently quantum computers have very constrained memory, given only quantum registers on quantum processors can be used for an algorithm to run. It is true that e.g. Qiskit language allows to use RAM or HDD of classical computer, however, resulting algorithms are hybrid quantum-classical.

+ +

I found some proposals how to implement qRAM, e.g. here.

+ +

But my understanding is that the device is highly experimental nowadays.

+ +

So my questions are those:

+ +
    +
  1. Does anybody know about progress in this field? Some links to articles of state-of-art implementation of qRAM will be highly appreciated.
  2. +
  3. What about IBM Q? Do we have an opportunity to use qRAM on IBM Q computer in foreseeable future (i.e. few years)?
  4. +
+",9006,,26,,1/9/2020 2:22,1/9/2020 2:22,What is the state of the art on Quantum Random Access Memories?,,1,1,,1/9/2020 13:33,,CC BY-SA 4.0 +9414,1,,,1/4/2020 13:03,,0,154,"

If we measure the first qubit and obtain $|0\rangle$, what does the second qubit collapses to?

+ +

$$ +\left| \varphi \right>=\frac{1}{\sqrt{2}} \left| 00 \right> + {\frac{i}{2}} \left| 01\right> - {\frac{1}{2}} \left| 11\right> +$$

+",9700,,55,,11/10/2020 17:36,11/10/2020 17:36,Qubit measurement of the state $\frac{1}{\sqrt2}|00\rangle+\frac{i}{2}|01\rangle-\frac{1}{2}|11\rangle$,,1,1,,,,CC BY-SA 4.0 +9415,2,,9243,1/4/2020 13:21,,0,,"

Probably i found an additional solution: +$$e^{-itH}=e^{-it(|x\rangle\langle \psi|+|\psi\rangle\langle x|)}=e^{-it(\alpha I+\sqrt{1-\alpha^2}X+\alpha Z)}=e^{-it\alpha}e^{-it(\sqrt{1-\alpha^2}X+\alpha Z)}$$ +where we put the calculation basis through $|x\rangle$ and $|\psi\rangle$

+ +

the last exponent express the rotation on the Bloch sphere around vector $(\sqrt{1-\alpha^2},0,\alpha)$. +It means that Hamiltonian $H$ express the same rotation on the Bloch sphere.

+ +

On other hand +$$e^{-itH_1}=e^{-it(|x\rangle\langle x|+|\psi\rangle\langle \psi|)}=e^{-it(I+\alpha\sqrt{1-\alpha^2} X+\alpha^2 Z)}=e^{-it}e^{-it\alpha(\sqrt{1-\alpha^2}X+\alpha Z)}$$ +where we see rotation around the same vector $(\sqrt{1-\alpha^2},0,\alpha)$.

+ +

It means that Hamiltonian $H$ can be simulated by using $H_1$, but $H_1$ can be simulated by using products of terms such as $e^{i\delta|x\rangle\langle x|}$ and $e^{i\delta|\psi\rangle\langle \psi|}$ (see Nielsen and Chuang Textbook p258)

+",9545,,,,,1/4/2020 13:21,,,,1,,,,CC BY-SA 4.0 +9416,2,,9352,1/4/2020 14:35,,5,,"

Here is the solution. The trick is to use ""the only connectivity matters"" rule. The swap rule of 4.9 helps us reorder the inputs, which then makes it topologically equivalent to the next diagram (match the first and second wires of the states).

+ +

+",2832,,,,,1/4/2020 14:35,,,,0,,,,CC BY-SA 4.0 +9417,2,,9414,1/4/2020 15:32,,2,,"

If first qubit is $|1\rangle$ there is no other possibility than second qubit to be $|1\rangle$ as well since probability of state $|10\rangle$ is zero. Hence probability of measuring $|1\rangle$ in second qubit is $1$.

+ +

In case first qubit is $|0\rangle$ there are two possibe results: +$|00\rangle$ or $|01\rangle$. Since probability of state $|00\rangle$ is $\frac{1}{2}$ and probability of state $|01\rangle$ is $\frac{1}{4}$, conditional probabilities that second qubit is $|0\rangle$ is $\frac{2}{3}$ and that it is $|1\rangle$ is $\frac{1}{3}$.

+ +

This is about probabilities of measuring $|0\rangle$ or $|1\rangle$ in computational basis, regarding quantum state of second qubit before its measurement, please refer to Shai Dashe comment:

+ +
+

Hint: note that $|\varphi\rangle = |0\rangle \otimes \big(\frac{1}{\sqrt{2}}|0\rangle + \frac{i}{2}|1\rangle\big) + |1\rangle\otimes \big(-\frac{1}{2}|1\rangle\big)$

+
+",9006,,9006,,1/4/2020 15:41,1/4/2020 15:41,,,,4,,,,CC BY-SA 4.0 +9418,1,,,1/4/2020 15:39,,6,409,"

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 implement a circuit doing $(x, 0, 0, y) \rightarrow (x, f(x), g(x), y)$ by first copying $x$ to the second register and then using the Fredkin gate equivalent of the classical algorithm to take the second register (now $x$) and the ancilla bits in the third register to $f(x)$ and some garbage $g(x)$.

+ +

Then they use $CNOT$ gates to add $f(x)$ to the last register, resulting in $(x, f(x), g(x), y \oplus f(x))$.

+ +

I understand that it is now important to uncompute the $g(x)$ garbage bits so that they don't mess with quantum interference that may occur later on the fourth register (the result). So they take the registers back to $(x, 0, 0, y\oplus f(x))$ using the inverse of the Fredkin gate implementation.

+ +

Now I am wondering if the following would also work: +Take $(x,0,y)$ to $(f(x), g(x), y)$ using the Fredkin equivalent of the classical algorithm. Then use $CNOT$ gates to go to $(f(x),g(x),y\oplus f(x))$ and then do the uncomputation step as before to get $(x, 0, y\oplus f(x))$.

+ +

This way we save a register. I assume I am either making some mistake on the way or the authors deemed their version easier to understand.

+",9450,,2105,,1/4/2020 19:11,1/4/2020 19:51,Uncomputation in quantum implementation of a classical algorithm,,1,3,,,,CC BY-SA 4.0 +9419,2,,9418,1/4/2020 19:06,,5,,"

Nielsen and Chuang book may be confusing; I will try to explain.

+ +

Any classical algorithm can be presented as a circuit consisting of $NOT$ and $AND$ gates; this means that if we can make quantum gates computing $NOT$ and $AND$, and make fanout, we can run any classical algorithm on quantum computer. $NOT$ is reversible and we have quantum $NOT$ gate; many quantum gates can serve as fanout; the only problem is $AND$ because it is irreversible.

+ +

Figure 3.16 in the book shows how configure Fredkin (CSWAP) gate for computing $AND$: +

+ +

You can see that we have computed garbage function $g(x,y)=\bar{x}y$ and we must uncompute it. Note that $y$ here have no relation to $y$ ancilla that will be used later in the chapter; it is better to denote here $x$ as $x_1$ and $y$ as $x_2$, and think of $x$ as of 2 qubits.

+ +

To uncompute $g(x_1,x_2)=\bar{x}_1x_2$ we need one more qubit denoted by $y$ in the book; usually it is $|0\rangle$ qubit; using $CNOT$ with qubit $f(x)=x_1x_2$ as a control qubit we map $y\rightarrow y\oplus f(x)$ and apply second Fredkin gate (which is self-reversed) to obtain

+ +
    +
  • on input: $0$, $x_2$, $x_1$, $y$
  • +
  • on output:$0$, $x_2$, $x_1$, $y\oplus f(x)$
  • +
+ +

and we are done, and we used $4$ qubits to do the job.

+ +
+ +

PS: If you want to understand things better:

+ +

https://www.youtube.com/watch?v=R2hyQhjHxrs

+ +

https://www.youtube.com/watch?v=5hLpvy6Mja0

+",2105,,2105,,1/4/2020 19:51,1/4/2020 19:51,,,,2,,,,CC BY-SA 4.0 +9420,2,,9409,1/5/2020 6:45,,4,,"

Depending on your physical implementation, it may be that the two basis states are at different energies. Thus, when the state collapses, the energy changes. However, the average energy remains constant so you cannot use this for energy generation or similar.

+ +

For example, assume we have a qubit with a Hamiltonian +$$ +H=E|1\rangle\langle 1|. +$$ +For any state $|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$, we have an average energy +$$ +\bar E=\langle\psi|H|\psi\rangle=E|\beta|^2. +$$ +If we measure this qubit in the standard, $Z$ basis, we get:

+ +
    +
  • answer $0$ with probability $|\alpha|^2$. Afterwards, the system is in the state $|0\rangle$ and has energy 0.
  • +
  • answer $1$ with probability $|\beta|^2$. Afterwards, the system is in the state $|1\rangle$ and has energy $E$.
  • +
+ +

So, you can see that the average energy is $|\alpha|^2\times 0+|\beta|^2\times E=E|\beta|^2$, which is unchanged from the original state. Sometimes you gain energy, sometimes you lose energy, but on average it stays the same.

+",1837,,1837,,1/6/2020 8:11,1/6/2020 8:11,,,,0,,,,CC BY-SA 4.0 +9421,1,,,1/5/2020 9:38,,5,334,"

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?

+",9714,,55,,1/10/2020 15:27,1/10/2020 15:27,How to implement the CCH gate in quantum computers available in clouds?,,2,2,,,,CC BY-SA 4.0 +9425,1,,,1/5/2020 15:15,,2,355,"

I want to compute the POVM $E_{(\theta, \phi)}$ of the measure which gives the probability of a qubit state lying over the surface of Bloch sphere, with angles $\theta, \phi$. How can I handle this?

+ +

Dividing the surface area through the volume of Bloch sphere seems not to be a solution because it gives and absurd result of 3.

+ +

How should I start?

+ +

_____EDIT____________

+ +

For clarification, I will write down the full statement of the problem:

+ +
+

Find the POVM $E_{(\theta, \phi)}$ of the measure which determines the probability that the state of a qubit is on the surface of the Bloch sphere with polar angle $\theta$ and azimuthal $\phi,$ the relation of completeness being fulfilled in this case: + $$\int d^{2} \Omega E_{(\theta, \phi)}=\mathbb{I}$$ + Is that a projective measure? Prove also that: + $$p(\theta, \phi)=\operatorname{Tr}\left[E_{(\theta, \phi)} \rho\right]=\frac{1}{4 \pi}(1+\boldsymbol{r} \cdot \boldsymbol{\Omega})$$ + with $r$ being the state's Bloch vector and $\Omega=(\sin \theta \cos \phi, \sin \theta \sin \phi, \cos \theta)$.

+ +

Explain why the only determination of the maximum of $p(\theta, \phi)$ allows tomography the state.

+
+ +

I was trying to use the pure state $\rho = \frac{1}{2}\left( \mathbb{I}+\vec{\Omega } \cdot \vec{\sigma} \right)$ as a operator measure for the mixed state $\rho '$ but can't obtain the factor $\frac{1}{4\pi}$.

+ +

I hope this update clears up your doubts

+",9716,,9716,,1/6/2020 9:54,6/4/2020 11:01,What is the probability of a single qubit state lying over the surface of Bloch sphere?,,2,6,,,,CC BY-SA 4.0 +9427,2,,9246,1/5/2020 19:38,,1,,"

3 things I see from your implementation of inverse QFT:

+ +
    +
  1. SWAP gates are missing prior to applying Hadamard gates and cu1 gates.
  2. +
  3. The Hadamard gate should come first before cu1 gates.
  4. +
  5. The angles of cu1 gates, how I understand inverse QFT, should be different.
  6. +
+ +

Here is inverse QFT that worked for me with not touching other parts of the code:

+ +
def qft_dagger(circ, q, n):
+    """"""n-qubit inverse QFT on q in circ.""""""
+    # SWAP gates
+    for i in range(n//2):
+        circ.swap(q[i], q[n - i - 1])
+
+    for i in reversed(range(n)):
+        circ.h(q[i])
+        for m in reversed(range(i)):
+            circ.cu1(-2*np.pi/2**(i - m + 1), q[i], q[m])
+        circ.barrier()
+
+ +

For 0.75 I obtained: 011, + 0.875: 111, + 0.5: 001, + 0.25: 010.

+ +

For more info see Figure 5.1. from the M.A. Nielsen and I.L. Chuang's book.

+ +

+ +

It shows the circuit for QFT without SWAP gates. From the book ""Not shown are swap gates at the end of the circuit which reverse the order of the qubits"".

+ +

The inverse QFT should be the same gates but in reversed order with their daggered versions. Note that $H^{\dagger} = H$, $u1^{\dagger} (\lambda) = u1(-\lambda)$ and $R_k$ in the book corresponds to $R_k = u1(2 \pi / 2^{k})$.

+",9459,,9459,,1/7/2020 8:49,1/7/2020 8:49,,,,6,,,,CC BY-SA 4.0 +9428,1,,,1/5/2020 21:16,,3,295,"

I am a computer science master's student who is doing research in the field of quantum computing. I have an IBM quantum experience account(https://quantum-computing.ibm.com/) and as such I was provided an access token under my account settings page. As a part of my research I would like to be able to interact with the api to submit jobs, check device status, list all devices I have access to etc., using any programming language of my choice.

+ +

Unfortunately, I have been having a lot of difficulty interacting with this API due in part to not being able to find any documentation on the API endpoints, how to authenticate with the API etc. Additionally some of the information that I have found appears to be out of date or missing details. For instance, through my own investigations with monitoring network traffic on the quantum experience homepage I have discovered that the API url appears to have changed from https://quantumexperience.ng.bluemix.net/api/ to https://api.quantum-computing.ibm.com/api.

+ +

Does anyone have any documentation related to what endpoints are available and what data they return from the API, as well as how to properly authenticate with the API as this would be a great help.

+ +

Additionally, my research will involve accurate timing of how long quantum programs take to run. Is there any information either returned from the API jobs, such as the time taken to run the program or in device specifications with average times for gates, measurements, and if statements, so I can at least estimate a total time for my programs?

+",9713,,,,,6/21/2020 9:26,IBM Quantum Experience API Without QISKit,,2,0,,,,CC BY-SA 4.0 +9429,2,,9428,1/6/2020 0:33,,1,,"

So Qiskit (qiskit.org) already does everything you are looking for. If you need to access the API directly then the IBMQ account connector (https://github.com/Qiskit/qiskit-ibmq-provider) is a good starting point in lieu of formal documentation.

+",332,,,,,1/6/2020 0:33,,,,0,,,,CC BY-SA 4.0 +9430,2,,9425,1/6/2020 4:48,,1,,"

For a single qubit that's in a pure state (no decoherence) the probability that the state is somewhere on the surface of the sphere is 1. You don't need to measure this.

+ +

If you're going to do a POVM to learn a bit of information about the state, you have to choose an axis of measurement, and you will only gain information about the qubit with respect to that axis. This means that you can learn about $\theta$ or $\phi$, but not both.

+ +

Many measurements along different axes will give you full information about the qubit, but that involves more than one POVM. Look up ""state tomography"".

+",1867,,,,,1/6/2020 4:48,,,,0,,,,CC BY-SA 4.0 +9431,1,9446,,1/6/2020 6:09,,3,214,"

I have always wanted to do something with computers since I was 2. I have explored all kinds of things in the tech world for a long time. I have also loved physics for a long time. Someone recently suggested that I explore Quantum Computing. I had heard about it a lot beforehand and always thought it sounded fun. I don't really know where to start because I don't know anyone in the field. Does anyone know what the best way is I can start in the field?

+",9720,,26,,1/7/2020 12:57,1/20/2020 4:55,What is the best way to get into and learn quantum computing for a 14 year old?,,2,7,,,,CC BY-SA 4.0 +9432,1,9438,,1/6/2020 6:46,,7,1516,"

To implement a stabilizer code I need to measure stabilizer generators, as shown in Fig. 10.16 in Nielsen & Chuang. Is there a way for controlled multiqubit gates in qiskit? +

+",9275,,1859,,9/19/2020 9:44,9/19/2020 17:48,How to implement controlled multiqubit gates in qiskit?,,2,0,,,,CC BY-SA 4.0 +9433,2,,9421,1/6/2020 7:47,,5,,"

Assuming you've got Toffoli and single-qubit rotations, you can implement the following: +

+ +

This basically works because if either of the controls is not $|1\rangle$, the Toffoli does nothing and the two single-qubit unitaries cancel each other. Whereas, if both controls are $|1\rangle$, then the net gate on the target qubit is +$$ +(\cos\frac{\pi}{8}I+i\sin\frac{\pi}{8}Y)X(\cos\frac{\pi}{8}I-i\sin\frac{\pi}{8}Y)=X(\cos\frac{\pi}{4}I-i\sin\frac{\pi}{4}Y)=\frac{X+Z}{\sqrt2}=H. +$$

+",1837,,,,,1/6/2020 7:47,,,,0,,,,CC BY-SA 4.0 +9435,2,,9425,1/6/2020 10:48,,1,,"

I find the wording and notation of the question you've been given a bit odd. I think you've taken the correct strategy, and the factor of $4\pi$ in the question doesn't make any sense to me either. I guess it should just be a 2.

+",1837,,,,,1/6/2020 10:48,,,,5,,,,CC BY-SA 4.0 +9436,1,9437,,1/6/2020 10:58,,2,63,"

A generalized measurement can be defined as follow:

+ +

It is a set of operators $\{M_m \}$ such that, given an initial quantum state $|\psi\rangle$, we have the state after measurement being:

+ +

$$|\psi\rangle \rightarrow \frac{M_m |\psi\rangle}{\langle \psi | M_m^{\dagger}M_m |\psi\rangle} $$

+ +

The probability to find the outcome $m$ is: $p(m)=\langle \psi | M_m^{\dagger}M_m |\psi\rangle$

+ +

We can interpret the generalized measurement as entanglement unitary between a system and an ancillary system, and then a measurement on this ancillary system via the following:

+ +

$$U |\psi \rangle |0 \rangle = \sum_m M_m |\psi \rangle |m \rangle$$

+ +

My question is: how to prove that this $U$ is indeed a unitary ? I guess we also have to define its action on other states than $|0\rangle$ in the ancillary system, but how to do it ?

+",5008,,,,,1/10/2020 15:44,Generalized measurement interpreted as entanglement unitary + measurement. Why is it indeed a unitary?,,2,0,,,,CC BY-SA 4.0 +9437,2,,9436,1/6/2020 11:07,,2,,"

It is not necessary to define the action of $U$ on other states. It is sufficient to know that the defined action is compatible with being a unitary (i.e. inner produces are preserved between all inputs) because there always exists an extension of the defined action such that it is unitary. So, all you really have to check is that +$$ +\left(\langle\psi|\langle 0|\right)\left(|\phi\rangle|0\rangle\right)=\left(\langle\psi|\langle 0|U^\dagger\right)\left(U|\phi\rangle|0\rangle\right)=\sum_n\langle\psi|M_n^\dagger\langle n|\sum_mM_m|\phi\rangle|m\rangle. +$$ +The right-hand side simplifies to +$$ +\sum_m\langle\psi|M_m^\dagger M_m|\phi\rangle=\langle\psi|\phi\rangle +$$ +thanks to the completeness relation. This is all you need. Of course, it can be a useful exercise, for a specific case, to find the extension.

+",1837,,,,,1/6/2020 11:07,,,,3,,,,CC BY-SA 4.0 +9438,2,,9432,1/6/2020 13:37,,3,,"

A general controlled unitary

+ +

Let $CU$ denote the 'controlled' version of the $n$-qubit unitary $U$:

+ +

\begin{equation} +CU = |0\rangle\langle0|\otimes I_{t} + |1\rangle\langle1|\otimes U_{t}, +\end{equation}

+ +

where the operation acts on a Hilbert space $\mathcal{H}_{c}\otimes \mathcal{H}_{t}$, with $c$ denoting the control qubit and $t$ denoting the target qubits (in your case, the data qubits). I have added a subscript $t$ in the equation as well to indicate this subsystem.

+ +

Normally, to implement $CU$ one needs to compile it to the gateset used by the platform on which it is implemented. Qiskit generally uses only two-qubit multi-qubit gates, so higher-dimensional gates need to be compiled. See for instance this previous question or the paper referred to in an answer there.

+ +

Shortcut for stabilizer readout

+ +

However, there is a shortcut for the unitary you describe: we can write $U = U_{i}^{\otimes n}$, where each $U_{i}$ is a single-qubit unitary (In your case, all $U_{i}$ are either $X$ or $I$); we can always write the unitary like this when concerning stabilizer codes.

+ +

Now we can rewrite $CU$ as: +\begin{equation} +CU = \prod_{i \in n}|0\rangle\langle 0| \otimes I_{i} + |1\rangle\langle 1| \otimes U_{i}. +\end{equation}

+ +

That is to say, we can replace the entire multi-qubit controlled unitary by the succession of controlled version of all individual $U_{i}$'s.

+ +

That means for you that you can apply a controlled $X$ (or $I$) operation to every different data qubit, from your ancilla. Of course the controlled $I$ operation need not be actually performed.

+ +

Implementation on physical hardware

+ +

Note that this is easier said than done on an actual physical platform: you are then strongly limited by the connectivity between the various qubits on the chip. Steane's code has weight-four stabilizers, meaning that you need to connect one qubit (the ancilla) to 4 data qubits; moreover this needs to be done for multiple subsets of the data qubits. This is a very strong requirement and there are not many physical chips (if any) where you can actually perform this.

+ +

A planar implementation of the Steane code can be found in the picture in box 1 on page 3 of this paper; each of the $3$ faces is a stabilizer (e.g. an ancilla qubit), so the drawn vertices are in fact not actual connections between qubits.

+ +

Sidenote on implementing stabilizer error correction on current-gen hardware

+ +

As a sidenote, also please realize that when performing physical implementation, you will not be able to implement error correction, as you won't have quick enough access to the measurement outcomes of the stabilizer-ancilla measurements which give you the error measurement. That is, the binary-controlled (i.e. controlled by a classical bit - the measurement outcome) used in the error correction process will probably not be possible.

+",8141,,8141,,1/10/2020 15:51,1/10/2020 15:51,,,,0,,,,CC BY-SA 4.0 +9439,1,,,1/6/2020 14:04,,5,197,"

I read about some QEC codes such as Shor code. It encodes a logical qubit to 9 physical qubits, to correct the bit-flip and phase-flip error. To do this, it needs multiple $\mathrm{CNOT}$ and $\mathrm{H}$ gates. As we know, the increase of the number of operations brings errors. How can this procedure then decrease the overall error rate?

+",9105,,26,,1/6/2020 16:30,1/6/2020 16:30,Why does quantum error correction work?,,2,0,,,,CC BY-SA 4.0 +9440,2,,9439,1/6/2020 14:13,,5,,"

Quantum error correction concerns errors that happen on qubits; it does not provide any protection against errors in operations on those qubits.

+ +

Note however, that an error on an operation can be seen as the perfect operation plus some error 'on the qubit'. It is, however, the case that, without any precaution, the added operations introduced by error correction invoke many more extra errors than that the code might be able to correct. This is indeed a very though issue.

+ +

The answer is, in short, what is collectively known as fault-tolerance. This is essentially taking much, much effort to implement all operations included in error correction in such a way that the extra errors that might arise during this operation do not pile up, thereby exceeding the error correction capabilities of the code.

+ +

It has been proven that, taking enough precaution, one can correct errors quicker than they arise: The threshold theorem. Note that fault-tolerance requires very much resources (qubits and operations). Fault-tolerance is quite tough, but for an idea behind it see the second half of the introduction by Gottesman.

+",8141,,,,,1/6/2020 14:13,,,,2,,,,CC BY-SA 4.0 +9441,2,,9439,1/6/2020 15:37,,-5,,"

It was my understanding that error-correction does not really apply to quantum computing. The elements in the set are not numbers, they are probabilities. Probability elements are never in one state or another. They are always in all states. That is the beauty of quantum computing.

+",9414,,,,,1/6/2020 15:37,,,,6,,,,CC BY-SA 4.0 +9442,1,9464,,1/6/2020 16:37,,7,499,"

I am reading Fowler et al's paper on the surface code.. I do not understand how to initialize a logical qubit in an arbitrary state with the surface code. I do understand how to initialize the qubit in logical $|{0}\rangle$ and $|{1}\rangle$, but not how to initialize in an arbitrary superposition.

+ +

In Appendix B he shows that after the measurements in the circuit below,

+ +

+ +

the middle two qubits are in the one of the following four states:

+ +

+Can they also be in a superposition of one of these states?

+",9282,,9282,,1/6/2020 17:38,1/9/2020 1:35,Logical qubit initialization for the surface code,,3,0,,,,CC BY-SA 4.0 +9443,1,9453,,1/6/2020 16:43,,5,663,"

I know the definition of projective measurement, generalized measurement, POVM.

+ +

I understand the usage of generalized measurement for the reason that it can model experiments ""easier"" (for example measurement of a photon that will be destructive so that measuring again the state just after the first measurement will give me another answer).

+ +

However, I am still kinda confused by why we have introduced the notion of P.O.V.M. For me we have everything we want from generalized & projective measurement.

+ +
+ +

Would you agree with me if I say that POVM is just an axiomatic way to define statistics of measurement. There is nothing much to understand/overthink.

+ +

In the sense, we ask the minimal mathematical properties that our measurement operator must fullfil with respect to statistical behavior which is:

+ +
    +
  • they are semidefinite positive (to have positive probabilities)
  • +
  • they sum up to identity (to have probability summing up to $1$)
  • +
+ +

and we relate our measurement operator with the physics:

+ +

$$p(m)=\mathrm{Tr}(E_m \rho)$$ where $m$ is the outcome, $E_m$ the associated POVM.

+",5008,,55,,8/22/2020 7:57,10/5/2021 15:40,Why are POVMs useful? Are they just an axiomatic way to define measurement?,,3,1,,,,CC BY-SA 4.0 +9444,1,9447,,1/6/2020 17:12,,5,290,"

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 first $Ry$ gate and $\theta = -\frac{\pi}{4}$ for second one.

+ +

However, when I put $\mathrm{CH}$ gate implemented on IBM Q to circuit, a transpiled circuit has this form: +

+ +

So, the first circuit has only two one qubit gates whereas the second one has six such gates. If I understand it correctly, any single qubit gate is on IBM Q eventually replaced by $\mathrm{U3}$ gate with respective parameters.

+ +

It seems to me that the second circuit is unnecessary complex.

+ +

Is there any reason why to implement $\mathrm{CH}$ gate in such way or am I missing something?

+",9006,,26,,1/7/2020 19:07,1/11/2020 13:43,Why is implementation of controlled Hadamard on IBM Q so complex?,,1,6,,,,CC BY-SA 4.0 +9445,2,,9442,1/6/2020 17:36,,1,,"

You can initialize a qubit to any arbitrary state by gate $U3$ (abbreviation used on IBM Q):

+ +

$$ +U3(\theta,\phi,\lambda)= +\begin{pmatrix} +\cos(\theta/2) & -\mathrm{e}^{i\lambda} \sin(\theta/2) \\ +\mathrm{e}^{i\phi}\sin(\theta/2) & \mathrm{e}^{i(\lambda+\phi)} \cos(\theta/2) +\end{pmatrix} +$$

+ +

It is also possible to prepare any multi-qubit quantum state by a method described in this paper: Transformation of Quantum States Using Uniformly Controlled Rotations.

+ +

In your case, the arbitrary states is probably that generated by Hadamard gate $H$.

+ +

Regarding measurement in your circuit: If the measurement is done in z-basis, the only four possibilites are those you listed in your question. Yes, qubits can be in superposition but after measurement, they end up in one of four combination of $|0\rangle$ and $|1\rangle$.

+",9006,,,,,1/6/2020 17:36,,,,0,,,,CC BY-SA 4.0 +9446,2,,9431,1/6/2020 17:44,,4,,"

I would recommend getting started by looking at the Qiskit website. There is a textbook which starts from the beginning to get you up to speed with quantum computing and programming quantum computers. There are also tutorials and videos to help with learning Qiskit.

+ +

Additionally, there are many online courses, but some may require a high level on linear algebra. I have found that there are many great videos to help on YouTube, maybe start with some of the videos here.

+",5955,,,,,1/6/2020 17:44,,,,0,,,,CC BY-SA 4.0 +9447,2,,9444,1/6/2020 19:04,,4,,"

Summarization based on discussion with user met927:

+ +
    +
  • Transpiled circuit form depends on used backend - it is different for simulator and real quantum processor: + +
      +
    • On simulator, the $\mathrm{CH}$ gate is transpiled to the circuit shown above
    • +
    • On real quantum processor, the gate is implemented with two $\mathrm{U2}$ gates and $\mathrm{CNOT}$ (i.e. like in the first figure in the answer)
    • +
  • +
+ +

Overall, the $\mathrm{CH}$ gate implementation on IBM Quantum is efficient.

+",9006,,5955,,1/11/2020 13:43,1/11/2020 13:43,,,,0,,,,CC BY-SA 4.0 +9448,2,,9370,1/6/2020 23:00,,1,,"

The $(-1)^{x\cdot y}$ terms come from the matrix elements of $H^{\otimes n}$.

+ +

To see this, start from considering the matrix elements of $H$. You can check that they can be written as $H_{ij}=(-1)^{ij}$ where $i,j\in\{0,1\}$.

+ +

The matrix elements of $H^{\otimes n}$ are indexed by tuples of $n$ binary numbers, that is, writing $I\equiv (i_1,...,i_n), J\equiv(j_1,...,j_n)$, we have +$$(H^{\otimes n})_{IJ} = \prod_{k=1}^n H_{i_k ,j_k} = \prod_{k=1}^n (-1)^{i_k j_k} = (-1)^{\sum_{k=1}^n i_k j_k} \simeq (-1)^{\boldsymbol i\cdot\boldsymbol j},$$ +where in the last step we used the same notation as in the OP.

+ +

Note that I'm ignoring the normalisation factors here, so just add back the $1/2^{n/2}$ factors around as needed.

+",55,,,,,1/6/2020 23:00,,,,0,,,,CC BY-SA 4.0 +9449,1,,,1/7/2020 3:11,,3,323,"

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 my another question). This code has four stabilizer generators $XZZXI$, $IXZZX$, $XIXZZ$, $ZXIXZ$.

+

The following is a minimal working example in which I only draw the stabilizer generator $IXZZX$,

+
from qiskit import *
+
+
+encoded = QuantumRegister(5,'encoded')
+stab = QuantumRegister(4,'stab')
+syndr = ClassicalRegister(4, 'syndr')
+five = QuantumCircuit(encoded)
+fiveS = QuantumCircuit(encoded, stab, syndr)
+
+#----------------------------------encode----------------------------------
+five.h(encoded[0])
+five.h(encoded[1])
+five.h(encoded[2])
+five.h(encoded[3])
+
+
+five.z(encoded[0])
+five.z(encoded[3])
+
+five.cz(encoded[0],encoded[1])
+five.cz(encoded[0],encoded[3])
+five.cy(encoded[0],encoded[4])
+
+five.cz(encoded[1],encoded[2])
+five.cz(encoded[1],encoded[3])
+five.cx(encoded[1],encoded[4])
+
+five.cz(encoded[2],encoded[0])
+five.cz(encoded[2],encoded[1])
+five.cx(encoded[2],encoded[4])
+
+five.cz(encoded[3],encoded[0])
+five.cz(encoded[3],encoded[2])
+five.cy(encoded[3],encoded[4])
+
+five.barrier()
+
+#-------------------stabilizer generator IXZZX------------------------------
+fiveS.h(stab[1])
+fiveS.cx(stab[1],encoded[1])
+fiveS.cz(stab[1],encoded[2])
+fiveS.cz(stab[1],encoded[3])
+fiveS.cx(stab[1],encoded[4])
+fiveS.h(stab[1])
+
+fiveS.measure(stab,syndr)
+
+#----------------circuit visualization--------------------
+#%matplotlib inline
+#(five+fiveS).draw(output='mpl')
+
+counts = execute( five+fiveS, Aer.get_backend('qasm_simulator'), shots=10000).result().get_counts()
+print(counts)
+
+

Measuring stabilizer generators should return $0000$ but instead I get half $0000$ and half $0010$ (Same results returns when measuring $XIXZZ$, $ZXIXZ$). Where am I wrong?

+
+

Question updated

+

I tried to add all qubits in one quantum register and produce one quantum circuit.

+
from qiskit import *
+
+
+stab = QuantumRegister(9,'stab')
+syndr = ClassicalRegister(4, 'syndr')
+five = QuantumCircuit(stab, syndr)
+
+#----------------------------------encode----------------------------------
+five.h(stab[0])
+five.h(stab[1])
+five.h(stab[2])
+five.h(stab[3])
+
+
+five.z(stab[0])
+five.z(stab[3])
+
+five.cz(stab[0],stab[1])
+five.cz(stab[0],stab[3])
+five.cy(stab[0],stab[4])
+
+five.cz(stab[1],stab[2])
+five.cz(stab[1],stab[3])
+five.cx(stab[1],stab[4])
+
+five.cz(stab[2],stab[0])
+five.cz(stab[2],stab[1])
+five.cx(stab[2],stab[4])
+
+five.cz(stab[3],stab[0])
+five.cz(stab[3],stab[2])
+five.cy(stab[3],stab[4])
+
+five.barrier()
+
+#-------------------stabilizer generator IXZZX------------------------------
+five.h(stab[6])
+five.cx(stab[6],stab[1])
+five.cz(stab[6],stab[2])
+five.cz(stab[6],stab[3])
+five.cx(stab[6],stab[4])
+five.h(stab[6])
+
+five.measure(stab[5],syndr[0])
+five.measure(stab[6],syndr[1])
+five.measure(stab[7],syndr[2])
+five.measure(stab[8],syndr[3])
+
+#----------------circuit visualization--------------------
+#%matplotlib inline
+#five.draw(output='mpl')
+
+counts = execute( five, Aer.get_backend('qasm_simulator'), shots=10000).result().get_counts()
+print(counts)
+
+

However, the same happens. The following are my running results.

+",9275,,-1,,6/18/2020 8:31,10/11/2020 21:38,"Simulation for the [5,1,3] stabilizer code in Qiskit",,0,4,,,,CC BY-SA 4.0 +9450,2,,9413,1/7/2020 5:44,,3,,"

According to comment provided by user gIS, there was no progress in implementing qRAM as proposed in the paper.

+ +

However, some additional information on qRAM physical implementation can be found on this forum here.

+",9006,,26,,1/9/2020 2:21,1/9/2020 2:21,,,,0,,,,CC BY-SA 4.0 +9452,2,,9337,1/7/2020 7:39,,2,,"
+

First of all, are the ancilla qubits entangled with $|\psi\rangle$?

+
+ +

Yes, depending on what the state is. Let's say you started with +$$ +\alpha|000\rangle+\beta|111\rangle, +$$ +but it has experienced an error of $(\cos\theta I+i\sin\theta X)$ on the first qubit. So, your state becomes +$$ +\cos\theta(\alpha|000\rangle+\beta|111\rangle)+i\sin\theta(\alpha|100\rangle+\beta|011\rangle). +$$ +When you perform syndrome extraction, you'll get +$$ +\cos\theta(\alpha|000\rangle+\beta|111\rangle)|00\rangle+i\sin\theta(\alpha|100\rangle+\beta|011\rangle)|11\rangle. +$$ +This state has entanglement between the computational qubits register and the ancilla register.

+ +

Of course, in the next step, you measure the ancilla qubits, and that projects the ancilla qubits into a basis state, removing all entanglement between system and ancillas.

+ +
+

How can I perform such operation using a matrix?

+
+ +

As for what the matrix is, I strongly recommend against performing such calculations. Once you're up to 5 qubits, you're talking a $32\times 32$ matrix, which is fairly awful. It is far better to just talk about the action on (relevant) basis states, as you did. However, since you have explicitly asked:

+ +

I calculated this in Mathematica using

+ +
cNOT[i_, j_] := 
+ IdentityMatrix[32] + 
+  KroneckerProduct[IdentityMatrix[2^(i - 1)], {{0, 0}, {0, 1}}, 
+   IdentityMatrix[2^(j - i - 1)], {{-1, 1}, {1, -1}}, 
+   IdentityMatrix[2^(5 - j)]]
+TeXForm[cNOT[1, 4].cNOT[1, 5].cNOT[2, 4].cNOT[3, 5]]
+
+ +

(the first 3 qubits are the system qubits, and qubits 4&5 are the ancillas) giving the answer +$$ +\left( +\begin{array}{cccccccccccccccccccccccccccccccc} + 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ +\end{array} +\right) +$$

+ +

We can then verify the calculation that I showed before:

+ +
initial = {\[Alpha], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
+   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \[Beta], 0, 0, 0};
+witherror = 
+ KroneckerProduct[{{Cos[\[Theta]], I Sin[\[Theta]]}, {I Sin[\[Theta]],
+      Cos[\[Theta]]}}, IdentityMatrix[2^4]].initial
+U.witherror
+
+",1837,,,,,1/7/2020 7:39,,,,6,,,,CC BY-SA 4.0 +9453,2,,9443,1/7/2020 7:59,,3,,"

For me, generalised measurements cover everything (obviously, that's why they're generalised), with projective measurements being a simple case that covers what we usually want to be doing.

+ +

So, yes, why introduce POVMs which are basically the generalised measurements but without the output state? Because they describe what actually happens in some experiments. If you're using optics, for example, where measurement of a photon is destructive, i.e. you do not have the photon afterwards, the POVMs perfectly describe what's going on.

+ +

What I think is a reasonable follow-up question is why so many courses/texts etc put as much weight as they do on POVMs. I believe that the reason is simply that, when performing many quantum information protocols, we don't care about the state after measurement, we only care about the probabilities of the different outcomes. For example, if you're trying to identify what state you have, you only care about which measurement result you get, not the final state. Then it's a mathematical convenience that you're dealing with $E_i$ instead of having to calculate $M_i^\dagger M_i$ first.

+",1837,,,,,1/7/2020 7:59,,,,8,,,,CC BY-SA 4.0 +9454,2,,9421,1/7/2020 9:30,,3,,"

A brute force solution :). You can also obtain CCH via qiskit's basic gates with help of get_controlled_circuit method.

+ +
from qiskit import *
+from qiskit.aqua.utils.controlled_circuit import get_controlled_circuit
+
+q_reg = QuantumRegister(3, 'q')
+qc_h = QuantumCircuit(q_reg)
+qc_ch = QuantumCircuit(q_reg)
+qc_cch = QuantumCircuit(q_reg)
+
+qc_h.h(q_reg[0])
+
+qc_ch += get_controlled_circuit(qc_h, q_reg[1])
+
+qc_cch += get_controlled_circuit(qc_ch, q_reg[2])
+
+print(qc_cch.qasm())
+
+ +

Note that it may be not the optimal gate set for representing the $CCH$ gate, because get_controlled_circuit, how I understand, doesn't optimize the obtained gate set. Also, just info, $H = u2(0, \pi)$, where $u2$ is one of the basis gates of qiskit:

+ +

$$ +u2(\phi, \lambda) = \frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & -e^{i \lambda} \\ +e^{i\phi} & e^{i(\phi + \lambda)} +\end{pmatrix} +$$

+",9459,,,,,1/7/2020 9:30,,,,0,,,,CC BY-SA 4.0 +9455,1,9460,,1/7/2020 13:00,,3,241,"

I originally posted this question on the Physics StackExchange site (see here), but I realized it would be better suited on this one.

+ +

I'm trying to understand the diagrams used in the following paper. I'm new to the area so I don't have experience with the stabilizer formalism, but I'm trying to figure out what's going on in the diagrams (Figures 1 and 2, specifically). I have a few specific questions:

+ +
    +
  1. Each vertex has a physical data qubit. But what exactly do the operators (green circles) represent? Is there an X and Z operator on every vertex site, or only some of them (Figure 1b)?

  2. +
  3. Relatedly, the logical X and Z operators are specified as chains of single-qubit operators (the green circles, I presume) connecting top to bottom (logical X) or left to right (logical Z). Do these chains have to be straight lines, or can they twist and turn?

  4. +
  5. Do the semi-circular plaquettes (which have only two single-qubit operators on them) represent the fact that we are wrapping around the surface (so we are on a torus), or is it something else?

  6. +
  7. I don't understand the single-qubit Pauli flips described in Figure 2. I can't see how we get an error (red dot). Any explanation for this would be helpful.

  8. +
+ +

If someone could also explain to me the relationship between the Figure 1 in the above paper and Figure 1 of this paper, I think it would help makes things clearer.

+",1923,,,,,1/8/2020 8:11,Understanding surface code diagrams,,1,0,,,,CC BY-SA 4.0 +9456,1,,,1/7/2020 17:07,,1,62,"

The descriptions of the BICONF information reconciliation protocol in the literature appear to be inconsistent.

+ +

All descriptions agree that in each iteration Alice and Bob should select a random subset of bits of the key, that Alice should tell Bob what the correct parity of the chosen subset is, and that Bob should run BINARY on the selected subset if the correct parity differs from the current parity.

+ +

However, some descriptions (e.g. [2], [3]) explicitly say that Bob should also run BINARY on the complementary bits subset if the parity differs on the chosen bits subset.

+ +

Other descriptions (e.g. [4], [5]) only mention running BINARY on the chosen bits subset and never mention running BINARY on the complementary bits subset.

+ +

My questions are:

+ +
    +
  1. Should I or should I not also run BINARY on the complementary bits subset? In other words, which of the two conflicting descriptions is correct?

  2. +
  3. If yes, it appears necessary that Alice must also reveal the correct parity of the complementary bits subset (*). The fact that the chosen bits subset contains an odd number of errors says nothing about the number of errors in the complementary bits subset. The number of errors in the complementary bits subset could very well be zero, in which case it is not correct for Bob to run BINARY on the complementary bits subset. Is my understanding correct that more parities will need to be revealed?

  4. +
  5. I would like to consult the original paper where BICONF was introduced, which is apparently [1], to see what it says. Is there an online PDF version for this available (I could not find any)?

  6. +
+ +

(*) = Or alternatively, we can infer the correct parity of the complementary subset from the correct parity of the entire key, which in turn can be inferred from the correct parities of all the top-level blocks in the earlier Cascade iterations.

+ +

References:

+ +

[1] Tomohiro Sugimoto and Kouichi Yamazaki. A study on secret key reconciliation protocol ""cascade"". IEICE Transactions on Fundamentals of Electronics, Communications and Computer Sciences, E83-A(10), 2000.

+ +

[2] JesusMartinez-Mateo,ChristophPacher,MomtchilPeev,AlexCiurana,andVicenteMartin. Demystifying the Information Reconciliation Protocol Cascade. arXiv:1407.3257 [quant-ph], Jul 2014. https://arxiv.org/pdf/1407.3257.pdf Section 3.2 page 8: Then, they compute and exchange the parity value of this subset, and perform two dichotomic searches if their parities differ, one for the chosen subset and the other for the complementary subset (i.e., the subset of bits that were not selected).

+ +

[3] André Reis. Quantum Key Distribution Post Processing - A study on the Information Reconciliation Cascade Protocol, July 2019. https://repositorio-aberto.up.pt/bitstream/10216/121965/2/347567.pdf Section 3.1.2 page 16: If the parity of Bob’s subset is different, they execute BINARY once for the chosen subset and another for the complementary subset.

+ +

[4] Gilles Brassard and Louis Salvail. Secret-Key Reconciliation by Public Discussion. In Advances in Cryptology — EUROCRYPT ’93, pages 410–423. Springer Berlin Heidelberg, Berlin, Heidelberg, 1993. https://link.springer.com/content/pdf/10.1007%2F3-540-48285-7_35.pdf Section 6.2 page 418: Each time CONFIRM shows a subset for which Alice’s and Bob’s string have different parities they run BINARY on this subset and thus correct an error.

+ +

[5] Shengli Liu. Information-Theoretic Secret Key Agreement, Feb 2002. https://pure.tue.nl/ws/files/1977072/200210541.pdf. Section 2.3.1 page 22: Then Alice tells Bob the parity of her subset, and Bob checks whether his subset has the same parity. The primitive ends in case of identical parity, otherwise a binary search is performed to locate an error.

+",4733,,26,,1/8/2020 15:43,1/8/2020 15:43,In the BICONF information reconciliation protocol for QKD: should I also run BINARY on the complementary bits subset?,,0,0,,,,CC BY-SA 4.0 +9457,2,,9365,1/7/2020 17:24,,3,,"

Consider some simpler cases, $(j,j+1)$ for general $j$. Then you can do you want with plugging in $j=i$, $j=i+1$, $j=i+3$ and $j=i+4$ and concatenating the circuits appropriately and then simplifying.

+ +

So how to do $(j,j+1)$? That is conjugate to $(0,1)$, so just consider that for now.

+ +

$(0,1)$ would be NOT but controlled on making sure all the higher places are $0$.

+ +

The conjugation that takes you between $(0,1)$ and $(j,j+1)$ is the circuit that does addition of $j$ modulo $2^{w+1}$. Reduce that to addition of $1$ modulo $2^{w+1}$ repeated.

+ +

So that decomposes your desired operation into a bunch of other computational basis to computational basis transformations. Construct the circuits for those, concatenate them all together in the specified order and then pass the resulting circuit through an optimizer.

+ +

Write down something that works even if it is inefficient first, then you can look for simplifications until you come up with something better. That might be more general advice as well.

+",434,,,,,1/7/2020 17:24,,,,0,,,,CC BY-SA 4.0 +9458,1,9459,,1/7/2020 23:27,,3,175,"

I've upgraded qiskit for the first time in a while and I've discovered that the magic function for displaying backend information doesn't seem to work properly.

+ +

Here's what I've tried running:

+ +
from qiskit.tools.jupyter import *
+backend = P[1].get_backend('ibmq_poughkeepsie')
+%qiskit_backend_overview
+
+ +

This returns a ZeroDivisionError.

+ +

I've also tried calling backend_monitor(backend), but returns a TypeError, saying that 'module' object is not callable.

+ +

I've tried looking into what kind of changes might have been made to the library for monitoring backends, but I cannot seem to find the answer I'm looking for. Any help would be much appreciated!

+",7666,,16606,,6/3/2022 10:58,6/3/2022 10:58,Is qiskit_backend_monitor magic function deprecated?,,1,0,,,,CC BY-SA 4.0 +9459,2,,9458,1/8/2020 0:32,,6,,"

The %qiskit_backend_overview magic is not deprecated and has seen updates for the most recent 0.11.0 release: https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/tools/jupyter/backend_overview.py to ensure it works with new devices. The ZeroDivisionError might point to a bug in the code for the function or in your calling code, without a full traceback and all code you're running it's hard to know for sure.

+ +

I did test it with the latest version qiskit 0.14.1 locally and it still works fine for me:

+ +

+ +

As for backend monitor that also looks fine to me (it doesn't need a magic anymore as the html representation in jupyter for an ibmq backend object is formatted the same way since the qiskit-terra 0.9.0 release):

+ +

+ +

If the graphical jupyter backends aren't working for you for whatever reason there are always the python functions from qiskit.tools that do the same thing just without any of the graphical output. For example:

+ +

+",5529,,,,,1/8/2020 0:32,,,,0,,,,CC BY-SA 4.0 +9460,2,,9455,1/8/2020 8:11,,4,,"
+

Each vertex has a physical data qubit. But what exactly do the operators (green circles) represent? Is there an X and Z operator on every vertex site, or only some of them (Figure 1b)?

+
+ +

The circles on, e.g. the bottom-left of Fig. 1, show you how to describe each of the stabilizers. So, for every mustard yellow square in the top-left diagram, there is a stabilizer comprising a tensor product of 4 $Z$s, acting on the 4 vertices that that square touches. Similarly for the cyan squares with $X$ operators. So, every vertex in the bulk of the system is touched by 4 stabilizers, 2 with $Z$s and 2 with $X$s. On the edge, some of those squares are replaced by lines, i.e. pairs of terms.

+ +
+

Relatedly, the logical X and Z operators are specified as chains of single-qubit operators (the green circles, I presume) connecting top to bottom (logical X) or left to right (logical Z). Do these chains have to be straight lines, or can they twist and turn?

+
+ +

They can twist and turn. Logical $X$ is any continuous line of Pauli-$X$s going from top to bottom, with arbitrary twists and turns. Similarly for $Z$s going from left to right.

+ +
+

Do the semi-circular plaquettes (which have only two single-qubit operators on them) represent the fact that we are wrapping around the surface (so we are on a torus), or is it something else?

+
+ +

No. This is the surface code, not the Toric code. The surface code is the same as the Toric code but with open (rather than periodic) boundary conditions. The stabilizers have to be changed. So, the stabilizers act on pairs of qubits. Again, this is explicitly given in the bottom-left panel. The only reason for making them semi-circles is to that there;s a fill colour. If you just depicted it as a line, you wouldn't be able to colour it, and therefore wouldn't be able to tell what type it was.

+ +
+

I don't understand the single-qubit Pauli flips described in Figure 2. I can't see how we get an error (red dot). Any explanation for this would be helpful.

+
+ +

The red dots simply describe which stabilizers anti-commute with a given sequence of operations (the letters in green circles). So, if I act an $X$ operation on a single qubit, that commutes with all the $X$-type stabilizers. It commutes with all the $Z$-type stabilizers that do not act on that site. However, it anti-commutes with the two $Z$-type stabilizers which touch that site. So, they put a red dot on the corresponding two mustard yellow squares.

+ +

When you do multiple operations, red dots add up modulo 2. So, if I do two $X$ operations on neighbouring vertices, I still only have two red dots (rather than 4) because two act on the same yellow square, and cancel (Basically because $XX$ commutes with $ZZZZ$ if the two $X$s act on two of the sites that $Z$s act on)

+ +
+

If someone could also explain to me the relationship between the Figure 1 in the above paper and Figure 1 of this paper, I think it would help makes things clearer.

+
+ +

In the second paper, ignore the black circles. The yellow + shapes in that paper correspond to the cyan squares, and the green + shapes correspond to the mustard yellow squares. However, I don't think the correspondence is exact. I think (without having spent a long time carefully checking) that the two lattices are rotated by $45^{\circ}$ relative to each other, and that lets them have different boundary terms.

+",1837,,,,,1/8/2020 8:11,,,,4,,,,CC BY-SA 4.0 +9461,2,,9442,1/8/2020 15:28,,2,,"

I've not read the cited paper, so I don't know how this corresponds to anything that they say, but one way that I would think about it is, if I have an unknown qubit state stored on a single qubit, how do I copy this onto a surface code already initialised in logical 0?

+ +

Now, if it weren't logical qubits, we can easily write down a circuit that would accomplish this (left-hand circuit, which has output $|0\rangle|\psi\rangle$). If we express this in terms of Pauli operators (middle circuit), we can replace these with logical operators (right-hand circuit). It is this right-hand circuit that I would implement. +

+",1837,,,,,1/8/2020 15:28,,,,0,,,,CC BY-SA 4.0 +9462,1,,,1/8/2020 16:54,,1,88,"

I have problem to simplify the quantum system states on bloch sphere to get $\theta$, $\phi$ values, +My question is not duplicated! +$$ +\left| \varphi \right>=\frac{1+i}{\sqrt{3}} \left| 0 \right> + {\sqrt{\frac{1}{3}}} \left| 1\right> +$$

+",9715,,26,,1/9/2020 2:02,1/9/2020 2:02,"Simplify the system to find the $\theta$, $\phi$ on bloch sphere",,0,6,,1/8/2020 17:28,,CC BY-SA 4.0 +9463,1,9465,,1/8/2020 18:50,,4,155,"

Suppose that we have one-qubit unitary $U$ that maps +$$ \left| 0 \right> \longmapsto \frac{1}{\sqrt{2}} \left| 0 \right> + {\frac{1+i}{2}} \left| 1\right> $$ +and +$$ \left| 1 \right> \longmapsto {\frac{1-i}{2}} \left| 0 \right> - \frac{1}{\sqrt{2}} \left| 1\right> $$ +What is $U$?

+",9700,,55,,1/9/2020 11:14,1/10/2020 9:44,What unitary gate produces these quantum states from the computational basis?,,2,1,,,,CC BY-SA 4.0 +9464,2,,9442,1/8/2020 19:06,,7,,"

For $|0\rangle$, $|1\rangle$, $|+\rangle$, and $|-\rangle$ you do transversal initialization (initialize all physical qubits to the desired state, then turn on the stabilizers).

+ +

For $|i\rangle$ and $|-i\rangle$ you do topological initialization using twists.

+ +

For $T|+\rangle$ states and other states with nice state distillation protocols, you do noisy low code distance initialization followed by distillation at high code distances. Basically, just prepare a physical qubit into the desired state, pretend it's a surface code qubit with code distance one, and increase its code distance while hoping nothing went wrong. Then use a distillation procedure to ensure that nothing went wrong. Read A magic state's fidelity can be superior to the operations that created it and Efficient magic state factories with a catalyzed |CCZ> to 2|T> transformation for the state of the art.

+ +

For other single qubit states, you approximate them using a series of operations. Read Efficient synthesis of universal Repeat-Until-Success circuits + for the state of the art.

+",119,,119,,1/9/2020 1:35,1/9/2020 1:35,,,,0,,,,CC BY-SA 4.0 +9465,2,,9463,1/8/2020 19:29,,7,,"

Firstly simply rewrite probability amplitudes of returned states as columns of a matrix: +$$ +U = +\begin{pmatrix} +\frac{1}{\sqrt{2}} & \frac{1-i}{2} \\ +\frac{1+i}{2} & -\frac{1}{\sqrt{2}} +\end{pmatrix} +$$ +Now do some algebra +$$ +U = \frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & \frac{1-i}{\sqrt{2}} \\ +\frac{1+i}{\sqrt{2}} & -1 +\end{pmatrix} += +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & \mathrm{e}^{-i\frac{\pi}{4}} \\ +\mathrm{e}^{i\frac{\pi}{4}} & -1 +\end{pmatrix} +$$

+ +

There is a quantum gate called $\mathrm{U2}$: +$$ +\mathrm{U2}(\phi,\lambda)= +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & -\mathrm{e}^{i\lambda} \\ +\mathrm{e}^{i\phi} & \mathrm{e}^{i(\phi+\lambda)} +\end{pmatrix} +$$

+ +

Setting $\phi=\frac{\pi}{4}$ and $\lambda = \frac{3}{4}\pi$ you have a resut since $\phi+\lambda =\pi$, so $\mathrm{e}^{i(\phi+\lambda)} = \mathrm{e}^{i\pi} = -1$ and $-\mathrm{e}^{i\lambda}=-\mathrm{e}^{i\frac{3}{4}\pi} = -\frac{-1+i}{\sqrt{2}}$.

+ +

Conclusion: $U=\mathrm{U2}\big(\frac{\pi}{4},\frac{3}{4}\pi\big)$

+",9006,,,,,1/8/2020 19:29,,,,1,,,,CC BY-SA 4.0 +9466,1,9467,,1/8/2020 20:09,,0,1894,"

In last time there is a lot of questions how to find $\theta$ and $\phi$ for particular state on Bloch sphere. I think that it would be useful to solve one example to stop stream of very similar questions.

+ +

So my question is how to find $\theta$ and $\phi$ on Bloch sphere? +Please demonstrate calculation on this quantum state: +$$ +\left| \varphi \right>=\frac{1+i}{\sqrt{3}} \left| 0 \right> + {\sqrt{\frac{1}{3}}} \left| 1\right> +$$

+ +

Note to moderators and other users: please do not mark this question as duplicity but rather use it for closing similar questions on Bloch sphere coordinates calculation. It seems that explanation on particular example is asked rather than theoretical method how to solve such problems.

+",9006,,55,,1/9/2020 0:32,1/9/2020 5:49,Find coordinates $\theta$ and $\phi$ on the Bloch sphere of a given qubit state,,1,0,,1/9/2020 11:23,,CC BY-SA 4.0 +9467,2,,9466,1/8/2020 20:09,,0,,"

Generally, a quantum state can be expressed in this form:

+ +

$$ +|\varphi\rangle = \cos\frac{\theta}{2}|0\rangle + \mathrm{e}^{i\phi}\sin\frac{\theta}{2}|1\rangle +$$ +Where $\theta$ and $\phi$ are coordinates on Bloch sphere.

+ +

Regarding the particular state in question, we firstly have to get rid of complex amplitude before $|0\rangle$ to have only real number here. We can do that by multiplying whole state by so-called global phase. This multiplication does not change the state as two states which differ in global phase are identical. You can for example check probabilities of $|0\rangle$ and $|1\rangle$ after multiplication. They remain same (for the state in question probability of measuring $|0\rangle$ and $|1\rangle$ in z-basis is $\frac{2}{3}$ and $\frac{1}{3}$, respectively).

+ +

Mathematically, the global phase is a complex number with absolute value 1.

+ +

In our paritucar case I multiplied $|\varphi\rangle$ with $\frac{1-i}{\sqrt{2}} = \mathrm{e}^{-\frac{\pi}{4}}$ (hence global phase is $-\frac{\pi}{4}$).

+ +

The result is

+ +

$$ +\left| \varphi \right>={\sqrt{\frac{2}{3}}} \left| 0 \right> + \frac{1-i}{\sqrt{2}}\frac{1}{\sqrt{3}} \left| 1\right> +$$

+ +

Since $\frac{1-i}{\sqrt{2}} = \mathrm{e}^{-i\frac{\pi}{4}}$, apparently $\phi = -\frac{\pi}{4}$.

+ +

Theta can be calculated from $\cos\frac{\theta}{2} = \sqrt{\frac{2}{3}}$. Hence

+ +

$$ +\theta = 2\arccos\sqrt{\frac{2}{3}} = 1.2310. +$$

+ +

We can verify $\theta$ with sine

+ +

$$ +\theta = 2\arcsin\sqrt{\frac{1}{3}} = 1.2310. +$$

+ +

Conclusion: $\theta = 1.2310$ and $\phi = -\frac{\pi}{4}$.

+ +

Another numerical example on Bloch sphere coordinates

+",9006,,9006,,1/9/2020 5:49,1/9/2020 5:49,,,,2,,,,CC BY-SA 4.0 +9468,2,,9335,1/9/2020 0:24,,3,,"

Yes, any state can always be described as a coherent superposition of some other set of states. ""Being in a superposition"" is not a property of just a quantum state, but rather a property of a quantum state relative to some basis. It doesn't make sense to talk of a superposition if not relative to a basis. We often don't explicitly specify this basis simply because it's usually obvious from the context which one is it.

+",55,,,,,1/9/2020 0:24,,,,0,,,,CC BY-SA 4.0 +9469,1,9482,,1/9/2020 2:19,,2,172,"

I'm looking into this paper from DiCarlo's group Scalable quantum circuit and control for a superconducting surface code. I don't understand how it's supposed to identify specific single-qubit errors, specifically how it tells apart single qubit X or Z errors on the data qubits belonging only to one of the weight-4 syndromes.

+ +

Does it? Maybe that's not even required, if it really isn't, why?

+",9740,,9006,,1/9/2020 5:52,1/10/2020 13:40,How does Surface-17 tell apart Z errors on Db and Dc?,,2,0,,,,CC BY-SA 4.0 +9471,1,,,1/9/2020 7:30,,3,576,"

I am using Qiskit.

+ +

I made two quantum circuits to generate $\cos\theta|00\rangle + \sin\theta|00\rangle$ for VQE calculations as follows. +

+ +

+ +

Apparently, the first one which has fewer CNOT gates is better ansatz for calculations. However, I would like to evaluate the efficiency of these circuits qualitatively.

+ +

Run time or something?

+ +

Thank you.

+",8673,,8673,,1/12/2020 4:09,10/10/2020 16:35,What is a better ansatz for VQE?,,1,1,,,,CC BY-SA 4.0 +9472,2,,9469,1/9/2020 7:51,,1,,"

Distinguishing $X$ and $Z$ errors is easy. $X$ errors anti-commute with the $Z$-type stabilizers, and so when you perform a measurement of those parity checks, you get and answer '1'. Similarly, $Z$ errors give you a '1' answer only on the $X$-type parity checks.

+ +

Also, note that, in the bulk (i.e. not on the edges), you never get a '1' on only one weight-4 parity check syndrome. They always come in pairs. You can never identify exactly what error happened (although you might make a good guess) but that doesn't prevent you from correcting the error. That's the whole point of a topological system. If a single $X$ error occurred somewhere, you don't have to apply the same $X$ to correct for it. Any sequence of $X$ operations that creates a closed loop on the lattice (without going off the edge) will also correct the error (and could equally have been an error sequence that gave the same syndrome).

+",1837,,,,,1/9/2020 7:51,,,,2,,,,CC BY-SA 4.0 +9474,2,,9404,1/9/2020 11:21,,5,,"

In last time there is a lot of questions how to find $\theta$ and $\phi$ for this particular state on Bloch sphere: $$ +\left| \varphi \right>=\frac{1+i}{\sqrt{3}} \left| 0 \right> + {\sqrt{\frac{1}{3}}} \left| 1\right> +$$

+ +

I will try to demonstrate how to do so in more details in comparison with previous answer.

+ +

Generally, a quantum state can be expressed in this form:

+ +

$$ +|\varphi\rangle = \cos\frac{\theta}{2}|0\rangle + \mathrm{e}^{i\phi}\sin\frac{\theta}{2}|1\rangle +$$ +Where $\theta$ and $\phi$ are coordinates on Bloch sphere.

+ +

Regarding the particular state in question, we firstly have to get rid of complex amplitude before $|0\rangle$ to have only real number here. We can do that by multiplying whole state by so-called global phase. This multiplication does not change the state as two states which differ in global phase are identical. You can for example check probabilities of $|0\rangle$ and $|1\rangle$ after multiplication. They remain same (for the state in question probability of measuring $|0\rangle$ and $|1\rangle$ in z-basis is $\frac{2}{3}$ and $\frac{1}{3}$, respectively).

+ +

Mathematically, the global phase is a complex number with absolute value 1.

+ +

In our paritucar case I multiplied $|\varphi\rangle$ with $\frac{1-i}{\sqrt{2}} = \mathrm{e}^{-\frac{\pi}{4}}$ (hence global phase is $-\frac{\pi}{4}$).

+ +

The result is

+ +

$$ +\left| \varphi \right>={\sqrt{\frac{2}{3}}} \left| 0 \right> + \frac{1-i}{\sqrt{2}}\frac{1}{\sqrt{3}} \left| 1\right> +$$

+ +

Since $\frac{1-i}{\sqrt{2}} = \mathrm{e}^{-i\frac{\pi}{4}}$, apparently $\phi = -\frac{\pi}{4}$.

+ +

Theta can be calculated from $\cos\frac{\theta}{2} = \sqrt{\frac{2}{3}}$. Hence

+ +

$$ +\theta = 2\arccos\sqrt{\frac{2}{3}} = 1.2310. +$$

+ +

We can verify $\theta$ with sine

+ +

$$ +\theta = 2\arcsin\sqrt{\frac{1}{3}} = 1.2310. +$$

+ +

Conclusion: $\theta = 1.2310$ and $\phi = -\frac{\pi}{4}$.

+",9006,,,,,1/9/2020 11:21,,,,0,,,,CC BY-SA 4.0 +9475,1,9476,,1/9/2020 16:25,,-3,47,"

I have two vectors: +$$ +a=\begin{pmatrix} +{1} & {1} & {1} \ +\end{pmatrix} \\ +b=\begin{pmatrix} +{1} & {2} & {k} \ +\end{pmatrix} +$$ +These vectors should be orthogonal. What is value of $k$?

+",9715,,55,,11/10/2020 17:36,11/10/2020 17:36,What value of K parameter of the following two vectors?,,1,2,,1/10/2020 18:30,,CC BY-SA 4.0 +9476,2,,9475,1/9/2020 16:26,,2,,"

$$ +\left\langle a| b \right\rangle= +\begin{pmatrix} +{1} & {1} & {1} \ +\end{pmatrix} +\begin{pmatrix} +{1} & {2} & {k} \ +\end{pmatrix} +$$ +Since the two vectors are orthogonal,so the inner product of them is zero: +$$ +0=1+2+k \\ +k=-3 +$$

+",9700,,,,,1/9/2020 16:26,,,,1,,,,CC BY-SA 4.0 +9477,1,9499,,1/9/2020 18:13,,2,161,"

I'm making my way through several neural network examples and libraries. Landing on this nugget, in creating a basic NN for character recognition.

+ +

In calculating weights and biases, looking at the graph below, looks oddly familiar in one of the quantum-related problems to solve - minimizing cost functions and finding local minimums.

+ +

Is there an equivalent quantum NN for this and are there examples I can begin working with?

+ +

My interest here is in how a parallel quantum system can be more efficient with training data over its non-quantum counterpart.

+ +

+",9744,,,,,1/12/2020 13:38,"Is there a quantum neural network ""hello world"" for character recognition (convolutional neural networks)?",,1,4,,,,CC BY-SA 4.0 +9478,1,,,1/10/2020 2:37,,2,57,"

I tried installing Forest openfermion by +pip install forestopenfermion and I got the following long error message (cut):

+ +
Building wheels for collected packages: scipy
+  Building wheel for scipy (setup.py) ... error
+  ERROR: Command errored out with exit status 1:
+   command: /Users/michelle/anaconda/envs/py3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '""'""'/private/var/folders/jl/jdqt56zx7nl6czhgp8qhdwd40000gn/T/pip-install-7odaoj4r/scipy/setup.py'""'""'; __file__='""'""'/private/var/folders/jl/jdqt56zx7nl6czhgp8qhdwd40000gn/T/pip-install-7odaoj4r/scipy/setup.py'""'""';f=getattr(tokenize, '""'""'open'""'""', open)(__file__);code=f.read().replace('""'""'\r\n'""'""', '""'""'\n'""'""');f.close();exec(compile(code, __file__, '""'""'exec'""'""'))' bdist_wheel -d /private/var/folders/jl/jdqt56zx7nl6czhgp8qhdwd40000gn/T/pip-wheel-8zcv76y9 --python-tag cp37
+       cwd: /private/var/folders/jl/jdqt56zx7nl6czhgp8qhdwd40000gn/T/pip-install-7odaoj4r/scipy/
+  Complete output (1015 lines):
+  lapack_opt_info:
+  lapack_mkl_info:
+  customize UnixCCompiler
+    FOUND:
+      libraries = ['mkl_rt', 'pthread']
+      library_dirs = ['/Users/michelle/anaconda/envs/py3/lib']
+      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
+      include_dirs = ['/Users/michelle/anaconda/envs/py3/include']
+
+    FOUND:
+      libraries = ['mkl_rt', 'pthread']
+      library_dirs = ['/Users/michelle/anaconda/envs/py3/lib']
+      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
+      include_dirs = ['/Users/michelle/anaconda/envs/py3/include']
+
+  Running from scipy source directory.
+  non-existing path in 'scipy/integrate': 'quadpack.h'
+  Splitting linalg.interpolative Fortran source files
+  blas_opt_info:
+  blas_mkl_info:
+  customize UnixCCompiler
+    FOUND:
+      libraries = ['mkl_rt', 'pthread']
+      library_dirs = ['/Users/michelle/anaconda/envs/py3/lib']
+      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
+      include_dirs = ['/Users/michelle/anaconda/envs/py3/include']
+
+    FOUND:
+      libraries = ['mkl_rt', 'pthread']
+      library_dirs = ['/Users/michelle/anaconda/envs/py3/lib']
+      define_macros = [('SCIPY_MKL_H', None), ('HAVE_CBLAS', None)]
+      include_dirs = ['/Users/michelle/anaconda/envs/py3/include']
+
+  non-existing path in 'scipy/sparse': 'sparsetools/sparsetools_impl.h'
+  non-existing path in 'scipy/sparse': 'sparsetools/bsr_impl.h'
+  non-existing path in 'scipy/sparse': 'sparsetools/csc_impl.h'
+  non-existing path in 'scipy/sparse': 'sparsetools/csr_impl.h'
+  non-existing path in 'scipy/sparse': 'sparsetools/other_impl.h'
+  running bdist_wheel
+  running build
+  running config_cc
+  unifing config_cc, config, build_clib, build_ext, build commands --compiler options
+  running config_fc
+  unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
+  running build_src
+  build_src
+  building py_modules sources
+  creating build
+  creating build/src.macosx-10.9-x86_64-3.7
+  creating build/src.macosx-10.9-x86_64-3.7/scipy
+  building library ""dfftpack"" sources
+  building library ""fftpack"" sources
+  building library ""mach"" sources
+  building library ""quadpack"" sources
+  building library ""odepack"" sources
+  building library ""dop"" sources
+  building library ""fitpack"" sources
+  building library ""fwrappers"" sources
+  building library ""odrpack"" sources
+  building library ""minpack"" sources
+  building library ""rootfind"" sources
+  building library ""superlu_src"" sources
+  building library ""arpack_scipy"" sources
+  building library ""sc_c_misc"" sources
+  building library ""sc_cephes"" sources
+  building library ""sc_mach"" sources
+  building library ""sc_amos"" sources
+  building library ""sc_cdf"" sources
+  building library ""sc_specfun"" sources
+  building library ""statlib"" sources
+  building extension ""scipy.cluster._vq"" sources
+  building extension ""scipy.cluster._hierarchy"" sources
+  building extension ""scipy.fftpack._fftpack"" sources
+  creating build/src.macosx-10.9-x86_64-3.7/scipy/fftpack
+  creating build/src.macosx-10.9-x86_64-3.7/scipy/fftpack/src
+  conv_template:> build/src.macosx-10.9-x86_64-3.7/scipy/fftpack/src/dct.c
+  conv_template:> build/src.macosx-10.9-x86_64-3.7/scipy/fftpack/src/dst.c
+  f2py options: []
+  f2py: scipy/fftpack/fftpack.pyf
+  Reading fortran codes...
+    Reading file 'scipy/fftpack/fftpack.pyf' (format:free)
+  Line #86 in scipy/fftpack/fftpack.pyf:""       /* Single precision version */ ""
+    crackline:2: No pattern for line
+  Post-processing...
+
+ +

And so on... Could somebody help me? Thanks!

+",9749,,23,,2/2/2020 9:28,2/2/2020 9:28,Error during Forest openfermion installation,,0,1,,,,CC BY-SA 4.0 +9479,1,9480,,1/10/2020 7:33,,4,317,"

I noticed that in page 427 in Nielsen & Chuang's book Quantum Computation and Quantum Information, quantum error correction is possible because errors can be discretized.

+ +

In other hand, the master equation in the Lindblad form in the following seems describes errors continuously occurring on qubits,

+ +

$\frac{d\rho}{dt}=-i[H,\rho]+\frac{1}{2}\sum_{j}\lambda_j(2L_j\rho L_j^\dagger-L_j^\dagger L_j\rho-\rho L_j^\dagger L_j)$.

+ +
+ +

I want to say that ""errors can be discretized"" is one of the basis that ""quantum error correction is possible"". But then I found errors described by the master equation can also be corrected and these errors seems like continuous errors to me.

+ +

My question is if the bold sentence is wrong or the errors described by the master equation are actually discrete errors?

+",9275,,9006,,1/10/2020 14:12,1/10/2020 14:12,"What kind of errors does the master equation in the Lindblad form describe, continuous errors or discrete errors?",,1,0,,,,CC BY-SA 4.0 +9480,2,,9479,1/10/2020 7:59,,6,,"

The errors that are described by the Master equation are continuous errors. The action of error correction is to discretize those errors.

+ +

For example, dephasing noise can be described by the Master equation. The net effect is that an initial state $\rho$ is transformed into +$$ +\rho\mapsto (1-p)\rho+pZ\rho Z, +$$ +where $p$ is a function of time.

+ +

However, imagine that you are protecting against such errors by using a majority vote in the $X$ basis. We encode as: +$$ +|\psi\rangle=\alpha|+++\rangle+\beta|---\rangle +$$ +so $\rho=|\psi\rangle\langle \psi|$. Under dephasing noise, this continuously transforms. However, at the moment that you choose to do error correction, you introduce ancillas, perform the syndrome extraction and measurement. At the moment you get the measurement result, you know whether you have, for example, $\rho$ or $Z_1\rho Z_1$ etc. So, it has been discretized and you only have to think about Pauli errors.

+",1837,,,,,1/10/2020 7:59,,,,2,,,,CC BY-SA 4.0 +9481,2,,9463,1/10/2020 8:12,,4,,"

Just to expand on the detail of why writing out the columns works:

+ +

Start by writing the action of the unitary: +\begin{align*} +U|0\rangle=\frac{1}{\sqrt{2}}|0\rangle+\frac{1+i}{2}|1\rangle \\ +U|1\rangle=\frac{1-i}{2}|0\rangle-\frac{1}{\sqrt{2}}|1\rangle +\end{align*} +Before proceeding, it's always worth checking that both sides are correctly normalised. In this case, they are.

+ +

Now take the inner product of each equation with $\langle 0|$: +$$ +\langle 0|U|0\rangle=\frac{1}{\sqrt{2}}\qquad\langle 0|U|1\rangle=\frac{1-i}{2} +$$ +Similarly, using $\langle 1|$, you get +$$ +\langle 1|U|0\rangle=\frac{1+i}{2}\qquad\langle 1|U|1\rangle=-\frac{1}{\sqrt{2}}. +$$ +So, these identify all four matrix elements, which you can just insert: +$$ +U=\left(\begin{array}{cc} +\frac{1}{\sqrt{2}} & \frac{1-i}{2} \\ \frac{1+i}{2} & -\frac{1}{\sqrt{2}} +\end{array}\right). +$$ +(I should say that I always get muddled between the two off-diagonal elements. So I have to stop and think about, for example, $\langle 0|U|1\rangle$, and which element is selected by doing the inner product $\left(\begin{array}{cc}1 & 0\end{array}\right)U\left(\begin{array}{c} 0 \\ 1 \end{array}\right)$: top row, right-hand column.)

+ +

Don't forget to check that your answer is reasonable by verifying $UU^\dagger=I$.

+",1837,,9006,,1/10/2020 9:44,1/10/2020 9:44,,,,0,,,,CC BY-SA 4.0 +9482,2,,9469,1/10/2020 13:40,,0,,"

I have added the layout from the paper.

+ +

A Z error on Db will fire Xb and Xa. A Z error on Dc will fire Xa. +Thus these two are distinguishable.

+ +

If a X error occurs on Dc this will fire Zb. This can be corrected by applying X on Dc.

+ +

If a X error occurs on Db this will also fire Zb. It is also corrected by applying X on Dc. At the end Db and Dc have been flipped, this does not change the logical state, because X-Db X-Dc is one of the stabilizers. This stabilizer is measured by Xa. Remember that applying a stabilizer is the same as applying the identity gate.

+ +

+",9282,,,,,1/10/2020 13:40,,,,0,,,,CC BY-SA 4.0 +9483,2,,9436,1/10/2020 15:44,,1,,"

A matrix/operator is unitary if and only if it sends orthonormal bases into orthonormal bases.

+ +

Therefore, to check whether $U$ is unitary, it is enough to check that it sends a subset of a basis (i.e. a non-complete set of orthonormal vectors) into a set of orthonormal vectors. In the present case, this means to prove that orthonormal states in the first space are sent into orthonormal states into the larger space. Once this is proved, you can just extend the operation to one that acts unitarily on the rest of the space. You might notice that there are multiple (infinite) ways to do this.

+ +

For example, say $U$ acts on a two-qubit system as $U|00\rangle=|00\rangle$ and $U|10\rangle=|11\rangle$. +This does not mean that $U$ is unitary, but it does mean that it can trivially be made into a unitary. You just need to define its action of the rest of the space (here $|01\rangle$ and $|11\rangle$) so that the overall action is unitary. A trivial way to do it here can be $U|01\rangle=|01\rangle$ and $U|11\rangle=|10\rangle$.

+",55,,,,,1/10/2020 15:44,,,,0,,,,CC BY-SA 4.0 +9484,1,9545,,1/10/2020 21:46,,2,350,"

Happened on some code, which I was hoping would run out of the box. However fails on the import

+ +
from qiskit.aqua.translators.ising import max_cut
+
+ +

I've not been able to find the module in the documentation. Any ideas how to solve this? Other then use an earlier version of Qiskit?

+ +

I get the following error:

+ +
from qiskit.aqua.translators.ising import max_cut
+ModuleNotFoundError: No module named 'qiskit.aqua.translators'
+
+",7439,,7439,,1/10/2020 22:12,1/15/2020 4:58,max_cut in qiskit aqua,,1,2,,,,CC BY-SA 4.0 +9485,1,9486,,1/10/2020 22:15,,3,332,"

I'm trying to solve a problem. I have my own approach to it, as the one in the textbook seems overly complicated. I tried using my own approach, but I'm not sure if what I found was a coincidence or not.

+ +

Here's the problem (it's in French, I did my best to translate):

+ +
+

Alice and Bob are separated by a distance of $2L$. Suppose that Charlie is in the middle, i.e. he's at a distance $L$ from Alice and at a distance $L$ from Bob. Charlie produces two entangled pairs in the state $\left| B_{00} \right>_{12}$ and $\left| B_{00} \right>_{34}$. Therefore, there are 4 bits called $1,2,3,4$. Charlie keeps in his lab the particles $2$ and $3$ and sends particles $1$ and $4$ to Alice and Bob. Now, Charlie makes a measure in the Bell basis on particles $2$ and $3$ that he kept in his lab. Which are the possible results (with probabilities) of the measure in Charlie's Lab?

+
+ +

Here's my approach

+ +

Before the measure, we know that the initial state is : $$\left| \psi \right> = \left| B_{00} \right>_{12} \otimes \left| B_{00} \right>_{34}$$ $$=\frac{1}{2} \left( \left| 0 \right>_{1} \otimes \left| 00 \right>_{23} \otimes \left| 0 \right>_{4} + \left| 0 \right>_{1} \otimes \left| 01 \right>_{23} \otimes \left| 1 \right>_{4} + \left| 1 \right>_{1} \otimes \left| 10 \right>_{23} \otimes \left| 0 \right>_{4} + \left| 1 \right>_{1} \otimes \left| 11 \right>_{23} \otimes \left| 1 \right>_{4} \right)$$

+ +

Now, given that I know that $$\left| 00 \right>_{23} = \frac{1}{\sqrt{2}}(\left| B_{00} \right>_{23} + \left| B_{10} \right>_{23})$$, $$\left| 01 \right>_{23} = \frac{1}{\sqrt{2}}(\left| B_{01} \right>_{23} + \left| B_{11} \right>_{23})$$, and so on for the rest. I was able to rewrite the initial state as follows (although I'm not sure I can do this, given that I'm not sure I can do this):$$ \left| \psi \right> =\frac{1}{2\sqrt{2}} \left| B_{00} \right>_{23} \otimes (\left| 00 \right>_{14} + \left| 11 \right>_{14}) + \frac{1}{2\sqrt{2}} \left| B_{10} \right>_{23} \otimes (\left| 00 \right>_{14} - \left| 11 \right>_{14}) + \frac{1}{2\sqrt{2}} \left| B_{01} \right>_{23} \otimes (\left| 01 \right>_{14} + \left| 10 \right>_{14}) + \frac{1}{2\sqrt{2}} \left| B_{11} \right>_{23} \otimes (\left| 01 \right>_{14} - \left| 10 \right>_{14})$$ which reduces to: $$\left| \psi \right> =\frac{1}{2} \left| B_{00} \right>_{23} \otimes \left| B_{00} \right>_{14} + \frac{1}{2} \left| B_{01} \right>_{23} \otimes \left| B_{01} \right>_{14} + \frac{1}{2} \left| B_{10} \right>_{23} \otimes \left| B_{10} \right>_{14} + \frac{1}{2} \left| B_{11} \right>_{23} \otimes \left| B_{11} \right>_{14}$$

+ +

So, each state in each term of the sum is a possible state in Charlie's Lab after the measurement. In other words, measurements states are: $\left| B_{00} \right>_{23} \otimes \left| B_{00} \right>_{14}$ $\left| B_{01} \right>_{23} \otimes \left| B_{01} \right>_{14}$ $\left| B_{10} \right>_{23} \otimes \left| B_{10} \right>_{14}$ $\frac{1}{2} \left| B_{11} \right>_{23} \otimes \left| B_{11} \right>_{14}$

+ +

Therefore, the probability of measuring each state is $p=\frac{1}{4}$. I found this without using Born's rule. I used the fact that in another state, such as $\left| \phi \right>=\alpha\left| 0 \right> + \beta\left| 1 \right>$, the probability of measuring $\left| 0 \right>$ is $|\alpha|^2$(and the idea is the same for $\left| 1 \right>$). I used this fact, but I'm not sure why I would be allowed to do this. Now that I'm writing this question, I realize that perhaps, given that the states after the measure form a basis for our space, writing the initial state as a sum of basis vectors, I am allowed to do this. Would you say that I'm correct?

+",9407,,55,,7/27/2020 12:27,7/27/2020 12:27,Problem involving entanglement swapping,,2,1,,,,CC BY-SA 4.0 +9486,2,,9485,1/11/2020 6:35,,1,,"

Judging from your computations, the Bell states are +$$|B_{00}\rangle = |\Phi^+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$$ +$$|B_{10}\rangle = |\Phi^-\rangle = \frac{1}{\sqrt{2}}(|00\rangle - |11\rangle)$$ +$$|B_{01}\rangle = |\Psi^+\rangle = \frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$$ +$$|B_{11}\rangle = |\Psi^-\rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$$ +I don't like changing order of qubits in tensor products, but it does affect the final result which I believe is correct: Charlie measurement outcomes are equally likely, and more: after the measurement Charlie knows the Bell state which is shared by Alice and Bob.

+",2105,,2105,,1/11/2020 6:40,1/11/2020 6:40,,,,2,,,,CC BY-SA 4.0 +9487,1,,,1/11/2020 9:07,,1,196,"

In A New Quantum Inspired Genetic Algorithma a lookup table is used to decide the Qubit rotation. But how the lookup table is used is not briefed.

+

Does anyone know how it is done ?

+

An example is shown below.

+
+

$\delta\theta$ is chosen equal to $\pi/25$. The following table gives the value of the rotation angle in function of $\alpha, \beta$ and the bit's value in the best solution.

+

$$\text{Table 1. Lookup table of the rotation angle}$$ +$$\begin{array} {|c|c|c|c|}\hline \boldsymbol\alpha & \boldsymbol\beta & \textbf{Reference bit value} & \textbf{Angle} \\ \hline >0 & >0 & 1 & +\delta\theta \\ \hline >0 & >0 & 0 & -\delta\theta \\ \hline >0 & <0 & 1 & -\delta\theta \\ \hline >0 & <0 & 0 & +\delta\theta \\ \hline <0 & >0 & 1 & -\delta\theta \\ \hline <0 & >0 & 0 & +\delta\theta \\ \hline <0 & <0 & 1 & +\delta\theta \\ \hline <0 & <0 & 0 & -\delta\theta \\ \hline \end{array}$$

+
+",9759,,23,,8/25/2020 16:38,8/25/2020 16:38,How to read a Qubit rotation lookup table?,,0,3,,,,CC BY-SA 4.0 +9488,2,,9485,1/11/2020 9:08,,1,,"

If you are interested only in the measurements of the system that comprises only 2nd and 3rd qubits, then you could compute the reduced density matrix $\rho_{23}$ on those qubits from the total density matrix $\rho_{1234}=|\psi\rangle \langle\psi|$, i.e. +$$ +\rho_{23} = \text{Tr}_{14}(\rho_{1234}) +$$ +Density matrix carry all information that is need to predict measurements outcomes.
+Since in this case $$\rho_{23} = \frac{1}{4}I$$ +the Bell measurement outcomes must be equiprobable.

+ +

To compute partial trace $\text{Tr}_{14}(\rho_{1234})$ note that the state $\rho_{1234}$ is disentangled relative to the decomposition $H_{12} \otimes H_{34}$, i.e. $\rho_{1234} = \rho_{12} \otimes \rho_{34}$. +So it must be +$$\text{Tr}_{14}(\rho_{1234}) = \text{Tr}_{14}(\rho_{12} \otimes \rho_{34}) = \text{Tr}_{1}(\rho_{12}) \otimes \text{Tr}_{4}(\rho_{34}) = \frac{1}{2}I\otimes\frac{1}{2}I = \frac{1}{4}I$$ +Though, of course, partial trace could be computed directly.

+ +

As for your approach, it is correct, and also answers the question in what state qubits 1 and 4 will be after the Bell measurement of 2 and 3.

+",5870,,5870,,1/11/2020 10:47,1/11/2020 10:47,,,,0,,,,CC BY-SA 4.0 +9490,1,,,1/11/2020 14:09,,2,70,"

I'm learning quantum error correction by myself and I want to know the relation between block codes and surface codes.

+ +

I find that many researchers in the field of coding theory are exploring quantum block codes with better parameters, like constructing quantum codes from various classical codes.

+ +

In other hand, I find that surface codes are popular in recent papers.

+ +
+ +

My questions are

+ +
    +
  1. Which one are more promising in quantum error correction? and further in constructing fault-tolerant quantum computers?
  2. +
  3. How many ancilla qubits are needed now approximataly for a computable logical qubit?
  4. +
+",9275,,,,,1/13/2020 9:13,"Block codes with better parameters vs. surface codes, which need less ancilla qubits?",,1,0,,,,CC BY-SA 4.0 +9491,1,9492,,1/11/2020 15:21,,1,151,"

Is it possible to get the $\alpha$ and $\beta$ (amplitudes) of a qubit in Qiskit, i.e. not only probabilities after measurement but complete quantum state?

+",9759,,9006,,1/11/2020 15:40,1/11/2020 16:00,Is it possible to get the $\alpha$ and $\beta$ (amplitudes) of a qubit in Qiskit?,,1,2,,,,CC BY-SA 4.0 +9492,2,,9491,1/11/2020 16:00,,4,,"

This can be done using the statevector_simulator provided with Qiskit Aer. It will return the statevector that describes the quantum state at the end of your circuit. It can be used in the same way as the qasm_simulator, only your circuit shouldn't have measurement gates at the end. There is more information about this simulator in this tutorial.

+",5955,,,,,1/11/2020 16:00,,,,1,,,,CC BY-SA 4.0 +9493,1,,,1/11/2020 18:54,,3,164,"

Suppose there is a Q# operation as follows:

+ +
operation Op () : Bool {
+
+    let result = CSharpMethod ();
+    return result
+}
+
+ +

where CSharpMethod () is a defined method in the Driver class as follows:

+ + + +
public static bool CSharpMethod () {
+    // ...
+    // return a boolean value
+}
+
+ +

So my question is how to call a method of a C# class inside a Q# operation and handle its returned value?

+ +

Thanks.

+",8487,,,,,1/11/2020 20:22,How to invoke a C# method inside a Q# operation?,,1,0,,,,CC BY-SA 4.0 +9494,2,,9493,1/11/2020 20:22,,3,,"

Q# operations are compiled into C# classes. To define a C# implementation for a Q# operation, you will need to do the following steps:

+ +
    +
  1. Define a Q# operation with empty or intrinsic body CSharpMethod.
  2. +
  3. Define a C# class that implements the abstract class into which your Q# operation gets compiled, something like public class CSharpMethod_Impl : CSharpMethod.
  4. +
  5. Define method called Body in that class that does the actual computation that you need and returns the result.
  6. +
+ +

This is a very hacky thing to do, so you might want to follow an example of operation GetOracleCallsCount and its C# implementation to see the exact pieces that have to be in place for it to work.

+ +

You can also see this question on StackOverflow that tries to do a similar thing.

+",2879,,,,,1/11/2020 20:22,,,,2,,,,CC BY-SA 4.0 +9495,1,9498,,1/11/2020 23:10,,1,296,"

I studied the OPENQASM 2.0 spec a few times but failed to find a way to include my own libraries. Have I missed anything?

+ +

Right now, the only way is to use include ""qelib1.inc"" mechanism to separate the library from my own code. When the circuit starts to grow, there is a real need to group various components to different files. How can that be achieved without contaminating the qelib1.inc?

+",9768,,9006,,1/12/2020 7:27,1/12/2020 11:53,OPENQASM: How to include my own libraries,,1,2,0,,,CC BY-SA 4.0 +9496,1,,,1/12/2020 0:55,,2,102,"

In C# it is possible to have:

+ + + +
public void Fun (int n = 0){
+    // ...
+}
+
+ +

then the following method call examples will be compiled:

+ +
    +
  • Fun()
  • +
  • Fun(10)
  • +
+ +

So I wonder whether or not such a useful facility is available in creating Q# operations with optional parameters?

+",8487,,,,,1/14/2020 21:02,Is it possible to create a Q# operation with optional parameters?,,2,1,,,,CC BY-SA 4.0 +9497,2,,9496,1/12/2020 1:40,,2,,"

Not at the moment. As of version 0.10, Q# doesn't support optional parameters, and it does not allow to define two operations with the same name that would only differ by the list of parameters (which would be a different way to do the same thing).

+",2879,,,,,1/12/2020 1:40,,,,0,,,,CC BY-SA 4.0 +9498,2,,9495,1/12/2020 11:53,,2,,"

According to the openqasm spec the include statement will insert the contents of the files with the name relative to the current working directory:

+ +

https://github.com/Qiskit/openqasm/blob/master/spec/qasm2.rst#language

+ +

If you're using qiskit-terra as your parser this should work unless you name the local file ""qelib1.inc"". The parser included in the qiskit-terra parser uses the cwd unless the filename is present in the libs dir (the only current one being qelib1.inc: https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/qasm/qasmlexer.py#L131-L163 If you're using openqasm with another parser that parser should implement the same behavior (for example see: https://github.com/libtangle/qasm-rust/blob/master/src/lib.rs#L188-L244 for how it's implemented in qasm-rust).

+",5529,,,,,1/12/2020 11:53,,,,2,,,,CC BY-SA 4.0 +9499,2,,9477,1/12/2020 13:38,,1,,"

I don't think a hello world really exists here. You can have different points of view or goals here. I will give references.

+ +

The first one is speeding up parts of the algorithm with a quantum version (here is an example reference). But here, we assume a perfect hardware.

+ +

Another one is to apply it to quantum many-body systems. The interesting point here is to have less parameters/weights to work on your problem.

+ +

The last one is to apply with quantum circuits that could be run on near-term devices. One way to do so would be to process the data amenable to a realistic-size on a quantum computer, using transfer leaning for instance, and apply a parameterized quantum circuit where its input correspond to the output of a classical NN. For this one, there exists an implementation here.

+",4127,,,,,1/12/2020 13:38,,,,0,,,,CC BY-SA 4.0 +9500,1,9505,,1/12/2020 14:24,,-3,1067,"

I refer to A DIY Guide to Building a Quantum Computer and Researchers advance noise cancelling for quantum computers.

+ +

With my friends, I would like to build our simplified quantum computer.

+ +

We are also keen to reduce the noise, so my question: is there some quick and easy way to reduce noise?

+",166,,9006,,1/12/2020 17:59,1/19/2020 7:29,Building a DIY quantum computer - how to reduce a noise?,,2,3,,,,CC BY-SA 4.0 +9502,1,9503,,1/12/2020 16:41,,2,81,"

I have experimented a bit with Grover's Algorithm, and I wanted to search for the states $|00\rangle$ and $|10\rangle$. I tried making a Quantum Circuit, which looks like the one below, but measuring the superposition 1 024 times only gives me all states with equal probability. Any way I could alter the approach?

+ +

+",9633,,9006,,1/12/2020 18:05,1/12/2020 18:21,Negating amplitude in amplitude amplification when second qubit is 0 not working,,1,0,,,,CC BY-SA 4.0 +9503,2,,9502,1/12/2020 18:14,,2,,"

It seems that there is a missing $\mathrm{X}$ and $\mathrm{H}$ gates on qubit $q_2$. I used this Grover algoritm shape:

+ +

+ +

Note 1: controlled $\mathrm{Z}$ is replaced by $\mathrm{CNOT}$ and Hadamards on both sides.

+ +

Note 2: put your Oracle instead of dashed line.

+ +

Note 3: you do not have to measure $q_2$.

+",9006,,9006,,1/12/2020 18:21,1/12/2020 18:21,,,,2,,,,CC BY-SA 4.0 +9504,1,,,1/12/2020 19:31,,3,249,"

We know that any of the Bell states has the special property that the second qubit will be found in a state which is predictable based on measuring one of the qubits. But assuming any other pair of entangled qubits (any other entangled state apart from the Bell states) how does measuring the first qubit affects the probability of finding the second qubit in a specific state after measurement? Can we deduce any property(ties) for any entangled pair of qubits?

+ +

Obviously, there is a general property that measuring a quantum system impacts other systems entangled with it forthwith. But here I mean some property which is more specific and more calculational based. For instance, if the first qubit after measurement collapses in zero state then the probability of finding the second qubit in zero state will be $n$ where $n$ is calculated through some computations.

+ +

Thanks.

+",8487,,55,,1/13/2020 10:26,1/20/2020 10:10,What is the property of any entangled pair of qubits?,,2,6,,,,CC BY-SA 4.0 +9505,2,,9500,1/12/2020 19:57,,3,,"

I read the article and it seems too rudimentary to provide a manual how to build a quantum computer home. It also contain some "half-truth" about quantum computers, e.g.:

+
+

Quantum computers take advantage of strange properties from quantum mechanics to filter through possible solutions much more quickly than conventional computers. When someone asks about the many ways a drug can impact a cancer cell...

+
+

and

+
+

A quantum computer, on the other hand, has a unique way of sorting through possible solutions and can have an answer in a matter of minutes!

+
+

This is true for some tasks but not for all. There are some problems that quantum computer cannot solve faster than classical computer.

+

Regarding the noise:

+
+

One way to reduce noise is to make the quantum system cold. Very cold. As close as possible to the coldest temperature that can be physically reached

+
+

and

+
+

Next, you will have to limit other types of energy that create noise, such as external magnetic or electric fields ... (Finding clever ways of reducing noise is an ongoing problem and is a big barrier for scientists developing these computers.)

+
+

From these quotes, it is obvious that to build quantum computer at home is impossible. Firstly, how to reach temperature close to absolute zero? Reducing vibration is also very difficult and expensive. So, there is no easy way how to do so at your own.

+

Quotes from the second article:

+
+

While the MIT experiment to validate the protocol won't immediately make large-scale quantum computers practically viable, it is a major step toward making them more precise.

+

According to the research team, there are still years of additional work required in order to perfect the detection and cancellation of noise in quantum systems. In particular, future research will move from a single-sensor system to a two-sensor system, enabling the characterization of noise correlations across different qubits.

+
+

You can see that even for scientists with the state-of-art equipment, it is difficult to apply the knowledge about the noise to reduce it and to build a big quantum computer which can be widely used.

+

Please consider the first articles as and introduction (with some inaccuracies) for laymen how a quatum computers work. Overall, it seems impossible to build a quantum computer in easy and cheap way at home. But please do not feel discouradged and continue to study quantum computing.

+",9006,,-1,,6/18/2020 8:31,1/12/2020 19:57,,,,2,,,,CC BY-SA 4.0 +9506,1,,,1/12/2020 20:37,,1,71,"

In the released Q# documentation by Microsoft available at: Quantum Development Kit Full State Simulator, it is written

+ +
+

By default OpenMP uses all available hardware threads, which means that programs with small numbers of qubits will often run slowly because the coordination required will dwarf the actual work. This can be fixed by setting the environment variable OMP_NUM_THREADS to a small number.

+
+ +

So I wonder how to do that as I couldn't find the solution of fixing OMP_NUM_THREADS to a small number in their documentation?

+ +

Update: +Following is the snippet of the my code which does the main job:

+ + + +
mutable numberOfObservedZeros = 0;
+
+for (i in 1..firstLoop){
+
+    for (j in 1..secondLoop){
+
+        Set (qubit,Zero);
+
+        Ry (0.3141, qubit);
+        R1 (0.0, qubit); 
+
+        if (M(qubit) == Zero){
+             set numberOfObservedZeros += 1;
+        }
+    }
+}
+
+ +

where firstLoop and secondLoop are passed to the operation containing the above block of code.

+",8487,,8487,,1/12/2020 20:58,1/12/2020 20:58,How to reduce the length of Q# programs execution time?,,0,18,,,,CC BY-SA 4.0 +9507,1,9726,,1/12/2020 21:43,,10,1666,"

Recently a pre-print of article Efficient quantum algorithm for solving travelling salesman problem: An IBM quantum experience appeared. The authors use a phase estimation as a core for their algorithm. This part of the algorithm is used for a length calculation of a particular Hamiltonian cycle in TSP.

+ +

After that a minimization algorithm introduced in A Quantum Algorithm for Finding the Minimum is employed to find an actual soulution of TSP.

+ +

Briefly, the proposed algorithm work as follows:

+ +

Firstly a matrix $A$ containing distances among $N$ cities (i.e. element $a_{ij}$ is distance from city $i$ to city $j$) is converted to matrix $B$ which elements are $b_{ij} = \mathrm{e^{i a_{ij}}}$ in order to represent distances among cities as a phase. Note that $a_{ij}$ are normalized on interval $(0;2\pi)$.

+ +

After that, for each city a diagonal matrix $U^{(i)}$ is constructed. An element $u^{(i)}_{jj} = b_{ij}$ i.e. a distance from city $i$ to city $j$.

+ +

Then a final operator $U = U^{(1)}\otimes U^{(2)} \otimes \dots \otimes U^{(N)}$ is constructed. The matrix $U$ is diagonal hence its eigenvectors are vectors constituing z-basis (or standard basis) and respective eigenvalues are diagonal elements of the matrix. Because of approach how $U$ is constructed, $(N-1)!$ of $N^N$ diagonal elements contain length of all possible Hamiltonian cycles in TSP.

+ +

Each Hamiltonian cycle can be represented wiht eigenvector obtained followingly:

+ +

$$ +|\psi\rangle = \otimes_{j} |i(j) - 1\rangle +$$ +for $j \in \{1\dots N\}$ and function $i(j)$ returns city $i$ we traveled to $j$ from. For example, consider four cities and cycle $1 \rightarrow 2 \rightarrow 3\rightarrow 4\rightarrow 1$. In this case

+ +
    +
  • $i(1) - 1 = 4 - 1 = 3$, so $|3_{10}\rangle = |11\rangle$
  • +
  • $i(2) - 1 = 1 - 1 = 0$, so $|0_{10}\rangle = |00\rangle$
  • +
  • $i(3) - 1 = 2 - 1 = 1$, so $|1_{10}\rangle = |01\rangle$
  • +
  • $i(4) - 1 = 3 - 1 = 2$, so $|2_{10}\rangle = |10\rangle$
  • +
+ +

Hence $|\psi\rangle = |11 00 01 10\rangle$. Multiplication $U|\psi\rangle$ returns lenght of the Hamiltonian cycle.

+ +

This setting allows to use phase estimation to get lenght of a cycle. Setting respective $\psi$ as an input to phase estimation leads after inverse Fourier transform to obtaining lenght of the cycle.

+ +

So far, I understand everything. However, the authors proposed:

+ +
+

We get the phases in form of binary output from + phase estimation algorithm, then we can easily perform + the quantum algorithm for finding the minimum [10] to find the minimum cost and the corresponding route that + is to be taken for that particular cost.

+
+ +

Note that [10] is the second article I mentioned above.

+ +

Since the complexity of minimum finding is $\mathcal{O}(\sqrt{N})$ we get quadratic speed-up for TSP solving, so complexity of TSP would be $\mathcal{O}(\sqrt{(N-1)!})$. But if my understanding is correct, we need to have a table of all Hamiltonian cycles prepared before phase estimation and to prepare a quantum state which is superposition of all eigenstates describing these cycles.

+ +

But to prepare all cycles in advance will take $\mathcal{O}((N-1)!)$ time unless there is a faster algorithm for permutation generation.

+ +

So my questions are:

+ +
    +
  1. Where does the speed-up come from if we need to have all Hamiltonian cycles in TSP listed in advance?
  2. +
  3. Is there a quantum algorithm for preparing all permutation of set $\{1 \dots N\}$ faster than on classical computer?
  4. +
+ +

Note: since the paper is a pre-print there are some mistakes, e.g. $d+c-a-b$ in equation (8) should be d-c+a-b. Figure S1 is not completed, moreover, there is a more efficient way how to implement $\mathrm{C-U^{(i)}}$ gate (avoiding Toffolis).

+",9006,,9006,,1/12/2020 22:00,2/3/2020 11:04,Travelling salesman problem on quantum computer,,1,3,,,,CC BY-SA 4.0 +9508,1,,,1/12/2020 22:23,,6,106,"

I am starting to see press about quantum inspired algorithms. Are these algorithms that solve problems faster by looking at things from a quantum computing perspective?

+",4693,,,,,1/12/2020 22:23,What are quantum inspired algorithms?,,0,3,,,,CC BY-SA 4.0 +9509,2,,9504,1/13/2020 6:47,,3,,"

Suppose you have 2-qubit state $|\psi\rangle_{AB}$. Entangled or not, you can always write it as +$$|\psi\rangle_{AB}=a_0|0\rangle_A|\psi_0\rangle_{B}+a_1|1\rangle_A|\psi_1\rangle_{B}$$ +If you measure qubit $A$ in state $|0\rangle$, then the qubit $B$ is in state $|\psi_0\rangle$, and you can compute the probability of qubit $B$ being in state $|0\rangle$ as $|\langle 0|\psi_0\rangle|^2$.

+ +

As you can see, the probability tells you nothing about possible entanglement of the state $|\psi\rangle_{AB}$.

+ +

If you have an unknown state, there is no way to tell whether the state is entangled or not by doing a single measurement.

+ +

If you have a known state, you can detect entanglement by computing concurrence. For a pure state +$$|\psi\rangle =a_{00}|00\rangle+a_{01}|01\rangle+a_{10}|10\rangle+a_{11}|11\rangle$$ +concurrence is +$$C(|\psi\rangle)=2|a_{00}a_{11}-a_{01}a_{10}|$$ +If concurrence is zero, the state is not entangled, otherwise it is entangled.

+",2105,,2105,,1/17/2020 19:12,1/17/2020 19:12,,,,6,,,,CC BY-SA 4.0 +9511,2,,9490,1/13/2020 9:13,,2,,"

I will attempt to provide some insight regarding your first question. For starters, both quantum surface codes and quantum block codes are stabilizer codes, which means that although they are significantly different in terms of their construction and utility, they still share some common ground. With regard to which code family is more promising, I believe both types of code are of equal value to the field of QEC, each one having a specific scenario in which it can outperform the other.

+ +

A quantum error correcting code will be good depending on the specific requirements of the problem at hand. Surface codes are particularly useful when implementing error correction in situations where the qubits that make up the code are placed in a lattice and only interact with neighbours that are nearby. In such a situation, it is desirable for syndrome extraction to be local (to facilitate fault tolerance). Surface codes (being the most basic example of topological codes) are extremely well suited to solve problems with locality constraints given that they have stabilizer generators with local support. +This is essential, because it means that they are compatible with the locality constraints of realistic devices such as superconducting qubits, which, as you mention and has been shown in recent research, has caused a substantial rise in the popularity of these codes.

+ +

On the other hand, block codes are very useful because of how they coalesce the classical and quantum error correction paradigms. Most quantum block codes are built using the CSS construction, which enables you to essentially select classical codes and apply them to the quantum scenario almost seamlessly. The only issue is that a good classical code may not be applicable or as good when used to build a quantum CSS block code, and so most of the research is focused around finding good classical codes that can be used to make up good quantum codes. Due to the vast amounts of research and knowledge that we have regarding classical error correction, a big part of the value and promise of quantum block codes stems from the fact that they provide a gateway to apply our classical know-how to the quantum realm.

+ +

The subject of quantum surface codes and quantum block codes is a whole lot more nuanced than what I have mentioned in my answer, but it should serve as a succint summary of some of the differences of these code families.

+",7855,,,,,1/13/2020 9:13,,,,0,,,,CC BY-SA 4.0 +9512,1,,,1/13/2020 9:45,,4,494,"

I am exploring using Qiskit in other programming languages for game development, such as C# (for Unity game engine), JavaScript (Phaser.io) and Lua (LÖVE2D).

+ +

Is there a general way to call Qiskit class and methods from other programming languages? Perhaps this is a question related to python and not specific to Qiskit. But I think it still has values in this stackexchange for people want to develop applications in other languages using Qiskit.

+ +

The answer for Julia: Qiskit in Julia language? is related but not the same. I have edited the question for C#, JavaScript and Lua specifically.

+",7474,,7474,,1/13/2020 15:15,3/6/2021 20:02,"Use Qiskit in other programming languages (C#, JavaScript and Lua)",,1,6,,,,CC BY-SA 4.0 +9513,1,9549,,1/13/2020 14:49,,1,298,"

My question is a bit broad, but my concern is mainly on understand the ratio between the number of possible linear combinations that can be decomposed in a direct product of states and the number of possible entangled states in that system. The system is a just an $n$-qubits set, as an usual vector space, with the assumption that all the states in a certain superposition can be expected as equally probable. As an example to clarify what I mean take:

+ +

$$ +\left| \psi \right\rangle = \frac{\sqrt{2}}{2} (\left| 00 \right\rangle + \left| 11 \right\rangle) +$$

+ +

I know that the ratio in a 2-qubits system should be 50%, but what about $n=100$?

+ +

To improve the clarity of the question I would ask, how do you interpret this kind of graph?

+ +

Where Product = a state that can be decomposed uniquely by a tensor product. Entangled = it's own defition. +Is this a true picture of what's going on in an $n$-qubit system or not?

+",9238,,55,,11/10/2020 17:36,11/10/2020 17:36,How many $n$-qubit states are entangled?,,1,10,,,,CC BY-SA 4.0 +9514,2,,9504,1/13/2020 14:52,,3,,"

There is a more direct characteristic that makes the state of an entangled pair of qubits distinct from a non-entangled pair (which is also known as a separable state).

+ +

When two qubits are not entangled, the state of the one qubit can be described without any knowledge of the state of the other qubit. Mathematically we can write:

+ +

\begin{equation} +|\psi\rangle_{AB,\mathrm{sep}} = |\psi\rangle_{A}|\phi\rangle_{B}. +\end{equation} +That is to say, the first qubit is in the state $|\psi\rangle_{A}$, and the second qubit is in the state $|\phi\rangle_{B}$; these states do not have any correlation whatsoever. A measurement on the first qubit does not give any information about the second qubit (and vice-versa). Since the state of the first and second qubit is completely separated, we also refer to such a system as a separable state.

+ +

Entangled qubits do not permit the above description. The state of the one qubit is correlated with the state of the other qubit. Since there are only two orthogonal states for a single qubit, we can always write the complete state as a sum of two correlated states on the first and second qubit:

+ +

\begin{equation} +|\psi\rangle_{AB,\mathrm{gen}} = a_{1}|\psi_{1}\rangle_{A}|\phi_{1}\rangle_{B} + a_{2}|\psi_{2}\rangle_{A}|\phi_{2}\rangle_{B}, +\end{equation}

+ +

meaning that when the first qubit is in state $|\psi_{1}\rangle_{A}$, we know the second qubit to be in state $|\phi_{1}\rangle_{B}$, and likewise for $|\psi_{2}\rangle_{A}$ and $|\phi_{2}\rangle_{B}$.

+ +

Note that if $|\phi_{1}\rangle_{B} = |\phi_{2}\rangle_{B}$ we end up with just a separable state $\big(a_{1}|\psi_{1}\rangle_{A} + a_{2}|\psi_{2}\rangle_{A}\big)|\phi_{2}\rangle_{B}$. So, our general expression gives us an entangled state whenever this is not the case:

+ +

\begin{equation} +|\psi\rangle_{AB,\mathrm{ent}} = a_{1}|\psi_{1}\rangle_{A}|\phi_{1}\rangle_{B} + a_{2}|\psi_{2}\rangle_{A}|\phi_{2}\rangle_{B}, +\end{equation} +when $|\psi_{1}\rangle_{A} \not= |\psi_{2}\rangle_{A}$ and $|\phi_{1}\rangle_{B} \not= |\phi_{2}\rangle_{B}$.

+ +

Moreover, when $\langle\psi_{0}|\psi_{1}\rangle = 0 $ and $ \langle\phi_{0}|\phi_{1}\rangle = 0$ (they are orthogonal to each other) we have what we call a maximally entangled state.

+",8141,,8141,,1/20/2020 10:10,1/20/2020 10:10,,,,0,,,,CC BY-SA 4.0 +9515,1,9521,,1/13/2020 15:11,,1,324,"

I want to realize this error correction circuit. +

+ +

To do that, I created a circuit: +

+ +

However, I cannot execute on real hardware. +How can I create a circuit to realize this correction on real hardware?

+",9105,,,,,1/13/2020 18:37,How to realize this quantum error correction circuit on real hardware?,,3,2,,,,CC BY-SA 4.0 +9516,2,,9515,1/13/2020 15:24,,1,,"

AFAIK, this is impossible on IBM's current hardware. See this github issue: https://github.com/Qiskit/qiskit-textbook/issues/119

+",1790,,,,,1/13/2020 15:24,,,,1,,,,CC BY-SA 4.0 +9517,2,,9515,1/13/2020 15:31,,2,,"

I don't think that this will be possible on real current quantum hardware.

+ +

An alternative would be to run it on a simulator with a realistic noise model. This means that the circuit will be run in a non-ideal environment, and so should incur errors similar to how it would if it was executed on a real device. This tutorial teaches you how to build a noise model.

+",5955,,,,,1/13/2020 15:31,,,,3,,,,CC BY-SA 4.0 +9519,1,,,1/13/2020 17:06,,1,73,"

What would be the outcome of this circuit?

+ +

+",9777,,,,,1/13/2020 18:07,What is the outcome of this circuit?,,1,0,,,,CC BY-SA 4.0 +9520,2,,9519,1/13/2020 17:19,,4,,"

The outcome is $-i\left| 11 \right\rangle +$. Here is how I obtained it.

+ +

$$ +\left| 01 \right\rangle \xrightarrow{\text{X}} +\left| 11 \right\rangle \xrightarrow{\text{Y}} +-i\left| 10 \right\rangle \xrightarrow{\text{CNOT}} +-i\left| 11 \right\rangle \xrightarrow{\text{SWAP}} +-i\left| 11 \right\rangle +$$

+ +

$X$ gate changes 0 to 1, and 1 to 0:

+ +

$$ +X \left| 0 \right\rangle = \left| 1 \right\rangle +\qquad +X \left| 1 \right\rangle = \left| 0 \right\rangle +$$

+ +

$Y$ gate also changes 0 to 1, and 1 to 0, but also changes the phase of the qubit:

+ +

$$ +Y \left| 0 \right\rangle = i\left| 1 \right\rangle +\qquad +Y \left| 1 \right\rangle = -i\left| 0 \right\rangle +$$

+ +

CNOT changes the second qubit if the first qubit is in $\left| 1 \right\rangle$ state and does nothing if the first qubit is in $\left| 0 \right\rangle$ state:

+ +

$$ +CNOT \left| 00 \right\rangle = \left| 00 \right\rangle +\qquad +CNOT \left| 01 \right\rangle = \left| 01 \right\rangle +$$

+ +

$$ +CNOT \left| 10 \right\rangle = \left| 11 \right\rangle +\qquad +CNOT \left| 11 \right\rangle = \left| 10 \right\rangle +$$

+ +

SWAP gate changes the qubits, first qubit's state becomes the state of the second qubit and vice versa:

+ +

$$ +SWAP \left| 00 \right\rangle = \left| 00 \right\rangle +\qquad +SWAP \left| 01 \right\rangle = \left| 10 \right\rangle +$$

+ +

$$ +SWAP \left| 10 \right\rangle = \left| 01 \right\rangle +\qquad +SWAP \left| 11 \right\rangle = \left| 11 \right\rangle +$$

+",9459,,9459,,1/13/2020 18:07,1/13/2020 18:07,,,,10,,,,CC BY-SA 4.0 +9521,2,,9515,1/13/2020 18:37,,1,,"

You can simply control $X$ gates with qubits $q3$ and $q4$. You DO NOT have to measure them firstly and then use classical bits for controlling.

+ +

The reason is that in quantum computing, controling some qubit with other qubits or with their measured results in classical register is the same.

+ +

Hence, you can implement the algorithm on real quantum computer.

+",9006,,,,,1/13/2020 18:37,,,,6,,,,CC BY-SA 4.0 +9522,1,9527,,1/13/2020 18:40,,4,109,"

Logically, what does the second reflection in Grover's algorithm do? I currently don't have a lot of background in linear algebra so I'm failing to understand what exactly its purpose is and what it does.

+",9633,,,,,1/13/2020 23:16,Logical Explanation behind second reflection in Grover's algorithm,,1,0,,,,CC BY-SA 4.0 +9524,2,,9471,1/13/2020 19:01,,2,,"

If you have one parameter (one $\theta$) for both circuits then I think the first one is better... they are doing the same job, but the second one is creating extra gates. So the first one will be faster and will have fewer errors because there are fewer gates in the first circuit.

+ +

But if you are obtaining the second circuit with two parameters (two different $\theta$s) it is harder to decide what ansatz is better. When you have two parameters you may have an infinite number of combinations of two parameters that match the optimal value that VQE should estimate. My intuition is that it will not be a good thing for VQE :). Why? Because imagine you have a parabola and the VQE should find the point in the middle that has minimal value:

+ +

+ +

Here $x$ corresponds to one $\theta$ and $y$ is the value that VQE obtains depending on $\theta$. For VQE this optimization is like ""crossing the street perpendicularly"" (the shortest way). You are restricting VQE in 1D space (You are restricting VQE ""to cross the street only perpendicularly"").

+ +

Now Imagine parabolic cylinder in 3D space:

+ +

+ +

Here $x$ and $y$ correspond to two $\theta$ parameters and $z$ is the value that VQE obtains depending on the two $\theta$s. Now you are giving freedom to VQE optimization to choose from a broad range of ""paths"" for finding to way to the minimal value. For example, now VQE can choose not the shortest path to the minimum (it may not ""cross the street perpendicularly"", it may ""cross the street at an angle"" XD).

+ +

Again, this is just my intuition.

+",9459,,9459,,1/13/2020 21:50,1/13/2020 21:50,,,,1,,,,CC BY-SA 4.0 +9525,2,,9375,1/13/2020 21:23,,2,,"

One thing that I noticed. If cu3 gate from $q[2]$ to $q[0]$ is some $U$, then the cu3 from $q[2]$ to $q[0]$ should be $U^2$ in the phase estimation algorithm, but the comparisons of operators with the help of numpy.array showed me that it's not true here. I tried to implement by replacing cu3 part of the QASM code with the following:

+ +
cu3(1.6, -1.12, 2.03) q[2] q[3]
+
+cu3(1.6, -1.12, 2.03) q[1] q[3]
+cu3(1.6, -1.12, 2.03) q[1] q[3]
+
+cu3(1.6, -1.12, 2.03) q[0] q[3]
+cu3(1.6, -1.12, 2.03) q[0] q[3]
+cu3(1.6, -1.12, 2.03) q[0] q[3]
+cu3(1.6, -1.12, 2.03) q[0] q[3]
+
+ +

And obtained a different result via IBM's 'qasm simulator':

+ +
{'0010': 39, '0101': 13, '1110': 16, '0110': 47, '1011': 4, '1010': 8, '1000': 92, '1101': 5, '1111': 143, '1001': 22, '0011': 10, '0001': 16, '1100': 3, '0100': 8, '0000': 235, '0111': 363}
+
+
+ +

And the sum of '1111' and '0111' outcomes is maximum (here 506 from 1024 measurements) as was obtained in the paper.

+",9459,,9459,,1/13/2020 22:25,1/13/2020 22:25,,,,3,,,,CC BY-SA 4.0 +9526,1,,,1/13/2020 21:36,,1,113,"

Suppose there are two quits called q1 and q2. They are in two different superposition states. If we represent their states on the Bloch sphere surface, q1 is located at point_1 and q2 is placed at point_2. Please note that point_1 is different from point_2 and we know where point1 and point2 are. Now, my question consists of two parts:

+ +
    +
  1. How to make q1 and q2 entangled?
  2. +
  3. After making them entangled, how to check if they are entangled indeed?
  4. +
+",8487,,8487,,1/13/2020 21:45,1/13/2020 21:45,How to know if any two arbitrary qubits are entangled?,,0,1,0,1/14/2020 23:12,,CC BY-SA 4.0 +9527,2,,9522,1/13/2020 23:16,,3,,"

An application of the reflection operator change each amplitude of a basis state $ |i\rangle$ by +$$ \alpha_i \rightarrow- \alpha_i + 2 \langle\alpha\rangle\ $$ +where $ \langle\alpha\rangle\ $ is the average of all amplitudes. +It follows the oracle which is use to ""mark"" the seeked elements $ |i\rangle$.

+ +

Say for instance that you have 8 elements, so you work on 3 qubits and you want to output $ |011\rangle$ with high probability. At the beginning, each basis state has $\frac{1}{8}$ probability to be measured as their amplitude are $\frac{1}{\sqrt{8}}$. +The oracle first will mark $ |011\rangle$, so its amplitude will be $-\frac{1}{\sqrt{8}} = -\frac{1}{2\sqrt{2}}$.

+ +

$$ \langle\alpha\rangle\ = \frac{1}{8} (7* \frac{1}{\sqrt{8}} - \frac{1}{\sqrt{8}}) = \frac{6}{8\sqrt{8}} = \frac{3}{8\sqrt{2}}$$

+ +

So the amplitude of $ |011\rangle$ after the reflection operator becomes +$$ - (-\frac{1}{2\sqrt{2}}) + 2\langle\alpha\rangle\ = \frac{5}{4\sqrt{2}} $$ +while others will have a new amplitude: +$$ - (\frac{1}{2\sqrt{2}}) + 2*\frac{3}{8\sqrt{2}} = \frac{1}{4\sqrt{2}}$$

+ +

If you square those amplitudes, then $ |011\rangle$ has $\frac{25}{32} \approx 0.78 > \frac{1}{8}$ probability to be measured, while another state will have $\frac{1}{32}$ probability to be measured. You see the probability of the solution to be outputed increased while non-solutions less likely to be.

+",4127,,,,,1/13/2020 23:16,,,,0,,,,CC BY-SA 4.0 +9529,1,9530,,1/14/2020 10:57,,1,292,"

Consider the state +$$ +\left| \varphi \right>=\frac{i}{\sqrt{3}} \left| 0 \right> + \sqrt{\frac{2}{3}} \left| 1\right>. +$$ +What is the probability of qubit system when measured in the state $\left| + \right>$?

+",9700,,55,,1/17/2020 11:32,1/17/2020 11:32,How to compute the probability of finding a given state in the $|+\rangle$ state?,,1,1,,,,CC BY-SA 4.0 +9530,2,,9529,1/14/2020 11:09,,4,,"

It is known that:

+ +

$$ +\left| 0 \right\rangle = \frac{1}{\sqrt{2}} \left( \left| + \right\rangle + \left| - \right\rangle \right) +\qquad +\left| 1 \right\rangle = \frac{1}{\sqrt{2}} \left( \left| + \right\rangle - \left| - \right\rangle \right) +$$

+ +

By substituting in the initial state:

+ +

$$ +\left| \varphi \right\rangle = \frac{i}{\sqrt{3}}\left| 0 \right\rangle + \frac{\sqrt{2}}{\sqrt{3}}\left| 1 \right\rangle = +\frac{i + \sqrt{2}}{\sqrt{6}} \left| + \right\rangle + +\frac{i - \sqrt{2}}{\sqrt{6}} \left| - \right\rangle +$$

+ +

So the probability to measure the qubit in the $\left| + \right\rangle$ state is equal to $\left|\frac{i + \sqrt{2}}{\sqrt{6}}\right|^2 = 0.5$

+",9459,,,,,1/14/2020 11:09,,,,0,,,,CC BY-SA 4.0 +9531,1,9532,,1/14/2020 11:10,,1,598,"

I want to make a three qubit system that marks the states where the last qubit is 0. I have made an oracle function but when I try to run the reflection the amplitudes are only higher than the others by around 15%. Is there something I'm missing out on the second reflection/diffusion operator, I'm kinda new to this field so don't know much. I have attached a picture of the second reflection as well as the probabilities:

+ +

Reflection: +

+ +

Probabilities:

+ +

+",9633,,9006,,1/14/2020 22:29,1/14/2020 22:29,Grover diffusion operator for a 3 qubit system,,1,0,,,,CC BY-SA 4.0 +9532,2,,9531,1/14/2020 13:45,,1,,"

It seems that $\mathrm{CNOT}$ gates should not be in your circuit. Here is Grover algorithm for 3 qubits:

+ +

+ +

Put your Oracle instead of dashed line. The Oracle should have three inputs $q_0$, $q_1$ and $q_2$, output should be on qubit $q_3$ after $\mathrm{H}$ gate.

+",9006,,9006,,1/14/2020 22:28,1/14/2020 22:28,,,,7,,,,CC BY-SA 4.0 +9533,2,,2310,1/14/2020 14:45,,4,,"

Here is an implementation of a circuit producing state $|\psi\rangle = \frac{1}{\sqrt{3}}(|00\rangle + |01\rangle + |10\rangle)$ on IBM Q:

+ +

+ +

Note that $\theta = 1.2310$ for $\mathrm{Ry}$ on $q_0$. $\theta = \frac{\pi}{4}$ and $\theta = -\frac{\pi}{4}$ for first and second $\mathrm{Ry}$ on $q_1$.

+ +

The $\mathrm{Ry}$ on $q_0$ prepares qubit in superposition $|q_0\rangle = \sqrt{\frac{2}{3}}|0\rangle + \frac{1}{\sqrt{3}}|1\rangle$. $\mathrm{Ry}$ gates on $q_1$ and $\mathrm{CNOT}$ implements controlled Hadamard gate. When $q_0$ is in state $|0\rangle$ the Hadamard acts on $q_1$ thanks to negation $\mathrm{X}$. This happens with probability $\frac{2}{3}$. Since Hadamard turns $|0\rangle$ to $|+\rangle$, i.e. equally distributed superposition, final states $|00\rangle$ and $|01\rangle$ can be measured with probability $\frac{1}{3}$. When $q_0$ is in state $|1\rangle$, controled Hadamard does not act and state $|10\rangle$ is measured. Since $q_0$ is in state $|1\rangle$ with probability $\frac{1}{3}$, $|10\rangle$ is measured also with probability $\frac{1}{3}$.

+",9006,,,,,1/14/2020 14:45,,,,1,,,,CC BY-SA 4.0 +9534,1,,,1/14/2020 16:25,,5,426,"

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, lately I have been wondering how this class codes would be implemented physically in terms of Clifford gates in an actual quantum computer. I have not found much about such mapping in the literature, and less of an actual general algorithm (most of the things I have found are just examples, and not general algorithms that realize the task). Can anyone give some insight about this circuit synthesis problem? Are there any general algorithms that realize this circuit synthesis? Are there optimized versions?

+",2371,,,,,2/23/2021 10:00,Stabilizer circuit synthesis via Clifford gates,,2,6,,,,CC BY-SA 4.0 +9535,1,,,1/14/2020 19:05,,3,152,"

I'm writing some code in python with Qiskit that implements Grover's algorithm to solve the 3-SAT problem, but when I run it it doesn't give the correct annswer. I've checked the circuit with the QuantumCircuit.draw() function and I can't find any error. The result should be one of the possible answers that satisfy the function.

+

Here's the code and the circuit together with the result it outputs:

+

+
from qiskit import QuantumCircuit, execute, Aer, IBMQ
+import math
+import random 
+from qiskit.visualization import plot_histogram
+import qiskit
+
+variables = 3
+clausules = 2
+treball = variables - 2
+temp = clausules - 1
+total = variables + clausules + treball + temp
+
+
+funcio = [['0', '-1', '-2'], ['0', '1', '2']]
+
+pro_vars = []
+pro_vals = []
+
+# Process input
+for i in range(len(funcio)):
+    pro_vars.append([])
+    pro_vals.append([])
+    
+    for j in range(len(funcio[i])):
+        
+        if funcio[i][j][0] == '-':
+            pro_vals[i].append(0)
+            pro_vars[i].append(int(funcio[i][j][1]))
+        
+        else:
+            pro_vals[i].append(1)
+            pro_vars[i].append(int(funcio[i][j]))
+
+#Quantum algorithm
+opt_iter = 1#int(math.pi / 4 * math.sqrt(2**variables))
+
+simulator = Aer.get_backend('qasm_simulator')
+
+circuit = QuantumCircuit(variables + clausules + treball + temp + 1, variables)
+
+# Qubit inicialization
+for i in range(variables):
+    circuit.h(i)
+
+circuit.h(total)
+circuit.x(total)
+
+def grover():
+    
+    #Set work qubits to state 0
+    for i in range(variables, variables + treball):
+        circuit.reset(i)
+    
+    
+    #Oracle
+    for i in range(clausules):
+        for j in range(3):
+            
+            if (pro_vals[i][j] == 0):
+                circuit.x(int(pro_vars[i][j]))
+        
+        control = circuit.qbit_argument_conversion(range(variables))
+        
+        work = circuit.qbit_argument_conversion(range(variables, variables + treball))
+        
+        target = circuit.qbit_argument_conversion(variables + treball + i)
+        
+        circuit.barrier()
+        circuit.OR(control, target[0], work)
+        circuit.barrier()
+        
+        for k in range(treball):
+                
+                circuit.reset(variables + k)    
+            
+                
+        for j in range(len(pro_vars[i])):
+        
+            if pro_vals[i][j] == 0:
+                circuit.x(pro_vars[i][j])    
+    
+    circuit.ccx(variables + treball, variables + treball + 1, variables + treball + clausules)
+    
+    for i in range(0, temp - 1):
+        control1 = variables + treball + 2 + i
+        control2 = variables + treball + clausules + i
+        targetf = control2 + 1
+        circuit.ccx(control1,control2, targetf)
+    
+    circuit.cx(total - 1, total)
+    circuit.barrier()
+
+    #Grover diffusion operator
+    for i in range(variables):
+        circuit.h(i)
+        circuit.x(i)
+        
+    circuit.h(variables-1)
+    
+    circuit.ccx(0,1,variables)
+    
+    for i in range(0,variables-3):
+        circuit.ccx(i+2, variables + i, variables + 1 + i)
+        t1 = variables + 1 + i
+    circuit.cx(2 * (variables - 1) - 1, variables - 1)
+    circuit.barrier()
+    circuit.h(variables-1)    
+    circuit.barrier()
+    for i in range(variables):
+        circuit.x(i)
+        circuit.h(i)
+
+
+for i in range(opt_iter):
+    grover()        
+
+circuit.measure(range(variables), range(variables))    
+
+job = execute(circuit, simulator, shots=1024)
+result = job.result()
+counts = result.get_counts(circuit)
+
+print("function: ", funcio)
+
+plot_histogram(counts)
+
+#circuit.draw()
+
+

+",9788,,16092,,6/18/2021 6:02,6/18/2021 6:02,Grover's algorithm for 3SAT problem gives erroneous results,,0,1,,,,CC BY-SA 4.0 +9536,1,9543,,1/14/2020 20:09,,7,496,"

Observing the violation of Bell inequalities, be it in their original formulation, or in the nowadays more commonly used CHSH formulation, involves computing averages of specific experimentally measurable quantities. In the CHSH formulation, these are for example the averages of the products of the experimental outcomes.

+ +

Are there scenarios in which Bell nonlocality can be observed without such averages, that is, in a single-shot scenario? By this I mean a scenario in which a single measurement outcome (rather than a collection of outcomes used to compute averages, as is done in CHSH formulation) is enough to rule out a local hidden variable explanation.

+ +

I seem to recall having seen this kind of thing in some paper, possibly in a scheme involving three or more parties (or maybe it was with systems with three or more outcomes?). I can't, however, find the reference right now, so I'm not sure whether I'm remembering this correctly or not.

+",55,,55,,11/10/2020 17:36,11/10/2020 17:36,Are there Bell-like violations that can be observed without collecting statistics?,,4,1,,,,CC BY-SA 4.0 +9538,2,,9496,1/14/2020 21:02,,1,,"

One way that I've found that works pretty well is to define a new UDT for options, and then provide a function that returns a reasonable set of defaults. For instance, in the case you gave, you might have something like:

+ + + +
newtype FunOptions = (
+   N : Int,
+   SomeOtherOption : Double[]
+);
+
+function DefaultFunOptions() : FunOptions {
+    return (0, [0.0]);
+}
+
+function Fun(options : FunOptions) : Double {
+    // do something using options::N and options::SomeOtherOption
+}
+
+ +

This lets you call Fun by using the w/ to provide optional arguments as you see fit:

+ +
let w = Fun(DefaultFunOptions());
+let x = Fun(DefaultFunOptions() w/ N <- 10);
+let y = Fun(DefaultFunOptions() w/ SomeOtherOption <- [0.1, 0.2]);
+let z = Fun(DefaultFunOptions() w/ N <- 42 w/ SomeOtherOption <- [0.1, 0.2]);
+
+ +

This is the approach taken, for instance, with the new quantum machine learning library currently under development. If you're interested, check out the pull request where the new TrainingOptions UDT was first introduced at https://github.com/microsoft/QuantumLibraries/pull/187.

+",1978,,,,,1/14/2020 21:02,,,,1,,,,CC BY-SA 4.0 +9539,2,,9536,1/14/2020 21:22,,1,,"

Original paper: Going beyond Bell's theorem

+ +

Papers by Mermin:

+ + + +
+ +

We can give a non-probabilistic proof that local hidden variables theories are incompatible with Quantum Mechanics.

+ +

The proof does not explain how experimentally decide which theory is correct; it just shows more clearly than Bell or CHSH that Quantum Mechanics and local hidden variables theories are incompatible.

+ +

Proof:

+ +

Suppose we have 3-qubit GHZ state +$$|GHZ\rangle=\frac{1}{\sqrt{2}}(|000\rangle+|111\rangle)$$ +For visibility sake think of a qubit as of a spin $1/2$ particle.

+ +

We can measure spin in $X$ and $Y$ directions; $X$ direction means Hadamard basis $\{|+\rangle, |-\rangle\}$, $Y$ direction means $\{\frac{1}{\sqrt{2}}(|0\rangle+i|1\rangle), \frac{1}{\sqrt{2}}(|0\rangle-i|1\rangle)\}$ basis.

+ +

First, Quantum Mechanics predicts that if we measure 2 qubits in $Y$ direction and 1 qubit in $X$ direction, each qubit's measurement outcome is $50\% / 50\%$ random, but there is strong correlation: the outcomes of $Y$ measurements determine the outcome of $X$ measurement; namely, if $Y$ measurements are identical, $X$ measurement is $|-\rangle$, otherwise $|+\rangle$. Following Einstein's ""elements of reality"" concept, it means that each qubit has deterministic ""instructions"" how to behave if measured in $X$ and $Y$ direction, and the set of legal instructions for all 3 qubits in GHZ experiment is limited.

+ +

Following the 1st cited Mermin paper, the legal instructions are (first line $X$ measurement, second line $Y$ measurement):

+ +
 ---  -++  +-+  ++-  -++  ---  ++-  +-+
+ ---  -++  +-+  ++-  +--  +++  --+  -+-
+
+ +

It now turns out that if we apply legal instructions approach to measuring all 3 qubits in $X$ direction, the only possible outcomes are $|---\rangle$, $|-++\rangle$, $|+-+\rangle$ and $|++-\rangle$.

+ +

On the other hand, quantum mechanics predicts that the only possible outcomes are $|+++\rangle$, $|+--\rangle$, $|-+-\rangle$ and $|--+\rangle$, because

+ +

$$|GHZ\rangle = \frac12(|+++\rangle+|+--\rangle+|-+-\rangle+|--+\rangle)$$ +and we have no overlap with legal instructions (hidden variables) approach.

+",2105,,2105,,1/21/2020 14:05,1/21/2020 14:05,,,,0,,,,CC BY-SA 4.0 +9540,2,,6201,1/15/2020 1:34,,5,,"

Have you tried the Bloch Sphere Playground Application? It just might be what you are looking for.

+ +

Bloch Sphere Playground Application

+ +

https://javafxpert.github.io/grok-bloch/

+",4963,,,,,1/15/2020 1:34,,,,0,,,,CC BY-SA 4.0 +9541,1,,,1/15/2020 1:45,,3,66,"

I'm focusing on training non quantum physics / non math majors - software engineers to be specific (and the interested senior executive that wonders by) and am bewildered by the lack of adequate training vehicles for non-quantum indigenous folks.

+ +

I'm searching for good quantum computing illustration packages or frameworks for visually teaching various aspects of QC that are interactive in nature?

+ +

For instance QUIRK does a very good job, as does the OReilly JS QC simulator - both useful to teaching purposes but we need more to really bring QC to software engineers.

+ +

Some other examples are the Bloch Sphere Playground and the Quantum State Sphere Playground. (links below)

+ +

My preference is for interactive vehicles like ""Immersive Math"" when it comes to explaining linear algebra concepts visually and interactively.

+ +

There has to be some decent vehicles out there that provide more coverage on under served fronts of QC, but I just can't seem to find them.

+ +

Links:

+ +

QUIRK: - https://algassert.com/quirk

+ +

OReilly QC: - https://oreilly-qc.github.io/#

+ +

Immersive Math: - http://immersivemath.com/ila/index.html

+ +

Bloch Sphere Playground: https://javafxpert.github.io/grok-bloch/

+ +

Quantum State Sphere Playground: https://javafxpert.github.io/quantum-state-spheres/

+",4963,,5955,,1/15/2020 12:49,1/15/2020 12:49,Does anyone have any really good quantum computing illustration packages or frameworks for visually teaching various aspects of QC?,,0,2,,,,CC BY-SA 4.0 +9543,2,,9536,1/15/2020 3:56,,3,,"
+

Are there scenarios in which Bell nonlocality can be observed without such averages, that is, in a single-shot scenario?

+
+ +

No, you have to collect statistics. Any single result you see could have been due to classical players picking completely at random and getting lucky. Making the chance of classical luck arbitrarily close to zero requires repetition (or arbitrarily large games).

+ +

For a single-shot experiment to work, you need a game with an outcome that has a Bayes factor of infinity between a quantum strategy and all classical strategies. This means every classical strategy must have a 0% success rate while some quantum strategy has a non-zero success rate. That's not possible, because any move a quantum strategy makes can also be made by accident by a random strategy.

+ +

You can have game where entangled strategies have a 100% success rate, such as the mermin-peres game, but the Bayes factor of that game is not infinity because the classical strategy has a success rate of 8/9 > 0.

+",119,,119,,1/19/2020 21:17,1/19/2020 21:17,,,,4,,,,CC BY-SA 4.0 +9544,1,9546,,1/15/2020 4:09,,3,420,"

Can qubit be inside Bloch Sphere, i.e. its length is less than 1?
+If yes, how we represent that state since we have only parameter for angles and not the length (norm) of the vector?

+",8491,,55,,1/16/2020 12:10,1/16/2020 12:10,Can a qubit be in the inside of the Bloch Sphere?,,2,1,,,,CC BY-SA 4.0 +9545,2,,9484,1/15/2020 4:58,,1,,"

It seems that docplex class also was moved to from qiskit.optimization.ising import docplex

+",8042,,,,,1/15/2020 4:58,,,,1,,,,CC BY-SA 4.0 +9546,2,,9544,1/15/2020 5:43,,5,,"

Mixed states are represented by vectors inside Bloch sphere.

+ +

Suppose you have mixed state with density matrix

+ +

$$\rho=q|\psi\rangle\langle\psi| + (1-q)|\phi\rangle\langle\phi|$$ +where $|\psi\rangle$ and $|\phi\rangle$ are pure states with vectors $\overset{\rightarrow}{r_{\psi}}$ and $\overset{\rightarrow}{r_{\phi}}$ on Bloch sphere, and $0<q<1$; then the vector +$$\overset{\rightarrow}{r_{\rho}}=q\overset{\rightarrow}{r_{\psi}}+(1-q)\overset{\rightarrow}{r_{\phi}}$$ +inside Bloch sphere represents mixed state with density matrix $\rho$. Geometrically, $\overset{\rightarrow}{r_{\rho}}$ is a point on the line connecting points $\overset{\rightarrow}{r_{\psi}}$ and $\overset{\rightarrow}{r_{\phi}}$

+",2105,,,,,1/15/2020 5:43,,,,1,,,,CC BY-SA 4.0 +9547,2,,9544,1/15/2020 7:32,,3,,"

Yes, the state of a qubit can be described by a point inside the Bloch sphere. However, you cannot use the state vector formalism to describe it, you have to generalise to the concept of mixed states. For a qubit, these have three parameters: the two angles and the length of the vector.

+",1837,,,,,1/15/2020 7:32,,,,0,,,,CC BY-SA 4.0 +9548,2,,9536,1/15/2020 7:56,,3,,"

I believe you're thinking of the all-versus-nothing proofs based on GHZ states. You start with a state such as +$$ +|\Psi\rangle=\frac{1}{\sqrt{2}}(|000\rangle+|111\rangle) +$$ +and you select at random one of the four measurements to implement: $X\otimes X\otimes X$, $X\otimes Y\otimes Y$, $Y\otimes X\otimes Y$ or $Y\otimes Y\otimes X$. Assuming every one of these can be implemented perfectly every time, you must always get the answer -1 (just calculate $\langle\Psi|M|\Psi\rangle$ where $M$ is one of the measurement operators) for any of the measurements with two $Y$s, and +1 for the $XXX$ measurement.

+ +

However, if the outcomes are associated with a local hidden variable model, this outcome is impossible. Let $x_i\in\{-1,1\}$ and $y_i\in\{-1,1\}$ be the hidden variables associated with the outcomes of measuring $X$ or $Y$ respectively on qubit $i$.

+ +

Now let us consider what would happen if we made each of the four measurements, and took the product of the outcomes. The quantum model says we get answer $-1$. The local hidden variable model, however, says that answer must be +$$ +(x_1x_2x_3)(x_1y_2y_3)(y_1x_2y_3)(y_1y_2x_3)=x_1^2x_2^2x_3^2y_1^2y_2^2y_3^2=1. +$$ +A local hidden variable model is incompatible with always getting the predicted set of quantum answers.

+ +

So, the idea is that whatever measurement you make, you know there is a fixed answer that you must get if the system is behaving properly quantumly (and assuming no errors whatsoever in the system). If you ever get a disagreement, the system cannot be behaving perfectly quantumly. So, that gives you the non-probabilstic answer you mention.

+ +

Of course, a more reliable way of running this is to repeat the experiment many times. If you ever get a false answer, that's a proof of non-quantumness. However, the conclusion of quantumness (i.e. always getting the expected answers) still has an associated probability because after $n$ runs, there's a probability of $1/4^n$ that the local hidden variable version gives all the expected quantum answer.

+",1837,,,,,1/15/2020 7:56,,,,7,,,,CC BY-SA 4.0 +9549,2,,9513,1/15/2020 10:09,,2,,"

The probability of finding an entangled state while randomly sampling (from the uniform distribution) over pure states is one: almost all pure states are entangled.

+ +

This is shown in this answer on physics.SE. This paper might also be of interest.

+ +

The gist is that separable states correspond to rank-1 matrices, which have zero measure in the set of all matrices. This is also discussed in this post on math.SE.

+ +

Another less rigorous argument could be to observe that separable states are always infinitesimally close to entangled out: given an arbitrary separable pure state $|\psi\rangle\otimes|\phi\rangle$, take $|u\rangle,|v\rangle$ such that $|\Psi\rangle\equiv\langle u|\psi\rangle=\langle v|\phi\rangle=0$. Then, the state +$$\frac{1}{\sqrt{1+\epsilon^2}}\left[|\Psi\rangle+\epsilon(|u\rangle\otimes|v\rangle)\right]$$ +is entangled for all $\epsilon>0$ and can be made to be infinitesimally close to $|\Psi\rangle$. This hints towards the set of separable states having empty interior (although technically, having empty interior is not in itself enough to prove having zero measure, see e.g. this blog post).

+",55,,55,,1/15/2020 10:25,1/15/2020 10:25,,,,0,,,,CC BY-SA 4.0 +9550,1,9551,,1/15/2020 12:44,,4,974,"

Several quantum algorithms that deals with linear algebra and matrices that are not necessarily unitary circumvent the problem of non-unitary matrices by requiring a decomposition of the non-unitary matrix as a sum of unitary matrices. +A widely known example being the LCU method.

+ +

I am currently facing the problem of ""how should I decompose my non-unitary matrix?"". I want to decompose as a sum of unitary matrices (in the best world ever, easy to implement unitary matrices) the following matrix:

+ +

$$ +A = \begin{pmatrix} +0 & \cdots{} & \cdots{} & \cdots{} & \cdots{} & 0 \\ +\vdots{} & & & & & \vdots{}\\ +\vdots{} & & & & & \vdots{}\\ +0 & & & & & \vdots{}\\ +1 & 0 & \cdots{} & \cdots{} & \cdots{} & 0 \\ +\end{pmatrix} +$$ +which is obviously non-unitary.

+ +

I started by restricting myself to the Pauli matrices (+ identity) because I know that these unitary matrices are easy to implement. +I found the following decomposition:

+ +

$$ +A = \frac{1}{2^{n}} (\mathbb{X} - i \mathbb{Y})^{\otimes n}. +$$ +The problem with this decomposition is that it is a sum of an exponential (with respect to the number of qubits) number of unitary matrices. From another perspective, there are as much unitary matrices in the decomposition as the size of $A$, so it is linear in the size of $A$. +The methods mentioned at the beginning of this question are only efficient when the number of unitary matrices in the decomposition is poly-logarithmic, which is not the case here.

+ +

First question: is there any way to find a better decomposition (in terms of number of summed unitary matrices)? Or a proof that shows that it is not possible to do better only with the Pauli matrices?

+ +

I voluntarily took a very restricted and simple gate set. I started to think about how introducing a 2-qubit gate like CNOT would affect the decomposition. Obviously, it can only improve the number of unitary matrices summed in the decomposition, but I still cannot figure out if introducing other unitary matrices will help me to reduce the number of unitary matrices summed in the decomposition to something that is logarithmic in the size of $A$ (instead of the linear behaviour I have now).

+ +

Second question: do you have any ideas about how modifying the gate set will affect the number of summed unitary matrices in the decomposition?

+",1386,,,,,1/15/2020 14:37,Non-unitary matrix decomposition as a sum of unitary matrices,,1,0,,,,CC BY-SA 4.0 +9551,2,,9550,1/15/2020 13:54,,7,,"

All tensor products of $n$ Pauli operators $\{I,X,Y,Z\}$ (that is $4^n$ combinations) form an orthogonal basis for the vector space of $2^n \times 2^n$ complex matrices. Hence, for every matrix there is a unique decomposition as a linear combination of tensor products of Pauli unitaries. Same is true if we fix some other unitary basis.

+ +

If we not fix the unitary basis, then there are a lot of other options, of course. For example, your matrix $A$ is a linear combination of 2 unitaries: +$$ +A = \frac{1}{2}\begin{pmatrix} +0 & 0 & 0 & \cdots{} & 1 \\ +0 & 1 & 0 & & \vdots{}\\ +0 & 0 & \ddots & & \vdots{}\\ +\vdots{} & & & 1 & 0\\ +1 & \cdots & \cdots{}& 0 & 0 \\ +\end{pmatrix} + +\frac{1}{2}\begin{pmatrix} +0 & 0 & 0 & \cdots{} & -1 \\ +0 & -1 & 0 & & \vdots{}\\ +0 & 0 & \ddots & & \vdots{}\\ +\vdots{} & & & -1 & 0\\ +1 & \cdots & \cdots{}& 0 & 0 \\ +\end{pmatrix} +$$

+",5870,,5870,,1/15/2020 14:37,1/15/2020 14:37,,,,7,,,,CC BY-SA 4.0 +9552,1,9554,,1/15/2020 15:31,,0,148,"

I would like to check if state

+ +

$$ |\psi\rangle = \cos{\theta}|0\rangle + i \sin{\theta}|1\rangle +$$

+ +

is properly defined.

+ +

But when I calculated $\langle \psi | \psi \rangle$ is get +$$ +\cos^2{\theta} - \sin^2{\theta} +$$

+ +

so I am facing sin and cos.

+ +

What is wrong in my calculation?

+",9700,,55,,1/16/2020 12:09,1/16/2020 12:09,How can I check if the following are possible states of a qubit?,,2,3,,,,CC BY-SA 4.0 +9553,2,,9500,1/15/2020 19:46,,2,,"

The source of noise in your system, and how to reduce it, is really dependent on the quantum computing architecture you're pursuing.

+ +

As stated above the most successful quantum computers at the moment are of the superconducting qubit flavor. And as the articles suggest, the way to reduce noise is low temperature and low vibrations, and perhaps chip design(layout of the resonators, and microwave feeds) all of any other easy things have already been Incorporated.

+ +

The superconducting qubits however aren't exactly accessible to the amateur, unless you have hundreds of thousands of dollars to throw at it. A dilution refrigerator will run you upwards of $100,000, AWG's for each qubit can run quite a bit too. Then there is the chip fabrication, which is completely out of my range of knowledge.

+ +

However there do exist other architectures which are more easily amateur accessible, though they all have their drawback(hence no real commercial adoption)

+ +

Nitrogen Vacancy centers in diamond provide you a fairly easy to manipulate and read out qubit. For a basic setup see: Little bits of diamond: +Optically detected magnetic resonance of nitrogen-vacancy centers. They suffer from a scaleability problem. And the inherent challenge is that to scale them up, you naturally introduce magnetic noise. Though you could in principle utilize the electron spin as a bus and interface and nuclear spins in the diamond as your qubits.

+ +

Another accessible option is NMR computing. Nuclear spins are your qubits, and you readout and manipulate they through RF. They too suffer from scaleability, and a readout. So you end up needing to work with ensembles (Which provide you with your statistics in one shot) however you can't really initialize the system properly. A nice review: Quantum Computing with NMR

+ +

I'm sure there are some other easily accessible architectures, but I'm not so familiar with them.

+",9579,,9006,,1/19/2020 7:29,1/19/2020 7:29,,,,0,,,,CC BY-SA 4.0 +9554,2,,9552,1/15/2020 22:22,,2,,"

Standard inner product on space $\mathbb{C}^{n}$ is defined as

+ +

$$ +\langle a|b \rangle = \sum_{i=1}^{n} a_{i}b_{i}^{\dagger}, +$$

+ +

where $b^{\dagger}$ is complex conjugate (i.e. for $x \in \mathbb{C}$: if $x = x_{re} + ix_{im}$ then $x^{\dagger} = x_{re} - ix_{im}$).

+ +

In your case $a_{1} = \cos(\theta)$ and $a_{2} = i\sin(\theta)$. Since you are interested in product $\langle a|a \rangle$, $a_{1}^{\dagger} = \cos(\theta)$ because it is a real number and $a_{2}^\dagger = -i\sin(\theta)$ you have

+ +

$$ +\langle a|a \rangle = a_{1}a_{1}^{\dagger}+a_{2}a_{2}^{\dagger} = \cos^{2}(\theta) -i^{2}\sin^{2}(\theta) = \cos^2(\theta) + sin^{2}(\theta) = 1 +$$

+ +

Alternatively you can use normalization condition $|a|^2+|b|^2 = 1$:

+ +

$$|a|^2 = |\cos(\theta)|^2 = \cos^{2}(\theta)$$

+ +

and

+ +

$$|b|^2 = |i\sin(\theta)|^2 = |i|^2|\sin^{2}(\theta)| = 1^2\cdot \sin^{2}(\theta)$$

+ +

And again you have $\cos^{2}(\theta) + \sin^{2}(\theta) = 1$.

+ +

Overall, your quatum state is properly defined.

+",9006,,,,,1/15/2020 22:22,,,,0,,,,CC BY-SA 4.0 +9555,1,9557,,1/15/2020 22:28,,4,834,"

I am currently reading the paper quantum principal component analysis from Seth Lloyd's article Quantum Principal Component Analysis There is the following equation stated.

+
+

Suppose that on is presented with n copies of $\rho$. A simple trick allows one to apply the unitary transformation $e^{-i\rho t}$ to any density matrix $\sigma$ up to $n$th order in $t$. Note that +\begin{align}\label{eq1}\tag{1} +\text{tr}_pe^{-iS\Delta t}\rho\otimes\sigma e^{iS\Delta t} &= \left(\cos^2\Delta t\right)\sigma + \left(\sin^2 \Delta t\right)\rho - i\sin\Delta t\left[\rho, \sigma\right] \\ +&= \sigma - i\Delta t\left[\rho, \sigma\right] + \mathcal O\left(\Delta t^2\right) +\end{align} +Here $\text{tr}_p$ is the partial trace over the first variable and $S$ is the swap operator. $S$ is a sparse matrix and so $e^{-iS\Delta t}$ can be performed efficiently [6-9]. Repeated application of \eqref{eq1}

+
+

I know from the qiskit website, that we can express $\mathrm{e}^{i\gamma B}$ as $\cos(\gamma)I + i\sin(\gamma)B $ with $\gamma$ being some real number and $B$ is an involutory matrix. Can someone explain me why there is only a single $\sigma$ and no $\rho$ in $(\cos^2\triangle t)\sigma$ and a single $\rho$ and no $\sigma$ in $(\sin^2\triangle t)\rho$? Is it because of the partial trace?

+

Any intuition or approach is welcome. Many thanks in advance.

+",9785,,55,,7/26/2020 19:00,7/26/2020 19:00,Quantum Principal Component analysis by Seth Lloyd,,1,0,,,,CC BY-SA 4.0 +9556,1,9559,,1/15/2020 23:02,,2,630,"

So suppose you want to do a Shor algorithm on an arbitrary number of qubits using an arbitrary $a$ (the base number in the periodic function $a^x \mod c$) and $c$ ( the factored number). Making the IQFT is easy for an arbitrary number of qubits because it has a clear pattern and it uses only Hadamard and controlled phase shifts gates. But what about the permutation gate that multiplies the function? I can make one for a 7 qubits Shor with 3 qubits $x$ and 4 qubits $f(x)$ using Toffolli gates but I don't know how I can code something that does it automatically for given $c$ and $a$. I also wonder how would you do it for a higher number of qubits. Any help, reading material or pointers on that?

+",9644,,9006,,1/16/2020 5:51,1/16/2020 8:30,How to make a Shor's algorithm for an arbitrary number of qubits with Qiskit on a IBM machine?,,1,0,,,,CC BY-SA 4.0 +9557,2,,9555,1/16/2020 7:26,,4,,"

As you say, start by expanding $e^{-iS\Delta t}=\cos(\Delta t)I-i\sin(\Delta t)S$, so you'd be calculating +$$ +(\cos(\Delta t)I-i\sin(\Delta t)S)\rho\otimes\sigma(\cos(\Delta t)I+i\sin(\Delta t)S). +$$ +If you multiply out all the terms, then the $\cos^2(\Delta t)$ comes from the two $I$ terms, leaving you with $\rho\otimes\sigma$. If you trace out the first term, you're left with $\sigma$.

+ +

Similarly, $S(\rho\otimes\sigma)S=\sigma\otimes\rho$, so if you trace out the first system, you're left with $\rho$.

+ +

It's actually the cross-terms that are the trickier ones. Take, for example, $S(\rho\otimes\sigma)$. If I try to trace out the first system, I have +\begin{align} +\sum_{i,j,k}|j\rangle\langle k|\langle i,j|S\rho\otimes\sigma|i,k\rangle&=\sum_{i,j,k}|j\rangle\langle k|\langle j,i|\rho\otimes\sigma|i,k\rangle \\ +&=\sum_{i,j,k}|j\rangle\langle k|\langle j|\rho|i\rangle\langle i|\sigma|k\rangle \\ +&=\sum_{j,k}|j\rangle\langle k|\langle j|\rho\sigma|k\rangle \\ +&=\rho\sigma. +\end{align}

+",1837,,1837,,1/17/2020 12:17,1/17/2020 12:17,,,,1,,,,CC BY-SA 4.0 +9558,2,,9552,1/16/2020 7:51,,1,,"

You asked ""What is wrong in my calculation?""

+ +

My guess is that your mistake is in forgetting that $\langle \psi | = \cos{\theta}\langle 0| - i \sin{\theta}\langle 1|$ instead of $\cos{\theta}\langle 0| + i \sin{\theta}\langle 1|$ (because $i$ becomes $-i$ when you take the complex conjugate).

+",1790,,,,,1/16/2020 7:51,,,,0,,,,CC BY-SA 4.0 +9559,2,,9556,1/16/2020 8:30,,2,,"

Maybe this paper can help you, that's what the implementation in Qiskit is based on.

+ +

Otherwise looking at the implementation of Shor's algorithm in Qiskit itself might be insightful. The circuit for the algorithm is constructed in the method construct_circuit and can be visualized with this snippet.

+ +
from qiskit.aqua.algorithms import Shor
+a, N = 2, 3
+shor = Shor(N, a)
+circuit = shor.construct_circuit()
+print(circuit.draw())  # or circuit.draw(output='mpl') for a nicer looking diagram ;)
+
+ +

Warning: the circuit is huge and takes a long time to plot for large N!

+",9800,,,,,1/16/2020 8:30,,,,1,,,,CC BY-SA 4.0 +9561,1,,,1/16/2020 10:23,,1,228,"

In the Gates Glossary of IBM Quantum Experience it states

+ +
+

H gate

+ +

The H or Hadamard gate rotates the states |0⟩ and |1⟩ + to |+⟩ and |−⟩, respectively. It is useful for making superpositions. As a Clifford gate, it is useful for moving + information between the x and z bases.

+
+ +

This is followed by a picture of a Bloch sphere rotation which looks good but still does tell me nothing. Well for me as a programmer all I understood by playing around with the Hadamard gate was that I get with a 50/50 probability 0 or 1 when measuring the qubit after the Hadamard gate.

+ +

But trying to learn more the above is very confusing and I do not find anything googling either without starting to ask more questions about basic terminology.

+ +

Breaking down the quoted sentence I come up with a lot of questions: What exactly is a state of a qubit? What is the state of + and what is the state of -? Why is it important to know that this is a ""Clifford gate"" does this help in any way to understand the Hadamard gate? What is the x base? What is the z base? And why am I all the time confronted with math when I want to write a program? I write software since 35 years and the amount of math I needed was very limited why should I suddenly need to understand all this math theorems? I am not stupid. I could understand math but the notations in math are intimidating. I prefer to read software code no matter how nested. Single SQL queries of 1000 lines no problem.

+ +

I know these are all basic questions but I feel that they are not properly answered anywhere without the use of either incomprehensible math or other terminology inappropriately defined either. I think also that I am not the only ""classical"" programmer that struggles with the basics.

+ +

I appreciate any answer not using new terminology that is not defined and I prefer answers that explain math formulas. If it can only be explained with math then this is okay, but please define your notations. As a programmer I prefer terms as for(i = 1; i <= N; i++) Sum += i; over terms like $\sum_{i=1}^n$ which look very alien to me.

+",9173,,55,,10/9/2020 6:57,10/9/2020 6:57,What are the $|+\rangle$ and $|-\rangle$ states?,,1,2,,,,CC BY-SA 4.0 +9562,2,,9561,1/16/2020 11:01,,5,,"

The $|+⟩$ and $|-⟩$ are states given by the following decomposition in the Z-basis: +\begin{equation} +\begin{aligned} +|+⟩ &= \frac{1}{\sqrt{2}} \Big(|0⟩ + |1⟩\Big)\\ +|-⟩ &= \frac{1}{\sqrt{2}} \Big(|0⟩ - |1⟩\Big) +\end{aligned} +\end{equation} +As from quantum mechanics, you can see that there's a 50% chance for both states to be found in the |0⟩ or |1⟩ state when measuring in the Z-basis.

+ +

The terms Z-basis and X-basis refer to the two pair of states $\{|0⟩,|1⟩\}$ and $\{|+⟩,|-⟩\}$ respectively, which are eigenstates of the two Pauli matrices $\sigma_z$ and $\sigma_x$ (or in IBMQ terms, the Z and X operators). They're called Z and X basis for simplicity and in the Bloch sphere are usually represented on the corresponding z and x axes, but there's no connection with the real space directions and in other quantum mechanics fields are referred to as 1 and 2, with no indication of axes. +The Hadamard gate is just given by this matrix in the Z basis +\begin{equation} +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 1\\ +1 & -1 +\end{pmatrix} +\end{equation} +which converts the state $|0⟩$ to $|+⟩$ and the state $|1⟩$ to $|-⟩$. This is all you need to know about what it does, no need to get in depth about Clifford algebra and gates which might be a bit overkill.

+ +

Turning to the other questions, it's kind of hard to explain. QC is not just another programming paradigm or language, but a totally different way of performing computation. It is still in its infancy, we're at the ""circuit model"" of computation and none of the hardware nowadays available can perform the few algorithms (Shor, Grover, Deutch-Jorsza etc.) on more than a couple qubits. For these reason and a couple thousands other, QC is still mostly a research field and you need a lot of math to understand it, since any computation effort is quite strongly dependant on the hardware and thus on the quantum mechanics behind it. At the very least, you should know a bit of linear algebra.

+ +

As an example, think of the classical computation in its earlier days of turing machines and circuit model of computation. To understand these you needed quite a bit of math (though a different kind of math from QC, mostly combinatorics and logic). Nowadays, though still taught at university, nobody needs to know anything about circuits or Turing machines in order to program, nor it has to worry much about the hardware performing the computation.

+ +

Edit: I think the best route for you to approach QC would be to take part in the qiskit development, it is hosted on github at this link.

+",9772,,9772,,1/16/2020 11:35,1/16/2020 11:35,,,,3,,,,CC BY-SA 4.0 +9563,1,,,1/16/2020 11:30,,2,78,"

$\newcommand{\Ket}[1]{\left|#1\right>}$ +If we have the superposition +$$\displaystyle \sum \dfrac{1}{2^n} \Ket x \Ket{ f(x)} \Ket 0 \Ket y \Ket{g(y)} \Ket 0 \Ket {\delta_{x,y}} ,$$ here $\delta_{x,y} = 1 $ if $f(x) = g(y)$, else $\delta_{x,y}=0$. I want to copy $\delta_{x,y}$ to qubit $\Ket 0$ by some ways so that it becomes superpositon + $$\left(\displaystyle \sum \dfrac{1}{2^{n/2}} \Ket x \Ket{f(x)}\Ket {\delta_x} \right) \left(\displaystyle \sum \dfrac{1}{2^{n/2}} \Ket y \Ket{g(y)} \Ket{\delta_y} \right) \Ket 0 ,$$ +means that $\delta_x = 1$ if $f(x)$ collides with some $g(y)$, and so does $y$. After that, apply Grover's algorithm on the first half and second half to find $x$ and $y$ that collides, in $O(2^{n/4})$ time complexity.

+ +

Is there any way to copy like this?

+",9801,,55,,11/10/2020 17:36,11/10/2020 17:36,Can we apply Grover to meet-in-the-middle attack?,,0,6,,,,CC BY-SA 4.0 +9564,1,9565,,1/16/2020 11:31,,4,143,"

I am given fixed quantum states $\rho_X$ and $\sigma_Y$ and some function of the form $\text{Tr}(N_{X\rightarrow Y}(\rho_X)\sigma_Y)$. I would like to maximize this function over all completely positive trace preserving maps $N_{X\rightarrow Y}$. What is the way to solve such an optimization?

+ +

I notice that my problem is linear in $N_{X\rightarrow Y}$ so I was wondering if there could even be an analytical solution to this?

+",4831,,55,,5/27/2022 9:36,5/27/2022 9:36,How to maximise over linear functionals of quantum channels?,,1,0,,,,CC BY-SA 4.0 +9565,2,,9564,1/16/2020 15:00,,8,,"

For the specific linear function you are interested in, the solution turns out to be trivial: you can take the channel to be $N_{X\rightarrow Y}(\rho) = \operatorname{Tr}(\rho) |\psi\rangle\langle \psi|$ for $|\psi\rangle$ being an eigenvector of $\sigma_Y$ having the largest possible eigenvalue.

+ +

More generally, however, you can optimize any real-valued linear function over all channels of a fixed size using semidefinite programming. Perhaps the simplest way to do this is to use the Choi representation of the channels you are optimizing over: +$$ +J(N_{X\rightarrow Y}) = \sum_{a,b} N_{X\rightarrow Y}(|a\rangle\langle b|) \otimes |a\rangle\langle b|, +$$ +where $a$ and $b$ range over the standard basis states of $X$. It is the case that $N_{X\rightarrow Y}$ is a channel (i.e., is completely positive and trace preserving) if and only if $J(N_{X\rightarrow Y})$ is positive semidefinite and obeys the linear constraint +$$ +\operatorname{Tr}_{Y}(J(N_{X\rightarrow Y})) = \mathbb{1}_X. +$$ +For any real-valued linear function of $N_{X\rightarrow Y}$, there will always exist a Hermitian operator $H$ for which the value of this linear function is given by +$$ +\operatorname{Tr}(H J(N_{X\rightarrow Y})). +$$ +The resulting semidefinite program looks like this: +$$ +\begin{align} +\text{maximize} \quad & \operatorname{Tr}(H P) \\[1mm] +\text{subject to} \quad & \operatorname{Tr}_{Y}(P) = \mathbb{1}_X\\[1mm] +& P \in \mathrm{Pos}(Y\otimes X), +\end{align} +$$ +where $\mathrm{Pos}(Y\otimes X)$ refers to the set of all positive semidefinite operators acting on $X\otimes Y$.

+ +

Like all semidefinite programs, this one has a dual formulation, which is as follows: +$$ +\begin{align} +\text{minimize} \quad & \operatorname{Tr}(Q)\\[1mm] +\text{subject to} \quad & \mathbb{1}_Y \otimes Q - H \in \mathrm{Pos}(Y\otimes X)\\[1mm] +& Q \in \mathrm{Herm}(X), +\end{align} +$$ +where $\mathrm{Herm}(X)$ is the set of all Hermitian operators acting on $X$.

+ +

If you have a specific choice of $H$ in mind, you can solve this optimization problem numerically. I recommend CVX for MATLAB for this purpose.

+ +

In general, an analytic solution seems unlikely, but if you correctly guess an optimal solution, you can prove its optimality analytically: using some known facts about semidefinite programming (complelemtary slackness in particular), $N_{X\rightarrow Y}$ can be shown to be optimal if and only if +$$ +\operatorname{Tr}_{Y}(H J(N_{X\rightarrow Y})) +$$ +is a Hermitian operator and satisfies +$$ +\mathbb{1}_Y \otimes \operatorname{Tr}_{Y}(H J(N_{X\rightarrow Y})) - H \in \mathrm{Pos}(Y\otimes X). +$$

+",1764,,1764,,1/16/2020 17:01,1/16/2020 17:01,,,,5,,,,CC BY-SA 4.0 +9566,1,9568,,1/16/2020 19:00,,4,1097,"

I guess, I understood simple Deutsch Algorithm (if unary function is balanced or constant) as described here: Introduction to quantum computing: The Deutsch algorithm

+ +

I need to test it. I was wondering how I would implement all the four function oracles. I was hoping to find it, already implemented somewhere on IBM Quantum Experience.

+ +

Could someone please point me to an implementation for the same?

+ +

EDIT: Kind of answering the question: I guess my issue was: I was trying to find $f(x)$ somewhere inside the bigger black box. But if I let go of that (what if I don't want to?), then things become really simple by realizing: +we had function: $x \rightarrow f(x)$ +But this is not reversible, so we wanted to implement black box with function: $|x, y\rangle \rightarrow |x, f(x) \oplus y\rangle$.

+ +

So here is what this translates to four possible functions:

+ +

1) $f(x) = 0$: $f(x) \oplus y = 0 \oplus y = y$, So, black box doesn't do anything

+ +

2) $f(x) = 1$: $f(x) \oplus y = 1 \oplus y = \bar{y}$ +So, black box simply negate the $y$.

+ +

3) $f(x) = \bar{x}$: $f(x) \oplus y = \bar{x} \oplus y$ (which is also $\overline{x \oplus y}$)

+ +

So, we can implement it in two ways:

+ +

Option 1: for $x$: not it twice so that finally we get $x$. +for $y$: when $x$ is notted once, at that point use it as control to CNOT $y$ and output that.

+ +

Option 2: $x$ is outputted as it is. +For $y$ take $x$ as control and CNOT it. Then NOT it. +Here CNOT gives $x \oplus y$, and when we NOT it we get $\overline{(x \oplus y)}$ which is same as $\bar{x} \oplus y$

+ +

4) $f(x) = x:$ +For $y$ simply CNOT it with $x$, using $x$ as control.

+ +

I verified it (on IBM Q Experience) and it seems to be working. :-) +I see that in all 4 implementation it is possible to not change $x$ at all. But yet, when we measure it, it's value is changing!!! I guess I still have to turn my head around that.

+",9804,,9006,,1/18/2020 8:40,3/6/2020 18:45,Implementing four oracles for the Deutsch Algorithm (preferably on IBM Q Experience),,4,0,,,,CC BY-SA 4.0 +9567,1,,,1/16/2020 20:44,,2,502,"

I don't know if this is the right place to ask this question. I just thought it would be a place where people knew what they are doing. If there is a better place to look for answers (stackoverflow for example), feel free to tell me.

+ +

The problem is that .NET can't install iqsharp. It says it doesn't recognize the file even though it is in the PATH folder (user/.dotnet/tools).

+ +
> dotnet iqsharp install
+Could not execute because the specified command or file was not found.
+Possible reasons for this include:
+  * You misspelled a built-in dotnet command.
+  * You intended to execute a .NET Core program, but dotnet-iqsharp does not exist.
+  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
+
+ +

It shows the same behavior when I want to use other .NET packages. I have dotnet version 3.1.101. I can send dotnet --info if you want.

+ +

I have looked on github and other websites for solutions but most of the problems were caused by Linux Ubuntu and most of the treads are still open.

+ +

Thanks for reading and I hope you can help me.

+",8746,,9006,,1/17/2020 5:52,11/6/2020 18:05,Problems with Q# installing,,2,10,,,,CC BY-SA 4.0 +9568,2,,9566,1/16/2020 22:40,,1,,"

An oracle $U_f$ is actually $\mathrm{X}$ gate (or a negation). The circuit implementing the oracle is following

+ +

+ +

Qubit $q_0$ is input and qubit $q_{1}$ is output. Firstly $\mathrm{X}$ is applied on $q_{0}$. This negate the qubit, however, we want to have an output on $q_1$. Therefore, we apply $\mathrm{CNOT}$ which in this setting ""copy"" the $q_{0}$ to output $q_{1}$. After that the second $\mathrm{X}$ returns state of $q_0$ back to preserve input value here.

+ +

Second and third oracles in the article are same. These examples shows how to build Deutsch-Jozsa algorithm step by step. But they use same oracle as an example.

+ +

The fourth oracle is general case of function with more than one input qubit. So, I cannot provide you with implementation unless I have a matrix defining function $U_f$.

+ +

Note: $\mathrm{CNOT}$ gate is so-called controlled negation. In fact it is XOR logical function and can be used for copy qubits (so-called fan-out gate). Meaning of ""copy"" can be somehow misleading because it is not possible to copy quantum state. But application of $\mathrm{CNOT}$ leads to entanglement between qubits and therefore $q_0$ and $q_1$ behave in same way; they have same value.

+",9006,,,,,1/16/2020 22:40,,,,4,,,,CC BY-SA 4.0 +9570,2,,9566,1/17/2020 18:31,,3,,"

@cgranade and I have a chapter on the Deutsch-Jozsa algorithm (Chapter 7) as well as implementations of the oracles for Q# in our book Learn Quantum Computing with Python and Q#. You can find the code samples for the book in the repo here. In particular, the oracles look like this:

+ +
namespace DeutschJozsa {
+    open Microsoft.Quantum.Intrinsic;
+
+    operation ZeroOracle(control : Qubit, target : Qubit) : Unit {
+    }
+
+    operation OneOracle(control : Qubit, target : Qubit) : Unit {
+        X(target);
+    }
+
+    operation IdOracle(control : Qubit, target : Qubit) : Unit {
+        CNOT(control, target);
+    }
+
+    operation NotOracle(control : Qubit, target : Qubit) : Unit {
+        X(control);
+        CNOT(control, target);
+        X(control);
+    }
+}
+
+",4211,,,,,1/17/2020 18:31,,,,2,,,,CC BY-SA 4.0 +9571,1,,,1/17/2020 21:07,,6,489,"

This question has been asked here: ""Problem 2.2 in Nielsen & Chuang - Properties of the Schmidt number"", +but no answer has been provided there yet, thus I move it here.

+ +

The problem is stated below. This is problem 2.2 (not exercise 2.2) in Nielsen & Chuang (Page 117 in the newest version).

+ +
+

Suppose $|\psi\rangle $ is a pure state of a composite system with components $A$ and $B$, such that: $$|\psi\rangle = \alpha \rvert \phi \rangle + \beta \rvert \gamma \rangle$$ + Prove that: + $$ \operatorname{Sch}(\psi) \geq | \operatorname{Sch}(\phi) - \operatorname{Sch}(\gamma)|$$ + where $\operatorname{Sch}(x)$ is the Schmidt number of the pure state labeled $x$.

+
+ +

The link above provide some attempts, but not quite succeed. Any help is appreciated.

+",9816,,55,,1/20/2020 12:43,9/18/2020 16:30,Problem 2.2 in Nielsen & Chuang - Properties of the Schmidt number,,2,1,,,,CC BY-SA 4.0 +9572,2,,9566,1/17/2020 23:36,,1,,"

I implemented them as a ""subcircuit"" so it looks ""hidden"" from the ""outside"".

+ +

constant 0:

+ +
input = QuantumRegister(1, name='input')
+temp = QuantumRegister(1, name='temp')
+constant0 = QuantumCircuit(input, temp, name='oracle')
+oracle = constant0.to_instruction()
+
+ +

identity:

+ +
input = QuantumRegister(1, name='input')
+temp = QuantumRegister(1, name='temp')
+identity = QuantumCircuit(input, temp, name='oracle')
+identity.cx(input, temp)
+oracle = identity.to_instruction()
+
+ +

inverts:

+ +
input = QuantumRegister(1, name='input')
+temp = QuantumRegister(1, name='temp')
+invert = QuantumCircuit(input, temp, name='oracle')
+invert.cx(input, temp)
+invert.x(temp)
+oracle = identity.to_instruction()
+
+ +

constant 1:

+ +
input = QuantumRegister(1, name='input')
+temp = QuantumRegister(1, name='temp')
+constant1 = QuantumCircuit(input, temp, name='oracle')
+constant1.x(temp)
+oracle = constant1.to_instruction()
+
+ +

So you can add the oracle in the algorithm like this:

+ +
qr = QuantumRegister(2)
+cr = ClassicalRegister(1)
+circuit = QuantumCircuit(qr, cr)
+circuit.x(qr[1]);
+circuit.h(qr)
+circuit.append(oracle, [qr[0], qr[1]])
+circuit.h(qr[0])
+circuit.measure(qr[0], cr[0]);
+
+ +

And you can run it like this:

+ +
counts = execute(circuit, backend=local_simulator).result().get_counts()
+if '1' in counts:
+    print('BALANCED')
+elif '0' in counts:
+    print('CONSTANT')
+
+",1859,,,,,1/17/2020 23:36,,,,0,,,,CC BY-SA 4.0 +9573,2,,9566,1/18/2020 0:18,,3,,"

I think this snippet from Cirq's Deutsch's algorithm example (disclosure: I am its author) should be fairly easy to understand:

+ +
def make_oracle(q0, q1, secret_function):
+    """""" Gates implementing the secret function f(x).""""""
+
+    # coverage: ignore
+    if secret_function[0]:
+        yield [CNOT(q0, q1), X(q1)]
+
+    if secret_function[1]:
+        yield CNOT(q0, q1)
+
+ +

In the code, secret_function[i] is the value of $f(i)$.

+ +

If $f(0) = f(1) = 0$, nothing happens so the q1 maintains its initial value of 0.

+ +

If $f(0) = f(1) = 1$, the sequence CNOT(q0, q1), X(q1), CNOT(q0, q1) is applied, which is the same as just X(q1) no matter the value of q0, which means q1 is flipped to 1.

+ +

If $f(0) = 0$ and $f(1) = 1$, then only CNOT(q0, q1) is applied, which means the input is passed through (i.e., q1 is effectively assigned the value of q0).

+ +

If $f(0) = 1$ and $f(1) = 0$, then CNOT(q0, q1), X(q1) is applied, which means the inputs are exchanged after passing through (i.e., q1 is assigned the opposite of the value of q0).

+ +

Since you ask about the IBM Quantum Experience, you can produce the four oracle functions as follows in Qiskit:

+ +
# Pick a secret function.
+secret = [random.randint(0, 1) for _ in range(2)]
+def append_oracle(ciruit, secret):
+    if secret[0]:
+        circuit.cx(0, 1)
+        circuit.x(1)
+    if secret[1]:
+        circuit.cx(0, 1)
+
+# Create the Deutsch algorithm circuit.
+circuit = QuantumCircuit(2, 1)
+circuit.x(1)
+circuit.barrier()
+circuit.h(0)
+circuit.h(1)
+circuit.barrier()
+append_oracle(circuit, secret)
+circuit.barrier()
+circuit.h(0)
+circuit.measure(0, 0)
+circuit.draw()
+
+ +

You can of course set secret = [$f(0)$,$f(1)$] explicitly to each of the four possible combinations of $f(0)$ and $f(1)$ to output the circuit you want.

+ +

You can easily create these using the circuit composer if that's what you want to do:

+ +

$f(0) = f(1) = 0$ (constant): +

+ +

$f(0) = 0, f(1) = 1$ (balanced): +

+ +

$f(0) = 1, f(1) = 0$ (balanced): +

+ +

$f(0) = f(1) = 1$ (constant): +

+ +

(You can of course simplify this last circuit by removing the two CNOTs.)

+",1790,,1790,,3/6/2020 18:45,3/6/2020 18:45,,,,2,,,,CC BY-SA 4.0 +9575,2,,9571,1/18/2020 9:33,,2,,"

Following your attempt we have +$$ +\begin{align*} +| \phi \rangle &= \sum_i \phi_i | a_i^{\phi} \rangle | b_i^{\phi} \rangle\\ +| \gamma \rangle &= \sum_i \gamma_i | a_i^{\gamma} \rangle | b_i^{\gamma} \rangle, +\end{align*} +$$ +$$ +\rho \equiv \operatorname{tr}_B(| \psi \rangle \langle \psi |) = |\alpha|^2 \rho_{\phi \phi} + |\beta|^2 \rho_{\gamma \gamma} + \alpha \bar{\beta} \rho_{\phi \gamma} + \bar{\alpha} \beta \rho_{\gamma \phi}, +$$ +where +$$ +\rho_{\phi \phi} \equiv \operatorname{tr}_B(| \phi \rangle \langle \phi |) = \sum_i \phi_i^2 | a_i^{\phi} \rangle \langle a_i^{\phi} | \\ +\rho_{\gamma \gamma} \equiv \operatorname{tr}_B(| \gamma \rangle \langle \gamma |) = \sum_i \gamma_i^2 | a_i^{\gamma} \rangle \langle a_i^{\gamma} | +\\ +\rho_{\phi \gamma}\equiv \operatorname{tr}_B(| \phi \rangle \langle \gamma |) = \sum_i \phi_i | a_i^{\phi} \rangle \sum_j \gamma_j \langle b_j^{\gamma} | b_i^{\phi} \rangle \langle a_j^{\gamma} | \\ +\rho_{\gamma \phi}\equiv \operatorname{tr}_B(| \gamma \rangle \langle \phi |) = \sum_i \gamma_i | a_i^{\gamma} \rangle \sum_j \phi_j \langle b_j^{\phi} | b_i^{\gamma} \rangle \langle a_j^{\phi} |. +$$ +Now observe that for the following subspace of the first subsystem +$$ +H_\alpha = \text{span}\{| a_1^{\phi} \rangle, | a_2^{\phi} \rangle, ... ; | a_1^{\gamma} \rangle, | a_2^{\gamma} \rangle, ... \} +$$ +we have that +$$ +\rho_{\phi \phi} (H_\alpha^\perp) = \rho_{\gamma \gamma} (H_\alpha^\perp) = \rho_{\phi \gamma} (H_\alpha^\perp) = \rho_{\gamma \phi} (H_\alpha^\perp) = 0 +$$ +Thus $\rho(H_\alpha^\perp)=0$, which means that $\text{rank}(\rho)\leq \text{dim}(H_\alpha)$. Hence +$$ +\text{Sch}(\psi) \leq \text{Sch}(\phi) + \text{Sch}(\gamma) +$$ +This is just a triangle inequality. To obtain the necessary just apply the above inequality to $\alpha \rvert \phi \rangle = |\psi\rangle - \beta \rvert \gamma \rangle$ and $\beta \rvert \gamma \rangle = |\psi\rangle - \alpha \rvert \phi \rangle $

+",5870,,,,,1/18/2020 9:33,,,,0,,,,CC BY-SA 4.0 +9576,1,20985,,1/18/2020 11:15,,5,857,"

I am trying to find application of a quantum computing in finance. So far I found these papers:

+ +
    +
  1. Quantum computing for finance: Overview and prospects

  2. +
  3. Quantum computational finance: quantum algorithm for portfolio optimization

  4. +
  5. Efficient quantum algorithm for solving travelling salesman problem: An IBM quantum experience

  6. +
  7. Towards Pricing Financial Derivatives with an IBM Quantum Computer

  8. +
  9. Quantum computational finance: Monte Carlo pricing of financial derivatives

  10. +
  11. Quantum Risk Analysis

  12. +
  13. Credit Risk Analysis using Quantum Computers

  14. +
+ +

My question is: do you know about other possible application of quantum computing in finance, banking, companies finanace management or general business area?

+",9006,,9006,,1/20/2020 5:27,8/26/2021 18:39,Quantum computing in finance - list of articles,,2,2,,,,CC BY-SA 4.0 +9577,1,9578,,1/18/2020 12:18,,2,3979,"

I need to know how can I find eigenvalues and eigenvectors for a quantum gate, for example $X$ gate.

+",9700,,9006,,1/19/2020 0:06,1/19/2020 0:06,How to find eigenvalues and eigenvector for a quantum gate?,,2,1,,1/24/2020 18:30,,CC BY-SA 4.0 +9578,2,,9577,1/18/2020 13:00,,6,,"

First you need eigenvalues; +$$X=\begin{pmatrix} 0&1 \\ 1&0\end{pmatrix}$$ so you need to solve equation +$$\begin{vmatrix}0-\lambda &1 \\ 1 &0-\lambda\end{vmatrix}=0$$ or +$$\lambda^2-1=0$$ +which gives eigenvalues +$$\lambda_{1,2}=\pm 1$$ +Since $X$ is Hermitian, eigenvalues are real. +Now you can find eigenvectors; +for example, for the first eigenvector $|v\rangle=a|0\rangle+b|1\rangle$ +$$X\begin{pmatrix}a \\ b \end{pmatrix}=\lambda_1\begin{pmatrix}a \\ b \end{pmatrix}$$ +$$\begin{cases} +0\cdot a +1\cdot b=a\\ +1\cdot a +0\cdot b=b +\end{cases}$$

+ +

which gives $a=b$; after normalization, $a=b=\frac{1}{\sqrt{2}}$, and

+ +

$$|v\rangle=\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)=|+\rangle$$

+",2105,,,,,1/18/2020 13:00,,,,0,,,,CC BY-SA 4.0 +9579,1,9581,,1/18/2020 16:02,,5,298,"

In Quantum Computation and Quantum Information by Isaac Chuang and Michael Nielsen, section 8.2.3, $\mathcal{E}=\sum_{k}E_k\rho E_k^{\dagger}$ gives the operator-sum representation. In general, it requires $\sum_k E_k E_k^{\dagger}\leq I$. But, what does it mean by the inequation here? Does it mean every entry of the matrix is a nonnegative real value up to 1?

+ +

Thanks

+",8321,,55,,1/21/2020 10:11,1/21/2020 10:11,"What does it mean ""less than identity"" in the operator sum representation?",,1,0,,,,CC BY-SA 4.0 +9581,2,,9579,1/18/2020 17:12,,11,,"

Matrix inequalities of the form $A\ge B$ should be read as +$$ +A-B\ge 0\ , +$$ +which in turn means that all eigenvalues of $A-B$ are larger or equal than zero.

+ +

In the given case, $M\le I$ means that all eigenvalues of $M$ are smaller or equal than one.

+ +

(Note that this convention for $\ge$ used on matrices depends on the field. In other fields, ""$\ge0$"" might refer to a component-wise property, and $\succeq0$ might be used for positivity of the eigenvalues.)

+",491,,,,,1/18/2020 17:12,,,,0,,,,CC BY-SA 4.0 +9582,1,9583,,1/18/2020 18:47,,2,509,"

Let a quantum register of size $n$ be in the following state, expressed in the computational basis for $n$-qubit states:

+ +

$$\left| \psi \right> = \sum_{i=0}^{2^n-1} \alpha_i \left| i \right>, \forall i \in \{0, 1, ..., 2^n-1\}, \alpha_i \in \mathbb{C}$$

+ +

Additionally, the normalization condition states that:

+ +

$$\sum_{i=0}^{2^n-1}|\alpha_i|^2 = 1$$

+ +

How many real-valued coefficients would it take to express these $2^n$ complex-valued coefficients (the probability amplitudes of the register's quantum state)?

+ +

The naïve answer would be two real coefficients per complex coefficient, one for the real part and one for the imaginary part, or one for the modulus and one for the phase, so in total $2^{n+1}$.

+ +

The correct answer, it seems, is however $2(2^n-1)$, as stated in the lecture notes I am following, on slide 5.

+ +

Obviously, the normalization condition can be used to reduce the required number of real coefficients, but I can only see it reducing the required number by $1$ (express a modulus using all of the other modulus values) instead of $2$.

+ +

I just can't find an explanation to the correct answer.

+",9408,,55,,1/20/2020 12:49,1/20/2020 13:01,How many real-valued coefficients does it take to specify an $n$-qubit state?,,2,4,,,,CC BY-SA 4.0 +9583,2,,9582,1/18/2020 19:30,,4,,"

You can also rephase. So that gets rid of 1 more real dimension. That is quotient by $\psi ~ e^{i \theta} \psi$. Caution: unlike normalization where you are taking a subset, instead you are identifying many points into one.

+ +

Edit:

+ +

Let $| \psi \rangle = \sum_{i=0}^{2^{n}-1} \alpha_i | i \rangle$ +There are identifications $| \psi \rangle \equiv z | \psi \rangle$. Rescaling $|z|$ means changing the normalization and rescaling by $\frac{z}{|z|}$ is the rephasing by $e^{i \theta}$ mentioned already. +So suppose $\alpha_0 \neq 0$, then we can pick a represetative of the equivalence class of $|\psi \rangle$ by letting $z = \frac{1}{\alpha_0}$, then we get $| \psi \rangle \equiv | 0 \rangle + \sum_{i=1}^{2^n-1} \frac{\alpha_i}{\alpha_0} | i \rangle$. This is not normalized but it is okay because we are only talking about equivalence classes and you can find the normalized state in this equivalence class. There are no more free parameters to specify. There are $2^n-1$ complex numbers to specify by giving all the values of $\frac{\alpha_i}{\alpha_0}$. +If $\alpha_0 = 0$, then repeat the same trick with $\alpha_1$ or $\alpha_2$ etc. The entire space is not a vector space so you can't just parameterize everything with one coordinate chart. But this shows that in each chart by given by saying $\alpha_0 \neq 0$ etc is made by specifying $2^n-1$ complex numbers. They all glue together into one manifold that has complex dimension $2^n-1$ or real dimension $2(2^n-1)$.

+ +

Take the construction section in Wikipedia: Complex Projective Space and substitute $n+1$ there is $2^n$ here. There it was states in a Hilbert space $\mathbb{C}^{n+1}$ but you want $\mathbb{C}^{2^n}$. Above I give you the coordinate chart $U_0$ as it is called there. The line below is probably what you are thinking of. First you normalized everything so you get some sphere by $\sum Re(\alpha_i)^2 + Im(\alpha_i)^2 = 1$ but then you still have to do a quotient by phase to get rid of one more real dimension.

+",434,,434,,1/18/2020 21:50,1/18/2020 21:50,,,,2,,,,CC BY-SA 4.0 +9585,2,,9577,1/19/2020 0:04,,3,,"

I would like to add general case for single qubit gate. Let us assume that our gate is described by unitary matrix

+ +

$$ +U = \begin{pmatrix} +u_{11} & u_{12} \\ +u_{21} & u_{22} +\end{pmatrix} +$$

+ +

Eigenvalues are roots of so-called characteristic equation

+ +

$$ +|U-\lambda I|=0 +$$

+ +

In particular

+ +

$$ +\begin{vmatrix} +u_{11} - \lambda & u_{12} \\ +u_{21} & u_{22} -\lambda +\end{vmatrix} += +(u_{11}-\lambda)(u_{22}-\lambda) - u_{12}u_{21} = \lambda^2 - (u_{11}+u_{22})\lambda + u_{11}u_{22} - u_{12}u_{21} = 0 +$$

+ +

Solving this quadratic equation gives you eigenvalues.

+ +

Since matrix $U$ is unitary then $|\lambda|=1$. Additionally, if $U$ is Hermitian (i.e. $u_{21} = u_{12}^\star$) then $\lambda \in \mathbb{R}$ hence $\lambda \in \{-1;1\}$.

+ +

When you have eigenvalues, you can calculate eigenvectors by solving equation $Ux =\lambda x$. Vector $x$ should be normalized with its Euclidian norm, i.e. $x := \frac{x}{|x|}$. Obviously the normalized vector fulfil $Ax=\lambda x $ as well.

+ +

Appoach mentioned above is not difficult for single qubit gates. Howver, even in case of two qubit gates you have to deal with matrix 4x4 and thus characteristic equation is of fourth order. There are other methods how find eigenvalues based on matrix diagonalization.

+ +

But for practical purposes I would recommend using MatLab or its free version Octave. +You can use function

+ +
 [V D] = eig(U); 
+
+ +

where $U$ is matrix which eigenvectors and eigenvalues you are look for, $V$ is matrix containing all eigenvectors and $D$ is diagonal matrix having eigenvalues on its diagonal. Note that element $d_{ii}$ is connected to vector $v_{i}$.

+",9006,,,,,1/19/2020 0:04,,,,0,,,,CC BY-SA 4.0 +9586,1,,,1/19/2020 5:49,,2,461,"

I am new to both IBM Qiskit and Microsoft QDK. I wish to understand which framework would be best suited for someone new to this field. I am lookig for the pros and cons of both frameworks.

+",166,,9006,,1/19/2020 7:35,1/19/2020 7:35,IBM qiskit vs Microsoft QDK,,0,2,,1/23/2020 18:17,,CC BY-SA 4.0 +9587,1,9588,,1/19/2020 12:52,,0,159,"

Is this now deprecated or moved? I've been looking for it. It was in

+ +
from qiskit.chemistry.aqua_extensions.components.variational_forms import UCCSD
+
+",7439,,9006,,1/19/2020 16:32,1/19/2020 16:32,UCCSD in qiskit deprecated?,,2,0,,,,CC BY-SA 4.0 +9588,2,,9587,1/19/2020 12:55,,1,,"

No, it wasn't removed, it's here: https://github.com/Qiskit/qiskit-aqua/blob/master/qiskit/chemistry/components/variational_forms/uccsd.py

+",4379,,,,,1/19/2020 12:55,,,,1,,,,CC BY-SA 4.0 +9589,1,9592,,1/19/2020 14:02,,0,169,"

I am persuing some older code as below

+ +
ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)
+...
+qubitOp = ferOp.mapping(map_type='parity', threshold=0.000001)
+qubitOp = qubitOp.two_qubit_reduced_operator(num_particles)
+
+ +

but am getting the following error:

+ +
AttributeError: 'WeightedPauliOperator' object has no attribute 'two_qubit_reduced_operator'
+
+ +

Any suggestions for how to fix. I am using qiskit version:

+ +
qiskit                             0.14.1
+qiskit-aer                         0.3.4
+qiskit-aqua                        0.6.2
+qiskit-ibmq-provider               0.4.5
+qiskit-ignis                       0.2.0
+qiskit-terra                       0.11.1 
+
+",7439,,,,,1/19/2020 15:52,More broken older Qiskit code,,1,0,,,,CC BY-SA 4.0 +9590,2,,4783,1/19/2020 15:00,,1,,"

I think there's some confusion here, so I'll try to explain the principle of QKD (Quantum Key Distribution) instead.

+ +

Say Alice and Bob want to communicate in a secure fashion using symmetric encryption. To do so, they require a shared secret, a key. One of them generates it and he must somehow get it to the other person without an eavesdropper, say Eve, finding out the key.

+ +
    +
  1. Alice generates the key, a binary string of length $n$ (probably a random string): $k = b_n b_{n-1} \ldots b_1$.

  2. +
  3. Alice chooses $n$ bases: $\forall i \in \{1, \ldots, n\}, B_i \in \{X,Z\}$. Here, $X$ and $Z$ denote the respective Pauli gates, in matrix form $X = \begin{pmatrix} 0 & 1 \\ +1 & 0 \end{pmatrix}$ and $Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$.

  4. +
  5. Bob also chooses $n$ bases: $\forall i \in \{1, \ldots, n\}, \widetilde{B_i} \in \{X,Z\}$.

  6. +
  7. Alice sends over the key bit by bit over a quantum channel. If she chose the computational basis, she sends a qubit in state $\left| 0 \right>$ for a classical bit in state $0$ and a qubit in state $\left| 1 \right>$ for a classical bit in state $1$. If she choses basis $X$, she sends a qubit in state $\left| + \right>$ for a classical bit in state $0$ and a qubit in state $\left| - \right>$ for a classical bit in state $1$.

  8. +
  9. Bob receives the qubits and measures them in the bases he chose beforehand, obtaining the eigenvalues $+1$ or $-1$ as measurement results, which he equates to $0$ or $1$ in classical terms.

  10. +
  11. Both Alice and Bob publicly announce the bases they have chosen, allowing them to sift through them and keep only those where they chose the same bases. They are left with $m \leq n$ bases.

  12. +
  13. Alice and Bob have obtained a key of length $m$ by keeping only the bits where they chose the same basis.

  14. +
+ +

But what if Eve is eavesdropping? She can do the same thing as Bob, choose $n$ bases, intercept and measure the qubits. When Alice and Bob have chosen the same basis, two cases can happen:

+ +
    +
  • She gets lucky and chooses the same basis as both Alice and Bob. In this case, she has intercepted one bit correctly and undetected.
  • +
  • She chooses another basis. In this case, upon measuring the state of the qubit, she causes it to collapse into one of the basis' eigenstates, but they are a superposition of the correct basis' eigenstates. This means that when Bob measures it, there's a chance he'll measure a different value than what Alice sent.
  • +
+ +

The first case isn't really a problem: unless she gets very lucky and chooses the same bases as Alice and Bob when they match up, she doesn't intercept the entire key.

+ +

The second case means that Alice and Bob have one piece of good news and one piece of bad news. The piece of bad news is that their supposedly shared secret isn't in fact the same, since Alice messed with it and changed what Bob should have measured. The good news is that they can check over a public channel for a subset of the bits which should be the same whether they actually are the same. If not, they know someone tampered with their channel and that they haven't exchanged the key correctly.

+",9408,,,,,1/19/2020 15:00,,,,0,,,,CC BY-SA 4.0 +9591,1,,,1/19/2020 15:35,,3,49,"

I've recently performed certain analyses (Archipelagos of Total Bound and Free Entanglement) pertaining to eq. (50) in +Separable Decompositions of Bipartite Mixed States , that is

+ +

\begin{equation} \label{rhoAB} +\rho_{AB}^{(1)}=\frac{1}{2 \cdot 4} \textbf{1} \otimes \textbf{1} +\frac{1}{4} (t_1 \sigma_1 \otimes \lambda_1+t_2 \sigma_2 \otimes \lambda_{13}+t_3 \sigma_3 \otimes \lambda_3), +\end{equation}

+ +

""where $t_{\mu} \neq 0$, $t_{\mu} \in \mathbb{R}$, and $\sigma_i$ and $\lambda_{\nu}$ are SU(2) and SU(4) generators, respectively.""

+ +

Subsequent analyses (which I could detail)--concerning certain entanglement constraints employed in the two studies--lead me to speculate whether or not there is a possible ambiguity in the specific identification of the three $4 \times 4$ matrices ($\lambda$'s).

+ +

I, of course, had to use a specific set of three in my analyses--but, at this point, I'd just as soon leave matters ""wide open"" and not ""bias"" matters, if possible.

+ +

If there is possible ambiguity (which I presently suspect) perhaps good practice should dictate that the specific ordering employed be explicitly identified.

+",3089,,9006,,1/19/2020 16:34,1/19/2020 16:34,Are there different orderings of the fifteen SU(4) generators in common use?,,0,0,,,,CC BY-SA 4.0 +9592,2,,9589,1/19/2020 15:52,,3,,"

The chemistry sample in the README on the qiskit-aqua repo shows how to do this now:

+ +
from qiskit.chemistry import FermionicOperator
+from qiskit.chemistry.drivers import PySCFDriver, UnitsType
+from qiskit.aqua.operators import Z2Symmetries
+
+# Use PySCF, a classical computational chemistry software
+# package, to compute the one-body and two-body integrals in
+# molecular-orbital basis, necessary to form the Fermionic operator
+driver = PySCFDriver(atom='H .0 .0 .0; H .0 .0 0.735',
+                    unit=UnitsType.ANGSTROM,
+                    basis='sto3g')
+molecule = driver.run()
+num_particles = molecule.num_alpha + molecule.num_beta
+num_spin_orbitals = molecule.num_orbitals * 2
+
+# Build the qubit operator, which is the input to the VQE algorithm in Aqua
+ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)
+map_type = 'PARITY'
+qubitOp = ferOp.mapping(map_type)
+qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)
+num_qubits = qubitOp.num_qubits
+
+...
+```
+
+",9831,,,,,1/19/2020 15:52,,,,0,,,,CC BY-SA 4.0 +9593,2,,9587,1/19/2020 15:58,,1,,"

qiskit-aqua is the github repo in the link above. Chemistry is in the qiskit-aqua repo under qiskit.chemistry so

+ +

from qiskit.chemistry.components.variational_forms import UCCSD

+",9831,,,,,1/19/2020 15:58,,,,0,,,,CC BY-SA 4.0 +9594,2,,9431,1/20/2020 4:55,,-2,,"

In all honesty, I think quantum computing is a really, really bad place to start if your interested in computers.

+ +

It's much more like being a ""mathematician"" where you're locked alone in a basement and have to write papers on math that MIGHT be useful some day 200 years from now.

+ +

Learn to program on a classical computer first. And if you're interested in physics, why not start with learning how to do ""physics"" like things first. For instance, you could program a videogame like slime volleyball and add all sorts of realistic physics models. (Maybe nonelastic interactions? Air friction? You name it!)

+ +

If you are really thinking of going the ""physics track,"" that means a life in the world of ""academia,"" and you should really talk to a lot of people and see if it's right for you. It pays way less than other computer related professions, a lot of the work you might end up doing ends up having no real meaningful impact on the world or even in science, and the profession is swarmed with very few jobs and students with mental health issues.

+ +

If you're still interested. I would learn these topics (get a college textbook that's highly rated, and read it and do example problems): +""Algebra 2""(basically matrices and imaginary numbers), (skip trig & geometry, but learn what sin(x), cos(x), and e^ix are), calculus, differential equations, then some of ""modern physics"" (learn to solve schodingers equation & how they came up with it), THEN start with a SIMPLE quantum physics book. After you've mastered schrodingers equation, eigenvalues/eigenvalues, and you actually understand it - and aren't just like a robot plugging and chugging (which will probably take years of effort), then try to learn some ""theoretical programming"", topics like what P and NP are, what's big(O) notation? Only after that can you try to tackle a ""quantum computing"" problem, at the minimum.

+ +

There are people who will try to convince you that you only need to know linear algebra to do this type of work, while technically true, it's like telling someone they don't need to see where they are going in order to drive a car, since you're just turning a wheel and pushing on a pedal...while technically true it's completely ridiculous and will only end up with people getting hurt.

+",2660,,,,,1/20/2020 4:55,,,,1,,,,CC BY-SA 4.0 +9595,2,,9582,1/20/2020 13:01,,1,,"

The only thing that is physical about a quantum state $|\psi\rangle$ is its square overlaps with other states. In other words, given an arbitrary complete basis $\{|u_k\rangle\}_k$, what matter are the overlaps $p_k=|\langle u_k|\psi\rangle|^2$, and these are interpreted as outcome probabilities and must therefore be normalised as $\sum_k p_k=1$.

+ +

This tells you two things:

+ +
    +
  1. The global phase of $|\psi\rangle$ doesn't matter: changing $|\psi\rangle\to e^{i\phi}|\psi\rangle$ doesn't affect the probabilities $p_k$. This means that one less degree of freedom is needed to characterise the state.
  2. +
  3. The normalisation condition on the probabilities must always be satisfied, thus removing another degree of freedom.
  4. +
+ +

If the state is $N$-dimensional, then it amounts to $2N$ numbers as a real vector. Removing the two degrees of freedom as discussed above thus tells you that the number of real degrees of freedom characterising $N$-dimensional qudits is $2(N-1)$.

+",55,,,,,1/20/2020 13:01,,,,0,,,,CC BY-SA 4.0 +9597,1,,,1/20/2020 13:56,,6,1426,"

Is there anything practical that can be done with a single qubit? And by ""practical,"" I mean a problem that can be solved or information that can be stored.

+ +

I realize that one practical thing that you can do with a single qubit is to write a grant application to build a computer that has 9 qubits, but that is a bit too meta for this question.

+",9482,,,,,10/14/2022 0:03,Is there anything practical that can be done with a single qubit?,,3,2,,,,CC BY-SA 4.0 +9598,2,,8458,1/20/2020 13:59,,0,,"

An open question is whether IBM has created a single 53-qubit chip, or if they are mass-producing the 53-qubit chip. Based on press accounts, it appears that there is only a single chip, and that is a research machine.

+ +

MIT Technology Review reports that the new computer will be made available for researchers and companies through the Internet (which TR annoyingly calls ""the cloud""), so my guess is that there is only a single machine.

+",9482,,,,,1/20/2020 13:59,,,,0,,,,CC BY-SA 4.0 +9599,1,9600,,1/20/2020 14:15,,0,211,"

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 such operation is given by: +$$U = \frac{1}{\sqrt{3}}\begin{pmatrix}1&-\sqrt{2}\\ \sqrt{2} & 1 \end{pmatrix}$$ +So the question is, how can I build a quantum circuit with the usual quantum gates (X, Y, Z, etc) which reproduces this behavior?

+",9716,,,,,1/20/2020 14:38,How can I build up an arbitrary quantum circuit given a certain unitary matrix operation?,,1,1,,,,CC BY-SA 4.0 +9600,2,,9599,1/20/2020 14:38,,0,,"

You can use $Ry$ (y-rotation gate). Its general matrix is

+ +

$$ +Ry(\theta) = +\begin{pmatrix} +\cos(\theta/2) & -\sin(\theta/2) \\ +\sin(\theta/2) & \cos(\theta/2) +\end{pmatrix} +$$

+ +

Applying the gate on $|0\rangle$ state, you get a state

+ +

$$ +|\psi\rangle = \cos(\theta/2)|0\rangle + \sin(\theta/2)|1\rangle +$$

+ +

Hence $\cos(\theta/2) = \frac{1}{\sqrt{3}}$ and

+ +

$$ +\theta = 2\arccos\Big(\frac{1}{\sqrt{3}}\Big) = 1.910633. +$$

+ +

You can validate that such setting of $\theta$ gets your matrix $U$.

+",9006,,,,,1/20/2020 14:38,,,,0,,,,CC BY-SA 4.0 +9601,2,,8458,1/20/2020 17:13,,2,,"

The 53 qubit Rochester machine is available to members of the IBM Q Network only. Currently there are eight systems available to the public via the IBM Quantum Experience and by extension the Qiskit framework. The largest of these systems is currently 15 qubits.

+",332,,,,,1/20/2020 17:13,,,,0,,,,CC BY-SA 4.0 +9602,1,,,1/20/2020 18:20,,2,46,"

Persuant to all contributors, here I will use a coin toss analogy since the vector direction is either up or down (heads or tails). Two coins will be used for each of two tosses. It's assumed that the process will be one-shot (shots=1).

+ +

Toss one: Superposition will be applied using Hadamard gates on two qubits. Collapse will result in the following possible binary results: [00,01,10,11] (HH,HT,TH,TT).

+ +

For toss two: Of the four binary results of toss one, I will choose either 00 or 11.

+ +

I want to know how to prepare two qubits in an entangled state after either 00 or 11 is measured on those two independent qubits prepared with Hadamards in toss one.

+",9826,,9006,,1/23/2020 22:32,1/23/2020 22:32,Can two intrinsic angular momentum directions (spin) be used for future entanglement after collapse?,,0,2,,1/23/2020 18:17,,CC BY-SA 4.0 +9603,1,9604,,1/20/2020 18:57,,2,94,"

After stumbling upon this recent news article: Information teleported between two computer chips for the first time (which references a ""Nature Physics"" publication Chip-to-chip quantum teleportation and multi-photon entanglement in silicon)...

+ +
+

...with quantum teleportation, information appears to break that speed limit

+ +

Harnessing this phenomenon could clearly be beneficial, and the new study helps bring that closer to reality. The team generated pairs of entangled photons on the chips, and then made a quantum measurement of one. This observation changes the state of the photon, and those changes are then instantly applied to the partner photon in the other chip.

+
+ +

... I've been wondering what this specific break-through means for the state of quantum teleportation, if anything.

+ +

The quotes above would appear to imply that information can potentially be transported and used instantly, faster than the speed of light. Is that accurate though? My understanding was that because of its dependency on classical communication, quantum teleportation won't allow for faster-than-light communication in practice. Has that changed?

+",308,,,,,1/20/2020 19:15,"Quantum teleportation between two computer chips, how relevant?",,1,0,,,,CC BY-SA 4.0 +9604,2,,9603,1/20/2020 19:15,,4,,"

Information can't be transmitted faster-than-light using quantum teleportation protocol, because as you correctly noticed quantum teleportation involves classical communication between sender and receiver.

+ +

The paper's abstract is saying about implementing quantum teleportation using a particular technology (silicon integrated optics) for the first time. This is probably great, but it has nothing to do with faster-than-light communication.

+",2105,,,,,1/20/2020 19:15,,,,2,,,,CC BY-SA 4.0 +9606,2,,9597,1/21/2020 2:59,,18,,"

Some select examples of single qubit technology that has been used for decades:

+ +
    +
  • Atomic clocks are single qubit quantum information processors. (In fact, the natural transition frequency between the states of a specific qubit defines what humans mean by time.)
  • +
  • NMR Spectroscopy is typically applied to single qubits. (Well, ensembles of single qubits, but there is no entanglement between qubits in the ensemble. This actually less powerful than processing them one at a time.)
  • +
  • Quantum Random Number Generators use measurement of single qubits in superposition. (You can by machines that use polarisation of light to do this, for example.)
  • +
  • Interferometers are essentially dual-rail qubits. (Again, laser light in an interferometer is just an ensemble of such qubits and would be equivalent to waiting for the same number of single photons to traverse it one at a time.)
  • +
+ +

Possible future uses (nowhere near exhaustive or unbiased):

+ +
    +
  • Coherent measurement for binary classification (see, e.g., Quantum Data Gathering)
  • +
  • Quantum metrology for estimating phases (see, e.g., Quantum metrology with full and fast control)
  • +
  • Pedagogy (We'll never stop learning quantum starting with qubits. Having access to precision controlled single qubits would be useful in teaching.)
  • +
  • Test-beds for control (Even a large scale quantum computer will be run with single qubit gates at the physical level. Research in control and noise mitigation techniques on single qubits with remain relevant for quite some time.)
  • +
+",4407,,,,,1/21/2020 2:59,,,,4,,,,CC BY-SA 4.0 +9607,1,,,1/21/2020 7:22,,3,1963,"

We have been asked to measure relaxation and dephasing times T1 and T2 on the IBM Q using the composer only, Qiskit not allowed. I am a bit confused about the way to do so. Can someone explain the idea behind and how to implement the measurement in QASM?

+",9846,,55,,7/26/2020 18:08,7/26/2020 18:08,Measuring T1 and T2 constants on IBM Q,,2,0,,,,CC BY-SA 4.0 +9608,1,,,1/21/2020 10:45,,3,410,"

Is there a direct way to go from an object generated in openfermion to objects usable in Qiskit. I can't find anything about any plugin.

+ +

It's not too hard to translate into pyQuil and then to Qiskit from there, but a direct way would be much easier.

+",9849,,23,,2/2/2020 9:28,2/6/2020 9:41,Openfermion to qiskit,,0,3,,,,CC BY-SA 4.0 +9609,1,9612,,1/21/2020 12:21,,3,232,"

Google's article Quantum supremacy using a programmable superconducting processor states that the processor ""53 qubits, 1,113 single-qubit gates, 430 two-qubit gates, and a measurement on each qubit, for which we predict a total fidelity of 0.2%.""

+ +

Where are the gates physically located? In the diagram, the qubits are the crosses and the qubits are the couplers.

+ +

+",9482,,9006,,1/21/2020 13:48,1/22/2020 13:26,Where are the physical gates in the Google processor?,,1,3,,,,CC BY-SA 4.0 +9610,1,9613,,1/21/2020 13:29,,6,294,"

Let $N$ be the number we're trying to factor. In Shor's algorithm, the top register then has $2 \lceil\log_2(N)\rceil+1$ qubits, while the bottom register (the ancilla qubits) has $\lceil\log_2(N)\rceil$ qubits.

+ +

This is stated in my lecture notes on slide 25.

+ +

I believe I have an approximate understanding of Shor's algorithm: the end result on the top register, $\left| x_{\text{final}} \right>$, is such that $\frac{x_{\text{final}}}{T} = \frac{s}{r}$ for some integer $s$. In the aforementioned equation, $T=2^{2 \lceil \log_2(N) \rceil + 1}$ and $r$ is the oracle's (modular exponentiation) period.

+ +

The end result of the bottom (ancillary) register is the result of the modular exponentiation: $\left| f(x) + y \right> = \left| f(x) \right> = \left| a^x \mod N \right>$. The largest result possible is $N-1$, for which you require $\lceil \log_2(N - 1) \rceil$ qubits, so it makes sense that the size of the bottom register is $\lceil\log_2(N)\rceil$.

+ +

I do not however understand the choice of the size of the top register.

+",9408,,,,,1/21/2020 19:25,Why is the size of the top register for Shor's algorithm chosen as it is?,,1,0,,,,CC BY-SA 4.0 +9611,1,9618,,1/21/2020 13:41,,3,483,"

Consider Hilbert spaces $\mathcal{X}, \mathcal{Y}$. For any quantum channel $\mathcal{E}_{\mathcal{X}\rightarrow \mathcal{Y}}$, the bipartite Choi state $J(\mathcal{E}) \in L(\mathcal{Y}\otimes\mathcal{X})$ is given by

+ +

$$J(\mathcal{E}) = (\mathcal{E}\otimes I)\sum_{a,b} \vert a\rangle\langle b\vert\otimes\vert a\rangle\langle b\vert$$

+ +

It is also possible to show (see here for example) that the trace preserving condition of the map $\mathcal{E}$ is equivalent to the following condition on its Choi state

+ +

$$\text{Tr}_\mathcal{Y}J(\mathcal{E}) = I_\mathcal{X} \tag{1}$$

+ +

The proof is easy - it relies on noticing that the trace preserving condition implies that $\mathcal{E}(\vert a\rangle\langle b\vert) = \delta_{a,b}$ due to the trace preserving condition. Meanwhile, positive-semidefiniteness of $J(\mathcal{E})$ corresponds to complete positivity of $\mathcal{E}$.

+ +

If $J(\mathcal{E})$ is a density matrix but does not fulfill (1) is it still related to physical quantum channels (i.e. completely positive and trace preserving maps) in some way? Specifically, since completely positive maps correspond to positive semidefinite Choi matrices, does imposing that $\text{Tr}(J(\mathcal{E})) = 1$ (in addition to positive semidefiniteness) give us any condition on the map $\mathcal{E}$?

+",4831,,55,,3/5/2021 11:05,3/5/2021 11:05,"What does a ""Choi state"" where we relax the partial trace condition represent?",,1,0,,,,CC BY-SA 4.0 +9612,2,,9609,1/21/2020 15:14,,4,,"

In relating quantum computing to classical computing there may be a small conceptual hurdle that needs to be overcome. Although a classical $\mathsf{NAND}$ gate may be implemented in hardware (say CMOS with a set of N- and P-type transistors), the idea of a quantum gate such as a $\mathsf{CNOT}$ or an $\mathsf{H}$ gate used in quantum computing most often is a little more subtle.

+ +

Conventionally a quantum circuit including a number of quantum gates acting on qubits usually is meant to read with time progressing from left to right. Most quantum gates are not so much physical as in classical computing on CMOS, but are rather well-timed laser, or in the case of Sycamore, microwave pulses on the qubits/couplers. These pulses may excite a qubit from $\vert 0\rangle$ to $\vert 1\rangle$ or act as one qubit controlling another qubit, etc. In this sense, quantum gates are much more like opcodes than like a set of transistors arranged in parallel/series in the classical sense.

+ +

Accordingly the ""1,113 single-qubit gates, 430 two-qubit gates"" quoted in the Sycamore paper corresponds to these microwave pulses acting on the transmon qubits/couplers. My understanding is that in the case of Sycamore, different shapes of the microwave pulses generated by an automatic waveform generator acts on the qubits in different ways, thus realizing different gates at different times. In the classical setting we might have that assembly language opcodes are transcribed to machine code; in the quantum world we might have that quantum gates are transcribed to the shape of these pulses.

+ +

I believe that quantum gates acting on transmon qubits correspond to microwave pulses, and quantum gates acting on trapped ions correspond to similarly well-timed laser pulses.

+ +

Note that photons move at the speed of light, and I believe photonic quantum gates as proposed for example in Boson Sampling experiments include physical mirrors/beam splitters/etc. Thus, I think that photonic gates may be a bit more similar to classical gates, and may actually be implemented in hardware.

+",2927,,2927,,1/22/2020 13:26,1/22/2020 13:26,,,,1,,,,CC BY-SA 4.0 +9613,2,,9610,1/21/2020 19:25,,7,,"

In a nutshell, the number of qubits in the top register directly corresponds to the number of bits of precision to which $x/T$ approximates $s/r$, and we need enough precision to be able to determine $s$ and $r$ given $x/T$. For example, if $s=1$ and $r$ is large, then we cannot afford to confuse $1/r$ with $1/(r+1)$, say.

+ +

In more detail, think about any two fractions $a/b$ and $c/d$ with $a/b\not=c/d$, where $b$ and $d$ are both positive integers that are less than $N$. Because these are integers, and because $ad\not=bc$, we find that the difference between them satisfies the following inequality: +$$ +\Bigl| \frac{a}{b} - \frac{c}{d} \Bigr| = \frac{|ad-bc|}{bd} > \frac{1}{N^2}. +$$ +So, if $x/T$ is an approximation to $s/r$ that is good to $2\lceil\log(N)\rceil + 1$ bits of precision, the error of this approximation will be less than half of $1/N^2$, so the approximation has to be closer to $s/r$ than it is to any other fraction of a different value having a denominator smaller than $N$ (and of course the continued fraction algorithm will allow us to find $s$ and $r$ in this case, assuming they are relatively prime). It is not hard to see that we do in fact need this much precision in the worst case, as in the case of distinguishing $1/r$ from $1/(r+1)$ for $r$ close to $N$.

+",1764,,,,,1/21/2020 19:25,,,,0,,,,CC BY-SA 4.0 +9614,1,9615,,1/21/2020 20:45,,6,1180,"

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 to apply to the following circuit.

+ +

+ +

The first part, both Hadamard to first and second qubit:

+ +

$M_1 = H \otimes H \otimes I \otimes I$

+ +

Then, first Controlled NOT:

+ +

How can I apply a matrix to the first and second qubit if I have $M_1$ that is a 16x16 matrix. +I know I could have applied $H$ to the first qubit and then do a tensor product with $I$ (third qubit), and the result, multiply by $CX$. But then I have the second $CX$ which is applied to the first qubit and 4th qubit.

+ +

Symbol $\otimes$ is a tensor product.

+",9797,,9006,,1/21/2020 22:39,4/21/2020 15:51,How to interpret a 4 qubit quantum circuit as a matrix?,,1,0,,,,CC BY-SA 4.0 +9615,2,,9614,1/21/2020 22:38,,6,,"

Note: $I_k$ is unit matrix and $O_k$ is the zero matrix of order $k$ in the following text.

+ +

First step of the algorithm is $H \otimes H \otimes I_2 \otimes I_2$ as you mentioned.

+ +

A controlled gate $U$ with $n$ qubits between the control qubit and the target qubit can expressed as a matrix

+ +

$$ +CU_{n} = +\begin{pmatrix} +I_{\frac{N}{2}} & O_{\frac{N}{2}} \\ +O_{\frac{N}{2}} & I_{\frac{N}{4}} \otimes U +\end{pmatrix}, +$$

+ +

where $N = 2^{n + 2}$ (you can check that for $n=0$ and $U=X$ you will get CNOT matrix).

+ +

Now, how to apply this on CNOT acting on $q_{2}$ and controlled with $q_{0}$. In this case $n=1$ and $U=X$. Hence $N=2^{1+2}=8$ and CNOT in the second step of algorithm can be written as +$$ +CX_{1} = +\begin{pmatrix} +I_{4} & O_{4} \\ +O_{4} & I_{2} \otimes X +\end{pmatrix} +$$

+ +

After that there is a $I$ gate on qubit $q_{3}$, so the second step of the algoritm can be written as $CX_{1} \otimes I_{2}$.

+ +

Third step is CNOT gate with two qubits between control and target qubits ($N=2^{2+2} = 16$) hence its matrix is

+ +

$$ +CX_{2} = +\begin{pmatrix} +I_{8} & O_{8} \\ +O_{8} & I_{4} \otimes X +\end{pmatrix} +$$

+ +

Fourth step is simply $I_2 \otimes CNOT \otimes I_2$.

+ +

Fifth step is $I_2 \otimes CX_{1}$ (i.e. similarly as in the second step but matrices in Kronecker product are switched).

+ +

You can check that all matrices describing each step is 16x16. Now, you can multiply them all together to get final matrix representation of the algorithm.

+",9006,,9006,,4/21/2020 15:51,4/21/2020 15:51,,,,4,,,,CC BY-SA 4.0 +9616,2,,9607,1/22/2020 0:06,,4,,"

I cannot give you a complete answer(I am not too familiar with the IBM quantum tools) however I might be able to give you a few hints from a NMR/EPR perspective.

+ +

In magnetic resonance T2 is commonly measured by generating a spin coherence, and refocusing at progressively longer times then measuring a spin echo.

+ +

In quantum gate language that would be: prepare in state $|0\rangle$, Hadamard gate, $X$ or $Y$ gate, Hadamard gate, measure. And progressively add identity operations between the $H-X$ and $X-H$. Alternatively you can add progressively more $X$ gates and only measure at the odd numbered ones. Though I suppose the latter method would introduce gate errors into your measurement.

+ +

And T1 in magnetic resonance is usually measured by an inversion recovery: so prepare qubit in state $|0\rangle$, invert with $X$ or $Y$, and measure at progressively longer delays by using identity operations as delays.

+",9579,,9006,,1/24/2020 5:46,1/24/2020 5:46,,,,1,,,,CC BY-SA 4.0 +9618,2,,9611,1/22/2020 11:43,,2,,"

It is exactly what you say: A ""Choi state"" which is only positive semi-definite corresponds to a completely positive map which is not necessarily trace preserving. Fixing the trace of the Choi state rescales the ""success probability"" when implementing the CP map via the isomorphism - if you wish, it rescales the trace of all output states $\mathcal E(\rho)$ by a constant factor. (Note that deviating from the local trace condition $\mathrm{tr}_Y J = I$, but keeping the total trace $\mathrm{tr} J =1$, implies that there will be inputs with outputs with trace larger than one.)

+",491,,,,,1/22/2020 11:43,,,,0,,,,CC BY-SA 4.0 +9620,1,,,1/22/2020 14:25,,1,131,"

I am doing an state of the art study about the existing quantum computer technologies and one of the parameters of interest is the gate delay value, as it determines the time expected from a gate from such computer to make its operation, and consequently, it is important to see the coherence time that such computer presents.

+ +

I would like to know where can I find such values for the IBM quantum computers.

+",2371,,6180,,1/22/2020 14:48,1/22/2020 15:36,IBM quantum computers gate delay values,,2,0,,,,CC BY-SA 4.0 +9621,2,,9620,1/22/2020 15:16,,3,,"

The length of all backend basis gates is available from backend.properties().gate_length. For example

+ +
properties = backend.properties()
+id_gate_length_qo = properties.gate_length('id', 0)
+
+",9863,,,,,1/22/2020 15:16,,,,2,,,,CC BY-SA 4.0 +9622,2,,9620,1/22/2020 15:36,,1,,"

In addition to backend.properties() described above, you can go to https://quantum-computing.ibm.com, click a machine, then click ""Download Calibrations"".

+",7659,,,,,1/22/2020 15:36,,,,0,,,,CC BY-SA 4.0 +9623,1,9625,,1/22/2020 23:02,,7,751,"

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 like to argue in the following way.

+ +

First, we do have such a construction for $U=R_z(\theta)$ which is the following (sorry that I have to draw it by hand)

+ +

+ +

where the (reverse) CNOT has the matrix representation

+ +

$$ +\begin{bmatrix} +1 & 0 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0 \\ +0 & 1 & 0 & 0 \\ +\end{bmatrix} +$$ +such that we have the matrix representation of the circuit as +$$ +\begin{bmatrix} +1 & 0 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0 \\ +0 & 1 & 0 & 0 \\ +\end{bmatrix} +\big( +\begin{bmatrix} +1 & 0 \\ +0 & e^{-i\theta/2} +\end{bmatrix} +\otimes +\begin{bmatrix} +1 & 0 \\ +0 & e^{i\theta/2} +\end{bmatrix} +\big) +\begin{bmatrix} +1 & 0 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0 \\ +0 & 1 & 0 & 0 \\ +\end{bmatrix} = +\begin{bmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & e^{-i\theta/2} & 0 \\ +0 & 0 & 0 & e^{i\theta/2} \\ +\end{bmatrix} +$$

+ +

which is the desired matrix for $C^1(R_z(\theta))$. Thus we do a have a circuit with only two single qubit gates and CNOT for $U=R_z(\theta)$. Now for the rotation $U=R_x(\theta) = VR_z(\theta)V^\dagger$, which differ from $R_z$ by a unitary transformation V, we will need to ""sandwich"" the above circuit by some other gate. However, that is not possible by just one single qubit gate as we need unitary transformation on both sides of the circuit, despite we may merge two gates into one. Thus I feel that it is not possible for $U=R_{x,y}$. However, on the other hand, physically there is no difference between various rotation operators, it feels not right that only $R_z$ has such circuit construction but not for others. So I may have missed sth here, and any help and clarification is appreciated.

+",9816,,55,,1/24/2020 17:05,8/7/2022 6:42,Constructing a circuit for $C^1(U)$ for rotation operators with TWO single qubit gates and CNOT gate,,2,1,,,,CC BY-SA 4.0 +9624,2,,9597,1/23/2020 1:59,,3,,"

I particularly like this example of a single qubit quantum classifier. The idea is to use a variational approach to do ‘data reuploading’ and create a non-linear classifier, which has similarities to a single hidden layer neural network.

+ +

There’s an example implementation from Xanadu in Python along with a basic overview.

+",1937,,,,,1/23/2020 1:59,,,,0,,,,CC BY-SA 4.0 +9625,2,,9623,1/23/2020 7:38,,4,,"

The question comes in two parts. Firstly, for the top circuit, can you find the gates $A$, $B$ and $C$ such that $ABC=I$ and $CXBXA=R_x(\theta)$ or $R_y(\theta)$. Secondly, can you reduce either of these to the lower circuit with $AB=I$ and $XBXA=R_x(\theta)$ or $R_Y(\theta)$.

+ +

+ +

The first of these is detailed in the bit of Nielsen and Chuang just before the exercise, so I won't go through it here. (Equally, if I can do the second part, that's like the first part but setting $C=I$.)

+ +

For the second part, I'll do specifically for the $Y$ version. We know that we need $B=A^\dagger$, which means that $A^\dagger XA$ squares to $I$. So, we can certainly choose an $A$ such that $A^\dagger XA=\cos\theta X+\sin\theta Z$. Hence, $XBXA=\cos\theta I-i\sin\theta Y=R_Y(2\theta)$.

+ +

To identify $A$ in this case, note that we can write $X$ in the form $|+\rangle\langle +|-|-\rangle\langle -|$ and the target unitary $\cos\theta X+\sin\theta Z$ as $|u\rangle\langle u|-|v\rangle\langle v|$ with $\langle u|v\rangle=0$. So, we simply define +$$ +A=|+\rangle\langle u|+|-\rangle\langle v|, +$$ +and this achieves the desired transformation. Alternatively, I could predict (this comes with experience. The reliable way is the way I just stated.) that $A$ would be of the form $R_Y(\phi)$. Then we'd see +$$ +A^\dagger XA=XA^2=XR_Y(2\phi)=X\cos\phi-\sin\phi Z, +$$ +and you just have to choose the correct value of $\phi$ to give you the $\theta$ that you want.

+ +

On the other hand, note that we cannot achieve the controlled-$X$ rotation. Here, you would need $BA=I$ (i.e. $B=A^\dagger$) and $XBXA=R_x(\theta)$. Now observe that these two conditions could be rewritten as $BA=I$ and $BXA=R_x(\theta+\pi)$, so if you could achieve it, you would be able to achieve it with only a single c-not gate. However, the seqeunce with only a single c-NOT gate squares to $I$, meaning the $R_x(\theta+\pi)$ would have to have eigenvalues $\pm 1$, meaning $\theta=0$ or $\pi$ are the only possible values (which is exactly the do nothing and controlled-not gates up to some possible permutations).

+",1837,,1837,,1/24/2020 8:49,1/24/2020 8:49,,,,5,,,,CC BY-SA 4.0 +9626,1,,,1/23/2020 11:07,,7,1361,"

Consider the $X$ gate. Mathematically, we have $X=i e^{-i\frac{\pi}{2} X}$

+ +

But as global phase of unitaries don't matter because they will simply act a global phase to the wavefunction, we can consider implementing $X$ by $e^{-i\frac{\pi}{2} X}$, allright.

+ +

Now, consider a CNOT. Formally, we have:

+ +

$$CNOT=|0\rangle \langle 0| \otimes \mathbb{I} + |1\rangle \langle 1| \otimes X $$

+ +

If at this point I say ""well, a $X$ gate or a $\pi$ rotation around $x$ is the same, up to global phase"", I could say:

+ +

$$CNOT=|0\rangle \langle 0| \otimes \mathbb{I} + |1\rangle \langle 1| \otimes e^{-i\frac{\pi}{2} X} $$

+ +

But the two expressions of the CNOT do not differ from a global phase.

+ +

My question is the following.

+ +

Let's assume we want to implement an algorithm. Is it that we have at the beginning to define once for all how we implement an $X$ gate, and be consistant all along.

+ +

For example, if as soon as there is an $X$ in the algorithm and that I replace it by $e^{-i\frac{\pi}{2} X}$, then I will be fine.

+ +

But, if sometime I replace it by $ie^{-i\frac{\pi}{2} X}$ and sometime by $e^{-i\frac{\pi}{2} X}$ then I will have problems.

+ +

So here, indeed my two definitions of CNOT do not implement the same unitary, but if they were inside of an algorithm and that I had chosen a fixed convention for $X$, then I will be safe ?

+ +
+ +

Other question (more important for my purpose).

+ +

Let's assume I can only do single qubit rotations on which I might have a quantum control on it (I can do controlled rotation in the end).

+ +

How is it possible from this to implement a CNOT operation ? Indeed this example shows that a CNOT is not a controlled $\pi$-pulse around $x$. How could I add the $i$ that is missing in practice then ? Because from respect to the target qubit this $i$ is a global phase. This confuses me.

+",5008,,5008,,1/23/2020 12:57,1/23/2020 21:13,Global phase and single qubit gate: does it actually matter for two (or more) qubit gates?,,1,5,,,,CC BY-SA 4.0 +9627,1,,,1/23/2020 13:18,,5,426,"

Sender and receiver use the teleportation protocol, where the sender teleports a quantum state $\left| \varphi \right>=\alpha\left| 0 \right> + \beta \left|1\right>$ to the receiver.

+ +

I want to implement this protocol, and then find the output $\left| ABC \right>$ of the quantum circuit when the measurement of the teleportation protocol in the left side is $\left| 11\right>$.

+ +

In other words: when we measure $|11\rangle$, how to show that the state $|\varphi\rangle$ was really teleported?

+ +

+",9700,,55,,11/10/2020 17:35,1/25/2022 15:45,Compute the output of the quantum teleportation circuit,,1,3,,,,CC BY-SA 4.0 +9628,1,,,1/23/2020 17:42,,3,114,"

Consider a state $\rho_{AB}$. Let it have purification $\psi_{A'AB}$. I am interested in the coherent information of this state which is given by

+ +

$$I(A\rangle B)_\rho = S(B)_\rho - S(AB)_\rho$$

+ +

I can rewrite this as follows using the fact that $\psi_{A'AB}$ is pure. +\begin{align} +I(A\rangle B) &= S(B)_\rho - S(AB)_\rho\\ +&=S(A'A)_\psi - S(A')_\psi \\ +&= S(A|A')_\psi +\end{align}

+ +

Now let us consider $J(A\rangle B) = -I(A\rangle B)$. We have +\begin{align} +J(A\rangle B) &= S(AB)_\rho - S(B)_\rho\\ +&= S(A|B)_\psi +\end{align}

+ +

But the quantum conditional entropy $S(X|Y)$ is a concave function of the input state (see Corollary 11.13 in Nielsen and Chuang). So both $J$ and $I$ are concave. This would imply that the coherent information is a linear function of $\psi_{A'AB}$ which I believe is not true. Where did I make a mistake in the argument?

+",4831,,55,,11/4/2020 16:02,11/4/2020 16:02,Convexity of coherent information - erroneous argument!,,0,2,,,,CC BY-SA 4.0 +9629,2,,9567,1/23/2020 19:30,,0,,"

Basicaly what happened is that dotnet didn't add itself to path. Path is an environment variable which is basically a list of paths to find executable. You can see it by simply typing PATH in the command prompt. You have to add the path to your dotnet tools which should be %USERPROFILE%/.dotnet/tools in the control panel. Look on the internet about how to do it, there are plenty tutorials. The problem should be solved.

+",8746,,,,,1/23/2020 19:30,,,,0,,,,CC BY-SA 4.0 +9630,2,,9626,1/23/2020 21:13,,8,,"

What is this business of global phase?

+ +

Unfortunately, most people encounter this when seeing their first calculation and the teacher says, ""we can just get rid of that because overall phases don't matter."" But where does this come from? First, the math answer:

+ +

States of quantum systems are properly modelled as complex projective spaces. (More loosely: 1 dimensional subspaces of the Hilbert space.)

+ +

In direct notation, the statement is saying the state $|\psi\rangle$ is really the projector $|\psi\rangle\!\langle\psi|$. Now consider the state defined as +$$ |\psi_\theta\rangle = e^{i \theta}|\psi\rangle. +$$ +Its corresponding projector is +$$ |\psi_\theta\rangle\!\langle\psi_\theta|= e^{i \theta}|\psi\rangle\!\langle\psi| e^{-i\theta} = |\psi\rangle\!\langle\psi|. +$$ +The exact same projector!

+ +

You could just take this as the first axiom of quantum theory and be done with it. But that is not all that useful unless you are interested in mathematical physics. (Which you should be because its cool.)

+ +

Another answer is that overall phases always drop out at the end of any calculation. Consider again the state defined as +$$ |\psi_\theta\rangle = e^{i \theta}|\psi\rangle. +$$ +You could carry that phase through the whole calculation. But quantum calculations always end with a modulus inner product: +$$ +|\langle\phi|\psi_\theta\rangle|^2=|e^{i\theta}\langle\phi|\psi\rangle|^2 = |e^{i\theta}|^2|\langle\phi|\psi\rangle|^2. +$$

+ +

The important part here is that such a calculation is only ever done on the entire system. Phases can be removed not be because they are unphysical or don't matter, but because they are inconvenient in some calculations.

+ +

Another way to think about it is: two states can be considered the ""same"" if there is no experiment you can do which will distinguish them. The same would be true of two measurements and two operations. In your case, you identified that the two different unitaries could be distinguished with an experiment, so they are not the same. Now, if the entire system were two qubits, then $CNOT$ and $e^{i\theta} CNOT$ could be considered equivalent, but not if they were part of a larger system.

+",4407,,,,,1/23/2020 21:13,,,,0,,,,CC BY-SA 4.0 +9631,1,,,1/24/2020 5:42,,0,271,"

I have been experimenting with Qiskit lately, but I have found the implementation of algorithms in Aqua extremely confusing. Currently I am trying to implement a very simple circuit that will return the eigenvalues of a 2x2 unitary operator, for example Pauli X. The problem is that I don't know which class I should use: is it PhaseEstimationCircuit from qiskit.aqua.circuits.phase_estimation_circuit or EigsQPE from qiskit.aqua.components.eigs.eigs_qpe or any of the many similarly named modules. An example tentative is shown below.

+ +

pauli = Pauli( z=[0], x=[1], label=None) +weighted_pauli = WeightedPauliOperator(paulis=[(1,pauli)]) +a = qpc.construct_circuit()

+ +

The circuit a does not seem to be the correct one. More objectively, is there anyway to reproduce a QPE circuit as the one shown in Wikipedia through Aqua?

+",9877,,,,,1/24/2020 14:19,Right way to use Quantum Phase Estimation using aqua,,2,0,,,,CC BY-SA 4.0 +9632,2,,9607,1/24/2020 9:06,,3,,"

Lets start with measuring circuits. With link to user245427 answer, you should construct following circuits in composer followingly:

+ +

T1 (relaxation time)

+ +

T1 is constant connected with spontaneous relaxation from state $|1\rangle$ to state $|0\rangle$. So firstly apply $X$ gate on a qubit to change its state from $|0\rangle$ to $|1\rangle$, then apply a few $I$ gates to make a delay and then measure results. Record a probability of measuring state $|1\rangle$ (i.e. relaxation did not occur).

+ +

T2 (dephasing time)

+ +

T2 is connected with change in phase, for example state $|+\rangle$ changes spontaneously to $|-\rangle$. To prepare $|+\rangle$ apply $H$ gate on qubit in state $|0\rangle$. Then apply several $I$ gates to make a delay. After that apply again $H$ gate and do measurement. Record probability of measuring state $|0\rangle$ (i.e. phase change did not occur).

+ +

T1 and T2 calculation

+ +

Both decoherence processes are described by exponential decay law:

+ +

$$ +P(t) = \mathrm{e}^{-\frac{t}{T}} +$$

+ +

where $T$ is eiher T1 or T2 constant, $t$ is time between setting qubit to either state $|1\rangle$ for T1 or $|+\rangle$ for T2 and its measurment. Having probabilities that a qubit is in state either $|1\rangle$ and $|+\rangle$ and knowing $t$ you can easily calculate

+ +

$$ +T = -\frac{t}{\ln P(t)}. +$$

+ +

Although it is not problem to construct such circuits on IBM Q, I realized that the problem is how to obtain time $t$. After simulation you get results with time the simulation actually run on a quantum processor. It seems logical to divide this time with number of shots to get length of one shot and hence $t$. I did so on Melbourne processor but it seems that some other operations take place among shots which lengthen time $t$. As a result you can not get actual time $t$. If you put lenght of simulation to the formula above, resulting T1 is in order of miliseconds which does not make sense.

+",9006,,,,,1/24/2020 9:06,,,,0,,,,CC BY-SA 4.0 +9633,2,,9631,1/24/2020 11:41,,0,,"

I believe this tutorial takes you through how to find eigenvectors. They use EigsQPE, through a helper function they define themselves, called create_eigs().

+",5955,,,,,1/24/2020 11:41,,,,0,,,,CC BY-SA 4.0 +9634,1,9636,,1/24/2020 12:42,,3,177,"

I've seen many articles in the popular press saying that quantum computers will enable searching through huge amounts of data in an instant. But I can't figure out how the current architectures can do that at all, things like Google's Sycamore architecture don't even have storage. There is literally nothing to search except for the state space that results from the configuration of the gates (and that seems to be an RF signal that is spread out over time).

+ +

So how will quantum computers search anything, other than tuning parameters?

+",9482,,9006,,1/24/2020 13:49,1/25/2020 5:28,How will quantum computers access large amounts of storage?,,2,0,,,,CC BY-SA 4.0 +9635,1,9639,,1/24/2020 13:20,,11,1156,"

I sometimes see the ""Fubini-Study distance"" between two (pure) states $|\psi\rangle,|\phi\rangle$ written as +$$ +d(\psi,\phi)_1=\arccos(|\langle\psi|\phi\rangle|), +$$ +for example in the Wikipedia page. +Other sources (e.g. this paper in pag. 16), use the definition +$$ +d(\psi,\phi)_2=\sqrt{1-|\langle\psi|\phi\rangle|}. +$$

+ +

What is the difference between these two definitions? Is one preferred over the other?

+",55,,4407,,1/25/2020 0:23,10/29/2020 8:01,"What is the difference between the ""Fubini-Study distances"" $\arccos|\langle\psi|\phi\rangle|$ and $\sqrt{1-|\langle\psi|\phi\rangle|}$?",,2,5,,,,CC BY-SA 4.0 +9636,2,,9634,1/24/2020 13:48,,2,,"

Qiskit and other programming languages allow to write a hybrid algorithms, i.e. combination of classical and quantum algorithm. Inputs to quantum algorithm can be pre-processed on classical computer and results produced by quantum computers can be post-processed again classically.

+ +

You are right that storage is still a problem. So far quantum RAM (qRAM) was proposed. However, it also face problems such a decoherence.

+ +

You can find a proposal of quantum RAM architecture here: Quantum random access memory

+ +

Some discussion on qRAM is on this forum here.

+ +

Overall, data can be stored classically and access via hybrid algorithms. However, in this case part of quantum speed-up is lost.

+",9006,,,,,1/24/2020 13:48,,,,5,,,,CC BY-SA 4.0 +9637,2,,9631,1/24/2020 14:19,,1,,"

As a general comment Aqua has function at different levels, algorithms such as VQE, QPE, HHL etc, pluggable components that were designed to be replaceable 'parts' of algorithms such as Variational Forms, Optimizers, Uncertainty models etc, and then there are circuits which can be used to build any of the above.

+ +

When it comes to Phase Estimation it's a technique used in a number of places in algorithms and components as well. QPE, IQPE expose phase estimation in the form of as an algorithm with an intent of finding the min eigenvalue. AmplitudeEstimation algorithm is another example of an algorithm that uses phase estimation. The eigs component you indicated was designed initially for HHL to allow different forms of eigenvalue support for it, and uses phase estimation. PhaseEstimationCircuit is used by all the above and is the lowest level 'building block' for this in Aqua.

+ +

PhaseEstimationCircuit can take either an Aqua Operator, such as WeightedPauliOperator, which you can create from Paulis, or a unitary circuit that implements the circuit factory in utils folder. The components and algorithms that use PhaseEstimation circuit may just work with one of these types that the circuit supports. Ultimately the 'right way' depends on what you want to do and the set of functionality in Aqua that can address what you want to do.

+ +

Hope this helps explain why you see phase estimation in a number of places. I see you have already been indicated the HHL tutorial that has eigs_qpe used. Hopefully the above explanation and that tutorial helps. You can find other tutorials on QPE and IQPE etc if they might be of help too.

+",9831,,,,,1/24/2020 14:19,,,,0,,,,CC BY-SA 4.0 +9638,2,,5462,1/24/2020 22:06,,0,,"

@ahelwer has provided a smart construction, and I will provide a more brute-force method as a complementary for beginners like me. It actually starts out by listing all the possible 16 moves. Let x,y=0,1,2,3, then all the possible moves are

+ +

$ +x=0, \quad y=(0123)\rightarrow(0123) \\ +x=1, \quad y=(0123)\rightarrow(1230) \\ +x=2, \quad y=(0123)\rightarrow(2301) \\ +x=3, \quad y=(0123)\rightarrow(3012) +$

+ +

where by arrow we mean $y$ is treated as an output. So if we denote $|xy\rangle\equiv|x\rangle|y\rangle=|ab\rangle\ |cd\rangle$, for $a,b=0,1$, we have

+ +

$ +|00cd\rangle \rightarrow |00cd\rangle +$

+ +

and +$ +|0100\rangle \rightarrow |0101\rangle \\ +|0101\rangle \rightarrow |0110\rangle \\ +|0110\rangle \rightarrow |0111\rangle \\ +|0111\rangle \rightarrow |0100\rangle +$

+ +

and +$ +|1000\rangle \rightarrow |1010\rangle \\ +|1001\rangle \rightarrow |1011\rangle \\ +|1010\rangle \rightarrow |1000\rangle \\ +|1011\rangle \rightarrow |1001\rangle +$

+ +

and +$ +|1100\rangle \rightarrow |1111\rangle \\ +|1101\rangle \rightarrow |1100\rangle \\ +|1110\rangle \rightarrow |1101\rangle \\ +|1111\rangle \rightarrow |1110\rangle +$

+ +

which are exactly the rules @ahelwer described. This is not surprised from the perspective of addition of binary numbers. In terms of matrices, the above actions read

+ +

$ +I_4, \begin{bmatrix} +& I_3 \\ +1 +\end{bmatrix}, +\begin{bmatrix} + & I_2 \\ +I_2 +\end{bmatrix}, +\begin{bmatrix} +& 1\\ +I_3 +\end{bmatrix} +$

+ +

respectively for the above four sectors. Since the matrices acting on different sectors (the big $16\times16$ matrix is block-diagonal), we can construct them separately. In particular, we notice for the $|01\rangle$ sector,

+ +

$ +\begin{bmatrix} +& I_3 \\ +1 +\end{bmatrix}=\begin{bmatrix} +I_2 & \\ +& X +\end{bmatrix} +\begin{bmatrix} +1 & \\ +& X\\ +& & 1 +\end{bmatrix} +\begin{bmatrix} +X & \\ +& I_2 +\end{bmatrix} +$

+ +

which is CNOT conditioned by the first qubit being zero, followed by SWAP, and followed by CNOT. Similarly for the $|11\rangle$ space, which is just the hermitian conjugate. For $|10\rangle$, it is

+ +

$ +\begin{bmatrix} + & I_2 \\ +I_2 +\end{bmatrix} = X\otimes I_2 +$

+ +

Thus the complete circuit is attached below. As we explained above, since the three units (boxed by dashed lines) acting on different subspace, they commute and we can move them in different orders.

+ +

+",9816,,,,,1/24/2020 22:06,,,,0,,,,CC BY-SA 4.0 +9639,2,,9635,1/24/2020 22:30,,9,,"

Recall the law of cosines for two unit vectors $\mathbf{u}$ and $\mathbf{v}$ in $\mathbb R^2$: +$$ +\|\mathbf{u}-\mathbf{v}\|^2 = 2-2\cos\theta, +$$ +where $\theta$ is the angle between the vectors. Similarly, you'll recall the definition of the inner product, +$$ +\langle \mathbf u|\mathbf {v}\rangle = \cos\theta. +$$ +So, +$$ +\|\mathbf{u}-\mathbf{v}\| = \sqrt{2}\sqrt{1- \langle\mathbf{u}|\mathbf{v}\rangle}. +$$ +For these unit vectors in $\mathbb R^2$, $\theta$ is the arc length on the unit circle intersecting these vectors. It is a distance. In your notation, $d(\mathbf{u},\mathbf{v})_1$ is the arc length and $d(\mathbf{u},\mathbf{v})_2$ is the Euclidean distance. Before we generalize to quantum states, you should note that nothing said so far would suggest one is preferred over the other.

+ +

For complex vectors we can do something analogous. Define the ""Hermitian angle"" of two complex vectors $\psi$ and $\phi$ in $\mathbb C^n$ to be +$$ +\cos\theta = |\langle\psi|\phi\rangle|. +$$ +Now consider +$$ +\|\psi -\phi\|^2 = 2-2\Re[\langle\psi|\phi\rangle] \geq 2-2|\langle\psi|\phi\rangle|. +$$ +So you can see that $d(\psi,\phi)_1$ and $d(\psi,\phi)_2$ are analogous, but not quite, the arc length and distance between the quantum states.

+ +

Both are distances and both are referred to by the name ""Fubini-Study"". This sort of overloading of definitions is unfortunate but happens all the time. For example, quantum fidelity could mean one of two things as well, and they differ quadratically.

+ +

When trying to generalize things from simple cases, there are many choices and so we end up with lots of different distances. (Just wait until you find out how many their are for matrices!) Just as there is no objective way to choose between arc length and Euclidean distance, there is no objective way to choose between the Fubini-Study distances.

+ +

Why does a particular researcher use one over the other? The answer varies, but it could be convenience—sometimes you choose the definition for which you can prove things about. Other times, a scenario is set up so a particular definition has a physical or operational meaning—you might be able to connect it to something measurable or it could correspond to the success of some protocol. But without some assumptions in the set-up of the problem, there is no preferred distance.

+",4407,,,,,1/24/2020 22:30,,,,2,,,,CC BY-SA 4.0 +9640,2,,9634,1/25/2020 5:28,,2,,"

Typically, quantum search algorithm searches through a very large solution spaces that can represented by logarithmic scale of data, not directly over huge amount of data. An example is travelling salesman problem where the input data are the distances between cities, but each solution is a path and the space to be searched is exponential in terms the number of cities.

+ +

Nielsen and Chuang’s book suggested two approaches to search really unstructured data directly, by using a quantum memory, or by quantum access to classical memory.

+",8321,,,,,1/25/2020 5:28,,,,2,,,,CC BY-SA 4.0 +9641,1,9653,,1/25/2020 9:22,,3,273,"

I am trying to check the way qiskit has the noise implemented. I have read how is this theoretically done using quantum channels (see Nielsen and Chuang chapter 8) and I want to verify if qiskit follows the same procedure. I have started by the bit-flip error using the pauli_error function. Finally it creates a quantum error object which can be added to the NoiseModel object. However when adding this you have to use the add_all_qubit_quantum_error function and I do not really understand how this works. It is supposed to add the quantum error to all qubits when given a set of gates as an argument, as in the following example:

+ +
# Example error probabilities
+p_reset = 0.03
+p_meas = 0.1
+p_gate1 = 0.05
+
+# QuantumError objects
+error_reset = pauli_error([('X', p_reset), ('I', 1 - p_reset)])
+error_meas = pauli_error([('X',p_meas), ('I', 1 - p_meas)])
+error_gate1 = pauli_error([('X',p_gate1), ('I', 1 - p_gate1)])
+error_gate2 = error_gate1.tensor(error_gate1)
+
+# Add errors to noise model
+noise_bit_flip = NoiseModel()
+noise_bit_flip.add_all_qubit_quantum_error(error_reset, ""reset"")
+noise_bit_flip.add_all_qubit_quantum_error(error_meas, ""measure"")
+noise_bit_flip.add_all_qubit_quantum_error(error_gate1, [""u1"", ""u2"", ""u3""])
+noise_bit_flip.add_all_qubit_quantum_error(error_gate2, [""cx""])
+
+print(noise_bit_flip)
+
+ +

However I do not know when the bit-flit is applied. Is it applied everytime one gate that can be decomposed in any of the ones of the list [""u1"", ""u2"", ""u3""]? What I need to know is how often it is applied and with which criterion.

+ +

Thank you for your help!

+",9887,,55,,7/26/2020 18:19,7/26/2020 18:19,How is quantum error applied to the qubits?,,1,0,,,,CC BY-SA 4.0 +9642,2,,9627,1/25/2020 9:22,,6,,"

Since your circuit is teleportation, $|C\rangle =|\varphi\rangle$ and since you measured $|11\rangle$ on $|AB\rangle$ the answer is $|ABC\rangle = |11\rangle|\varphi\rangle$.

+ +

Now, let look why this is true.

+ +

Firstly Hadamard and CNOT gate on second and third qubit prepares entangled Bell state $|\beta_{00}\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$.

+ +

Now the circuit is in state

+ +

$$ +|\varphi\rangle|\beta_{00}\rangle = \frac{1}{\sqrt{2}}(\alpha|0\rangle+\beta|1\rangle)(|00\rangle + |11\rangle) = \frac{1}{\sqrt{2}}[\alpha|0\rangle(|00\rangle + |11\rangle) + \beta|1\rangle(|00\rangle + |11\rangle)] +$$

+ +

Then you apply CNOT controlled by first qubit and targeting second qubit. This will negate second qubit in case the first qubit is in state $|1\rangle$. This means that only part $\beta|1\rangle(|00\rangle + |11\rangle)$ is influenced.

+ +

Now, state of the circuit is changed to

+ +

$$ + \frac{1}{\sqrt{2}}[\alpha|0\rangle(|00\rangle + |11\rangle) + \beta|1\rangle(|10\rangle + |01\rangle)] +$$

+ +

Application of Hadamard gate on the first qubit change the state further to

+ +

$$ + \frac{1}{2}[\alpha(|0\rangle + |1\rangle)(|00\rangle + |11\rangle) + \beta(|0\rangle - |1\rangle)(|10\rangle + |01\rangle)] +$$

+ +

because $H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ and $H|1\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$.

+ +

Since you will measure first and second qubit, it is convenient to rearange the state to separate first two qubits. So, you can rewrite the state as

+ +

$$ +\frac{1}{2} \big( |00\rangle(\alpha|0\rangle + \beta|1\rangle) ++ |01\rangle (\alpha|1\rangle + \beta|0\rangle) ++ |10\rangle (\alpha|0\rangle - \beta|1\rangle) ++ |11\rangle (\alpha|1\rangle - \beta|0\rangle) \big) +$$

+ +

In your case you measured $|11\rangle$ on first and second qubit. This means that the third qubit is in state

+ +

$$ +(\alpha|1\rangle - \beta|0\rangle) +$$

+ +

Since both first and second qubits are in state $|1\rangle$ both CNOT gates after measurement will be activated. The first one change the state of third qubit to

+ +

$$ +(\alpha|0\rangle - \beta|1\rangle) +$$

+ +

Next two Hadamards together with CNOT implements controlled $Z$ gate which change a phase to oposite in case input qubit is in state $|1\rangle$. This leads to final state of third qubit

+ +

$$ +(\alpha|0\rangle + \beta|1\rangle) +$$

+ +

Hence, you can see that state from first qubit was teleported to third qubit.

+ +

Note: based on Nielsen and Chuang, pg. 27 and expanded

+",9006,,10065,,3/18/2020 11:31,3/18/2020 11:31,,,,0,,,,CC BY-SA 4.0 +9643,2,,8908,1/25/2020 11:19,,0,,"

You can also run QML/QAI on a real Quantum Computer using Qiskit.

+ +

Here are two sample Jupyter Notebooks for qSVM and qGAN. +https://quantum-computing.ibm.com/jupyter/tutorial/advanced/aqua/artificial_intelligence/index.ipynb

+",9889,,,,,1/25/2020 11:19,,,,0,,,,CC BY-SA 4.0 +9644,1,,,1/25/2020 20:55,,2,129,"

Quantum algorithms are inherently probabilistic. Let's say I run Shor's factoring algorithm on some number. There's a chance that the output I observe is incorrect. Does the many-worlds theory suggest that I'm simply in a universe where the output happened to be wrong? Because the probability of error is slim, does that mean the vast majority of universes realize a correct execution of the algorithm?

+ +

Edit: Thanks to Mark S for pointing me to Effects of quantum computing on parallel universes which fully explores my question. Also, a big thanks to everyone who commented here! The questions raised and resources raised have only helped to enhance my curiosity about the subject.

+",8438,,8438,,1/30/2020 16:47,1/30/2020 16:47,Quantum computing w.r.t. the many-worlds theory,,1,2,,1/29/2020 14:23,,CC BY-SA 4.0 +9645,2,,9644,1/25/2020 21:36,,0,,"

Quantum algorithm can give answers with 100% certainty. For example, Grover's algorithm can give the answer with certainty when the ratio of ""good"" items to ""bad"" items satisfies some constraints. The uncertainty exists when the output state is not an eigenstate of the measurement observable.

+ +

On the other hand, Shor's algorithm is a hybrid of classical and quantum steps. The quantum order finding step might fail to find an appropriate ""order"" in an iteration, but you cannot say it is incorrect. Instead, the measurement gives one of the phases of the unitary operator $U|y\rangle =|xy \text{(mod } N\text{)}\rangle$, the phase can then be used to derive the order classically. However only some of these orders can be used to find the factors. If the order found after measurement is not appropriate, Shor's algorithm need to repeat the quantum step (together with some classic steps). (There are multiple phases because the input $|1\rangle$ is a superposition of many eigenvectors associated with these phases.)

+ +

Many word theory is more philosophical than computationally or informational. Using this theory, at least one of the world will find an appropriate order in the first iteration and Shor's algorithm will stop quicker. In some world, all iterations fail (as long as you continue) to find the appropriate order and Shor's algorithm will not finish. Of course, Shor proved that the probability of not finishing can be arbitrarily low given enough iterations.

+ +

Some people reject many world theory using a joke: you can believe it in the other worlds. To me, the challenge is where does the (exponential, enormous) extra energy come as worlds split all the time?

+",8321,,8321,,1/26/2020 17:48,1/26/2020 17:48,,,,9,,,,CC BY-SA 4.0 +9646,2,,4434,1/25/2020 22:06,,0,,"

I took a quick look at the QCL paper, it seems that & is shown as concatenation of quantum register, which can be viewed as tensor product of the quantum states in the two operand registers. For tensor product of operators, you can apply them one after the other, but on different qubits: $(A\otimes I)(I\otimes B)=A\otimes B)$.

+",8321,,,,,1/25/2020 22:06,,,,0,,,,CC BY-SA 4.0 +9647,1,,,1/25/2020 22:09,,2,43,"

I'm trying to run a simulation of the following circuit:

+ +

+ +

on the ibmq_qasm_simulator, but it only shows the ""Circuit diagram"" without the ""Circuit Implementation"" and ""Results tab"". +Did someone had that problem before ?

+ +

Note: Ever since it happened, every simulation I ran before started to have this problem too.

+",9892,,9006,,1/25/2020 23:44,1/25/2020 23:44,Problem with circuit composer results tab,,0,5,,,,CC BY-SA 4.0 +9648,1,9655,,1/25/2020 23:08,,7,549,"

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 \rangle + \beta_2 \vert 1 \rangle}\\ +\color{blue}{\vert Q_3 \rangle = \alpha_3 \vert 0 \rangle + \beta_3 \vert 1 \rangle} +$$ +where $\forall i : \,\,|\alpha_i|^2 + |\beta_i|^2 = 1$.

+ +

I then decide to entangle all these qubits to obtain: +$$ +\vert \psi \rangle = \alpha \vert \color{red}{0}\color{green}{0}\color{blue}{0} \rangle + \beta \vert \color{red}{1}\color{green}{1}\color{blue}{1} \rangle +$$ +where $|\alpha|^2 + |\beta|^2 = 1$.

+ +

Now, I realize that I don't need the second qubit to be entangled with the others, so I unentangle it to obtain the following: +$$ +\begin{align} +\vert \psi \rangle &= \alpha \vert \color{red}{0}\color{blue}{0} \rangle + \beta \vert \color{red}{1}\color{blue}{1} \rangle +\end{align} +$$ +I don't really care about qubit two anymore. It can be measured to destroy its superposition or even be set to anything else. The point is I unentangle it from the system. Is such thing possible? If yes, what is the mathematics and the physical realization behind this?

+",7528,,55,,1/27/2020 14:27,1/27/2020 14:27,Unentangling a qubit from a system: can we convert $\alpha|000\rangle+\beta|111\rangle$ into $\alpha|00\rangle+\beta|11\rangle$?,,3,0,,,,CC BY-SA 4.0 +9649,2,,9648,1/25/2020 23:38,,3,,"

First of all, you cannot describe entanglement with tensor product. Resulting state of $q_0 \otimes q_1 \otimes q_2$ will be

+ +

$$ +|\varphi\rangle = \sum_{i=000}^{111}a_{i}|i\rangle, +$$ +i.e. $i$ is $|000\rangle$,$|001\rangle$...$|111\rangle$; and $\sum_{i=0}^{n}|a_{i}|^2 = 1$.

+ +

To obtain state $\alpha|000\rangle + \beta|111\rangle$ you have to employ circuit similar to this:

+ +

+ +

In this case $\alpha = \beta = \frac{1}{\sqrt{2}}$. To change $\alpha$ and $\beta$ you should replace Hadamard gate with for example $U3$ gate to set these constants according to your requirements.

+ +

To unentangle second qubit, you should appply inverse operation to the one which created the entanglement. In this case, it was CNOT gate. As inverse to CNOT is CNOT itself, the circuit where qubits $q_0$, $q_1$ and $q_2$ were firstly entangled and then qubit $q_1$ was unentangled is this:

+ +

+",9006,,9006,,1/26/2020 7:33,1/26/2020 7:33,,,,0,,,,CC BY-SA 4.0 +9651,1,,,1/26/2020 4:56,,1,839,"

I am following this qiskit workshop from https://colab.research.google.com/github/mtreinish/qiskit-workshop/blob/master/Workshop.ipynb . After adding my API key I had encountered the error 'IBMQFactory' object has no attribute 'load_accounts' when running qiskit.IBMQ.load_accounts(). How do I fix this?

+",9893,,9006,,1/26/2020 7:00,1/26/2020 9:24,'IBMQFactory' object has no attribute 'load_accounts',,2,0,,,,CC BY-SA 4.0 +9652,2,,9651,1/26/2020 7:44,,1,,"

I also came across with the same issue. However when I added my account token as follows, it worked.

+ +
token = 'Your token'
+IBMQ.save_account(token)    
+provider = IBMQ.load_account()
+device = provider.get_backend('ibmq_16_melbourne')
+
+ +

You can get your IBM Q token via : https://quantum-computing.ibm.com/account

+ +

Hope this helped, let me know if it didn't.

+",9759,,,,,1/26/2020 7:44,,,,0,,,,CC BY-SA 4.0 +9653,2,,9641,1/26/2020 9:05,,1,,"

Qiskit simulator behaves like this for your code snippet: whenever it encounters one of u1, u2, or u3 gates (in the compiled circuit), it first applies the gate; then it performs an X gate according to the provided probability (0.05 in our case).

+",7659,,,,,1/26/2020 9:05,,,,2,,,,CC BY-SA 4.0 +9654,2,,9651,1/26/2020 9:24,,4,,"

IBMQ.load_accounts() was deprecated and removed in Qiskit 0.14. Please use IBMQ.load_account().

+",332,,,,,1/26/2020 9:24,,,,0,,,,CC BY-SA 4.0 +9655,2,,9648,1/26/2020 12:46,,11,,"

Yes, it is possible. To obtain the state $$\vert \phi \rangle = \alpha \vert 00 \rangle + \beta \vert 11 \rangle$$ from $$\vert \psi \rangle = \alpha \vert 000 \rangle + \beta \vert 111 \rangle,$$ note that the latter can be written as $$\begin{aligned}\vert \psi\rangle=&\frac{1}{\sqrt{2}}\alpha \vert 00+ \rangle + \frac{1}{\sqrt{2}}\alpha \vert 00 -\rangle + \frac{1}{\sqrt{2}}\beta \vert 11 +\rangle-\frac{1}{\sqrt{2}}\beta \vert 11 -\rangle\\ +=& \frac{1}{\sqrt{2}}(\alpha\vert 00\rangle + \beta\vert 11\rangle)\vert +\rangle +\frac{1}{\sqrt{2}}(\alpha\vert00\rangle -\beta \vert 11\rangle)\vert - \rangle\\ + =& \frac{1}{\sqrt{2}} \vert \phi \rangle\vert+\rangle + (Z\otimes \text{Id}) \frac{1}{\sqrt{2}} \vert \phi \rangle\vert - \rangle.\end{aligned}$$ +This shows how you can remove a qubit from this entangled state. If you measure this qubit in $X$-basis, then you get one of the following two outcomes:

+ +
    +
  • $+1$ (i.e. $\vert +\rangle$), in which case you have successfully projected onto $\vert \phi \rangle$.
  • +
  • $-1$ (i.e. $\vert -\rangle$), in which case you have projected onto $(Z\otimes Id)\vert \phi\rangle$, which, however, can be transformed into $\vert \phi \rangle$ by applying a $Z$-gate on one of the remaining qubits.
  • +
+ +

In summary: measure the qubit that you want to remove in the $X$-Basis and perform a phase correction if neccessary.

+ +

This procedure is standard in entanglement-based quantum computation.

+",104,,104,,1/26/2020 18:37,1/26/2020 18:37,,,,6,,,,CC BY-SA 4.0 +9656,1,9657,,1/26/2020 13:14,,2,315,"

I've started playing around with circuits only recently and decided to try out and implement a 4-qubit Grover's search using qiskit.

+ +

When I run my python script using the qasm_simulator, I get the expected results with a probability peak over the value 0010 as expected (the value marked by my oracle).

+ +

However, when I change the backend to basically anything else on IBMQ (ibmqx2, ibmq_essex, ibmq_vigo), the results get very different. There is no apparent peak in the distribution whatsoever, not even if I repeat the amplitude amplification process - I use the ""iterations"" variable for that further in the code - works nicely with qasm_simulator, but seems to have no real effect on a quantum computer.

+ +

I feel like I'm doing something fundamentally wrong, but I simply cannot figure it out.

+ +

Here's my code:

+ + + +
import math
+from qiskit import IBMQ, BasicAer
+from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister, execute
+from qiskit.visualization import plot_histogram
+pi = math.pi
+provider = IBMQ.load_account()
+
+
+def oracle(circuit, qr):
+    circuit.x(qr[0])
+    circuit.x(qr[2])
+    circuit.x(qr[3])
+    circuit.cu1(pi/4, qr[0], qr[3])
+    circuit.cx(qr[0], qr[1])
+    circuit.cu1(-pi/4, qr[1], qr[3])
+    circuit.cx(qr[0], qr[1])
+    circuit.cu1(pi/4, qr[1], qr[3])
+    circuit.cx(qr[1], qr[2])
+    circuit.cu1(-pi/4, qr[2], qr[3])
+    circuit.cx(qr[0], qr[2])
+    circuit.cu1(pi/4, qr[2], qr[3])
+    circuit.cx(qr[1], qr[2])
+    circuit.cu1(-pi/4, qr[2], qr[3])
+    circuit.cx(qr[0], qr[2])
+    circuit.cu1(pi/4, qr[2], qr[3])
+    circuit.x(qr[0])
+    circuit.x(qr[2])
+    circuit.x(qr[3])
+
+
+def amplification(circuit, qr):
+    circuit.h(qr)
+    circuit.x(qr)
+    circuit.cu1(pi/4, qr[0], qr[3])
+    circuit.cx(qr[0], qr[1])
+    circuit.cu1(-pi/4, qr[1], qr[3])
+    circuit.cx(qr[0], qr[1])
+    circuit.cu1(pi/4, qr[1], qr[3])
+    circuit.cx(qr[1], qr[2])
+    circuit.cu1(-pi/4, qr[2], qr[3])
+    circuit.cx(qr[0], qr[2])
+    circuit.cu1(pi/4, qr[2], qr[3])
+    circuit.cx(qr[1], qr[2])
+    circuit.cu1(-pi/4, qr[2], qr[3])
+    circuit.cx(qr[0], qr[2])
+    circuit.cu1(pi/4, qr[2], qr[3])
+    circuit.x(qr)
+    circuit.h(qr)
+
+
+qr = QuantumRegister(4)
+cr = ClassicalRegister(4)
+iterations = 1
+
+groverCircuit = QuantumCircuit(qr, cr)
+
+# apply Hadamard gate to all qubits
+groverCircuit.h(qr)
+
+while iterations > 0:
+    oracle(groverCircuit, qr)
+    amplification(groverCircuit, qr)
+    iterations -= 1
+
+# measure
+groverCircuit.measure(qr, cr)
+provider.backends()
+
+backend = provider.get_backend('ibmqx2')
+# backend = BasicAer.get_backend('qasm_simulator')
+
+shots = 1024
+results = execute(groverCircuit, backend=backend, shots=shots).result()
+answer = results.get_counts()
+print(answer)
+print(plot_histogram(answer))
+
+ +

For example, this is one of the probability distributions I got from a quantum computer, where the 0010 value should have been amplified: +

+",9896,,9896,,1/26/2020 13:33,1/26/2020 14:19,Vey different results between qasm_simulator and quantum computer,,1,0,,,,CC BY-SA 4.0 +9657,2,,9656,1/26/2020 14:19,,5,,"

You have to look at the size of the circuit that actually runs on the quantum computer to see if it can reasonably succeed with existing levels of noise.

+ +

The most important metrics are the depth of the circuit and the number of CNOTs. In your case, with 1 iteration, the ideal circuit has depth 34. But this will not run as-is on the backend, because it contains gates outside the backend's native basis_gates and qubit coupling_map. When you transpile the circuit to respect these constraints and optimize for them (for say ibmq_vigo), it will end up with a depth of 100 and 61 CNOTs. This circuit will accumulate too much noise to give meaningful results. (Each qubit has a coherent lifetime of around 100 us. Each CNOT has around 1% error and takes around 300 ns to apply. Also there are readout errors of around 4%. These are ballparks which vary across backends and across qubits/gates).

+ +

Also you really want 2 iterations, as you are running a 4-qubit Grover's search. In an ideal simulation that would give you a much better peak, however unfortunately that incurs yet more gates in the circuit.

+ +

This is all to say that this is not going to work right out of the box when you switch from simulation to real experiment. There are circuit optimization and error mitigation techniques that you can do. See this recent paper which tries to solve a very similar problem: https://arxiv.org/pdf/2001.06575.pdf

+ +

P.S. You can modify the last few lines of your code like this to see the circuit metrics I talked about.

+ +
shots = 1024
+groverCircuit_transpiled = transpile(groverCircuit, backend, optimization_level=3)
+qobj = assemble(groverCircuit_transpiled, backend=backend, shots=shots)
+results = backend.run(qobj).result()
+answer = results.get_counts()
+
+print(""%d depth, %d CNOTs"" % (groverCircuit.depth(), groverCircuit.count_ops()['cx']))
+print(""%d depth, %d CNOTs"" % (groverCircuit_transpiled.depth(), groverCircuit_transpiled.count_ops()['cx']))
+
+print(answer)
+plot_histogram(answer)
+```
+
+",2503,,,,,1/26/2020 14:19,,,,1,,,,CC BY-SA 4.0 +9658,1,9660,,1/26/2020 15:46,,2,260,"

I am trying to implement the Grover's search algorithm using Q# and I am not able to implement the oracle (black box) part for the search of state $|1010\rangle$. How to implement the controlled NOT gate using 5 qubits with 4 qubits (q[0] ... q[3]) used as the control qubits and q[4] as the target qubit in Q#?

+ +

Please correct me if this is wrong, I am trying to implement Grover's algorithm using 4 qubits where 3 qubits are for the states and the 4th qubit is the auxiliary qubit so the auxiliary bit should be the target qubit?

+",9898,,2879,,1/26/2020 19:00,1/26/2020 19:00,Controlled NOT gate using multiple control qubits in Q#,,1,0,,,,CC BY-SA 4.0 +9660,2,,9658,1/26/2020 18:57,,4,,"

You can implement a controlled version of any gate in Q# using Controlled functor; for the oracles, you'll use something like Controlled X(controlQubits, targetQubit), where controlQubits is an array of qubits that have to be in 1 state for the X gate to be applied and targetQubit is the qubit to which the gate is applied.

+ +

Q# also has a neat library function ControlledOnBitString which allows to apply controlled version of the gate if the control qubits are in a state given by the bit string. So if you want to encode a specific state to use as control, like $|1010\rangle$ in your example, you can use

+ +
(ControlledOnBitString([true, false, true, false], X))(controlQubits, targetQubit);
+
+ +

You can see examples of implementing Grover's search using Q# in the GroverSearch kata (task 1.2 is almost exactly your example of looking for a state 1010).

+",2879,,,,,1/26/2020 18:57,,,,4,,,,CC BY-SA 4.0 +9661,2,,8799,1/26/2020 19:14,,2,,"

I will try to link the two concepts in the following way. It is rough, descriptive, but contains the essential idea.

+ +

Here we are talking about the so-called orbital angular momentum (OAM) of an electron orbiting around the nuclei. In classical mechanics, OAM is defined as

+ +

$ +\vec{L} \equiv \vec{r}\times\vec{p} +$

+ +

where $\vec{r}$ is the position of the electron, and $\vec{p}$ is the momentum. One could roughly think that the magnetic moment to be proportional to $\vec{L}$, namely $\vec{M}\propto\vec{L}$ given that we ignore the spin part (which are in fact equally important). Now in quantum mechanics, the OAM is given by pretty much the similar expression, except two things. First, $\vec{r}$ and $\vec{p}$ should be thought as operators now (see below) and second, the operators are sandwiched between wavefunctions. Thus

+ +

$ +\vec{L} = \langle \psi | \vec{r}\times\vec{p} |\psi \rangle +$

+ +

Precisely what this means is that, if you want to calculate say the component $L_z$, then the expression is

+ +

$ +L_z = i\int d^3r \psi^*(r) ( x \frac{\partial}{\partial y} - y \frac{\partial}{\partial x} )\psi(r) +$

+ +

where we have written out the operator $\vec{p}$ explicitly as $i\frac{\partial}{\partial \vec{r}}$ for the purpose of calculation.

+ +

That said, the two point of view, one with orbiting electron and the other with probability cloud is not in conflict with each other. Rather, they are complementary in the sense that the former view is more intuitive for us to imagine the physics and write down equations, but when it comes down to actual calculations, we have to use the wavefunctions.

+",9816,,,,,1/26/2020 19:14,,,,0,,,,CC BY-SA 4.0 +9662,1,9713,,1/26/2020 23:52,,3,146,"

Consider two quantum states $\rho_A$ and $\sigma_A$, and define the classical-quantum state over a classical binary system $B$ and $A$, +$$\omega_{AB}^\epsilon :=\epsilon \vert 0 \rangle \langle 0 \vert \rho_A + (1-\epsilon) \vert 1 \rangle \langle 1 \vert \sigma_A.$$ I am interested in the conditional von Neumann entropy +$S(B\vert A)_{\omega_{AB}^\epsilon} = S(\omega_{AB}^\epsilon)- S(\omega_{A}^\epsilon)$. This is related to quantum state discrimination.

+ +

If $\rho_A$ and $\sigma_A$ are orthogonal, it is easy to show that $S(B\vert A)=0$. In case they are not orthogonal, I seek a lower bound of the form +$$S(B\vert A) \ge -c_1\epsilon \ln \epsilon + c_2 \epsilon,$$ +where $c_1>0$ and $c_2$ is any constant. I am particularly interested in the case where $c_1$ does not depend on the dimensionality of $A$, and applies even in the countably-infinite dimensional case.

+ +

One can derive a bound of this type for a classical system in the following way. Define $c = \max_a [\min\{\rho_A(a), \sigma_A(a)\}]$, and let $\hat{a}$ indicate the state of $A$ such that $c = \min\{\rho_A(\hat{a}), \sigma_A(\hat{a})\}$. Then, write +\begin{align} +S(B|A)&=\sum_a\left[\epsilon \rho_A(a)\ln\frac{\epsilon \rho_A(a)+(1-\epsilon)\sigma_A(a)}{\epsilon \rho_A(a)} + (1- \epsilon) \sigma_A(a)\ln\frac{\epsilon \rho_A(a)+(1-\epsilon)\sigma_A(a)}{(1- \epsilon)\sigma_A(a)}\right]\\ +&\ge \epsilon \rho_A(\hat{a})\ln\frac{\epsilon \rho_A(\hat{a})+(1-\epsilon)\sigma_A(\hat{a})}{\epsilon \rho_A(\hat{a})}\\ +&\ge \epsilon \rho_A(\hat{a})\ln\frac{c}{\epsilon \rho_A(\hat{a})}\\ +&= -\epsilon \rho_A(\hat{a})\ln\epsilon +\epsilon \rho_A(\hat{a})\ln \frac{c}{\rho_A(\hat{a})} +\end{align}

+ +

However, I have not seen something similar for the quantum case.

+",9900,,55,,11/4/2020 16:02,11/4/2020 16:02,Quantum state discrimination and lower bound for conditional von Neumann entropy,,1,0,,,,CC BY-SA 4.0 +9663,1,9667,,1/26/2020 23:52,,2,272,"

I'm using Qutip to plot some basic two level dynamics using hamiltonians with a temporal envelope defined as the sum of two error functions, designed to make it more representative of experimental conditions.

+ +

I'm using the following code.

+ +
import numpy as np
+from qutip import * 
+from scipy.special import erf
+import matplotlib.pyplot as plt
+
+def pulseEdge(x, x0, sigma):
+    pulseEdge = ((erf((x-x0)/sigma)) +1.)/2.
+    return pulseEdge
+
+def pulse(t, tOn, tOff, sigma):
+    return pulseEdge(t, tOn, sigma)* (1.-pulseEdge(t, tOff, sigma))
+
+def H(t, args):
+    H = Qobj([[0.,1],[1,0.0]])
+    envelope = pulse(t, 2,2+np.pi/2,0.2)
+    return H*envelope
+
+tlist = np.linspace(0,10,1000)
+h = np.array([H(t,0)[0][0] for t in tlist])
+H_list = H
+
+psi0 = basis(2,0)
+basisStates = [basis(2,i) for i in range(2)]
+e_ops = [b*b.dag() for b in basisStates]
+
+me =mesolve(H_list, psi0, tlist,  progress_bar = None, e_ops = e_ops)
+
+plt.plot(me.expect[0])
+plt.plot(me.expect[1])
+
+plt.plot(h)
+plt.show()
+
+ +

Which works really well and produces the desired output, a $\pi$ Rabi oscillation driven by a $\pi$ pulse. The red is the envelope of the Rabi hamiltonian, and the orange and blue are the (expected) populations of the upper and lower states of a two level system undergoing a pi pulse. This is the expected behaviour.

+ +

+ +

Except if I want the pulse one time unit later, when no evolution is driven. The code is exactly the same, except the hamiltonian function is modified to the following

+ +
def H(t, args):
+    H = Qobj([[0.,1],[1,0.0]])
+    envelope = pulse(t, 3,3+np.pi/2,0.2)
+    H*=envelope
+    return H
+
+ +

which produces

+ +

+ +

Or if I want the edges to be sharper, when again, no evolution occurs

+ +
def H(t, args):
+    H = Qobj([[0.,1],[1,0.0]])
+    envelope = pulse(t, 2,2+np.pi/2,0.01)
+    H*=envelope
+    return H
+
+ +

+ +

What element of these time dependent Hamiltonians functions is causing mesolve to correctly calculate the dynamics in some cases, and completely fail in others?

+ +

The difference between the Hamiltonians in the above plots seems minor and arbitrary to me, and the rest of the code is identical between plots.

+ +

EDIT

+ +

After Paul Nation's answer, here is updated, working code.

+ +
import numpy as np
+from qutip import * 
+from scipy.special import erf
+import matplotlib.pyplot as plt
+
+def pulseEdge(x, x0, sigma):
+    pulseEdge = ((erf((x-x0)/sigma)) +1.)/2.
+    return pulseEdge
+
+def pulse(t, tOn, tOff, sigma):
+    return pulseEdge(t, tOn, sigma)* (1.-pulseEdge(t, tOff, sigma))
+
+def H(t, args):
+    H = Qobj([[0.,1],[1,0.0]])
+    envelope = pulse(t, 2,2+np.pi/2,0.01)
+    H*=envelope
+    return H
+
+tlist = np.linspace(0,10,1000)
+h = np.array([H(t,0)[0][0] for t in tlist])
+H_list = H
+
+psi0 = basis(2,0)
+basisStates = [basis(2,i) for i in range(2)]
+e_ops = [b*b.dag() for b in basisStates]
+
+options = Options(max_step = 1)
+me =mesolve(H_list, psi0, tlist,  progress_bar = None, e_ops = e_ops, options = options)
+
+plt.plot(me.expect[0])
+plt.plot(me.expect[1])
+
+plt.plot(h)
+plt.show()
+
+ +

+",9901,,9901,,1/27/2020 12:14,1/27/2020 12:14,"Strange Behaviour of MeSolve, McSolve",,1,0,,,,CC BY-SA 4.0 +9664,1,9666,,1/27/2020 5:47,,2,221,"

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)$ be the number of qubits needed for finding the period. As far as I know, we can initialize $s=1$, and multiply it with $a,a^2,a^4 \cdots a^{2^{N-1}} \mod n$ according to the $N$ control qubits. However, all methods I can think of needs around $O(N^2)$ modulus and thus $O(N^2)$ ancillary clean qubits (for example, compute $a,a^2,a^4 \cdots a^{2^{N-1}}\mod n$ beforehand, use additions, comparing numbers and subtracting accordingly). Is there a way to implement modulus as some reversible circuit? Or, am I all wrong?

+",5951,,9006,,1/27/2020 5:52,1/27/2020 7:41,How to implement modular exponentiation efficiently in Shor's algorithm?,,1,2,,,,CC BY-SA 4.0 +9666,2,,9664,1/27/2020 7:41,,3,,"

There is no circuit that performs the mod operation reversibly. You need to keep your numbers mod'ed the whole time. For example, instead of using an adder and then attempting to mod, use a fundamentally modular adder.

+ +

There's actually quite a lot of detail that goes into constructing these circuits. Too much for an answer here. A preprint that goes through all the details (and had working ProjectQ code at the time) is ""Factoring with n+2 clean qubits and n-1 dirty qubits"".

+ +

Here's a few example diagrams:

+ +

+ +

+ +

Note that the constructions are really going out of their way to avoid using ancillae, so they often have not-so-great gate counts.

+ +

And here's one to reinforce the point that it's complicated:

+ +

+",119,,,,,1/27/2020 7:41,,,,0,,,,CC BY-SA 4.0 +9667,2,,9663,1/27/2020 11:46,,1,,"

So, this can happen when the ode solvers automatic step size solver thinks that nothing is going on and takes a big step over the pulse. There is a max_step option that you can set. In practice, setting this to something like half the width of the smallest pulse in a pulse sequence works quite well. Then the solver sees the pulses and adjusts accordingly.

+",332,,,,,1/27/2020 11:46,,,,0,,,,CC BY-SA 4.0 +9668,1,9669,,1/27/2020 13:24,,4,914,"

The most general single qubit gate is $\mathrm{U3}$ given by matrix

+ +

$$ +\mathrm{U3}= +\begin{pmatrix} +\cos(\theta/2) & -\mathrm{e}^{i\lambda}\sin(\theta/2) \\ +\mathrm{e}^{i\phi}\sin(\theta/2) & \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) +\end{pmatrix}. +$$

+ +

If the gate is applied on qubit in state $|0\rangle$ again the most general description of quantum state is obtained, i.e.

+ +

$$ +|\varphi_0\rangle = \cos(\theta/2)|0\rangle + \mathrm{e}^{i\phi}\sin(\theta/2)|1\rangle, +$$

+ +

where angles $\phi$ and $\theta$ describe position of the state on Bloch sphere.

+ +

When the gate is applied on qubit in state $|1\rangle$, the result is

+ +

$$ +|\varphi_1\rangle = \mathrm{e}^{i\lambda}(-\sin(\theta/2)|0\rangle + \mathrm{e}^{i\phi}\cos(\theta/2)|1\rangle) +$$

+ +

Obviously term $\mathrm{e}^{i\lambda}$ can be ignored because it is the global phase of a state.

+ +

I can imagine that global phase can be useful for constructing contolled global phase gate but it can be implemented as $\mathrm{Ph}(\lambda) \otimes I$, +where

+ +

$$ +\mathrm{Ph}(\lambda) = +\begin{pmatrix} +1 & 0 \\ +0 & \mathrm{e}^{i\lambda}. +\end{pmatrix} +$$

+ +

My question is: What a parameter $\lambda$ in $\mathrm{U3}$ is used for?

+",9006,,55,,1/28/2020 19:43,1/28/2020 19:43,What is the $\lambda$ parameter in the $U3$ gate used for?,,1,5,,,,CC BY-SA 4.0 +9669,2,,9668,1/27/2020 13:28,,6,,"

The parameter $e^{i\lambda}$ is only a global phase if it's acting on the basis state $|1\rangle$. Act on any superposition of states, and it's a relative phase, and absolutely critical.

+",1837,,,,,1/27/2020 13:28,,,,1,,,,CC BY-SA 4.0 +9670,2,,9648,1/27/2020 14:26,,6,,"

Measuring the second qubit in the $X$ basis you get one of two results, associated with the two eigenstates of $X$, which are: $\newcommand{\ket}[1]{|#1\rangle}\sqrt2\ket\pm\equiv\ket0\pm\ket1$.

+ +

The post-measurement states corresponding to these two outcomes are given (up to normalisation) by the overlaps $\langle\pm_2|\psi\rangle$, where here $\ket{\pm_2}\equiv I\otimes\ket\pm\otimes I$. This gives +$$ + \ket{\psi_+}\equiv\frac{\langle+_2|\psi\rangle}{\sqrt{p_+}} = \alpha\ket{00} + \beta\ket{11}, \\ + \ket{\psi_-}\equiv\frac{\langle-_2|\psi\rangle}{\sqrt{p_-}} = \alpha\ket{00} - \beta\ket{11}. +$$ +where $p_\pm\equiv\|\langle \pm_2|\psi\rangle\|^2=1/2$ are the outcome probabilities.

+ +

This tells you that, if you want to get the state $\alpha\ket{00}+\beta\ket{11}$ on the remaining qubits, you can do it by post-selecting on the outcome $|+\rangle$ when measuring one of the qubits (in your case the second one). By post-selection I mean that you will have the correct state on the two qubits only whenever you measure $\ket+$ on the second one. This can be used in computation by post-selecting the experimental runs in which the second qubit was found to be $\ket+$ (which will be roughly half of them), and discarding the rest.

+ +

If you also allow for a local operation be performed on the remaining qubits conditionally on the results of measuring the second one, then you even make this into a deterministic algorithm, by applying a $Z$ gate conditionally to finding $\ket{2_+}$ which as you can check converts $\ket{\psi_-}$ into $\ket{\psi_+}$.

+",55,,,,,1/27/2020 14:26,,,,0,,,,CC BY-SA 4.0 +9671,1,,,1/27/2020 19:10,,4,98,"

The coherent information of a channel $\mathcal{E}_{A'\rightarrow B}$ is defined as the maximum value obtained by the following function where the maximization is over all input states

+ +

$$I_{\rm{coh}}(\mathcal{E}) = \max_{\rho_{A'}} S(\mathcal{E}(\rho_{A'})) - S((I_A\otimes \mathcal{E})(\rho_{AA'})),$$

+ +

where $\rho_{AA'}$ is the purification of $\rho_{A'}$. I can think in terms of the complementary channel $\mathcal{E}^c_{A'\rightarrow E}$ instead and the optimization becomes

+ +

$$I_{\rm{coh}}(\mathcal{E}) = \max_{\rho_{A'}} S((I_A\otimes \mathcal{E^c})(\rho_{AA'})) - S(\mathcal{E^c}(\rho_{A'}))$$

+ +

Suppose I forget about the channel for a moment and only look at the registers $A$ and $E$. Clearly, the state that maximizes the coherent information is the maximally mixed state $I_{AE}$. In some sense, this is the ideal output state that we try to achieve. For any strictly noisy channel, it must hold that there exists no pure input $\rho_{AA'}$ such that

+ +

$$(I\otimes \mathcal{E^c})\rho_{AA'} = I_{AE}$$

+ +
+ +

Is there a general way to see this impossibility/possibility result for arbitrary states on the right hand side? In other words, if I am given a channel and its complementary channel (but don't know its capacity) and a ""target"" state $\rho_{AE}$, can I efficiently prove that there exists/cannot exist a pure input $\rho_{AA'}$ that satisfies

+ +

$$(I\otimes \mathcal{E^c})\rho_{AA'} = \rho_{AE}$$

+",4831,,4831,,1/27/2020 20:31,1/31/2020 13:59,Forbidden/allowed outputs of a quantum channel,,0,0,,,,CC BY-SA 4.0 +9672,1,9674,,1/28/2020 0:24,,4,357,"

Being a newbie in this field, I'm trying to understand what types of real-life workloads are suitable for migrating to Quantum computers. +Intuitively, it seems to me that if a Quantum computer ingests data by reading symbols one-by-one from a tape, exactly like a classical Turing machine, it would be impossible for it to outperform the Turing machine. It seems that optimization can be achieved only if a parallel method of ingesting the input is implemented. +Is this true? Does this mean that, if I want to migrate a workload to a Quantum computer for better performance, I should first try to parallelize it as much as possible?

+ +

I'd like to clarify my question with an example:

+ +

The classical multiple string-match problem - namely, ""Given a string-set $L \subseteq \Sigma∗$ and an input stream $W \in \Sigma∗$, find all occurrences of any of the strings in $L$ that are substrings of $W$"" - is considered a 'solved problem', where many algorithms solve it in $O(n)$. However, almost all of these algorithms have a hidden constraint - they assume that the input is fed to them sequentially.

+ +

It is obvious that when a cell extracts information from its DNA strand, or when a person reads a newspaper, they do not read the 'symbols' from left to right, or in any strict order for that matter. Still, strict order is usually enforced both in DNA analysis algorithms and in text analysis algorithms.

+ +

So my question is: do we need to come up with completely different quantum-based solutions for such problems, or is there a way to 'interpret' existing algorithms to the quantum domain and still expect some speedup?

+ +

Edit (and some thoughts):

+ +

Arguing that speedup requires handling parallelized input may lead to the following (pretty radical) conclusion: Order is overrated.

+ +

Computer Science 101 is all about for() loops - maybe out of habit. Yet multithreading, hyperthreading, multicore, SIMD, DPDK, FPGA, and Quantum Computing, all considered major advancements, are all about parallelizing workloads and breaking the 'serial computing' paradigm. But at the moment we are stuck with cloud servers running endless loops and contributing to 'Pollution-as-a-Service'.

+ +

The next generation of programmers should probably learn Parallel and Quantum Computing in Computer Science 101, and treat for() loops as a last resort...

+",9913,,9913,,1/29/2020 7:22,1/29/2020 7:22,Does the massive parallelization in Quantum computing imply parallelization of input (as opposed to Turing machine)?,,2,1,,,,CC BY-SA 4.0 +9673,1,,,1/28/2020 5:21,,0,71,"

I have a quantum circuit and the job has been run on the ""statevector"" backend, which runs only 1 shot.

+ +

Therefore is there a way to return the qubit state (0 or 1) specifically when selected specifically ?

+",9759,,5955,,1/28/2020 9:32,1/28/2020 9:32,Return the value of a selected Qubit from Qiskit,,1,1,0,,,CC BY-SA 4.0 +9674,2,,9672,1/28/2020 5:51,,1,,"

The reason that a quantum computer is faster in same tasks is given by different computational paradigm based on quantum mechanics laws. They mainly exploit superposition (i.e. state of qubit is linear combination of zero state and one state) and quantum entanglement (i.e. two or more qubits are connected and they behave as one system, or in other words there is some dependency among qubits values).

+ +

It is not easy, or even impossible, to explain in plain words, hence mathematical proof for each task is needed to evaluate speed-up and decide wheter there is any.

+ +

Commnon misunderstanding is that quantum computers are based on paralelism and provide exponential speed-up always as they process all possible values in $n$ qubits (i.e. $2^n$ values) at once. This is not true. If it was, all tasks would record exponential speed-up but this is not the case. While some tasks are speeded up exponentially (i.e. Shor algorithm for integer factoring), for others the speed-up is quadratic (i.e. Grover algorithm for searching in database).

+",9006,,,,,1/28/2020 5:51,,,,2,,,,CC BY-SA 4.0 +9676,2,,9673,1/28/2020 9:32,,1,,"

The statevector backend returns the final state vector at the end of the circuit. If you would like to return the counts instead, the qasm_simulator should be used. This returns, in the result object, a dictionary which contains the results as keys and the number of times the result was seen as values. For example, for a circuit that constructs a Bell state, run 10 times, this could be {00: 6, 11: 4}

+",5955,,,,,1/28/2020 9:32,,,,0,,,,CC BY-SA 4.0 +9677,1,,,1/28/2020 10:31,,1,646,"

I referred to the following Qiskit's document: state_fidelity.

+ +

The inputs of state_fidelity are quantum state vectors or density matrices. +For example, $|00\rangle$ or $|0\rangle \langle0|$.

+ +
+ +

Now, let me assume a circuit is described as follows. +

+ +

The above circuit with no noise provides $\frac{1}{\sqrt{2}}( |00\rangle + |11\rangle )$ .

+ +

When I would like to measure the noise of this circuit, I use state_fidelity and compare the measurements and $\frac{1}{\sqrt{2}}( |00\rangle + |11\rangle )$. +Here, we have to obtain the state vector such as numpy.array([***]).

+ +

However, I received the following error: AerError: 'statevector_simulator does not support noise.' when I set backend = Aer.get_backend('statevector_simulator') + to get the state vectors.

+ +

When I use qasm_simulator with noise_model (cf. How can noise on a device be simulated using measured noise parameters?), I obtained the following error: 'No statevector for experiment ""None"". However, I could obtain the counts by result().get_counts.

+ +
+ +

How can I obtain the state vector with noise_model? +Do I have to calculate the state vector from the counts?

+ +

I append the code as below.

+ + + +
%matplotlib inline
+# Importing standard Qiskit libraries and configuring account
+from qiskit import QuantumCircuit, execute, Aer, IBMQ
+from qiskit.compiler import transpile, assemble
+from qiskit.tools.jupyter import *
+from qiskit.visualization import *
+# Loading your IBM Q account(s)
+provider = IBMQ.load_account()
+
+from qiskit.aqua import run_algorithm
+from qiskit.aqua.input import LinearSystemInput
+from qiskit.quantum_info import state_fidelity
+from qiskit.aqua.algorithms.classical import ExactLSsolver
+
+from qiskit import *
+import numpy as np
+
+from qiskit.providers.aer import noise
+properties = device.properties()
+noise_model = noise.device.basic_device_noise_model(properties)
+basis_gates = noise_model.basis_gates
+
+def test():
+    q = QuantumRegister(2)
+    c = ClassicalRegister(2)
+    qc = QuantumCircuit(q,c) 
+    qc.h( q[0] )
+    qc.cx( q[0], q[1] )
+
+    qc.measure(q,c)
+
+    return qc
+# test().draw()
+
+def test2():
+    q = QuantumRegister(2)
+    c = ClassicalRegister(2)
+    qc = QuantumCircuit(q,c) 
+    qc.h( q[0] )
+    qc.cx( q[0], q[1] )
+
+#     qc.measure(q,c)
+
+    return qc
+# test2().draw()
+backend = Aer.get_backend('qasm_simulator')
+simulator = Aer.get_backend( 'qasm_simulator' )
+job1 = execute( test(), backend, noise_model = noise_model, basis_gates= basis_gates, shots = 100 ).result().get_statevector()
+
+backend = Aer.get_backend('statevector_simulator')
+simulator = Aer.get_backend( 'statevector_simulator' )
+job2 = execute( test2(), backend, noise_model=noise_model, shots = 100 ).result().get_statevector()
+
+
+ +

Thank you.

+",8673,,,,,1/28/2020 10:42,How to obtain the noise of a circuit in Qiskit?,,1,0,,,,CC BY-SA 4.0 +9678,2,,9677,1/28/2020 10:42,,1,,"

The reason the Statevector simulator does not handle noise is that Statevector is not a correct formulation, mathematically, for the application of noise; for this one has to work with a generalization of statevector called Density Matrix.

+ +

Obtaining the density matrix of a noisy state from the actual measurements is done by something called Quantum State Tomography which is part of qiskit-ignis. See here the tutorial.

+ +

There is, however, an alternative method which skips using the simulator altogether. You can use qiskit-terra's quantum_info library to directly obtain the quantum operator for the circuit, and compose it with a quantum operator for the noise. This requires a little more understanding of the underlying math, but the results are precise, as opposed to using state tomography which is intended for ""real world"" use, where you don't have a noise model.

+",9918,,,,,1/28/2020 10:42,,,,3,,,,CC BY-SA 4.0 +9679,1,9693,,1/28/2020 10:57,,3,189,"

I am familiar with the quantum gates of Qiskit, but I become very confused when looking at the continuous variable (CV) operations in the PennyLane documentation. I am especially interested in the Karr, Squeeze and Displacement operators as I have seen them used in Quantum Neural networks. See here.

+ +

I don't understand the mathematical representations of these operators. How would one implement them on for example Qiskit?

+",5632,,371,,8/18/2020 8:56,8/18/2020 8:56,"PennyLane operations - Kerr, Displacement and Squeeze",,1,0,,,,CC BY-SA 4.0 +9680,2,,9672,1/28/2020 12:53,,2,,"
+

do we need to come up with completely different quantum-based solutions for such problems, or is there a way to 'interpret' existing algorithms to the quantum domain and still expect some speedup?

+
+ +

Generally speaking yes, you need to come up with different algorithms. You cannot simply take a classical algorithm and ""quantize it"" in a straightforward way. Quantum algorithms work in a fundamentally different way than their classical counterparts.

+ +

I don't think the ""sequential"" aspect in the question is really the important point though. What's important is to have a bunch of qubits/states in a coherent superposition, and this is where most (all?) quantum algorithms draw their speed-ups from. You can input qubits sequentially and still have them interact using quantum memories or other such device (the specifics would depend on the way you define your model).

+",55,,,,,1/28/2020 12:53,,,,0,,,,CC BY-SA 4.0 +9682,1,,,1/28/2020 16:00,,2,116,"

I need to have a resource in which phenomenological decoherence model are well defined and explained.

+ +

Indeed, from what I read there are three usual timescales considered to model decoherence of a qubit: $T_1,T_2,T_2^*$

+ +

$T_1$ from what I understood is the typical time for which the qubit will fall in the ground state

+ +

$T_2$ is the typical time for which the qubit will lose its coherence. More precisely that the quantum superposition between excited and ground state will become a classical mixture

+ +

$T_2^*$ is the one that confuses me the most but represents the following as far as I understood.

+ +

I take two qubits $A$ and $B$ in some superposition of excited and ground states. I call $\phi_1$ and $\phi_2$ their respective angle to the $x$ axis of the Bloch sphere.

+ +

If $T_2^*$ is infinite: $\forall t, \phi_1(t)-\phi_2(t)=\phi_1(0)-\phi_2(0)$

+ +

$T_2^*$ thus represent the typical time for which $\phi_1(t)-\phi_2(t)$ is a uniform random variable that can take any value in $[0,\pi]$ (I don't know at all what is the relative phase between the two).

+ +

I don't know if there is a way to make this definition more precise.

+ +
+ +

Now, in practice, a reasonable model for some physical situations in which we assume the noise is markovian is a master equation like:

+ +

$$ \frac{\partial \rho}{\partial t} = \frac{1}{i \hbar} [H,\rho]+\sum_i \gamma_i D[X_i](\rho) $$

+ +

Where:

+ +

$$D[X_i](\rho)=X_i \rho X_i^{\dagger} - \frac{1}{2} X_i^{\dagger} X_i \rho - \frac{1}{2} \rho X_i^{\dagger} X_i $$

+ +

And $H$ is the hamiltonian of the system that may include the drive to manipulate our qubit (if we want to perform a gate for example).

+ +
+ +

My questions are:

+ +
    +
  • How to relate this master equation to those phenomenological times ? Would I be correct to do the following:
  • +
+ +

$$(\gamma_1, X_1)=(\frac{1}{T_1}, |g\rangle \langle e|)$$ +$$(\gamma_2, X_2)=(Max(\frac{1}{T_2^*},\frac{1}{T_2}) , \sigma_z)$$

+ +
    +
  • Would you agree that it can be considered as a phenomenological model to describe two level system evolution ? For example if in some experiment they give values of $T_1$, $T_2$, $T_2^*$, as a first approximation the dynamic can be modelled like this

  • +
  • Are there good resources that state clearly what I said. I would like to have a reference clearly stating master equation description relating the $T_1$ $T_2$ $T_2^*$ like I tried to do here.

  • +
  • I have heard somewhere that ""in general"" we have: $T_2^* < T_2 < T_1$, do you confirm that it is indeed the case in most physical situations ?

  • +
  • Do you agree with my understanding of $T_2^*$ ? Am I wrong in my formulation of its meaning ?

  • +
  • Is the master equation written in the rotating frame at the frequency of the qubit (interacting picture) ? So the noises rate are indeed time independent and correspond to the inverse of the $T_i$ ?

  • +
+",5008,,5008,,1/28/2020 16:46,2/6/2020 23:30,Rigorous definition of phenomenological master equation for decoherence,,1,0,,,,CC BY-SA 4.0 +9683,1,,,1/29/2020 7:32,,3,454,"

I wanted to ask how do you implement a circuit that finds the non-diagonal values of the density matrix of a quantum state on IBM Q?

+",9924,,9006,,1/30/2020 5:26,1/30/2020 5:26,Implementation of tomography on IBM Q,,2,0,,,,CC BY-SA 4.0 +9684,1,9685,,1/29/2020 7:32,,3,385,"

I have been reading qiskit documentation for hours and I still don't get how does it implements noise in the circuit. I have understood that it works with a objects of the class QuantumError which finally gives a zip of the quantum instructions (quantum gates that can be applied to the circuit) and the probability of each instruction. Once we have this, how is it really applied to the circuit when we use the add_all_qubit_quantum_error to add the error to the noise model? What I want to do is to check if it is theoretically correct as for a quantum channel the most efficient form to apply this will be to use the Kraus representation:

+

$$\mathcal E(\rho)=\sum_{k=1}^M E_k \rho E_k^\dagger.$$

+

For example for the bit-flip case the corresponding Kraus operators E_k will be:

+

+

Therefore to add the quantum noise for the bit-flip case we will need to multiply the density matrix of our state by the Kraus operator and its hermitian conjugate as we can see in the Kraus representation of a quantum channel. However I don't understand how can this corresponds with what I have read in the documentation as finally the functions such as pauli_error and so on end up returning a QuantumError object which is finally written as a zip of instructions and probabilities which I guess are append to the circuit in someway. I have carefully read the source code of every noise function that is used to implement the different types of noise and I am not able to figure out whether it is the same as implementing the corresponding Kraus errors, I would be extremely grateful if someone could answer me.

+",9887,,55,,7/26/2020 18:18,3/20/2021 7:29,How does qiskit finally implement a noise model?,,1,0,,,,CC BY-SA 4.0 +9685,2,,9684,1/29/2020 8:57,,1,,"

A probability distribution over unitaries ${(p_1, U_1),..., (p_k, U_K)}$, where you select $U_i$ with probability $p_i$, is equivalent to Kraus operators $\sqrt{p_1}U_1,..., \sqrt{p_k}U_k$. For example, the bit flip error can be implemented by randomly deciding whether to leave the state unchanged (with probability $p$) or apply an $X$ gate (with probability $1-p$). With an infinite number of shots, where each shot randomizes independently from the other shots, all measurement statistics will converge to those obtained from the density matrix.

+",7659,,14239,,3/20/2021 7:29,3/20/2021 7:29,,,,0,,,,CC BY-SA 4.0 +9687,2,,9683,1/29/2020 10:40,,3,,"

Basically you add measurements in different bases by applying gates before the (Z-basis) measurement.

+ +

See here the standard implementation:

+ +

https://github.com/Qiskit/qiskit-ignis/blob/3c59f82c11e87c071bc7e84240b50e2aa995281f/qiskit/ignis/verification/tomography/basis/paulibasis.py#L31

+",9918,,,,,1/29/2020 10:40,,,,0,,,,CC BY-SA 4.0 +9688,2,,9683,1/29/2020 11:10,,4,,"

Density matrix of single qubit state can be estimated based on this formula

+ +

\begin{equation} +\rho = \frac{\text{tr}(\rho)I+\text{tr}(X\rho)X+\text{tr}(Y\rho)Y+\text{tr}(Z\rho)Z}{2}, +\end{equation}

+ +

where $X$, $Y$, $Z$ are Pauli matrices.

+ +

Obviously $\mathrm{tr}(\rho) = 1$.

+ +

Terms $\mathrm{tr}(X\rho)$, $\mathrm{tr}(Y\rho)$ and $\mathrm{tr}(Z\rho)$ can be estimated by measuring a quantum state in different bases:

+ +
    +
  • In $z$ basis you simply measure the state
  • +
  • In $x$ basis Hadamard gate has to be applied before measurement
  • +
  • In $y$ basis $S^\dagger$ gate followed by Hadamard gate have to be applied before measurement
  • +
+ +

Value of $\mathrm{tr}(A\rho)$, where $A \in \{X,Y,Z\}$, is given by

+ +

$$ +\mathrm{tr}(A\rho) = \frac{1}{m}\sum_{i=1}^{m}\lambda_{i}, +$$

+ +

where $m$ is number of measurements (i.e. shots on IBM Q) and $\lambda_{i}$ is eigenvalue respective to measured state. Since Pauli matrices are Hermitian and unitary, their eigenvalues are -1 and +1. Moreover, eigenvalue -1 is assigned to such eigenstate that after measurement it is mapped to state $|1\rangle$, eigenvalue +1 is mapped to state $|0\rangle$.

+ +

Note: You can check this if you calculate eigenvectors and eigenvalues of Pauli matrices and then apply above mentioned gates. Eigenstates should be mapped to $|0\rangle$ and $|1\rangle$.

+ +

For practical purposes formula for calculation $\mathrm{tr}(A\rho)$ can be rewritten in terms of measured states probability distribution followingly

+ +

$$ +\mathrm{tr}(A\rho) = P(|0\rangle) - P(|1\rangle), +$$

+ +

because +1 is equivalent to measuring $|0\rangle$, hence $\frac{1}{m}\sum_{\lambda = 1}\lambda_i = \frac{\#(\lambda = 1)}{m} = P(\lambda = 1) = P(|0\rangle)$. Similarly for eigenvalue -1.

+ +

Note: probabilities are expressed as decimal number, not percentage!

+ +

To sum up how to do quantum tomography on IBM Q:

+ +
    +
  1. Prepare a qubit in some state
  2. +
  3. Measure it in $x$, $y$ and $z$ bases
  4. +
  5. Use probabilities of measuring $|0\rangle$ and $|1\rangle$ for estimation of $\mathrm{tr}(A\rho)$
  6. +
  7. Calculate density matrix $\rho$ (the first formula in this answer)
  8. +
+",9006,,,,,1/29/2020 11:10,,,,0,,,,CC BY-SA 4.0 +9689,2,,9682,1/29/2020 11:56,,1,,"

I think you are mostly correct (although I am not an expert).

+ +

I think it makes it easier to understand these terms to remember that these terms are used by experimentalits. They refer to things that can be measured, and their connection to theoretical time-constants is not simple.

+ +

I agree with your definitions for T1 and T2, but I would give a different definition of T2* (which might be equivalent):

+ +
    +
  • T2: The time-scale on which a single copy of my system will dephase (loose coherence and become a mixture).

  • +
  • T2*: The time-scale on which a large ensemble of ""copies"" of my system will fall out of phase with one another. IF every single copy is identical to every other this is equal to T2. However in practice it is typical in many systems for (say) Qubit 1 to have a energy difference between ground and excited states of $E_1$, and qubit two to have energy gap $E_2$, with some small difference - its an imperfectly engineered system. Consequently you would still expect the two qubits to fall out of phase with one another even without any dephasing on either of them individually. A single Qubit or spin cannot have a T2*, only an ensemble. (Just like the standard deviation in YOUR height doesn't make sense, you need the standard deviation of a population).

  • +
+ +

See: T2*-weighted_imaging

+ +

By this definition T2* is always < than T2.

+ +

Another point to consider is that the decay of the excited state (the T1 process) will also destroy coherence between the ground and excited states. So the experimentally measured T2 time includes something related to the decay in addition to other effects. I am not 100% about this but my understanding is that in the absence of any additional dephasing process (any σ_z process) the measured T2 is 2*T1. This means that the dephasing timescale you want to include in your model should be considerably less than 1/T2.

+ +

(You definitely don't want to take my word for this without checkking but I think:

+ +

$\frac{1}{T_2} = \frac{1}{2 T_1} + \frac{1}{T_{\text{dephaisng}}}$

+ +

So I think your definitions should read:

+ +

$(γ1,X1)=(\frac{1}{T_1},|g⟩⟨e|)$

+ +

$(γ2,X2)=( (\frac{1}{T_2} - \frac{1}{2 T_1}) ,σ_z)$

+ +

You would not include T2* as a Lindblad collapse term. Think of T2* as (once the T2 part is subtracted from it) something that tells you how much random variation their is in the Hamiltonian from one of your Qubits (spins) to the other.

+ +

Really useful link (Its about MRI, but they explain it well and this is where the terms come from in the first place).

+ +

See: Relaxation NMR - references on Wiki +https://en.wikipedia.org/wiki/Relaxation_(NMR)#cite_note-Traficante-6

+",8339,,9006,,1/29/2020 13:49,1/29/2020 13:49,,,,1,,,,CC BY-SA 4.0 +9690,1,9694,,1/29/2020 13:46,,6,147,"

What is the difference between performing $Z$ operation and performing $e^{-i Zt}$ operation on a state, given that $e^{-i Zt}= \mathbb{1} + (-i Zt) + ...$ is not equal to $Z$ for any value of $t$?

+",8290,,23,,7/26/2020 18:09,8/2/2020 19:32,What is the difference between the action of $Z$ and $\exp(-i Z t)$ on a state?,,1,0,,,,CC BY-SA 4.0 +9691,1,,,1/29/2020 14:02,,6,777,"

I want to prepare some mixed states regarding a project that I am doing, however, I am not sure how to do that using IBM Q. Experience circuit composer. Basically, I am looking to prepare maximally mixed and non-maximally mixed quantum states. +I have attached the circuit which I could come up with.

+",9928,,,,,1/31/2020 12:11,How to prepare mixed states using IBM quantum experience?,,1,4,,,,CC BY-SA 4.0 +9692,2,,9691,1/29/2020 14:29,,2,,"

A mixed state is described by a density matrix consisting of a sum of projection operators corresponding to the possible states of the system, weighted by the classical probabilities of being in each state. The register of qubits in a quantum computer is always a state vector. A density matrix can be constructed by taking a large number of shots of a system and averaging together. Unfortunately, the measurements are only in the computational basis, so reconstructing the full density matrix requires additional work to get all of the components of the density matrix. This is known as tomography and usually scales exponentially with the number of qubits, and is thus computationally very expensive. This can however be done on simulators for reasonable sized circuits.

+ +

An example (only works on master branch at the moment):

+ + + +
from qiskit import *
+from qiskit.quantum_info.states.utils import partial_trace
+qc = QuantumCircuit(2, 2)
+qc.h(0)
+qc.cx(0, 1)
+
+sim =  Aer.get_backend('statevector_simulator')
+res = execute(qc, sim, shots=1).result()
+state_vec = res.get_statevector()
+
+# Remove qubit zero
+partial_trace(state_vec, [0])
+
+
+",332,,332,,1/31/2020 12:11,1/31/2020 12:11,,,,4,,,,CC BY-SA 4.0 +9693,2,,9679,1/29/2020 15:34,,5,,"

Short, sort-of right answer: you can't

+ +

This is in essence due to the superconducting qubits that e.g. IBM use being, well, qubits, while continuous variable (CV) operations don't act on qubits. Well, sort of.

+ +

These are two fundamentally different ways of going about making a quantum computer, so let's start from first principles:

+ +

When you take a state $\left|\psi\right\rangle$, such as the state of a qubit, you're using first quantisation, where the wave function is used as the state of the system to ask 'what is the state of the particle?' (in quantum computing, usually in terms of the basis states $\left|0\right>$ and $\left|1\right>$). However, CV operaations instead use second quantisation. That is, as an example, we have a physical waveguide/optical cable that light can travel down, known as a 'mode' and we ask 'how many particles are there in each state and mode?'.

+ +

To do this, we use the idea of creation and annihilation operators where each creation operator $a^\dagger$ creates a particle and each annihilation operator $a$ destroys a particle. We can further define $n = a^\dagger a$ as the number of particles. These are the operators that are used in defining the CV operations you linked to.

+ +

Worth noting is that one can be related to the other using $\left|1\right> = a^\dagger\left|0\right>$ and therefore $\left|0\right> = a\left|1\right>$. This then gives a more meaningful (at some level) understanding of those basis states - $\left|0\right>$ is the state with no excitations and $\left|1\right>$ is the state with one excitation. This can be further extended to refer to $\left|n\right>$ (defined by $a\left|n\right> = \sqrt{n}\left|n-1\right>$ and $a\left|0\right> = 0$) as the state with n excitations, where the states with 0 and 1 excitation are used as the basis for your qubit.

+ +

Now, just because you're only accessing those bottom two excitation levels ('ground' and 'first excited' states) doesn't mean that the other levels don't exist, so there is no fundamental reason those operation you linked to can't be performed on superconducting qubits (after including higher energy levels). Indeed, this appears to be possible.

+ +

This gives the full answer:

+ +

This is something that's not completely unfeasible but either the specific way that IBM implements its operations on its qubits, what they haven't tried or just don't allow the users to do mean that it's not something we can do on IBM's quperconducting qubit devices.

+",23,,,,,1/29/2020 15:34,,,,0,,,,CC BY-SA 4.0 +9694,2,,9690,1/29/2020 19:06,,8,,"

Effectively, the Z operation (represented by the Pauli $Z$ matrix) applies a rotation about the $Z$-axis. As you note, rotations can also be written in the form $e^{-i Z t}$. To see that, you can use a trick pretty similar to the one used to derive Euler's identity ($e^{i \theta} = \cos(\theta) + i \sin(\theta)$) to rewrite the Taylor series that you quoted in your question.

+

In particular, to derive Euler's identity, you can use that $i^2 = -1$ to separate the even and odd powers of the series $e^x$ and identify the series for $\cos(\theta)$ and $\sin(\theta)$. Since $(Zt)^2 = 𝟙t^2$ , you can pull the same trick with $e^{i Z t}$:

+

$$ +\begin{align} + e^{i Z t} & = \sum_{j = 0}^{\infty} \frac{(iZt)^j}{j!} \\ + & = 𝟙\left[\sum_{k = 0}^{\infty} \frac{(-1)^k}{(2k)!}t^{2k}\right] + i Z \left[ \sum_{k=0}^{\infty} \frac{(-1)^k}{(2k+1)!}t^{2k+1} \right] \\ + & = 𝟙 \cos(t) + i Z \sin(t) +\end{align} +$$

+

Thus, at $t = \pi / 2$, $e^{i Z t} = iZ$. Since $i$ is an example of a global phase, evolving under $Z$ for time $t = \pi / 2$ gives you the same unitary transformation as $Z$. Indeed, you can check the equivalence of the two matrices using QuTiP:

+
In [1]: import qutip as qt
+In [2]: import numpy as np
+In [3]: Z = qt.sigmaz()
+In [4]: -1j * (1j * Z * np.pi / 2).expm()
+Out[4]:
+Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True
+Qobj data =
+[[ 1.  0.]
+ [ 0. -1.]]
+
+

You can also check that the quantum program Z(q); does the same thing as Exp([PauliZ], PI() / 2.0, [q]); using the AssertOperationsEqualReferenced operation:

+
open Microsoft.Quantum.Arrays;
+open Microsoft.Quantum.Diagnostics;
+open Microsoft.Quantum.Math;
+
+operation ApplyZ(qubits : Qubit[]) : Unit is Adj + Ctl {
+    Z(Head(qubits));
+}
+
+operation CheckIfOperationsEqual() : Unit {
+    AssertOperationsEqualReferenced(1,
+        ApplyZ,
+        Exp([PauliZ], PI() / 2.0, _)
+    );
+    Message("Operations are equal!");
+}
+
+

Try it online!

+",1978,,8623,,8/2/2020 19:32,8/2/2020 19:32,,,,4,,,,CC BY-SA 4.0 +9695,1,9809,,1/29/2020 19:48,,7,1808,"

I can find many qasm examples. +How can I run them on different IBMQ devices?

+",9105,,9105,,9/13/2021 14:08,9/13/2021 14:08,How to run a qasm file on IBMQ device?,,3,0,,,,CC BY-SA 4.0 +9696,2,,9695,1/29/2020 20:07,,6,,"

The easiest way is to use the QuantumCircuit methods QuantumCircuit.from_qasm_file() or QuantumCircuit.from_qasm_str() depending on if your loading the QASM from a file or Python string, respectively.

+",332,,,,,1/29/2020 20:07,,,,2,,,,CC BY-SA 4.0 +9697,1,28277,,1/29/2020 21:04,,6,199,"

What problem structure(s) are required to admit an exponential speedup in the universal quantum model of computation under the query model?

+

Intuitively, it would seem that much of the benefit of the quantum model, as is often suggested, is due to the ability to compute the solution in an exponentially large Hilbert space – i.e. a superposition of exponentially many possible states. We apply functions, encoded as unitary operators, to orchestrate useful interference over the amplitudes of the state space and repeat to a desired precision and measure. However, this is in essence the amplitude amplification framework inspired by Grover, which is not known to yield an exponential speedup for any problem.

+

So recently, I've been digging into this line of inquiry. Aaronson & Ambainis (2014), Ben-David(2011) Chailloux (2018) (among others) studied the above question, however, to date it seems that it is unresolved (not least because it seems to be a very hard problem from a complexity standpoint). That said, on the basis of existing algorithms, Aaronson and Ambainis suggest:

+
+

In the context of most existing quantum algorithms, “structured” +basically means that we are trying to determine some global property +of an extremely long sequence of numbers, assuming that the sequence +satisfies some global regularity. As a canonical example, consider +PERIOD-FINDING, the core of Shor’s algorithms for factoring and +computing discrete logarithms...The requirement of periodicity is +crucial here: it is what lets us use the Quantum Fourier Transform +to extract the information we want from a superposition...For other +known quantum algorithms, X needs to be (for example) a cyclic shift +of quadratic residues or constant on the cosets of a hidden subgroup.

+
+

This, as might be presumed, is different from the approach taken by amplitude amplification – setting aside the notion of finding a global property within a sequence with assumed global regularity. So, my question is, dipping below the surface, what is the intuition around the kinds of problems that yield quantum algorithms with an exponential speedup under the query model? Can we simply put it down to period finding and hidden subgroups or is there a higher level intuition that captures the interplay between the problem structure and the properties of quantum information (i.e. entanglement, superposition, and interference) that seem superficially necessary for an exponential speedup?

+",1937,,1937,,9/26/2022 17:33,9/26/2022 17:33,The relationship between problem structure and exponential speedups under the query model,,2,3,,,,CC BY-SA 4.0 +9699,1,9702,,1/30/2020 16:41,,1,139,"

When one has a noisy quantum channel over which one wishes to send some quantum state, one usually comes up with an encoder and decoder. Then, the error between the input state and the output state is some $\epsilon$ which vanishes in the limit where we use the channel infinitely many times.

+ +

For quantum circuits, we have a slightly different setting. Here, we wish to act some unitary on a quantum state but unfortunately, this unitary is noisy because our gates are noisy. We once again encode the input state (the logical state) into some codespace (the physical qubits) and act the unitary on t. Now, measuring the output reveals the ""syndrome"" of the error which can then be reversed. Thus, the error is corrected but notice that this process is exact - the final state is exactly what we would have gotten if the circuit was noiseless.

+ +

Are there techniques for approximate quantum error correction, where some small error is allowed but this error vanishes in some limit (say large number of qubits) that performs better than zero error QEC?

+",4831,,4831,,1/30/2020 16:48,1/31/2020 9:57,Quantum error correction - approximate vs exact,,1,0,,,,CC BY-SA 4.0 +9700,1,,,1/30/2020 16:59,,5,227,"

In the literature, there is a distinction between exact and error-bounded quantum algorithms. The former must solve a problem with a zero probability of error, whereas the latter only needs to bound the probability of error away from some constant (typically strictly less than $\frac{1}{3}$).

+ +

My questions are these:

+ +
    +
  1. How do algorithms of each type differ?
  2. +
  3. What are examples of exact algorithms?
  4. +
  5. Can you use amplitude amplification in an exact algorithm?
  6. +
+",8438,,8438,,3/17/2020 14:45,3/17/2020 14:45,What is an exact quantum algorithm?,,3,2,,,,CC BY-SA 4.0 +9701,1,9704,,1/30/2020 17:53,,5,663,"

In Quantum Algorithm Implementations for Beginners is an example of the Quantum PCA with an given 2 x 2 covariance matrix $\sum$.
+The steps for state preparation are given in the paper. The steps are:

+ +
    +
  • calculate covariance matrix $\sum$ from the data

  • +
  • compute density matrix $\rho = \frac{1}{Tr(\sum)}*\sum$

  • +
  • calculate two-qubit pure quantum state $| \psi \rangle$
  • +
  • calculate the unitary operator $U_{prep}$
  • +
+ +

I wanna comprehend the example from the paper. So far I got the density matrix $\rho$. I would be glad if someone could explain me how to calculate the quantum state $| \psi \rangle$ and futhermore $U_{prep}$.

+",9930,,55,,8/1/2020 11:35,8/1/2020 11:35,Quantum PCA State Preparation,,1,3,,,,CC BY-SA 4.0 +9702,2,,9699,1/30/2020 18:55,,1,,"

It is unfortunately not true that for general quantum computations an error correcting code is exact. There is no QECC that can correct all possible errors.

+ +

Consider, for example, one of the simplest QECC's there is: the 3-bit repetition code. +In this code, the logical Hilbert space is spanned by the logical states $|\overline{0}\rangle = |000\rangle$ & $|\overline{1}\rangle = |111\rangle$.

+ +

By parity comparisons we can infer if certain errors happened. The errors we can detect are all the single qubit $X$-flips: $XII$, $IXI$ and $IIX$.

+ +

The important thing to realize is that any error model that only has these errors is not at all a realistic error model. If we take something more realistic, (but still overly simplified), we might have that all qubits individually are flipped with a probability $\epsilon$. That is to say, we have Kraus operators: +\begin{equation} +E_{1} = \sqrt{1-\epsilon}I, \,E_{2} = \sqrt{\epsilon}X, +\end{equation} +on all three qubits. Therefore, our entire system has $2^{3} = 8$ Kraus operators, namely the three-fold tensor product of $E_{1}$ and $E_{2}$: +\begin{equation} +\begin{split} +A_{1} = (1-\epsilon)^{3/2}III, \,& A_{8} = \epsilon^{3/2}XXX \\ +A_{2} = (1-\epsilon)(\epsilon)^{1/2}XII, \,& A_{5} = (1-\epsilon)^{1/2}\epsilon IXX \\ +A_{3} = (1-\epsilon)(\epsilon)^{1/2}IXI, \,& A_{6} = (1-\epsilon)^{1/2}\epsilon XIX \\ +A_{4} = (1-\epsilon)(\epsilon)^{1/2}IIX, \,& A_{7} = (1-\epsilon)^{1/2}\epsilon XXI,\\ +\end{split} +\end{equation} +where I have put Kraus operators giving raise to the same error syndrome in the same row.

+ +

If we have some logical state $\rho = \in \mathcal{H}_{l}$, and we put it through the above channel, and then through error correction, even after perfect error decoding we get the following mixtures (depending on the error syndrome we actually measured): +\begin{equation} +\begin{split} +\rho \rightarrow \frac{1}{(1-\epsilon)^{3} + \epsilon^{3}}\big((1-\epsilon)^{3}\rho + \epsilon^{3} XXX\rho XXX \big), \\ +\rho \rightarrow \frac{1}{(1-\epsilon)^{2}\epsilon + (1-\epsilon)\epsilon^{2}}\big((1-\epsilon)^{2}\epsilon\rho + (1-\epsilon)\epsilon^{2} XXX\rho XXX \big), \\ +\end{split} +\end{equation} +with the top row holding for a trivial error syndrome, and the bottom row holding for any non-trivial error syndrome.

+ +

So even in this very simple case our QECC is never perfect, because we can never correct all errors. We limit ourselves by correcting only a subset of all errors, and we normally choose the lower weight errors. There will necessarily be errors with the same error syndrome but with different correction operators, so we can never hope to correct all of these.

+ +

We just choose the more likely errors, and we design all of our interactions with the code (encoding, decoding, measurement, syndrome extraction, logical gates etc.) in such a way that we limit the number of higher weight errors. This last thing is broadly known as fault-tolerance.

+ +

All in all, a QECC only brings down the rate of erroneous states, but it never brings it to zero (note that in the last equation, the correct states are all more likely than the erroneous ones by a factor of at least $\sim \epsilon$. However, the erroneous states are not non-existant). By repeated QECC's (concatenated codes), we can bring down the error rate even more. Of course, all operations that we need to do to perform QECC introduce some error as well, and we also have to correct for these. The threshold theorem states that if $\epsilon$ is small enough, we can correct the new errors faster than they arise, thereby allowing us to get arbitrary small errors.

+ +

This also taps into your last question: essentially all error correction is of the approximate type. The error only 'vanishes' by the use of repeated and fault-tolerant implementation of codes.

+",8141,,8141,,1/31/2020 9:57,1/31/2020 9:57,,,,0,,,,CC BY-SA 4.0 +9703,2,,9700,1/31/2020 9:02,,3,,"

Only a partial answer, the Deutsch-Jozsa algorithm is an example of an exact algorithm.

+ +

In my view, the algorithms differ exactly in how the answer is given. Either with probability 1 for exact algorithms, or with a bounded probability for approximate ones.

+ +

I would say you cannot use amplitude amplification in exact algorithms, as this would imply that states not corresponding to the answer have non-zero probability. I'm not sure about this point though. +(note that Grover's algorithm for $4$ states uses amplitude amplification and gives an exact answer. This is an exception though I would say)

+",2005,,,,,1/31/2020 9:02,,,,5,,,,CC BY-SA 4.0 +9704,2,,9701,1/31/2020 10:48,,2,,"

In an article Towards Pricing Financial Derivatives with an IBM Quantum Computer PCA is implemented in a practical way with an example.

+ +

Operator $U_{prep}$ is realized with $\mathrm{U3}$ gates but parameters for some gates presented in the article seems wrong (maybe typo). See this thread for more information, correct $\mathrm{U3}$ parameters values and a way how to implement PCA on IBM Q.

+ +
+ +

EDIT: How to find parameters $\theta$, $\phi$ and $\lambda$ for implementation of $U_{prep}$ with $\mathrm{U3}$ gate.

+ +

$\mathrm{U3}$ gate has this form:

+ +

$$ +\mathrm{U3}= +\begin{pmatrix} +\cos(\theta/2) & -\mathrm{e}^{i\lambda}\sin(\theta/2) \\ +\mathrm{e}^{i\phi}\sin(\theta/2) & \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) +\end{pmatrix}. +$$

+ +

Firstly, you have to factor out some complex number (denote $c$) from $U_{prep}$ in order to have a real number on position $u_{11}$. After that you can easily calculate $\theta$ from $\cos(\theta/2)$. Then, it is not problem to find $\phi$ from $\mathrm{e}^{i\phi}\sin(\theta/2)$ and finnaly $\lambda$ from $\mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2)$.

+ +

The number $c$ factored out in the first step is a global phase. It is not important in case $\mathrm{U3}$ is used in its single qubit form. But if the gate is used as controlled one, the global phase cannot be neglected. So, you will have controlled $\mathrm{U3}$ and controlled global phase gate.

+",9006,,9006,,2/3/2020 10:37,2/3/2020 10:37,,,,4,,,,CC BY-SA 4.0 +9705,1,9708,,1/31/2020 11:11,,14,2484,"

There are two groups of quantum gates - Clifford gates and non-Clifford gates.

+ +

Representatives of Clifford gates are Pauli matrices $I$, $X$, $Y$ and $Z$, Hadamard gate $H$, $S$ gate and $CNOT$ gate. Non-Clifford gate is for example $T$ gate and Toffoli gate (because its implementation comprise $T$ gates).

+ +

While Clifford gates can be simulated on classical computer efficiently (i.e. in polynomial time), non-Clifford gates cannot. Moreover (if my understanding is correct), non-Clifford gates increase time consumption of a quantum algorithm far more than Clifford gates.

+ +

My questions are these:

+ +
    +
  1. Am I right that non-Clifford gates increase time consumption (or complexity of quantum algorithm)?
  2. +
  3. Why non-Clifford gates cannot be simulated efficiently? This is confusing for me, because $S$ and $T$ gates are both rotations with only different angle.
  4. +
+",9006,,55,,7/24/2020 12:16,7/24/2020 12:16,Why are non-Clifford gates more complex than Clifford gates?,,1,1,,,,CC BY-SA 4.0 +9706,2,,9700,1/31/2020 11:20,,2,,"

Say you want to factorise a large integer $N$. We know (inefficient) classical algorithms to do this, a naive example being: just check all combinations of smaller numbers until you find one that multiplies to $N$. You can make this into a quantum algorithm by simply converting each operation in your classical algorithm into a reversible one (there are standard ways to do this). This leaves you with an (inefficient) quantum algorithm that solves the problem deterministically.

+ +

Here, deterministic means that the output of the algorithm is 1) fully determined by its input and 2) gives you the answer directly. For example, in the factoring case, the output of the device might be a series of qubits. You know the output by measuring these qubits and thus getting a sequence of bits, which you can put together to know your answer (exactly like what you do in the classical case).

+ +

This is clearly, however, not a very useful quantum algorithm (you might as well just use a classical computer instead). So one can try something different, e.g. Shor's algorithm. Now, this is efficient, but not deterministic. This means that running the algorithm just once will not, in general, be enough to solve the problem. To simplify, you can imagine that each run of the algorithm will give you a different output, but that having enough of these outputs you can put them together to get your answer (with the whole process being still more efficient than the classical solution).

+ +

An example of a less artificial deterministic quantum algorithm would be Deutsch-Jozsa.

+ +
+

Can you use probability amplification in an exact algorithm? If so, are they really all that different?

+
+ +

What would be the point? If the algorithm is exact/deterministic, then there is nothing to amplify. If anything, you might want to use amplitude amplification with a non-exact algorithm, to amplify the success probability. Bear in mind however that even just running non-exact algorithms enough times is usually enough to get the right answer with probability close to one.

+",55,,,,,1/31/2020 11:20,,,,7,,,,CC BY-SA 4.0 +9707,1,9710,,1/31/2020 13:30,,1,165,"

Based on the properties of the qubit, how could I solve this problem:

+ +
    +
  • I have 3 person A B C and 2 taxis T1 and T2
  • +
  • A and B are friends
  • +
  • B and C hate each other
  • +
  • A and C hate each other
  • +
+ +

How could I maximize the pairs of people (A,C), (A,B) and (B,C) which are friends +and minimize the pairs of people who hate each other using qubits?

+ +

I know that 'pair' means entangled, so I have the possible 'pairs' in a quantum state

+ +

$$ a|AB\rangle +b|AC\rangle+c|BC\rangle $$

+ +

satisfying $ |a|^{2}+|b|^{2}+|c|^{2}=1 $ after normalization.

+",9937,,9006,,1/31/2020 23:05,1/31/2020 23:20,Quantum algorithm for binary assignment problem,,1,4,,,,CC BY-SA 4.0 +9708,2,,9705,1/31/2020 19:44,,10,,"
    +
  1. Yes, you are correct. Non-Clifford gates cannot be transversely implemented, instead implementation generally requires distilling magic states or Toffoli states. In practice this requires significantly more spacetime volume than Clifford gates. For reference, see the introduction sections here and here.

  2. +
  3. The natural expectation would be that no quantum gates can be simulated efficiently by classical computers since an n-qubit quantum circuit operates in a $2^n$-dimensional Hilbert space. The (arguably) surprising result is that circuits consisting only of Clifford gates can be simulated efficiently (by the Gottesman-Knill Theorem). It's a very natural situation that non-Clifford gates cannot be simulated efficiently because of the size of Hilbert space in which they operate. If both Clifford and non-Clifford gates could be simulated efficiently by classical computers, there would be no (or at least drastically reduced) motivation to build quantum computers.

  4. +
+",8623,,,,,1/31/2020 19:44,,,,0,,,,CC BY-SA 4.0 +9709,2,,6099,1/31/2020 21:39,,1,,"

I think your misunderstanding is in the wording of the secret key rate; The PLOB-Bound offers an asymptotic, ultimate-upper bound on the secret key rate per use of a lossy bosonic channel.

+ +

This bound on the secret key rate is computed as a regularisation, where one considers the infinite limit of $ n \rightarrow \infty$ transmissions across the channel in order to create an infinitely long secret key. Specifically, the regularised relative entropy of entanglement of a teleportation resource state $\hat{\rho}$, +\begin{equation} +\mathcal{C}(\mathcal{E}) \leq E_R^\infty(\hat{\rho}) := \lim_{n\to\infty} {1\over n} E_R(\hat{\rho}^{\otimes n}). +\end{equation} +Each transmission used within the QKD protocol is therefore considered a use of the channel. This considers only one quantum channel - one does not introduce a new channel for each degree of freedom that the quantum information being transmitted may have.

+ +

The generality of the PLOB-Bound and its versatility to a variety of channels using Discrete Variable or Continuous Variable quantum information, makes it extremely useful as an optimal upper bound to strive for in realistic implementations of QKD. If you would like more insight into the techniques used in this paper (channel simulation, teleportation stretching, etc.), check out this paper.

+ +

Furthermore, more recent work using these techniques attempts to determine more expedient bounds on the secret key rate for CVQKD. Here they investigate sub-optimal, but finite energy resource states within the teleportation stretching protocols, which converge to the optimal bound in the limit of infinite energy resource states.

+",9839,,,,,1/31/2020 21:39,,,,0,,,,CC BY-SA 4.0 +9710,2,,9707,1/31/2020 23:20,,2,,"

I will try to give you a hint how to rewrite your problem as an binary optimization problem which can be solved on quantum annealer, i.e. a single purpose quantum computer for solving optimization task (see more about annealers here).

+

Your problem as an binary assignment problem:

+

Lets denote $x_{ik} \in \{0;1\}$ a binary variable meaning whether a person $i$ is assigned to a taxi $k$ (i.e. $x_{ik} = 1$) or not (i.e. $x_{ik} = 0$). Further let $P$ be a set of persons and $T$ set of taxis. Without loss of generality, assume that number of taxi is half the number of persons (in case number of persons is odd, you can add a dummy person, when the dummy is assigned to some taxi, this means that only one person is in the taxi).

+

Lets denote $c_{ijk}$ a cost of assigning persons $i$ and $j$ to taxi $k$. In case the persons are friends then $c_{ijk} = 1$, in case they hate each other then $c_{ijk} = -1$ and if one person is the dummy one then $c_{ijk} = 0$.

+

Your objective function is

+

$$ +f = \sum_{i,j \in P \\k \in T} c_{ijk}x_{ik}x_{jk} \rightarrow \mathrm{MAX}, +$$

+

subject to conditions

+

$$ +\forall k \in T: \sum_{i \in P} x_{ik} = 2 +$$

+

and

+

$$ +\forall i \in P: \sum_{i \in T} x_{ik} = 1 +$$

+

The first condition means that there are two persons in each taxi, the second one means that each person is assigned to just one taxi.

+

Now you can employ a quantum annealer to perform the optimization.

+",9006,,-1,,6/18/2020 8:31,1/31/2020 23:20,,,,1,,,,CC BY-SA 4.0 +9713,2,,9662,2/1/2020 9:17,,1,,"

I found a very nice result in Audenaert, ""Quantum skew divergence"", J of Mathematical Physics, 2014 (also cited in Kim and Ruskai, ""Bounds on the concavity of quantum entropy"", J of Mathematical Physics, 2014). + Theorem 14 in Audenaert bounds the Holevo information between $A$ and $B$ as +$$\chi(B;A) \le h(\epsilon) T(\rho_A, \sigma_A) +$$ +where $h(\epsilon)=-\epsilon \ln \epsilon - (1-\epsilon) \ln (1-\epsilon)$ is the binary Shannon entropy and $T(\rho_A, \sigma_A) = \frac{1}{2} \lVert \rho_A-\sigma_A\rVert_1$ is the trace distance. +For our classical-quantum state, $S(B|A)= S(B) - \chi(B;A)$, which gives +$$S(B|A) \ge (1 - T(\rho_A, \sigma_A)) h(\epsilon),$$ +which is exactly the kind of bound I was looking for.

+",9900,,,,,2/1/2020 9:17,,,,1,,,,CC BY-SA 4.0 +9714,1,,,2/1/2020 17:34,,-2,84,"

According to some references (Lectures on Quantum Computation at Carnegie Mellon School of Computer Science) Grover’s algorithm uses only O($\sqrt{N}\ln {N}$) gates.

+ +

Using this to calculate desired hash (such as you have in Bitcoin) will require, as I interpret the above - $256\times{2^{128}}$ gates. +Is this correct interpretation?

+",9261,,9006,,2/1/2020 19:01,2/4/2020 9:51,Grover’s algorithm,,1,6,,2/4/2020 16:24,,CC BY-SA 4.0 +9715,1,9718,,2/1/2020 19:09,,2,116,"

On a view places, I've seen kets that look like this $\left|+\right>$ or this $\left|-\right>$ but I don't seem to find any explanation of this base online. Is it just a different notation for $0$ and $1$, or does it mean something else? Thanks for your help!

+",9950,,9006,,2/1/2020 23:25,2/1/2020 23:25,What are $|+\rangle$ and $|-\rangle$?,,1,2,,,,CC BY-SA 4.0 +9716,1,14672,,2/1/2020 19:22,,3,237,"

I'm discovering ZX-Calculus, and it seems to be much easier to do computations on circuit that would take much more time with the usual formalism. However, I can't find a nice way to represent measurements (instead of post-selection) and compute the output probabilities. I have the feeling that normalisation and adding variables to a ""one-leg"" spiders could help, but I'm not yet convinced that it's the good way to go.

+ +

And for example, can ZX-calculus deal with ""impossible""/not normalisable circuits, like ""create a plus state and project it on minus"" ?

+ +

Thanks!

+",5969,,,,,11/16/2020 10:14,ZX-calculus : measurement and output probabilities,,2,1,,,,CC BY-SA 4.0 +9717,2,,9716,2/1/2020 19:39,,2,,"

In the ZX calculus, the closest thing to a graph that measures an observable is a graph that post-selects that observable to be in its $+1$ eigenbasis.

+ +

If you are attempting to understand a surface code lattice surgery computation in terms of a ZX graph this is kind of annoying. You need to be able to figure out which postselections are just shorthands for unitary effects, and which ones are actual measurements of the inputs. The best way that I know of to do that is to perform Gaussian elimination on the table of things that are post-selected by each individual spider. The eliminated table then tells you the external observables that are postselected. Any observable that is input-only or output-only indicates the presence of a measurement.

+ +

+",119,,,,,2/1/2020 19:39,,,,6,,,,CC BY-SA 4.0 +9718,2,,9715,2/1/2020 19:53,,6,,"

The set $\{ \left|+\right>, \left|-\right> \}$ is known as the polar basis. It easy to see that they are the result of applying the Hadamard transform $H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}$ to the standard basis vectors of a one-dimensional Hilbert space: +$$ +H\left|0\right> = \left| + \right>, +$$ +$$ +H\left|1\right> = \left| - \right>. +$$ +You can read more about them Hadamard transform here.

+",8438,,,,,2/1/2020 19:53,,,,2,,,,CC BY-SA 4.0 +9719,1,9723,,2/3/2020 0:08,,2,74,"

I am reading about Entanglement-assisted Quantum Error Correction Codes from Quantum Information Processing and Quantum Error Correction: An Engineering Approach (Chapter 9) . It is a scheme that allows the usage of any classical error correction code. Furthermore, it uses entangled qubits (ebits) which is the Bell state $\vert \Phi^+ \rangle$. It is assumed to be error-free and shared between the sender Alice and receiver Bob, prior to the start of the communication.

+ +

Alice will encode her state $\vert \psi \rangle$ with the help of local ancillary qubits $\vert 0 \rangle$ and her half of shared ebits. She will then sends the encoded qubits over a noisy quantum channel.

+ +

The book then states:

+ +
+

Notice that the channel does not affect the receiver’s half of shared + ebits at all.

+
+ +

How is that even possible? I thought if one entangled subsystem changes, then the other changes automatically.

+ +

Furthermore, consider the following (to make it simple, assume one ebit is used which is shared between Alice and Bob before communication begins). Let us say Alice will send her half of the ebit over the noise channel and a bit-flip occurred, what happens to the other half (Bob's half)?

+",7528,,,,,2/3/2020 9:10,The behaviour of ebits in Entanglement-assisted Quantum Error Correction Codes?,,2,0,,,,CC BY-SA 4.0 +9720,1,9721,,2/3/2020 2:19,,3,462,"

There is a basis consisting of $|0\rangle$ and $|1\rangle$ states, i.e. z-basis. Why do we need different basis (in quantum computation), like polar basis and others ($|+\rangle$ and $|-\rangle$)?

+",8491,,9006,,2/3/2020 5:26,2/4/2020 12:04,Why do we need different basis vectors?,,2,0,,,,CC BY-SA 4.0 +9721,2,,9720,2/3/2020 4:51,,4,,"

It is not clear for me what need means here.

+ +

Transformation between standard $\{|0\rangle, |1\rangle \}$ basis and a different basis is unitary, so instead of measuring in an arbitrary basis we can apply a proper unitary gate and measure in the standard basis; we can do all measurements in the standard basis, this is enough for quantum computation. If our quantum computer supports measurements in $\{|+\rangle, |-\rangle \}$ basis, then we can use this option to optimize computation or ignore.

+ +

We don't really need different bases, we just can use them if our quantum hardware supports measurements in different bases.

+",2105,,2105,,2/4/2020 12:04,2/4/2020 12:04,,,,3,,,,CC BY-SA 4.0 +9722,2,,9720,2/3/2020 5:34,,0,,"

I would add the different basis are necesary for quantum tomography. If you want to describe quantum state competely, you have measure it in different basis. For example measuring states $\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$ and $\frac{1}{\sqrt{2}}(|0\rangle+\mathrm{e}^{i\frac{\pi}{2}}|1\rangle)$ in standard basis returns $|0\rangle$ and $|1\rangle$ both with probability 50 % but the second state has relative phase $\frac{\pi}{2}$ about which you know nothing. But mesuring in other basis allows you to get information about the phase. In plain words, this means that you look at a quantum states from different angles of view which allows you to see ""all its properties"".

+ +

Moreover, sometimes, it is more convenient to switch from standard basis to other one because of simplier calculations.

+",9006,,,,,2/3/2020 5:34,,,,0,,,,CC BY-SA 4.0 +9723,2,,9719,2/3/2020 8:09,,3,,"

If you have a noisy channel +$$ +\rho\mapsto \mathcal{E}(\rho) +$$ +for a single qubit, then if you have a Bell pair +$$ +\rho_B=\frac12\left(|00\rangle+|11\rangle\right)\left(\langle 00|+\langle 11|\right), +$$ +then you can describe the effect of sending the first qubit through the channel using +$$ +(\mathcal{E}\otimes I)\cdot\rho_B. +$$ +Thus, mathematically, you see the operator is only acting on the first qubit. I think this is primarily what the authors were meaning. Now, it depends on what the noise actually does as to whether the state of the second qubit (not sent through the channel) actually changes. If the action of the channel is just a unitary, it really doesn't change the second qubit. This is because +$$ +\text{Tr}_1(U_1\otimes I\cdot\rho_{12})=\text{Tr}_1(\rho_{12}) +$$ +for all possible states $\rho_{12}$ and and possible unitaries $U_1$. On the other hand, a measurement on the first qubit would change the second qubit. However, even in that case, unless the person holding the second qubit knows what measurement was performed, and what the result was, their description of that qubit (in terms of a density matrix, for example), does not change.

+ +

For example, if your channel applies $X$ on the first qubit of an entangled pair (I won't use the Bell pair, because using a maximally entangled state creates some ambiguity), the overall state changes to +$$ +\alpha|00\rangle+\beta|11\rangle\rightarrow\alpha|10\rangle+\beta|01\rangle. +$$ +It's not entirely a fair question, really, to be asking ""has the second qubit changed?"". The state is a state of both qubits and you cannot talk about just the state of one qubit. However, it is certainly true that (i) the action can always be described as an action just on the first qubit (as it happen, in this basis, you can describe it by an action on the second qubit instead, but that's not universally true) and (ii) the reduced density matrix of the second qubit does not change. It is $|\alpha|^2|0\rangle\langle 0|+|\beta|^2|1\rangle\langle 1|$ both before and after the error.

+",1837,,,,,2/3/2020 8:09,,,,1,,,,CC BY-SA 4.0 +9724,2,,8543,2/3/2020 8:15,,3,,"

You can take the definition of the function $f(x)$ acting on any normal matrix to be such that if +$$ +M=\sum_i\lambda_i|\lambda_i\rangle\langle\lambda_i|, +$$ +then +$$ +f(M):=\sum_if(\lambda_i)|\lambda_i\rangle\langle\lambda_i|. +$$ +So for any $M$ such that $M^2=I$, then $M=P_+-P_-$ is described using projectors onto its $\pm1$ eigenspaces, and $P_++P_-=I$. We can solve these simultaneously to get $P_+=(I+M)/2$ and $P_-=(I-M)/2$. Now, +$$ +f(M)=e^{it}P_++e^{-it}P_-=e^{it}(I+M)/2+e^{-it}(I-M)/2=\cos(t)I+i\sin(t)M. +$$

+",1837,,,,,2/3/2020 8:15,,,,0,,,,CC BY-SA 4.0 +9725,2,,9719,2/3/2020 9:10,,2,,"

The fact that the channel does not affect to half of the ebits is an assumption that is made when entanglement-assisted quantum error correction is considered. It is usually thought as if the sender and the receiver pre-share this EPR pairs beforehand, and so then only half of the ebits (the ones from the sender) do go through the channel and suffer its action.

+ +

Obviously, this will not be practical nor realizable in reality, and so different entanglement distribution protocols will be needed so that the ""noiseless"" ebits reach the receiver (i.e. entanglement distillation, protecting such half with unassisted QECCs ...). This paradigm is studied in Entanglement-Assisted Quantum Error-Correcting Codes with Imperfect Ebits, I give the reference so that you can further deepen your knowledge about QECCs operating with noisy shared entanglement.

+",2371,,,,,2/3/2020 9:10,,,,1,,,,CC BY-SA 4.0 +9726,2,,9507,2/3/2020 11:04,,3,,"

Based on comment by DaftWullie and my experience with the algortihm, it seems that a title of the article is misleading.

+ +

The authors claim that algorithm they proposed is efficient. However, this is true only partialy. The authors devised only part of an algorithm for solving TSP. In particular, they are able to calculate length of a Hamiltonian cycle described by an eigenstate but this has to be provided in advance. The authors also mentioned application of a quantum function minimization algorithm but this algorithm is based on assumption that we have a list of all possible function values. In this case these values are eigenstates representing all Hamiltonian cycles and there are $(n-1)!$ such eigenstates. Moreover, the list has to be stored in a memory (maybe qRAM). However, qRAM is rather experimental nowadays.

+ +

To sum up:

+ +
    +
  • The proposed algorithm is in fact only part of complete algorithm for solving TSP
  • +
  • The algorithm is efficient only if it is possible to list all Hamiltonian cycles efficiently about which I am not sure (at least I was not able to find any algorithm for doing so) (THIS IS THE MAIN OBSTACLE)
  • +
  • The algorithm needs qRAM which is not avaiable now
  • +
+",9006,,,,,2/3/2020 11:04,,,,1,,,,CC BY-SA 4.0 +9728,1,9732,,2/3/2020 15:41,,1,153,"

So I have been given the following quantum states:

+ +

$$\rho = \frac{I}{2} + \frac{\bar{s}.\bar{\sigma}}{2}$$ +$$\pi = \frac{I}{2} + \frac{\bar{r}.\bar{\sigma}}{2}$$

+ +

How do I calculate the fidelity between the two?

+ +

I know that the general formula for fidelity is: $tr\sqrt{\rho^{1/2}\pi\rho^{1/2}}$

+ +

I want to know if there's any way to calculate the fidelity other than to go through the mess of diagonalizing the respective matrices of $\rho \text{ and } \pi$.

+",9959,,55,,2/4/2020 10:33,2/4/2020 10:33,Can I compute the fidelity between two states without having to diagonalise them?,,1,0,,,,CC BY-SA 4.0 +9729,1,9733,,2/3/2020 16:01,,13,1994,"

Currently, quantum computer science (in contrast to classical computer science) can mostly only be understood if one has a good inside knowledge of physics, or more precisely quantum physics. Only then one can really understand the explanations of superposition, coherence, entanglement, etc. in relation to Qubits. I felt the same way and had to take the extra physics course, in order to really get into Quantum Computing.

+ +

However, I heard more and more that it is ""theoretically"" possible to abstract quantum computer science to such a degree, that knowledge in physics is no longer required. Is there any truth to this or is it just way too conceptual so far?

+ +

(And yes, I am aware that this question might be more related to didactics rather than on-topic with this board. But I wasn't quite sure if I should've posted it on StackOverflow. So, forgive my error, given I've done one)

+",8640,,55,,11/4/2020 16:02,11/4/2020 16:02,Does quantum computing already possess the level of abstraction to be explicable even without knowledge of physics?,,2,3,,,,CC BY-SA 4.0 +9731,2,,9729,2/3/2020 17:46,,5,,"

I believe it is possible to study Quantum Mechanics by studying Quantum Computing.

+ +

A qubit is a simplest quantum system showing non-classical behavior (superposition of basis states). It is very logical to start studying Quantum Mechanics from the simplest quantum system, and then move to more complex multiqubit systems. If you need Quantum Mechanics to understand Quantum Information Science, study Quantum Mechanics of qubits!

+ +

I like very much introductory online course on Quantum Mechanics and Quantum Computation by Prof. Vazirani, now archived, which is an interesting attempt to teach both Quantum Mechanics and Quantum Computation in a single course.

+",2105,,,,,2/3/2020 17:46,,,,0,,,,CC BY-SA 4.0 +9732,2,,9728,2/3/2020 18:13,,3,,"

If these are qubit states, the formula in your question simplifies dramatically to $$F'(\rho,\pi)=\sqrt{\text{tr}(\rho \pi) + 2 \sqrt{\text{det}(\rho) \text{det}(\pi)}}.$$

+ +

If you consider the components of the vectors, $\vec s = (s_1, s_2, s_3)$ and $\vec r = (r_1, r_2, r_3)$, this can be expressed simply as $$F'(\rho, \pi) = \frac{1}{\sqrt{2}} \left[1+ \sum \limits_{i=1}^3 s_i r_i + \sqrt{(1-\vert \vec s \vert^2)(1-\vert \vec r \vert^2)} \right]^\frac{1}{2}.$$

+ +

Note that the formula you provided is normally referred to as quantity fidelity ($F'$), defined in terms of fidelity ($F$) by $F'\equiv\sqrt{F}$.

+",8623,,8623,,2/4/2020 5:41,2/4/2020 5:41,,,,2,,,,CC BY-SA 4.0 +9733,2,,9729,2/3/2020 19:17,,12,,"

I don't think you need to know quantum physics to understand quantum computing - similarly to how you don't think about the hardware implementation of the classical computers when you write high-level code for them.

+ +

The field of quantum computing has grown to the point where one cannot really teach all of it in one course, so different approaches to teaching emerge. Some courses indeed start with quantum mechanics, introducing qubits as particles and operations as physical processes on them. Others choose to abstract the physics away and to discuss the quantum computing algorithms in mathematical terms - representing states as vectors, operators as matrices and so on. Examples include:

+ + + +

There is plenty of material to cover even without diving deep into physics, and there are lots of programming languages that allow the learner to focus on studying and implementing the high-level algorithms instead.

+",2879,,,,,2/3/2020 19:17,,,,1,,,,CC BY-SA 4.0 +9734,1,9745,,2/3/2020 20:28,,2,144,"

I have been trying to install Qiskit in a virtual Python environment via pip through Miniconda command prompt on Windows 10. The issue is with using Microsoft Visual Studio tools such cl, nmake, etc. The command prompt cannot find them. However, I followed the Qiskit's installation instructions and I have installed Microsoft Visual C++ Redistributor 2015.

+ +

I tried to find to add Microsoft Visual C++ Redistributor 2015 as a path variable but couldnt find its location (not in C:/programfiles (x64)/Microsoft Visual Studio).

+ +

Any help is greatly appreciated!!!!

+ +

+",9960,,9960,,2/7/2020 1:49,2/7/2020 1:49,Installing Qiskit Error: Building wheel failed!,,1,3,,,,CC BY-SA 4.0 +9735,2,,9714,2/4/2020 9:51,,1,,"

The $O(N)$ notation does not mean what you're interpretting it to mean. All it means is that as $N$ grows, the running time scales roughly linearly in $N$. But there are constants that are suppressed ($O(N)$ could mean $10^9N$ or $10^{-9}N$) and also ignores all terms in a summation that could grow more slowly, such as $N^{0.95}$ (even if they could dominate at small sizes). It is often not trivial to work out the exact number of gates required for an algorithm, and you certainly need to know a lot more details of the algorithm.

+",1837,,,,,2/4/2020 9:51,,,,1,,,,CC BY-SA 4.0 +9736,1,,,2/4/2020 14:13,,1,288,"

Dear team and developers.

+

I am using qiskit on Python 36, windows 64bits

+

I have the same identical problem of Import from qiskit-aqua error

+

But the suggested solution (installing Numpy+mkl, I did it!) is not the solution in my case as the error persists and I am desperate.

+
Traceback (most recent call last):
+  File "C:\Users\root\eclipse-workspace\Dir\file.py", line 11, in <module>
+    from qiskit.aqua.components.uncertainty_models import UniformDistribution, UnivariateVariationalDistribution 
+  File "C:\Users\root\AppData\Local\Programs\Python\Python36\lib\site-packages\qiskit\aqua\__init__.py", line 29, in <module>
+    from .utils.backend_utils import (get_aer_backend,
+  File "C:\Users\root\AppData\Local\Programs\Python\Python36\lib\site-packages\qiskit\aqua\utils\__init__.py", line 27, in <module>
+    from .qp_solver import optimize_svm
+  File "C:\Users\root\AppData\Local\Programs\Python\Python36\lib\site-packages\qiskit\aqua\utils\qp_solver.py", line 18, in <module>
+    from cvxopt import matrix, solvers
+  File "C:\Users\root\AppData\Local\Programs\Python\Python36\lib\site-packages\cvxopt\__init__.py", line 50, in <module>
+    import cvxopt.base
+ImportError: DLL load failed: The specified module could not be found.
+
+

I re-installed everything, all is up to date.

+

Please help.

+",9966,,16092,,6/30/2021 23:00,11/28/2021 0:02,from qiskit.aqua import... ImportError: DLL load failed: The specified module could not be found,,0,5,,11/28/2021 13:57,,CC BY-SA 4.0 +9737,1,,,2/4/2020 18:30,,3,226,"

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 functions out there or any hash functions that could be easily built into a quantum circuit (obviously building up from classical circuits)

+ +

Any help would be great Thanks!

+",9902,,,,,4/15/2021 14:34,Easiest hash function to implement on Qiskit,,1,0,,,,CC BY-SA 4.0 +9738,1,,,2/4/2020 20:58,,2,61,"

The connection between physical qubits of IBM devices are all bidirectional or there are some architectures that there existing some unidirectional connection?
+I found that in IBM Quantum experience, all the device connections are bidirectional, I was wondering if there are some exceptions?

+",9105,,,,,2/4/2020 21:18,Are all the IBM QX mapping bidirectional?,,1,0,,,,CC BY-SA 4.0 +9739,2,,9738,2/4/2020 21:18,,4,,"

All of the backends are bidirectional from the viewpoint of Qiskit. The Cross-Resonance (CR) gate used in implementing the CNOT has a natural preferred direction associated with it, but accounting for the direction is done automatically by the devices, thus yielding a bi-directional topology.

+",332,,,,,2/4/2020 21:18,,,,3,,,,CC BY-SA 4.0 +9740,1,9741,,2/5/2020 5:04,,2,123,"

I'm trying to solve problem 11.3 in Nielsen Chuang:

+ +
+

(3) Prove the conditional version of the triangle inequality: + $$ +S(A,B|C)\geq S(A|C)-S(B|C) +$$

+
+ +

But the inequality seems incorrect. For example, let +$$ +|\psi\rangle = \frac{|0\rangle|0\rangle|00\rangle+|0\rangle|1\rangle|01\rangle+|1\rangle|0\rangle|10\rangle+|1\rangle|1\rangle|11\rangle}{2},\\ +\rho^{ABC} = |\psi\rangle\langle\psi|. +$$ +Then: +$$ +\rho^{C}=\frac{I}{4},\\ +\rho^{AC}=\rho^{BC}=\frac{I}{2},\\ +S(A,B|C)=S(A,B,C)-S(C)=0-2,\\ +S(A|C)=S(B|C)=1-2=-1,\\ +S(A,B|C)=-2<0=S(A|C)-S(B|C). +$$

+ +

Am I doing something wrong, or did the problem mean to say $S(A,B)\geq S(A|C)-S(B|C)$ or something?

+",9970,,55,,11/4/2020 16:02,11/4/2020 16:02,Conditional version of the triangle inequality for Von Neumann entropy,,1,0,,,,CC BY-SA 4.0 +9741,2,,9740,2/5/2020 11:30,,2,,"

You've computed $\rho^{AC},\rho^{BC}$ incorrectly $-$ they are matrices of size $8\times 8$, also they are not equal to $I/8$. Nevertheless their entropy is equal, i.e. $S(A,C) = S(B,C)$. So $|\psi \rangle$ is indeed a counterexample to the statement.

+ +

The inequality $S(A,B)\geq S(A|C)-S(B|C)$, which is equivalent to +$$ +S(A,B) + S(B,C) \geq S(A,C) +$$ +is probably what they had in mind.

+",5870,,5870,,2/5/2020 14:48,2/5/2020 14:48,,,,0,,,,CC BY-SA 4.0 +9742,1,,,2/5/2020 13:01,,1,137,"

How can we show that HHL algorithm achieves exponential speedup?

+",9973,,9006,,2/5/2020 13:52,2/5/2020 22:49,Where will I find necessary math to understand HHL algorithm?,,1,4,,,,CC BY-SA 4.0 +9743,2,,9695,2/5/2020 16:14,,-3,,"
from qiskit import *
+simulator = Aer.get_backend('qasm_simulator')
+
+",9975,,,,,2/5/2020 16:14,,,,3,,,,CC BY-SA 4.0 +9745,2,,9734,2/5/2020 16:41,,1,,"

Try installing using

+ +
+

pip install wheel

+
+ +

Refer here.

+ +

Wheels are the new standard of Python distribution and are intended to replace eggs. Support is offered in pip >= 1.4 and setuptools >= 0.8.

+",9975,,,,,2/5/2020 16:41,,,,1,,,,CC BY-SA 4.0 +9746,2,,9742,2/5/2020 22:49,,1,,"

You can find details about the algorithm optimality and complexity in the original paper by Harrow, Hassidim and Lloyd: Quantum algorithm for solving linear systems of equations, mainly in parts III and appendix 5.

+ +

An article Quantum Circuit Design for Solving Linear Systems of Equations may be interesting for you as well. It contains a ""practical"" example HHL algorithm application.

+",9006,,,,,2/5/2020 22:49,,,,0,,,,CC BY-SA 4.0 +9747,1,9819,,2/6/2020 2:15,,2,199,"

Short version:

+ +

How could I prove in ZX-calculus that these two diagrams are equal (up to a global phase), using axioms from this paper (Fig. 1) for example? Any intuition is welcome!

+ +

+ +

Long version:

+ +

I'm starting to learn about ZX-Calculus, and I wanted to try to see the different ways to perform a CZ gate (rotation of $\pi$ angle). And it appears that there are (at least) three different ways (sorry for the bad quality of the drawings):

+ +

Version 1:

+ +

+ +

Version 2: (note the minus sign on the bottom qubit)

+ +

+ +

Version 3:

+ +

+ +

Now, version 2 is very easy to derive from version 1 if we take the axiom (EU) of this paper (we will call this axiom (EU1)), and version 3 is also easy to derive from version 1 if we take the axiom (EU) of this paper (we will call this axiom (EU2)).

+ +

But I can't find how to go from version 2 to version 3 by using only the axioms in the first paper (including EU1), or the other way around. Basically, it should be enought to prove that these two diagrams are equal (and I made the computation: they are equal, up to a global phase):

+ +

+ +

Any idea how to prove the equality of these two diagrams with axioms only from the first paper for example? It seems super easy (just 1/2 nodes!)... but I can't make it... Any intuition is welcome!

+",5969,,,,,2/10/2020 16:52,ZX-Calculus: how to prove this simple equation between two very small circuits,,2,0,,,,CC BY-SA 4.0 +9748,1,9757,,2/6/2020 4:02,,2,137,"

I am trying to implement multiple parallel subroutines of HHL algorithm, each working on a different set of matrix $A$ (when solving for $x$, in $A\vec{x} = \vec{b}$), to find the expectation values of $|x\rangle$. The matrix $A$ is randomly generated Hermitian matrix, and may/may not be sparse (checking what happens, is also something I'm wondering).

+ +

I have the following queries:

+ +
    +
  1. If I understand correctly, I need to encode eigenvalues of a $2 \times 2$ matrix $A$, say $\lambda_1$ and $\lambda_2$ in the quantum register. Is that right? How do I do that?
  2. +
  3. Is the quantum register initialized with the binary values of $\lambda_1$ and $\lambda_2$? Does that mean 2 runs of HHL? Is finding Eigenvalues of matrix $A$ supposed to be a classical subroutine?
  4. +
+",2391,,2391,,2/6/2020 8:00,2/6/2020 12:29,How to encode eigenvalues of matrix $A$ in solving $A\vec{x} = \vec{b}$ using the HHL Algorithm,,1,2,,,,CC BY-SA 4.0 +9750,2,,8972,2/6/2020 6:16,,-1,,"

Do install Microsoft Visual C++ . So tat the error can be satisfied. And also do pip install wheel.

+",9975,,,,,2/6/2020 6:16,,,,0,,,,CC BY-SA 4.0 +9752,1,9756,,2/6/2020 9:30,,19,12012,"

I learned that T1 is relaxation time (time from $|1\rangle$ to $|0\rangle$) and T2 is coherence time. +The relaxation is a specific case of decoherence. +What's the difference between them and what's the exact meaning of coherence time T2?

+",9105,,9006,,2/6/2020 9:48,2/4/2021 0:00,What's the difference between T1 and T2?,,2,0,,,,CC BY-SA 4.0 +9756,2,,9752,2/6/2020 9:47,,16,,"

T2 is so-called dephasing time.

+

It describes how long the phase of a qubit stays intact. In your words, it is time from $|+\rangle= \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ to $|-\rangle= \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$, or conversely.

+

Just note that both T1 and T2 are not actually "time from state x to state y" but rather decay constants. Probability that a qubit will stay in state $|1\rangle$ after time $t$ is given by formula

+

$$ +P(|1\rangle) = \mathrm{e}^{-\frac{t}{T1}}. +$$

+

Similarly for T2.

+

Both times T1 and T2 are together called decoherence times.

+",9006,,10480,,2/4/2021 0:00,2/4/2021 0:00,,,,0,,,,CC BY-SA 4.0 +9757,2,,9748,2/6/2020 12:29,,2,,"

Finding the eigenvalues of $A$ is an intermediate part of the HHL algorithm (although it will not output them). It is a quantum routine known as phase estimation, for which you need to be able to implement a controlled-unitary evolution where the unitary is determined by $U=e^{iAt}$ for some $t$. You do not need to find them by any classical routine. However, you do need some prior information: a bound on the range that the eigenvalues can occupy (this determines the $t$ in the previous relation), and a bound on how close to zero these eigenvalues might be (this determines how large a register you need for performing the phase estimation).

+",1837,,,,,2/6/2020 12:29,,,,0,,,,CC BY-SA 4.0 +9758,1,,,2/6/2020 13:31,,1,194,"

I am currently doing my final year undegraduate research. For many quantum inspired algorithms are simulated on Matlab. However if I am to run the algorithms on a Quantum Simulator provided by IBM, will that carry any significant importance.

+ +

Basically what makes IBM Quantum simulator stand out from general Matlab based or other simulators which generates random numbers for qubits.

+",9759,,9006,,2/6/2020 22:13,2/9/2020 7:57,What is the difference between IBM quantum simulator and others,,1,1,,,,CC BY-SA 4.0 +9759,2,,9752,2/6/2020 14:16,,18,,"

Slight correction to Martin Vesely's answer: $T_2$ is not the (decay constant) time after which an initial state $|+\rangle$ will necessarily switch to the state $|-\rangle$. If it were, then error correction would be easy. Instead, it's the (decay constant) time after which an initial state $|+\rangle$ will evolve into an equal classical probabilistic mixture of the $|+\rangle$ and $|-\rangle$ states, so that you can no longer confidently predict the state. That is, it's the autocorrelation time after which the initial and final states become uncorrelated, not negatively correlated.

+",551,,,,,2/6/2020 14:16,,,,2,,,,CC BY-SA 4.0 +9760,2,,9700,2/6/2020 14:26,,2,,"

I asked basically the same question on CS stack exchange before this community was created. The answer is that the class of exact quantum algorithms has a name (EQP) but isn't very natural to study theoretically, because whether or not an exact algorithm can be executed depends entirely on the gate set that you have available, and moreover there's no universal gate set for this class of algorithms.

+ +

That having been said, one odd quirk of Grover's algorithm is that it's exact (in the sense that it's guaranteed to give a non-unique correct answer) if exactly one-quarter of the database is a valid solution. Of course, this is utterly useless in practice, because if you somehow knew that exactly one-quarter of the database was valid, then it would be much, much, much easier to just classically randomly query it, and you'd only need to to do so twice (in expectation) before finding a valid element.

+",551,,,,,2/6/2020 14:26,,,,0,,,,CC BY-SA 4.0 +9761,1,,,2/6/2020 17:00,,1,661,"

For my undergraduate final project I am working on a Quantum Inspired Genetic Algorithm.

+ +

For this I am using IBM Q real devices and I need to set a custom initial state on qubits. Using the statevector simulator this was possible, however I am not sure how to do so on real quantum hardware. For example I want to put qubit into state $|\psi\rangle = \sqrt{0.3}|0\rangle + \sqrt{0.7}|1\rangle$.

+",9759,,9006,,2/6/2020 22:11,2/6/2020 22:29,How to set initial state on IBM Q?,,1,11,,,,CC BY-SA 4.0 +9763,2,,9761,2/6/2020 22:29,,3,,"

To prepare an arbitrary single qubit state it is possible to use $\mathrm{U3}$ gate. The gate is defined by a matrix

+ +

$$ +\mathrm{U3}(\theta, \phi, \lambda)= +\begin{pmatrix} +\cos(\theta/2) & -\mathrm{e}^{i\lambda}\sin(\theta/2) \\ +\mathrm{e}^{i\phi}\sin(\theta/2) & \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) +\end{pmatrix}. +$$

+ +

When then gate is applied on a qubit in state $|0\rangle$ (i.e. initial state of all qubits on IBM Q), it is transformed to state

+ +

$$ +|\varphi_0\rangle = \cos(\theta/2)|0\rangle + \mathrm{e}^{i\phi}\sin(\theta/2)|1\rangle. +$$

+ +

Setting parameters $\theta$ and $\phi$ allows you to get any single qubit state you need.

+ +

In your case $|\psi\rangle = \sqrt{0.3}|0\rangle + \sqrt{0.7}|1\rangle$, so obviously $\phi = 0$.

+ +

Since $\cos(\theta/2) = \sqrt{0.3}$ parameter $\theta$ is given as

+ +

$$ +\theta = 2 \arccos(\sqrt{0.3}) = 1.9823. +$$

+ +

Note 1: In case $\alpha$ and $\beta$ are real numbers, $\phi = 0$ always and you can apply $\mathrm{Ry}(\theta)$ gate (i.e. y-rotation) with same parameter $\theta$ instead because $\mathrm{Ry}(\theta) = \mathrm{U3}(\theta,0,0)$.

+ +

Note 2: To preare any multiqubit quantum state, a method introduced in Transformation of quantum states using uniformly controlled rotations can be employed.

+",9006,,,,,2/6/2020 22:29,,,,0,,,,CC BY-SA 4.0 +9764,1,,,2/6/2020 23:28,,2,39,"

I wanted to know if there are some way in NISQ (we run ""bare"" gate without Q.E.C) to certify if an algorithm will give a correct or wrong answer based on the process of a single gate ?

+ +

For example in fault tolerant quantum computing, if you know the X,Y or Z error of a single logical gate you can easily tell what will be the probability that your full algorithm is wrong.

+ +

Are there similar constructions for NISQ ?

+",5008,,,,,2/6/2020 23:28,Dealing with noise in NISQ,,0,0,,,,CC BY-SA 4.0 +9765,1,,,2/7/2020 2:25,,3,54,"

In Quantum-inspired classical algorithms for principal component analysis and supervised clustering, the PCA algorithm requires that the variances of the principal vectors differ by at least a constant fraction of the Frobenius norm squared ($\sigma_{i+1}^2 - \sigma_i^2 \ge \eta ||A||_{F}^2$) and that the variance is above a certain constant $\sigma^2$. Can the assumption that the principal vectors have different variances be dropped and the output changed to just the hypervolume created by all the (unordered) principal vectors with at least a certain variance, $\sigma^2$? And, if so, what is the modified algorithm's computational complexity? From the remark,

+ +
+

As we assume our eigenvalues have an $\eta ||A||_F^2$ + gap, the precise eigenvector $|v_j\rangle$ sampled can be identified + by the eigenvalue estimate. Then, by computing enough + samples, we can learn all of the eigenvalues of at least $\sigma^2$ + and get the corresponding states

+
+ +

It seems like this should be fine, but later Tang adds,

+ +
+

Note that we crucially use the assumptions in Problem 7 + for our QML algorithm: without guarantee on the gap or + that $\sigma_i \ge \sigma$, finding the top k singular vectors would be + intractable, even with samples of $|v_i\rangle$’s.

+
+ +

leaves open the possibility it wouldn't work.

+",9305,,9006,,2/7/2020 5:42,2/7/2020 5:42,Variances of the principal components in Ewin Tang's PCA algorithm,,0,0,,,,CC BY-SA 4.0 +9766,1,9768,,2/7/2020 4:27,,1,481,"

I am trying to generate a Quantum Phase Estimation (QPE) circuit in QISKIT the following way.

+ +

1 - First, I generate a QPE circuit with the following code:

+ + + +
### building inverse quantum fourier transform circuit
+iqft = StandardIQFTS(2)
+iqft_circ = QuantumCircuit(QuantumRegister(2))
+iqft.construct_circuit(mode='circuit', qubits=iqft_circ.qubits, circuit=iqft_circ, do_swaps=True)
+
+### Defining matrix operator
+matrix = np.array([[1,0],[0,np.exp(1j*np.pi/4)]])
+
+### Defining Quantum Phase Estimation object
+eigs_qpe = EigsQPE(MatrixOperator(matrix=matrix),
+                   iqft,
+                   num_time_slices=2,
+                   num_ancillae=2,
+                   expansion_mode='trotter',
+                   expansion_order=1,
+                   evo_time=2,
+                   negative_evals=False,
+                   ne_qfts=[None,None])
+
+### Generating circuit
+eigs_circ = eigs_qpe.construct_circuit(mode=""circuit"")
+eigs_circ.draw(output=""mpl"")
+
+ +

2 - Then I want to prepend the following initial state to the previous circuit

+ + + +
vector = np.array([0,1])
+initial_state = Custom(1,state_vector=vector)
+
+ +

Thus getting a QPE computed on the initial_state. Is it possible to do this, for example by accessing eigs_circ.data and prepending the proper gates that generate the initial_state?

+",9877,,,,,2/10/2020 9:49,Prepending initial state to a quantum circuit in Qiskit,,1,0,,,,CC BY-SA 4.0 +9767,1,9773,,2/7/2020 8:01,,3,600,"

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 such as $11^x\mod15$. +

+ +

And what does this result mean?

+ +

+",9990,,9006,,2/7/2020 10:05,2/7/2020 14:12,Implementing QFT for Shor's Algorithm?,,1,0,,,,CC BY-SA 4.0 +9768,2,,9766,2/7/2020 8:28,,1,,"

If you have the circuit, you can get the registers the circuit acts on from eigs_circ.qregs. You can then create another circuit using the returned quantum register, add an instruction to it (initialize) and then add these two circuits together. Your final code should look something like

+ +
qregs = eigs_circ.qregs         # NB this is a list
+qc = QuantumCircuit(*qregs)
+qc.initialize([0,1], 0)         # You need to specify the qubits to act on
+overall_circ = qc + eigs_circ
+
+ +

The method for appending two circuits is here

+",5955,,5955,,2/10/2020 9:49,2/10/2020 9:49,,,,2,,,,CC BY-SA 4.0 +9769,1,9771,,2/7/2020 8:57,,6,982,"

I'm studying Shor's Algorithm. +In the book, author explains QFT can be replaced by Hadamard gates? +Why this process is possible??

+ +

+ +

Thank you everybody. This is QPE. I attach part of book!!

+ +

+",9990,,55,,8/1/2020 11:26,8/1/2020 11:26,Why can the QFT be replaced by Hadamard gates?,,2,3,,,,CC BY-SA 4.0 +9770,2,,9769,2/7/2020 10:45,,4,,"

The $H$ gates do not replace a Quantum Fourier Transform. The Quantum Phase Estimation algorithm is defined as shown in the picture you linked in your question:

+ +
    +
  1. Hadamard gates on all the ""ancillary"" qubits
  2. +
  3. Controlled unitary matrices (controlled circuits)
  4. +
  5. Inverse QFT.
  6. +
+ +

Having an inverse QFT at the end of the circuit does not necessarily mean that there should be a QFT beforehand.

+ +

In this case, the inverse QFT is used because it allows us to extract the information we want from a measurement. Go check the maths (on the Wikipedia page for example) to convince yourself that the $H$ gates at the beginning do not replace a QFT.

+ +

You can also try to replace the $H$ gates by a QFT, do the maths, and see by yourself what would be the result of the algorithm in this case. It seems to be a good exercise, and hopefully it will convince you that a QFT has nothing to do at the beginning of the Quantum Phase Estimation algorithm (EDIT: it was the worst example possible to convince yourself, see @DaftWullie's answer).

+",1386,,1386,,2/7/2020 12:58,2/7/2020 12:58,,,,1,,,,CC BY-SA 4.0 +9771,2,,9769,2/7/2020 11:13,,13,,"

While the QFT and Hadamard transforms are different, their action on the input state $|00\ldots 0\rangle$ is identical; both produce the uniform superposition of all states. So, if you've got a choice of which to use, you shoulduse the one that is the easiest to implement: the Hadamard transform. +Hadamard Transform: +$$ +H|0\rangle=\frac{|0\rangle+|1\rangle}{\sqrt{2}}\implies (H|0\rangle)^{\otimes n}=\frac{1}{\sqrt{2^n}}\sum_{x\in\{0,1\}^n}|x\rangle +$$ +Fourier Transform: +$$ +U_{QFT}=\frac{1}{\sqrt{2^n}}\sum_{x,y=0}^{2^n-1}e^{2\pi i\frac{xy}{2^n}}|y\rangle\langle x|\implies U_{QFT}|0\rangle=\frac{1}{\sqrt{2^n}}\sum_{x=0}^{2^n-1}|x\rangle\equiv\frac{1}{\sqrt{2^n}}\sum_{x\in\{0,1\}^n}|x\rangle +$$

+",1837,,,,,2/7/2020 11:13,,,,4,,,,CC BY-SA 4.0 +9772,1,,,2/7/2020 13:24,,2,49,"

Consider the simple state teleportation gadget below. Measuring the entangled state after the CZ gate in the $X$ eigenbasis (equivalent to first applying $H$ and then measuring in computational basis) teleports the state $|\psi\rangle$ to the second register up to a $X^m H$.

+

Now, what if we were to consider a measurement of non-orthogonal operators (for simplicity say a POVM given by $E_1, E_2, E_3$) instead of measuring in the $X$ basis. I am reading an article in which the authors seem to indicate that this will generally leave the state on the second register in a mixed state.

+

Could someone explain why this is the case?

+

(I have actually taken this slightly out of context, as this originally concerns a quantum optics measurement, namely a so-called heterodyne measurement, where the measurement operators are given by $E=|\alpha\rangle\langle\alpha|$ but the coherent states $|\alpha\rangle$ are not orthogonal and form an overcomplete basis. However, I believe this should boil down to the same question)

+",5322,,-1,,6/18/2020 8:31,2/7/2020 13:24,Teleportation and non-orthogonal measurement operators,,0,0,,,,CC BY-SA 4.0 +9773,2,,9767,2/7/2020 13:45,,4,,"

It seems that you are trying to make sense of compiled circuits from this paper. All Sections, Tables and Figures noted below are in reference to this paper. The short answers are in bold in case you are not looking for explanation.

+ +

WHY?

+ +

The circuit in your question is a ""compiled"" quantum circuit, which uses known information about the solution to a specified problem to create a simplified implementation of Shor's algorithm. The motivation for doing this is discussed in Section III(A).

+ +

Using the notation convention $f_{a,N}(x)=a^x \, (\text{mod} \, N)$, the authors create a truth table (Table V) that implements the modular exponentiation of $f_{4,21}(x)$: +$$\vert x \rangle \vert 0 \rangle \rightarrow \vert x \rangle \vert \; 4^x \, (\text{mod} \, 21) \rangle.$$

+ +

The input value, $x$, corresponds to the left side of both Table V and Table VI, which in turn corresponds to the value over the three input qubits ($q1_0$ through $q1_2$ in your circuit).

+ +

The value of the function $f_{4,21}(x)$ corresponds the right side of Table V, which in turn corresponds to the five output qubits of the circuit in Figure 5.

+ +

The two output qubits in your circuit ($q1_3$ and $q1_4$) correspond to $\text{log}_4 (f_{4,21}(x))$, where $x$ is the input value over $q1_0$, $q1_1$, and $q1_2$.

+ +

These values are tabulated in the right side of Table VI. This is a second level of compilation, again made possible by a priori knowledge of the solution.

+ +

What Does this Result Mean?

+ +

In the context of this compiled circuit we are not interested in measuring the output qubits because the circuit was specifically constructed so that the output qubits will match Table VI. It's an easy exercise to modify your circuit and verify that they do.

+ +

Instead, the state of the three input qubits after the QFT is the interesting measurement. These values are interesting because despite the layers of synthetic compilation, they match the values predicted by theory.

+ +

This is explained in detail in Section V. The end result is Table XI, which tabulates the probability of measuring state $\vert k \rangle$ (over your $q1_0$, $q1_1$, and $q1_2$) in the columns relative to a postulated period of $f_{4,21}(x)$ in the rows. Note that the authors do not use binary in the column headers, so, e.g. $\vert 5 \rangle \equiv \vert 101 \rangle$.

+ +

From Table III we know a priori that the period of $f_{4,21}(x)$ is 3. So as expected

+ +

Your histogram corresponds to row 3 of Table XI.

+ +

If you increase your shots the numbers should align even more closely.

+ +

Can I Show a Compiled Circuit for $11^x \, (\text{mod} \, 15)$?

+ +

The cited paper has examples of composite circuits constructed for several other problems. These are much more detailed and reliable than I could hope to provide here, so I would refer you there instead.

+",8623,,8623,,2/7/2020 14:12,2/7/2020 14:12,,,,2,,,,CC BY-SA 4.0 +9774,1,9792,,2/7/2020 14:43,,3,341,"

Recently, I came across ZX calculus. It is an interesting method to describe quantum circuits. However, it seems to me, too complicated for day-to-day use in circuit design (something like to program an application in assembler instead of in higher level language) because it uses only few quantum gates ($Rx$, $Ry$, $H$ and $CNOT$).

+ +

My question is for what purposes the ZX calculus was developed?

+",9006,,5955,,2/7/2020 14:45,9/20/2022 15:26,What are some applications of the ZX calculus?,,3,0,,,,CC BY-SA 4.0 +9775,1,9778,,2/7/2020 14:58,,1,1395,"

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

+",5632,,9006,,2/13/2020 5:48,2/13/2020 5:48,Swap test to calculate inner product with qiskit for multi-qubit states,,2,4,,,,CC BY-SA 4.0 +9776,1,,,2/7/2020 16:46,,1,505,"

I want to compare the theoretical output of a circuit measurement with the actual output from a real quantum computer. I can approximate the ideal output by running the circuit on a simulator. However when you're measuring a state in superposition, the results you get from a simulator are still nondeterministic, making them not ideal for comparison.

+ +

For instance, when measuring a single qubit in even superposition (the state $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$, the ideal result would be that you measure $|0\rangle$ with probability $0.5$ and $|1\rangle$ with probability $0.5$. However, when running on a simulator, you might naturally get $|0\rangle$ with probability $0.501$ and $|1\rangle$ with probability $0.499$:

+ +

+ +

In other words, knowing that the theoretical probability of obtaining state $|\phi\rangle$ when measuring a state $|\psi\rangle$ is $\langle\phi|\psi\rangle$, is there a function in Qiskit to calculate this value from a circuit or state, or to get the ideal probability distribution that I can compare my actual distribution against?

+",7761,,,,,2/9/2020 8:24,Is there a function that gives the ideal probability distribution of a measurement in Qiskit?,,2,0,,,,CC BY-SA 4.0 +9777,2,,9776,2/7/2020 16:56,,1,,"

You can use the statevector_simulator to return the statevector of your system. From this statevector, you can see the theoretical probability of obtaining each possible state for your system. For example:

+ +
qc = QuantumCircuit(2)
+qc.x(0)
+
+sim = Aer.get_backend('statevector_simulator')
+
+job = execute(qc, sim)
+
+print(job.result().get_statevector(qc))
+
+ +

will print out +[0.+0.j 1.+0.j 0.+0.j 0.+0.j]. Each element refers to a possible 2-qubit state. The 0th element would refer to state 00, the 1st refers to 01, the 2nd to 10, and the 3rd to 11.

+",6180,,,,,2/7/2020 16:56,,,,1,,,,CC BY-SA 4.0 +9778,2,,9775,2/7/2020 17:01,,5,,"

It is possible, but when calling cswap, all of the arguments need to be of the same size. In your example, assuming ancilla[0] is 1 qubit, you would need qb1 and qb2 to also be 1 qubit. If qb1 and qb2 are QuantumRegisters of size > 1, then you would need multiple cswap calls. For example, if qb1 and qb2 are of size 2:

+ +
circuit.cswap(ancilla[0], qb1[0], qb2[0])
+circuit.cswap(ancilla[0], qb1[1], qb2[1])
+
+ +

This way the ancilla[0] qubit is still the control for both calls, and all of the arguments in both calls are of the same size.

+",6180,,,,,2/7/2020 17:01,,,,0,,,,CC BY-SA 4.0 +9779,1,,,2/7/2020 18:04,,2,121,"

I'm checking this article of R. Somma about quantum simulations

+ +

https://arxiv.org/abs/quant-ph/0512209

+ +

I understand the common commutation relations for creationd and annihilation operators, given by: +$$[b_i, b_j^\dagger]|n_1 n_2\dots n_N\rangle = b_ib_j^\dagger|n_1 n_2\dots n_N\rangle-b_j^\dagger b_i|n_1 n_2\dots n_N\rangle\\ + = \sqrt{n_i(n_j+1)}|n_1\dots n_i-1\ n_j+1\dots n_N\rangle\\ + -\sqrt{n_i(n_j+1)}|n_1\dots n_i-1\ n_j+1\dots n_N\rangle=0$$ +My question is about equation (2.57) on page 32. They restrict the Fock space to contain at most $N_P$ bosons per site, and then they affirm that the following relations hold: +$$\left[\bar{b}_{i}, \bar{b}_{j}\right]=0,\left[\bar{b}_{i}, \bar{b}_{j}^{\dagger}\right]=\delta_{i j}\left[1-\frac{N_{P}+1}{N_{P} !}\left(\bar{b}_{i}^{\dagger}\right)^{N_{P}}\left(\bar{b}_{i}\right)^{N_{P}}\right]$$ +Where does that come from? +I started considering the general Fock state $|n_1 n_2\dots n_N\rangle=\prod_{k=1}^{N}\frac{1}{\sqrt{n_k!}}{b_k^\dagger}^{n_k}|0\rangle$ and trying to compute the commutator expression but obtained nothing useful. +Can anyone help me?

+",9716,,9716,,2/10/2020 11:29,2/10/2020 11:29,Commutation of bosonic operators on finite Hilbert space,,1,0,,,,CC BY-SA 4.0 +9780,1,,,2/7/2020 18:38,,14,892,"

My understanding is that at the level of quantum mechanics, almost all operations are reversible in time. Most gates in a quantum circuit clearly obey this rule; they can be reversed by applying some other gate. But a measurement gate seems to be one-directional. Is there some physical process that performs the opposite of what a measurement gate does?

+",9995,,9006,,2/7/2020 22:46,2/7/2020 22:46,"What is the opposite of measurement, in a quantum circuit?",,4,1,,,,CC BY-SA 4.0 +9781,2,,9780,2/7/2020 18:56,,4,,"

A measurement represents a non-reversible operation in quantum mechanics, i.e. it is not a unitary operation. As such, the opposite of a measurement has no well-defined meaning.

+",332,,,,,2/7/2020 18:56,,,,0,,,,CC BY-SA 4.0 +9782,2,,9780,2/7/2020 18:57,,2,,"

A measurement leads to collapse of a wave function describing qubits, they get to one particular state and remain in that state. To do reverse operation you have to repeat measurement many times. Based on resulting probability distribution you can reconstruct the state of qubits and prepare it again.

+ +

The reconstruction of probability distribution is done with quantum tomography.

+ +

Arbitrary state can be prepared with method in this paper: Transformation of quantum states using uniformly controlled rotations

+",9006,,9006,,2/7/2020 22:45,2/7/2020 22:45,,,,0,,,,CC BY-SA 4.0 +9783,2,,9780,2/7/2020 20:01,,1,,"

If you look at quantum circuit diagrams, you'll usually see quantum rails (single-lines) and classical rails (double-lines). These rails represent quantum bits or classical bits. The measure operator is performed on a quantum bit, but outputs to classical space. So it's NOT a quantum operator. It does not need to be reversible.

+",9967,,,,,2/7/2020 20:01,,,,0,,,,CC BY-SA 4.0 +9784,2,,9780,2/7/2020 20:28,,17,,"

A measurement is basically a CNOT between the quantum computer and the external environment. The important distinction between this CNOT and the CNOTs entirely within the quantum computer is that the target qubit is not protected. The environment is going to spread and mix the target qubit's value all over the place.

+ +

To perform the inverse of a measurement would mean you need to undo all the mixing and spreading that the environment does, so you can undo the CNOT at the heart of the measurement. Unfortunately this is not plausible, because you don't have sufficient control over the environment.

+ +

The mixing is so hard to undo that some interpretations of quantum mechanics say it triggers a literally irreversible process (collapse). But even in interpretations without collapse, like many worlds, it's not practical to undo the mixing.

+",119,,9006,,2/7/2020 22:44,2/7/2020 22:44,,,,0,,,,CC BY-SA 4.0 +9785,1,,,2/7/2020 20:32,,4,836,"

+ +

After I have finished computing and operating a specific circuit on a set of (say) 4 qubits, my final interest only is to deal with (say) two of the four qubits. Then, how do I recycle or delete the other two qubit? Or rather how do I plot state vectors of only the two qubits of interest on Qiskit?

+ +

In the above figure I want to delete q0_0 and q0_1. I want state vectors of only q1_0 and q1_1.

+",9997,,16606,,6/3/2022 10:58,6/3/2022 10:58,"How do we discard or delete or reuse a qubit at the end, on Qiskit?",,1,3,,,,CC BY-SA 4.0 +9786,1,13462,,2/7/2020 21:33,,5,280,"

The complexity class $\mathrm{MIP^*}$ includes the set of languages that can be efficiently verified by a classical, polynomially-bounded verifier, engaging with two quantum provers that can share (potentially infinite) entanglement, but are otherwise forbidden to signal to each other. The complexity class $\mathrm{RE}$ includes recursively enumerable problems, the Halting Problem being a complete problem therein.

+ +

A recent breakthrough of Ji, Natarajan, Vidick, Wright, and Yuen in quantum complexity theory is $\mathrm{MIP^*=RE}$. This is, in a way, a quantum analog of the classical result that $\mathrm{MIP=NEXP}$, but shows that shared quantum entanglement in a potentially infinite-dimensional Hilbert space is much much more powerful than that allowed in the (unentangled) classical setting.

+ +

Rolling back the implications of Tsirelson and others, this implies a negative answer to Connes' Embedding Problem, which is a major problem in algebra theory.

+ +

I can get my head around the complexity class $\mathrm{MIP^*}$ and that of $\mathrm{RE}$. Thanks to Yuen's lecture at the IAS, I vaguely understand Tsirelson's problem in relation to CHSH games, etc., and how it could relate to $\mathrm{MIP^*}$. Also I was able to follow a lot of Slofstra's lecture, where he mentions that Tsirelson's problem is related to finding magic squares in $\mathbb{Z}_2$, and emphasizes the relation to solving a specific word problem for finitely presented groups. Famously such word problems can be algorithmically unsolvable.

+ +

However, I know very little of even the statement of Connes' embedding problem, and I don't know how to analogize the problem to something that I'm familiar with.

+ +

According to Wikipedia, ""Connes' Embedding Problem asks whether every type II1 factor on a separable Hilbert space can be embedded into some $R^\omega$.""

+ +
+

Is the CEP itself akin to an algorithmic problem as in the word problem for a finitely generated groups? Or is it much more subtle than that?

+
+ +

Basically I'm looking for a statement of Connes' embedding problem that is a bit more accessible than the Wikipedia article?

+",2927,,2927,,8/26/2022 3:32,8/26/2022 3:32,Is Connes' Embedding Problem akin to the word problem for finitely presented groups?,,1,0,,,,CC BY-SA 4.0 +9787,2,,9785,2/7/2020 21:42,,3,,"

You can use Qiskit's partial_trace functionality on the final Statevector. Here's code that builds up the final statevector for your circuit, then traces over the first 2 qubits to yield the reduced density matrix (works on the latest version of Qiskit):

+ +
from qiskit import QuantumCircuit, QuantumRegister
+from qiskit.quantum_info.states import Statevector, partial_trace
+from qiskit.visualization import plot_state_city
+
+q0 = QuantumRegister(2, 'q0')
+q1 = QuantumRegister(2, 'q1')
+
+circuit = QuantumCircuit(q0, q1)
+circuit.h(q1[1])
+circuit.cswap(q1[1], q1[0], q0[1])
+circuit.cx(q1[0], q0[0])
+circuit.cx(q0[1], q0[0])
+circuit.ccx(q0[0], q1[1], q0[1])
+
+zero_state = Statevector.from_label('0000')
+final_state = zero_state.evolve(circuit)
+
+reduced_state = partial_trace(final_state, [0, 1])
+
+plot_state_city(reduced_state.data)
+
+ +

+",2503,,,,,2/7/2020 21:42,,,,2,,,,CC BY-SA 4.0 +9788,2,,9775,2/7/2020 22:36,,3,,"

If you aren't keeping the states that you performed the swap test on, you don't need to use CSWAPs to perform the swap test. You can instead just pair up the qubits from each system, perform Bell basis measurements on them, and count whether you see the 11 result and odd or even number of times.

+

This:

+

+

Gives the same result statistics as this:

+

+

But the latter is much less demanding on the quantum hardware, because the three qubit gates can be done in the classical postprocessing.

+",119,,-1,,6/18/2020 8:31,2/7/2020 22:36,,,,2,,,,CC BY-SA 4.0 +9789,1,9790,,2/8/2020 8:23,,4,414,"

I'm studying Shor's algorithm. +but I see from the beginning this empty circle. +what this circle means??

+ +

+",9990,,55,,2/10/2020 23:19,2/10/2020 23:19,What do empty white circles mean in a quantum circuit?,,1,0,,,,CC BY-SA 4.0 +9790,2,,9789,2/8/2020 8:57,,5,,"

It is a ""negative"" control.

+ +

In other terms, the gate in your circuit will apply a NOT on the last qubit if and only if the following conditions are both met:

+ +
    +
  • $\vert x_3\rangle = \vert 0 \rangle$
  • +
  • the first ancilla qubit is in the state $\vert 1 \rangle$.
  • +
+ +

A ""normal"" control (i.e. not an empty circle) would change the first condition to $\vert x_3 \rangle = \vert 1 \rangle$.

+",1386,,,,,2/8/2020 8:57,,,,1,,,,CC BY-SA 4.0 +9791,2,,9779,2/8/2020 11:48,,2,,"

The reason for this is because when you truncate the Hilbert space, applying the raising operator on the highest state raises you out of the Hilbert space, ie it gives a zero vector. Thus the commutator in matrix form is not the identity but a diagonal matrix with all ones expect for the last entry which is minus one. If your have any nonzero amplitude in that final state you will get a reduction in the expectation value of the commutator. When working with truncated Hilbert spaces, it is best to start from the definitions of the raising and lowering operators in this space and build everything up from there. Otherwise you can get inconsistencies, eg the displacement operator is not what you expect.

+",332,,,,,2/8/2020 11:48,,,,3,,,,CC BY-SA 4.0 +9792,2,,9774,2/8/2020 14:27,,7,,"

The ZX calculus was not designed to be a programming language, or a language in which to specify things at a high level. It is a language for reasoning about things on a relatively low level, albeit without digging into the actual physics.

+ +

What it was designed for is hinted at in your observations, and by the name of the ZX calculus itself.

+ +
    +
  • It can describe individual quantum gates: so it is a notation for circuits (and other quantum procedures — one of the things the ZX calculus was explicitly designed for was to analyse measurement based quantum computing [arXiv:0906.4725]; and Dom Horsman and I showed that it has a very close connection to surface code lattice surgery [arXiv:1704.08670]).

  • +
  • It is a calculus : it is a notation in which you can actually do calculations. If you're good with reasoning about commutation relations, you can do this to a limited extent with ordinary circuit diagrams; for the ZX calculus you can in principle do this entirely with diagrams.

  • +
+ +

There are people who are working on higher-level ZX descriptions of procedures on multiple qubits — eg. [arXiv:1905.00041] — which might become suitable to actually program with if developed further. But the existing version of the ZX calculus is more suitable for an intermediate representation of a compiler, or indeed performing computations or analysis by hand, than as a programming language.

+",124,,124,,2/11/2020 21:26,2/11/2020 21:26,,,,3,,,,CC BY-SA 4.0 +9793,1,9794,,2/8/2020 21:58,,6,256,"

A Hilbert Space has this property

+ +

$$\langle cf,g\rangle=c\langle f,g\rangle$$

+ +

where $f$ and $g$ are the vectors in the Hilbert Space and $c$ is a complex number.

+ +

In Dirac Notation,

+ +

$$\langle cf|g\rangle = c^*\langle f\vert g\rangle$$

+ +

I am confused about why the Dirac notation takes complex conjugate on $c$. I know $\langle f \vert$ in the Dirac notation is in the Dual Hilbert space. Is this the reason? Do I need to define a Hilbert Space as

+ +

$$\langle cf,g\rangle=c\langle f,g\rangle$$

+ +

I feel it is equivalent if I define as

+ +

$$\langle cf,g\rangle = c^*\langle f,g\rangle$$

+ +

Am I right? Thanks a lot!

+",9676,,55,,2/10/2020 23:20,2/10/2020 23:20,"In Dirac notation, why do we have $\langle cf|g\rangle = c^*\langle f\vert g\rangle$?",,1,1,,,,CC BY-SA 4.0 +9794,2,,9793,2/8/2020 23:01,,5,,"

Inner products on Hilbert spaces are linear in their first argument and conjugate linear in their second argument. So Hilbert spaces also have the property +$$\langle f, \, cg\rangle = c^\ast \langle f, \, g \rangle.$$

+ +

As you said, a bra represents the dual space to a ket. So to move to an inner product in Dirac notation simply note that for $c_1, \, c_2 \in \mathbb{C}$ and $f, \, g \in \mathcal{H}$ $$\langle c_1 f , \, c_2 g \rangle = \langle c_2 g \vert c_1 f \rangle = c_1 \, c_2^\ast \langle f, \, g \rangle.$$

+",8623,,8623,,2/9/2020 1:06,2/9/2020 1:06,,,,4,,,,CC BY-SA 4.0 +9795,2,,9758,2/9/2020 7:57,,1,,"

Qiskit simulator supports advanced features like noise simulation. You can explore them by taking a look at the notebooks in https://github.com/Qiskit/qiskit-iqx-tutorials/tree/master/qiskit/advanced/aer. In addition it is written in multi-threaded C++ and is optimized for high performance.

+",7659,,,,,2/9/2020 7:57,,,,0,,,,CC BY-SA 4.0 +9796,2,,9776,2/9/2020 8:24,,1,,"

You can use the probabilities snapshot. Enter a snapshot as a circuit instruction:

+ +
circuit.snapshot_probabilities(label, qubits)
+
+ +

Then after execution get the probabilities from the result, see the documentation of Result.data.

+",7659,,,,,2/9/2020 8:24,,,,1,,,,CC BY-SA 4.0 +9797,1,9812,,2/9/2020 8:35,,3,296,"

when I measure the shot = 1024

+ +

+ +

when I measure the shot = 8192

+ +

+ +

I want to derive result value 011(=3) +However, I know if measure the more shots, increase the accuracy. +why this result derive??? +why increase inaccuracy??

+ +

Sorry to late reply your request. I attach my code in qiskit!! +Thank you everybody!!

+ +

+ +

and I want to gain output 011(=3)

+",9990,,9006,,2/11/2020 5:30,2/11/2020 5:30,"When increase the shot, why the result is different?",,1,3,,,,CC BY-SA 4.0 +9798,1,,,2/9/2020 14:36,,4,1765,"

This has been bothering me for a while.

+ +

Bitcoin mining involves repeatedly changing the nonce (and occasionally the timestamp and Merkle root) in a block header and hashing it repeatedly, until the resulting hash falls below the target value. Therefore, the only valid way to find a valid hash is via brute force on a classical computer.

+ +

However, quantum computers are on the rise. 8-qubit and 16-qubit systems are already somewhat accessible to the public (for example, the IBM Q experience, which allows for cloud-based quantum computing), and the biggest quantum computer ever constructed to-date is, to my knowledge, 72-qubits. Grover's algorithm, which can only be implemented on a quantum computer, is particularly suited for breaking SHA256, the encryption algorithm behind bitcoin mining.

+ +

And therefore my question is - is it possible to implement Grover’s algorithm to find the right nonce that allows the block header hash to satisfy the target value? How many qubits would be required - 8, 16, 32 or more? My understanding is that, since we only need to iterate between all possible combinations of the nonce, which is 32 bits, wouldn't it require only sqrt(2^32)=2^16 (16 qubits) to instantly find a valid block header hash if we use Grover's algorithm?

+ +

Or am I missing something? I'm not very familiar with encryption and quantum algorithms, so please correct me if I'm wrong.

+",10014,,,,,7/9/2020 15:40,Is it possible to mine bitcoin by implementing Grover's algorithm on a quantum computer,,3,1,,,,CC BY-SA 4.0 +9799,1,,,2/9/2020 15:31,,3,331,"

I am referring to Equation (8.89) to (8.92) in Chapter 8 of "Quantum Computing and Information 10th Anniversary Edition" by Nielsen and Chuang. This section deals with the geometric picture of single qubit quantum operations on a Bloch sphere. I am trying to arrive at (8.91) and (8.92) which the authors claimed that "...it is not difficult to check..."

+

We have the state of a single qubit in Bloch representation:

+

$$\rho=\frac{I+\vec{r}\cdot\vec{\sigma}}{2}\hspace{5em}(8.87)$$

+

The affine map $\varepsilon$ is given as:

+

$$\vec{r}\longrightarrow\vec{r'}=M\space\vec{r}+\vec{c}\hspace{5em}(8.89)$$

+

The operators that generate the operator-sum-representation for $\varepsilon$ are given in the form:

+

$$E_{i}=\alpha_{i}I+\sum^{3}_{k=1}a_{ik}\sigma_{k}\hspace{5em}(8.90)$$

+

The text went on to say it is not difficult to check that:

+

$$M_{jk}=\sum_{l}\bigg[a_{lj}a^{*}_{lk}+a^{*}_{lj}a_{lk}+\big(|a_l|^2-\sum_pa_{lp}a^*_{lp}\big)+i\sum_p\epsilon_{jkp}(\alpha_la^*_{lp}-\alpha^*_la_{lp})\bigg]\hspace{1em}$$

+

$$c_k=2i\sum_l\sum_{jp}\epsilon_{jkp}a_{lj}a^*_{lp}\hspace{5em}\text{(8.91) and (8.92)}$$

+

and they claim $c_k$ was written as such because $\sum_{i}E^{\dagger}_{i}E_{i}=I$ is used to simplify it.

+

So I tried to see how I can somehow arrive at (8.91) and (8.92) by doing these:

+

$$\varepsilon(\rho)=\frac{I+\sum_{l}E_{l}\vec{r}\cdot\vec{\sigma}E^{\dagger}_{l}}{2}=\frac{I+(M\space\vec{r}+\vec{c})\cdot\vec{\sigma} }{2}$$

+

The second term in the above equality is what I tried to work out,

+

\begin{align} +\mathcal{E}&(\rho)=\sum_l E_l\rho E_l^\dagger=\frac{I+\sum_l E_l(\vec{r}.\vec{\sigma})E_l^\dagger}{2}\\ +&=\frac{1}{2}\bigg[I+\sum_l\Big[ \Big(\alpha_lI+\sum_{j=1}^3a_{lj}\sigma_j\Big)\Big(\sum_{k=1}^3r_k\sigma_k\Big)\Big(\alpha_l^*I+\sum_{p=1}^3a^*_{lp}\sigma_p\Big) \Big]\bigg]\\ +&=\frac{1}{2}\bigg[I+\sum_l\Big[ |\alpha_l|^2\sum_{k=1}^3r_k\sigma_k+\alpha_l\sum_{k=1}^3r_k\sigma_k\sum_{p=1}^3a_{lp}^*\sigma_p+\alpha_l^*\sum_{j=1}^3a_{lj}\sigma_j \sum_{k=1}^3r_k\sigma_k+\sum_{j=1}^3a_{lj}\sigma_j\sum_{k=1}^3r_k\sigma_k\sum_{p=1}^3a_{lp}^*\sigma_p \Big]\bigg]\\ +&=\frac{1}{2}\bigg[I+\sum_l\Big[ |\alpha_l|^2\sum_{k=1}^3r_k\sigma_k+\alpha_l\sum_{k=1}^3\sum_{p=1}^3r_ka_{lp}^*\sigma_k\sigma_p+\alpha_l^*\sum_{j=1}^3\sum_{k=1}^3r_ka_{lj}\sigma_j \sigma_k+\sum_{j=1}^3\sum_{k=1}^3\sum_{p=1}^3r_ka_{lj}a_{lp}^*\sigma_j\sigma_k\sigma_p \Big]\bigg]\\ +\end{align}

+

Before I attempt to write out the subsequent expansion in latex, I'll like to know am I on the right track? Because after expansion I get the terms with $r_k$ and we know $c_{k}$ is a constant. Can someone guide me on how to understand (8.91) and (8.92)? Or even better, show me on how to arrive at these two equations through any means. Help will be very much appreciated. Thanks.

+",5253,,18369,,10/26/2022 10:24,10/26/2022 10:24,Affine Map of the Bloch sphere,,0,3,,,,CC BY-SA 4.0 +9800,1,,,2/9/2020 15:55,,6,336,"

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,Z,H and CNOT?)

+",10015,,,,,2/17/2020 16:45,"If an auxiliary qubit is allowed, how to construct toffoli gate in easier way?",,2,7,,,,CC BY-SA 4.0 +9802,1,,,2/9/2020 17:54,,1,39,"

$\newcommand{\ket}[1]{\left|#1\right>}$ +In the original HHL paper, in step 4 of the $U_{\text{invert}}$ subroutine (Appendix A.1), it says to adjoin a three-dimensional register S in the state

+ +

$\ket{h(\lambda_k)} = \sqrt{1-f(\lambda_k)^2-g(\lambda_k)^2}\ket{\text{nothing}}+f(\lambda_k)\ket{\text{well}}+g(\lambda_k)\ket{\text{ill}}$.

+ +

I have played around with some possible controlled-rotation schemes to prepare this state, but with no luck. Does anyone know how to prepare this state?

+",10018,,,,,2/9/2020 17:54,How to prepare the three-dimensional register S in HHL?,,0,0,,,,CC BY-SA 4.0 +9805,1,,,2/10/2020 1:15,,1,214,"

I am trying to create a Quantum Classifier and would like to try to test it out using a Qiskit ML dataset. However, I only know of the breast cancer dataset and I would like to try it on another dataset.

+ +

On another note, I am also curious if the Qiskit ML datasets are usable for classical machine learning, for example, using TensorFlow.

+",10020,,5955,,2/10/2020 11:31,3/6/2021 15:08,"Does anyone know how to get a list of all the Qiskit ML datasets, and if they can also be used for classical machine learning?",,2,0,,,,CC BY-SA 4.0 +9806,1,,,2/10/2020 1:46,,2,64,"

Let $a'_k$ be Bob's measurement result of qubit $ + {\Psi_{a_kb_k}}$, assuming a noiseless channel with no eavesdropping. Show that when $b'_k\neq b_k$, $a'_k$ is random and completely uncorrelated with $a_k$. But when $b'_k=b_k$, $a'_k=a_k$.

+ +

I have no idea how to approach this problem, but I was thinking that, for instance, one possibility is that Alice sends bob a Qubit prepared in $ab=00$, and Bob measures it in state $a'b'=01$. Then $a=a'$ but $b=b'$.

+",10021,,55,,10/28/2020 9:26,10/28/2020 9:26,"Show that if $b'$ and $b$ are uncorrelated, then $a'$ and $a$ are uncorrelated",,1,0,,,,CC BY-SA 4.0 +9807,1,9808,,2/10/2020 4:04,,1,81,"

Given a tensored state of qbits such as +$$ +\frac{1}{\sqrt{3}}|0\rangle_1|1\rangle_2 + \sqrt{\frac{2}{3}}|1\rangle_1|0\rangle_2 +$$ +or +$$ +\frac{1}{\sqrt{2}}(|0\rangle_1|+\rangle_2 + |+\rangle_1|-\rangle_2) +$$ +Then how do you calculate the probabilities of getting $|0\rangle$ or $|1\rangle$ if you measure qbit one in the above states?

+",10023,,,,,2/10/2020 7:37,How to find measurement probabilities of a single qbit in a tensored state,,1,1,,,,CC BY-SA 4.0 +9808,2,,9807,2/10/2020 5:32,,3,,"

Only consider first qubit.

+ +

First case:

+ +

$\frac{1}{\sqrt 3}|0\rangle _1|1\rangle_2 + \sqrt{\frac{2}{3}}|1\rangle_1|0\rangle_2$

+ +

$P(|0\rangle_1) = \frac{1}{3}$ and $P(|1\rangle_1) = \frac{2}{3}$

+ +

Second case:

+ +

$\frac{1}{\sqrt 2}(|0\rangle_1|+\rangle_2 + |+\rangle_1|-\rangle_2) = \frac{1}{\sqrt 2}(|0\rangle_1|+\rangle_2 + \frac{1}{\sqrt 2}|0\rangle_1|-\rangle_2 + \frac{1}{\sqrt 2}|1\rangle_1|-\rangle_2 )=\frac{1}{\sqrt 2}|0\rangle_1|+\rangle_2 + \frac{1}{2}|0\rangle_1|-\rangle_2 + \frac{1}{2}|1\rangle_1|-\rangle_2$

+ +

Therefore, probabilities are:

+ +

$P(|0\rangle_1|+\rangle_2) = \frac{1}{2}$ and $P(|0\rangle_1|-\rangle_2) = P(|1\rangle_1|+\rangle_2) = \frac{1}{4}$

+ +

So, probability of measuring $|0\rangle$ in the first qubit is $\frac{1}{2} + \frac{1}{4} = \frac{3}{4}$ and probability of measuring $|1\rangle$ is $\frac{1}{4}$.

+",9563,,9006,,2/10/2020 7:37,2/10/2020 7:37,,,,0,,,,CC BY-SA 4.0 +9809,2,,9695,2/10/2020 5:51,,9,,"

This is a example for loading QASM, executing and displaying the result.

+ + + +
from qiskit import QuantumCircuit, Aer, execute
+
+qasm_str = """"""OPENQASM 2.0;
+include ""qelib1.inc"";
+qreg q[2];
+creg c[2];
+h q[0];
+cx q[0],q[1];
+measure q -> c;
+""""""
+
+# From str.
+qc = QuantumCircuit.from_qasm_str(qasm_str)
+# If you want to read from file, use instead
+# qc = QuantumCircuit.from_qasm_file(""/path/to/file.qasm"")
+
+# You can choose other backend also.
+backend = Aer.get_backend(""qasm_simulator"")
+
+# Execute the circuit and show the result.
+job = execute(qc, backend)
+result = job.result()
+print(result.get_counts())
+
+",9563,,,,,2/10/2020 5:51,,,,0,,,,CC BY-SA 4.0 +9810,2,,9798,2/10/2020 6:19,,0,,"

Today's quantum computer has too much calculation error. +To calculate hash, quantum error correction is required. +It uses a large number of qubits.

+ +

The figure is sited from: Quantum Computing Progress and Prospects (2019) pp.163 +https://www.nap.edu/catalog/25196/quantum-computing-progress-and-prospects

+ +

+",9563,,,,,2/10/2020 6:19,,,,0,,,,CC BY-SA 4.0 +9811,2,,9798,2/10/2020 7:34,,0,,"

Yes, of course. But there are some interesting new challenges arising, if many miners used quantum computers to mine Bitcoin: https://arxiv.org/abs/1804.08118

+",1771,,,,,2/10/2020 7:34,,,,0,,,,CC BY-SA 4.0 +9812,2,,9797,2/10/2020 10:03,,8,,"

In general, the number of shots does not increase the accuracy of an experiment. Rather it gives a more precise answer. Attached is a figure showing the distance (in terms of Hellinger distance) for a Bell state run on the IBM Quantum Boeblingen device from the theoretical answer as a function of the number of shots taken. For each value of the shots, the experiment is repeated 100 times.

+ +

We see that as the number of shots is increased, the spread of the distributions decreases, following a $1/\sqrt{\rm{shots}}$ scaling. Therefore our answers are becoming more precise. However, the mean of this distribution is fairly constant, and it is clear that it converges to a nonzero answer, $\sim 0.17$ in this case. Ideally this should converge to zero distance, and the difference is the accuracy of the experiment. No matter how many shots one takes, this accuracy does not improve. This is because of errors in the device such as gate errors, measurement errors, environmental noise, etc. In this particular case the dominate error is measurement error that can fortunately be mitigated.

+",332,,332,,2/10/2020 23:27,2/10/2020 23:27,,,,1,,,,CC BY-SA 4.0 +9813,1,9814,,2/10/2020 10:04,,2,958,"

I know that the Qasm Simulator execute quantum circuits with presence of noise, even if I do not specify the model of noise in options for that backend.

+ +

But how can I execute the circuits without noise at all?

+",6071,,,,,2/10/2020 11:15,How to run the Qiskit Aer simulator without noise?,,1,0,,,,CC BY-SA 4.0 +9814,2,,9813,2/10/2020 11:15,,7,,"

This is incorrect. The QASM simulator by default has no noise. The fluctuations in its results are a result of finite sampling of the output statevector. Thus, the QASM simulator is equivalent to running a quantum circuit on an ideal quantum computer. To add noise you can follow the example here: https://www.qiskit.org/aer

+",332,,,,,2/10/2020 11:15,,,,2,,,,CC BY-SA 4.0 +9815,2,,9805,2/10/2020 11:30,,1,,"

Qiskit uses the datasets provided by sklearn and all the ones built into Qiskit are available here. You could follow how these methods work to load your own dataset if you wanted to.

+ +

You should be able to use the return from the call to the dataset directly for classical machine learning methods.

+",5955,,,,,2/10/2020 11:30,,,,0,,,,CC BY-SA 4.0 +9817,2,,9806,2/10/2020 12:17,,2,,"

So first, let's define a bit your notations. I guess (correct me if I'm wrong) that you consider Bob honest, and that what you denote by $\Psi_{a_k,b_k}$ is the BB84 qubit in basis $\{0,1\}$ if $b_k = 0$, and in basis $\{+,-\}$ if $b_k = 1$, whose ""value"" bit is $a_k$, i.e.:

+ +

$$\Psi_{a_k,b_k} = H^{b_k}X^{a_k}|0\rangle$$

+ +

Then, Bob will measure in basis $b'_k$ (with the same notation as above), and get the result $a'_k$. And you want to prove that:

+ +
    +
  1. if $b'_k = b_k$, then $a'_k = a_k$
  2. +
  3. if $b'_k \neq b_k$, then $a'_k$ is not correlated with $a_k$, i.e. $\forall a_k, Pr[a'_k = 0 | a_k] = Pr[a'_k = 1 | a_k] = \frac{1}{2}$
  4. +
+ +

First direction

+ +

Performing a measurement in the $\{+,-\}$ basis consists of a Hadamard gate, and a measurement in $\{0,1\}$ basis (that we will denote by $M_Z$). Basically measuring in the basis $b'_k$ is like performing the circuit $M_Z H^{b'_k}$. So you just need to apply this on your input qubit: +$$a'_k = M_Z H^{b'_k} H^{b_k}X^{a_k}|0\rangle$$ +but $b_k = b'_k$ so +$$a'_k = M_Z H^{b_k} H^{b_k}X^{a_k}|0\rangle = M_Z (HH)^{b_k}X^{a_k}|0\rangle$$ +but $HH$ is identity, so +$$a'_k = M_Z X^{a_k}|0\rangle$$ +And then it's easy to see that $a'_k = a_k$ (if you are not yet convinced, just try to compute this value for the two possible values of $a_k$)

+ +

Second direction

+ +

Let's start again from equation

+ +

$$a'_k = M_Z H^{b'_k} H^{b_k}X^{a_k}|0\rangle$$

+ +

derived above. Then, if $b'_k \neq b_k$, you see that $H^{b'_k} H^{b_k} = H$ (if you are not convinced, then just try to write it for the two values of $b_k$). so the equation becomes

+ +

$$a'_k = M_Z H X^{a_k}|0\rangle$$

+ +

So then, we will have two cases: if $a_k=0$, then $a'_k = M_Z |+\rangle$ and if $a_k=1$, then $a'_k = M_Z |-\rangle$. But measuring a $|+\rangle$ (or a $|-\rangle$) in the computational basis always gives you a uniform random bit. Indeed, to get the probability of obtaining a $0$ as outcome when measuring a $|+\rangle$, you need to compute +$$|\langle 0 | | + \rangle|^2 = |\langle 0 |(\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle))|^2$$ +So +$$|\langle 0 | | + \rangle|^2 = |(\frac{1}{\sqrt{2}}(\langle 0 |0\rangle + \langle 0 |1\rangle))|^2$$ +i.e. +$$|\langle 0 | | + \rangle|^2 = |(\frac{1}{\sqrt{2}}(1 + 0))|^2$$ +i.e.

+ +

$$|\langle 0 | | + \rangle|^2 = \frac{1}{2}$$

+ +

So $Pr[a'_k = 0 | a_k=0] = \frac{1}{2}$. From that, you have directly $Pr[a'_k = 1 | a_k=0] = 1-\frac{1}{2} = \frac{1}{2}$. And when $a_k=1$, it's the exact same computation, but with a minus sign in front of 0... so it does not really matter.

+ +

So when $b_k \neq b'_k$, $a'_k$ is not correlated with $a_k$.

+",5969,,5969,,2/11/2020 10:38,2/11/2020 10:38,,,,0,,,,CC BY-SA 4.0 +9818,2,,9805,2/10/2020 13:33,,0,,"

Yes, you can use Tensorflow to perform this. +Below are few mentioned: +A cross-platform Python library for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations +Introduction of the first dedicated machine learning platform for quantum computers

+ +

It's Documentation

+",9975,,,,,2/10/2020 13:33,,,,0,,,,CC BY-SA 4.0 +9819,2,,9747,2/10/2020 14:33,,2,,"

Here is a screenshot of a possible proof:

+ +

You can ignore the scalars if you want. +The idea is to:

+ +
    +
  1. disconnect the red node using the spider rule
  2. +
  3. turn it into a green node with a Hadamard node
  4. +
  5. decompose the hadamard gate
  6. +
  7. use the copy rule to get rid of the red node
  8. +
+ +

The above proof uses the rule from the second paper. If you want to use the other rule, the process is pretty much the same, you would simply need to disconnect the red node using the spider rule between 3. and 4., before you can use the copy rule.

+ +

The signs before the angles can be swapped by applying the Hadamard gate at the bottom on both sides of the equation, and hence changing ""$-\pi/2$-red node = $\pi/2$-green node"" into ""$-\pi/2$-green node = $\pi/2$-red node"".

+",7422,,,,,2/10/2020 14:33,,,,2,,,,CC BY-SA 4.0 +9820,2,,9747,2/10/2020 16:08,,2,,"

If all the angles in your diagram are multiples of $\pi/2$, you should use the rules from ""A Simplified Stabilizer ZX-calculus"" instead of the original rules in the paper you linked. But I'll work with them since it's what you asked.

+ +

Because you don't care about non-zero scalar factors (such as global phase), you can simplify the rules by dropping any disconnected regions. So, for example, this:

+ +

+ +

becomes this:

+ +

+ +

Which you can perhaps see would be useful for showing that your version 1 CZ is equivalent to your version 3. The simplified stabilizer calculus paper also proves this identity:

+ +

+ +

Which relates your version 1 to your version 2. Your various CZs are just transforming the Hadamard in the middle into different forms.

+ +

Anyways, your goal is to prove this:

+ +

+ +

Which I would call ""S gate can be performed by injecting a $\sqrt{X}^\dagger |0\rangle$ state"". The main thing you need to do is to translate the $\sqrt{X}^\dagger |0\rangle$ part into an equivalent $\sqrt{Z}|+\rangle$ part, i.e. turn that green leaf into a red leaf so that you can just merge it into the central red node.

+ +

In the simplified stabilizer calculus axioms paper, the only rule that involves a leaf with a $\pi/2$ angle is $EU^\prime$. And if you look at their proof of that axiom from the original axioms, it includes a proof of the $\pi/2$ color change:

+ +

+ +

After discarding all the disconnected pieces on the right hand side, you have the hard part of your proof. The rest is just spider fusion.

+",119,,119,,2/10/2020 16:52,2/10/2020 16:52,,,,1,,,,CC BY-SA 4.0 +9821,2,,9567,2/10/2020 17:22,,1,,"

Go to Pycharm or VS Code and in console do write this command pip install qsharp . It works well.

+",9975,,,,,2/10/2020 17:22,,,,0,,,,CC BY-SA 4.0 +9822,2,,9512,2/10/2020 17:33,,1,,"

Yes it can be converted to required Programming language. +Py4J , Py4J enables Python programs running in a Python interpreter to dynamically access Java objects in a Java Virtual Machine.  +SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.

+",9975,,,,,2/10/2020 17:33,,,,0,,,,CC BY-SA 4.0 +9823,1,,,2/11/2020 5:34,,6,1843,"

What is a ""shot"" in relation to quantum computing? I heard it is repeating time, but I don't understand it. Additionally, why is the default number of shots 1,024 in the IBM Q Experience?

+ +

One more question - I saw the sentence for each value of the shots, the experiment repeated 100 times. What is this mean? Is there difference between shots and repeated experiments? Are shot and experiment repetition same thing?

+",10028,,55,,10/28/2020 9:26,2/16/2022 3:08,"What is meant with ""shot"" in quantum computation?",,3,1,,,,CC BY-SA 4.0 +9824,1,9888,,2/11/2020 7:23,,2,226,"

I'm studying shor's algorithm. I implemented in Qiskit and apriori I know that a period is 3 in my example.

+ +

However, unless I know about period, how to obtain this period only according to seeing diagram?

+ +

This is a circuit diagram.

+ +

+ +

This is a probability diagram. How to obtain a period from it?

+ +

+",9990,,9006,,2/11/2020 7:29,2/17/2020 17:50,Shor algorithm - how to obtain a period from diagram?,,1,0,,,,CC BY-SA 4.0 +9825,2,,9823,2/11/2020 7:26,,6,,"

Number of shots: Number of shots means how many times an algorithm is run to get a probability distribution of results.

+ +

Experiment is repeated: This means how many times an experiment is repeated with particular number of shots. Imagine, you repeated an experiment 100 times and you have 1,024 shots. In each experiement repetition some metrics is calculated based on probability distribution obtained from 1,024 shots (i.e. an algorithm repetitions). The metrics can be, for example expected value or any other metrics based on the results. Hence you have 100 values of the metric and you can do some statistics on them.

+ +

Overall, number of shots and experiment repetitions mean different things.

+ +

Default number of shots: IBM Q allows you to set different number of shots. Default value 1,024 is an arbitrary decision. There is no physical/technical reason for that value.

+",9006,,9006,,2/11/2020 14:14,2/11/2020 14:14,,,,8,,,,CC BY-SA 4.0 +9826,1,,,2/11/2020 8:43,,2,3285,"

I have created a virtual environment by virtualenv (not conda) and tried to install qiskit by:

+ +
pip install qiskit
+
+ +

But it gives me a lot of error lines on the output:

+ +
Processing c:\users\mrt\appdata\local\pip\cache\wheels\20\f3\76\5a370641d58aa5f2887118316f675e967dd00c087276c5fc7d\qiskit-0.15.0-py3-none-any.whl
+Requirement already satisfied: qiskit-ibmq-provider==0.4.6 in e:\py\quantum-computing\lib\site-packages (from qiskit) (0.4.6)
+Collecting qiskit-aqua==0.6.4
+  Using cached qiskit_aqua-0.6.4-py3-none-any.whl (1.8 MB)
+Collecting qiskit-aer==0.4.0
+  Using cached qiskit-aer-0.4.0.tar.gz (10.0 MB)
+Requirement already satisfied: qiskit-terra==0.12.0 in e:\py\quantum-computing\lib\site-packages (from qiskit) (0.12.0)
+Requirement already satisfied: qiskit-ignis==0.2.0 in e:\py\quantum-computing\lib\site-packages (from qiskit) (0.2.0)
+Requirement already satisfied: requests>=2.19 in e:\py\quantum-computing\lib\site-packages (from qiskit-ibmq-provider==0.4.6->qiskit) (2.22.0)
+Requirement already satisfied: websockets<8,>=7 in e:\py\quantum-computing\lib\site-packages (from qiskit-ibmq-provider==0.4.6->qiskit) (7.0)
+Requirement already satisfied: requests-ntlm>=1.1.0 in e:\py\quantum-computing\lib\site-packages (from qiskit-ibmq-provider==0.4.6->qiskit) (1.1.0)
+Requirement already satisfied: arrow>=0.15.5 in e:\py\quantum-computing\lib\site-packages (from qiskit-ibmq-provider==0.4.6->qiskit) (0.15.5)
+Requirement already satisfied: nest-asyncio!=1.1.0,>=1.0.0 in e:\py\quantum-computing\lib\site-packages (from qiskit-ibmq-provider==0.4.6->qiskit) (1.2.3)
+Collecting scikit-learn>=0.20.0
+  Using cached scikit_learn-0.22.1-cp37-cp37m-win32.whl (5.5 MB)
+Requirement already satisfied: sympy>=1.3 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4->qiskit) (1.5.1)
+Processing c:\users\mrt\appdata\local\pip\cache\wheels\78\55\c8\dc61e772445a566b7608a476d151e9dcaf4e092b01b0c4bc3c\dlx-1.0.4-py3-none-any.whl
+Collecting quandl
+  Using cached Quandl-3.5.0-py2.py3-none-any.whl (25 kB)
+Requirement already satisfied: scipy>=1.0 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4->qiskit) (1.4.1)
+Requirement already satisfied: jsonschema>=2.6 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4->qiskit) (3.2.0)
+Requirement already satisfied: fastdtw in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4->qiskit) (0.3.4)
+Requirement already satisfied: numpy>=1.13 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4->qiskit) (1.18.1)
+Requirement already satisfied: setuptools>=40.1.0 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4->qiskit) (45.2.0)
+Requirement already satisfied: psutil>=5 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4->qiskit) (5.6.7)
+Requirement already satisfied: networkx>=2.2 in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4->qiskit) (2.4)
+Requirement already satisfied: docplex in e:\py\quantum-computing\lib\site-packages (from qiskit-aqua==0.6.4->qiskit) (2.12.182)
+Collecting cvxopt; python_version < ""3.8"" or sys_platform != ""win32""
+  Using cached cvxopt-1.2.4.tar.gz (6.7 MB)
+Collecting h5py
+  Using cached h5py-2.10.0-cp37-cp37m-win32.whl (2.1 MB)
+Requirement already satisfied: cython>=0.27.1 in e:\py\quantum-computing\lib\site-packages (from qiskit-aer==0.4.0->qiskit) (0.29.15)
+Requirement already satisfied: pybind11>=2.4 in e:\py\quantum-computing\lib\site-packages (from qiskit-aer==0.4.0->qiskit) (2.4.3)
+Requirement already satisfied: marshmallow-polyfield<6,>=5.7 in e:\py\quantum-computing\lib\site-packages (from qiskit-terra==0.12.0->qiskit) (5.8)
+Requirement already satisfied: marshmallow<4,>=3 in e:\py\quantum-computing\lib\site-packages (from qiskit-terra==0.12.0->qiskit) (3.4.0)
+Requirement already satisfied: dill>=0.3 in e:\py\quantum-computing\lib\site-packages (from qiskit-terra==0.12.0->qiskit) (0.3.1.1)
+Requirement already satisfied: ply>=3.10 in e:\py\quantum-computing\lib\site-packages (from qiskit-terra==0.12.0->qiskit) (3.11)
+Requirement already satisfied: idna<2.9,>=2.5 in e:\py\quantum-computing\lib\site-packages (from requests>=2.19->qiskit-ibmq-provider==0.4.6->qiskit) (2.8)
+Requirement already satisfied: chardet<3.1.0,>=3.0.2 in e:\py\quantum-computing\lib\site-packages (from requests>=2.19->qiskit-ibmq-provider==0.4.6->qiskit) (3.0.4)
+Requirement already satisfied: certifi>=2017.4.17 in e:\py\quantum-computing\lib\site-packages (from requests>=2.19->qiskit-ibmq-provider==0.4.6->qiskit) (2019.11.28)
+Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in e:\py\quantum-computing\lib\site-packages (from requests>=2.19->qiskit-ibmq-provider==0.4.6->qiskit) (1.25.8)
+Requirement already satisfied: ntlm-auth>=1.0.2 in e:\py\quantum-computing\lib\site-packages (from requests-ntlm>=1.1.0->qiskit-ibmq-provider==0.4.6->qiskit) (1.4.0)
+Requirement already satisfied: cryptography>=1.3 in e:\py\quantum-computing\lib\site-packages (from requests-ntlm>=1.1.0->qiskit-ibmq-provider==0.4.6->qiskit) (2.8)
+Requirement already satisfied: python-dateutil in e:\py\quantum-computing\lib\site-packages (from arrow>=0.15.5->qiskit-ibmq-provider==0.4.6->qiskit) (2.8.1)
+Collecting joblib>=0.11
+  Using cached joblib-0.14.1-py2.py3-none-any.whl (294 kB)
+Requirement already satisfied: mpmath>=0.19 in e:\py\quantum-computing\lib\site-packages (from sympy>=1.3->qiskit-aqua==0.6.4->qiskit) (1.1.0)
+Collecting more-itertools
+  Using cached more_itertools-8.2.0-py3-none-any.whl (43 kB)
+Processing c:\users\mrt\appdata\local\pip\cache\wheels\13\61\89\9192774c0f1e6c3342354df9f4804d7a9de80ac88e062d2e56\inflection-0.3.1-py3-none-any.whl
+Requirement already satisfied: six in e:\py\quantum-computing\lib\site-packages (from quandl->qiskit-aqua==0.6.4->qiskit) (1.14.0)
+Collecting pandas>=0.14
+  Using cached pandas-1.0.1-cp37-cp37m-win32.whl (7.7 MB)
+Requirement already satisfied: pyrsistent>=0.14.0 in e:\py\quantum-computing\lib\site-packages (from jsonschema>=2.6->qiskit-aqua==0.6.4->qiskit) (0.15.7)
+Requirement already satisfied: attrs>=17.4.0 in e:\py\quantum-computing\lib\site-packages (from jsonschema>=2.6->qiskit-aqua==0.6.4->qiskit) (19.3.0)
+Requirement already satisfied: importlib-metadata; python_version < ""3.8"" in e:\py\quantum-computing\lib\site-packages (from jsonschema>=2.6->qiskit-aqua==0.6.4->qiskit) (1.5.0)
+Requirement already satisfied: decorator>=4.3.0 in e:\py\quantum-computing\lib\site-packages (from networkx>=2.2->qiskit-aqua==0.6.4->qiskit) (4.4.1)
+Requirement already satisfied: docloud>=1.0.375 in e:\py\quantum-computing\lib\site-packages (from docplex->qiskit-aqua==0.6.4->qiskit) (1.0.375)
+Requirement already satisfied: cffi!=1.11.3,>=1.8 in e:\py\quantum-computing\lib\site-packages (from cryptography>=1.3->requests-ntlm>=1.1.0->qiskit-ibmq-provider==0.4.6->qiskit) (1.14.0)
+Collecting pytz>=2017.2
+  Using cached pytz-2019.3-py2.py3-none-any.whl (509 kB)
+Requirement already satisfied: zipp>=0.5 in e:\py\quantum-computing\lib\site-packages (from importlib-metadata; python_version < ""3.8""->jsonschema>=2.6->qiskit-aqua==0.6.4->qiskit) (2.2.0)
+Requirement already satisfied: pycparser in e:\py\quantum-computing\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography>=1.3->requests-ntlm>=1.1.0->qiskit-ibmq-provider==0.4.6->qiskit) (2.19)
+Building wheels for collected packages: qiskit-aer, cvxopt
+  Building wheel for qiskit-aer (setup.py) ... error
+  ERROR: Command errored out with exit status 1:
+   command: 'e:\py\quantum-computing\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '""'""'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\qiskit-aer\\setup.py'""'""'; __file__='""'""'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\qiskit-aer\\setup.py'""'""';f=getattr(tokenize, '""'""'open'""'""', open)(__file__);code=f.read().replace('""'""'\r\n'""'""', '""'""'\n'""'""');f.close();exec(compile(code, __file__, '""'""'exec'""'""'))' bdist_wheel -d 'C:\Users\MRT\AppData\Local\Temp\pip-wheel-ygy91648'
+       cwd: C:\Users\MRT\AppData\Local\Temp\pip-install-6b8z6utw\qiskit-aer\
+  Complete output (153 lines):
+
+
+  --------------------------------------------------------------------------------
+  -- Trying ""Ninja (Visual Studio 15 2017 v141)"" generator
+  --------------------------------
+  ---------------------------
+  ----------------------
+  -----------------
+  ------------
+  -------
+  --
+  Not searching for unused variables given on the command line.
+  CMake Error: CMake was unable to find a build program corresponding to ""Ninja"".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
+  -- Configuring incomplete, errors occurred!
+  See also ""C:/Users/MRT/AppData/Local/Temp/pip-install-6b8z6utw/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log"".
+  --
+  -------
+  ------------
+  -----------------
+  ----------------------
+  ---------------------------
+  --------------------------------
+  -- Trying ""Ninja (Visual Studio 15 2017 v141)"" generator - failure
+  --------------------------------------------------------------------------------
+
+
+
+  --------------------------------------------------------------------------------
+  -- Trying ""Visual Studio 15 2017 v141"" generator
+  --------------------------------
+  ---------------------------
+  ----------------------
+  -----------------
+  ------------
+  -------
+  --
+  Not searching for unused variables given on the command line.
+  CMake Error at CMakeLists.txt:2 (PROJECT):
+    Generator
+
+      Visual Studio 15 2017
+
+    could not find any instance of Visual Studio.
+
+
+
+  -- Configuring incomplete, errors occurred!
+  See also ""C:/Users/MRT/AppData/Local/Temp/pip-install-6b8z6utw/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log"".
+  --
+  -------
+  ------------
+  -----------------
+  ----------------------
+  ---------------------------
+  --------------------------------
+  -- Trying ""Visual Studio 15 2017 v141"" generator - failure
+  --------------------------------------------------------------------------------
+
+
+
+  --------------------------------------------------------------------------------
+  -- Trying ""NMake Makefiles (Visual Studio 15 2017 v141)"" generator
+  --------------------------------
+  ---------------------------
+  ----------------------
+  -----------------
+  ------------
+  -------
+  --
+  Not searching for unused variables given on the command line.
+  -- The C compiler identification is unknown
+  CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
+    The CMAKE_C_COMPILER:
+
+      cl
+
+    is not a full path and was not found in the PATH.
+
+    To use the NMake generator with Visual C++, cmake must be run from a shell
+    that can use the compiler cl from the command line.  This environment is
+    unable to invoke the cl compiler.  To fix this problem, run cmake from the
+    Visual Studio Command Prompt (vcvarsall.bat).
+
+    Tell CMake where to find the compiler by setting either the environment
+    variable ""CC"" or the CMake cache entry CMAKE_C_COMPILER to the full path to
+    the compiler, or to the compiler name if it is in the PATH.
+
+
+  -- Configuring incomplete, errors occurred!
+  See also ""C:/Users/MRT/AppData/Local/Temp/pip-install-6b8z6utw/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log"".
+  See also ""C:/Users/MRT/AppData/Local/Temp/pip-install-6b8z6utw/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeError.log"".
+  --
+  -------
+  ------------
+  -----------------
+  ----------------------
+  ---------------------------
+  --------------------------------
+  -- Trying ""NMake Makefiles (Visual Studio 15 2017 v141)"" generator - failure
+  --------------------------------------------------------------------------------
+
+
+
+  --------------------------------------------------------------------------------
+  -- Trying ""NMake Makefiles JOM (Visual Studio 15 2017 v141)"" generator
+  --------------------------------
+  ---------------------------
+  ----------------------
+  -----------------
+  ------------
+  -------
+  --
+  Not searching for unused variables given on the command line.
+  -- The C compiler identification is unknown
+  CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
+    The CMAKE_C_COMPILER:
+
+      cl
+
+    is not a full path and was not found in the PATH.
+
+    To use the JOM generator with Visual C++, cmake must be run from a shell
+    that can use the compiler cl from the command line.  This environment is
+    unable to invoke the cl compiler.  To fix this problem, run cmake from the
+    Visual Studio Command Prompt (vcvarsall.bat).
+
+    Tell CMake where to find the compiler by setting either the environment
+    variable ""CC"" or the CMake cache entry CMAKE_C_COMPILER to the full path to
+    the compiler, or to the compiler name if it is in the PATH.
+
+
+  -- Configuring incomplete, errors occurred!
+  See also ""C:/Users/MRT/AppData/Local/Temp/pip-install-6b8z6utw/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log"".
+  See also ""C:/Users/MRT/AppData/Local/Temp/pip-install-6b8z6utw/qiskit-aer/_cmake_test_compile/build/CMakeFiles/CMakeError.log"".
+  --
+  -------
+  ------------
+  -----------------
+  ----------------------
+  ---------------------------
+  --------------------------------
+  -- Trying ""NMake Makefiles JOM (Visual Studio 15 2017 v141)"" generator - failure
+  --------------------------------------------------------------------------------
+
+  ********************************************************************************
+  scikit-build could not get a working generator for your system. Aborting build.
+
+  Building windows wheels for Python 3.7 requires Microsoft Visual Studio 2017.
+  Get it with ""Visual Studio 2017"":
+
+    https://visualstudio.microsoft.com/vs/
+
+  ********************************************************************************
+  ----------------------------------------
+  ERROR: Failed building wheel for qiskit-aer
+  Running setup.py clean for qiskit-aer
+  Building wheel for cvxopt (setup.py) ... error
+  ERROR: Command errored out with exit status 1:
+   command: 'e:\py\quantum-computing\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '""'""'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\cvxopt\\setup.py'""'""'; __file__='""'""'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\cvxopt\\setup.py'""'""';f=getattr(tokenize, '""'""'open'""'""', open)(__file__);code=f.read().replace('""'""'\r\n'""'""', '""'""'\n'""'""');f.close();exec(compile(code, __file__, '""'""'exec'""'""'))' bdist_wheel -d 'C:\Users\MRT\AppData\Local\Temp\pip-wheel-03pa82mg'
+       cwd: C:\Users\MRT\AppData\Local\Temp\pip-install-6b8z6utw\cvxopt\
+  Complete output (21 lines):
+  running bdist_wheel
+  running build
+  running build_py
+  creating build
+  creating build\lib.win32-3.7
+  creating build\lib.win32-3.7\cvxopt
+  copying src\python\coneprog.py -> build\lib.win32-3.7\cvxopt
+  copying src\python\cvxprog.py -> build\lib.win32-3.7\cvxopt
+  copying src\python\info.py -> build\lib.win32-3.7\cvxopt
+  copying src\python\misc.py -> build\lib.win32-3.7\cvxopt
+  copying src\python\modeling.py -> build\lib.win32-3.7\cvxopt
+  copying src\python\msk.py -> build\lib.win32-3.7\cvxopt
+  copying src\python\printing.py -> build\lib.win32-3.7\cvxopt
+  copying src\python\solvers.py -> build\lib.win32-3.7\cvxopt
+  copying src\python\_version.py -> build\lib.win32-3.7\cvxopt
+  copying src\python\__init__.py -> build\lib.win32-3.7\cvxopt
+  UPDATING build\lib.win32-3.7\cvxopt/_version.py
+  set build\lib.win32-3.7\cvxopt/_version.py to '1.2.4'
+  running build_ext
+  building 'base' extension
+  error: Microsoft Visual C++ 14.0 is required. Get it with ""Build Tools for Visual Studio"": https://visualstudio.microsoft.com/downloads/
+  ----------------------------------------
+  ERROR: Failed building wheel for cvxopt
+  Running setup.py clean for cvxopt
+Failed to build qiskit-aer cvxopt
+Installing collected packages: joblib, scikit-learn, dlx, more-itertools, inflection, pytz, pandas, quandl, cvxopt, h5py, qiskit-aqua, qiskit-aer, qiskit
+    Running setup.py install for cvxopt ... error
+    ERROR: Command errored out with exit status 1:
+     command: 'e:\py\quantum-computing\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '""'""'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\cvxopt\\setup.py'""'""'; __file__='""'""'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\cvxopt\\setup.py'""'""';f=getattr(tokenize, '""'""'open'""'""', open)(__file__);code=f.read().replace('""'""'\r\n'""'""', '""'""'\n'""'""');f.close();exec(compile(code, __file__, '""'""'exec'""'""'))' install --record 'C:\Users\MRT\AppData\Local\Temp\pip-record-u6cvqizo\install-record.txt' --single-version-externally-managed --compile --install-headers 'e:\py\quantum-computing\include\site\python3.7\cvxopt'
+         cwd: C:\Users\MRT\AppData\Local\Temp\pip-install-6b8z6utw\cvxopt\
+    Complete output (21 lines):
+    running install
+    running build
+    running build_py
+    creating build
+    creating build\lib.win32-3.7
+    creating build\lib.win32-3.7\cvxopt
+    copying src\python\coneprog.py -> build\lib.win32-3.7\cvxopt
+    copying src\python\cvxprog.py -> build\lib.win32-3.7\cvxopt
+    copying src\python\info.py -> build\lib.win32-3.7\cvxopt
+    copying src\python\misc.py -> build\lib.win32-3.7\cvxopt
+    copying src\python\modeling.py -> build\lib.win32-3.7\cvxopt
+    copying src\python\msk.py -> build\lib.win32-3.7\cvxopt
+    copying src\python\printing.py -> build\lib.win32-3.7\cvxopt
+    copying src\python\solvers.py -> build\lib.win32-3.7\cvxopt
+    copying src\python\_version.py -> build\lib.win32-3.7\cvxopt
+    copying src\python\__init__.py -> build\lib.win32-3.7\cvxopt
+    UPDATING build\lib.win32-3.7\cvxopt/_version.py
+    set build\lib.win32-3.7\cvxopt/_version.py to '1.2.4'
+    running build_ext
+    building 'base' extension
+    error: Microsoft Visual C++ 14.0 is required. Get it with ""Build Tools for Visual Studio"": https://visualstudio.microsoft.com/downloads/
+    ----------------------------------------
+ERROR: Command errored out with exit status 1: 'e:\py\quantum-computing\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '""'""'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\cvxopt\\setup.py'""'""'; __file__='""'""'C:\\Users\\MRT\\AppData\\Local\\Temp\\pip-install-6b8z6utw\\cvxopt\\setup.py'""'""';f=getattr(tokenize, '""'""'open'""'""', open)(__file__);code=f.read().replace('""'""'\r\n'""'""', '""'""'\n'""'""');f.close();exec(compile(code, __file__, '""'""'exec'""'""'))' install --record 'C:\Users\MRT\AppData\Local\Temp\pip-record-u6cvqizo\install-record.txt' --single-version-externally-managed --compile --install-headers 'e:\py\quantum-computing\include\site\python3.7\cvxopt' Check the logs for full command output.
+
+ +

System description:

+ +
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 19:29:22) [MSC v.1916 32 bit (Intel)] on win32
+Windows 10 x64
+
+ +

What are the requirements? What should I do to solve this problem?

+ +

Thanks in advance.

+",9668,,55,,2/19/2020 13:22,8/12/2021 15:32,Installing qiskit with `pip install qiskit` gives `ERROR: Command errored out with exit status 1`,,6,2,,,,CC BY-SA 4.0 +9827,2,,9826,2/11/2020 8:59,,1,,"

It appears pip is trying to compile qiskit-aer (the C++ simulators) from source and failing since it doesn't have visual studio installed (I guess you're on Windows). This should not happen in the sense that it should simply download a precompiled wheel.

+ +

My guess is that you have a cached previous install attempt. To ignore it, try:

+ +

pip install qiskit --no-cache-dir

+",9918,,,,,2/11/2020 8:59,,,,3,,,,CC BY-SA 4.0 +9828,1,9829,,2/11/2020 10:12,,3,168,"

I want to construct the following state of a qubit using a quantum circuit: $\frac{-|0\rangle + |1\rangle}{\sqrt{2}}$

+ +

When I use the following qiskit code in Python:

+ +
q = QuantumRegister(1)
+c = ClassicalRegister(1)
+circuit = QuantumCircuit(q, c)
+circuit.x(q[0])
+circuit.z(q[0])
+circuit.h(q[0])
+backend = BasicAer.get_backend('statevector_simulator')
+job = execute(circuit, backend)
+amplitudes = job.result().get_statevector(circuit)
+print(amplitudes)
+
+ +

I get [ 0.70710678+0.00000000e+00j -0.70710678+8.65956056e-17j]. When I remove the Pauli-Z gate I get: [ 0.70710678+0.00000000e+00j -0.70710678+8.65956056e-17j], i.e. the same result.

+ +

However, using Quirk I get the expected output. With the IBM Quantum Experience, I'm not sure. I get [ -0.707+0j, 0.707+0j ] and it says 'The qubit 0 is the one that is furthest to the right on the state.' So I guess it's also not the correct result.

+ +

I am using qiskit==0.15.0 and qiskit-aqua==0.6.4, which I updated after having this problem in an older version, too.

+ +

I also tested the following circuit:

+ +
# setup the circuit as before
+circuit.x(q[0])
+circuit.z(q[0])
+# get and print amplitudes
+
+ +

Which results in [ 0.+0.0000000e+00j -1.+1.2246468e-16j], as I had expected.

+ +

Thus I am guessing, that I miss something. Can anyone explain this behavior?

+",5461,,55,,2/19/2020 13:23,2/19/2020 13:23,Generate the state $\frac{-|0\rangle + |1\rangle}{\sqrt{2}}$ with qiskit: problem with Pauli-Z behavior,,1,1,,,,CC BY-SA 4.0 +9829,2,,9828,2/11/2020 10:25,,4,,"

Generally, quantum states are determined up to a phase - i.e. up to multiplication by scalar. So $\frac{\left|0\right\rangle -\left|1\right\rangle }{\sqrt{2}},\frac{-\left|0\right\rangle +\left|1\right\rangle }{\sqrt{2}}$ are essentially the same state.

+ +

It is a good question how the statevector simulator chooses to normalize its statevector representation.

+",9918,,,,,2/11/2020 10:25,,,,3,,,,CC BY-SA 4.0 +9832,1,9835,,2/11/2020 14:59,,2,94,"

In the quantum search algorithm below, also known as Grover's algorithm, what observable do we measure at the end of the protocol?

+ +

That is, in the red box, it says ""measure the first $n$ qubits"", but which observable are we measuring?

+ +

Thanks.

+ +

+",10033,,10033,,2/11/2020 15:46,2/11/2020 20:03,What observable do we measure at the end of a quantum search algorithm?,,1,0,,,,CC BY-SA 4.0 +9833,1,,,2/11/2020 16:46,,1,179,"

I have a very basic question: say I perform some set of operations on $N$ qubits (like QFT, QFT addition etc), and thus have a $N$ qubit final state.

+ +

If each qubit has something that I want to read off of it, is it possible to extract data from each qubit into classical?

+ +

I now know how to load classical data onto a quantum device, but how do I read the final data? Is it impossible to get it since the wavefunction collapses? What I mean to ask is whether there exists a general protocol to read final N qubits into N classical bits (even at least by repeated measurements (bounded by the Chernoff limit) or similar such methods).

+",9997,,55,,2/19/2020 13:25,2/19/2020 13:25,Reading or Unloading quantum data to classical data,,2,1,,,,CC BY-SA 4.0 +9834,2,,9833,2/11/2020 17:54,,1,,"

In Qiskit, to read the qubits into classical bits you can use the measure operation. If you have defined classical and quantum registers as cr and qr respectively, you can get the values of all the qubits by doing qc.measure(qr,cr)

+",5955,,,,,2/11/2020 17:54,,,,3,,,,CC BY-SA 4.0 +9835,2,,9832,2/11/2020 19:58,,3,,"

Usually, when we don't specify, we measure in the computational basis, i.e. each qubit is measured using the observable $Z$.

+",5969,,5969,,2/11/2020 20:03,2/11/2020 20:03,,,,2,,,,CC BY-SA 4.0 +9836,2,,9833,2/11/2020 20:50,,2,,"

It seems as if you have an algorithm that can prepare a state such as:

+ +

$$\frac{1}{\sqrt{2}}(\vert 0A\rangle+\vert 1B\rangle),$$

+ +

and you want to be able to extract $A$ and $B$ separately.

+ +

You are correct that if you measure the second register, you will ""collapse"" the state, and it may be difficult to distinguish $A$ and $B$.

+ +

However, you may still be able to determine whether $A=B$. For example, interference allows you to measure the first register in the Hadamard basis. If $A=B$ then after Hadamarding the first register must revert back to $0$.

+",2927,,,,,2/11/2020 20:50,,,,2,,,,CC BY-SA 4.0 +9837,1,9841,,2/11/2020 22:03,,5,136,"

In order to figure out if a given pure 2-qubit state is entangled or separable, I am trying to compute: the density matrix, then the reduced density matrix by tracing out with respect to one of the qubits, squaring the resulting reduced matrix, and finally taking its trace. Then, if the trace is $=1,$ I know the state is separable and entangled otherwise.

+ +

So I am trying this method for the following state (which we know to be entangled):

+ +

$$ +|\psi\rangle = a_0b_0 |00\rangle+a_0b_1|01\rangle + a_1b_1|11\rangle \tag{1} +$$ +nothing much else is really said about the coefficients other than neither of the above rhs terms have a coefficient $0.$

+ +
+ +

My attempt:

+ +
    +
  • I computed $\rho=|\psi\rangle \langle\psi|$, then took the partial trace in the basis of the 2nd qubit $\rho_1=\operatorname{Tr}_2(\rho).$
  • +
+ +

The obtained $\rho_1$ is:

+ +

$$ +\rho_1 = \begin{pmatrix} a_0^2b_0^2 & a_0 a_1^* b_1^2 \\ a_0^* a_1 b_1^2 & a_1^2b_1^2\end{pmatrix} \tag{2} +$$

+ +
    +
  • Then computing $\rho_1^2$ then taking its trace, I obtain:
  • +
+ +

$$\operatorname{Tr}(\rho_1^2)=a_0^4b_0^4+a_1^4b_1^4+2a_0^2a_1^2b_1^4=(a_0^2b_0^2+a_1^2b_1^2)^2 \tag{3}$$

+ +
    +
  • So for $|\psi\rangle$ to be an entangled state, we need to show $(3)$ is $\neq 1,$ i.e., $(a_0^2b_0^2+a_1^2b_1^2)\neq 1$

  • +
  • The only way I can make progress with the latter, is to assume that our given state $|\psi\rangle$ in $(1)$ is normalized, then I can assert that $(a_0^2b_0^2+a_1^2b_1^2)<1$ since by normalization $a_0^2b_0^2+a_1^2b_1^2+a_0^2 b_1^2=1$ must be unity, thus $(a_0^2b_0^2+a_1^2b_1^2)<1$ must be true and our state is entangled.

  • +
+ +
+ +

Question:

+ +
    +
  • Do my calculations make any sense? Admittedly, I am not very confident about it, and if I am correctly applying the described approach at the start.

  • +
  • Is my assumption that $(1)$ is a normalized ket a necessary one in order to solve the problem of whether $(1)$ is entangled or separable?

  • +
  • In case the assumption is needed, is my end result correctly interpreted then?

  • +
+",10043,,10043,,2/12/2020 0:32,2/12/2020 8:21,Applying density matrix based criterion to verify separability,,2,0,,,,CC BY-SA 4.0 +9838,1,9840,,2/12/2020 2:28,,6,301,"

I am currently working my way through the book Quantum Computation and Quantum Information by Chuang and Nielsen. So far it has been a joy to read, however I am hung up on a couple aspects of quantum parallelism and Deutsch's algorithm that I cannot understand as they are described in the text. My two questions are as follows.

+ +
+ +

First, in concern with quantum parallelism, suppose we are given the function $f(x): \{0, 1\} \rightarrow \{0, 1\}$, and the unitary map +$$ +U_f:|x, y\rangle \rightarrow |x, y\oplus f(x)\rangle +$$ +Now suppose we feed $U_f$ the input $|+\rangle |0\rangle$. Then as output we obtain the interesting state +$$ +\frac{1}{\sqrt{2}}(|0, f(0)\rangle + |1, f(1) \rangle) +$$ +which clearly exhibits quantum parallelism as $f(0)$ and $f(1)$ are simultaneously evaluated. What I am unclear on is exactly how to arrive at the above output state via computation: how do you compute $|0 \oplus f(|+\rangle)\rangle$, or just $f(|+\rangle)$? And how does this computation lead to our output state? What if we had more than one qubit in our input register such as the state $|++\rangle$, how would you compute $f(|++\rangle)$?

+ +
+ +

My next question follows from the first. In the text, the authors say: applying $U_f$ (as defined above) to the state $|x\rangle \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$ gives the state +$$ +(-1)^{f(x)}|x\rangle \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle) +$$ +How was this result obtained (what computation is needed to obtain it?), where did the term $(-1)^{f(x)}$ come from?

+ +

As a consequence of this, they say that inputting the state $|+-\rangle$ into $U_f$ leaves us with the two possibilities of $\pm |+-\rangle$ if $f(0)=f(1)$ or $\pm |--\rangle$ if $f(0) \not= f(1)$. Similarly this doesn't make sense, how can I carry out the computation to show this?

+ +

Thank you all for the time and help, I will upvote partial answers (anwering one of the above questions for example).

+",10023,,,,,2/12/2020 7:05,Understanding Steps in Deutsch's Algorithm,,1,0,,,,CC BY-SA 4.0 +9839,2,,9837,2/12/2020 6:38,,1,,"

I haven’t checked the content of your calculation, but, yes, conceptually that’s all correct. The idea of testing the purity and comparing to 1 is entirely predicated on notion that your initial state is normalised, so you did exactly the right thing.

+",1837,,,,,2/12/2020 6:38,,,,0,,,,CC BY-SA 4.0 +9840,2,,9838,2/12/2020 7:05,,6,,"

To answer your first question, the quantum oracles are defined by their effect on the basis states $|0\rangle$ and $|1\rangle$, and if the oracle has to be computed on a superposition of basis states, its effects are expressed using the fact that the oracle is a linear transformation. This means that you never compute $f(|+\rangle)$; instead, to compute the result of applying $U_f$ to a state $|+\rangle|0\rangle$, you'd perform the following steps:

+ +

$$U_f|+\rangle|0\rangle = U_f \frac{1}{\sqrt2}(|00\rangle + |10\rangle) = \frac{1}{\sqrt2}(U_f|00\rangle + U_f|10\rangle) = \frac{1}{\sqrt{2}}(|0, f(0)\rangle + |1, f(1) \rangle)$$

+ +
+ +

Your next question can be answered using exactly the same logic: take the input state, represent it as a linear combination of basis states, apply the oracle to each basis state separately and look at the result to write it more concisely. Thus, if $x$ is a basis state 0 or 1, you'll get

+ +

$$U_f|x\rangle \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle) = \frac{1}{\sqrt{2}}(U_f|x,0\rangle - U_f|x,1\rangle) =$$ +$$ = \frac{1}{\sqrt{2}}(|x,f(x)\rangle - |x,1 \oplus f(x)\rangle) = +|x\rangle\frac{1}{\sqrt{2}}(|f(x)\rangle - |1 \oplus f(x)\rangle)$$

+ +

Now you consider options:

+ +
    +
  • if $f(x) = 0$, the state of the second qubit is $\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle) = |-\rangle$,
  • +
  • if $f(x) = 1$, the state of the second qubit is $\frac{1}{\sqrt{2}}(|1\rangle - |0\rangle) = -|-\rangle$
  • +
+ +

which finally you can write shorter as $(-1)^{f(x)}|x\rangle \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$

+ +
+ +

The same math applies to the final portion of your question, when $U_f$ is applied to a $|+\rangle|-\rangle$ state. For educational purposes I would recommend you do go through the steps yourself - you should have all the tool for that now!

+",2879,,,,,2/12/2020 7:05,,,,1,,,,CC BY-SA 4.0 +9841,2,,9837,2/12/2020 8:14,,2,,"

In essence the calculations are correct, though those numbers $𝑎^2_i, 𝑏^2_i$ must be taken with modulus, because they are in fact $a_ia_i^*, b_ib_i^*$. In general $𝑎^2_0$ is a complex number, so you can't write $𝑎^2_0>0$.

+ +

Normalization is required when we consider quantum states (also, otherwise, $\operatorname{Tr}(\rho_1^2)$ can be arbitrary close to 0). With normalization you have showed that $\operatorname{Tr}(\rho_1^2) < 1$, hence the state must be entangled.

+",5870,,5870,,2/12/2020 8:21,2/12/2020 8:21,,,,0,,,,CC BY-SA 4.0 +9842,1,9843,,2/12/2020 10:41,,4,944,"

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 are used. Moreover, when it is necessary to use multiple inputs Toffoli gate (i.e. with three or more inputs), one has to use ancilla qubit(s) which has to be uncomputed eventually. This increases complexity of a circuits further.

+ +

So my questions are these:

+ +
    +
  1. Is it possible to implement two inputs Toffoli gate in simpler way than for example on IBM Q?
  2. +
  3. How to implement Toffoli gate with three or more inputs without building it up from two inputs Toffoli gates and using ancilla qubits?
  4. +
+",9006,,9006,,2/14/2020 14:38,2/14/2020 14:38,Simpler implementation of the Toffoli gate on IBM Q for special circumstances,,1,0,,,,CC BY-SA 4.0 +9843,2,,9842,2/12/2020 10:41,,0,,"

It is possible to employ a method presented in Transformation of quantum states using uniformly controlled rotations. The article shows (besides) how to implement gate controlled by $n$ qubits and yielding a state

+ +

$$ +|\psi\rangle_{n+1} = |i\rangle_{n}\Big(\sqrt{1-f(i)}|0\rangle + \sqrt{f(i)}|1\rangle\Big), +$$

+ +

where $i$ is a binary representation of $n$ bits number and $f(i)$ is an arbitrary function. Setting function $f(i) = 1$ for $|i\rangle = |1 \dots1\rangle$ and $f(i) = 0$ otherwise allows to construct Toffoli gate with as many input qubits as one wants without ancilla qubits. Note however, that increase in number of gates is exponential in number of input qubits. For $n$ input qubits $2^n$ $CNOT$s and $Ry$ rotations is used.

+ +

However, in comparison with complexity of circuits used for implementation of Toffoli gate on IBM Q, the circuit is simpler. In case of two qubits, four $CNOT$s and four $Ry$ gates are used (note that after transpiling the circuit on IBM Q, $Ry$ are replaced by $U3$ gates).

+ +

A implementation of Toffoli gate with above mentioned method is this:

+ +

+ +

Note: Parameter $\theta$ is set to $\pm\frac{\pi}{4}$.

+ +

I tested the new gate ""abilities"" on input $|11\rangle$. Backend ibmqx2 was used, number of shots was set to 8,192. The circuit was designed to follow the backend physical implementation and hence to avoid qubits swaps after transpiling. A probability of measuring $|1\rangle$ was 93.286 %, while the same probability with Toffoli implemented on IBM Q was 87.486 %. Clearly, simpler circuits helped to get a more coherent results.

+ +

The method also allows to implement Toffoli gate with three inputs:

+ +

+ +

Note: Parameter $\theta$ is set to $\pm\frac{\pi}{8}$.

+ +

I again tested the circuit on ibmqx2 with same setting as above and compared it with Toffoli gate on IBM Q (here I had to use ancilla qubit and three two input Toffoli gates - one for uncomputing the ancilla). Input of circuit was $|111\rangle$. +A probability of measuring $|1\rangle$ was 81.213 %, while the probability with Toffoli implemented on IBM Q was 30.542 %. This means that output of construction with two inputs Toffoli gate and one ancilla qubit is very decoherent.

+ +
+ +

EDIT: based on DaftWullie comment.

+ +

Actually above introduced simplification of a Toffoli gate can be used only in case qubit $q_2$ (or $q_3$ in case of three inputs) is set to $|0\rangle$, i.e. the gate operate as AND known from classical Boolean logic. The reason is that a matrix describing circuit above is

+ +

$$ +\begin{pmatrix} +1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ +0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ +0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 0 & 0 & 0 & 0 & -1 \\ +0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ +\end{pmatrix} +$$

+ +

This means that for input $|111\rangle$ a phase is shifted by $\pi$.

+ +

As a result, the circuit is not ""general Toffoli"" and can be used only in special cases where it is ensured that the ""last"" qubit is set to $|0\rangle$

+",9006,,9006,,2/14/2020 14:37,2/14/2020 14:37,,,,3,,,,CC BY-SA 4.0 +9844,1,,,2/12/2020 14:06,,2,253,"

Suppose that I have a 5 qubit quantum computer and want to generate

+ +
    +
  1. 4 entangled states (each of 5 qubits)
  2. +
  3. Single 6 qubit entangled state.
  4. +
+ +

Are these 2 cases possible? I am a beginner please help!

+",8620,,9006,,2/13/2020 22:15,2/13/2020 22:15,Can I generate 4 entangled states (each 5 qubits) on a 5 qubit quantum computer?,,1,2,,,,CC BY-SA 4.0 +9845,1,,,2/12/2020 15:59,,2,96,"

In 2020, practically speaking, how long (time-wise) will a qubit function normally before decoherence kicks in?

+",7528,,,,,2/13/2020 3:30,How long can a qubit exist without decoherence?,,2,2,,,,CC BY-SA 4.0 +9846,1,9852,,2/12/2020 19:05,,1,257,"

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 transformation $M|0\rangle = \frac{1}{\sqrt{m}}\sum_{i=0}^{m-1}|i\rangle$ acting on $\log m$ qubits initialized to $|0\rangle$?

+",8620,,9006,,2/13/2020 5:46,2/13/2020 11:12,How to construct a IBM Quantum Experience circuit for the following state transformation?,,2,2,,,,CC BY-SA 4.0 +9847,2,,9845,2/12/2020 19:12,,3,,"

On IBM Q, it is a few tens microseconds. The best value of dephasing time T2 is around 500 microseconds. Have a look here IBM Q website and navigate to ""Qubits as physical system"" and then to ""dephasing T2"" to see development of T2 in last twenty years.

+",9006,,,,,2/12/2020 19:12,,,,0,,,,CC BY-SA 4.0 +9848,2,,9846,2/12/2020 21:01,,3,,"

The circuit you have described is formed of 2 qubits, both in an equal superposition. This can be achieved by applying the H gate to both qubits, as this puts each qubit into superposition and takes us up to 4 possible states. In the IBM Quantum Experience, this circuit would look like

+",5955,,,,,2/12/2020 21:01,,,,0,,,,CC BY-SA 4.0 +9849,2,,9845,2/13/2020 3:30,,1,,"

Nuclear moments of europium ions have been experimentally measured to have coherence times of over six hours, although there is no currently known way of performing controlled logic gate operations on them.

+",551,,,,,2/13/2020 3:30,,,,1,,,,CC BY-SA 4.0 +9850,2,,9844,2/13/2020 4:00,,1,,"

To go straight to your questions:

+ +
    +
  1. No, simply because if you want four 5-qubit entangled states you'd need 20 qubits.
  2. +
  3. No, if you only have 5 qubits, then you wouldn't be able to create a 6-qubit entangled state. You'd need 6 qubits in order to do that.
  4. +
+ +

One way I can think of creating a 5-qubit entangled state is to have one qubit in superposition with a Hadamard gate and then a CNOT from that qubit to the other four qubits. If you wanted 4 of those 5-qubit entangled states, then you'd just repeat that for the other 15 qubits in groups of 5. Here's an example in the circuit composer from IBM's Quantum Experience:

+ +

+",4966,,,,,2/13/2020 4:00,,,,2,,,,CC BY-SA 4.0 +9851,1,9885,,2/13/2020 4:14,,10,1514,"

(This is a somewhat soft question.)

+ +

The quantum Fourier transform is formally quite similar to the fast Fourier transform, but exponentially faster.

+ +

The QFT is famously at the core of Shor's algorithm for period finding. It also comes up in a few other places, like the HHL algorithm for solving (certain very special) linear systems of equations.

+ +

The FFT, on the other hand is used in countless different applications throughout applied math, science, engineering, finance, and music (notably for signal processing and solving differential equations). Gilbert Strang called it ""the most important numerical algorithm of our lifetime.""

+ +

Given that the QFT is exponentially faster than the FFT, there seems to me to be a strange discrepancy between the literally thousands of known applications of the FFT and the relatively few applications of the QFT (even at the theoretical level, setting aside the obvious practical implementation challenges). I would have expected that, given the exponential speedup that the QFT delivers over the FFT, a quantum computer capable of implementing the QFT would instantly render many classical computing applications obsolete, and would also open up many more potential applications that are currently impractical. And yet the only application of the QFT that people seem to really discuss is using Shor's algorithm for decryption. (I don't mean ""application"" in the academic's sense of ""something that will get me a paper published"", but in the business person's sense of ""something that there might be a commercial market for"".) It's not even clear if the HHL algorithm would actually deliver a useful speedup in practice.

+ +

Is there some conceptual explanation for why the QFT doesn't seem to be as big of a deal in practice as one might expect? Is it just the usual I/O challenge of (a) efficiently reading a large data set in memory and (b) only being able to statistically sample the output amplitudes over many runs instead of being able to read them out all at once?

+",551,,,,,1/20/2021 14:25,Does the quantum Fourier transform have many applications beyond period finding?,,3,0,,,,CC BY-SA 4.0 +9852,2,,9846,2/13/2020 5:45,,2,,"

Answer to EDIT in question:

+ +

It is possible to prepeare a state

+ +

$$|\psi\rangle = \frac{1}{\sqrt{m}}\sum_{i=0}^{m-1}|i\rangle,$$

+ +

where $m = 2^n$ and $n$ is a number of qubits, by application of operator $\otimes H ^{n} = H_{q_0} \otimes H_{q_1} \otimes \dots \otimes H_{q_{n-1}}$, i.e. Hadamard gate is applied on each qubit involved. As a results, you will get $n=\log{m}$ qubits in superposition described by uniform probability distribution. It is a generalization of construction provided in answer by met927

+ +
+ +

EDIT: based on comment by Adam Levine: ""what if for example $m=5$?""

+ +

It that case you have to prepare entangled state and the approach is a little bit more intricated. For $m=5$ you have to prepare state (I switched to more common convention with states expressed in binary numbers instead of decimal):

+ +

$$ +|\psi\rangle = \frac{1}{\sqrt{5}}(|000\rangle + |001\rangle + |010\rangle+|011\rangle+|100\rangle), +$$

+ +

i.e. three qubits state where $|101\rangle$, $|110\rangle$ and $|111\rangle$ have zero probability.

+ +

To prepare an arbitrary state, you can employ approach presented in this article: +Transformation of quantum states using uniformly controlled rotations.

+ +

Based on the article, a circuit preparing state $|\psi\rangle$ is this:

+ +

+ +

Here you can see results provided by IBM Q simulator:

+ +

+ +

Apparently, the circuit prepared desired state with uniformly distributed values from $|000\rangle$ to $|100\rangle$.

+ +
+ +

EDIT 2: here is a code in QASM of the circuit above:

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+qreg q[3];
+creg c[3];
+
+ry(0.927) q[0];
+
+ry(pi/4) q[1];
+cx q[0],q[1];
+ry(pi/4) q[1];
+cx q[0],q[1];
+
+ry(pi/2) q[2];
+cx q[1],q[2];
+ry(-pi/4) q[2];
+cx q[0],q[2];
+ry(pi/4) q[2];
+cx q[1],q[2];
+cx q[0],q[2];
+
+measure q[0] -> c[2];
+measure q[1] -> c[1];
+measure q[2] -> c[0];
+
+",9006,,9006,,2/13/2020 11:12,2/13/2020 11:12,,,,8,,,,CC BY-SA 4.0 +9854,2,,9851,2/13/2020 11:20,,2,,"

QFT is used for phase and amplitude estimation and hence it can be found in many application of quantum computing in finance, for example portfolio construction using HHL in its core, Monte Carlo simulation and quantum principal component analysis. There is also application in travelling salesman problem.

+ +

See list of articles on these applications here: Quantum computing in finance - list of articles

+ +

Disclaimer: I can imagine that there are application in other fields of science but I am particularly interested in finance, so I provided examples only for this field.

+",9006,,,,,2/13/2020 11:20,,,,2,,,,CC BY-SA 4.0 +9855,1,12539,,2/13/2020 15:28,,7,965,"

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 matrices. +I am aware we can have/create a quantum register proportional to a density matrix by tracing out some qubits on a bigger states, but I don't have any intuition to how this can be done in practice on a quantum computer.

+ +

It is simple with just an Hadamard gate (for n being a power of 2) to prepare the following state:

+ +

$$ |\psi\rangle = \frac{1}{\sqrt{n}} \sum_i^n |i\rangle $$ +The density matrix version of this state is: +$$\sigma= \sum_{i,y}^{n,n} |i\rangle\langle y|$$

+ +

But instead, I would like to know how to prepare a quantum register in the following state: +$$\rho = \frac{1}{n}\sum_{i}^{n} |i\rangle\langle i|$$

+ +

Unfortunately, I have no intuition how I can think this state in a quantum register, as I am too used to work with pure state. The density matrix should incorporate our (classical) ignorance about a quantum system, but why should I ignore the outcome of discarding (i.e. measuring) a bigger state that gives me the totally mixed state on a quantum computer?

+ +

Rephrased in other words my question is: what is the pure state state of $\rho$? +We know it must exist, because density matrices of pure states have the property that $\rho^2 = \rho$ page 20 of preskill's lecture notes. +Intuitively, is $\psi$, but it is not, as $\sigma \neq \rho$.

+",10062,,10062,,2/19/2020 3:52,6/18/2020 16:22,How to prepare mixed states on a quantum computer?,,3,1,,,,CC BY-SA 4.0 +9856,1,9857,,2/13/2020 21:34,,4,126,"

In a recent news "Scientists Make Major Breakthrough In ‘quantum Entanglement’ That Could Change How The Internet Works"

+
+

Scientists have managed to entangle two "quantum memories" at a distant much bigger than ever before, a breakthrough that could one day change the way the internet works.

+

To entangle those two quantum memories, researchers had to shoot photons, or individual particles of light, along the 50-kilometre cable.

+
+

One can think that, if one can separate quantum entangled particles then use them to transmit information between them. But the researchers entangled at the end of the cable;

+
+

After making their way over that distance, the two memories were able to interfere with each other, making the experiment a success and demonstrating that two quantum memories could become entangled over such a distance.

+
+

My questions are;

+
    +
  • What is quantum internet
  • +
  • What is the relation of it with quantum entanglement
  • +
+",4866,,55,,10/28/2020 9:25,10/28/2020 9:25,"What is ""quantum internet"" and what is its relation with quantum entanglement?",,1,0,,,,CC BY-SA 4.0 +9857,2,,9856,2/13/2020 22:06,,5,,"

Quantum internet is a theoretical concept of global (or at least wide) quantum net. It would allow to interconnect many quantum processors (or computers) and enable them to communicate each other.

+ +

How is a entanglement related: Quantum entanglement enables to employ superdense coding and quantum teleportation for a communication. The former is used for sending two classical bits over one qubit (i.e. information is compressed) but before that you have to have two entangled qubits, one placed at a sender and second one at a receiver. +The latter allows to transport qubit through classical communication channel (two classical bits are used for that) and reconstruct its state at a receiver but again before that you need to have two entangled qubits at both sides of communication.

+",9006,,9006,,2/14/2020 5:25,2/14/2020 5:25,,,,2,,,,CC BY-SA 4.0 +9858,2,,9855,2/13/2020 23:01,,3,,"

Easiest way to prepare a mixed state is to decompose it into a sum of pure states that are easy to construct, and then classically make a random selection.

+ +

Sure, it's now in some pure state, but from the point of view of someone who doesn't know which that is, it's in a mixed state.

+ +

As far as I can tell, there's no good reason ever to work with mixed states that aren't Bell pair halves or something else entangled. Pure states are simpler, and a mixed state is essentially just a piece of a pure state. If you don't care about the thing the pure state's entangled with, why not just make a random selection?

+",1949,,,,,2/13/2020 23:01,,,,2,,,,CC BY-SA 4.0 +9859,1,9866,,2/13/2020 23:40,,3,177,"

I'm currently learning Simon's algorithm, from IBM Quantum Experiene. +For the given string $s=11$, they display the implemented function $Q_f$ like this:

+ +

+ +

Can someone explain to me, why the CNOT gates are arranged like this, for $s=11$? The way I see it, the outcome of the the qubits below, should be $f(x \oplus 11)$, but we still don't know about the implementation of $f$, just because we know $s$, if I'm not wrong. So how can we display $Q_f$ here?

+",9950,,,,,2/14/2020 12:39,Simon's algorithm -- circuit for given s,,1,0,,,,CC BY-SA 4.0 +9861,1,9862,,2/14/2020 2:37,,1,312,"

Quantum mechanics is based on the idea of waves, and waves have both a magnitude and a phase?

+

$$|\psi\rangle = i\alpha|0\rangle + \beta|1\rangle.$$

+

Does $\alpha$ and $\beta$ represent magnitude and $i$ represent phase?

+

Or how do we represent phase? Or is it something else?

+",8491,,8757,,7/8/2020 10:23,7/8/2020 10:23,Magnitudes and phases of coefficients of a qubit,,1,2,,7/11/2020 21:20,,CC BY-SA 4.0 +9862,2,,9861,2/14/2020 7:23,,3,,"

It is more common to write a qubit as

+

$$ +|\psi\rangle = \alpha|0\rangle + \beta|1\rangle, +$$

+

where $\alpha, \beta \in \mathbb{C}$, i.e. to omit $i$ and get it in complex number $\alpha$.

+

Parameters $\alpha$ and $\beta$ are called complex amplitudes, $|\alpha|^2$ is a probability of measuring state $|0\rangle$ and $|\beta|^2$ is a probability of measuring state $|1\rangle$. So, $\alpha$ and $\beta$ (or rather square of their absolute values) can be called "magnitude".

+

Any qubit can be rewritten as

+

$$ +|\psi\rangle = \cos(\theta/2)|0\rangle + \mathrm{e}^{i\phi}\sin(\theta/2)|1\rangle, +$$

+

where $\theta$ and $\phi$ are coordinates on so-called Bloch sphere.

+

In this notation, $\cos^2(\theta/2)$ and $\sin^2(\theta/2)$ are probabilities ("magnitudes") of measuring $|0\rangle$ and $|1\rangle$, respecitively. Parameter $\phi$ is a phase (or to be precise, relative phase).

+",9006,,-1,,7/7/2020 23:03,7/7/2020 23:03,,,,0,,,,CC BY-SA 4.0 +9864,1,,,2/14/2020 9:27,,4,164,"

+ +

I want to run this qasm file using IBM device. +However, there's always an error:

+ +
qiskit.transpiler.exceptions.TranspilerError: 'Number of qubits (16) in circuit0 is greater than maximum (5) in the coupling_map'
+
+ +

How does this error come?

+ +

How can I set up the initial mapping when running this qasm file? +How to run the qasm file in Jupyter notebook?

+",9105,,55,,2/19/2020 13:47,2/19/2020 13:47,What is the source of this TranspilerError when running qasm file?,,1,0,,,,CC BY-SA 4.0 +9865,2,,9864,2/14/2020 9:42,,5,,"

The issue is that you are transpiling for a backend with 5 qubits, but this circuit is defined over a 16 qubit register (line 3 qreg q[16];).

+ +

To avoid this error you can either update your qasm to work over a register of 5 qubits, or transpile for a different backend. I think that the simulator is the only available device that will run up to 16 qubits.

+",5955,,,,,2/14/2020 9:42,,,,0,,,,CC BY-SA 4.0 +9866,2,,9859,2/14/2020 12:39,,3,,"

Remember that we're not told what function $f$ is being implemented by this circuit, it is simply claimed that $f(x)=f(y)$ if and only if $y=x$ or $x\oplus 11=\bar{x}$. So, we need to identify what the function is, and then we can verify if it has that property.

+ +

The first thing we observe is that, actually, it's just a one-bit function repeated twice - the second qubit of the second register will always be equal to the first qubit of the second register. So, let's just think about the function applied to the first qubit. Remember what controlled-not does: +

+ +

so, if the bit values of the first register are $x$ and $y$, we compute $0\oplus x=x$ with the first controlled not, and $x\oplus y$ with the second. Now we can make a truth table for the function. If the two inputs are the same, the output is 0. If the two outputs are different, the outputs are 1. So, in both cases, the two inputs that give the same output are related to each other by $\oplus 11$, as required.

+",1837,,,,,2/14/2020 12:39,,,,1,,,,CC BY-SA 4.0 +9867,1,,,2/14/2020 20:54,,2,748,"

If I have an arbitrary non-unitary matrix of say +$$ +U = \begin{pmatrix} +1.5 & 0 & 0 & 0 \\ +0 & 0 & 0 & 1.6 \\ +0 & 0 & 1 & 0 \\ +0 & 1 & 0 & 0 \\ +\end{pmatrix}, +$$

+ +

is it possible to decompose it into gates implementable in qiskit?

+ +

If so, how? If not, why not?

+ +

Is is possible to have any arbitrary non-unitary matrix as an input and get the corresponding gates that implement this arbitrary matrix?

+",9778,,23,,2/19/2020 23:49,2/19/2020 23:49,Decomposition of an arbitrary gate using given matrix in Qiskit,,0,8,,,,CC BY-SA 4.0 +9868,2,,9800,2/14/2020 23:04,,6,,"

To give an answer to part of your question:

+ +
+

Can we only use X,Y,Z,H and CNOT?

+
+ +

No. The gates you mention are stabilizer gates. On the other hand, the Toffoli is not a stablizer gate. (In fact, Toffoli and Hadamard together are universal.) Thus, it is impossible to build the Toffoli with only stabilizer gates (and thus only the gates you mention).

+",491,,,,,2/14/2020 23:04,,,,0,,,,CC BY-SA 4.0 +9870,1,,,2/15/2020 13:31,,4,462,"

While I'm reading some literature about synthesizing quantum circuit, I couldn't understand what cascades of Toffoli gates means. How Toffoli cascade runs in quantum circuit?

+",10028,,55,,2/19/2020 13:49,2/19/2020 13:49,"What is a ""cascade of gates""?",,1,1,,,,CC BY-SA 4.0 +9871,1,9875,,2/15/2020 17:56,,1,135,"

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 shown below :

+ +

+ +

Is there a way of achieving this with qiskit's ccx function ? +I tried :

+ +

qnodes = QuantumRegister(2) + qsubnodes = QuantumRegister(2) + qc.ccx(subnode[0], subnode[1], q[1]) + if (q[1] ==1) : + qc.x(q[0]) +qc.x(q[1]) +qc.ccx(subnode[0], subnode[1], q[1])

+",10075,,5955,,2/16/2020 15:02,2/16/2020 15:02,Achieve a control gate with 2 hadamard coins,,1,2,,,,CC BY-SA 4.0 +9872,2,,9870,2/15/2020 22:25,,4,,"

I think a ""cascade"" of gates is just a fancy word for a sequence of gates that follow a certain pattern. A good example is offered in this answer that details implementing a multi-controlled-NOT gate using Toffoli gates. The pictures in that answer show Toffoli gates form two ladder-like patterns. I don't think the term ""cascade"" means anything more specific than that.

+",2879,,,,,2/15/2020 22:25,,,,0,,,,CC BY-SA 4.0 +9873,1,,,2/16/2020 3:40,,2,265,"

I understand the matrix multiplication behind Grover's algorithm, but I'd like to get an intuitive grasp on why sequence of gates Hadamard-Phase-Hadamard does inversion about the mean. Can anyone help?

+",10078,,9006,,2/16/2020 9:42,2/16/2020 9:42,Hadamard/Phase/Hadamard and Inversion about the Mean,,1,0,,,,CC BY-SA 4.0 +9874,2,,9873,2/16/2020 6:32,,2,,"

I'm not sure whether it's completely intuitive if it still has some formulas in it, but here's a try. (I prefer term ""reflection"", since it makes the geometrical interpretation a bit simpler, but I think they are used interchangeably.)

+ +
    +
  1. First, let's convince ourselves that Controlled Z does inversion about the $|1...1\rangle$ state.
    +Controlled Z flips the phase of $|1...1\rangle$ basis state and keeps the phases of other states unchanged, so it can be written as $\mathcal{I} - 2|1...1\rangle \langle 1...1|$, which is the reflection about the $|1...1\rangle$ (with an extra global phase of -1, which can be ignored).

  2. +
  3. Second, let's see how to represent reflection about any state $|\psi\rangle$ in terms of reflection about the $|1...1\rangle$ state, given that we know a unitary $U$ that prepares state $|\psi\rangle$ from the $|1...1\rangle$, i.e., $|\psi\rangle = U|1...1\rangle$.
    +Reflection about $|\psi\rangle$ is

    + +

    $$2|\psi\rangle \langle \psi| - \mathcal{I} = 2 U|1...1\rangle \langle 1...1|U^\dagger - \mathcal{I} = U(2|1...1\rangle \langle 1...1| - \mathcal{I})U^\dagger$$

    + +

    So you can represent that reflection by applying the following sequence of steps:

    + +
      +
    • $U^\dagger$
    • +
    • reflection about the $|1...1\rangle$
    • +
    • $U$
    • +
  4. +
  5. Finally, let's see how to prepare the mean state $\sum_j |j\rangle$, starting with the $|1...1\rangle$ state.
    +The easiest way is to apply X gate to each qubit to get $|0...0\rangle$, and then to apply H gate to each qubit to get an equal superposition of all basis states.

  6. +
+ +

Putting this all together, we get the following procedure:

+ +
    +
  • apply H to each qubit
  • +
  • apply X to each qubit
  • +
  • apply Controlled Z with most qubits as control and last qubit as target
  • +
  • apply X to each qubit
  • +
  • apply H to each qubit
  • +
+",2879,,,,,2/16/2020 6:32,,,,0,,,,CC BY-SA 4.0 +9875,2,,9871,2/16/2020 11:44,,2,,"

You can implement three-input Toffoli gate with three two-input Toffoli gates and one ancilla qubit as shown below.

+ +

+ +

Assume that qubits $q_0$, $q_1$ and $q_2$ are three inputs and qubit $q_4$ is a target. Qubit $q_3$ is ancilla qubit. The first gate implements function $q_0~ \mathrm{AND}~ q_1$ and saves results of this operation to $q_3$. The second gate implements function $q_2~ \mathrm{AND}~ q_3 = q_2~\mathrm{AND}~(q_0~ \mathrm{AND}~ q_1) = q_0~\mathrm{AND}~q_1~ \mathrm{AND}~ q_2$. Eventually, qubits $q_0$, $q_1$ and $q_2$ control qubit $q_4$. The last gate is used for uncomputation ancilla qubit $q_3$ back to state $|0\rangle$ (this is necessary because ancilla qubits entangled with other qubits can cause interference and increase error rate, note that inverse gate for Toffoli is again Toffoli).

+ +

Here is a code in QASM (sorry, I am not experienced in Qiskit)

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+qreg q[5];
+creg c[5];
+
+ccx q[0],q[1],q[3];
+ccx q[2],q[3],q[4];
+ccx q[0],q[1],q[3];
+
+",9006,,,,,2/16/2020 11:44,,,,1,,,,CC BY-SA 4.0 +9876,1,9877,,2/16/2020 17:28,,5,209,"

I am trying to read Nielsen's and Chuang's book on quantum computing and I am having problem understanding Deutsch's algorithm.

+ +

According to my understanding of the algorithm, the state $|x\rangle$ between the Hadamard gates should not change, however somehow the state of the second qubit affects the first? So from my point of view the measurement after the second Hadamard gate should always be $|0\rangle$. So is $|x\rangle$ after the $U_f$ not the state we used as input? If not then what is the state? Every answer will be appreciated, thanks in advance.

+",10085,,2879,,2/16/2020 18:50,2/16/2020 18:50,How does $U_f$ in Deutsch's Algorithm affect the state $|x\rangle$?,,1,0,,,,CC BY-SA 4.0 +9877,2,,9876,2/16/2020 18:50,,3,,"

This picture can be confusing, since it makes some assumptions that are not clear when you quickly scan through the text.

+ +
    +
  1. The picture of the oracle $U_f$ describes its effect on the basis states that go into it, not on arbitrary superposition states. If both $x$ and $y$ are basis states, the oracle will behave exactly as the rectangle says, but the algorithm feeds states in superposition to it, so you need to deduce the effect on a linear combination of basis states as a linear combination of effects on individual basis states.
  2. +
  3. Since the states fed to the oracle are in superposition, and $|y\rangle = |-\rangle$, phase kickback happens: applying the oracle leaves $|y\rangle$ unchanged and modifies the phase of some of the basis states of $x$ depending on $f(x)$. This allows the final H gate to transform the first qubit into $|0\rangle$ or $|1\rangle$ state depending on the values $f(x)$.
  4. +
+ +

You can read more details on the math behind this picture in this question.

+",2879,,,,,2/16/2020 18:50,,,,0,,,,CC BY-SA 4.0 +9878,1,,,2/16/2020 18:58,,2,103,"

I have been exploring quantum computing, I have no idea of decomposing arbitrary gates in Qiskit. Can someone help me with an example?

+",9778,,1859,,11/3/2020 14:12,11/3/2020 14:12,How to decompose arbitrary gates in Qiskit?,,0,2,,3/1/2020 15:30,,CC BY-SA 4.0 +9879,1,9880,,2/16/2020 23:09,,4,754,"

I'm new to quantum computing, but everything I've read about superdense coding claims that, in the circuit below, Bob should receive a $[01\rangle$ from Alice.

+ +

+ +

Unfortunately, that's not what I get I run the above circuit in either Qiskit or Circuit Composer. The latter results are shown below.

+ +

+ +

If I replace the Pauli-X gate with a Pauli-Z gate, the outcome is $[01\rangle$. What am I missing?

+",10086,,9006,,2/17/2020 15:24,2/17/2020 15:24,Superdense coding circuit returns wrong result,,1,0,,,,CC BY-SA 4.0 +9880,2,,9879,2/16/2020 23:20,,4,,"

Bit ordering convention in Qiskit is reversed to what is common in many physics textbooks.

+ +

From Qiskit textbook:

+ +
+

The bit we flipped, which comes from qubit 7, lives on the far left of the string. This is because Qiskit numbers the bits in a string from right to left. If this convention seems odd to you, don’t worry. It seems odd to lots of other people too, and some prefer to number their bits the other way around. But this system certainly has its advantages when we are using the bits to represent numbers. Specifically, it means that qubit 7 is telling us about how many 27s we have in our number. So by flipping this bit, we’ve now written the number 128 in our simple 8-bit computer.

+
+ +

You can also have a look at Big Endian vs. Little Endian in Qiskit (question on this stackexchange):

+ +
+

Qiskit uses little-endian for both classical bit ordering and qubit ordering.

+
+",10087,,1386,,2/17/2020 10:24,2/17/2020 10:24,,,,4,,,,CC BY-SA 4.0 +9883,1,,,2/17/2020 0:56,,3,303,"

While I'm studying Algorithm, I couldn't understand what Quantum Phase Estimation is. And I heard there is relation between Phase-Kickback and Quantum Phase Estimation. I wonder what it is. Also, I'm not sure what this is and how it works within the algorithm. I would like to learn from the mathematical point of view and the conceptual part.

+",10028,,,,,2/17/2020 21:13,What is Quantum Phase Estimation in Shor's Algorithm?,,2,0,,,,CC BY-SA 4.0 +9884,2,,9883,2/17/2020 7:53,,4,,"

Phase estimation is the process by which you are given a controlled-$U$ unitary, and a state that you are promised is an eigenvector of $U$ with eigenvalue $e^{2\pi ix/2^t}$, then you can use a $t$-qubit register to affect the change +$$ +|0\rangle^{\otimes t}|u\rangle\mapsto|y\rangle|u\rangle. +$$ +If $x$ is in integer, then the outcome is guaranteed to be $y=x$. If $x$ is not an integer, $y$ is, with high probability, the closest integer to $x$.

+ +

The phase-kickback is the way that we get something, apparently on the second register (i.e. the $|u\rangle$ being acted upon by $U$) to change the first register. In effect, this is making use of the difference between global phase (as it would be for $U$) and relative phase in a superposition (which is what you actually get when you use controlled-$U$).

+ +

Before I go into the detailed mathematics, what have you read so far (as this is standard in all texts)? What is it you don't understand?

+",1837,,,,,2/17/2020 7:53,,,,0,,,,CC BY-SA 4.0 +9885,2,,9851,2/17/2020 9:34,,7,,"
+

Given that the QFT is exponentially faster than the FFT,

+
+ +

The problem with quantum computing is that they are not actually parallel computers: One is tweaking the qubits in such a way that when reading out the result, the desired result gets a high probability.

+ +

The power of quantum computing comes from the vast phase-space that grows exponentially with the number of the entangled qubits, and all of the parameters representing that phase space are manipulated at once during a quantum computation step. However, reading out will ""collapse"" the quantum state and you'll only see the projection of the state. A bit like a 2-d shadow has less information than a 3-d object casting that shadow.

+ +

While you get all the $2^n$ frequency components with FFT, you'll basically just find one frequency with QFT, and this works nicely in cases where you are only interested in one frequency. The latter is the case for Shor's algorithm where you basically compute the order of the multiplicative group of $\mathbb Z/n\mathbb Z$.

+",10089,,2927,,2/17/2020 17:31,2/17/2020 17:31,,,,1,,,,CC BY-SA 4.0 +9886,2,,9800,2/17/2020 16:45,,4,,"

To give another partial answer - considering only the CNOT cost (I agree that one needs to define a cost to answer this question, and CNOT cost is probably one of the most relevant, theoretically and practically): No matter how many ancillas you add, as long as CNOT is your only two-qubit gate, you cannot do better than the original circuit. This is Theorem 1 in Shende and Markov 08:

+ +
+

A circuit consisting of CNOT gates and one-qubit gates which implements the + n-qubit TOFFOLI gate without ancillae requires at least 2n CNOT gates. For n = 3, this + bound holds even when ancillae are permitted, and is achieved by the circuit of Figure 1

+
+ +

Where Figure 1 is just the circuit in the original question

+",10087,,,,,2/17/2020 16:45,,,,1,,,,CC BY-SA 4.0 +9887,1,,,2/17/2020 17:12,,0,57,"

How to retrieve the parameters of a Q# operation? Is it possible to do such a thing at all?

+",8487,,8487,,4/12/2020 15:16,4/12/2020 15:16,How to retrieve the parameters of a Q# operation?,,1,3,,,,CC BY-SA 4.0 +9888,2,,9824,2/17/2020 17:50,,2,,"

With the most probable phase coming out of the phase estimation being 0 (the highest value in the histogram you got), you can't really do much. I suppose you got this from actual hardware, which has more tendency to relax to |0> for each qubit. This is just an artifact coming from the noise in the hardware. I suggest to you to run on noiseless simulator first, and better with more qubits (larger N in the input) so the histogram will be more significant towards the phase estimated from the quantum algorithm. Then, apply (classical) continued-fraction algorithm in the regular procedure to get the order out of the most probable phase extracted from the histogram

+",10087,,,,,2/17/2020 17:50,,,,1,,,,CC BY-SA 4.0 +9889,2,,9883,2/17/2020 21:13,,2,,"

If you want to learn more generally about phase estimation, the book I am helping write has a whole chapter on it, Learn Quantum Computing with Python and Q# (chapter 8). +Ping me here or via email and I can get you a discount code!

+",4211,,,,,2/17/2020 21:13,,,,0,,,,CC BY-SA 4.0 +9890,1,9893,,2/18/2020 1:53,,3,129,"

The paper Quantum fidelity measures for mixed states considers various differently-normalized variants of the Hilbert-Schmidt inner product $\mathrm{Tr}(A^\dagger B)$ on linear operators as candidate measures of the fidelity $\mathcal{F}$ between two density operators $\rho$ and $\sigma$ - that is, +$$\mathcal{F} = \frac{\mathrm{tr}(\rho \sigma)}{f \left(\mathrm{tr}(\rho^2), \mathrm{tr}(\sigma^2) \right)}$$ +for various choices of normalization function $f(x,y)$. For various choices of $f$, they say which of the Jozsa axioms are and are not respected by that choice:

+ +

J1a. $\mathcal{F}(\rho, \sigma) \in [0, 1]$

+ +

J1b. $\mathcal{F}(\rho, \sigma) = 1 \iff \rho = \sigma$

+ +

J1c. $\mathcal{F}(\rho, \sigma) = 0 \iff \rho \sigma = 0$

+ +

J2. $\mathcal{F}(\rho, \sigma) = \mathcal{F}(\sigma, \rho)$

+ +

J3. $\mathcal{F}(\rho, \sigma) = \mathrm{tr}(\rho \sigma)$ if either $\rho$ or $\sigma$ is a pure state

+ +

J4. $\mathcal{F}(U \rho U^\dagger, U \sigma U^\dagger) = \mathcal{F}(\rho, \sigma)$ for any unitary operator $U$.

+ +

But oddly enough, they never discuss which of these axioms are respected by the simplest choice of normalization of all: $f \equiv 1$, which gives the Hilbert-Schmidt inner product itself as the candidate fidelity.

+ +

Which of the Jozsa axioms does the Hilbert-Schmidt inner product respect? It's easy to see that it satisfies axioms J2-J4, but what about J1a-J1c?

+",551,,55,,10/28/2020 9:25,10/28/2020 9:25,Which of the Jozsa axioms does the Hilbert-Schmidt inner product violate?,,1,0,,,,CC BY-SA 4.0 +9891,1,9938,,2/18/2020 2:10,,19,533,"

The (Uhlmann-Jozsa) fidelity of quantum states $\rho$ and $\sigma$ is defined to be +$$F(\rho, \sigma) := \left(\mathrm{tr} \left[\sqrt{\sqrt{\rho} \sigma \sqrt{\rho}} \right]\right)^2.$$ +However, as discussed here, the cyclical property of the trace extends to arbitrary analytic functions: +$$\mathrm{tr}[f(AB)] \equiv \mathrm{tr}[f(BA)]$$ +for any analytic function $f$ whenever either side is well-defined. Letting $f$ be the square root function, this seems to imply that +$$F(\rho, \sigma) \equiv \big(\mathrm{tr} \left[\sqrt{\rho \sigma} \right]\big)^2,$$ +which is much easier to deal with. (I don't think the branch point at the origin of the square root function is an issue, because the function is still continuous there.)

+
    +
  1. Am I correct that these two expressions are equivalent?

    +
  2. +
  3. If so, is there any reason why the much clunkier former expression with nested square roots is always given?

    +
  4. +
+

The only benefit of the original definition that I can see is that it makes it clear that the operator inside the trace is Hermitian and positive-semidefinite, so that the resulting fidelity is a non-negative real number.

+
+

Related on physics.SE

+",551,,2927,,5/31/2021 15:51,5/31/2021 15:51,Can we combine the square roots inside the definition of the fidelity?,,2,6,,,,CC BY-SA 4.0 +9893,2,,9890,2/18/2020 7:33,,2,,"

You could probably reach the same conclusions by identifying that $tr(\rho \sigma)$ is just the expectation value of $\rho$ under the mixed state $\sigma$, but let's do it explicitly:

+ +

for $\rho = \sum_i p_i |\psi_i\rangle \langle \psi_i|$ and $\sigma = \sum_i q_i |\phi_i\rangle \langle \phi_i|$, we have:

+ +

$tr(\rho \sigma)$ = $\sum_{ij} p_i q_j tr(|\psi_i\rangle \langle \psi_i|\phi_j\rangle \langle \phi_j|)$ = $\sum_{ij} p_i q_j |\langle \psi_i|\phi_j\rangle |^2$ by the trace cyclic property and the fact that the trace of a scalar is the scalar.

+ +

Then:

+ +

J1a is true because $p_i$, $q_j$ and $|\langle \psi_i|\phi_j\rangle |$ are all larger or equal zero and smaller or equal one so: +$0 \leq \sum_{ij} p_i q_j |\langle \psi_i|\phi_j\rangle |^2 \leq \sum_{ij} p_i q_j = (\sum_i p_i)(\sum_j q_j) = 1$

+ +

J1b is false because $tr(\rho \sigma) = tr(\rho^2) < 1$ for $\rho = \sigma$ a non-pure state

+ +

J1c is true because right to left direction is trivial. For left to right direction suppose $tr(\rho \sigma) = \sum_{ij} p_i q_j |\langle \psi_i|\phi_j\rangle |^2$ = 0, so $\langle \psi_i|\phi_j\rangle = 0$ for all $i$, $j$ in the mixed states (i.e. $p_i, q_j \neq 0$). Then $\rho \sigma = (\sum_i p_i |\psi_i\rangle \langle \psi_i|)(\sum_j q_j |\phi_j\rangle \langle \phi_j|) = \sum_{ij} p_i q_j |\psi_i\rangle \langle \psi_i|\phi_j\rangle \langle \phi_j| = 0$ by the assumption.

+",10087,,10087,,2/18/2020 16:36,2/18/2020 16:36,,,,6,,,,CC BY-SA 4.0 +9894,1,9898,,2/18/2020 18:12,,3,292,"

In the QAOA algorithm for MaxCut, the authors construct a very specific scheme where the qubits (corresponding to the vertices of the graph) are transformed using a sequence of unitaries

+ +

$$|\gamma, \boldsymbol{\beta}\rangle= U\left(B, \beta_{p}\right) U\left(C, \gamma_{p}\right) \cdots U\left(B, \beta_{1}\right) U\left(C, \gamma_{1}\right)|s\rangle$$

+ +

Here $\vert s\rangle$ is an intial state constructed by a Hadamard on the all zero state. The $U(B, \beta_i)$ and $U(C,\gamma_i)$ are also specific unitaries that the authors construct. The alternating sequence of $U(B, \beta_i)$ and $U(C,\gamma_i)$ is also specified.

+ +

QAOA works by iteratively measuring the output state $|\gamma, \boldsymbol{\beta}\rangle$. It uses a classical optimizer to choose the next set of angles $\{\beta_i\}$ and $\{\gamma_i\}$. This is repeated until the classical optimizer converges and the final measurement on the state $|\gamma, \boldsymbol{\beta}\rangle$ gives us the information of how to cut the graph.

+ +

Is there a reference that explains why this specific construction was chosen? The original paper introduces this construction and says that this yields a good cut but what motivated this very specific construction? Any references or links to talks would be greatly appreciated!

+",4831,,,,,2/18/2020 22:41,QAOA for MaxCut - Algorithm motivation,,1,0,,,,CC BY-SA 4.0 +9895,1,9896,,2/18/2020 10:18,,2,195,"

I have two ebits $e1$ and $e2$ and my 4-qubit system is in the state:

+ +

$$(|00\rangle + |11\rangle) (|00\rangle + |11\rangle)$$

+ +

Ignoring the normalizing constants for now. As mentioned, I need to obtain $|0000\rangle + |1111\rangle$.

+ +

I have the additional restriction that I can only use single gates on all the qubits, and controlled gates (CNOT, etc) only on the second and third qubit (otherwise I could just use inverse operations to disentangle all qubits, and proceed to get what I want in same way we create the GHZ state).

+ +

My idea to do this was to entangle second and third qubits, using CNOT and H gates, but it doesn't work because the 2nd and third qubits are in the state $|00\rangle + |01\rangle + |10\rangle + |11\rangle$, and I only know how to entangle if we were starting in $|00\rangle$ (or even if we're in $|0\rangle(|0\rangle + |1\rangle)$, which is what we get after H gate).

+ +

Is this possible to do?

+",,Peeyush Kushwaha,55,,10/28/2020 9:25,10/29/2020 12:09,Further entangling two ebits to obtain $|0000\rangle + |1111\rangle$ state,,3,2,,,,CC BY-SA 4.0 +9896,2,,9895,2/18/2020 13:09,,6,,"

If you can only use unitary control gates on the second and third qubits, you cannot change the density matrix on the first and last qubits except by single qubit operations. This density matrix is the completely mixed state: +$$\frac{1}{4}\left(\begin{array}{cc}1&0\\0&1\end{array}\right)\otimes \left(\begin{array}{cc}1&0\\0&1\end{array}\right),$$ and unitary single qubit operations don't change it. In the 4-qubit state you want, the first and fourth qubits are not in the completely mixed state.

+ +

Are you allowed to use measurements on the second and third qubits?

+",1765,Peter Shor,,,,2/18/2020 13:29,,,,2,,,,CC BY-SA 4.0 +9898,2,,9894,2/18/2020 22:41,,6,,"

What motivated this construction is mentioned in the original paper (section VI): adiabatic quantum computing. This construction is basically a Trotterized version of the evolution by the time dependent hamiltonian: +$$ H(t) = (1-t/T)B + (t/T) C $$ +where T is the total runtime.

+ +

The Trotterized evolution consists of alternately applying $U_{C}$ and $U_{B}$. +Here, the sum of the angles is the total runtime T.

+ +

And note that the initial state is the highest energy eigenstate of B and by evolution, we try to find the highest energy eigenstate of C. The adiabatic theorem tells you that if you evolve slowly and long enough, you end up in the seeked eigenstate. In QAOA, slowly means small angles and long enough means a good enough depth $p$. And to the limit of infinite depth, you get convergence.

+",4127,,,,,2/18/2020 22:41,,,,0,,,,CC BY-SA 4.0 +9899,2,,9895,2/18/2020 23:02,,1,,"

If you allow for measurements and communication of measurement outcomes, and joint operations on qubits 2 and 3, parties $2$ and $3$ can prepare the desired state locally and teleport it to 1 and 4.

+",491,,,,,2/18/2020 23:02,,,,0,,,,CC BY-SA 4.0 +9900,1,,,2/19/2020 4:22,,2,40,"

What are the different ways of representing unitary gates in terms of the matrix? In other words what would be the two different matrices which on multiplication give you unitary gate matrix?

+",9778,,55,,2/19/2020 11:37,2/19/2020 11:37,What are the different ways of representing unitary gates in terms of the matrix?,,1,0,,,,CC BY-SA 4.0 +9902,1,9945,,2/19/2020 6:38,,1,215,"

Delayed choice entanglement swapping.

+ +

Two pairs of entangled photons are produced, and one photon from each pair is sent to a party called Victor. Of the two remaining photons, one photon is sent to the party Alice and one is sent to the party Bob. Victor can now choose between two kinds of measurements. If he decides to measure his two photons in a way such that they are forced to be in an entangled state, then also Alice's and Bob's photon pair becomes entangled.

+ +

If Victor chooses to measure his particles individually, Alice's and Bob's photon pair ends up in a separable state. Modern quantum optics technology allows to delay Victor's choice and measurement with respect to the measurements which Alice and Bob perform on their photons. Whether Alice's and Bob's photons are entangled and show quantum correlations or are separable and show classical correlations can be decided after they have been measured.

+ +

We follow the calculations in the reference.

+ +

$\Phi^+=\frac{1}{\sqrt{2}}(\vert 00\rangle+\vert 11\rangle)$

+ +

$\Phi^-=\frac{1}{\sqrt{2}}(\vert 00\rangle-\vert 11\rangle)$

+ +

$\Psi^+=\frac{1}{\sqrt{2}}(\vert 01\rangle+\vert 10\rangle)$

+ +

$\Psi^-=\frac{1}{\sqrt{2}}(\vert 01\rangle-\vert 10\rangle)$

+ +

$\vert 00\rangle=\frac{1}{\sqrt{2}}(\Phi^+ + \Phi^-)$

+ +

$\vert 11\rangle=\frac{1}{\sqrt{2}}(\Phi^+ - \Phi^-)$

+ +

$\vert 01\rangle=\frac{1}{\sqrt{2}}(\Psi^+ + \Psi^-)$

+ +

$\vert 10\rangle=\frac{1}{\sqrt{2}}(\Psi^+ - \Psi^-)$

+ +

Two pairs of entangled photons (1&2 and 3&4) are each produced in the antisymmetric polarization entangled Bell singlet state such that the total four photon state has the form:

+ +

$$\vert \Psi\rangle_{1234}=\vert \Psi^-\rangle_{12}\otimes\vert\Psi^-\rangle_{34}$$

+ +

In short, we write:

+ +

$$\vert \Psi\rangle_{1234}=\Psi^-_{12}\otimes\Psi^-_{34}$$

+ +

If Victor subjects his photons 2 and 3 to a Bell state measurement, they become entangled. Consequently photons 1 (Alice) and 4 (Bob) also become entangled, and entanglement swapping is achieved. This can be seen by writing $\vert \Psi\rangle_{1234}$ in the basis of Bell states of photons 2 and 3.

+ +

$$\vert\Psi\rangle_{1234}=\frac{1}{2}(\Psi^+_{14}\otimes\Psi^+_{23}-\Psi^-_{14}\otimes\Psi^-_{23}-\Phi^+_{14}\otimes\Phi^+_{23}+\Phi^-_{14}\otimes\Phi^-_{23})$$

+ +

This is relation (2) in the paper linked above.

+ +

In order to see the correlations between their particles, Alice and Bob must compare their coincidence records with Victor. Without comparing with Victor's records, they only see a perfect mixture of anti-correlated (the Ψ’s) and correlated (the Φ’s) photons, no pattern whatsoever.

+ +

There is though another way based on statistics and a reliable entanglement witness.

+ +

When Victor entangles his photons 2 and 3,  photons 1 and 4 are in a mixture of entangled states. We consider the transmitter (Victor) and the receiver (Alice and Bob) follow an agreed protocol. For each bit of information transferred (0/1),  a certain number  KN of pairs of photons are measured by both Victor and  corespondingly by Alice/Bob. When he wants to send a 0, Victor does not entangle his photons. When he wants to send a 1, Victor entangles his photons. In order to decode the message Alice and Bob need a reliable procedure of entanglement detection . And they don't need to compare their records with Victor.

+ +

In the paper above it is discussed witnessing entanglement without entanglement witness operators. The method involves measuring the statistical response of a quantum system to an arbitrary nonlocal parametric evolution. The witness of entanglement is solely based on the visibility of an interference signal. If followed closely, this method never gives false positives.

+ +

In the protocol described , when Victor (the transmitter) and Alice and Bob (the receiver) measure N pairs of photons, then with probability $\frac{1}{4^N}$ all the N photon pairs measured by Alice and Bob will be in the same Bell state. So the transmitter and receiver can repeat measuring N pairs of photons (lets say K times) until the entanglement detection method described above will give a positive. At this point Alice and Bob know that Victor must be entangling his photons. When Victor does not entangle his photons, since the method of entanglement detection mentioned above does not give false positives, Alice and Bob will know that Victor does not entangle his photons for all the KN pairs of photons processed. For large N and K, the probability of error can be made arbitrarily small. Basically, without comparing records, Alice and Bob know what Victor is doing. That's signalling, and the no - signalling theorem can be circumvented due to the method of entanglement detection described above, which does not rely on witness operators.

+ +

In principle the problem seems to allow a solution. Reliable entanglement detection seems to circumvent the no - signalling theorem.

+ +

Question: Is back in time (classical) information transfer possible?

+ +

I am thinking about experiments that would validate Everett's many worlds interpretation of QM (or variants, because that's the only way to avoid the emerging logical paradoxes). In fact, following Scott Aaronson (and others), computation with CTC's would have a great impact in the field. But first things first, is this possible, in principle?

+ +
+ +

Cross-posted on physics.SE

+",10110,,55,,10/28/2020 9:25,10/28/2020 9:25,Is back in time (classical) information transfer possible (based on delayed choice entanglement swapping)?,,1,4,,,,CC BY-SA 4.0 +9903,2,,9900,2/19/2020 6:40,,3,,"

A unitary gate is described by a unitary matrix $U$. (Note that this gate can have different representations as a matrix depending on what basis you choose to use.)

+ +

If you want to decompose that into a pair of matrices that multiply together to give the original unitary, there are infinitely many ways to do this. For example, a pair of matrices $V$ and $V^\dagger U$ satisfy this for any unitary $V$ and, indeed, you can generalise it to the case of $V$ simply being invertible. If you’re looking for some particular consistent way of doing it, you might be interested in LU or QR decompositions of a matrix, but since you give no guidance as to the context that you want this for, it’s impossible to know!

+",1837,,,,,2/19/2020 6:40,,,,0,,,,CC BY-SA 4.0 +9904,1,9922,,2/19/2020 11:16,,4,75,"

Recently, I started to study practical application of ZX calculus but I am confused by meaning of ""diamond"" and ""loop"".

+ +
+ +

Issue no. 1: +There are these rules:

+ +

B-rule

+ +

+ +

and D-rule

+ +

+ +

But this example seems to use the rules wrongly:

+ +

+ +

In the middle of a digram, B-rule is used, however, I do not see any loop or diamonds justifying this step (i.e. a disconection of nodes).

+ +

Similar situation occurs in this example:

+ +

+ +

Why is it possible to ignore loop and diamonds?

+ +
+ +

Issue no. 2:

+ +

Interpreation of a diamond in Hilbert space is this:

+ +
+

Diamond = $\sqrt{2}$

+
+ +

What does mean that diamond is $\sqrt{2}$? Is it a normalization constant?

+ +

Interpreation of a loop in Hilbert space is this:

+ +
+

Loop represent the dimension of underlying Hilbert space

+
+ +

Assuming D-rule, loop should represent two diamonds hence $\sqrt{2}\sqrt{2} = 2$ which is dimension of Hilbert space for description of single qubit states. But ZX calculus can be used for any number of qubits. What does it mean that loop represent a dimension? How is a dimension of ""multi-qubits"" Hilbert space represented?

+",9006,,,,,2/20/2020 15:56,ZX calculus: What do diamond and loop mean?,,1,0,,,,CC BY-SA 4.0 +9905,1,,,2/19/2020 12:15,,2,62,"

I am wondering how to simulate spin-1 systems with qiskit or on the IBMQ +platform? I want to initialize a qudit (a spin-1 system), and then define the usual operations (such as Sx, Sy, and Sz) on the system. If you have any experience with this, it would be much appreciated.

+",10112,,55,,2/19/2020 12:42,2/19/2020 12:42,How to simulate spin-1 systems with qiskit or on the IBMQ platform?,,0,0,,,,CC BY-SA 4.0 +9906,1,9908,,2/19/2020 12:37,,3,97,"

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 get the idea of operators required in the circuit by seeing the qubits.

+ +

+ +

+",8527,,9006,,2/19/2020 13:55,2/19/2020 13:55,How to make circuit of a 32 X 32 matrix?,,1,0,,,,CC BY-SA 4.0 +9907,2,,9855,2/19/2020 12:51,,3,,"

Given an arbitrary state $\rho$ in a space $H_A$, you can always find a pure state $\newcommand{\tr}{\operatorname{Tr}}\newcommand{\ket}[1]{|#1\rangle}\newcommand{\ketbra}[1]{|#1\rangle\!\langle #1|}\ket\psi$ on some $H_A\otimes H_B$ such that $\rho=\tr_B(\ketbra\psi)$. Any such $\ket\psi$ is called a purification of $\rho$. +If the eigendecomposition of your $\rho$ reads $\rho=\sum_k p_k\ketbra{\psi_k}$, any pure of the form +$$ + \ket\psi = \sum_k \sqrt{p_k} \ket{\psi_k}\otimes\ket{u_k}, +$$ +for any set of orthonormal vectors $\ket{u_k}$, is a viable purification.

+ +

To actually generate experimentally such a $\rho$, two straightforward ways are

+ +
    +
  1. Actually run the experiment using the different $\ket{\psi_k}$ as input, rather than $\rho$. You can then mix the experimental outcomes according to the weights $p_k$. This will give you identical answers as if you used $\rho$.
  2. +
  3. Use a purification $\ket\psi$ as input for the experiment, but only operate and measure a part of the system (what we denoted with $H_A$ above).
  4. +
+ +
+

The density matrix should incorporate our (classical) ignorance about a quantum system, but why should I ignore the outcome of discarding (i.e. measuring) a bigger state that gives me the totally mixed state on a quantum computer?

+
+ +

This depends on why you want to use a non-pure state to begin with.

+",55,,,,,2/19/2020 12:51,,,,0,,,,CC BY-SA 4.0 +9908,2,,9906,2/19/2020 13:29,,4,,"

If I'm reading your matrix correctly, it can be written as +$$ +\cos(\theta)I+i\sin(\theta)Z\otimes X^{\otimes 4}. +$$ +So, if I were you, I'd start by performing a rotation $R_z(2\theta)$ on the first qubit, creating +$$ +(\cos(\theta)I+i\sin(\theta)Z)\otimes I, +$$ +and then apply four controlled-nots, controlled off each of the other 4 qubits, and targetting the first qubit. That creates +$$ +\cos(\theta)I+i\sin(\theta)Z^{\otimes 5}. +$$ +You can then convert the $Z$s into $X$s using Hadamards. Overall, the circuit looks something like: +

+",1837,,,,,2/19/2020 13:29,,,,4,,,,CC BY-SA 4.0 +9909,1,,,2/19/2020 14:39,,3,98,"

+ +

I have a sample IBM experience circuit which generates $$\frac{1}{2}(|00\rangle - |01\rangle - |10\rangle + |11\rangle)$$ +When we measure the state will be either $|00\rangle$/$|01\rangle$/$|10\rangle$/$|11\rangle$.

+ +

I know that state phase disappears after measurement. I am testing a complex circuit which involves phase angles and I want to ask my questionusing a simple state as mentioned above.

+ +

Is there anyway to know if the circuit has produced my desired state. I want to view the full state.

+",8620,,8620,,2/19/2020 15:10,2/19/2020 15:40,Can we capture phase in IBM Quantum Experience?,,2,1,,,,CC BY-SA 4.0 +9910,2,,9909,2/19/2020 14:53,,2,,"

If you get the QASM of your circuit, you can load this into Qiskit and run the circuit on the state vector simulator. This will show you what the final state vector of your circuit is.

+ +

You can load the circuit by using QuantumCircuit.from_qasm_str('your QASM') and you can then get the simulator using Aer.get_backend('statevector_simulator').

+",5955,,,,,2/19/2020 14:53,,,,0,,,,CC BY-SA 4.0 +9911,2,,5904,2/19/2020 15:37,,3,,"

I was recently looking for a similar solution. Hope this helps.

+ +
job = execute(qc, backend=backend, shots=1024)
+results = job.result()
+print(results.time_taken)
+
+ +

You can also check all the values stored in result as it is a dictionary by printing it:

+ +
print(results)
+
+ +

Here you can check for all the information that is available within the dictionary and you can also observe the value for 'time_taken'

+",10114,,,,,2/19/2020 15:37,,,,0,,,,CC BY-SA 4.0 +9912,2,,9909,2/19/2020 15:40,,3,,"

Click on the icon with graph on left hand-side from window with qasm code. You will see theoretical output of the circuit.

+ +

+1 for Martin Vesely's comment.

+",8620,,,,,2/19/2020 15:40,,,,0,,,,CC BY-SA 4.0 +9913,1,9919,,2/19/2020 16:15,,7,520,"

It is well known that entanglement in a quantum state is not affected when you perform a combination of 1-qubit unitary transformations.

+ +

I have seen that the QFT can be decomposed into product of 1-qubit unitary transformations (for example in Wiki). However, it is not very clear that QFT preserves entanglement or not. I have seen sources suggesting that it does, doesn't, and unclear.

+ +

Does anyone have a definite answer for this question?

+",6174,,55,,2/20/2020 10:12,2/20/2020 10:12,Does the Quantum Fourier Transform (QFT) preserve entanglement?,,2,1,,,,CC BY-SA 4.0 +9914,1,9916,,2/19/2020 16:39,,1,48,"

I'm looking at some examples, but I cannot get the expected result when it comes down to making the measurement on the following state where we measure the first qubit which is the ancilla state.

+ +

Here is $|\psi\rangle = \frac{1}{2} |{0}\rangle \otimes (|\psi_a\rangle |\psi_b\rangle + |\psi_b\rangle |\psi_a\rangle) + \frac{1}{2} |{1}\rangle \otimes (|\psi_a\rangle |\psi_b\rangle - |\psi_b\rangle |\psi_a\rangle)$

+ +

My calculation suggests that the probability of the ancilla being in the state $|0\rangle$ is:

+ +

$p_{0} =\frac{1}{2} + \frac{1}{2}|\langle\psi_a | \psi_b \rangle|^2 $

+ +

However the text suggests that there is a minus in place of the plus. I'm not sure if I'm doing anything wrong here or this is a typo.

+",7439,,7439,,2/19/2020 19:03,2/20/2020 1:52,Getting dot product from two wavefunctions,,1,2,,,,CC BY-SA 4.0 +9915,1,,,2/19/2020 21:16,,3,470,"

In section 3.3.2 of this PDF, The general SWAP gate is defined as

+ +

$ +S (\alpha, \hat{y}) = \begin{bmatrix} +1 & 0 & 0 & 0 \\ +0 & \cos(\alpha/2) & -\sin(\alpha/2) & 0 \\ +0 & \sin(\alpha/2) & \cos(\alpha/2) & 0 \\ +0 & 0 & 0 & 1 \\ +\end{bmatrix} +$

+ +

The same lecture notes claim that for $\alpha = \pi$, you get the SWAP gate. This is not correct if we perform the computation.

+ +

$ +S (\pi, \hat{y}) = \begin{bmatrix} +1 & 0 & 0 & 0 \\ +0 & 0 & -1 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +\end{bmatrix} +$

+ +

Those lecture notes also say the square root of SWAP can be created by setting $\alpha=\frac{\pi}{2}$. When we do that we get

+ +

$ +S (\frac{\pi}{2}, \hat{y}) = \begin{bmatrix} +1 & 0 & 0 & 0 \\ +0 & \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} & 0 \\ +0 & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} & 0 \\ +0 & 0 & 0 & 1 \\ +\end{bmatrix} +$

+ +

The matrix for the square root of Swap is +$ +\begin{bmatrix} +1 & 0 & 0 & 0 \\ +0 & \frac{1}{{2}} (1+i) & \frac{1}{{2}} (1-i) & 0 \\ +0 & \frac{1}{{2}} (1-i) & \frac{1}{{2}} (1+i) & 0 \\ +0 & 0 & 0 & 1 \\ +\end{bmatrix} +$

+ +

This is not the same matrix as the one we get when we use the general SWAP matrix. Is the matrix for the general SWAP from those lecture notes correct? I haven't been able to find another source to cross-reference.

+",362,,9006,,2/20/2020 12:43,11/16/2020 15:03,What is the general matrix for the Swap gate?,,1,2,,,,CC BY-SA 4.0 +9916,2,,9914,2/20/2020 1:52,,1,,"

Your calculation is correct, given the state and conclusion that you have written. The book may be unclear, or have a typo.

+",10115,,,,,2/20/2020 1:52,,,,0,,,,CC BY-SA 4.0 +9917,2,,9913,2/20/2020 1:56,,7,,"

I expect you're referring to this image:

+ +

+ +

Where it says that $R_m$ is given by a particular 2x2 matrix. In this notation, $R_m$ is a 1-qubit unitary, but the circuit is applying a different gate, what we might call $CR_m$: a controlled version of $R_m$. This is a 2-qubit gate, given by a 4x4 matrix, with the definition

+ +

$$ CR_m (|0\rangle |\psi\rangle) = |0\rangle |\psi\rangle$$ +$$ CR_m (|1\rangle |\psi\rangle) = |1\rangle (R_m |\psi\rangle)$$

+ +

This is part of the circuit notation, but not particularly clear in the article; I'll edit it now. But anyway, this is a 2-qubit gate, so it does create entanglement.

+",10115,,,,,2/20/2020 1:56,,,,0,,,,CC BY-SA 4.0 +9918,1,,,2/20/2020 5:36,,4,242,"

I have been working on implementing Jozsa-Deutsch decision algorithm, Grover search algorithm, Shor factorization algorithm on my home-made 2 qubits device.

+ +

I am wondering if there are any other breakthrough quantum algorithms that I can devise, run and experiment on with on my 2 qubits device?

+",166,,11925,,5/4/2020 8:29,5/4/2020 8:29,"Any other quantum algorithms than Jozsa-Deutsch decision algorithm, Grover search algorithm, Shor factorization algorithm?",,5,0,,,,CC BY-SA 4.0 +9919,2,,9913,2/20/2020 7:29,,5,,"

TLDR: the Fourier transform is entangling.

+ +

We can immediately agree on two things:

+ +
    +
  • if you input a computational basis state (separable) to the Fourier transform, it outputs a separable state
  • +
  • the circuit involves entangling gates
  • +
+ +

Neither of these actually resolves the question. Could there be another separable basis which is converted to entangled states? Could entangling gates combine to give an overall separable operation (example: swap gate being composed of 3 controlled-nots)?

+ +

The best way to resolve this is with an example. So, take the simplest example: the Fourier transform on two qubits. The circuit looks like this:

+ +

+ +

This is easy to analyse because there's only one entangling gate: the controlled-$S$. Any single-qubit gates that come after it do not affect entanglement. Now, if controlled-$S$ acted on an input of $|+\rangle|+\rangle$, it would create entanglement. So, we can work backwards: if I input $(H\otimes I)|+\rangle|+\rangle=|0+\rangle$ to the circuit, the output must be entangled. Separable input yields entangled output, so the circuit is entangling.

+",1837,,,,,2/20/2020 7:29,,,,0,,,,CC BY-SA 4.0 +9920,2,,9918,2/20/2020 8:00,,3,,"

Probably only two qubits constrain set of algorithm you can run on your device, for example HHL algorithm (linear equation solver) seems to impossible work there.

+ +

You can however implement algorithms based on uniformly controlled rotation used for preparing arbitrary quantum state. See details in the paper Transformation of quantum states using uniformly controlled rotations.

+ +

Also you can implement toy-model (adding two single bit numbers) of adder based on Fourier transformation. See paper Addition on a Quantum Computer.

+ +

Moreover, you can play with quantum tomography on one and two qubits. See this thread for more information how to do the tomography: Implementation of tomography on IBM Q.

+",9006,,,,,2/20/2020 8:00,,,,0,,,,CC BY-SA 4.0 +9921,2,,9915,2/20/2020 14:22,,1,,"

A gate $S (\alpha, \hat{y})$ implements this circuit:

+ +

+ +

Here is an example of code for $\alpha = \pi/4$ (other parameters of $U3$ have to be set as stated):

+ +
cx q[1], q[0];
+cu3(pi/4,-pi,pi) q[0],q[1];
+cx q[1], q[0];
+
+ +

Setting $\alpha = \pi$ leads to something similar to swap gate up to a phase for input $|10\rangle$ in which case $-|01\rangle$ is returned.

+",9006,,,,,2/20/2020 14:22,,,,2,,,,CC BY-SA 4.0 +9922,2,,9904,2/20/2020 15:56,,2,,"
    +
  1. If you agree to treat diagrams up to a constant factor, then you can ignore loops and diamonds. As you correctly guessed, it's a normalization constant.

  2. +
  3. For a multi-qubit system, you represent an identity operator with several wires. If you trace them, you get dimension equal to $2^n$, and in the diagram you represent this dimension as $n$ disjoint loops each contributing a factor of 2.

  4. +
+",5103,,,,,2/20/2020 15:56,,,,0,,,,CC BY-SA 4.0 +9923,2,,9918,2/20/2020 17:05,,3,,"

I have implemented via qiskit two algorithms and posted in github that need only 1-2 qubits. First is Iterative Quantum Phase Estimation (IQPE) that works on two qubits, the second one is Variational Quantum Eigensolver (VQE) that works on only one qubit (one can do also for 2 qubits) in my implementations. Actually they are jupyter notebook tutorials, so I hope it will be easy to understand what I did. Here is the link to the repo where you can find both of them:

+ +

https://github.com/DavitKhach/quantum-algorithms-tutorials

+",9459,,9459,,2/20/2020 17:13,2/20/2020 17:13,,,,1,,,,CC BY-SA 4.0 +9924,1,,,2/20/2020 17:20,,2,479,"

I am trying to run following 6 qubit quantum circuit and I am getting different results under ibmq_qasm_simulator and ibmq_16_melbourne (both involving 8192 shots). What is the reason?

+ +

ibmq_qasm_simulator :: +

+ +

ibmq_16_melbourne :: +

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+qreg q[6];
+creg c[6];
+
+ry(1.57079631679) q[0];
+ry(1.57079631679) q[1];
+ry(1.57079631679) q[2];
+ry(1.57079631679) q[3];
+ry(1.57083295585) q[4];
+ry(1.98263774407) q[5];
+cx q[0],q[1];
+ry(-0.00000001000) q[1];
+cx q[0],q[1];
+cx q[1],q[2];
+ry(-0.00000001000) q[2];
+cx q[0],q[2];
+ry(-0.00000001000) q[2];
+cx q[1],q[2];
+ry(-0.00000001000) q[2];
+cx q[0],q[2];
+cx q[2],q[3];
+ry(-0.00000001000) q[3];
+cx q[1],q[3];
+ry(-0.00000001000) q[3];
+cx q[2],q[3];
+ry(-0.00000001000) q[3];
+cx q[0],q[3];
+ry(-0.00000001000) q[3];
+cx q[2],q[3];
+ry(-0.00000001000) q[3];
+cx q[1],q[3];
+ry(-0.00000001000) q[3];
+cx q[2],q[3];
+ry(-0.00000001000) q[3];
+cx q[0],q[3];
+cx q[3],q[4];
+ry(0.00003662905) q[4];
+cx q[2],q[4];
+ry(0.00003662905) q[4];
+cx q[3],q[4];
+ry(0.00003662905) q[4];
+cx q[1],q[4];
+ry(0.00003662905) q[4];
+cx q[3],q[4];
+ry(0.00003662905) q[4];
+cx q[2],q[4];
+ry(0.00003662905) q[4];
+cx q[3],q[4];
+ry(0.00003662905) q[4];
+cx q[0],q[4];
+ry(0.00003662905) q[4];
+cx q[3],q[4];
+ry(0.00003662905) q[4];
+cx q[2],q[4];
+ry(-0.78523504324) q[4];
+cx q[3],q[4];
+ry(-0.78523504324) q[4];
+cx q[1],q[4];
+ry(0.78530830134) q[4];
+cx q[3],q[4];
+ry(-0.78523504324) q[4];
+cx q[2],q[4];
+ry(0.00003662905) q[4];
+cx q[3],q[4];
+ry(0.00003662905) q[4];
+cx q[0],q[4];
+cx q[4],q[5];
+ry(0.17720720528) q[5];
+cx q[3],q[5];
+ry(0.17720720528) q[5];
+cx q[4],q[5];
+ry(0.01914233557) q[5];
+cx q[2],q[5];
+ry(0.01914233557) q[5];
+cx q[4],q[5];
+ry(-0.21549187642) q[5];
+cx q[3],q[5];
+ry(0.17720720528) q[5];
+cx q[4],q[5];
+ry(0.01914233557) q[5];
+cx q[1],q[5];
+ry(0.01914233557) q[5];
+cx q[4],q[5];
+ry(0.17720720528) q[5];
+cx q[3],q[5];
+ry(-0.21549187642) q[5];
+cx q[4],q[5];
+ry(0.01914233557) q[5];
+cx q[2],q[5];
+ry(-0.76625582782) q[5];
+cx q[4],q[5];
+ry(0.17720720528) q[5];
+cx q[3],q[5];
+ry(0.17720720528) q[5];
+cx q[4],q[5];
+ry(-0.37355674613) q[5];
+cx q[0],q[5];
+ry(0.21549187642) q[5];
+cx q[4],q[5];
+ry(-0.01914233557) q[5];
+cx q[3],q[5];
+ry(-0.01914233557) q[5];
+cx q[4],q[5];
+ry(-0.17720720528) q[5];
+cx q[2],q[5];
+ry(-0.17720720528) q[5];
+cx q[4],q[5];
+ry(0.37355674613) q[5];
+cx q[3],q[5];
+ry(-0.80454049897) q[5];
+cx q[4],q[5];
+ry(-0.17720720528) q[5];
+cx q[1],q[5];
+ry(-0.17720720528) q[5];
+cx q[4],q[5];
+ry(-0.01914233557) q[5];
+cx q[3],q[5];
+ry(-0.41184141727) q[5];
+cx q[4],q[5];
+ry(-0.17720720528) q[5];
+cx q[2],q[5];
+ry(-0.17720720528) q[5];
+cx q[4],q[5];
+ry(-0.01914233557) q[5];
+cx q[3],q[5];
+ry(-0.01914233557) q[5];
+cx q[4],q[5];
+ry(0.21549187642) q[5];
+cx q[0],q[5];
+measure q[0] -> c[5];
+measure q[1] -> c[4];
+measure q[2] -> c[3];
+measure q[3] -> c[2];
+measure q[4] -> c[1];
+measure q[5] -> c[0];
+
+",8620,,55,,8/12/2020 8:34,8/12/2020 8:34,Why IBM Quantum Experience is giving different results under ibmq_qasm_simulator and ibmq_16_melbourne?,,2,0,,,,CC BY-SA 4.0 +9925,2,,9924,2/20/2020 17:39,,6,,"

The problem is caused by depth of the circuit. Current quantum hardware is not as developed as would be needed to run your algorihtm. Try to implement 2 or 3 qubits state preparation and you will se that results are more similar to the simulator ones.

+ +

Moreover, qubits are not connected each other (this is not the case on the simulator), therefore, a transpiler have to apply qubit swaps (additional 3 CNOT gates) to implement the circuit on real hardware. This increases depth of the circuit as well and leads to further decoherence.

+",9006,,,,,2/20/2020 17:39,,,,0,,,,CC BY-SA 4.0 +9926,1,9928,,2/20/2020 20:55,,0,84,"

I would like to know which property is being used in this example. +For $Tr_1$ the partial trace on the first system:

+ +

$$Tr_1[(|0\rangle\otimes|0\rangle)(\langle 0| \otimes \langle0|)] =|0\rangle\langle0|\langle 0 | 0 \rangle $$

+ +

The property that I can imagine used are:

+ +
    +
  • the ciclicity of the trace,
  • +
  • $Tr[AB]=Tr[BA]$,
  • +
  • $Tr[v_1^Tv_2] = (v_1,v_2)$
  • +
+",10062,,9006,,2/20/2020 21:10,2/21/2020 5:43,Which simple property of partial trace are we using here?,,1,0,,,,CC BY-SA 4.0 +9927,2,,9924,2/20/2020 21:32,,2,,"

The brief answer would be, due to the introduced noise on a real quantum device.

+

Simulators are nothing but a classical implementation/simulation of a quantum device. On a simulator, you can define arbitrary qubit connectivity, noise model, and adjust the noise strength. But by default, a simulator runs without noise.

+

Typically the two main sources of noise, on a real device, are gate-infidelity and decoherence.

+

On a real device, over time the effect of decoherence gets higher. So the depth of the circuit plays always a role. Higher depth, higher noise! In addition, each qubit has its own decoherence rate, so depending on which combination of qubits you've used, you'll get different measurement results.

+

In order to understand gate fidelity, you have to know the difference between a physical(native) gate and a logical (software-visible) gate. +When you are implementing on an IBM device, you'd have the following gate set to use in your circuit: {I,X,Y,Z,H,S,S†,T,T†,U1(λ),U2(λ,φ),U3(λ,φ,θ),CNOT}. +Any gate you use, will be translated into products of three physical gates,{U1(λ), RX (π/2), CNOT} in the hardware level. +So gate infidelity refers to the fact that the software gate does not precisely map (implement) to the physically implemented gate.

+

It is worth mentioning, that even running the same circuit on different IBM Q topologies (real device topologies) would result in different readout errors!

+

You can find some details in this article: Full-Stack, Real-System Quantum Computer Studies: Architectural Comparisons and Design Insights

+",9318,,9318,,8/11/2020 15:07,8/11/2020 15:07,,,,1,,,,CC BY-SA 4.0 +9928,2,,9926,2/20/2020 21:58,,3,,"
    +
  1. mixed-product property of the Kronecker product: $(A \otimes B)(C \otimes D) = (AC \otimes BD)$
  2. +
  3. definition of the partial trace: $\text{Tr}_1(A\otimes B) = \text{Tr}(A)B$
  4. +
  5. cyclic property of the trace: $\text{Tr}(AB) = \text{Tr}(BA)$
  6. +
+ +

Your 3 guesses actually follow from the cyclic property.
+$\text{Tr}(|v_1\rangle\langle v_2|) = \text{Tr}(\langle v_2|\cdot|v_1\rangle) = \langle v_2|v_1\rangle$

+",5870,,5870,,2/21/2020 5:43,2/21/2020 5:43,,,,0,,,,CC BY-SA 4.0 +9929,1,9936,,2/20/2020 22:21,,2,92,"

using this paper, I want to implement a solution for the Job Shop Problem on a D-Wave machine. One of the constraints mentioned in the paper, is +$$ +h_3(\bar{x}) = \sum_i \left(\sum_t x_{i,t}-1 \right)^2, +$$ +and I'm curious, how to implement a general BQM for it. I need to create a Qubo matrix, based on the solution of this sum. For that I have rewritten it to +$$ +\sum_i \left(\sum_t x_{i,t}-1 \right)^2 = \sum_i\left(2\sum_t\sum_{u>t}x_{it}x_{iu} - \sum_tx_{it} +1\right) +$$ +and tried to fill the generall matrix with these loops

+ + + +
for i in range (num_operations):
+    for u in range(upper_time_limit):
+        for t in range(u):
+            # What to do with 2* x_{it}x_{iu} ?
+    for t in range(upper_time_limit):
+        Q[i][t] -= 1
+
+ +

Here I am unsure about how to handle the first part, with situations like $x_{2, 3}x_{2,4}$, and I'm not sure what to do with the $+1$ in the end.

+ +

I appreciate any help!

+",9950,,9006,,2/20/2020 22:26,2/22/2020 18:21,Quantum Annealing - Job Shop Problem,,1,0,,,,CC BY-SA 4.0 +9930,1,,,2/20/2020 23:09,,3,161,"

It seems IBM offers a 15 qubit quantum computer through their quantum experience program. However, upon a quick search through the literature, the largest implementation of Grover's algorithm I have seen is with 4 qubits. What seems to be preventing people from implementing Grover's algorithm with as many qubits as possible?

+",10127,,,,,2/20/2020 23:09,Difficulty in implementing Grover's Algorithm with large number of qubits,,0,2,,,,CC BY-SA 4.0 +9931,1,9934,,2/21/2020 4:40,,1,306,"

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?

+",8620,,55,,10/17/2020 20:28,10/17/2020 20:28,Can we add two classical registers in IBM Quantum Experience?,,1,0,,,,CC BY-SA 4.0 +9934,2,,9931,2/21/2020 7:01,,2,,"

You can add two qubits firstly in quantum registers and then measure qubit with results and put it to classical register.

+ +

Adding two qubits modulo 4 can be do with this circuit:

+ +

+ +

First $CNOT$ is fan-out and make a ""copy"" of qubit $q_0$ to $q_2$, second $CNOT$ realizes XOR function between $q_1$ and $q_2$. Eventually you have $(q_0 + q_1) \mod 4$ in $q_2$

+ +
+ +

EDIT: Expanded for two qubits adder modulo 4, based on comment by Adam Levine:

+ +

Here is a code implementing a modulo 4 adder for two qubits:

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+qreg q[6];
+creg c[6];
+
+//first input q[0]q[1]
+//second input q[2]q[3]
+//output q[4]q[5]
+
+//input
+//q[0]q[1] = 01
+id q[0];
+x q[1];
+//q[2]q[3] = 11
+x q[2];
+x q[3];
+
+//first qubit:
+//q[1] + q[3] - sum
+cx q[1],q[5];
+cx q[3],q[5];
+//q[1], q[3] - carry
+ccx q[1], q[3], q[4];
+
+//second qubit:
+//q[0] + q[2] - sum
+cx q[0],q[4];
+cx q[2],q[4];
+//no carry, modulo 4 sum
+
+ +

$I$ and $X$ gates set an input (based on the comment), $CNOT$ gates acting on qubit $q_5$ return sum of last (lower) qubits of input numbers. Toffoli gate is used for calculation of carry form last qubits and next two $CNOT$ gates add together the carry and first (higher) qubits of input numbers. Carry from this sum is not performed as the adder is modulo 4. The result is in qubits $q_4$ and $q_5$ where higher qubit is $q_4$ and lower $q_5$.

+ +

Note: this is based on classical approach how to construct an adder. There is also quantum approach based on quantum Fourier transform. See details here: Addition on a Quantum Computer

+",9006,,9006,,2/24/2020 9:39,2/24/2020 9:39,,,,1,,,,CC BY-SA 4.0 +9935,2,,9887,2/21/2020 7:48,,1,,"

You are assuming a 1-1 mapping from a Q# operation with a C# operation but it doesn't work like that. A Q# operation can have a lot more functionality than a C# class, for example, Q# offers the ability to automatically create the adjoint and controlled versions of a the operation.

+ +

As Mariia pointed out, https://stackoverflow.com/questions/59022076/how-to-get-the-type-of-a-q-operation-parameter is a very similar question and the same answer applies:

+ +

Each Q# operations generations a C# class that extends the generic class Operation<I,O>, so to figure out what the input/output parameters you can take a look at the BaseType of the operation's Type, and look at the value of the GenericTypeArguments[0] to figure out the input type.

+",2918,,,,,2/21/2020 7:48,,,,0,,,,CC BY-SA 4.0 +9936,2,,9929,2/21/2020 12:25,,1,,"

From what I understand, $x_{i,t}$ are the binary variables. So your QUBO matrix should not be indexed as Q[i][t]. If you do this way, this means you have a binary variable $x_i$ and a binary variable $x_t$ and they have a real coefficient, so representing a term $Q[i][j] *x_i x_j$.

+ +

In this case, if you really want a QUBO matrix with a correct indexing, you should reindex or relabel. Or even simpler, think of a simple matrix reindexing from 2D to 1D, by applying the function: +$$ R: (i,u) \rightarrow i*U + u $$ +U being your $upper\_time\_limit$ or number of columns; +and then you can simply call $Q[R(i,t)][R(i,u)]$.

+ +

The $+1$ at the end will just end up in a constant factor that you do not submit to the QPU. So you can store your constants in an offset variable if you really want but adding it to the evaluations you get after running the QPU with your problem.

+",4127,,4127,,2/22/2020 18:21,2/22/2020 18:21,,,,0,,,,CC BY-SA 4.0 +9938,2,,9891,2/21/2020 19:16,,4,,"
    +
  1. Square root is not differentiable at 0, so that cyclic property cannot be applied
  2. +
  3. While $\rho\sigma$ has the same non-negative eigenvalues as $\sqrt\rho\sigma\sqrt\rho$, it's not self-adjoint. Non self-adjoint matrices are not diagonalizable in general, so the square root $\sqrt{\rho\sigma}$ can be not well-defined (see edit below).
  4. +
  5. Anyway, $\text{Tr}(\sqrt{\sqrt\rho\sigma\sqrt\rho})$ is equal to the sum of square roots of eigenvalues of $\rho\sigma$.
  6. +
+ +

EDIT
+It turns out that $\rho\sigma$ is always diagonalizable https://www.sciencedirect.com/science/article/pii/002437959190239S

+ +

So, taking principal square root of it is a correct operation. And it is indeed possible to write this shorter formula. Though this is not very well known and not conventional, since $\rho\sigma$ is not self-adjoint.

+",5870,,5870,,2/24/2020 18:32,2/24/2020 18:32,,,,9,,,,CC BY-SA 4.0 +9939,1,9942,,2/21/2020 19:32,,2,321,"

I don't understand a simple property of the outer product when doing density matrices. I am studying nielsen and chuang's book.

+ +

At equation 2.197 they do show the density matrix of the state of quantum teleportation before alice performs her measurements. +For +$$|\psi\rangle = \frac{1}{2}[|00\rangle(\alpha|0\rangle +\beta |1\rangle)+ |01\rangle(\alpha|1\rangle+\beta|0\rangle)+|10\rangle(\alpha|0\rangle -\beta |1\rangle) + |11\rangle(\alpha|1\rangle -\beta|0\rangle)]$$ +The density matrix is just: +$$\rho_1= \frac{1}{4}[|00\rangle \langle 00|(\alpha|0\rangle + \beta|1\rangle)(\alpha^*|0\rangle+\beta^*|1\rangle)+\\ +|01\rangle\langle01|(\alpha|1\rangle +\beta |0\rangle)(\alpha^*\langle1| +\beta^*\langle0|) +\\ +|10\rangle\langle10|(\alpha|0\rangle -\beta |1\rangle)(\alpha^*\langle 0|-\beta^*\langle1|) +\\ + |11\rangle\langle11|(\alpha|1\rangle -\beta|0\rangle)(\alpha^*\langle 1| -\beta^*\langle0|) +]$$

+ +

But in the example a couple of pages before, they present the density matrix of $|+\rangle$, which is:

+ +

$$\rho_2=\frac{1}{2} (|0\rangle+|1\rangle)(\langle0| + \langle 1|) $$ +Which it gets ""opened up"" as +$$\rho_2=\frac{1}{2} (|0\rangle\langle0|+ |0\rangle \langle1| + |1\rangle\langle0| + |1\rangle\langle1|) $$

+ +

So basically I don't understand why sometimes the outer product you have the cross terms $|0\rangle \langle1|$, and sometimes you dont: I would have expected to have 16 terms in the density matrix of the teleportation, or just 2 in the example of the maximally mixed state.

+ +

Specifically, I expect either $\rho_2$ to be (which I understand is plain wrong): +$$\rho_2 = \frac{1}{2}(|0\rangle\langle0| + |1\rangle\langle1|)$$ +or $\rho_1$ to be all the cross product terms: +$$\rho_1= \frac{1}{4}[|00\rangle \langle 00|(\alpha|0\rangle + |01\rangle(\alpha^*|1\rangle+\beta^*|0\rangle)+\\ +|01\rangle\langle01|(\alpha|0\rangle +\beta |1\rangle)(\alpha^*\langle0| +\beta^*\langle1|) +\\ +|10\rangle\langle10|(\alpha|0\rangle -\beta |1\rangle)(\alpha^*\langle 0|-\beta^*\langle1|) +\\ + |11\rangle\langle11|(\alpha|1\rangle -\beta|1\rangle)(\alpha^*\langle 1| -\beta^*\langle1|+\\ +|00\rangle \langle 01|(..)()..)+\\ +|00\rangle \langle 10|(..)()..)+\\ +|00\rangle \langle 11|(..)()..)+\\ +|01\rangle \langle 00|(..)()..)+\\ +|01\rangle \langle 10|(..)()..)+\\ +|01\rangle \langle 11|(..)()..)+\\ +etc.. +) +]$$

+ +

Can someone tell me what i don get about distributive property of outer products?

+",10062,,55,,2/23/2020 11:21,2/23/2020 11:21,Understanding the outer products in density matrices,,1,2,,,,CC BY-SA 4.0 +9940,1,,,2/22/2020 2:24,,3,273,"

I would like to know if there is a way to:

+ +
    +
  1. Implement Quantum 'Functions' e.g the QFT of QFT* containing several single-qubit operations?
  2. +
  3. Implement such operations on an arbitrary number of qubits and in the same vein implement work-qubits.
  4. +
+ +

Not looking as responsive as pyquil, however, I noticed in the Qiskit documentation that implementing a 'CircuitFactory' with the 'ABC' package seems to be the way to go. I would just appreciate insights from experienced hands. +Thank you kindly.

+",10141,,5955,,2/22/2020 14:28,6/18/2022 5:05,Implementing QFT,,1,3,,,,CC BY-SA 4.0 +9941,1,,,2/22/2020 4:07,,3,324,"

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 Eigenvalue - VQE approach - using quantum circuits. So far, what I have done, using tutorials I found, is as follows:

+ +

$H_{total} = H_1(\theta_1) + H_2(\theta_2) + H_3(\theta_3)$

+ +

I have been relying on simulating each term of the hamiltonian, the $H_i$, as separate circuits and measuring the expected values as $\theta_i$ changes.

+ +

However, as I have been told by my TA that one cannot simulate the hamiltonians separately to find the ground state.

+",6253,,6253,,2/22/2020 4:13,2/22/2020 4:13,"XX, YY, ZZ circuit representations?",,0,11,,,,CC BY-SA 4.0 +9942,2,,9939,2/22/2020 6:46,,2,,"

You're right, there should be 16 terms. But since they are tracing out Alice's system in the next step only 4 terms are relevant - those that correspond to $|00\rangle \langle 00|$, $|01\rangle \langle 01|$, $|10\rangle \langle 10|$ and $|11\rangle \langle 11|$. Tracing out $|00\rangle \langle 01|\cdot |\phi\rangle\langle\psi|$ will result in 0, because $\text{Tr}(|00\rangle \langle 01|)=\langle 01|00\rangle=0$.

+",5870,,,,,2/22/2020 6:46,,,,1,,,,CC BY-SA 4.0 +9943,1,9944,,2/22/2020 10:31,,2,459,"

I am trying to make a circuit for the randomly selected gates from a gate_list but I don't know how to put these selected gates in front of qr. statement. I don't know how to do this exactly is there any batter way to do this?

+ +
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
+from qiskit import Aer, execute
+import random
+
+n = 8
+gate_list = ['u1', 'u2', 'u3', 'id', 'x', 'y', 'z', 'h', 's'] 
+
+selected_gates= []
+
+for i in range(0,8):
+  x = random.choice(gates)
+  a = '({})'.format(i)
+  k = x+a
+  selected_gates.append(k)
+
+print(selected_gates)
+qr = QuantumCircuit(n)
+qr.selected_gates[0]
+qr.selected_gates[1]
+qr.selected_gates[2]
+qr.selected_gates[3]
+qr.selected_gates[4]
+qr.selected_gates[5]
+qr.selected_gates[6]
+qr.selected_gates[7]
+
+qr.draw()
+
+",8527,,,,,2/22/2020 12:14,How to make circuit for randomly selected gate?,,1,0,,,,CC BY-SA 4.0 +9944,2,,9943,2/22/2020 12:14,,4,,"

This is very similar to an function in terra random_circuit: https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/random/utils.py#L30-L113 It randomly picks gates from the list of all the standard gates in terra. For example, you can run something like:

+ + + +
from qiskit.circuit.random import random_circuit
+
+qr = random_circuit(10, 10, max_operands=3, measure=True)
+
+ +

Which will return a 10 qubit circuit of depth 10 with measurements at the end.

+ +

What this function is missing is an option to specify the list of gates to select from, but I think if you opened an issue about this no one would be opposed to adding that functionality in the future. But, regardless the implementation of that function shows how you would implement a version with your own list of gates, just make a local copy of the function and modify the lists https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/circuit/random/utils.py#L52-L59.

+",5529,,,,,2/22/2020 12:14,,,,2,,,,CC BY-SA 4.0 +9945,2,,9902,2/22/2020 14:04,,2,,"

Any scheme of back-in-time information transfer based on entangled particles runs up against the no-signalling theorem.

+ +

Initially it's not clear how you conclude that ""they do not need to compare their results with Victor, in order to distinguish between the cases when Victor entangles his photons or measures them independently.""

+ +

For example, in your scheme Victor could just as easily be light-years away from Alice and Bob. Rather than ""back in time"" information transfer, if Victor's actions could send signal to Alice/Bob, then he could transfer a bit to them faster than light, violating the no-signalling theorem.

+ +

Taking it a step further, consider $\alpha^2=1$. Then up to global phase your system is:

+ +

$$\vert\Psi\rangle_{1234}=\vert 0101\rangle,$$

+ +

Alice and Bob's qubits are:

+ +

$$\vert\Psi\rangle_{14}=\vert 01\rangle,$$

+ +

But Victor's qubits are:

+ +

$$\vert\Psi\rangle_{23}=\vert 10\rangle,$$

+ +

Victor can do anything he wants with his two qubits that are in the state $\vert 10\rangle$, but Alice/Bob's are already fixed to $\vert 01\rangle$.

+ +

Your Hilbert space only has dimension $2^4 = 16$ , which is not so bad to work out the amplitudes of each basis directly. Thus I recommend picking a Pythagorean triple for $\alpha$ and $\beta$, and working out for yourself all $16$ amplitudes for your state. From letting, say, $\alpha=\frac{12}{13}$ and $\beta=\frac{5}{13}$, you can calculate each amplitude and you should see that local operations on $\vert\Psi\rangle_{23}$ do not impact amplitudes on $\vert\Psi\rangle_{14}$.

+",2927,,2927,,3/4/2020 12:44,3/4/2020 12:44,,,,4,,,,CC BY-SA 4.0 +9946,1,9949,,2/22/2020 17:06,,1,146,"

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 :

+ +
qsubnodes = QuantumRegister(2)
+qsubnodes = QuantumRegister(2)
+qc.h(subnode[0])
+qc.h(subnode[1])
+
+ +

and then for the first Toffoli gate:

+ +
qc.ccx(subnode[0], subnode[1], *q) 
+
+ +

and the second toffoli gate (which is the issue) :

+ +
qc.h(subnode[0])
+qc.h(subnode[1])
+qc.x(subnode[1]) // to invert the coin to control for 0 (as shown in the circuit)
+qc.ccx(subnode[0], subnode[1], *q)
+
+ +

Is it the right way of inverting the coin for the second toffoli ?

+ +

Thank you,

+",10075,,9006,,2/22/2020 22:37,2/22/2020 22:45,Toffoli gates with Hadamard coins (QISKIT),,1,0,,,,CC BY-SA 4.0 +9947,1,,,2/22/2020 20:24,,2,135,"

I am writing to double check that if have a hamiltonian of the form $H = I_1 \otimes I_2$, when I seek to find the unitary, $e^{-i\gamma I_1 \otimes I_2}$, there really is no need to convert this into a circuit given that it's just measuring two non-interacting qubits (despite their tensor product)?

+ +

I ask this because what throws me off is the $\alpha$ factor which, in the case of $H = \frac{1}{2} (Z_1 \otimes Z_2)$ it becomes a $U \approx e^{-i\frac{\alpha}{2} Z_1 \otimes Z_2}$ which becomes the following circuit:

+ +

+ +

Provided this circuit, one question I have is, do I need an Ansatz on top of this unitary, or is this unitary the ansatz I need to represent the Ising coupling?

+ +

Thank you.

+",6253,,6253,,2/24/2020 17:36,2/24/2020 17:36,Circuit of a very trivial thing,,2,1,,,,CC BY-SA 4.0 +9948,1,,,2/22/2020 20:31,,1,66,"

I want to process some old data again. How do I load old data retrieved from IBM-Q into a new program? I've downloaded the relevant .json file, but I don't know how to use it like I would have a new data.

+",10146,,9006,,2/22/2020 22:51,2/22/2020 22:51,Loading old results for Data reprocessing,,0,4,,,,CC BY-SA 4.0 +9949,2,,9946,2/22/2020 22:45,,1,,"

According to your circuit diagram, the second Toffoli should act in case ""lower"" qubit is in state $|1\rangle$ and ""upper"" one in state $|0\rangle$. Since Toffoli acts only in case both inputs are in state $|1\rangle$, you have to invert ""upper"" qubit, or in other words to apply $X$ there.

+ +

So it seems that your construction is right. To test this, try to prepare circuit containing one Toffoli gate with $X$ applied on one of its input. Set a input of the circuit to $|01\rangle$ or $|10\rangle$ depending on which Toffoli's input is neggated and try to measure Toffoli's output; you should get $|1\rangle$.

+",9006,,,,,2/22/2020 22:45,,,,1,,,,CC BY-SA 4.0 +9950,2,,9947,2/23/2020 3:14,,2,,"

When $H = I_1 \otimes I_2$, $e^{-i\gamma I_1 \otimes I_2} = I_1 \otimes I_2$. Therefore, you don't have to apply any gates.

+ +

Your CNOT RZ CNOT circuit represents the time evolution of Ising coupling. +However, if you want to solve the Ising model problem by QAOA, you need ""mixing term"" like RX rotation. +Rigetti grove's document is very good to understanding QAOA.

+",9563,,,,,2/23/2020 3:14,,,,9,,,,CC BY-SA 4.0 +9951,1,9954,,2/23/2020 18:14,,9,2679,"

Would we need to create new algorithms that only work on quantum computers or would be simply edit codes in languages such as C++ to involve the new primitives from quantum computing? Are there things that can be programmed on a classical computer that can’t be programmed ona. Quantum computer? I know that quantum computer are turing complete.

+",,user10151,,user10151,2/23/2020 18:39,2/23/2020 18:58,Is there anything that can be programmed on a classical computer but not on a quantum computer?,,1,0,,,,CC BY-SA 4.0 +9952,1,,,2/23/2020 18:29,,3,169,"

I'm working on an open-source and open-hardware implementation of the KLM protocol, currently I'm working on EDA software that converts OpenQASM code into a manufacturable PCB

+ +

As part of that, I need to make a set of standardized components which requires creating a scalable architecture, etc. etc.

+ +

In a perfect world where every component I use works perfectly, timing and synchronization isn't an issue at all, but this is reality so I'm assuming there is a degree of accuracy needed to actually implement the KLM protocol.

+ +

I've devised a delay system using a laser that allows me to trigger my single photon sources at the same time and allows me to synchronize the production of a photon in controlled gates with the arrival of a photon at the gate, at least in theory, the reality is the electrical components (e.g. photodiodes, transistors, etc.) take time to actually do their job. Now, all of these components have known max times to do their job, usually rated in nanoseconds, so I can predict with a degree of accuracy how close the photons will be along a specific path.

+ +

So, for instance if I have 2 photons traveling towards a CX gate with two ancillary modes with a photon and a vacuum state, if the 3 photons enter the gate a few ns apart will the gate still work?

+ +

Maybe I'm overthinking this, but if I count the number of photons at my ancilla detectors and their values are what they should be even though it took an extra few ns for the photons to pass through, that means the gate worked right?

+ +

But what happens if one photon passes through the gate before the other even arrives at the gate? Surely this must mean the gate would fail, no? I guess I'm not understanding how the controlled gates actually work.

+ +

And so, my question is how do the controlled gates work, and what is an acceptable discrepancy of time between the photons (or how do I calculate it)? The max accuracy I can realize without going to silicon fabrication is down to a few picoseconds

+",7838,,,,,2/23/2020 18:29,Timing accuracy for the KLM protocol and how do controlled gates work?,,0,0,,,,CC BY-SA 4.0 +9953,2,,9891,2/23/2020 18:31,,4,,"

Okay, this is a rather subtle situation, but I think I've figured it out. The key is to be very careful about which mathematical results about Hermitian operators do and do not hold for generic operators. Let $H$ represent an arbitrary Hermitian matrix, $N$ an arbitrary normal one, $D$ be a generic diagonalizable matrix, and $M$ an arbitrary matrix, all acting on an $n$-dimensional Hilbert space.

+ +

Subtlety 1: For normal $N$, the numerical range +$$\left \{ \frac{\langle \psi | N | \psi \rangle}{\langle \psi|\psi\rangle} \right \}$$ +for all nonzero $\psi$ in the Hilbert space is the convex hull of the eigenvalues of $N$. (So for $H$ Hermitian, it's the real interval $[\min \lambda, \max \lambda]$.) For generic $M$, the numerical range is still convex and contains the eigenvalues, but is not necessarily a hull for them.

+ +

Subtlety 2: Therefore, there are two definitions of ""positive (semi-)definite"" that are equivalent for Hermitian $H$ but not for generic $M$:

+ +

PD1: A matrix is positive (semi-)definite (PD1) if all of its eigenvalues are positive (nonnegative real).

+ +

PD2: A matrix $M$ is positive (semi-)definite (PD2) if $\langle \psi | M | \psi \rangle > (\geq)\ 0$ for all nonzero $|\psi\rangle$ in the Hilbert space.

+ +

PD1 and PD2 are equivalent for Hermitian $H$, but PD2 (which I think is the ""real"" meaning of positive-definite) is strictly stronger for generic $M$. See here for an example of a non-Hermitian $M$ that satisfies PD1 but not PD2.

+ +

Subtlety 3: There are two inequivalent definitions of a square root of a matrix.

+ +

SR1: $R$ is a square root (SR1) of a generic matrix $M$ if $R^2 = M$. Under this definition, a matrix has a finite number of square roots (e.g. $2^n$ if its eigenvalues are all distinct). This definition makes sense for any matrix. I'm not sure whether or not there's generically a natural choice of ""principal"" square root in this situation (e.g. if $M$ is defective), so the notation $\sqrt{M}$ is not (as far as I know) well defined.

+ +

SR2: $R$ is a square root (SR2) of a positive definite Hermitian matrix $P$ if $R^\dagger R = P$. (Since $P$ is Hermitian, we don't need to specify whether we mean PD1 or PD2 for ""positive definite"".) Under this definition, the set of square roots of a matrix $P$ is isomorphic to the Lie group $U(n)$, because if $R_1$ is a square root of $P$, then $R_2$ is a square root of $P$ iff $R_2 = U R_1$ for some unitary matrix $U$. $R$ is not necessarily Hermitian. But under this definition, we can define the natural ""principal"" square root of $P$, which we denote by $L = \sqrt{P}$, as the unique square root that is also Hermitian and positive (semi-)definite (again, no need to distinguish PD1 from PD2 here).

+ +

Since the principal square root $L$ is Hermitian by definition, it respects both definitions SR1 and SR2, as $L^\dagger L = L^2 = P$. But a generic square root (SR1) of $P$ will not be a square root (SR2) of $P$ or vice versa.

+ +

For a Hermitian $H$, the usual power series expansion of the square root function +$$\sum_{n=0}^\infty \frac{(-1)^n (2n)!}{(1-2n)(n!)^2 4^n} (H - I)^n$$ +will converge to $\sqrt{H}$ iff all the eigenvalues of $H$ lie in the interval $[0,2]$. For a generic diagonalizable matrix $D$, this series will converge to a square root of $D$ iff all of the eigenvalues of $D$ lie in the disk in the complex plane that has that interval as a diameter. (If I recall correctly, the boundary points 0 and 2 are included, but the boundary points with nonzero imaginary part are all excluded.)

+ +

Subtlety 4: If either of two generic matrices $A$ or $B$ is invertible, then $AB$ and $BA$ are similar, but if both $A$ and $B$ are singular, then $AB$ and $BA$ are not necessarily similar (see here for a counterexample). But even in this case, $AB$ and $BA$ always have the same eigenvalues and in fact characteristic polynomials, so (for example) their traces and regions of convergence for any formal power series will be the same.

+ +

Subtlety 5: If we have two Hermitian positive-definite matrices $P_1$ and $P_2$, then their non-Hermitian product $P_1 P_2$ will satisfy PD1 but not necessarily PD2 (see the first link above for a counterexample), so it may or may not necessarily be ""positive definite"", depending on your definition.

+ +

Now we can finally try to answer my question. The standard definition of the fidelity is unambiguous, because only Hermitian positive-semidefinite operators are ever getting square rooted. Since $\rho \sigma$ is non-Hermitian, its numerical range is generically complex and it does not satisfy PD2. Moreover, we can't talk about its square roots using definition SR2. And generically, the notation $\sqrt{M}$ may not be meaningful for a non-Hermitian $M$ because it implies some natural principal branch.

+ +

But we can talk about the square roots (plural) of $\rho \sigma$ under definition SR1, as with any matrix. Moreover, $\rho \sigma$ is a highly non-generic matrix. It satisfies PD1 by Subtlety 5. In fact, by Subtlety 4, $\rho \sigma$ has the same characteristic polynomial (with all roots lying in $[0,1]$) as $\sqrt{\rho} \sigma \sqrt{\rho}$. So because the eigenvalues all lie in this interval (which is obviously not generically true), there is a natural choice of principal square root: the one given by the usual power series expansion above, which is guaranteed to converge in light of its eigenvalue spectrum. So in this particular case, we can get away with defining $\sqrt{\rho \sigma}$ by the formal power series above. Then by the logic outlined in my question, we can indeed cycle the operators inside the square root and always get the right answer.

+ +

TLDR: The expression $\sqrt{M}$ is not uniquely defined for a generic matrix $M$ that is not Hermitian and positive semidefinite. But in this case, the special properties of the matrix $\rho \sigma$ guarantee that the formal power series above converges, so we can use that power series to (non-conventionally) define $\sqrt{\rho \sigma}$. If we use that convention, then we will indeed always get the same answer as the traditional definition. However, this is a bit of a hack, and the traditional definition's meaning is clear without needing to make any additional implicit definitions.

+",551,,551,,2/24/2020 13:20,2/24/2020 13:20,,,,4,,,,CC BY-SA 4.0 +9954,2,,9951,2/23/2020 18:58,,12,,"

Short answer: no. Any classical algorithm can be transformed into quantum algorithm. This result has little practical value, because you don't obtain quantum speedup, but it is important from theoretical point of view.

+",2105,,,,,2/23/2020 18:58,,,,8,,,,CC BY-SA 4.0 +9956,1,,,2/23/2020 19:58,,3,154,"

I cannot understand the proof of Lemma 5 from the paper ""Resources Required for Preparing Graph States"". Here it is:

+ +

+ +

(In this paper, $|G:S\rangle$ denotes $Z_S$ applied to the graph state $|G\rangle$, and the $/$ symbol denotes contraction of an edge.)

+ +

I have two questions

+ +

1) Why is the operator $Z_{v^{\prime\prime}}^k$ inside the big brackets necessary? Since $v^{\prime\prime}$ is not present in the graph $G/vv^\prime/v^\prime v^{\prime\prime}$, does this operator not just cancel out with the one inside the term $(|0\rangle +Z_{v^{\prime\prime}}^k|1\rangle)_{v^{\prime\prime}}$ ?

+ +

2) What is special about having $v^\prime$ and $v^{\prime\prime}$ here? If we had no $v^{\prime\prime}$ vertex, and the vertex $v^\prime$ attached directly to $R$ (see figure 1), would this same argument not work?

+",6118,,,,,12/15/2020 9:58,$X$ measurement on graph state leads to edge contraction,,2,0,,,,CC BY-SA 4.0 +9957,1,9958,,2/23/2020 21:43,,1,336,"

When I run:

+ +
from qiskit import QISKitError
+
+ +

I get the error:

+ +
ImportError: cannot import name 'QISKitError'
+
+ +

I need QISKitError for exception handling with my program. Did IBMQ recently update this import?

+",5747,,55,,2/24/2020 10:42,2/24/2020 10:42,IBMQ: `from qiskit import QISKitError` gives 'cannot import name QISKitError',,1,0,,,,CC BY-SA 4.0 +9958,2,,9957,2/23/2020 22:26,,3,,"

This has been moved to from qiskit.exceptions import QiskitError

+",5955,,,,,2/23/2020 22:26,,,,0,,,,CC BY-SA 4.0 +9959,1,,,2/23/2020 22:34,,3,775,"

Is there a way to look up the clock speed for the different computers?

+",10154,,9006,,2/23/2020 22:40,2/24/2020 18:25,The Clock Speed for the Quantum Computers,,1,0,,,,CC BY-SA 4.0 +9960,2,,9959,2/24/2020 5:45,,4,,"

The clock time (speed) for a quantum computer would be related to the T1 relaxation times (1/T1 rate) of the specific qubits and their architecture. The T1 relaxation time is essentially the time it takes for the qubit to return to an equilibrium and to be in the position to re-initialize.

+ +

While T2 and the gate time tells you how many operations you can perform in the given T1 clock cycle.

+",9579,,9579,,2/24/2020 18:25,2/24/2020 18:25,,,,1,,,,CC BY-SA 4.0 +9961,1,,,2/24/2020 6:35,,1,98,"

I would like to ask, how can I add my own .csv data file to run a quantum support vector machine using qiskit ? I don't want to use already existing datasets in sklearn, scikit-learn library.

+",10156,,55,,8/20/2020 8:08,8/20/2020 8:08,Regarding quantum support vector machine using qiskit,,0,8,,2/27/2020 14:55,,CC BY-SA 4.0 +9962,1,,,2/24/2020 8:23,,3,184,"

I'm trying to become familiar with manipulation of the Dirac notation. +I want to be able to compute quickly the final states obtained in a small circuit. +Typically, it should include 2 to 5 qubits, and be composed of some 2-qubit controlled gates (essentially CNOT but others would be good too), +rotation, hadamard, paulis, and other basic gates. It should not contain too many gates either so I don't spend 4 hours computing it. +Once computed the final state I want also to be able to give quickly the results of the measure of one of the qubits, +probability and state after measurement.

+ +

Do you know any exercises with solutions of the computation of circuits ? +Where can I find them ?

+",10065,,5955,,2/24/2020 8:50,2/24/2020 9:49,Exercises on computing by hand quantum circuits,,1,0,,,,CC BY-SA 4.0 +9963,2,,9962,2/24/2020 9:49,,3,,"

You can use Quirk to do this. It allows you to do all of the things you mention, using the four types of displays available.

+ +

Another option is to look up problem sets from a course.

+",9282,,,,,2/24/2020 9:49,,,,3,,,,CC BY-SA 4.0 +9964,2,,9947,2/24/2020 12:05,,2,,"

Remember that we can expand +$$ +e^{i\gamma(Z\otimes Z)}=I\cos\gamma+i(Z\otimes Z)\sin(\gamma). +$$ +Let's call this $U$. If I calculate +$$ +U|+\rangle|+\rangle=\cos\gamma|+\rangle|+\rangle+i\sin\gamma|-\rangle|-\rangle. +$$ +For most vales of $\gamma$, this state is entangled (indeed, for $\gamma=\pi/4$, you essentially have a Bell state in the Hadamard basis). So your statement ""given that it's just measuring two non-interacting qubits"" is false. The qubits are interacting.

+ +

For a point of comparison, perhaps you are thinking of a Hamiltonian $H=\gamma(I\otimes Z+Z\otimes I)$, because in this case, you have +$$ +e^{iH}=e^{i\gamma Z}\otimes e^{i\gamma Z}, +$$ +which is maybe what you thought was happening above?

+ +

The circuit that you show is what you need for an Ising interaction between two qubits. I'm not sure what ""Ansatz"" you could be referring to?

+",1837,,,,,2/24/2020 12:05,,,,5,,,,CC BY-SA 4.0 +9965,2,,9576,2/24/2020 14:30,,1,,"

There are many Qiskit notebooks on quatum computers application in different areas, including finance, in IBM Q web interface.

+ +

For application in finance, click on icon Qiskit Notebooks, then folder Advanced -> Aqua -> Finance.

+ +

Here is also website dedicated to quantum computing application in finance: Quantum for Quants.

+",9006,,9006,,2/27/2020 13:25,2/27/2020 13:25,,,,0,,,,CC BY-SA 4.0 +9966,1,9972,,2/24/2020 14:36,,3,354,"

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 duplication in the figure). Is it a valid circuit? If not why it is not?. Why am I getting error? (My target backend is ibmq_16_melbourne).

+ +

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+qreg q[8];
+qreg qGrp1[8];
+creg c[2];
+creg cGrp1[2];
+
+
+h q[2];
+h q[4];
+h q[6];
+x q[7];
+x qGrp1[1];
+h qGrp1[2];
+h qGrp1[4];
+h qGrp1[6];
+x qGrp1[7];
+cx q[2],q[3];
+cx q[4],q[5];
+cx q[6],q[7];
+cx qGrp1[2],qGrp1[3];
+cx qGrp1[4],qGrp1[5];
+cx qGrp1[6],qGrp1[7];
+ccx q[6],q[0],q[4];
+ccx qGrp1[6],qGrp1[0],qGrp1[4];
+ccx q[7],q[1],q[5];
+ccx qGrp1[7],qGrp1[1],qGrp1[5];
+x q[6];
+x q[7];
+x qGrp1[6];
+x qGrp1[7];
+ccx q[6],q[0],q[2];
+ccx qGrp1[6],qGrp1[0],qGrp1[2];
+ccx q[7],q[1],q[3];
+ccx qGrp1[7],qGrp1[1],qGrp1[3];
+cx q[2],q[3];
+cx q[4],q[5];
+cx qGrp1[2],qGrp1[3];
+cx qGrp1[4],qGrp1[5];
+
+measure q[3] -> c[0];
+measure q[5] -> c[1];
+measure qGrp1[3] -> cGrp1[0];
+measure qGrp1[5] -> cGrp1[1];
+
+",8620,,55,,2/25/2020 11:42,2/25/2020 11:42,Why I am getting transpilation error while executing the following IBM Quantum Experience code?,,1,8,,,,CC BY-SA 4.0 +9967,1,9968,,2/24/2020 15:24,,4,866,"

I am new to python programming and Qiskit. I would like to ask can we use sklearn for adding external .csv data file before Qiskit libraries, or without sklearn, we can do or is there any other Qiskit library to add any external .csv file, to run the python code of quantum support vector machine?

+ +

How I can use .csv data file with Qiskit libraries to run quantum SVM ?

+ +

I am following the code written below, where I should put my own .csv data file

+ +
import numpy as np
+from dataset import breast_cancer
+from sklearn.datasets.samples_generator import make_blobs
+from qiskit.aqua.utils import split_dataset_to_data_and_labels 
+from sklearn import svm
+from utils import svm_utils 
+from matplotlib import pyplot as plt
+#matplotlib inline
+#load_ext autoreload
+#autoreload 2   % Breast Cancer dataset
+
+n = 2 # number of principal components kept
+training_dataset_size = 20
+testing_dataset_size = 10
+
+sample_Total, training_input, test_input, class_labels = breast_cancer(training_dataset_size, testing_dataset_size, n)
+
+data_train, _ = split_dataset_to_data_and_labels(training_input)
+data_test, _ = split_dataset_to_data_and_labels(test_input)  # %%Breast Cancer dataset
+
+##%% Linear Support vector machine
+# We use the function of scikit learn to generate linearly separable blobs
+centers = [(2.5,0),(0,2.5)]
+x, y = make_blobs(n_samples=100, centers=centers, n_features=2,random_state=0,cluster_std=0.5)
+
+
+fig,ax=plt.subplots(1,2,figsize=(10,5))
+
+
+ax[0].scatter(data_train[0][:,0],data_train[0][:,1],c=data_train[1])
+ax[0].set_title('Breast Cancer dataset');
+
+ax[1].scatter(x[:,0],x[:,1],c=y)
+ax[1].set_title('Blobs linearly separable');
+
+##%% Hands-on session on support vector machine
+
+plt.scatter(data_train[0][:,0],data_train[0][:,1],c=data_train[1])
+plt.title('Breast Cancer dataset');
+
+model= svm.LinearSVC()
+model.fit(data_train[0], data_train[1])
+accuracy_train = model.score(data_train[0], data_train[1])
+accuracy_test = model.score(data_test[0], data_test[1])
+
+
+X0, X1 = data_train[0][:, 0], data_train[0][:, 1]
+xx, yy = svm_utils.make_meshgrid(X0, X1)
+Z = model.predict(np.c_[xx.ravel(), yy.ravel()])
+Z = Z.reshape(xx.shape)
+
+fig,ax=plt.subplots(1,2,figsize=(15,5))
+ax[0].contourf(xx, yy, Z, cmap=plt.cm.coolwarm)
+ax[0].scatter(data_train[0][:,0], data_train[0][:,1], c=data_train[1])
+ax[0].set_title('Accuracy on the training set: '+str(accuracy_train));
+
+ax[1].contourf(xx, yy, Z, cmap=plt.cm.coolwarm)
+ax[1].scatter(data_test[0][:,0], data_test[0][:,1], c=data_test[1])
+ax[1].set_title('Accuracy on the test set: '+str(accuracy_test));
+
+##%% We now implement a SVM with gaussian kernel
+clf = svm.SVC(gamma = 'scale')
+clf.fit(data_train[0], data_train[1]);
+accuracy_train = clf.score(data_train[0], data_train[1])
+accuracy_test = clf.score(data_test[0], data_test[1])
+
+
+X0, X1 = data_train[0][:, 0], data_train[0][:, 1]
+xx, yy = svm_utils.make_meshgrid(X0, X1)
+Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])
+Z = Z.reshape(xx.shape)
+
+fig,ax=plt.subplots(1,2,figsize=(15,5))
+ax[0].contourf(xx, yy, Z, cmap=plt.cm.coolwarm)
+ax[0].scatter(data_train[0][:,0], data_train[0][:,1], c=data_train[1])
+ax[0].set_title('Accuracy on the training set: '+str(accuracy_train));
+
+ax[1].contourf(xx, yy, Z, cmap=plt.cm.coolwarm)
+ax[1].scatter(data_test[0][:,0], data_test[0][:,1], c=data_test[1])
+ax[1].set_title('Accuracy on the test set: '+str(accuracy_test));
+
+##%% First steps in Qiskit
+import qiskit as qk
+
+# Creating Qubits
+q = qk.QuantumRegister(2)
+# Creating Classical Bits
+c = qk.ClassicalRegister(2)
+
+##%% Define and print empty circuit
+circuit = qk.QuantumCircuit(q, c)
+print(circuit)
+
+##%%% Add gates to the qubits
+# Initialize empty circuit
+circuit = qk.QuantumCircuit(q, c)
+# Hadamard Gate on the first Qubit
+circuit.h(q[0])
+# CNOT Gate on the first and second Qubits
+circuit.cx(q[0], q[1])
+# Measuring the Qubits
+circuit.measure(q, c)
+print (circuit)
+
+##%% Run the circuit on the quantum simulator
+# Using Qiskit Aer's Qasm Simulator: Define where do you want to run the simulation.
+simulator = qk.BasicAer.get_backend('qasm_simulator')
+
+# Simulating the circuit using the simulator to get the result
+job = qk.execute(circuit, simulator, shots=100)
+result = job.result()
+
+# Getting the aggregated binary outcomes of the circuit.
+counts = result.get_counts(circuit)
+print (counts)
+
+from qiskit.aqua.components.feature_maps import SecondOrderExpansion
+
+feature_map = SecondOrderExpansion(feature_dimension=2, 
+                                   depth=1)
+
+##%%Print the feature map circuit
+x = np.array([0.6, 0.3])
+print(feature_map.construct_circuit(x))
+
+##%%% QSVM Algorithm
+from qiskit.aqua.algorithms import QSVM
+
+qsvm = QSVM(feature_map, training_input, test_input)
+
+##%% Run QSVM
+from qiskit.aqua import run_algorithm, QuantumInstance
+from qiskit import BasicAer
+
+backend = BasicAer.get_backend('qasm_simulator')
+quantum_instance = QuantumInstance(backend, shots=1024, seed_simulator=10598, seed_transpiler=10598)
+
+result = qsvm.run(quantum_instance)
+
+##%%% Analyze output
+plt.scatter(training_input['Benign'][:,0], training_input['Benign'][:,1])
+plt.scatter(training_input['Malignant'][:,0], training_input['Malignant'][:,1])
+plt.show()
+length_data = len(training_input['Benign']) + len(training_input['Malignant'])
+print(""size training set: {}"".format(length_data))
+print(""Matrix dimension: {}"".format(result['kernel_matrix_training'].shape))
+
+print(""testing success ratio: "", result['testing_accuracy'])
+
+test_set = np.concatenate((test_input['Benign'], test_input['Malignant']))
+y_test = qsvm.predict(test_set, quantum_instance)
+
+##%% And here we plot the results. The first plot shows the label predictions of the QSVM and the second plot shows the test labels.
+plt.scatter(test_set[:, 0], test_set[:,1], c=y_test)
+plt.show()
+
+plt.scatter(test_input['Benign'][:,0], test_input['Benign'][:,1])
+plt.scatter(test_input['Malignant'][:,0], test_input['Malignant'][:,1])
+plt.show()
+
+
+",10156,,55,,2/25/2020 11:42,1/20/2021 10:49,How to use external .csv data file in quantum support vector machine qiskit python code?,,1,1,,,,CC BY-SA 4.0 +9968,2,,9967,2/24/2020 15:37,,5,,"

I have previously used this function to load a custom data set - it should still work but I haven't tried it with more recent releases of Aqua

+ + + +
def userDefinedData(location, file, class_labels,training_size, test_size, n=2, PLOT_DATA=True):
+
+
+    data, target, target_names = load_data(location, file)
+    # sample_train is of the same form as data
+    sample_train, sample_test, label_train, label_test = train_test_split(
+        data, target,test_size=0.25, train_size=0.75 ,random_state=22)
+
+
+    # Now we standarize for gaussian around 0 with unit variance
+    std_scale = StandardScaler().fit(sample_train)
+    sample_train = std_scale.transform(sample_train)
+    sample_test = std_scale.transform(sample_test)
+
+
+    # Now reduce number of features to number of qubits
+    pca = PCA(n_components=n).fit(sample_train)
+    sample_train = pca.transform(sample_train)
+    sample_test = pca.transform(sample_test)
+
+
+    # Samples are pairs of points
+    samples = np.append(sample_train, sample_test, axis=0)
+    minmax_scale = MinMaxScaler((-1, 1)).fit(samples)
+    sample_train = minmax_scale.transform(sample_train)
+    sample_test = minmax_scale.transform(sample_test)
+
+
+    # If class labels are numeric
+    if class_labels[0].isdigit():
+        # Pick training size number of samples from each distro
+        training_input = {key: (sample_train[label_train == int(key), :])[:training_size] for k, key in enumerate(class_labels)}
+        test_input = {key: (sample_test[label_test == int(key), :])[: test_size] for k, key in enumerate(class_labels)}
+
+    else:
+        # if they aren't
+        training_input = {key: (sample_train[label_train == k, :])[:training_size] for k, key in
+                         enumerate(class_labels)}
+        test_input = {key: (sample_train[label_train == k, :])[training_size:(
+                training_size + test_size)] for k, key in enumerate(class_labels)}
+
+
+
+    if PLOT_DATA:
+        for k in range(0, 9):
+            plt.scatter(sample_train[label_train == k, 0][:training_size],
+                        sample_train[label_train == k, 1][:training_size])
+
+        plt.title(""PCA dim. reduced user dataset"")
+        plt.show()
+
+    return sample_train, training_input, test_input, class_labels
+
+
+",5955,,5955,,2/24/2020 15:42,2/24/2020 15:42,,,,3,,,,CC BY-SA 4.0 +9969,1,9979,,2/24/2020 15:53,,1,62,"

I'm trying to compute the state of a particular circuit using Dirac notation but I get stuck after a while .. you can find the circuit there. +The numerical coefficients do not matter and I want to compute it for any rotation parameter. +So far here's what I've done :

+ +

Computing the three states after rotation :

+ +

$R_X(\theta_1) |0⟩ = |\phi_1⟩= \cos(\frac{\theta_1}{2})|0⟩ - i \sin(\frac{\theta_1}{2}) |1⟩$

+ +

$R_Y(\theta_2) |0⟩ = |\phi_2⟩ = \cos(\frac{\theta_2}{2}) |0⟩ + \sin(\frac{\theta_2}{2}) |1⟩$

+ +

$R_Y(\theta_3) |0⟩ = |\phi_3⟩ = \cos(\frac{\theta_3}{2}) |0⟩ + \sin(\frac{\theta_3}{2}) |1⟩$

+ +

I then compute the joint state $|\phi_1 \phi_2⟩$ :

+ +

$|\phi_1 \phi_2⟩ = (\cos(\frac{\theta_1}{2}) |0⟩ - i \sin(\frac{\theta_1}{2}) |1⟩) \otimes (\cos(\frac{\theta_2}{2}) |0⟩ + \sin(\frac{\theta_2}{2}) |1⟩)$

+ +

$ = \cos(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) |00⟩ + \cos(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2}) |01⟩ - i \sin(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) |10⟩ - i \sin(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2}) |11⟩ $

+ +

I then compute the CNOT gate with control $|\phi_1⟩$ and target $|\phi_2⟩$ :

+ +

$ CNOT(|\phi_1 \phi_2⟩) = \cos(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) |00⟩ + \cos(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2}) |01⟩ - i \sin(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) |11⟩ - i \sin(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2}) |10⟩ $

+ +

But then I'm not sure how to compute the last CNOT gate.. I could do it using matrix computation but the whole point is being able to do this kind of computation quickly by hand.

+",10065,,10065,,2/24/2020 19:06,2/24/2020 23:56,computing a quantum circuit by hand (CNOT on non-computational basis states),,1,0,,,,CC BY-SA 4.0 +9970,1,9971,,2/24/2020 15:58,,4,76,"

Do quantum computers only offer some computational benefit or advantage for complicated algorithms or would simple ordinary least squares solving or computing the maximum likelihood estimates or Newton Raphson also benefit?

+ +

Would Monte Carlo methods or Bayesian simulation based methods or Gibbs sampling be improved?

+",,user10151,,,,2/25/2020 5:49,Would quantum computers improve solving statistical regression problems or neural networks?,,2,0,,,,CC BY-SA 4.0 +9971,2,,9970,2/24/2020 16:15,,4,,"

We can expect that quantum computers will provide a significant advantage in various machine learning classic algorithms, and theoretical results for some of them are already here. For example, the quantum EM algorithm for mixture of gaussian has been studied and the complexity of the computation is given In the article Quantum Expectation-Maximization Algorithm written by Hideyuki Miyahara (first author). Their main result is that the algorithm is exponentially faster in the number of sample than it's classical counterpart.

+",10065,,,,,2/24/2020 16:15,,,,2,,,,CC BY-SA 4.0 +9972,2,,9966,2/24/2020 16:21,,5,,"

Your circuit looks fine, but it has 16 qubits, and the largest IBM public backend currently has 15 qubits (note that Melbourne has 16 but one of the qubits is off right now). So in order to run it, you need a larger backend. The 20+ qubit hardware is currently accessible by IBMQ Network institution members.

+ +

But if you just want to play around you can simulate your circuit under realistic noise models and see how transpilation changes the circuit. For this you can use the ""fake"" backends in Qiskit. For example:

+ +
from qiskit.test.mock import FakeAlmaden
+backend = FakeAlmaden()
+
+# you can see how this differs from original circuit and can plan
+# with some transpilation options
+new_circuit = transpile(circuit, backend) 
+
+ +

And then you can refer to this tutorial on how to simulate this backend. Almaden is a 20-qubit backend. +https://github.com/Qiskit/qiskit-iqx-tutorials/blob/09ea113fdeb340f4f2d71c862126ee35a676b754/qiskit/advanced/aer/2_device_noise_simulation.ipynb

+",2503,,,,,2/24/2020 16:21,,,,0,,,,CC BY-SA 4.0 +9974,1,,,2/24/2020 17:03,,2,344,"

I try to optimise a quantity via an SDP. I optimise over all PPT measurement operators and hence have the constraints $\Pi_k^{T_B} \succeq 0$ (PPT) for my measurement operators.

+ +

The part of the code where I define the SDP and constraints is:

+ + + +
[...]
+
+# Defining the SDP
+p = pic.Problem()
+pic.new_param(""rho_0"", rho_0)
+pic.new_param(""rho_1"", rho_1)
+pic.new_param(""rho_2"", rho_2)
+
+# Measurement operators
+P_0 = p.add_variable(""P_0"", (9,9), ""hermitian"")
+P_1 = p.add_variable(""P_1"", (9,9), ""hermitian"")
+P_2 = p.add_variable(""P_2"", (9,9), ""hermitian"")
+P_inc = p.add_variable(""P_inc"", (9,9), ""hermitian"")
+
+# Partial transposes
+p.add_constraint(PT_B(P_0, 3, 3) >> 0)
+p.add_constraint(PT_B(P_1, 3, 3) >> 0)
+p.add_constraint(PT_B(P_2, 3, 3) >> 0)
+p.add_constraint(PT_B(P_inc, 3, 3) >> 0)
+
+[...]
+
+ +

where PT_B is a function implementing the partial transpose, i.e.

+ + + +
def PT_B(M, d1, d2):
+    """"""
+    Partial Transpose map of M
+    Input: Matrix M, Dimension d1 of subsystem 1, Dimension d2 of subsystem 2
+    Output: Partial Transpose M_TB
+    """"""
+    assert M.shape == (d1 * d2, d1 * d2)
+
+    # Reshape into 4 tensor
+    M = M.reshape(d1, d2, d1, d2)
+
+    # Transpose 2nd system
+    M = M.transpose((0, 3, 2, 1))
+
+    # Reshape back into a density matrix
+    return M.reshape(d1 * d2, d1 * d2)
+
+ +

However, Picos doesn't let me manipulate the variable expressions. I also tried to implement the partial transpose by setting the elements of a new variable by hand to the elements of $\Pi_k^{T_B}$. But then Picos tells me that I can't slice variable expressions.

+ +

The error message for the above SDP code snippet I get is:

+ + + +
---------------------------------------------------------------------------
+AttributeError                            Traceback (most recent call last)
+<ipython-input-38-36083f3fb159> in <module>
+     12 
+     13 # Partial transposes
+---> 14 p.add_constraint(PT_B(P_0, 3, 3) >> 0)
+     15 p.add_constraint(PT_B(P_1, 3, 3) >> 0)
+     16 p.add_constraint(PT_B(P_2, 3, 3) >> 0)
+
+<ipython-input-34-2327f6ca6850> in PT_B(M, d1, d2)
+      5     Output: Partial Transpose M_TB
+      6     """"""
+----> 7     assert M.shape == (d1 * d2, d1 * d2)
+      8 
+      9     # Reshape into 4 tensor
+
+AttributeError: 'Variable' object has no attribute 'shape'
+
+ +

If I try to force the variable expression into an np.array:

+ + + +
[...]
+
+# Partial transposes
+p.add_constraint(PT_B(np.array(P_0), 3, 3) >> 0)
+p.add_constraint(PT_B(np.array(P_1), 3, 3) >> 0)
+p.add_constraint(PT_B(np.array(P_2), 3, 3) >> 0)
+p.add_constraint(PT_B(np.array(P_inc), 3, 3) >> 0)
+
+[...]
+
+ +

Then I get the error message:

+ + + +
---------------------------------------------------------------------------
+TypeError                                 Traceback (most recent call last)
+<ipython-input-39-c6e549dceb23> in <module>
+     12 
+     13 # Partial transposes
+---> 14 p.add_constraint(PT_B(np.array(P_0), 3, 3) >> 0)
+     15 p.add_constraint(PT_B(P_1, 3, 3) >> 0)
+     16 p.add_constraint(PT_B(P_2, 3, 3) >> 0)
+
+/usr/local/lib/python3.7/site-packages/picos/expressions.py in __getitem__(self, index)
+   3973         JJ = rangeT
+   3974         VV = [1.] * nsz
+-> 3975         newfacs = {self: spmatrix(VV, II, JJ, (nsz, sz))}
+   3976         if not self.constant is None:
+   3977             newcons = self.constant[rangeT]
+
+/usr/local/lib/python3.7/site-packages/picos/tools.py in spmatrix(*args, **kwargs)
+   2187     """"""
+   2188     try:
+-> 2189         return cvx.spmatrix(*args, **kwargs)
+   2190     except TypeError as error:
+   2191         # CVXOPT does not like NumPy's int64 scalar type for indices, so attempt
+
+TypeError: dimension too small
+
+ +

Does anyone have an idea how to implement the PPT constraint in the SDP in Python?

+ +

Mathematica doesn't allow complex matrix SDPs, and Picos and CVXPY give me a hard time implementing the PPT constraint.

+ +

Thanks for any suggestions!

+",8458,,10480,,3/9/2021 18:46,3/9/2021 18:46,"How can I implement partial transpose on a variable in Picos (Python, trying to solve an SDP)?",,0,1,,,,CC BY-SA 4.0 +9975,1,9977,,2/24/2020 17:10,,3,399,"

Besides machine learning, quantum info theory, optimization, and statistics knowledge, what are the prerequisites to implement existing ML techniques and create new ML techniques that would work on a quantum computer and be optimized to take full advantage of quantum computing’s efficiencies? What courses does one need to take? I don’t mean simulating quantum computers on a classical computers. I mean actually doing ML or Statistics or Topological data analysis on a trapped ion quantum computer.

+",,user10151,,user10151,2/24/2020 17:15,2/24/2020 18:49,What are the mathematical prerequisites to study machine learning on quantum computers?,,1,0,,,,CC BY-SA 4.0 +9976,1,9982,,2/24/2020 18:47,,1,110,"

Will quantum computers be able to pass the Turing test sooner than classical computers?

+",,user10151,,,,2/25/2020 8:37,Will quantum computers pass the Turing test?,,1,0,,2/25/2020 13:00,,CC BY-SA 4.0 +9977,2,,9975,2/24/2020 18:49,,2,,"

Quantum Machine Learning (QML) is both young and highly cross-disciplinary, meaning that it will be hard to find courses in specific disciplines (math, physics, computer science, etc) that provide background tailored to the subject.

+ +

One way to approach the field is to work backwards, by first choosing a specific type of algorithm that's currently popular and then find out what tools you need to understand whats going on. The background required to work with QAOA/quantum annealing/adiabatic algorithms is different than that required to work with qRAM-related things like HHL, qPCA (dequantized!), and working on any of those algorithms in a theoretical sense is very different than running on real hardware and interpreting the results.

+ +

A couple of questions that might help you narrow your interests are:

+ + + +

If after deciding on a more specific QML approach you are still unsure of the kind of background necessary, come back and ask questions about that problem/algorithm and you'll have an easier time finding specific answers.

+",1939,,,,,2/24/2020 18:49,,,,0,,,,CC BY-SA 4.0 +9978,1,,,2/24/2020 18:57,,6,159,"

In this paper, in Appendix B.1 (Grover's Search Algorithm and Grover Operator G), it does a change of coefficients, such as what is done for the Bloch Sphere, but for a many qubits system using only two vectors.

+ +

Firstly, it separates the uniform superposition

+ +

$$|{\psi}\rangle = \frac{1}{\sqrt{N}}\sum_{x=0}^{N-1}{|x\rangle} $$

+ +

in two desired states (based on Oracle ""responses"")

+ +

$$ |\psi\rangle = \sqrt{\frac{M}{N}}|\chi\rangle + \sqrt{\frac{N-M}{N}}|\xi\rangle$$

+ +

with

+ +

$$ +|\chi\rangle = \frac{1}{\sqrt{M}}\sum_{x,f(x)=1}{|x\rangle} \quad,\quad +|\xi\rangle = \frac{1}{\sqrt{N-M}}\sum_{x,f(x)=0}{|x\rangle} +$$

+ +

where $N=2^n$ (with n being the number of qubits) and $M$ is the number of Maximal Cliques, in this case the number of states which $f(x)=1$, the states which would be flipped by the Oracle.

+ +

Then it changes the coefficients of each summation to trigonometric ones as follows

+ +

$$ |\psi\rangle = \sin{\frac{\theta}{2}}|\chi\rangle + \cos{\frac{\theta}{2}}|\xi\rangle$$

+ +

I could easily see that this transformation is correct and preserves $\langle\psi|\psi\rangle=1$, but I got confused on how to deduce it for a many qubits system and how to achieve a similar structure after applying the Grover Operator G R times as stated by the paper in the following equation

+ +

$$ G^R|\psi\rangle = \sin{\frac{(2R+1)\theta}{2}}|\chi\rangle + \cos{\frac{(2R+1)\theta}{2}}|\xi\rangle$$

+",7333,,7333,,2/25/2020 23:59,8/2/2020 20:47,Changing qubits coefficients to trigonometric functions in Grover Algorithm,,1,3,,,,CC BY-SA 4.0 +9979,2,,9969,2/24/2020 23:56,,2,,"

If you include the third qubit in your state, now, you have

+ +

$$(\cos(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) |00⟩ + \cos(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2}) |01⟩ - i \sin(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) |11⟩ - i \sin(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2}) |10⟩)\otimes(\cos(\frac{\theta_3}{2})|0⟩+\sin(\frac{\theta_3}{2})|1⟩)$$

+ +

Then you expand this:

+ +

$$\cos(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) \cos(\frac{\theta_3}{2})|000⟩ + \cos(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2}) \cos(\frac{\theta_3}{2})|010⟩ - i \sin(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) \cos(\frac{\theta_3}{2})|110⟩ - i \sin(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2})\cos(\frac{\theta_3}{2}) |100⟩$$

+ +

$$ + \cos(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) \sin(\frac{\theta_3}{2})|001⟩ + \cos(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2}) \sin(\frac{\theta_3}{2})|011⟩ - i \sin(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) \sin(\frac{\theta_3}{2})|111⟩ - i \sin(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2})\sin(\frac{\theta_3}{2}) |101⟩$$

+ +

Then do the CNOT on each basis state, changing the third bit iff the second bit is 1:

+ +

$$\cos(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) \cos(\frac{\theta_3}{2})|000⟩ + \cos(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2}) \cos(\frac{\theta_3}{2})|011⟩ - i \sin(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) \cos(\frac{\theta_3}{2})|111⟩ - i \sin(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2})\cos(\frac{\theta_3}{2}) |100⟩$$

+ +

$$ + \cos(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) \sin(\frac{\theta_3}{2})|001⟩ + \cos(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2}) \sin(\frac{\theta_3}{2})|010⟩ - i \sin(\frac{\theta_1}{2}) \cos(\frac{\theta_2}{2}) \sin(\frac{\theta_3}{2})|110⟩ - i \sin(\frac{\theta_1}{2}) \sin(\frac{\theta_2}{2})\sin(\frac{\theta_3}{2}) |101⟩$$

+ +

... and that's your final state! Kind of a mess as you can see; there's a reason people avoid computing these by hand. :)

+",10115,,,,,2/24/2020 23:56,,,,1,,,,CC BY-SA 4.0 +9980,1,,,2/25/2020 4:06,,2,65,"

I want to have a software product specifically suited for Quantum Machine Learning. Please help me with a list of software product which has been designed specifically for implementing Quantum Machine Learning Algorithms. Currently, most of the packages are about hybrids like Pennylane and Qiskit are like generic interfaces through which quantum hardware can be accessed. I am looking for a high-level package which can make it easy to simulate QML, so that we can bring QML to audience with little understanding of Quantum Computing.

+",8120,,9006,,2/25/2020 5:52,2/25/2020 5:52,Software for implementing Quantum Machine Learning,,0,0,,,,CC BY-SA 4.0 +9981,2,,9970,2/25/2020 5:49,,2,,"

Quantum computers bring quadratic speed-up for Monte Carlo method. +See for example Quantum Risk Analysis where the authors discussed application of Monte Carlo for risk management in finance.

+",9006,,,,,2/25/2020 5:49,,,,0,,,,CC BY-SA 4.0 +9982,2,,9976,2/25/2020 8:37,,0,,"

I think a better phrasing to this question is - will cloud access to a quantum computer enable a classical computer to pass the Turing test sooner than a classical computer with no such access?

+ +

A quantum computer ""alone"" is very unlikely to pass the Turing test earlier than the above mentioned device, since quantum computers have technical difficulties performing large-scale simple tasks (e.g. multiply two 2048-digit numbers). Our usage of quantum computers relies on their ability to perform very specific tasks that are out of reach for classical computers.

+ +

In order to pass the Turing test, the computer needs to be able to cover an extremely wide variety of tasks; there is no reason to assume a quantum computer will be better than a classical computer in such a wide variety.

+ +

So the question remains - will cloud access to a quantum computer help with passing the Turing test? Here we can only speculate as well. For example, one can guess that good machine learning capabilities are essential to passing the Turing test (since you need to be able to tell the difference between a picture of a cat and a picture of a dog), and we hope that quantum computers will help us with machine learning. But this is still only in the realm of speculation.

+ +

My personal guess: Yes, it will help. But only because we have many years ahead of us until a computer passes the Turing test, and I believe(/hope/dream) that quantum computing will mature by then.

+",9918,,,,,2/25/2020 8:37,,,,0,,,,CC BY-SA 4.0 +9983,1,9988,,2/25/2020 11:41,,5,743,"

Exercise 2.77 in Nielsen and Chuang asks to show by example that there exist tripartite states $| \psi \rangle_{ABC} $ which cannot be written as

+ +

$$| \psi \rangle = \sum_i \lambda_i | i_A \rangle | i_B \rangle | i_C \rangle .$$

+ +

In this unofficial solution set, they consider the state

+ +

$$| \psi \rangle = | 0 \rangle_A \otimes | \Phi_+ \rangle_{BC} = |0 \rangle_A \otimes \bigg[ \frac{1}{\sqrt{2}} \Big( |00 \rangle_{BC} + | 11 \rangle_{BC} \Big) \bigg].$$

+ +

Then they perform the arbitrary (unitary) change of basis

+ +

$$|0\rangle = \alpha | \phi_0 \rangle + \beta | \phi_1 \rangle , \\ +|1\rangle = \gamma | \phi_0 \rangle + \delta | \phi_1 \rangle $$

+ +

obtaining

+ +

$$ | \psi \rangle = \Big( \alpha | \phi_0 \rangle_A + \beta | \phi_1 \rangle_B \Big) \otimes \bigg[ \frac{1}{\sqrt{2}} \Big( |\phi_0 \phi_0 \rangle_{BC} + | \phi_1 \phi_1 \rangle_{BC} \Big) \bigg].$$

+ +

Since the cross terms cannot vanish, the proof is finished. However, I don't see the last step. Why do you have $ |00 \rangle_{BC} + | 11 \rangle_{BC} = |\phi_0 \phi_0 \rangle_{BC} + | \phi_1 \phi_1 \rangle_{BC}$ ? I mean, for instance, the unitarity of the change of basis doesn't buy us the cancellation of the terms $ | \phi_0 \phi_1 \rangle$ and $| \phi_1 \phi_0 \rangle$ (I think).

+ +

EDIT: Note that:

+ +

1) The coefficients $\alpha$, $\beta$, $\gamma$ and $\delta$ are not, in general, real. Since we want to show that there is no way of rewritting $| \psi \rangle$ in Schmidt form, we have to consider the most general case where these coefficients are complex.

+ +

2) The change of basis is, in the most general case, different for each party. I mean, we should rather write

+ +

$$|0 \rangle_X = \alpha_X \, | \phi_0 \rangle_X + \beta_X \, | \phi_1 \rangle_X \, , \\ +| 1 \rangle_X = \gamma_X \, | \phi_0 \rangle_X + \delta_X \, | \phi_1 \rangle_X \, , $$

+ +

where $X= A, B, C$. Unitarity conditions are

+ +

$$| \alpha_X |^2 + |\beta_X |^2 = | \gamma_X |^2 + |\delta_X |^2 = 1 \, ,\\ +\alpha_X^* \gamma_X + \beta_X^* \delta_X = 0 $$

+ +

for each $X$. I don't see how you can cancel the cross terms using this.

+",9895,,55,,2/20/2021 16:27,5/7/2021 12:10,Prove that there exist tripartite $|\psi\rangle$ which cannot be written as $|\psi\rangle=\sum_i\lambda_i|i_A\rangle|i_B\rangle|i_C\rangle$,,3,0,,,,CC BY-SA 4.0 +9984,1,10007,,2/25/2020 12:17,,2,413,"

I'm trying to use sympy to compute symbolic results of quantum circuits using dirac notation. +More specifically, I'd like to use the three rotation gates. I try to implement them in the following way, using sympy symbolic quantum physics package :

+ + + +
from IPython.display import display
+
+from sympy import init_printing
+init_printing(use_latex=True)
+from sympy import expand, Eq, Symbol, simplify, exp, sin,cos,I,srepr,Matrix
+from sympy.physics.quantum import *
+from sympy.physics.quantum.qubit import *
+from sympy.physics.quantum.gate import *
+from sympy.physics.quantum.circuitplot import circuit_plot
+
+
+theta = Symbol('theta')
+
+Ry_mat = Matrix([[cos(theta/2), -sin(theta/2)],[sin(theta/2),cos(theta/2)]]) #check
+Rx_mat = Matrix([[cos(theta/2), -I*sin(theta/2)],[-I*sin(theta/2),cos(theta/2)]]) #check
+
+Ry = UGate((0,), Ry_mat)
+Rx= UGate((1,), Rx_mat)
+c = Ry*Rx
+circuit_plot(c, nqubits=2);
+
+qapply(c*Qubit('00'))
+
+ +

I get the error unhashable type: 'MutableDenseMatrix' +when executing qapply. I tried to replace the line :

+ + + +
c = Rx*Ry
+
+ +

with

+ + + +
c = Rx
+
+ +

and then there is no more errors. Does someone know what's going on ? What am I doing wrong ?

+",10065,,,,,2/26/2020 18:02,symbolic quantum computing using sympy : how to use arbitrary gate?,,1,0,,,,CC BY-SA 4.0 +9985,1,,,2/25/2020 14:10,,3,126,"

I have the following circuit which consists of symmetric modules. I compiled the circuit in IBM Quantum experience backend - ibmq_qasm_simulator, 8192 shots. The result is not equiprobable. Why? Since this is not a real machine ideally I should get same probability of 16.67%.

+ +

+

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+qreg qA[8];
+qreg qB[8];
+qreg qC[6];
+qreg qD[6];
+creg c[4];
+
+h qA[2];
+h qA[4];
+x qA[6];
+x qA[7];
+x qB[1];
+h qB[2];
+h qB[4];
+x qB[6];
+x qB[7];
+h qC[0];
+h qC[2];
+x qC[4];
+x qC[5];
+h qD[0];
+h qD[2];
+x qD[4];
+x qD[5];
+cx qA[2],qA[3];
+cx qA[4],qA[5];
+h qA[6];
+cx qB[2],qB[3];
+cx qB[4],qB[5];
+h qB[6];
+cx qC[0],qC[1];
+cx qC[2],qC[3];
+h qC[4];
+cx qD[0],qD[1];
+cx qD[2],qD[3];
+h qD[4];
+cx qA[6],qA[7];
+cx qB[6],qB[7];
+cx qC[4],qC[5];
+cx qD[4],qD[5];
+x qA[0];
+ccx qA[6],qA[0],qA[4];
+ccx qB[6],qB[0],qB[4];
+ccx qA[7],qA[1],qA[5];
+ccx qB[7],qB[1],qB[5];
+x qA[6];
+x qA[7];
+x qB[6];
+x qB[7];
+ccx qA[6],qA[0],qA[2];
+ccx qB[6],qB[0],qB[2];
+ccx qA[7],qA[1],qA[3];
+ccx qB[7],qB[1],qB[3];
+cx qA[2],qA[3];
+cx qA[4],qA[5];
+cx qB[2],qB[3];
+cx qB[4],qB[5];
+ccx qA[3],qC[4],qC[2];
+ccx qB[3],qC[5],qC[3];
+x qC[4];
+x qC[5];
+ccx qA[3],qC[4],qC[0];
+id qA[5];
+ccx qB[3],qC[5],qC[1];
+id qA[5];
+cx qC[0],qC[1];
+cx qC[2],qC[3];
+ccx qA[5],qD[4],qD[2];
+ccx qB[5],qD[5],qD[3];
+x qD[4];
+x qD[5];
+ccx qA[5],qD[4],qD[0];
+ccx qB[5],qD[5],qD[1];
+cx qD[0],qD[1];
+cx qD[2],qD[3];
+measure qC[1] -> c[3];
+measure qC[3] -> c[2];
+measure qD[1] -> c[1];
+measure qD[3] -> c[0];
+
+",8620,,8620,,2/25/2020 14:48,11/11/2022 23:01,Why I am not getting approximate equiprobable states in the following circuit on IBM Q simulator?,,1,10,,,,CC BY-SA 4.0 +9986,2,,9983,2/25/2020 14:34,,-1,,"

the trick is to show the relation $\alpha \beta$ = - $\gamma \delta$ so the cross terms cancels out. It's not so straightforward in my opinion.

+ +

Let's develop the term (dropping the subscript here) $|00⟩+|11⟩$ in term of the new basis :

+ +

$ |00⟩+|11⟩ = (\alpha^2+\gamma^2) |\phi_0 \phi_0⟩ + (\beta^2+\delta^2) |\phi_1 \phi_1⟩ + \alpha \beta |\phi_0 \phi_1⟩ + \alpha \beta |\phi_1 \phi_0⟩ + \gamma \delta |\phi_0 \phi_1⟩ + \gamma \delta |\phi_1 \phi_0⟩ $

+ +

If we can show that $\alpha \beta$ = - $\gamma \delta$ then the above expression reduces to

+ +

$|00⟩+|11⟩ =(\alpha^2+\gamma^2) |\phi_0 \phi_0⟩ + (\beta^2+\delta^2) |\phi_1 \phi_1⟩$

+ +

and we would only need to prove $(\alpha^2+\gamma^2) = (\beta^2+\delta^2) = 1 $.

+ +

Let's show that indeed $\alpha \beta$ = - $\gamma \delta$. +First remind that a unitary transform preserves orthogonality and since $|0⟩$ and $|1⟩$ are orthogonal, so are $\alpha |\phi_0⟩ + \beta |\phi_1⟩$ and $\gamma |\phi_0⟩ + \delta |\phi_1⟩$

+ +

writing the scalar product between the two and using orthogonality we find the relation :

+ +

$\alpha \gamma + \beta \delta = 0$

+ +

Not yet what we want. +We also know from definition of a qubit that

+ +

$\alpha^2 +\beta^2 =1$

+ +

$\gamma^2 + \delta^2 = 1$

+ +

combining those three equalities and with some help from wolphram I found that this system had solutions all implying the equality $\alpha \beta = -\gamma \delta$. I'm not writing the solutions here but you can use this link to wolphram to check it yourself. Hence the cross term do cancel.

+ +

To show that $(\alpha^2+\gamma^2) = (\beta^2+\delta^2) = 1$, we can use the result we just showed and the equality using orthogonality :

+ +

$\alpha \gamma = - \beta \delta$

+ +

$\alpha \beta = -\gamma \delta$

+ +

so $\gamma = -\beta$ and $\alpha^2 + \beta^2 = \alpha^2 + \gamma^2 = 1$. +proceed the same way to show $\beta^2 + \delta^2 = 1$.

+",10065,,10065,,2/25/2020 15:09,2/25/2020 15:09,,,,2,,,,CC BY-SA 4.0 +9987,2,,9985,2/25/2020 14:58,,0,,"

You might have an issue in your circuit. I believe the first X gate on line qB1 should actually be on line qB0 to be symmetric with the upper block.

+ +

Maybe you can also try to move those X gates just before the two controlled gates as they act on the first and third qubit you measure but not on the second and fourth ones (in descending order).

+",10065,,10065,,2/25/2020 15:21,2/25/2020 15:21,,,,2,,,,CC BY-SA 4.0 +9988,2,,9983,2/25/2020 15:55,,5,,"

In case you are interested in an alternative proof...

+

For a state $|\psi\rangle$ as given, the reduced density matrices of each of the three qubits must all be of the form $\sum_i\lambda_i|i_X\rangle\langle i_X|$, where the basis $|i_X\rangle$ is orthonormal. That means that all three density matrices have the same spectrum (eigenvalues $\lambda_i$).

+

Now, consider a state of the form +$$ +|0\rangle(|00\rangle+|11\rangle)/\sqrt{2} +$$ +The first qubit is separable, so the eigenvalues of the reduced density matrix are $\lbrace 1,0\rbrace$. The other two qubits are maximally mixed due to the entanglement, with eigenvalues $\lbrace 1/2,1/2\rbrace$.

+",1837,,15220,,5/7/2021 12:10,5/7/2021 12:10,,,,9,,,,CC BY-SA 4.0 +9989,1,,,2/25/2020 16:30,,1,43,"

I am interested in studying physical systems and trying to build circuits to simulate them. Now, of course, all the systems I could try to work with at simple, toy, systems - and that's fine.

+ +

However, I find myself unable to fully grasp how to go from say, a hamiltonian, to a graph, and then to a circuit - let alone to successfully find the right framework to add optimization.

+ +

I am wondering: do you have any papers that do a good job in taking a beginner - besides Patrick Cole's paper - from first principles to quantum gates?

+ +

Thank you.

+",6253,,,,,2/25/2020 16:30,Primer for Quantum Circuits and Optimization,,0,0,,,,CC BY-SA 4.0 +9990,1,9993,,2/25/2020 18:07,,4,449,"

I could not find any lower bound on the diamond norm for two uniformly random unitaries of dimension D sampled from the haar measure.

+",8748,,55,,10/28/2020 9:25,10/28/2020 9:25,Is there a lower bound on the average diamond norm of two uniformly random unitaries U1 and U1 of dimension D that are sampled from haar measure?,,2,0,,,,CC BY-SA 4.0 +9991,2,,9983,2/25/2020 18:25,,1,,"

It is not true that $ |00 \rangle + | 11 \rangle = |\phi_0 \phi_0 \rangle + | \phi_1 \phi_1 \rangle$ for an arbitrary change of basis. For example, let $|\phi_0 \rangle = |0\rangle $ and $ |\phi_1 \rangle = i|1 \rangle $.

+ +

You can, however, pick $ \phi_1 $ so that this equality is true, given $ \phi_0 $. If $ |\phi_0 \rangle = \kappa | 0 \rangle + \mu | 1 \rangle $, pick $ | \phi_1 \rangle = \mu | 0 \rangle - \kappa | 1 \rangle $ .

+",9995,,,,,2/25/2020 18:25,,,,1,,,,CC BY-SA 4.0 +9992,1,,,2/25/2020 18:43,,3,86,"

Does anyone in here know of an open source source for finding noisy data from quantum gates. I am interested in playing around with in the same way people play around with MNIST.

+ +

I know it's a long shot, but I hope to hear back from someone!

+",6253,,,,,11/12/2022 20:02,Quantum Noise Dataset,,1,3,,,,CC BY-SA 4.0 +9993,2,,9990,2/25/2020 20:27,,9,,"

This answer won't actually give you a bound, but will provide some information that may help you in your search. You may be able to find an answer in the random matrix theory literature if you translate the question into different terms, as I will describe.

+ +

First, suppose that $\Phi_0(X) = U_0 X U_0^{\dagger}$ and $\Phi_1(X) = U_1 X U_1^{\dagger}$ are any two unitary channels. In this special case, the diamond norm distance between these two channels can be expressed as follows: +$$ +\|\Phi_0 - \Phi_1\|_{\diamond} = 2 \sqrt{1 - \delta(U_0^{\dagger} U_1)^2}, +$$ +where $\delta(A)$ denotes the minimum absolute value taken over the numerical range of a given operator $A$. That is, +$$ +\delta(A) = \min_{|\psi\rangle} |\langle \psi | A | \psi\rangle|, +$$ +where the minimum is over all unit vectors $|\psi\rangle$.

+ +

Now, if you're interested in $U_0$ and $U_1$ being Haar-random, then you might as well set $U_0 = I$ and $U_1 = U$ for $U$ Haar-random, by the fact that the diamond norm is unitarily invariant. To understand the distribution of the diamond norm distance, you therefore need to understand something about the numerical range of a Haar-random unitary. Because unitary operators are normal, their numerical range is the convex hull of their eigenvalues, so you're essentially trying to understand something about the eigenvalues of a Haar-random unitary. This topic has been studied extensively in random matrix theory.

+ +

I do not know enough about this topic to give you precise bounds, but it is clear that as the dimension $D$ grows, the probability that the diamond norm distance equals the maximum possible value 2 (which means the two channels can be discriminated perfectly) approaches 1. Indeed, in order to have diamond norm distance strictly less than 2, all of the eigenvalues of $U$ (or $U_0^{\dagger} U_1$) must fall within an arc on the unit circle having length strictly less than $\pi$, which is extremely unlikely for large $D$ (surely the probability is exponentially small in $D$).

+",1764,,,,,2/25/2020 20:27,,,,1,,,,CC BY-SA 4.0 +9994,1,9995,,2/26/2020 5:14,,2,149,"

Is Industry and the companies including IBMa and D-wave etc or PhD research programs best for someone wanting to go to quantum statistical/mathematical machine learning in the United States?

+ +

I mean actual quantum computers rather than simulation of quantum computers on classical computers

+",,user10151,,,,2/26/2020 15:30,Is Industry or PhD programs best for someone wanting to go to quantum machine learning?,,1,0,,2/27/2020 21:19,,CC BY-SA 4.0 +9995,2,,9994,2/26/2020 6:14,,0,,"

I am a graduate MS student right now and unless you go to Caltech, MIT, or Waterloo it’s going to be really hard for you to get experience at industry without attending a PhD in quantum information and computation

+",6253,,6253,,2/26/2020 15:30,2/26/2020 15:30,,,,2,,,,CC BY-SA 4.0 +9996,1,10013,,2/26/2020 14:45,,5,620,"

I would like to know if there is a way to read the elements of a circuit. What I mean is if I have a QuantumCircuit object, can I obtain the gates that are applied to each qubit in order?

+ +

I would like to implement certain noise gate after each Hadamard and I would have therefore to identify each Hadamard in the QuantumCircuit object. So I need a function that gives me all the gates in a circuit and that allows me to modificate what it returns so I can construct a modified quantum circuit.

+",9887,,55,,10/28/2020 9:24,10/28/2020 9:24,How to read the elements of a circuit in qiskit?,,2,0,,,,CC BY-SA 4.0 +9997,1,10000,,2/26/2020 14:47,,2,85,"

How do I explain qubits to my cousin who is 8 years old?

+",166,,9006,,2/27/2020 5:25,2/27/2020 5:25,How do I explain qubits to my cousin who is 8 year old?,,2,0,,,,CC BY-SA 4.0 +9998,2,,9996,2/26/2020 15:09,,1,,"

I would recommend doing this by converting the circuit to a DAGCircuit and then using the topological_op_nodes() property, which will return all the operations in the DAG in order. I would also suggest instead of trying to modify the circuit in place, you create a new one.

+ +

To convert a circuit to a DAG you can use the function

+ +
from qiskit.converter import circuit_to_dag
+dag = circuit_to_dag(your_circuit)
+
+ +

And then you can iterate over the nodes

+ +
for node in dag.topological_op_nodes():
+    if node.name == 'H':
+       ~do something~
+
+ +

The objects returned are DAGNodes and contain all the information for you to be able to add the gate to a new circuit.

+",5955,,,,,2/26/2020 15:09,,,,3,,,,CC BY-SA 4.0 +9999,1,,,2/26/2020 15:16,,1,719,"

Consider the product of gates acting on two qubits: +$$ +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0 \\ +\end{pmatrix} +\cdot +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 0 & 1 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +\end{pmatrix} +\cdot +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ +0 & 0 & \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \\ +\end{pmatrix}. +$$ +This is a controlled Hadamard, then SWAP, then CNOT. On the basis +$$ +\begin{pmatrix} +00 \\ 01 \\ 10 \\ 11 +\end{pmatrix} +$$ +This leaves us, before the last CNOT, in the basis, +$$ +\begin{pmatrix} +00 \\ 1 + \\ 01 \\ 1 - +\end{pmatrix}. +$$ +It's hard for me to see the last CNOT as a control on a 1 state anymore. Am I missing something simple, or has the interpretation just been lost since I changed basis? I guess I'm wondering why even make the usual statement that CNOT (or any controlled gate) is used with a ''control'' and ''target'' since in some simple steps I can very rapidly move away from that interpretation. It seems like it should just be interpreted as another SWAP that just moves around the vector elements. Is my understanding of this correct? Thanks.

+",5527,,55,,5/30/2021 8:30,5/30/2021 8:30,How do I interpret the CNOT gate control-target structure after a basis-change?,,1,0,,,,CC BY-SA 4.0 +10000,2,,9997,2/26/2020 15:32,,3,,"

I think coin flipping could be a good example. At any given time you can express the state of the flip as 50% on tails and 50% on heads. It’s when you make the measurement - to flip the coin- that you find out which of the two states the coin is for that measurement.

+",6253,,,,,2/26/2020 15:32,,,,6,,,,CC BY-SA 4.0 +11729,1,11733,,4/28/2020 17:36,,4,89,"

I've come across this exercise plenty of times and I still don't understand how to do it. (Here it is from N.C. Ex.10.25)

+ +

Let $C$ be a linear code (Lets suppose its a binary code, i.e. a $k$-dimensional subspace of $\mathbb{F}_2^n$). Show that $$\sum_{y\in C}(-1)^{x\cdot y} =\begin{cases} |C|\, \text{ if $x\in C^\perp$},\\ 0\, \text{ if $x\notin C^\perp$}.\end{cases}$$

+ +

(Aside: This exercise is key in understanding why CSS codes can correct both bit flip and phase flip errors.)

+ +

The case where $x\in C^\perp$ is trivial. It's the second case that is less so... I know the following: If $x\notin C^\perp$ then $x\in C$. I can also see that the solution would follow if I could show that half the vectors $y\in C$ were orthogonal to $x$. Since this would imply that the other half are not orthogonal and we would have an equal number of $(+1)$'s coming from $x\cdot y=0$ that would cancel out with the $(-1)$'s from the $x\cdot y=1$ terms. Anyone have the missing piece or am I on the wrong track here.

+",11793,,55,,4/29/2020 13:16,6/20/2022 17:15,Identity for linear codes and their duals: why do we have $\sum_y (-1)^{x\cdot y}=|C|\delta_{x\in C^\perp}$?,,1,0,,,,CC BY-SA 4.0 +11730,1,11731,,4/28/2020 17:52,,3,147,"

This is related to exercise 4.34,

+ +

The operation described can be written as $(H \otimes I)C^1(U)(H \otimes I)(|0\rangle \otimes |\psi\rangle)$

+ +

I can get to the point where the state of the system is given by:

+ +

$|0\rangle \otimes(I+U)|\psi\rangle + |1\rangle \otimes(I-U)|\psi\rangle$,

+ +

where $U$ is a Hermitian unitary with eigenvalues $-1$ and $+1$ with corresponding eigenvectors $|\lambda_-\rangle$ and $|\lambda_+\rangle$ respectively.

+ +

however I am stuck on the final part that when measuring $q_0$ the post-measurement state is given by the corresponding eigenvector of $U$. This reduces down to to showing that

+ +

$(I-U)|\psi\rangle = |\lambda_-\rangle$

+ +

$(I+U)|\psi\rangle = |\lambda_+\rangle$

+ +

I have tried using the spectral decomp of $U$ however I can't seem to get it to lead anywhere. My current trail of thought (not sure if correct) is if taking the density of the system, $(I\pm U)$ reduces down to projectors for $|\lambda_\pm\rangle$, s.t. $P_{\pm}|\psi\rangle = c_{\pm}\lambda_\pm $.

+ +

-- Update --

+ +

An answer using projectors (as suspected) is using the fact that for $U$ to be unitary and Hermitian then $U = (2P - I)$ for an orthogonal projector $P$ (https://math.stackexchange.com/questions/57148/matrices-which-are-both-unitary-and-hermitian), hence $(I+U)$ and $(I-U)$ reduce down to a projector $P$ and its orthogonal complement $2(I-P)$, thus projecting $\psi$ onto the eigenvectors.

+",6139,,6139,,4/29/2020 3:30,4/29/2020 3:30,Showing measurement of a Hermitian Unitary operator gives final states as eigenvectors,,1,0,,,,CC BY-SA 4.0 +11731,2,,11730,4/28/2020 19:16,,2,,"

Just need to write it out: +\begin{align} +(I-U)|\psi\rangle &= I\big(c_+|\lambda_{-}\rangle + c_{-}|\lambda_{-}\rangle\big) - U\big(c_+|\lambda_{-}\rangle + c_{-}|\lambda_{-}\rangle\big) \\ +&= c_+|\lambda_{+}\rangle + c_{-}|\lambda_{-}\rangle - \big(c_+|\lambda_{+}\rangle - c_{-}|\lambda_{-}\rangle\big) \\ +&= c_+|\lambda_{+}\rangle + c_{-}|\lambda_{-}\rangle - c_+|\lambda_{+}\rangle + c_{-}|\lambda_{-}\rangle \\ +&= c_{-}|\lambda_{-}\rangle +\end{align}

+ +

I've used $U(c_{-}|\lambda_{-}\rangle) = -c_{-}|\lambda_{-}\rangle$.

+",9282,,,,,4/28/2020 19:16,,,,3,,,,CC BY-SA 4.0 +11733,2,,11729,4/28/2020 20:08,,5,,"

Here is a lovely proof. Recall that we can think of any vector space as an abelian group, in particular, the codespace $C$ is an abelian group (isomorphic to $\mathbb{Z}_2^k$). The dot product $\varphi_x(y)=x\cdot y$ is a group homomorphism $\varphi_x:C\rightarrow \mathbb{Z}_2$. Provided that $x\notin C^\perp$ the map is surjective which means that $K=ker(\varphi)$ is an index 2 subgroup of $C$. It follows from Lagrange's theorem that $|K|=|C|/2$ and the result follows.

+",11793,,11793,,6/20/2022 17:15,6/20/2022 17:15,,,,1,,,,CC BY-SA 4.0 +11734,1,11749,,4/28/2020 21:49,,4,325,"

$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$ +I'm looking for (unitary$^1$) transformations$^2$, to create a superposition of any $n$ computational basis states with equal coefficients. I'm further interested in the complexity of these implementations and/or a gate count.

+ +

Building up on this question, on how to create superpositions of 3 states, I wonder how it scales to split up into any number of $n$ computational basis states. For simplicity let's always start with $\ket{00...0}$. Here are my thoughts:

+ +
    +
  1. $n=5$: Split $\ket{000}\rightarrow \sqrt\frac25\ket{000}+ \sqrt\frac35\ket{001}$ by a local $Y$-gate , then implement a controlled (trigger when the rightmost bit is $0$) split like $\ket{000}\rightarrow \sqrt{\frac12}(\ket{000}+\ket{010})$ and finally a controlled (trigger when the leftmost bit is $1$) split like $\ket{001}\rightarrow \sqrt{\frac13}(\ket{001}+\ket{011}+\ket{111})$. For reference see here.
  2. +
  3. $n=6$: same as for $n=5$ but after an local split into 2 equal halves on the first (rightmost/top) qubit, 2 controlled splits into 3 states are involved.
  4. +
  5. $n=7$: again split in two parts with the weigths $\sqrt\frac37 :\sqrt\frac47$ and further implement controlled splits...
  6. +
  7. $n=8$: trivial
  8. +
  9. $n=9$: this takes 4 qubits. Split into 3 on the first 2 qubits and then have controlled splits into another 3 on the last 2 qubits.
  10. +
+ +

I haven't counted CNOTs and local operations (necessary for answering the scaling question), but the pattern looks like something, how to decompose numbers. Is there a generic way to come up with a circuit to split into $n$ computational basis states?

+ +

If you can improve my suggested implementations, let me know...

+",5280,,55,,4/29/2020 13:20,4/29/2020 19:10,What is the complexity of splitting a state into a superposition of $n$ computational basis states?,,3,3,,,,CC BY-SA 4.0 +11735,1,11748,,4/28/2020 22:23,,6,906,"

IBM Q is (maybe first) quantum computing platform allowing users to register for free and run algorithm on real quantum processors. There are several processors with usually 5 qubits, however, it is also possible to use processor Melbourne with 15 qubits.

+ +

My question: Is there any other platform where it is possible to register for free and run programs on real quantum hardware?

+",9006,,55,,5/24/2020 9:15,5/24/2020 9:15,What are examples of quantum computing platforms availble for free (other than IBM Q)?,,2,1,,,,CC BY-SA 4.0 +11736,2,,11735,4/28/2020 22:23,,6,,"

There is a platform Quantum Inspire provided by QuTech, an organization co-founded by Delft University of Technology. Currently, the platform offers two real quantum processors:

+ +
    +
  • Spin-2 - 2 qubits processor with qubits implemented as electron spins
  • +
  • Starmon-5 - 5 qubits transmon processor
  • +
+ +

The platform uses a programming language based on QASM. It is also possible to use Qiskit.

+ +

Here is a link to the platform.

+ +

In comparison with IBM Q, decoherence is more or less similar for transmon processors, while spin processor of Quantum Inspire shows higher decoherence. I tried to implement a circuit for preparing Bell state $\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$. On IBM Q (processor Rome), I reached these results (4,096 shots on both platforms):

+ +
    +
  • $|00\rangle$ - 4.13 %
  • +
  • $|01\rangle$ - 50.68 %
  • +
  • $|10\rangle$ - 43.29 %
  • +
  • $|11\rangle$ - 1.9 %
  • +
+ +

On Quantum Inspire, the results were these

+ +
    +
  • $|00\rangle$ - Starmon-5: 9.1 %, Spin-2: 9.1 %
  • +
  • $|01\rangle$ - Starmon-5: 44.2 %, Spin-2: 16.8 %
  • +
  • $|10\rangle$ - Starmon-5: 43.4 %, Spin-2: 60.5 %
  • +
  • $|11\rangle$ - Starmon-5: 3.2 %, Spin-2: 13.6 %
  • +
+",9006,,,,,4/28/2020 22:23,,,,1,,,,CC BY-SA 4.0 +11737,1,,,4/28/2020 22:57,,1,46,"

I'm trying to solve QUBO problems using Qiskit QAOA and VQE solvers. +However, I have the experience that I can only solve small problems. I tried with both QAOA and VQE and both experience the same issue. I am wondering if there is a limit to the size of problems that your simulators can run on Qiskit Aqua.

+",11855,,55,,4/29/2020 13:22,4/29/2020 13:22,Is there a limit to the size of problems that your simulators can run on Qiskit Aqua?,,0,1,,,,CC BY-SA 4.0 +11738,1,,,4/29/2020 0:01,,3,112,"

I'm looking at papers like Demonstration of teleportation-based error correction in the IBM quantum computer (page) 10 and Role of syndrome information on a one-way quantum repeater using teleportation-based error correction (pages 3 and 4 and figure 2).

+ +

In all these, they mention that a QND measurement enables the detection of error due to loss but I didn't quite understand how it is detected and how it is corrected.

+ +

I saw several other papers, that simply say that errors due to loss can be detected using TEC but I don't understand its working.

+",6252,,9006,,5/1/2020 22:26,5/1/2020 22:26,How does Teleportation based Error Correction (TEC) detect and correct loss/erasure errors?,,0,0,,,,CC BY-SA 4.0 +11740,2,,11734,4/29/2020 1:19,,3,,"

For large $N$ the most efficient method I am aware of is to prepare a uniform superposition over $2^{\lceil \log_2(N) \rceil}$ values with a bunch of Hadamard gates, then use a perfectly tuned Grover diffusion step to remove the unwanted states between $N$ and $2^{\lceil \log_2(N) \rceil}$. The cost of this approach is $O(\log N + \log 1/\epsilon)$ gates (the $1/\epsilon$ is from arbitrary angle rotations being approximated using a fixed gate set).

+ +

This method is explained in Figure 12 of https://arxiv.org/abs/1805.03662. Beware that there is a sign error in the figure. The numerator in the angle calculations should be $L - 2^{\lfloor \log(L)\rfloor}$ instead of $ 2^{\lfloor \log(L)\rfloor} - L$.

+ +

Here is a working example in Quirk, preparing a uniform superposition over 100 values. 100 is $25*2^2$, so this really reduces to the $N=25$ case with two $|+\rangle$ qubits. The perfect angle for the diffusion is $\arccos(1 - 16/25)$, where the 25 comes from $N=25$ and 16 is the smallest power of 2 less than $N$.

+ +

+ +

You can confirm that the construction works by clicking on the image to open quirk, changing the three ""25""s in the circuit to ""23""s, and seeing that the new output is a uniform superposition up to 4*23 = 92.

+",119,,119,,4/29/2020 19:10,4/29/2020 19:10,,,,1,,,,CC BY-SA 4.0 +11741,1,,,4/29/2020 4:42,,1,190,"

I have been working on Qiskit. Is it possible to display just the angle of each gate in a circuit as an output?

+

For example, if the below code is my circuit is it possible to just print the angle of the gate. We have function QuantumCircuit.count_ops() to display the gate counts similarly is there a way to do so?

+
q2 = QuantumRegister(2)
+circuit = QuantumCircuit(q2)
+circuit.cu1(math.pi/2, q2[0], q2[1])
+print(circuit)
+
+",9778,,1859,,4/28/2022 11:58,4/28/2022 11:58,Angle in qiskit,,2,0,,,,CC BY-SA 4.0 +11742,2,,11741,4/29/2020 6:29,,1,,"

I don't think there's a built in function for this, but you can always hack a little to iterate over the gate list:

+ +
from qiskit import QuantumCircuit, QuantumRegister
+import math
+q2 = QuantumRegister(2)
+circuit = QuantumCircuit(q2)
+circuit.cu1(math.pi/2, q2[0], q2[1])
+for gate, _, _ in circuit._data:
+    print(gate.params[0])
+
+ +

However, instructions in Qiskit do not have a standardized interface, meaning not every gate will have params[0] set (e.g. x gate) or only one parameter (e.g. u3 gate). So it's really a question of which gates you are going to use in your circuit and knowing how their angles are represented in Qiskit (using gate.defintion might help).

+",9918,,,,,4/29/2020 6:29,,,,0,,,,CC BY-SA 4.0 +11746,2,,11734,4/29/2020 8:12,,2,,"

I'd have thought your easiest method would be to prepare a uniform superposition of $m=\lceil\log_2 n\rceil$ qubits using hadamard gates. Then introduce an ancilla. You can then compute a function $f(x):\{0,1\}^m\rightarrow\{0,1\}$ for which $\sum_{x\in\{0,1\}^m}=n$. Any such function will do (this is the same marking function that you'd have in Grover's search).

+ +

Now, we simply measure the ancilla in the $Z$ basis. If it is in the state $|1\rangle$, you've got the state that you want. If it is in the state $|0\rangle$, you've failed and you have to try again. However, the probability of failure is less than $\frac12$. Thus, on average, you only need two runs to be successful.

+ +

As an example, take something like $n=7$. Here, we have $m=3$ and $f(x)$ is just +$$ +f(x)=\left\{\begin{array}{cc} +0 & x=111 \\ +1 & \text{otherwise} +\end{array}\right. +$$ +This is just a controlled-controlled-controlled-not targetting the ancilla.

+ +

I haven't thought it through particularly carefully, but I think you can achieve a marking function $f(x)$ using $O(m^2)$ controlled-nots (because you shouldn't need more than $m$ multi-controlled-nots).

+",1837,,,,,4/29/2020 8:12,,,,4,,,,CC BY-SA 4.0 +11748,2,,11735,4/29/2020 9:50,,5,,"

Already mentioned is:

+ +
    +
  • IBM Quantum Experience, the widest known and largest platform for small quantum computing experiments. There are various physical backends containing upwards of 20 qubits for free users, and more for 'IBM Q partners'. The chips have varying qubit connectivity (architecture), which can be of vital importance to low-level experiments. Although there is a browser-based interface for easy access, the main interface is the IBM Q Experience through qiskit. As qiskit is developed by IBM researchers, this offers the go-to way to interface with the hardware.
  • +
  • Quantum Inspire by QuTech, a joint venture by Delft University of Technology and TNO. Quantum inspire offers both a web-based interface based on the cQASM language, an interface through Qiskit and an interface through ProjectQ, both including a transpiler and compiler. There are currently 2 physical chips, one containing two and one containing 5 qubits.
  • +
+ +

Both of these platforms require a free account and use queue-based token-restricted access system. More tokens can often be requested by researchers and hobbyist with good reason.

+ +

I'm also familiar with:

+ +
    +
  • Rigetti's Forest platform, which works on a request-only based access system. As far as I know, access is always granted to researchers with a good proposal. The physical backends offered contain up to 28 qubits. Interfacing is done using the Forest SDK containing pyQuil.
  • +
  • A different approach: D-Wave's software platform offers (I believe) access to their adiabatic QPU's. I have never worked with this and am far from an expert on the annealing method of quantum computing. Note that this is an entirely different approach to quantum computing than the usual gate-based model used prominently on this website. See this excellent set of answers on this website by Neil de Beaudrap for an overview of all the different models.
  • +
+ +

I am sure there are more platforms that I am not familiar with!

+",8141,,,,,4/29/2020 9:50,,,,1,,,,CC BY-SA 4.0 +11749,2,,11734,4/29/2020 14:39,,2,,"

I'm not quite sure why using Grover is cheating, or what the motivation is for discounting measurement. However, there is a way of thinking about an algorithm without either. It also runs as $O(m^2)$ where $m=\lceil\log_2(n)\rceil$.

+ +

Consider the value $n$. We write $n-1$ in binary as $x$, comprising $m$ bits. We know that the first (most significant) bit of $x$ must be 1.

+ +

We're going to describe an iterative protocol. In the first step, we start with $|0\rangle^{\otimes m}$, and convert the first qubit to +$$ +\sqrt{\frac{2^{m-1}}{n}}|0\rangle+\sqrt{\frac{n-2^{m-1}}{n}}|1\rangle. +$$ +Controlled off the first qubit being 0, we apply Hadamard on all other qubits. This has got all the terms $|0y\rangle$ for $y\in\{0,1\}^{m-1}$ correct. Now we just have to worry about the $|1y\rangle$ terms. If the second bit of $x$ is 1, then we essentially just repeat the first step but for the $m-1$ least significant bits, and controlling every operation off the first qubit being in 1. If the second bit of $x$ is 0, then we move onto the third bit, but now controlling everything off the first qubit being 1 and the second qubit being 0 (except that we don't actually need that control because it's always 0 if the first qubit is 1). We can now just repeat this for the entire sequence.

+ +

For example, if $n=14$ ($x=1101$), you'd do something like +\begin{align*} +|0\rangle^{\otimes 4}&\rightarrow \sqrt{\frac{6}{14}}|1000\rangle+\frac{1}{\sqrt{14}}(|0000\rangle+|0001\rangle+|0010\rangle+|0011\rangle+|0100\rangle+|0101\rangle+|0110\rangle+|0111\rangle) \\ +&\rightarrow \sqrt\frac{6}{14}|1\rangle(\sqrt\frac{2}{6}|100\rangle+\frac{1}{\sqrt{6}}(|000\rangle+|001\rangle+|010\rangle+|011\rangle))+\frac{1}{\sqrt{14}}(\ldots) \\ +&\rightarrow\sqrt\frac{6}{14}|1\rangle\sqrt\frac{2}{6}|10\rangle\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)+\ldots +\end{align*} +To see the complexity, we've got to loop over the $m$ bits of $x$, and each step, at worst, we have to perform a multi-controlled not, which can be decomposed in terms of $O(m)$ controlled-nots. + +In this circuit diagram, I defined $U$ such that $U(x)|0\rangle=x|0\rangle+\sqrt{1-x^2}|1\rangle$. The slices correspond to the stated outputs in the example, and the dashed box hopefully guides the eye about the recursive structure. Note that for the very last gate, $U(1/\sqrt{2})=H$. I should also note that there are some case specific optimisations that can be made (all the gates on the last qubit can be combined as a single, uncontrolled, Hadamard) but that only obfuscates the algorithmic structure.

+",1837,,1837,,4/29/2020 14:46,4/29/2020 14:46,,,,0,,,,CC BY-SA 4.0 +11750,1,,,4/29/2020 16:01,,1,41,"

I'm still investigating the TFQ whitepaper.

+ +
+ +

In one section of the paper, the authors say this with respect to Quantum Datasets

+ +
+

In general, [a quantum dataset] might come from a given black-box source...
+ However, as current quantum computers cannot import quantum data from external sources, + the user has to specify quantum circuits which generate the data. + Quantum datasets are prepared using unparameterized cirq.Circuit objects and are + injected into the computational graph using tfq.convert_to_tensor

+
+ +
+ +

As I would like to investigate datasets like (QM9, QM8, etc.) and was hoping there was a way to involve TFQ/Cirq, this has raised a few questions for me.

+ +


+ +

Are there current methods for importing datasets containing Quantum Data onto a Quantum Computer? Similarly, is it possible to use TFQ or CIRQ or a similar Quantum-Computing/QML library to explore datasets like this in a way that garners a benefit from the use of Quantum Circuits and other Quantum Computer specific attributes?

+ +


+",11517,,,,,4/29/2020 16:01,Can We Currently Import Quantum Datasets (Datasets Containing Quantum Data) Onto NISQ-era Quantum Computers?,,0,0,,,,CC BY-SA 4.0 +11752,2,,4521,4/29/2020 17:36,,2,,"

The other answers seem outdated, so here is an answer written for Cirq v0.7.0. Applying a unitary matrix is basically constructing a custom gate, and a simple example for a qubit is shown below. The gate below simply converts 0 -> 1 and 1 -> 0, but more complex examples are possible.

+ + + +
import cirq
+import numpy as np
+
+class QubitPlusGate(cirq.SingleQubitGate):
+    def _unitary_(self):
+        # Our input is q = a[0] + b[1]
+        # And our output becomes q = b[0] + a[1]
+        return np.array([[0, 1],
+                         [1, 0]])
+
+    def _circuit_diagram_info_(self, args):
+        return '[+1]'
+
+# Create a single line qubit
+q0 = cirq.GridQubit(0, 0)
+
+circuit = cirq.Circuit(
+    QubitPlusGate().on(q0),
+    cirq.measure(q0)
+)
+
+# Simulate the circuit several times.
+simulator = cirq.Simulator()
+result = simulator.run(circuit, repetitions=10)
+print(""Results:"")
+print(result)
+
+ +

If you want to view more complex examples, it is best to dive into the source code of some gates supplied by cirq itself, but the implementation architecture is exactly the same.

+",11842,,,,,4/29/2020 17:36,,,,0,,,,CC BY-SA 4.0 +11753,2,,11672,4/29/2020 18:59,,2,,"

$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$

+ +

Let's start where the quantum world is still in order:

+ +
+

Now I perform a second Hadamard gate and re-group the terms: + $$ \frac{1}{2}\left[\left(|0\rangle(|x\rangle+|x'\rangle\right) + \left(|1\rangle(|x\rangle-|x'\rangle \right)\right] $$ + Now I am ready to do a rotation on the $Y$-axis of $\alpha$ (i.e. $\tiny\pmatrix{\cos(\alpha)&-\sin(\alpha)\\\sin(\alpha)&\cos(\alpha)}$) on the first qubit. This leads to:

+
+ +

$$ \frac{1}{2}\left[\left((\cos(\alpha)\ket0 +\sin(\alpha)\ket1)(|x\rangle+|x'\rangle\right) + \left((-\sin(\alpha)\ket0+\cos(\alpha)\ket1)(|x\rangle-|x'\rangle \right)\right] $$

+ +

Since I'm not sure where you want to go from here, I end...

+",5280,,,,,4/29/2020 18:59,,,,0,,,,CC BY-SA 4.0 +11754,1,11755,,4/29/2020 20:09,,5,384,"

Specifically, I'd like to see the ibmq_london calibration file for April 15, 2020.

+",11715,,9006,,4/29/2020 20:54,4/29/2020 20:54,Is there an archive of IBMQ calibration data?,,1,0,,,,CC BY-SA 4.0 +11755,2,,11754,4/29/2020 20:34,,7,,"

Historical calibration data are available for each device via the backend.properties() method. It accepts a datetime field.

+ +
from datetime import datetime
+
+t = datetime(day=15, month=4, year=2020, hour=10)
+london_backend.properties(datetime=t)
+
+",2503,,,,,4/29/2020 20:34,,,,0,,,,CC BY-SA 4.0 +11760,1,,,4/30/2020 7:27,,0,548,"

How to use Tensorflow and Qiskit to make a quantum neural network and recognize handwriting?

+",8745,,,,,5/2/2020 8:19,How to use Tensorflow and Qiskit to make a quantum neural network and recognize handwriting?,,1,0,,,,CC BY-SA 4.0 +11761,1,,,4/30/2020 8:16,,3,22,"

$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$

+ +

Thinking about adiabtic quantum computation, I wonder about the following:

+ +
+

Can we speed up the adiabatic process if we split the target hamiltonian in commuting parts?

+
+ +

Given the standard setup in adiabatic QC to start with a groud state $\ket{\psi_0}$ of a known and easy to prepare system hamiltonian $H_0$, we gradually change the hamiltonian towards a target one $H_1$, where the final ground state $\ket{\psi_1}$ resembles the solution of our problem. So +$$ +H(t)= (1-t) H_0 + t H_1. +$$ +The critical thing is, to do that in nice and slowly way, such that we don't excite the system too much. +Responsible for the speed is the energy gap between ground and first excited state.

+ +

Now we known, that a hamilton can be split into commuting parts, i.e. $H_1=\sum_k H_{1,k}$, with $[H_{1,a},H_{1,b}]_-=0;\forall a,b$.

+ +

I assume that we now can evolve the system in parts like: +$$ +H(t)= (1-t_n) H_0 + \sum_{k=0}^{n-1} \operatorname{Ramp}(t_k,t_{k+1})H_{1_k}, +$$ +where $\operatorname{Ramp(t_k,t_{k+1})}$ is a ramp-up function.

+ +

Can we minimize the time we need for the total adiabatic process by that approach? Maybe we could ramp up the hamiltonians in an order of decreasing gaps?

+",5280,,,,,4/30/2020 8:16,Can we speed up the adiabatic process if we split the target hamiltonian in commuting parts?,,0,0,,,,CC BY-SA 4.0 +11764,1,11765,,4/30/2020 10:58,,3,95,"

When a CNOT gate is applied to 2 qubits, one is known as the control qubit while the other is called target qubit.

+ +

According to what I understand, if the control qubit is in state $|1\rangle$ then it flips the target qubit otherwise it does nothing.

+ +

I want to know whether there is some state of 2 qubits $|a\rangle$ and $|b\rangle$ such that when we apply CNOT on the two of them by which we can flip the control qubit when control qubit is in state $|1\rangle$ and do nothing to the target qubit.

+",11868,,9006,,4/30/2020 16:17,4/30/2020 16:17,Are there any single-qubit states $|a\rangle$ and $|b\rangle$ so that applying a CNOT to combined state $|ab\rangle$ changes the control qubit?,,1,0,,,,CC BY-SA 4.0 +11765,2,,11764,4/30/2020 11:11,,6,,"

Yes. What you want to make use of, essentially, is the identity + +meaning that single-qubit rotations can effectively reverse the controlled-not.

+ +

In particular, if we input the state $|+\rangle|-\rangle$ to controlled-not, the output is $|-\rangle|-\rangle$, so the control qubit has flipped its value to an orthogonal state.

+",1837,,,,,4/30/2020 11:11,,,,0,,,,CC BY-SA 4.0 +11766,1,11767,,4/30/2020 11:42,,3,63,"

What is the best option for South America Brazil to configure: provider.get_backend (''), because melbourne_16 is very slow.

+",11859,,55,,5/1/2020 14:01,5/1/2020 14:01,What is the best IBMQ provider to South America?,,1,0,,,,CC BY-SA 4.0 +11767,2,,11766,4/30/2020 12:45,,6,,"

The names of the chips are (sadly) not where they are actually located. I would recommend using least_busy to find the provider with the shortest queue so that you can have your results returned to you as fast as possible. This can be done as follows

+ +
provider = IBMQ.load_account()
+device = least_busy(provider.backends(simulator=False))
+
+ +

There are many people using the devices, and so your jobs get placed in a queue, which is why it can take a while for results to come back

+ +

However, if you really don't want to wait, you can use a NoiseModel with the simulator to replicate real noise, as if you were to run your circuit on a real device. An example of how to do this can be seen here,

+",5955,,,,,4/30/2020 12:45,,,,1,,,,CC BY-SA 4.0 +11768,1,11795,,4/30/2020 13:25,,0,193,"

I am trying to calculate mutual entropies using QuTiP, but I am being unsuccessful so far. More specifically, I consider a 2^n x 2^n matrix representing the density operator of a n-qubit bipartite system AB made of system A (first m < n qubits) and B (remaining n-m qubits). No tutorial nor material on the internet addressed this specific task.

+ +

For simplicity, let us consider a 1-qubit system A and a 2-qubit system B and a density operator of dimension 8x8 representing AB in computational basis.

+ +

More practically in python, let +rhoAB = Qobj=(np.random.rand(8,8)), and assume that this is a valid density operator.

+ +

How should I call entropy_mutual so that I can get this measure between A and B, in particular, regarding the arguments selA and selB? Ideally, I would call something like entopy_mutual(rhoAB, selA=[1], selB=[2,3]) but this not the approach how the function interprets the subsystems and their respective dimensions.

+",11880,,55,,9/15/2021 12:28,9/15/2021 12:28,Using entropy_mutual function in QuTiP,,1,0,,,,CC BY-SA 4.0 +11769,1,11793,,4/30/2020 16:47,,5,201,"

Suppose Alice and Bob can communicate over a quantum channel. The quantum channel is noiseless in the absence of eavesdropping, a condition that cannot be guaranteed. They can also communicate over a classical channel which may be tapped, but not disturbed

+

To communicate securely Alice and Bob will use the BB84 protocol to establish a secret key. In this protocol (like the version outlined in Figure.12.13 of Nielsen & Chuang) there is a point (following step 6) where Alice and Bob have both obtained $2n$ shared bits. In the next step of the protocol, they will ``sacrifice'' $n$ of their secret bits to check for the presence of an eavesdropper. This check consists of Alice and Bob comparing $n$ of their bits for inconsistencies by publicly declaring them over the classical channel. Define an observable error rate $e$ and an error threshold $e_{thresh}$, so that Alice and Bob abort the protocol if they detect $en$ errors for $e>e_{thresh}$, and proceed otherwise. My question is the following:

+

What can we say about the value of $e_{thres}$, in particular at what point can Alice and Bob not establish any secure bits?

+

There are two things that come to mind. First, there is a limit on the number of errors that Alice and Bob can correct. For instance, they could encode their information in an error-correcting code that corrects $t$ errors, and thus if $en>t$ they cannot recover the information. This can also be done classically through the so-called information reconciliation protocol, but I don't understand the limitations of this protocol (so any help on this point would also be appreciated).

+

Secondly, because the quantum channel is noiseless in the absence of an eavesdropper, we know that the error rate is correlated with the amount of information gained by the eavesdropper. Knowing this relationship would enable us to give an error threshold for arbitrary levels of security (i.e we could pick our threshold to ensure that w.h.p the amount of information possessed by the eavesdropper is less than some constant).

+

Edit: In fact, because of the noiseless quantum channel we should be perhaps thinking about the following attack, with prob $1-p$ the eavesdropper measures on the right basis and obtains a bit of information, and with prob $p$ they measure in the wrong basis and cause an error. Given an observable error rate, we should be able to deduce an upper bound on the amount of information obtained by the eavesdropper.

+",11793,,7429,,1/21/2021 17:07,1/21/2021 17:07,"In the BB84 protocol, for what error thresholds can Alice and Bob not establish secure bits?",,1,0,,,,CC BY-SA 4.0 +11770,1,12144,,4/30/2020 18:35,,2,316,"

I am working my through the Strawberry Fields documentation & the section on state teleportation states:

+
+

+
+
+

Here, qumodes $q1$ and $q2$ are initially prepared as (the unphysical) infinitely squeezed vacuum states in momentum and position space respectively,

+
+
+

$\begin{split}&{|0\rangle}_x \sim \lim_{z\rightarrow\infty} S(z){|0\rangle}\\ +&{|0\rangle}_p \sim \lim_{z\rightarrow-\infty} S(z){|0\rangle}=\frac{1}{\sqrt{\pi}}\int_{-\infty}^\infty {|x\rangle}~dx\end{split}$

+
+

Related: Quantum teleportation over continuous variables?

+

Additionally, Constructing finite dimensional codes with optical continuous variables mentions "superpositions of an infinite number of infinitely squeezed states" in the introduction.

+

My primary question is, what is an infinitely squeezed state & how are they used in practice?

+

Additionally, what is meant by unphysical? Does this mean purely mathematical?

+",2645,,45,,12/28/2020 13:21,12/28/2020 13:21,What is infinite squeezing?,,1,4,,,,CC BY-SA 4.0 +11771,1,11781,,4/30/2020 20:17,,7,830,"

An N-qubit stabilizer state is a state that can be produced by starting from the $|0\rangle^{\otimes N}$ state and applying only H, CNOT, and S gates. How many N-qubit stabilizer states are there?

+ +

Because every stabilizer state can be represented as a graph states, which has an edge (or not) between each pair out of N nodes and also one of 24 possible Clifford operations on each node, there are at most $2^{(N^2)} 24^N$ stabilizer states over $N$ qubits. But a stabilizer state can have multiple graph state representations. What's a corresponding lower bound on the stabilizer state count, and what's the exact count?

+",119,,119,,4/30/2020 23:02,9/7/2022 13:10,How many N-qubit stabilizer states are there?,,2,0,,,,CC BY-SA 4.0 +11772,1,11777,,4/30/2020 20:23,,2,223,"

I'm new to using Qiskit Aqua, and I'm trying to get the intermediate values in the VQE algorithm to study the convergence. The documentation mentions an internal callback function, but I can't figure out how to use it. Any help is appreciated.

+",11884,,9006,,4/30/2020 20:58,4/30/2020 21:19,How do I get intermediate values of VQE algorithm using callback?,,1,0,,,,CC BY-SA 4.0 +11777,2,,11772,4/30/2020 21:19,,2,,"

Check out this tutorial notebook https://github.com/Qiskit/qiskit-community-tutorials/blob/master/aqua/vqe_convergence.ipynb which should answer what you need

+",9831,,,,,4/30/2020 21:19,,,,2,,,,CC BY-SA 4.0 +11778,1,11782,,4/30/2020 21:44,,1,234,"

Qiskit allows a user to directly access IBM Q quantum processors (both real ones and simulator). Each user is given a personal code which is entered into source code and serves as a login to the IBM Q platform.

+ +

My question is: Is there a similar possibility in MatLab? In other words, is there any module/code in MatLab allowing to access IBM Q processors?

+",9006,,9006,,4/30/2020 21:50,6/10/2020 17:15,Access IBM Q processors from MatLab,,1,7,,,,CC BY-SA 4.0 +11781,2,,11771,4/30/2020 22:58,,9,,"

There are $S(n) = 2^n \prod_{i=1}^n (2^i + 1)$ $n$-qubit stabilizer states, as per Corollary 21 of D. Gross, Hudson's Theorem for finite-dimensional quantum systems, J. Math. Phys. 47, 122107 (2006).

+ +

Here are some simple-to-state bounds on $S(n)$:

+ +

$2^{(n^2 + 3n)/2} \leq S(n) \leq 3 \cdot 2^{(n^2 + 3n)/2}$

+",11887,,119,,4/30/2020 23:22,4/30/2020 23:22,,,,0,,,,CC BY-SA 4.0 +11782,2,,11778,4/30/2020 23:58,,3,,"

As far as I know, there is no MatLab library for the IBM quantum experience. It may be possible to call Qiskit from Matlab

+",9863,,9863,,6/10/2020 17:15,6/10/2020 17:15,,,,0,,,,CC BY-SA 4.0 +11783,1,11789,,5/1/2020 0:24,,3,1323,"

I come from a CS background

+ +

I was reading Neven and Farhi's paper (""Classification with Quantum Neural Networks on near Term Processors""), and I am trying to implement the subset parity problem using Qiskit, and solve it using a quantum Neural Network.

+ +

There is one thing that doesn't make sense to me though. In the paper, they measure ""the Pauli Y gate on the readout qubit"" (perhaps this phrasing is wrong, as I have to admit that whenever one does not measure in the computational basis, the whole thing doesn't make sense to me anymore). In one of the questions I already asked on this site, I was told that measuring in a basis other than the computational basis is simply the same as applying a matrix to the qubit and then measuring it in a computational basis.

+ +

Through various research, I was able to determine that, for this problem ""to measure the Pauli Y gate the readout qubit"", I had to apply $HS^{\dagger}$ and then measure in the computational basis in order to obtain the same result. It works, but I don't understand why it has to be this matrix in particular (is there any mathematical proof that shows that this is indeed this matrix ?)

+",9407,,55,,5/1/2020 13:51,5/1/2020 13:51,Why can I apply $HS^\dagger$ and then measure in the computational basis to measure $Y$?,,2,0,,,,CC BY-SA 4.0 +11784,1,,,5/1/2020 1:24,,1,285,"

I was using qiskit to generate all of the Bell States. I created the following circuits for each state:

+

$|\Phi^+\rangle :$

+

+

$|\Phi^-\rangle :$

+

+

$|\Psi^+\rangle :$ +

+

$|\Psi^-\rangle :$ +

+

The $|\Psi^\pm\rangle$ states were creating CNOTs with X gates before, that way we have a CNOT that acts when the control qubit is set to zero.

+

When I execute the first 3 circuits in Qiskit, I get the expected state vectors. However, when I execute the last one, I get $\frac{(-|01\rangle + |10\rangle)}{\sqrt{2} }$. I can see that the state vector is $|\Psi^-\rangle$ up to a global phase factor. My question is: Is this a valid method to create Bell States? Or should I stick to the one that uses "normal" CNOT, X and Z?

+",8377,,-1,,6/18/2020 8:31,5/1/2020 1:24,Creating Bell States with CNOT conditioned to the control qubit being set to zero,,0,4,,,,CC BY-SA 4.0 +11786,1,11788,,5/1/2020 2:18,,3,241,"

The Bernstein-Vazirani problem:

+ +
+ +

Let $f$ be a function from bit strings of length $n$ to a single bit,

+ +

$$f: \{ 0, 1\}^n \to \{0, 1\} $$

+ +

thus all input bit strings $x \in \{0,1\}^n$. There exists a secret string $s \in \{0,1\}^n$ such that

+ +

$$ f(x) = x\cdot s$$

+ +

where $\cdot$ denotes the inner product mod 2. Find $s$ by querying $f$ as a few times as possible.

+ +
+ +

This problem can be solved using 1 query using QFT. The algorithm construction only uses an $X$ gate, Hadamard ($H$) gates, and $CNOT$ gates.

+ +
+ +

Now, according to the Gottesman-Knill theorem, quantum algorithms which utilise only the +operations belonging to a certain restricted set (Clifford group $C_n$, which is nothing but the normalizer of the Pauli group $P_n$) are efficiently simulable classically.

+ +

This implies that the quantum circuit we construct including the oracle can be implemented efficiently classically. So why do we say this problem can be solved exponentially faster with a quantum computer?

+ +

I understand that if you want to develop a classical algorithm then you do have to query the oracle $N$ times... but can't we just implement the entire circuit classically in polynomial time based on the Gottesman-Knill theorem.

+ +

What am I missing here? Thank you!

+",9858,,55,,10/12/2020 21:25,10/12/2020 21:25,Speed up in Bernstein-Vazirani algorithm and Gottesman-Knill theorem,,1,0,,,,CC BY-SA 4.0 +11787,1,11790,,5/1/2020 6:19,,2,144,"

I am wondering what is the equivalent to the import bellow in the current version of Qiskit?

+ +
import qiskit.tools.qcvv.tomography as tomography
+
+",10478,,9006,,5/1/2020 6:24,5/1/2020 8:10,Tomography library in Qiskit?,,1,0,,,,CC BY-SA 4.0 +11788,2,,11786,5/1/2020 7:45,,2,,"

There are two different aspects to your question:

+ +

Firstly, nobody should be claiming that you can solve this exponentially faster on a quantum computer. If I evaluate $f(x)$ just $n$ times using $x=1000..0, 01000...0, 00100..0, ... , 00...001$, then each time I find a particular bit value of $s$, and hence I find $s$ with $n$ function calls. This is only polynomially worse than the 1 function call in the quantum algorithm.

+ +

So, yes, the circuit can be classically simulated, meaning that there is a polynomial overhead in the simulation. That polynomial takes the number of calls from 1 to $n$. What this algorithm is trying to show you is that quantum algorithms can give you an improvement. It does not claim exponential improvement (you need to go to Simon's algorithm for that).

+ +

I should, however, mention the second point: that while you list the gates used: $X$, $H$ and cNOT, you leave out a very important ""gate"": the oracle itself. Do you know that if you were to decompose the oracle's function in terms of gates that you could certainly write it in terms of just $X$, $H$ and cNOT? Conventional explanations start from it being a reversible classical circuit, so you can decompose it in terms of Toffoli. But Toffoli is not covered by Gottesman-Knill. So, how do you incorporate the action of the oracle into your simulation?

+",1837,,,,,5/1/2020 7:45,,,,3,,,,CC BY-SA 4.0 +11789,2,,11783,5/1/2020 7:57,,4,,"

Your normal measurement is a pauli-$Z$ measurement. If you apply a unitary $U$ just before measurement, this transforms the $Z$ measurement into $U^\dagger ZU$. So, any $U$ that transforms $U^\dagger ZU=Y$ will do the job. One convenient way of doing this is +$$ +\frac{Y+Z}{\sqrt{2}}, +$$ +but your choice will also work: +$$ +SHZHS^\dagger=SXS^\dagger=-iS^2X=-iZX=Y +$$

+ +

If you want to know why it's the transformation $U^\dagger ZU$, well think about a circuit with input $|\psi\rangle$ that has a unitary $U$ enacted upon it, and then it's measured in the standard basis. The probability of getting the 0 answer is +$$ +|\langle 0|U|\psi\rangle|^2, +$$ +which is the same as the probability that $|\psi\rangle$ is in the state $U^\dagger|0\rangle$. This corresponds to a measurement projector $U^\dagger |0\rangle\langle 0|U$, so you can see that transformation starting to come out.

+",1837,,,,,5/1/2020 7:57,,,,3,,,,CC BY-SA 4.0 +11790,2,,11787,5/1/2020 8:10,,0,,"

The import should be replaced by:

+ +
import qiskit.ignis.verification.tomography as tomo
+
+ +

As documented here

+",10478,,,,,5/1/2020 8:10,,,,0,,,,CC BY-SA 4.0 +11791,2,,11783,5/1/2020 9:44,,3,,"

Measurement in $Y$ basis means that we want to measure is the qubit in $|+i\rangle$ state or $|-i\rangle$ state which are eigenbasis vectors for $Y$ gate. Because they are eigenbasis vectors we can express any $|\psi_1 \rangle$ state in this form:

+ +

$$| \psi_1 \rangle = \alpha_{+i} |+i\rangle + \alpha_{-i} |-i\rangle$$

+ +

where $|\alpha_{+i}|^2$ is the probability of measuring $|+i\rangle$ state and $|\alpha_{-i}|^2$ is the probability of measuring $|-i\rangle$. And

+ +

\begin{equation} +|+i\rangle = |0\rangle + i |1\rangle +\qquad +|-i\rangle = |0\rangle - i |1\rangle +\end{equation}

+ +

Now when we apply $HS^{\dagger}$ to $|\psi_1 \rangle$ state, we will obtain:

+ +

$$| \psi_2 \rangle = \alpha_{+i} |0\rangle + \alpha_{-i} |1\rangle$$

+ +

Then, with $|\alpha_{+i}|^2$ we will measure $|0\rangle$ (the same probability that we had for $|+i \rangle$ measurment in the initial $|\psi_1\rangle$), and with with $|\alpha_{-i}|^2$ we will measure $|1\rangle$ (the same probability that we had for $| -i \rangle$ measurment in the initial $|\psi_1\rangle$). For any gate that will do $U |+i\rangle = e^{i \varphi_1} |0\rangle$ and $U |-i\rangle = e^{i \varphi_2}|1\rangle$ mapping (where $\varphi_1$ and $\varphi_2$ are some phases that will not have any influence on probabilities), we will have this correspondence. For example, if I understand this Riggeti's code right, they are doing $Y$ basis measurement by applying firstly $U = R_x(\pi /2)$ gate that maps $R_x(\pi /2) |+i\rangle = |0\rangle$ and $R_x(\pi /2) |-i\rangle = -i|1\rangle$.

+ +

The other thing is to measure the expectation value of $Y$ operator:

+ +

$$\langle \psi_1 | Y | \psi_1 \rangle = |\alpha_{+i}|^2 - |\alpha_{-i}|^2$$

+ +

that can easily be calculated after enough measurements in the $Y$ basis. Here we took into accout that $Y|+i\rangle = (+1)|+i\rangle$ and $Y|-i\rangle = (-1)|-i\rangle$. $|\alpha_{+i}|^2 = \frac{N_{+i}}{N}$ and $|\alpha_{-i}|^2 = \frac{N_{-i}}{N}$, where $N$ is the number of measurements, $N_{+i}$ is the number of $| +i \rangle$ measurements, and $N_{-i}$ is the number of $| -i \rangle$ measurements.

+ +

I guess in the paper they mean expectation value of $Y$ operator, not just one simple measurement in the $Y$ basis, because of this line ""Our predicted label value is the real number between $−1$ and $1$... which is the average of the observed outcomes if $Y_{n+1}$ is measured in multiple copies of..."".

+",9459,,9459,,5/1/2020 10:06,5/1/2020 10:06,,,,1,,,,CC BY-SA 4.0 +11792,2,,9597,5/1/2020 15:05,,2,,"

Elitzur and Vaidman showed in 1993 that a single qubit in superposition can be used to detect the presence or absence of a bomb without the bomb necessarily going off!

+

I also really like O'Donnell's lecture on the Elitzur-Vaidman bomb tester here. With the naïve experiment, there is a 50% chance that the bomb will still go off; O'Donnell describes the improvement of Kwiat, Weinfurter, and Zeilinger that they call "Quantum Seeing in the Dark" - pdf link to SciAm paper - where the same qubit is rotated by $\epsilon$ degrees for $n$ times and the probability that the bomb is present and yet still goes off decreases as $\epsilon^2$ .

+",2927,,2927,,10/14/2022 0:03,10/14/2022 0:03,,,,0,,,,CC BY-SA 4.0 +11793,2,,11769,5/1/2020 15:25,,1,,"

As far as I know, the error threshold depends on the security proof. Meaning, BB84 has different security proofs, each with different assumptions, resulting in different security threshold. The 'optimal' bound is the one that has the best 'error-rate'. Meaning, what is the highest noise(error) that can be tolerated, and still, the protocol can be proved secure. The best such bound I know is 11%.

+",2403,,,,,5/1/2020 15:25,,,,0,,,,CC BY-SA 4.0 +11794,1,,,5/1/2020 15:45,,3,71,"

An interesting optimization of Grover's quantum algorithm is discussed in Sysoev's paper:

+ +

Reference paper 

+ +

We use the usual notation.  $N = 2^n$ ,  the number of all possible n-bit strings . The oracle  $U_\omega$ can be put in the form  

+ +

$U_\omega=I - 2  (\vert\omega\rangle\langle\omega \vert )$

+ +

$U_\omega$ is a reflection of any vector on the hyperplane orthogonal to $\vert\omega\rangle$

+ +

The vector $\vert s \rangle $ and operator $U_s$ are introduced. 

+ +

$\vert s \rangle = H \vert 0 \rangle^n$ , where H is the n-qubit Hadamard transform. 

+ +

Operator $U_s$ reflects any vector with respect to $\vert s \rangle$

+ +

$U_s = 2\vert s \rangle \langle s \vert - I$    

+ +

The Grover iteration is $U_{Grover} = U_s U_\omega$

+ +

$U_{Grover}$ rotates (at every iteration) the initial vector $\vert s \rangle$ towards the desired vector $\vert\omega\rangle$ by the angle $2\theta$, where $sin\theta =  \frac{1}{\sqrt{N}}$

+ +

We note that a reflection is expressed by a unitary matrix, so if we know the algebraic form of a vector $\vert\zeta\rangle$ then we can physically construct the quantum circuit that implements the operator $U_\zeta$ which reflects any vector with respect to $\vert\zeta\rangle$ .

+ +

We consider then the following modified Grover algorithm,  following  Sysoev,  but not exactly.

+ +

Step 1

+ +

$\vert \zeta_1 \rangle  = U_s U_\omega \vert s \rangle$ 

+ +

Use the constructed  quantum circuit implementing the operator:

+ +

$U_{\zeta_1} = 2\vert\zeta_1\rangle\langle\zeta_1\vert - I$

+ +

Step 2

+ +

$\vert \zeta_2 \rangle  = U_{\zeta_1} U_\omega \vert {\zeta_1} \rangle$ 

+ +

Use the constructed  quantum circuit implementing the operator:

+ +

$U_{\zeta_2} = 2\vert\zeta_2\rangle\langle\zeta_2\vert - I$

+ +

Step 3

+ +

$\vert \zeta_3 \rangle  = U_{\zeta_2} U_\omega \vert {\zeta_2} \rangle$ 

+ +

Use the constructed  quantum circuit implementing the operator 

+ +

$U_{\zeta_3} = 2\vert\zeta_3\rangle\langle\zeta_3\vert - I$

+ +

................................and so on..........

+ +

Step $[log_2 N] $(approximately in a neighborhood of n  where we stop,  see note below).

+ +

$\vert \zeta_n \rangle  = U_{\zeta_{n-1}} U_\omega \vert \zeta_{n-1} \rangle$ 

+ +

Measurement and stop.

+ +

So at each step, the current vector is reflected on the hyperplane orthogonal to $\vert\omega\rangle$ and then we further reflect this reflection with respect to the current vector itself.

+ +

The algorithm rotates the initial vector $\vert s \rangle$ towards the solution following the sequence:

+ +

$\theta  , 3\theta, 9\theta , .......3^k \theta$ .....

+ +

The optimal stopping time will be in a neighborhood of $[log_2 N]$ steps, so after about n steps. The exact number can be calculated. So we can run the algorithm several times, each time stopping at random after a number of steps  in a neighborhood of  $[log_2 N]$. The probability of getting very close to the target vector $\vert\omega\rangle$ becomes sufficiently high.

+ +

Note that Sysoev wants to construct a universal quantum circuit that would also take as input the vector determining the reflection axis. I don't know if such a quantum circuit can be constructed, it might be impossible.  But we can construct in advance all the quantum circuits implementing the operators  $U_{\zeta_k}$  for $k \in \{1, 2, 3, ...., [log_2 N]\}$ and run the quantum algorithm.  If we construct these quantum circuits for N sufficiently large (for a large number n of qubits), then most of the NP complete problems of interest can be solved efficiently, basically in  linear time.  We could also consider other sequences of reflections and axes of reflection, a lot depends on the arithmetic modulo $[\sqrt N]$ for a chosen N.

+ +

Question.  Assuming  that eventuality quantum circuits with a large number of qubits will become reliable and feasible,  are there any major flaws in my reasoning, in principle?

+ +

In his original paper Grover gives a proof of optimality of his algorithm, but certain assumptions in his proof of optimality are not satisfied by the algorithm described here. So the question is, could this exponential speedup of Grover's algorithm be possible in principle?

+ +

Edit 1 We consider the operator U defined by the relation:

+ +

$U(\vert x \rangle , \vert y \rangle ) = ( \vert x \rangle , U_x \vert y \rangle) $ , where $U_x \vert y \rangle$ represents the reflection of $\vert y \rangle$ with respect to $\vert x \rangle$

+ +

We have then the relations:

+ +

$U(\vert s \rangle , U_\omega\vert s \rangle ) = (\vert s \rangle , U_sU_\omega \vert s \rangle) = (\vert s \rangle , \vert \zeta_1 \rangle )$

+ +

$U(\vert \zeta_1 \rangle , U_\omega\vert \zeta_1 \rangle ) = (\vert \zeta_1 \rangle , U_{\zeta_1}U_\omega \vert \zeta_1 \rangle) = (\vert \zeta_1 \rangle , \vert \zeta_2 \rangle )$

+ +

$U(\vert \zeta_2 \rangle , U_\omega\vert \zeta_2 \rangle ) = (\vert \zeta_2 \rangle , U_{\zeta_2}U_\omega \vert \zeta_2 \rangle) = (\vert \zeta_2 \rangle , \vert \zeta_3 \rangle )$

+ +

.......................and so on..........................

+ +

$U(\vert \zeta_{n-1} \rangle , U_\omega\vert \zeta_{n-1} \rangle ) = (\vert \zeta_{n-1} \rangle , U_{\zeta_{n-1}}U_\omega \vert \zeta_{n-1} \rangle) = (\vert \zeta_{n-1} \rangle , \vert \zeta_n \rangle )$

+ +

That means that we only have to design one quantum circuit, associated to the operator U. Note that this Grover-Sysoev iteration (as I would call it) is a bit more complicated than the original Grover iteration, but in principle possible to implement. Well, we have to be careful so that this type of iteration doesn't enter into conflict with the no - cloning theorem.

+ +

Another possibility is the following (state $\vert s \rangle$ is known):

+ +

$U(\vert s \rangle , U_\omega\vert s \rangle ) = (\vert s \rangle , U_sU_\omega \vert s \rangle) = (\vert s \rangle , \vert \xi_1 \rangle )$

+ +

$U(\vert \xi_1 \rangle , U_\omega\vert s \rangle ) = (\vert \xi_1 \rangle , U_{\xi_1}U_\omega \vert s \rangle) = (\vert \xi_1 \rangle , \vert \xi_2 \rangle )$

+ +

$U(\vert \xi_2 \rangle , U_\omega\vert s \rangle ) = (\vert \xi_2 \rangle , U_{\xi_2}U_\omega \vert s \rangle) = (\vert \xi_2 \rangle , \vert \xi_3 \rangle )$

+ +

.......................and so on..........................

+ +

$U(\vert \xi_{n-1} \rangle , U_\omega\vert s \rangle ) = (\vert \xi_{n-1} \rangle , U_{\xi_{n-1}}U_\omega \vert s \rangle) = (\vert \xi_{n-1} \rangle , \vert \xi_n \rangle )$

+ +

In other words, the vector to be reflected is fixed but the reflection axis is variable (in the original Grover algorithm it's the other way around ).

+ +

Anyway, my impression is that the implementation of a quantum algorithm with an exponential speedup (compared to Grover's algorithm ) is possible. That's what this question is all about.

+ +

Edit 2. Unfortunately nothing from what I tried seems to work. You need a quantum circuit that takes as input the vector to be reflected and the vector that represents the reflection axis. The output of the quantum circuit must contain the reflected vector. That does not seem possible, as far as I understand. This reflection implementation problem, if ever solved, would lead to an exponential speedup of Grover's algorithm.

+",10110,,10110,,5/9/2020 7:27,5/9/2020 7:27,A question about Sysoev's extension of Grover's algorithm,,0,0,0,,,CC BY-SA 4.0 +11795,2,,11768,5/1/2020 16:38,,1,,"

Best to look at the source code when the documentation isn't helpful enough. The definition of entropy_mutual is

+ +
def entropy_mutual(rho, selA, selB, base=e, sparse=False):
+    """"""
+    Calculates the mutual information S(A:B) between selection
+    components of a system density matrix.
+
+    Parameters
+    ----------
+    rho : qobj
+        Density matrix for composite quantum systems
+    selA : int/list
+        `int` or `list` of first selected density matrix components.
+    selB : int/list
+        `int` or `list` of second selected density matrix components.
+    base : {e,2}
+        Base of logarithm.
+    sparse : {False,True}
+        Use sparse eigensolver.
+
+    Returns
+    -------
+    ent_mut : float
+       Mutual information between selected components.
+
+    """"""
+    if isinstance(selA, int):
+        selA = [selA]
+    if isinstance(selB, int):
+        selB = [selB]
+    if rho.type != 'oper':
+        raise TypeError(""Input must be a density matrix."")
+    if (len(selA) + len(selB)) != len(rho.dims[0]):
+        raise TypeError(""Number of selected components must match "" +
+                        ""total number."")
+
+    rhoA = ptrace(rho, selA)
+    rhoB = ptrace(rho, selB)
+    out = (entropy_vn(rhoA, base, sparse=sparse) +
+           entropy_vn(rhoB, base, sparse=sparse) -
+           entropy_vn(rho, base, sparse=sparse))
+    return out
+
+ +

So we see selA and selB are passed as arguments to compute the partial trace. I am not too familiar with qutip but here is an example computing $S(A:B)$ for $\rho_{AB}$ where $A$ is a qubit system and $B$ is a two-qubit system.

+ +
import qutip as qtp
+# note there is a rand_dm function
+# We should also let qutip know how are systems are partitioned
+# This is so it knows how to correctly compute the partial trace
+rho = qtp.rand_dm(8, dims=[[2,4],[2,4]])
+qtp.entropy_mutual(rho,0,1)
+
+ +

With the above example we could also specify the second system as two-qubits instead of a four dimensional system i.e.

+ +
rho = qtp.rand_dm(8, dims=[[2,2,2],[2,2,2]])
+qtp.entropy_mutual(rho,0,[1,2])
+
+",9854,,,,,5/1/2020 16:38,,,,1,,,,CC BY-SA 4.0 +11796,1,,,5/1/2020 19:08,,9,216,"

I've seen a lot of excitement in the popular press about the computers made by D-Wave Systems, but when I dig deep the only practical things that I can figure out that one can do with the computer are variations of:

+ +
    +
  • Train one's staff in the use of quantum computers.
  • +
  • Write papers about what you can do with a quantum computer.
  • +
  • Explore quantum algorithms.
  • +
+ +

That is, these aren't even research machines---they are exploratory machines for what kind of research we would do if we had larger machines.

+ +

Am I mistaken? Is there any ""quantum advantage"" to be had from these machines---that is, a computation that can be done more cost effectively than with conventional computers?

+",9482,,,,,12/14/2020 2:00,Is there quantum advantage to be had with a D-Wave computer in 2020?,,3,0,,,,CC BY-SA 4.0 +11797,1,11825,,5/1/2020 21:36,,2,263,"

$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$Given a mixed state $\rho = \sum p_k \rho_k$ that is an statistical emsemble, where each ""state"" $\rho_k$ on the upper half of the Bloch sphere

+ +

$\hskip3in$

+ +

appears with equal probability. The states don't lie on the surface of the Bloch sphere but at a radius of $1/{2\pi}$, such that the sum, which, in the continous case turns out to be an integral, properly works out. So the $\rho_k$ are not pure states!

+ +

If I now measure the system in the computational basis, I'll get $\ket0$ in 100% of the cases. So I would assume the state is a pure one, but is it?

+ +

We might need infinitely many states $\rho_k$, but maybe a big number is enough to get a good aprroximation. +Or did I miss something else?

+",5280,,55,,6/4/2020 15:03,6/4/2020 15:03,Is my $|0\rangle$ state mixed or pure?,,2,7,,,,CC BY-SA 4.0 +11798,2,,11796,5/1/2020 21:44,,1,,"

It is true that quantum computing is still emerging technology, howvever, it seems that D-Wave will come to practical usage sooner than universal quantum computers such as IBM Quantum Experience. The reason is that D-Wave provides simpler single purpose computers focusing mainly on optimization.

+ +

See for example these links for near to practice application of D-Wave:

+ +
    +
  • Lockheed Martin application of D-Wave for source code verification and mistakes identification
  • +
  • Volksvagen used D-Wave for traffic flow optimization in Beijing
  • +
+ +

Other applications seems more or less experimental, for example NASA partnership with D-Wave.

+ +

What is interesting is a usage of D-Wave by Los Alamos National Laboratory. It seems that army research is interested in the quantum annealers which can be significant for further development (mainly in terms of financing).

+",9006,,,,,5/1/2020 21:44,,,,0,,,,CC BY-SA 4.0 +11799,2,,11398,5/1/2020 22:19,,2,,"

Instead of saving the information of a single comparison into a y qubit, you can use a controlled adder. Instead of $n$ y qubits you would only need $\log_2 n$.

+",5280,,,,,5/1/2020 22:19,,,,2,,,,CC BY-SA 4.0 +11800,2,,9918,5/1/2020 22:21,,0,,"

There is

+ +
+

A Polynomial Quantum Algorithm for Approximating the Jones Polynomial

+
+ +

For simple knots, you can do that with 2 qubits...

+",5280,,5280,,5/2/2020 22:10,5/2/2020 22:10,,,,1,,,,CC BY-SA 4.0 +11801,1,,,5/2/2020 0:11,,3,53,"

In this excellently answered question 'How are gates implemented in a continuous-variable quantum computer?' the typical gates for CV quantum computing were listed and described. In particular for almost all the gates there is a description of their resulting effects on the quadrature position ($X$) and momentum ($P$).

+ +

The exception is with the action of the Kerr hamiltonian (whose action is also not described explicitely on the quadratures in the original paper by Lloyd either). There is likely a reason for this but all the same my question is:

+ +

What is the action of the Kerr hamiltonian, or a non linear equivalent like the cubic gate, on the quadratures (in the sense that the translation with P sends $x$ to $x+t$ or the squeeze gate $x$ to $xe^t$ etc)?

+",11896,,11896,,5/3/2020 19:43,5/3/2020 19:43,What is the explicit action of the non-linear gate in CV quantum computing on the quadratures?,,0,1,,,,CC BY-SA 4.0 +11802,2,,9918,5/2/2020 8:11,,1,,"

Stephan Jordan maintains a very comprehensive list of quantum algorithms on https://quantumalgorithmzoo.org/. Now that you have worked on some famous ones, you can consider veering off a bit. Take a look at the ""Algorithm: Machine Learning"" consolidation section. There are for instance single-qubit and two-qubit classifiers that could be interesting. In particular, the ""Quantum enhanced feature space"" classifier that was published in nature last year can be done on 2 qubits (https://arxiv.org/abs/1804.11326).

+",2794,,,,,5/2/2020 8:11,,,,0,,,,CC BY-SA 4.0 +11803,2,,11760,5/2/2020 8:19,,1,,"

Instead of combining Tensorflow and Qiskit, you can use the Tensorflow Quantum package. It provides seamless integration of quantum simulation in the tensorflow framework. You can build layered approaches as you would with classical neural networks, and use the standard loss functions and optimizers that you might be used to.

+ +

A tutorial on how to build a QNN using Tensorflow Quantum for MNIST (recognize hand-written digits) is available at https://www.tensorflow.org/quantum/tutorials/mnist.

+",2794,,,,,5/2/2020 8:19,,,,0,,,,CC BY-SA 4.0 +11804,1,11805,,5/2/2020 14:09,,2,250,"

A QuantumCircuit() command creates a qubit with zero state always.

+ +

I've seen some instructions about using Arbitrary Initialization but it is not accessible and returns 404 error.

+",11906,,9006,,5/2/2020 16:41,5/2/2020 16:41,How to create a qubit in arbitrary state in qiskit,,1,1,,,,CC BY-SA 4.0 +11805,2,,11804,5/2/2020 14:37,,3,,"

Any one-qubit state can be described as (up to a global phase):

+ +

$$|\psi \rangle = \cos \left(\frac{\theta}{2} \right)|0\rangle + \sin \left(\frac{\theta}{2} \right) e^{i\varphi}|1\rangle$$

+ +

If we start from $|0\rangle$ state arbitrary quantum state can be generated (up to a global phase) with $R_y(\theta)$ and $R_z(\varphi)$ unitary operators (the order is important). Firstly we apply $R_y(\theta)$

+ +

$$R_y(\theta) |0\rangle = \cos \left( \frac{\theta}{2} \right)|0\rangle + \sin \left( \frac{\theta}{2}\right)|1\rangle$$

+ +

Then $R_z(\varphi)$

+ +

$$R_z(\varphi) \left(\cos\left(\frac{\theta}{2}\right)|0\rangle + \sin\left(\frac{\theta}{2} \right)|1\rangle \right) = \cos\left(\frac{\theta}{2}\right)e^{-i\frac{\varphi}{2}}|0\rangle + \sin\left(\frac{\theta}{2}\right)e^{i\frac{\varphi}{2}}|1\rangle$$

+ +

Disregarding the global phase we will obtain the following state:

+ +

$$|\psi \rangle = \cos\left(\frac{\theta}{2}\right)|0\rangle + \sin\left(\frac{\theta}{2}\right)e^{i\varphi}|1\rangle$$

+ +

That is an arbitrary state that we wanted to create. There are also other ways (gates) to this transformation.

+ +

The code will look like this:

+ +
circuit.ry(theta, qubit[0])
+circuit.rz(phi, qubit[0])
+
+ +

It can also be done only with one $u3(\theta, \varphi, 0)$ gate:

+ +

$$u3(\theta, \varphi, 0) |0\rangle = \cos\left(\frac{\theta}{2}\right)|0\rangle + \sin\left(\frac{\theta}{2}\right)e^{i\varphi}|1\rangle$$

+ +
circuit.u3(theta, phi, 0, qubit[0])
+
+",9459,,9459,,5/2/2020 14:49,5/2/2020 14:49,,,,0,,,,CC BY-SA 4.0 +11806,1,11814,,5/2/2020 15:01,,11,1301,"

I'm struggling with the framework for quantum process tomography on Qiskit.

+ +

The final step of such a framework is running fit method of ProcessTomographyFitter class. Documentation states that such function gives a Choi matrix as output. Nevertheless, I'd want the Chi matrix to define the superoperator of a circuit. Specifically, I'm interested in understanding how a 2-qubit circuit affects a single qubit.

+ +

Thus, my questions are:

+ +
    +
  • What is the relationship between Choi and Chi matrix?
  • +
  • When do they coincide?
  • +
  • How to obtain Chi from Choi matrix?
  • +
+",8954,,55,,5/5/2021 18:24,2/2/2022 12:20,What is the relationship between Choi and Chi matrix in Qiskit?,,1,3,,,,CC BY-SA 4.0 +11807,1,11808,,5/2/2020 16:03,,1,102,"

I'm studying Mark Wilde's ""Quantum Information Theory"" and the author sometimes use the inequality $\mathrm{Tr}(\prod_\mathcal{H'}Y) \leq \mathrm{Tr}(Y)$ where $Y\in \mathcal{H}'$ is a density matrix and $\prod_\mathcal{H'}=V^{\dagger}V$ with isometry $V: \mathcal{H} \rightarrow \mathcal{H}'$. As far as I know, this inequality does not hold for general matrix $Y$. So I tried to prove the inequality using the positive semi-definite condition of $Y$, but I cannot grasp any clue. Does the inequality really holds? And if it does, how can I prove it? I appreciate any help.

+",11510,,5280,,5/3/2020 11:09,5/3/2020 11:09,Projection is trace-decreasing?,,1,0,,,,CC BY-SA 4.0 +11808,2,,11807,5/2/2020 16:43,,3,,"

Hint: Write $\Pi_{\mathcal H'}=\sum \lambda_i|i\rangle\langle i|$ in an eigenbasis $|i\rangle$, with $\lambda_i=0,1$. Then use that the trace is cyclic, and $\langle i|Y|i\rangle\ge0$.

+ +

(Note that the inequality cannot hold for a general matrix: If it holds for $Y=Y_0$, it cannot hold for $Y=-Y_0$.)

+",491,,,,,5/2/2020 16:43,,,,1,,,,CC BY-SA 4.0 +11809,2,,11741,5/2/2020 17:08,,1,,"

If you iterate over the circuit data as in Gadi A's answer, and use gate.qasm(), then you get the gate printed in concise format with all the relevant parameters.

+ +
for gate in circuit.data:
+    print(gate[0].qasm())
+
+",11908,,,,,5/2/2020 17:08,,,,0,,,,CC BY-SA 4.0 +11810,1,11815,,5/2/2020 17:21,,3,174,"

I am referring to the MS Quantum Katas, Measurements, 2.3 Peres/Wooters game +I have big problems to understand the solution. +The task is defined as:

+ +

--begin

+ +

Input: A qubit which is guaranteed to be in one of the three states:

+ +
    +
  • $|A\rangle = \frac{1}{\sqrt{2}} \big( |0\rangle + |1\rangle \big)$,
  • +
  • $|B\rangle = \frac{1}{\sqrt{2}} \big( |0\rangle + \omega |1\rangle \big)$,
  • +
  • $|C\rangle = \frac{1}{\sqrt{2}} \big( |0\rangle + \omega^2 |1\rangle \big)$,
  • +
+ +

Here $\omega = e^{2i \pi/ 3}$.

+ +

Output:

+ +
    +
  • 1 or 2 if the qubit was in the $|A\rangle$ state,
  • +
  • 0 or 2 if the qubit was in the $|B\rangle$ state,
  • +
  • 0 or 1 if the qubit was in the $|C\rangle$ state.
  • +
+ +

You are never allowed to give an incorrect answer. Your solution will be called multiple times, with one of the states picked with equal probability every time.

+ +

The state of the qubit at the end of the operation does not matter.

+ +

--end

+ +

The solution is described as:

+ +

Solution

+ +
+

The task is a simple game inspired by a quantum detection problem due to Holevo[1] and Peres/Wootters[2]. In the game, a player A thinks of a number (0,1 or 2) and the opponent, player B, tries to guess any number but the one chosen by player A.

+ +

Classically, if you just made a guess, you'd have to ask two questions to be right $100\%$ of the time. If instead, player A prepares a qubit with 0, 1, or 2 encoded into three single qubit states that are at an angle of 120 degrees with respect to each other and then hands the state to the opponent, then player B can apply a Positive Operator Valued Measure (POVM) consisting of 3 states that are perpendicular to the states chosen by player A. + It can be shown that this allows B to be right $100\%$ of the time with only 1 measurement, which is something that is not achievable with a von Neumann measurement on 1 qubit. + See also Peres[3, chapter 9.6] for a nice description of the optimal POVM.

+
+ +

Next, we address how we can implement the mentioned POVM by way of a von Neumann measurement, and then how to implement said von Neumann measurement in Q#. First, we note that the POVM elements are given by the columns of the following matrix:

+ +

$$M = \frac{1}{\sqrt{2}}\left(\begin{array}{rrr} +1 & 1 & 1 \\ +1 & \omega & \omega^2 +\end{array} +\right)$$

+ +

where $\omega = e^{2 \pi i/3}$ denotes a primitive $3$rd root of unity. Our task will be to implement the rank 1 POVM given by the columns of $M$ via a von Neumann measurement. This can be done by ""embedding"" $M$ into a larger unitary matrix (taking complex conjugates and transposed):

+ +

$$M' = \frac{1}{\sqrt{2}}\left(\begin{array}{cccc} +1 & -1 & 1 & 0 \\ +1 & -\omega^2 & \omega & 0 \\ +1 & -\omega & \omega^2 & 0 \\ +0 & 0 & 0 & -i +\end{array} +\right)$$

+ +

Notice that applying $M'$ to input states given by column $i$ of $M$ (padded with two zeros to make it a vector of length $4$), where $i=0, 1, 2$ will never return the label $i$ as the corresponding vectors are perpendicular.

+ +

We are therefore left with the problem of implementing $M'$ as a sequence of elementary quantum gates. Notice that

+ +

$$M' \cdot {\rm diag}(1,-1,1,-1) = M' \cdot (\mathbf{1}_2 \otimes Z) = +\frac{1}{\sqrt{2}}\left(\begin{array}{cccc} +1 & 1 & 1 & 0 \\ +1 & \omega^2 & \omega & 0 \\ +1 & \omega & \omega^2 & 0 \\ +0 & 0 & 0 & i +\end{array} +\right)$$

+ +

...
+--end

+ +

I have several questions / problems here.

+ +
    +
  1. What exactly is a ""von-Neumann"" measurement? Is it just a measurement in the standard basis?

  2. +
  3. I understand how to get M:
    +A POVM M with ${E_0, E_1, E_2}, E_k = |\psi_k\rangle\langle\psi_k|, |\psi_k\rangle=1/sqrt(2)(|0\rangle+\omega^k|1\rangle)$ results in $M=(\psi_0 \psi_1 \psi_2) = \frac{1}{\sqrt{2}}\left(\begin{array}{rrr} 1 & 1 & 1 \\ 1 & \omega & \omega^2 \end{array}\right)$

  4. +
+ +

Next step is

+ +
+

Our task will be to implement the rank 1 POVM given by the columns of M via a von Neumann measurement. This can be done by ""embedding"" M into a larger unitary matrix (taking complex conjugates and transposed)

+
+ +

What does this embedding mean exactly, what is the math behind? +I only found one article about ""Emdedded Transforms"" (https://books.google.de/books?id=pefvCAAAQBAJ&pg=PA104&lpg=PA104&dq=embedding+matrix+into+larger+unitary+matrix&source=bl&ots=2apFdXFYNd&sig=ACfU3U3JCtj7GgJimx5cgCcKE_FrMUx_4Q&hl=de&sa=X&ved=2ahUKEwjo-K3EipHpAhW8UxUIHVuyDtYQ6AEwCXoECAgQAQ#v=onepage&q=embedding%20matrix%20into%20larger%20unitary%20matrix&f=false), but this is valid only for square matrices.

+ +
    +
  1. The next step in the solution is:
  2. +
+ +
+

Notice that applying $M'$ to input states given by column $i$ of $M$ (padded with two zeros to make it a vector of length $4$), where $i=0, 1, 2$ will never return the label $i$ as the corresponding vectors are perpendicular. + We are therefore left with the problem of implementing $M'$ as a sequence of elementary quantum gates.

+
+ +

What does this mean? I don't understand the sense of this.

+ +

Thanks in advance, +Markus

+",11909,,9006,,5/2/2020 21:16,5/4/2020 7:13,MS Quantum Katas - Measurements Task 2.3 - problems in understanding the solution,,1,4,,,,CC BY-SA 4.0 +11812,1,,,5/2/2020 18:21,,4,781,"

I am referring to the article Advanced Topics in Quantum Information Theory exercise 4 and to the MS Quantum Kata MS-Quantum-Kata which describes a solution for the Mermin–Peres Magic Square Game. +I could follow the article and do all the maths for myself until the end of the article. +Unfortunately the article ends with

+
+

... Following the hint, we consider two maximally entangled states shared between Alice and Bob:$$|Ψ〉_{AB}=1/√2(|00〉_{A_1B_1}+|11〉_{A_1B_1})⊗1/√2(|00〉_{A_2B_2}+|11〉_{A_2B_2})$$ +It is then easy to check by using $$1/√2(|00〉+|11〉) =1/√2(|\phi^x_0\phi^x_0〉+|\phi^x_1\phi^x_1〉) =1/√2(|\phi^y_0\phi^y_1〉+|\phi^y_1\phi^y_0〉)$$ where $|0,1〉$ are the eigenvectors of $σ_z$ and where $|φ^{x,y}_j〉$ denote the eigenvectors of $σ_x$ and $σ_y$ as in the solution to the last exercise (with eigenvalues ±1 each), that the compatibility condition is indeed satisfied.

+
+

Unfortunately for me it is not easy to check, I spent multiple nights to try this, but I don't get it done.

+
    +
  1. Can anyone show me how this check looks like? What is the math behind it?
  2. +
  3. The algorithm states that Alice (and Bob) are performing multiple measurements on their qubits for all observables $M_{x,y}$ in her row (in his column).
    I don't understand why this makes sense: After the first measurement the quantum state has collapsed (or could have at least), why does it make sense to do additional measurements? +I know there is something called "phase kick-back" that kicks the phase into the control bit if I use "Controlled Operations", is that something that is used here? How exactly?
  4. +
  5. Is "Phase Kickback" only a mathematical trick or do physical systems really behave like this? Is there an easy to understand sample maybe, for a non-physic, non-mathematic guy (just a software dev)?
  6. +
+

Thanks a lot for any help or hints.

+",11909,,55,,3/21/2022 13:35,3/21/2022 13:35,"Problems in understanding the solution for ""Mermin–Peres Magic Square Game""",,1,2,,,,CC BY-SA 4.0 +11813,2,,9918,5/2/2020 18:37,,1,,"

This is not an full answer to your question. But I am very interested in how did you build your own 2-qubit device, as I am thinking about such a project for some months now. Would you mind to get in touch with me and exchange our thoughts on this? +I would really love to get into discussions with you, maybe you could support me to build my own device?

+ +

Regarding your questions, there are a lot of tasks in the MS Quantum Kata series, that only work with one or two qubits, maybe you'll like some of them, e.g.

+ +

https://github.com/microsoft/QuantumKatas/tree/master/CHSHGame

+ +

https://github.com/microsoft/QuantumKatas/tree/master/Superposition - Hardy-State

+",11909,,9006,,5/2/2020 21:21,5/2/2020 21:21,,,,2,,,,CC BY-SA 4.0 +11814,2,,11806,5/2/2020 18:43,,11,,"

( 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 found in this previous answer by Norbert Schuch. Consider the maximally entangled state $|\Omega \rangle = \sum_{\mathrm{i}}|\mathrm{i}\rangle \otimes |\mathrm{i}\rangle$, where $\{|\mathrm{i}\rangle\}$ forms a basis for the space on which $\rho$ acts. (Note that we thus have a maximally entangled state of twice as many qubits). +The Choi matrix is the state that we get when on one of these subsystems $\Lambda$ is applied (leaving the other subsystem intact): +\begin{equation} +\rho_{\mathrm{Choi}} = \big(\Lambda \otimes I\big) |\Omega\rangle\langle\Omega|. +\end{equation} +As the Choi matrix is a state, it must be positive semidefinite (corresonding the the CP constraint) and must have unit trace (necessary but not sufficient for the TP constraint).

+

The process- or $\chi$-matrix comes from the fact that we can write our map as a double sum: +\begin{equation} +\Lambda(\rho) = \sum_{m,n} \chi_{mn}P_{m}\rho P_{n}^{\dagger}, +\end{equation} +where $\{P_{m}\}$ & $\{P_{n}\}$ form a basis for the space of density matrices; we use the Pauli basis $\{I,X,Y,Z\}^{\otimes n}$ (thereby omitting the need for the $\dagger$ at $P_{n}$). The matrix $\chi$ now encapsulates all information of $\Lambda$; the CP constraint reads that $\chi$ must be positive semidefinite, and the trace constraint reads that $\sum_{m,n}\chi_{mn}P_{n}P_{m} \leq I$ (with equality for TP).

+

Computing one from another

+

From this, we get the following two identities: +\begin{equation} +\begin{split} +\rho_{\mathrm{Choi}} &= \sum_{m,n} \chi_{m,n} |P_{m}\rangle\rangle\langle\langle P_{n}|, \\ +\chi_{m,n} &= \langle\langle P_{m} | \rho_{\mathrm{Choi}} |P_{n}\rangle\rangle, +\end{split} +\end{equation} +where $|P_{m}\rangle\rangle$ is the 'vectorized' version of $P_{m}$, which is essentially just the columns of $P_{m}$ stacked on top of each other, giving a vector. That answers question 3.

+

Again I shamelessly 'self-promote': in the first appendix of my thesis I work through proofs of all these relations. The most intuitive way is by using the Kraus decomposition as an intermediary, but it is not needed.

+

Relationship between the two

+

From this, you can see that the Choi matrix and the chi matrix do indeed have some relationship. In fact, by choosing either the (qubit)-basis in which we express the Choi matrix, or choosing the (operator)-basis that we associate with the $\chi$-matrix, they can be one and the same.

+

As @AdamZalcman has pointed out in his comment (Thank you!), from the identity $\chi_{m,n} = \langle \langle P_{m}|\rho_{\mathrm{Choi}}| P_{n}\rangle\rangle$ we can choose the $P_{m/n}$ so that we just select the $m$-th row and $n$-th column of $\rho_{\mathrm{Choi}}$. This works if $P_{k} = |i\rangle \langle j|$, with $k = id + j$. Since both $i$ and $j$ run from $0$ to $d-1$ (indicating the column and row, respectively), this gives exactly $d^{2}$ elements.

+

The same effect can be reached if one expresses the Choi matrix in a different basis, while keeping the $P_{k}$ associated with $\chi_{m,n}$ the usual Paulis. For the two to coincide then (i.e. $\chi_{m,n} = \rho_{\mathrm{Choi}}^{m,n}$), we see that $\rho_{\mathrm{Choi}}^{m,n}$ should be expressed in the `vectorized-Pauli-basis' (which is a set of states, i.e. a basis for the Hilbert space!) - this is exactly the Bell basis.

+",8141,,8141,,2/2/2022 12:20,2/2/2022 12:20,,,,4,,,,CC BY-SA 4.0 +11815,2,,11810,5/2/2020 19:04,,1,,"

Von Neumann measurement is a measurement that corresponds to an orthonormal basis, not necessary standard. Though it's related to the standard by a unitary transformation.

+ +

As for the solution, at first you need to construct a POVM from the vectors orthogonal to those $|A\rangle, |B\rangle, |C\rangle$. For example, you can take +$$ +|E_0\rangle = \frac{1}{\sqrt{2}} \big( |0\rangle - |1\rangle \big), +$$ +$$ +|E_1\rangle = \frac{1}{\sqrt{2}} \big( |0\rangle - \omega |1\rangle \big), +$$ +$$ +|E_2\rangle = \frac{1}{\sqrt{2}} \big( |0\rangle - \omega^2 |1\rangle \big). +$$

+ +

You can verify that it's indeed a POVM, i.e. $\sum_i |E_i\rangle\langle E_i| = \frac{3}{2}I$. Not any set of vectors is suitable for a POVM.

+ +

So, if the result of the corresponding POVM measurement is $E_1$ (label 1), then the input state certainly wasn't $|B\rangle$ and you return 1 as an answer $-$ this will satisfy the output requirement.

+ +

The corresponding POVM matrix is
+$$ +M = \frac{1}{\sqrt{3}}\left(\begin{array}{rrr} +1 & 1 & 1 \\ +-1 & -\omega & -\omega^2 +\end{array} +\right) +$$ +Notice that we've renormalized vectors, i.e. $|E_i'\rangle = \sqrt{\frac{2}{3}}|E_i\rangle$, to satisfy $\sum_i |E_i'\rangle\langle E_i'| = I$.

+ +

To construct von Neumann measurement we must find ""embedding"" of this $M$ into some unitary matrix $M^\prime$. Embedding means that $M$ is just a submatrix of the matrix $M^\prime$.

+ +

You can take +$$ +M' = \frac{1}{\sqrt{3}}\left(\begin{array}{cccc} +1 & 1 & 1 & 0 \\ +-1 & -\omega & -\omega^2 & 0 \\ +1 & \omega^2 & \omega & 0 \\ +0 & 0 & 0 & \sqrt{3} +\end{array} +\right) +$$ +Here the embedding is obvious - $M$ is the top left corner.

+ +

In a unitary matrix columns form an orthonormal basis - this is our von Neumann measurement. Our embedding means that the input state to this measurement is $|\psi\rangle \otimes |0\rangle$, where $|\psi\rangle$ is the given state which is either $|A\rangle,|B\rangle$ or $|C\rangle$.

+ +

How it corresponds to a POVM measurement $M$? In this case trivially $-$ label $i$ of $M'$ corresponds to the label $i$ of $M$ if $i=0,1,2$. The result labelled $i=3$ can't happen because $|\psi\rangle \otimes |0\rangle$ is orthogonal to $|11\rangle$.

+",5870,,5870,,5/4/2020 7:13,5/4/2020 7:13,,,,12,,,,CC BY-SA 4.0 +11818,2,,11812,5/2/2020 22:05,,2,,"

Not an answer yet, but to long for comment: +Alice and Bob share two entangled pairs. Now look only at Alice's. +The last line gives the state that only one of'em has: +$$\frac1{\sqrt 2}(|00〉+|11〉) =\frac1{\sqrt 2}(|\phi^x_0\phi^x_0〉+|\phi^x_1\phi^x_1〉) =\frac1{\sqrt 2}(|\phi^y_0\phi^y_1〉+|\phi^y_1\phi^y_0〉).$$ +You can see that when you trace out Bob. +Now all hermitian measurement operator in one row/column commute, which means that they share eigenvectors. So after the collapse at the first measurement, subsequent measurement along communting operators don't alter the state anymore, since they are already eigenstates. +I think you have to check that the measured value is the same at the coincident site...

+",5280,,,,,5/2/2020 22:05,,,,1,,,,CC BY-SA 4.0 +11819,1,,,5/2/2020 22:14,,5,69,"

Definitions: a map $\Phi$ is called positive if $\Phi(\rho)$ is positive semidefinite for any positive semidefinite $\rho$, and completely positive (CP) if $\Phi \otimes \mathrm{Id}$ is a positive map with $\mathrm{Id}$ standing for an identity channel of arbitrary dimension.

+ +

It is well-known that a quantum channel needs to be a CP map in order to represent the physical evolution of a quantum system. However, I sometimes see mentions in the literature of a positive but not completely positive evolution of a system (and sometimes even beyond positive maps), in particular in the context of reduced dynamics of open quantum systems, e.g. [1], [2].

+ +

I am not too familiar with open quantum systems literature, but I would like to get some intuition for situations in which the physical evolution of a system might be expressed by a non-CP map. What classes of maps are used in such settings, and how is it all justified without ""breaking physics""? Beyond the example of open quantum systems, does it make sense in any other context to allow a state to evolve under a non-CP map?

+",11887,,55,,10/12/2020 7:28,10/12/2020 7:28,When can a non-completely-positive evolution of a state be physical?,,0,2,,,,CC BY-SA 4.0 +11820,2,,11797,5/2/2020 22:48,,0,,"

A pure state is any state that can be written in the form $|\alpha \rangle \langle \alpha|$, but you are free to write it any way you like, including as a sum.

+ +

A density $\rho$ is any Hermitian trace-1 positive semi-definite matrix. It can be written as $$\rho = \sum_i p_i |\psi_i\rangle \langle \psi_i|$$ with $\{p_i\}$ a probability distribution (i.e. all between 0 and 1 and they sum to 1) and each $|\psi_i \rangle$ a pure state. But, yes, you could write one density as a sum of other mixed densities, provided again your $p_i$ form a probability distribution.

+ +

The only trace-1 positive semi-definite matrix with $\langle 0 |\rho |0\rangle = 1$ is $$\rho = \begin{pmatrix}1 & 0\\ 0 & 0 \end{pmatrix}$$

+",9626,,,,,5/2/2020 22:48,,,,1,,,,CC BY-SA 4.0 +11821,1,,,5/2/2020 22:52,,2,191,"

As a data scientist, I want to use the cutting edge algorithms of machine learning to build my models, I am interested in quantum machine learning, the recent research in QML is about variational algorithms and other algorithms for NISQ machines, my question is, will these algorithms work in fault-tolerant quantum computers or we must design new algorithms such as Shor, Groover and HHL algorithms?

+",9226,,,,,5/3/2020 23:05,Will NISQ based algorithms be useful in fault-tolerant Quantum computers?,,1,0,,,,CC BY-SA 4.0 +11823,1,,,5/3/2020 10:30,,3,223,"

In Nielsen and Chuang, it is stated that the effect of phase estimation circuit is mapping state $|j\rangle |u\rangle$ to $|j\rangle U^j |u\rangle$.

+ +

Here is my solution: +Consider the first $CU^{2^0}$. Let $|j\rangle = |j_1j_2\dots j_t\rangle$. It maps the state $|j\rangle |u\rangle$ to state $|j\rangle U^{j_t2^0}|u\rangle$.If $j_t=0$, then nothing happens. Otherwise, $U^{2^0}$ is applied.

+ +

Continuing like this I get the following quantum state:

+ +

$|j\rangle U^{j_12^{t-1}} \cdots U^{j_t2^0}|u\rangle$

+ +

Then it should be true that $U^{j_12^{t-1}} \cdots U^{j_t2^0} = U^j$ but I cannot see how this follows. I am studying order finding algorithm and modular exponentiation part heavily depends on this observation. Can someone help?

+",7986,,,,,9/26/2021 9:01,Quantum Phase Estimation Circuit and Modular Exponentiaton,,1,3,,,,CC BY-SA 4.0 +11824,1,,,5/3/2020 16:14,,3,121,"

Let $\rho : V_1 \to V_1 $ and $\rho_2 : V_2 \to V_2 $, where $V_1$ and $V_2$ are Hilbert spaces.

+ +

Suppose that $U:V_1\otimes V_2 \to V_1\otimes V_2$ is a unitary operator.

+ +

Define a map $M : L(V_1, V_1) \to L(V_1, V_1)$ as +\begin{align*} +M(\rho) := \operatorname{Tr}_2 \left(\ U\ \rho\otimes\rho_2 \ U^{\dagger}\ \right) +\end{align*} where $\rho_2 \in L(V_2, V_2)$ is a fixed density operator, and $\operatorname{Tr}_2$ is the partial trace of vector space $V_2$.

+ +

Then, trivially $M$ is a unitary operator, if $U = U_1 \otimes U_2$ for some unitary operators $U_1 \in L(V_1,V_1)$ and $U_2 \in L(V_2,V_2)$.

+ +

Is the converse also true? +If $U$ cannot be expressed as a tensor product of $2$ unitary operators, then is $M$ non-unitary ?

+ +

I am lost how to prove this statement. Any hints or references are appreciated.

+",9908,,55,,10/19/2021 19:03,10/19/2021 19:03,"$M(\rho)=\operatorname{Tr}_2[U(\rho\otimes\rho_2)U^{\dagger}]$ is unitary $\iff U=U_1\otimes U_2$, a product of $2$ unitary operators?",,2,5,,,,CC BY-SA 4.0 +11825,2,,11797,5/3/2020 16:46,,1,,"

You're forgetting the requirement that the probability weights must sum to 1.

+ +

You can't sum up all the mixed state 3-vectors corresponding to the $\rho_k$ with unit weight to get the 3-vector corresponding to $\rho = \iint_k \rho_k$ - that sum isn't properly normalized. You need to take a convex combination of the $\rho_k$, i.e. a weighted sum $\sum_k \rho_k$ in which the $p_k$ are nonnegative and sum to 1, which yours don't.

+ +

You are correct that a convex combination of qubit states maps to the same convex combination of the initial state's 3-vectors in the Bloch ball. But geometrically, a convex combination of vectors in $\mathbb{R}^n$ always yields a vector inside their convex hull, which (loosely) consists of ""the space in between"" the original vectors. So you can't take a convex combination of 3-vectors and get a 3-vector that ""reaches outside"" the original set, as you propose. In your case of a uniformly-weighted mixture, you'd end with a mixed state whose 3-vector on the Bloch ball lies at the geometric center of mass of the original vectors, which would still be inside the ball.

+ +

In particular, a nontrivial convex combination of several qubit states (by which I mean that multiple coefficients are positive) always has a purity that is strictly lower than the highest purity of the constituent qubit states.

+",551,,,,,5/3/2020 16:46,,,,0,,,,CC BY-SA 4.0 +11826,1,11830,,5/3/2020 16:56,,5,320,"

How can we use Quantum Computing to break a Cryptosystem like RSA or AES-256?

+ +

Can we use Quantum Computing to solve difficult mathematical problems like Discrete Logarithms or Prime Number Factorization?

+",11861,,,,,1/21/2021 17:58,Is Quantum Computing a problem for Cryptography?,,2,0,,,,CC BY-SA 4.0 +11827,1,11829,,5/3/2020 17:16,,2,83,"

I am working on Grover's algorithm and I am trying to implement the algorithm. I am following the Microsoft quantum katas and I finished and did everything correctly. I am trying to implement the algorithm for a specific case, but I am stuck writing the marking oracle (defined as $U_\omega$ on the Wikipedia page). I tried to look into the kata tests but I wasn't very successful.

+ +

The goal of the operator is to flip the sign of a state if it is correct. The mathematical representation for this is : $$|x\rangle \, \overset{U_\omega} \longrightarrow \, (-1)^{f(x)}|x\rangle$$This is the problem, I do not know how to implement this sign flipping. Is it done case by case ? Or is the a general ""formula"" to do so ?

+ +

Thanks for reading.

+",8746,,,,,5/4/2020 14:58,How to correctly define $U_\omega$ for Grover's search algorithm,,1,0,,,,CC BY-SA 4.0 +11828,1,,,5/3/2020 17:30,,2,87,"

Is it possible, using the QPE algorithm, to map the state $\sum_j\alpha_j\,\left|v_j\right\rangle\,|0\rangle^{\otimes n}$ to the state $\sum_j\alpha_j\,\left|v_j\right\rangle\,\left|\theta_j\right\rangle$? I understand how it is done, and why does it work when applying the QPE algorithm to an eigenvector $|v_i\rangle$. But there is this measurement after the inverse QFT, which will just outputs the state $\sum_j\alpha_j\,\left|v_j\right\rangle\,\left|\theta_k\right\rangle$ with probability $\left\|\alpha_k\right\|^2$.

+ +

I don't think it is possible to get such an entangled state after the measurement of a quantum register. Still, there are algorithms which use the QPE to get this entangled state, and which even uncomputes the second register once they're done with. What am I missing?

+ +

The algorithm I want to implement is designed as follows:

+ +

First, we have a quantum state $|\psi\rangle=\sum_j\alpha_j\,\left|v_j\right\rangle$. Then, we apply the QPE with a certain unitary whose eigenvectors are the $\left|v_i\right\rangle$ (this is not true in practice, there's an intermediary step but this does not matter here). Hence, we are left with the state $\sum_j\alpha_j\,\left|v_j\right\rangle\,\left|\theta_j\right\rangle$. We consider a gate $\mathbf{T}_\theta$ such that $\mathbf{T}_\theta\,\left|\theta_j\right\rangle\,|0\rangle = \left|\theta_j\right\rangle\,|1\rangle$ is $\theta_j < \theta$ and $\left|\theta_j\right\rangle\,|0\rangle$ if $\theta_j\geqslant\theta$. We apply this gate on the second register and are left with the state:

+ +

$$\sum_{j\in\mathcal{S}}\alpha_j\,\left|v_j\right\rangle\,\left|\theta_j\right\rangle\,|0\rangle + \sum_{j\in\overline{\mathcal{S}}}\alpha_j\,\left|v_j\right\rangle\,\left|\theta_j\right\rangle\,|1\rangle$$

+ +

where $\mathcal{S}$ represents the set of indexes $j$ such that $\theta_j\geqslant\theta$. We finally uncompute the QPE to get the state:

+ +

$$\sum_{j\in\mathcal{S}}\alpha_j\,\left|v_j\right\rangle\,|0\rangle + \sum_{j\in\overline{\mathcal{S}}}\alpha_j\,\left|v_j\right\rangle\,|1\rangle$$

+ +

and we measure the second register. This works well if all $\theta_j$ can be represented exactaly on $n$ qubits. Now, let us assume this is not the case. We denote $2^n\,\theta_j=\overline{\theta_j} + 2^n\,\delta_j$. After applying the QPE, we are left with the state:

+ +

$$\frac{1}{2^n}\,\sum_j\alpha_j\,\left|v_j\right\rangle\,\sum_{x=0}^{2^n-1}\sum_{k=0}^{2^n-1}\mathrm{e}^{-\frac{2\,\mathrm{i}\,\pi\,k}{2^n}\,\left(x-2^n\,\theta_j\right)}\,|x\rangle$$

+ +

which we can rewrite as:

+ +

$$\frac{1}{2^n}\,\sum_j\alpha_j\,\left|v_j\right\rangle\,\sum_{x=0}^{2^n-1}\sum_{k=0}^{2^n-1}\mathrm{e}^{-\frac{2\,\mathrm{i}\,\pi\,k}{2^n}\,\left(x-\overline{\theta_j}\right)}\,\mathrm{e}^{2\,\mathrm{i}\,\pi\,k\,\delta_j}\,|x\rangle$$

+ +

which we can also rewrite as:

+ +

$$\frac{1}{2^n}\,\sum_j\alpha_j\,\left|v_j\right\rangle\,\left(\sum_{k=0}^{2^n-1}\mathrm{e}^{2\,\mathrm{i}\,\pi\,k\,\delta_j}\,\left|\overline{\theta_j}\right\rangle+\sum_{\substack{x=0\\x\neq\overline{\theta_j}}}^{2^n-1}\sum_{k=0}^{2^n-1}\mathrm{e}^{-\frac{2\,\mathrm{i}\,\pi\,k}{2^n}\,\left(x-\overline{\theta_j}\right)}\,\mathrm{e}^{2\,\mathrm{i}\,\pi\,k\,\delta_j}\,|x\rangle\right)\,.$$

+ +

We now apply $\mathbf{T}_\theta$:

+ +

$$\frac{1}{2^n}\,\left[\sum_{j\in\mathcal{S}}\alpha_j\,\left|v_j\right\rangle\sum_{k=0}^{2^n-1}\mathrm{e}^{2\,\mathrm{i}\,\pi\,k\,\delta_j}\,\left|\overline{\theta_j}\right\rangle\,|0\rangle+\sum_{j\in\overline{\mathcal{S}}}\alpha_j\,\left|v_j\right\rangle\sum_{k=0}^{2^n-1}\mathrm{e}^{2\,\mathrm{i}\,\pi\,k\,\delta_j}\,\left|\overline{\theta_j}\right\rangle\,|1\rangle+\underbrace{\sum_j\left(\sum_{\substack{x=0\\x\neq\overline{\theta_j}}}^{\theta-1}\sum_{k=0}^{2^n-1}\mathrm{e}^{-\frac{2\,\mathrm{i}\,\pi\,k}{2^n}\,\left(x-\overline{\theta_j}\right)}\,\mathrm{e}^{2\,\mathrm{i}\,\pi\,k\,\delta_j}\,|x\rangle\,|1\rangle+\sum_{\substack{x=\theta\\x\neq\overline{\theta_j}}}^{2^n-1}\sum_{k=0}^{2^n-1}\mathrm{e}^{-\frac{2\,\mathrm{i}\,\pi\,k}{2^n}\,\left(x-\overline{\theta_j}\right)}\,\mathrm{e}^{2\,\mathrm{i}\,\pi\,k\,\delta_j}\,|x\rangle\,|0\rangle\right)}_{\text{Noise}}\right]\,.$$

+ +

The problem now is that I don't see how the uncomputation of the QPE will affect this state. My guess is that if I assume that the amplitude of the noise is low, then I can just ignore it, and this will not affect my results. But how can I prove it? How can I quantitize this error?

+",10454,,10454,,5/4/2020 12:00,5/4/2020 12:00,Quantum Phase Estimation on a superposed state,,0,7,,,,CC BY-SA 4.0 +11829,2,,11827,5/3/2020 18:28,,4,,"

There are two types of oracles you can implement (Wikipedia article happily uses them interchangeably, which I don't think helps a lot): a marking oracle and a phase oracle.

+ +

Marking oracles are the ones that flip the state of the qubit $|y\rangle$ if $f(x) = 1$:

+ +

$$|x\rangle|y\rangle \, \overset{U_\omega} \longrightarrow \, |x\rangle|y \oplus f(x)\rangle$$

+ +

Marking oracles are much easier to build using reversible approach: break down your function into logical steps (such as AND, OR and NOT), implement each step in a reversible manner (using X, CNOT and Toffoli gates) and combine them. SolveSATWithGrover and GraphColoring show how to take a problem and implement it this way.

+ +

Phase (or sign flipping) oracles are the ones that flip the sign of the register $|x\rangle$ if $f(x) = 1$:

+ +

$$|x\rangle \, \overset{U_\omega} \longrightarrow \, (-1)^{f(x)}|x\rangle$$

+ +

Grover's search algorithm uses phase oracles, so you need to convert a marking oracle into a phase oracle using phase kickback trick (if you follow the katas, that's task 1.4 from GroversAlgorithm kata).

+",2879,,,,,5/3/2020 18:28,,,,2,,,,CC BY-SA 4.0 +11830,2,,11826,5/3/2020 21:45,,5,,"

RSA is based on high computational complexity of integer factorization. In simple words you prepare two large prime numbers $p$ and $q$. These composed your private key which is used for decryption. The public key used for encryption is simply product $m = pq$. If you were able to factorize public key, you would get private key and break the cypher. Since for large $p$ and $q$ this taks is very difficult as factorization of integers is exponentially complex on classical computers, it is not possible to break RSA in reasonable time.

+ +

There is Shor's algorithm which is able to factorize an integer to primes in polynomial time on quantum computers insted of exponential time as is the case for classical algorithms. However, current quantum computers can run Shor's algorithm for numbers like 21 or 35. This means the algorithm is useless for breaking RSA. Recently, so-called Variational Quantum Factoring appeared. This algorithm converts integer factorization to binary optimization task which can be solved even on single purpose quantum annealers. The VQF is able to factorize numbers in order of ten thousand which is still very low for breaking RSA.

+ +

Overall, quantum computers can increase speed of integer factorization rapidly (the speed-up is exponential) and help to break RSA. But nowadays, quantum computers are too noisy and have too few qubits to do so.

+",9006,,11925,,5/4/2020 8:29,5/4/2020 8:29,,,,2,,,,CC BY-SA 4.0 +11831,2,,11824,5/3/2020 21:56,,1,,"

This is probably not the answer to what you've meant, but it's still relevant.

+ +

Assume that $\rho_2 = |0\rangle\langle0|$ $-$ it's known that quantum channels have such representation.

+ +

If $U = U_1 \otimes U_2$ then +$$ +M(\rho) = U_1\rho U_1^\dagger. +$$ +This $M$ is ""unitary"" if we consider the space $L(V_1, V_1)$ as a vector space of matrices with Hilbert-Schmidt inner product given by $(A,B) = \text{Tr}(B^\dagger A)$. Indeed, we have +$$ +\text{Tr}(M(B)^\dagger M(A)) = \text{Tr}\big((U_1BU_1^\dagger)^\dagger(U_1AU_1^\dagger) \big)= \text{Tr}(B^\dagger A), +$$ +so the inner product remains the same.

+ +

Now suppose $M$ is unitary in this sense. Consider any pure state $\theta$ (density matrix of it, e.g. $|1\rangle\langle1|$). We must have +$$ +\text{Tr}(M(\theta)^\dagger M(\theta)) = \text{Tr}(\theta^\dagger \theta) = 1. +$$ +But $\text{Tr}(M(\theta))=1$. Let $\lambda_i$ be eigenvalues of $M(\theta)$, so $0\leq \lambda_i \leq 1$ and $\sum_i \lambda_i = 1$. The above equality gives us that $\sum_i \lambda_i^2 = 1$. From this it's easy to deduce that for some index $k$ it must be $\lambda_k=1$ and $\lambda_i = 0$ for $i\neq k$. That is, $M(\theta)$ also must be a pure state. So, $M$ maps pure states to pure states.

+ +

Notice that partial trace $\text{Tr}_2(s)$ is pure for a density matrix $s$ only if the state $s$ is a product state: $s = \text{Tr}_2(s) \otimes \text{Tr}_1(s)$ (here $\text{Tr}_1(s)$ is not necessary pure).

+ +

So we can write +$$ +U\ \theta \otimes\rho_2 \ U^{\dagger}\ = M(\theta) \otimes N(\theta), +$$ +where $N(\theta) = \text{Tr}_1(U\ \theta \otimes\rho_2 \ U^{\dagger})$ is a complementary channel.

+ +

Now take two pure states $\theta_1, \theta_2$. We have that

+ +

$$ +M(\theta_1\theta_2) = \text{Tr}_2(U\ \theta_1\theta_2 \otimes\rho_2 \ U^{\dagger}) += \text{Tr}_2(U\ \theta_1 \otimes\rho_2 \ U^{\dagger} \cdot U\ \theta_2 \otimes\rho_2 \ U^{\dagger}) = +$$ +$$ += \text{Tr}_2( M(\theta_1) \otimes N(\theta_1) \cdot M(\theta_2) \otimes N(\theta_2)) += M(\theta_1)M(\theta_2). +$$ +So, for any pure states $\theta_1, \theta_2$ we have that +$$ +M(\theta_1\theta_2) = M(\theta_1)M(\theta_2). +$$ +By linearity it can be proved that for any matrices $A,B \in L(V_1, V_1)$: +$$ +M(AB) = M(A)M(B). +$$ +It also can be shown that $M(I)=I$ and $M(A^\dagger) = M(A)^\dagger$. So $M$ is a unital $*$-homomorphism and this is a known fact that such homomorphism from matrix algebra to itself always corresponds to a unitary conjugation, i.e. it must be +$$ +M(A) = U_1 A U_1^\dagger +$$ +for some unitary $U_1$ and any matrix $A$.

+",5870,,5870,,5/4/2020 7:03,5/4/2020 7:03,,,,6,,,,CC BY-SA 4.0 +11832,2,,11823,5/3/2020 22:28,,1,,"

Thanks to comment by @gIS, I realized that I was mixing up the order. If I write $j$ as $|j_1\dots j_t\rangle$, of course it will be equal to $j_12^{t-1} \cdots j_t2^0$. I was confused about the numbering of the qubits.

+",7986,,7986,,5/4/2020 6:54,5/4/2020 6:54,,,,0,,,,CC BY-SA 4.0 +11833,2,,11821,5/3/2020 23:00,,1,,"

To my best understanding, one the challenges in quantum computing right now lies on the quantum noise that affects the fidelity of the qubits to reliable execute calculations. Fault-tolerant quantum computings are going to be capable of correct logical qubits faster than the rate of errors that will arise on the computation.

+ +

To, address the question, I think NISQ based algorithms can still be useful in later-stage fault-tolerant quantum computers precisely because of the error-correcting capabilities.

+ +

Case in point: right now quantum simulation of molecules is really hot. As far as I know from reading papers, quantum chemistry problems represent opportunities to test quantum computing. Even with errors present on the computation, researchers have found that current NISQ-quantum hardware will still converge to classical known answers.

+ +

However, what if you find yourself with the following challenge: you would like to simulate the interaction of a pair of copper ions in a MOF to calculate the relaxation times as a way to compare with experimental findings using NMR techniques.This was a problem I was interested in for my MS thesis. Unfortunately, this right now, as best as I know from speaking with Dr. De Jong, is not feasible using a NISQ-based quantum computer.

+ +

However, in the future, quantum computers may be able to tackle such a problem.

+ +

So, to conclude, the algorithm will be useful. Perhaps it may no longer be suitable given change in the computing paradigm - from NISQ to fault-tolerant quantum computing. Perhaps new algorithms will be found on the fault-tolerant regime that can outperform current algorithms. But all in all, it's not the NISQ-based algorithm, but the error-correcting capabilities that are one of the issues at the moment.

+ +

I can only conclude that if error-correcting is perfected to the level required to reach that paradigm of computation, that current NISQ-based algorithms run on fault-tolerant quantum computers will outperform current runs on current hardware.

+ +

One of the issues, again, as I understand it, is the error-correcting capabilities we have today and their impact on current quantum computing.

+",6253,,6253,,5/3/2020 23:05,5/3/2020 23:05,,,,0,,,,CC BY-SA 4.0 +11834,1,11841,,5/4/2020 0:25,,6,74,"

Given two 1-qubit rotations $U=R_n (\theta)$ and $V=R_m(\phi)$ with $n$ and $m$ vectors defining a rotation and $\theta, \phi$ angles, define $D(U,V)=Tr(|U-V|)$ where $|U-V|=\sqrt{(U-V)^\dagger (U-V)}$ and $E(U,V)=max_{|\psi \rangle} ||(U-V)|\psi \rangle ||$ where $|| |\psi\rangle ||$ is the vector norm.

+ +

Im trying to prove that $D(U,V)=2E(U,V)$, which can be seen from taking $n$ and $m$ as the same vector. +I also tried considering the case $U=R_z(\theta)$ and taking $m=\cos(\alpha)Z + \sin(\alpha)X$ but in this case I couldn't prove the result as I get a too complicated expression for the trace distance. Any help for proving this?

+",1754,,55,,10/12/2020 21:25,10/12/2020 21:25,Prove that for one-qubit unitaries $\text{Tr}|U-V|=2\max_\psi\|(U-V)|\psi\rangle\|$,,2,0,,,,CC BY-SA 4.0 +11837,1,11838,,5/4/2020 6:14,,1,363,"

How does entangle qubits pass single qubit gate? +For example, I initialize two qubits $|0\rangle\otimes|0\rangle$, then first qubit passes $H$ gate to make it an superposition state $\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$ and then applied CNOT gate. The state finally become $\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)$

+ +

Then I put the first qubit into $X$ gate. What will happen? It will become $\frac{1}{\sqrt{2}}(|10\rangle+|01\rangle)$? If so, how could it is possible the entangled two quibits pass the single-qubit-gate? If not, what will happen in this situation?

+",11765,,9006,,5/4/2020 21:33,5/4/2020 21:33,How does entangle qubits pass single qubit gate?,,2,3,,,,CC BY-SA 4.0 +11838,2,,11837,5/4/2020 6:42,,1,,"

Here are the steps in details:

+ +

$$H\otimes I |0\rangle \otimes |0\rangle = H |0\rangle \otimes I|0\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle + |1\rangle \right) \otimes |0\rangle = \frac{1}{\sqrt{2}}\left(|00\rangle + |10\rangle \right)$$

+ +

$$CNOT \frac{1}{\sqrt{2}}\left(|00\rangle + |10\rangle \right) = \frac{1}{\sqrt{2}}\left(CNOT|00\rangle + CNOT|10\rangle \right) = \frac{1}{\sqrt{2}}\left(|00\rangle + |11\rangle \right)$$

+ +

$$X \otimes I \frac{1}{\sqrt{2}}\left(|00\rangle + |11\rangle \right) = \frac{1}{\sqrt{2}}\left(X |0\rangle \otimes I|0\rangle + X |1\rangle \otimes I|1\rangle \right) = \frac{1}{\sqrt{2}}\left(|10\rangle + |01\rangle \right)$$

+ +

So, we don't apply to the two-qubit state an $X$ operator, instead, we actually apply $X \otimes I$ operator or $I \otimes X$ depending on what qubit $X$ is applied.

+",9459,,9459,,5/4/2020 6:47,5/4/2020 6:47,,,,7,,,,CC BY-SA 4.0 +11839,2,,11837,5/4/2020 6:58,,1,,"

Generally, if you have no gate on qubit, it means that there is an identity operator $I$. So if you have $n$ qubits, a gate $U$ applied on $i$ th qubit and no gate on others, effectively you have a gate +$$ +I_1 \otimes \dots \otimes I_{i-1} \otimes U \otimes I_{i+1} \otimes I_n, +$$

+ +

which is $n$ qubits gate. So in your case two qubits go through two qubits gate as Davit shown in his answer.

+",9006,,,,,5/4/2020 6:58,,,,0,,,,CC BY-SA 4.0 +11840,1,11842,,5/4/2020 7:30,,2,143,"

Now I have five qubits quantum circuit like: +

+ +

and as the circuit, first q[0], q[2] and q[3] pass the X gate, and then is that means they store in QRAM as a whole by the following quantum circuit? +If so, in the next step, how could it possible to take q[3] and q[4] out from the ""whole $| \text{out} \rangle$""?or actually, every time it takes the ""whole $| \text{out} \rangle$"" to the new step?

+ +

+",11765,,5955,,5/4/2020 8:45,5/4/2020 8:45,A question about how to store the quantum state in quantum circuit,,1,4,,,,CC BY-SA 4.0 +11841,2,,11834,5/4/2020 7:32,,4,,"

Let's start with expanding the calculation of $E$: +$$ +E(U,V)=\max_{|\psi\rangle}\sqrt{\langle\psi|(U-V)^\dagger(U-V)|\psi\rangle}. +$$ +Clearly, we want $|\psi\rangle$ to be the eigenvector with maximum eigenvalue of +$$ +2I-V^\dagger U-U^\dagger V. +$$ +Let's note that

+ +
    +
  • If $|\psi\rangle$ is an eigenvector of $U^\dagger V$, then the eigenvalue must be of the form $e^{i\theta}$ because $U^\dagger V$ is unitary

  • +
  • Furthermore, it is also an eigenvector of $V^\dagger U$, but with eigenvalue $e^{-i\theta}$ just by rearranging (multiplying by $V^\dagger U$) $U^\dagger V|\psi\rangle=e^{i\theta}|\psi\rangle$.

  • +
  • For a single-qubit rotation where $\text{det}(U)=\text{det}(V)=1$, there is a second eigenvector $|\psi^{\perp}\rangle$ whose eigenvalue is the conjugate (i.e. $e^{-i\theta}$ for $U^\dagger V$ and $e^{i\theta}$ for $V^\dagger U$) because the eigenvalues must have a product equal to 1.

  • +
+ +

So, +$$ +E(U,V)=\sqrt{2-e^{i\theta}-e^{-i\theta}}=2\cos\frac{\theta}{2} +$$

+ +

Now let's consider $D(U,V)$. +$$ +D(U,V)=\text{Tr}\left(\sqrt{(U-V)^\dagger(U-V)}\right). +$$ +When taking the trace, we can use any basis we want. Let's use the eigenbasis of $2I-V^\dagger U-U^\dagger V$, +$$ +D(U,V)=\langle\psi|\sqrt{(U-V)^\dagger(U-V)}|\psi\rangle+\langle\psi^\perp|\sqrt{(U-V)^\dagger(U-V)}|\psi^\perp\rangle. +$$ +Square roots maintain the diagonalisation, which means we can do +$$ +D(U,V)=\sqrt{\langle\psi|(U-V)^\dagger(U-V)|\psi\rangle}+\sqrt{\langle\psi^\perp|(U-V)^\dagger(U-V)|\psi^\perp\rangle}, +$$ +and we can now make use of the eigenvector relations +\begin{align*} +D(U,V)&=\sqrt{2+e^{i\theta}+e^{-i\theta}}+\sqrt{2+e^{-i\theta}+e^{i\theta}} \\ +&=4\cos\frac{\theta}{2} \\ +&=2E(U,V). +\end{align*}

+ +
+ +

For a completely different way to tackle the problem, let $U=e^{i\theta\underline{n}\cdot\underline{\sigma}}$ and $V=e^{i\phi\underline{m}\cdot\underline{\sigma}}$. Let's multiply out $U^\dagger V$. We get +$$ +U^\dagger V=\cos\theta\cos\phi I-i\underline{n}\cdot\underline{\sigma}\cos\phi\sin\theta+i\underline{m}\cdot\underline{\sigma}\sin\phi\cos\theta+(\underline{n}\cdot\underline{\sigma})\cdot(\underline{m}\cdot\underline{\sigma})\sin\theta\sin\phi. +$$ +Similarly, +$$ +V^\dagger U=\cos\theta\cos\phi I+i\underline{n}\cdot\underline{\sigma}\cos\phi\sin\theta-i\underline{m}\cdot\underline{\sigma}\sin\phi\cos\theta+(\underline{m}\cdot\underline{\sigma})\cdot(\underline{n}\cdot\underline{\sigma})\sin\theta\sin\phi. +$$ +So, when we add these two terms together, the middle two terms cancel immediately. The last term requires a little more thought. Note that +$$ +(\underline{n}\cdot\underline{\sigma})\cdot(\underline{m}\cdot\underline{\sigma})=(\underline{n}\cdot\underline{m})I+(\underline{n}\times\underline{m})\cdot\underline{\sigma}. +$$ +Also recal that the cross product is antisymmetric, so when we swap the order of terms, we get a negative sign. That means that the cross product term will also cancel. Hence +$$ +U^\dagger V+V^\dagger U=2I(\cos\theta\cos\phi+\underline{n}\cdot\underline{m})\sin\theta\sin\phi). +$$ +Overall, we have +$$ +2I-U^\dagger V-V^\dagger=2I(1-\cos\theta\cos\phi-\underline{n}\cdot\underline{m}), +$$ +which makes both the maximum eigenvector and the trace very easy to deal with and, critically, the trace of $I$ is double the maximum eigenvector.

+",1837,,,,,5/4/2020 7:32,,,,0,,,,CC BY-SA 4.0 +11842,2,,11840,5/4/2020 8:15,,2,,"

I am not sure if this will help to answer the question, but here are the detailed steps of the first circuit presented in the question:

+ +

$$X \otimes I \otimes X \otimes X \otimes I |00000\rangle = |10110\rangle$$

+ +

$$I \otimes I \otimes I \otimes CNOT^{3,4} |10110\rangle = |101\rangle \otimes CNOT^{3,4}|10\rangle = |10111\rangle$$

+ +

$$I \otimes I \otimes I \otimes CNOT^{4,3} |10111\rangle = |101\rangle \otimes CNOT^{4,3}|11\rangle = |10101\rangle $$

+ +

Here the indexes of the qubits start from $0$. Note that sometimes it is more convenient to drop the $I$ operators wherever it is possible. For example, the last step can be written in a shorter form:

+ +

$$CNOT^{4,3} |10111\rangle = |101\rangle \otimes CNOT^{4,3}|11\rangle = |10101\rangle $$

+",9459,,9459,,5/4/2020 8:28,5/4/2020 8:28,,,,3,,,,CC BY-SA 4.0 +11843,1,,,5/4/2020 8:24,,0,92,"

Find the decomposition of the following matrix into two level unitary matrices:

+ +

$$ +\frac{1}{2} +\begin{pmatrix} +1 & 1 & 1 & 1\\ +1 & i & -1 & -i\\ +1 & -1 & 1 & -1\\ +1 & -i & -1 & i\\ +\end{pmatrix} +$$

+",11580,,9006,,5/5/2020 13:41,5/5/2020 13:41,Find the decomposition of the following matrix into two level unitary matrices,,1,0,0,5/4/2020 20:16,,CC BY-SA 4.0 +11844,2,,11834,5/4/2020 11:15,,2,,"

Use the fact that both distance measures are invariant under left- as well as right-multiplication (independently!) with an arbitrary unitary.

+ +

This way, you can map $U$ to $I$ and $V$ to $R_z(\phi)$. Now (i) the matrices are both diagonal, making the trace distance trivial to compute, and (ii) the problem is only characterized by a single angle.

+ +

This will simplify the problem tremendously.

+",491,,,,,5/4/2020 11:15,,,,2,,,,CC BY-SA 4.0 +11845,1,11846,,5/4/2020 12:19,,2,634,"

I am interested in the execution time of quantum gates on IBM's $15$-qubits Melbourne computer. Is there any information regarding this?

+ +

After searching for a while I have only managed to find the times of the CNOT gates here, but unfortunately, no information for other quantum operations. I am specifically interested in the Hadamard gate .h() and the phase and rotation gates .rz() and .u3(), as well as the simple inverter .x(). I know these gates are not elementary (i.e they are composite gates) but still, any information regarding their respective execution times would be greatly appreciated!

+",6244,,9006,,5/4/2020 21:26,5/4/2020 21:26,Quantum gates execution times on IBM Q Melbourne,,1,0,,,,CC BY-SA 4.0 +11846,2,,11845,5/4/2020 12:47,,2,,"

You can get all the information about execution times on a backend by using the .properties() method in Qiskit. In your example, this can be done as follows

+ +
backend = provider.get_backend('ibmq_16_melbourne')
+backend.properties()
+
+ +

This returns an object containing all the gate times.

+ +

It is worth noting that all single qubit gates get converted into u3 gates, and all multiqubit gates converted to use cx, so that they can be run on the real hardware. If you want to see how a specific circuit is converted into this format you can use the transpiler, for example new_qc = transpile(qc, optimization_level=3)

+",5955,,,,,5/4/2020 12:47,,,,0,,,,CC BY-SA 4.0 +11847,2,,11843,5/4/2020 13:39,,1,,"

This is a Quantum Fourier Transform and the Wiki page provides a generic decomposition:

+ +

+ +

Can you find your two qubit version?

+",5280,,,,,5/4/2020 13:39,,,,0,,,,CC BY-SA 4.0 +11848,1,,,5/4/2020 14:07,,0,93,"

You are given a quantum state$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$ $\ket\psi$ with $2n$ qubits and the possibility to recreate the state $m$ times, but only one at a time. Further $m$ grows polynomial with $n$, i.e. $m=O(poly(n))$. Your task is to determine the probability (or even harder the coefficient) of $\ket{00\cdots0}$ in $\ket\psi$, so you start to measure.

+ +

Since you don't have enough (exponentially many) copies to fully characterize $\ket\psi$, what is the best strategy to at least get an upper bound on the probability to measure $\ket{00\cdots 0}$?

+ +

Is brute force measuring the best or could entanglement help?

+ +

EDIT:

+ +

Ok, so what one can do is to measure all qubits and collapse the state to $\ket{ m_0m_1\cdots m_{2n-1}}$, where $m_k$ is the measured $k$-th qubit $\in \{\ket0,\ket1\}$. And then I count ($\#C_{\ket{00\cdots 0}}$) how many $\ket{00\cdots 0}$ I had and divide by $m$. This gives at least the probability $\displaystyle p_{\ket{00\cdots 0}}=\frac{\#C_{\ket{00\cdots 0}}}{m}$.

+ +

But doesn't measuring any $\ket0$ at any qubit $k$ (I assume that qubits are measured one by one) and statistics on that affect my overall $p_{\ket{00\cdots 0}}$?

+ +

EDIT

+ +

I thought of some statistical thing like Bayesian Inference, testing of hypothesis,.... Can these methods be applied?

+ +

E.g. if I only look at the first measured qubit. If I measure a $\ket0$, the worst (for my prediction) that can happen is that the other two remaining qubits are in a equal superposition, so the best guess I can make is $\#C_{\ket{0}}/4m$...

+",5280,,5280,,5/6/2020 18:07,5/6/2020 18:07,What is the best strategy to get an upper bound to measure $|00\cdots 0\rangle$?,,0,10,,,,CC BY-SA 4.0 +11850,1,,,5/4/2020 15:49,,2,41,"

In superconducting qubits, all the method that I have seen until now are based on short range interaction.

+ +

For example you have two qubits to process information around a middle qubit that is actually a coupler. By tuning its frequency you can make the two other qubit fictively interact.

+ +

My question is: Is there at least one method of performing two qubit gates in superconducting qubit that allows for long range interaction, i.e two qubit that are far on the computer can interact. Even a gate with very bad fidelity. Or nothing has been found for now on?

+",5008,,9006,,5/4/2020 21:21,5/4/2020 21:21,Long range two qubit gates in superconducting qubits,,0,0,,,,CC BY-SA 4.0 +11851,1,11852,,5/4/2020 16:10,,5,1161,"

I am trying to understand and implement the Deutsch algorithm. I follow the logic from Nielsen book and I started to implement it in Qiskit. +For implementing the oracle, I use a CNOT gate and now I have this circuit:

+ +

+ +

Every time I ran it, the first qubit is always in state $|1\rangle$. +I am not sure if this is what I expect. Shouldn't it be sometimes $|1\rangle$ and sometimes $|0\rangle$?

+",9569,,9006,,5/4/2020 21:20,5/4/2020 21:20,Deutsch's algorithm in Qiskit,,1,0,,,,CC BY-SA 4.0 +11852,2,,11851,5/4/2020 16:43,,2,,"

CNOT gate is an example that implements a balanced function for which $f(0) = 0$ and $f(1) = 1$:

+ +

\begin{equation} +CNOT \frac{1}{2}\left(|0\rangle + |1\rangle \right) \left(|0\rangle - |1\rangle \right) = +\\ += \frac{1}{2}|0\rangle \left(|0 \oplus f(0)\rangle - |1 \oplus f(0)\rangle \right) ++ \frac{1}{2}|1\rangle \left(|0 \oplus f(1)\rangle - |1 \oplus f(1)\rangle \right) = +\\ += \frac{1}{2} \left(|0\rangle - |1\rangle \right) \left(|0\rangle - |1\rangle \right) +\end{equation}

+ +

$$H \otimes I \frac{1}{2}\left(|0\rangle - |1\rangle \right) \left(|0\rangle - |1\rangle \right)= \frac{1}{\sqrt{2}}|1\rangle \left(|0\rangle - |1\rangle \right)$$

+ +

It means that if we will do everything right we always should obtain (for balanced functions $f(0) \ne f(1)$) $|1\rangle$ outcome in the Deutsch algorithm.

+ +

For more look at 1.44 equation (page 33) in the M. Nielsen and I. Chuang textbook, where one can find the final state before the measurement. In the 1.44 system, one can see that if $f(0) = f(1)$ then the first qubit will be in $|0\rangle$ state and if $f(0) \ne f(1)$ (like the case with CNOT) then the first qubit will be in $|1\rangle$ state before the measurement.

+",9459,,9459,,5/4/2020 19:55,5/4/2020 19:55,,,,2,,,,CC BY-SA 4.0 +11853,1,,,5/4/2020 17:40,,3,111,"

I'm wondering about time complexities of variants of the searching problem in Grover's Algorithm. I know that using G.A. the time complexity required to find a market item reduces to $O(\sqrt N)$.

+ +

How about the following scenario:

+ +

You are given access to an oracle with $K$ marked items, and $K$ is unknown. What would be a lower bound for finding a marked item using $O(\sqrt {N/K})$, with probability more than $\frac{1}{2}$?

+ +

If so, is there an algorithm to show it?

+",11927,,9006,,5/4/2020 21:15,5/4/2020 21:15,How to find a marked item out of $K < N$ marked items when K is unknown?,,0,1,,,,CC BY-SA 4.0 +11854,2,,11824,5/4/2020 17:48,,0,,"

$\newcommand{\calU}{\mathcal{U}}\newcommand{\calV}{\mathcal{V}}\newcommand{\red}[1]{{\color{red}#1}}\newcommand{\purple}[1]{{\color{purple}#1}}\newcommand{\green}[1]{{\color{green}#1}}$You can prove this as follows:

+ +

Suppose $\sigma=|k\rangle\!\langle k|$.

+ +

Expliciting the expression of $M(\rho)$ in its matrix components we get +$$ M(\rho)_{ij} + = \sum_{a,n,m} \calU_{i a}^{n k}(\calU^*)_{j a}^{m k} \rho_{nm}. +$$ +This gives you the Kraus representation $M(\rho)=\sum_a A_a^{(k)}\rho A_a^{(k)\dagger}$ with $(A_a^{(k)})_{i,n}\equiv \calU_{ia}^{nk}$.

+ +

Our hypothesis is that, for some unitary $\calV$, we have $M(\rho)=\calV\rho\calV^\dagger$ for all $\rho$. +This would then imply +$$\calV \rho\calV^\dagger = \sum_a A_a^{(k)}\rho A_a^{(k)\dagger}\quad\forall\rho,$$ + +This, in turn, implies that $A_a^{(k)}=C_{a}^{(k)}\calV$ with $C$ such that $\sum_a |C_a^{(k)}|^2=1$. +This follows from the fact that if $\sum_a A_a\rho A_a^\dagger=\sum_a B_a \rho B_a^\dagger$ for all $\rho$ then for some unitary $C$ we have $A_a=\sum_b C_{ab}B_b$ (which in turn is a direct application of the SVD decomposition). If $B_b=\delta_{b0}\calV$ we get the result.

+ +

We thus proved that $(A_a^{(k)})_{i,n}=\calU_{ia}^{nk}=C_a^{(k)}\calV_{i}^n$. +This is essentially the conclusion: it means that $\calU=\calV\otimes \tilde C$ with $\tilde C$ a unitary whose first column (or row, depending on the convention we are using) equals $(C_a^{(k)})_a$ (it can be any such unitary, as $\calU$ is not fully defined by the definition of $M$).

+",55,,,,,5/4/2020 17:48,,,,0,,,,CC BY-SA 4.0 +11855,1,,,5/4/2020 19:47,,3,133,"

Background

+ +

Assume we have a density matrix $\rho$ of a sub-ensemble. However, we have an imperfect measuring instrument. While it does perform a measurement, we do not know exactly when it performs the measurement. If we want to perform the measurement at $t= 0$. Then, the measuring instrument performs the measurement in the time interval $(- \epsilon, \epsilon)$. The probability of it happening within this interval at time $t$ is given by $p(t) \delta t$. Obviously, $ \int_{- \epsilon}^\epsilon p(t) d t = 1$. The density operator post measurement at time $t$ is given by:

+ +

$$\rho_{M} = \Big ( \frac{P_i U ( t) \tilde \rho U^\dagger ( t) P_i}{\text{Tr} P_i U ( t) \tilde \rho U^\dagger ( t) } \Big )$$

+ +

With being the $P_i$ is an arbitrary projection operator $\tilde \rho$ being the density matrix at time $0$ (assuming no measurement) and $U$ being the unitary operator. The resultant density matrix when the non-ideal measurement device is included is given by at time $\epsilon$ is $\rho(\epsilon)$ is given by:

+ +

\begin{equation} + \rho (\epsilon) = p( - \epsilon + \delta t) U(2 \epsilon - \delta t ) \Big ( \frac{ P_i U (-\epsilon + \delta t) \tilde \rho U^\dagger (-\epsilon + \delta t) P_i }{\text{Tr} (P_i U (-\epsilon + \delta t) \tilde \rho U^\dagger (-\epsilon + \delta t) )} \Big) U^\dagger (2 \epsilon - \delta t ) \delta t +\end{equation} + $$+ $$

+ +

$$p( - \epsilon + 2 \delta t) U(2 \epsilon - 2\delta t ) \Big ( \frac{ P_i U (-\epsilon + 2\delta t) \tilde \rho U^\dagger (-\epsilon + 2\delta t) P_i }{\text{Tr} P_i U (-\epsilon + 2\delta t) \tilde \rho U^\dagger (-\epsilon + 2\delta t) } \Big)U^\dagger (2 \epsilon - 2\delta t ) \delta t $$

+ +

$$+ $$

+ +

$$ \vdots$$

+ +

$$ + $$

+ +

\begin{equation} + p( \epsilon - \delta t) U(\delta t ) \Big ( \frac{P_i U (\epsilon - \delta t) \rho ' U^\dagger (\epsilon - \delta t) P_i}{\text{Tr} P_i U (\epsilon - \delta t) \rho ' U^\dagger (\epsilon - \delta t)} \Big) U^\dagger ( \delta t ) \delta t +\end{equation}

+ +

Now, in the limit $\delta t \to 0$ we get an integral:

+ +

\begin{equation} + \implies \rho(\epsilon) = \int_{- \epsilon}^\epsilon p(z) U( \epsilon - z) \Big ( \frac{P_i U ( z) \tilde \rho U^\dagger ( z) P_i}{\text{Tr} P_i U ( z) \tilde \rho U^\dagger ( z) } \Big ) U^\dagger ( \epsilon - z) dz +\end{equation}

+ +

Let us see what happens as $\epsilon \to 0$. The first thing we notice is this would imply:

+ +

\begin{equation} + \epsilon \to 0 \implies p(z) \to \delta (z) +\end{equation}

+ +

Substituting this result in our integral we get the normal result of an ideal measurement at $t = 0$:

+ +

\begin{equation} + \lim_{\epsilon \to 0}\rho( \epsilon) = \frac{ P_i \tilde \rho P_i}{Tr P_i \tilde \rho } +\end{equation}

+ +

Question

+ +

Consider the von Neumann entropy $S(\rho)$ of the system. Is there a way to find the probability distributions which ensure the von Neumann entropy always increases?

+ +

$$ S(\rho(-\epsilon)) \leq S(\rho(\epsilon)) $$

+ +

Try to solve for as general as possible?

+",5045,,9118,,10/26/2020 18:31,10/26/2020 18:31,Increasing the von Neumann entropy despite the measurement?,,0,0,,,,CC BY-SA 4.0 +11856,1,,,5/5/2020 1:04,,2,53,"

My question concerns a proof in https://people.eecs.berkeley.edu/~vazirani/pubs/qao.pdf, ""Limits on Quantum Adiabatic Optimization - Warning: Rough Manuscript!"" by Wim van Dam and Umesh Vazirani. It seems that it was never completed, although it has been cited several times since. In particular, Lemma 2 states (summarized and paraphrased):

+ +
+

If a quantum adiabatic algorithm is carried out on a graph of size $n$ with diameter $w$, with a Hamiltonian whose entries are polynomial in $\log(n)$, the optimization will take time $2^{(w \log w)}$

+
+ +

This is a bit interpretation on my part, because the proof is very incomplete and inconsistent. Now, if this statement is true, we could* apply it to an expander graph with degree $d = \log^k(n)$, and get a graph of width $w = c\log(n)/\log(d)$ for some constant $c$.

+ +

That would imply a runtime of

+ +

$$d 2^{w\log w} = \log^k(n) 2^{(c \log n/k \log\log n) (\log\log n)} \le \log^k(n) 2^{(c \log n/k)}$$

+ +

Then by taking $k$ to be sufficiently large, say, $4/c$, this gives you a $poly(log(n))*2^{\log(n)/4}$, which appears to outperform Grover's algorithm, which is strong evidence that something here has gone wrong. :) As pointed out in the second answer to this question, there might currently be some loopholes to allow adiabatic computing to outperform gate models, but that seems extremely unlikely -- I assume I am not understanding the Lemma 2 from van Dam's manuscript, or the relevant expander graphs don't exist somehow (e.g. $c$ would depend on $n$ in some nontrivial way or something.)

+ +

Can anyone explain what's going on here, and perhaps provide a proof of that Lemma 2?

+ +
+ +

[*] This requires the existence of a such a graph. Moore graphs seem sufficient (a degree-$d$ tree branching out for $w$ levels). Ramanujan graphs might work, if they exist small enough; for example, for the case of Ramanujan graphs, the second-largest eigenvalue is bounded by $\lambda_2 \le 2\sqrt{d-1}$, and the edge expansion is lower-bounded by $\frac{1}{2}(d-\lambda_2) \ge \frac{d}{3}$. A graph with $n$ vertices and edge expansion $\phi$ has diameter bounded by $2\log(n)/\log(1+\phi)$.

+",10115,,55,,5/24/2020 9:17,5/24/2020 9:17,van Dam's proof for adiabatic optimization and graph diameter,,0,4,,,,CC BY-SA 4.0 +11857,1,14889,,5/5/2020 1:52,,6,253,"

I am following the 5.4.1 Period-Finding Algorithm in Nielsen and Chuang as shown below: +

+

My confusion lies with the second expression of point 3 in the procedure. Why is the second expression an approximation as opposed to just being equal to the first expression in point 3?

+

Nielsen and Chuang states on the next page that "the approximate equality in step 3 is required because $2^t$ may not be an integer multiple of r in general". But when I work through the following steps, I don't see exactly why $2^t$ must be an integer multiple of r for the equality to hold. Consider:

+

$$\frac{1}{\sqrt{r2^t}} \sum_{\ell=0}^{r-1}\sum_{x=0}^{2^t-1} e^{2\pi i \ell x/r} |x\rangle |\hat{f}(\ell)\rangle$$

+

We know by the definition of $|\hat{f}(\ell)\rangle$ in the image above,

+

$$|\hat{f}(\ell)\rangle = \frac{1}{\sqrt{r}}\sum_{s = 0}^{r-1} e^{-2\pi i\ell s/r} |f(s)\rangle$$ +(I use $s$ as the index instead of $x$ because $x$ is already used as an index in the first expression.) Anyways, now plugging this in to the first expression, we get:

+

$$\frac{1}{r\sqrt{2^t}} \sum_{s=0}^{r-1}\sum_{x=0}^{2^t-1}\sum_{\ell=0}^{r-1} \left( e^{2\pi \ell(x-s)/r}\right) |x\rangle |f(s)\rangle$$

+

Now, we know that $g(x, s) = \sum_{\ell=0}^{r-1} e^{2\pi \ell(x-s)/r} = r$ if $r|(x-s)$ and $0$ otherwise. Also, let $x \equiv s_2 (mod \> r)$. So for every $x$ in the summation, there is an $s = s_2$ meaning that $g(x, s_2) = r$ and $g(x, s) = 0$ for every other $s \neq s_2$. This means that:

+

$$\frac{1}{r\sqrt{2^t}} \sum_{s=0}^{r-1}\sum_{x=0}^{2^t-1}\sum_{\ell=0}^{r-1} \left( e^{2\pi \ell(x-s)/r}\right) |x\rangle |f(s)\rangle = \frac{1}{2^t}\sum_{x=0}^{2^t-1} |x\rangle |f(x)\rangle$$

+

Regardless of whether $2^t$ is a multiple of $r$, this equality holds. However, Nielsen and Chuang is stating that its an approximation, being equal only if $r|2^t$. What exactly am I missing here? Perhaps I'm making some assumption that is not true in the work above?

+",11644,,-1,,6/18/2020 8:31,12/28/2020 18:02,Question Regarding Quantum Period-Finding Fourier Transform Approximation,,1,2,,,,CC BY-SA 4.0 +11858,1,11860,,5/5/2020 5:49,,4,192,"

In the book, Nielsen and Chuang, there is a section on quantum simulation of the quantum search algorithm. Hamiltonion operator is defined as follows-

+ +

$$ +H = |x\rangle\langle x| + |\psi\rangle\langle\psi| +$$ +where x is the only solution to the search problem and +$$ +\psi = \frac{\sum_{x}{|x\rangle}}{N} +$$ +with N being the total number of elements.

+ +

+ +

I haven't been able to understand how the following circuits were implemented using the Hamiltonions specified in the picture and the book doesn't explain how they came up with the circuits.

+",11932,,9006,,5/5/2020 6:13,5/6/2020 7:41,Problem with building quantum circuit for Hamiltonian operation,,1,1,,,,CC BY-SA 4.0 +11859,2,,11703,5/5/2020 6:55,,0,,"

So, I add a ""ghost qubit"" in the solution space in order to increase N. I fixe the ""ghost qubit"" to a state (|1> here) and we get #solutions < N/2

+ +

+ +

+",10192,,,,,5/5/2020 6:55,,,,0,,,,CC BY-SA 4.0 +11860,2,,11858,5/5/2020 7:32,,5,,"

Both circuits work essentially the same. It's perhaps slightly easier to understand the second because it's being explicit about what it's doing rather than hiding some of it in an oracle. So, take the second diagram. Consider the effect of the middle gates. They basically say

+ +
    +
  • if the top register is in the all 0 state, flip the bit of the second register

  • +
  • if the second register is in 1, apply a phase. Otherwise, do nothing.

  • +
  • if the top register is in the all 0 state, flip the bit of the second register.

  • +
+ +

Clearly, the first and the third cancel each other out, meaning that the second register will return as $|0\rangle$. However, it's that middle operation that's important. Expressed as it is, hopefully you see that the overall effect of the three gates is to say ""add a phase if the top register is in the all 0 state"". Thus, the effect of these 3 gates on the first register can be written as +$$ +I+(e^{i\Delta t}-1)|0\rangle\langle 0|^{\otimes n}. +$$ +You can now take into account the effect of the other two gates. +$$ +H^{\otimes n}\left(I+(e^{i\Delta t}-1)|0\rangle\langle 0|^{\otimes n}\right)H^{\otimes n}=I+(e^{i\Delta t}-1)|\psi\rangle\langle \psi|=e^{i\Delta t|\psi\rangle\langle\psi|} +$$

+ +

There seems to be a minus sign inconsistency with what you've posted. I don't know if that's a mistake I've made somewhere...

+ +
+ +

To check the identity +$$ +I+(e^{i\Delta t}-1)|\psi\rangle\langle \psi|=e^{i\Delta t|\psi\rangle\langle\psi|}, +$$ +it is perhaps easiest to go from right to left. Clearly, the operator $|\psi\rangle\langle\psi|$ is a rank 1 projector, which I'll denote $P_{\psi}$. We can introduce a second projector $P_{\perp}=I-P_{\psi}$. The states that this projects onto all have 0 eigenvalue with $P_{\psi}$.

+ +

The definition of the exponential of matrix $M=\sum_j\lambda_jP_j$ is +$$ +e^{i\theta M}=\sum_je^{i\lambda_j\theta}P_j. +$$ +So, +$$ +e^{i\Delta t|\psi\rangle\langle\psi|}=e^{i\Delta t}P_{\psi}+P_{\perp}, +$$ +which is exactly what we were after.

+",1837,,1837,,5/6/2020 7:41,5/6/2020 7:41,,,,4,,,,CC BY-SA 4.0 +11861,1,12133,,5/5/2020 10:21,,11,2586,"

Quantum Inspire is a quantum computing platform provided by QuTech. It consists of two real quantum processors - Starmon-5 and Spin-2. Whereas it is possible to use rotation gates $Rx$, $Ry$ and $Rz$ on Spin-2 processor, Starmon-5 gate set consist only of:

+ +
    +
  • Pauli gates $\text{X}$, $\text{Y}$, $\text{Z}$ and $\text{I}$
  • +
  • Hadamard gate $\text{H}$
  • +
  • Phase gate ($\text{S}$) and $\pi/8$ ($\text{T}$) gate and their conjugate transpose gates
  • +
  • rotation around axes $x$ and $y$ for angle $\pm\frac{\pi}{2}$ gates
  • +
  • $\text{CNOT}$, $\text{CZ}$ and $\text{SWAP}$ gates
  • +
+ +

My question is how can I construct gates $Rx$, $Ry$ and $Rz$ with rotation angle $\theta$ from gate listed above.

+ +
+ +

EDIT:

+ +

Based on advice from JSdJ and the Nielsen and Chuang book, I found out that:

+ +
    +
  • $HTH = Rx(\pi/4)$ which together with the fact that $T=Rz(\pi/4)$ allows to build gate +$$R_{\hat{n}}=Rz(\pi/4)Rx(\pi/4)= \text{exp}(-i\frac{\pi}{8}Z)\text{exp}(-i\frac{\pi}{8}X) = \\ \cos^2\frac{\pi}{8}I-i(\cos\frac{\pi}{8}(X+Z)+\sin\frac{\pi}{8}Y)\sin\frac{\pi}{8}$$ +(note that $Y=-iZX$)
  • +
  • this is a rotation around axis defined by vector $\hat{n}=(\cos(\pi/8);\sin(\pi/8);\cos(\pi/8))$. Rotation angle is given by equation $\cos(\theta/2) =\cos^2(\pi/8)$
  • +
  • angle $\theta$ is $2\arccos[\cos^2(\pi/8)] \approx 1.096$ which is irrational multiple of $2\pi$
  • +
  • since $\theta$ is irrational, repeated application of the gate $R_{\hat{n}}$ never leads to rotation by an angle which sum up to $2\pi$
  • +
  • as a result we are able to reach any rotation by angle $\alpha$ around $\hat{n}$ axis by repeated application of $R_{\hat{n}}$, i.e. we can construct $R_{\hat{n}}(\alpha)=R_{\hat{n}}^{n_1}$, where $n_1$ is an integer
  • +
  • also it is true that $HR_{\hat{n}}(\alpha)H = R_{\hat{m}}(\alpha)$ where $\hat{m}$ is axis defined by vector $(\cos(\pi/8);-\sin(\pi/8);\cos(\pi/8))$, so the same procedure allows to find rotation for $\alpha$ around axis $\hat{m}$
  • +
  • it can also be proven that any arbitrary single qubit unitary matrix $U$ can be written (up to global phase) as $U = R_{\hat{n}}(\beta_1)R_{\hat{m}}(\gamma_1)R_{\hat{n}}(\beta_2)R_{\hat{m}}(\gamma_2)\dots$
  • +
  • together this leads to conclusion that any $U$ (including $Rx$, $Ry$ and $Rz$ rotations) can be approximated by repeated application of $R_{\hat{n}}$ and Hadamards, i.e. $U \approx R_{\hat{n}}^{n_1}HR_{\hat{n}}^{n_2}HR_{\hat{n}}^{n_3}HR_{\hat{n}}^{n_4}H \dots$, where $n_i$ are integers
  • +
+ +

To sum up, only with $T$ and $H$ gates we can construct any rotation.

+ +

Only question is how to find integers $n_i$ for construction of arbitrary $Rx$, $Ry$ and $Rz$ rotation. Can anybody give me an example of such circuit, for exaple gate $Ry(\pi/8)$?

+",9006,,9006,,5/6/2020 10:15,6/16/2020 18:57,"How to approximate $Rx$, $Ry$ and $Rz$ gates?",,3,10,,,,CC BY-SA 4.0 +11862,1,,,5/5/2020 10:51,,1,66,"

Alice wants to send Bob qubit in state $|\psi_A\rangle = \alpha|0\rangle_A + \beta|1\rangle_A$ , also she has one qubit from GHZ state $\frac{1}{\sqrt 2}(|0\rangle_a|00\rangle +|1\rangle_a|11\rangle)$.

+ +

Then she performs Bell basis
+($|\Psi_{\pm}\rangle_{Aa}=\frac{1}{\sqrt 2}(|00\rangle_{Aa}\pm|11\rangle_{Aa})$, $ |\Phi_{\pm}\rangle_{Aa}=\frac{1}{\sqrt 2}(|01\rangle_{Aa}\pm|10\rangle_{Aa})$ +measurement on qubits $(A, a)$.

+ +

In terms of projection operators and/or measurement operators how can I get expression for this 4-qubit state: +$$|\Psi\rangle_4=\frac{1}{ 2}[|\Psi_{+}\rangle_{Aa}(\alpha|00\rangle +\beta|11\rangle)+|\Psi_{-}\rangle_{Aa}(\alpha|00\rangle -\beta|11\rangle)+|\Phi_{+}\rangle_{Aa}(\beta|00\rangle +\alpha|11\rangle)+|\Phi_{-}\rangle_{Aa}(-\beta|00\rangle +\alpha|11\rangle)]$$

+ +

(I understand that if just simplify this exptression I get $(\alpha|0\rangle_A + \beta|1\rangle_A) \frac{1}{\sqrt 2}(|0\rangle_a|00\rangle +|1\rangle_a|11\rangle)$ ???

+ +

+ +

+",11641,,55,,10/12/2020 21:25,10/12/2020 21:25,What kind of operators should I perform on 4-qubit state $|\psi\rangle_A|GHZ\rangle$ to get expression like $|\Psi\rangle_4$?,,0,1,,,,CC BY-SA 4.0 +11863,1,12191,,5/5/2020 11:24,,4,119,"

We are trying to implement a ""sum over 4 booleans = k"" in the spirit of Grover search. First, we have 4 qubits, one for each boolean q00, q01, q02, q03,; then 4 qubits to computed intermediate sum (q11 and q10 to store ""q00+q01"" where q11 is the carry, etc); then 3 qubits to binary represent the int result q22.q21.q20 (varying between 0 to 3); and then a final qubit to test the result = k (here we want k=1 so 001 is the good result, then 2 X gate on q21 and q22 will bring 111 via the C3Not into q40. Finally q60 is for Grover extraction.

+ +

First we describe the sum (Oracle), then Grover Amplification (separated with a barrier); and done 2 iterations before measurements.

+ +

The histogram result is quite strange despite we found the standard 4 solutions, 0000 and 1111 appear also. +Can someone explain this behaviour?

+ +

+

+",11936,,9006,,5/6/2020 6:37,5/26/2020 9:39,Implementing sum on Boolean with Grover algorithm,,1,0,,,,CC BY-SA 4.0 +11864,2,,10298,5/5/2020 12:56,,1,,"

I could find a few research papers with the potential application of quantum algorithms for Singular Value Decomposition and QR decomposition.

+ +

Singular Value Decomposition: +Singular Value Decomposition (SVD) is one of the most useful techniques for analyzing data in linear algebra. SVD decomposes a rectangular real or complex matrix into two orthogonal matrices and one diagonal matrix. The following research paper proposes a Quantum-SVD algorithm that interpolates the non-uniform angles in the Fourier domain. This Quantum-SVD algorithm is a fundamentally novel approach for the computation of the Quantum Fourier Transformation (QFT) of non-uniform states.

+ +

We can also consider Schmidt decomposition approach for Singular Value Decomposition as per the researches in Quantum Information Theory. It is considered as a Schmidt decomposition has a lot of applications for bipartite state purification.

+ +

Quantum SVD based Approximation Algorithm

+ +

QR Factorisation

+ +

Following research paper proposes a rotation graph to devise elimination orderings in order to achieve QR factorisations. Properties of this graph characterise and identify sufficient sets of rotation planes. The unitary or real orthogonal matrix Q is usually computed in one of three ways: Givens rotations, Householder reflections, or Gram-Schmidt orthogonalization. A Givens-based decomposition is also an essential tool in quantum computing. It is important to determine whether a given set of rotation planes +can be used to reduce a matrix to upper triangular form using a minimal number of +rotations. One interesting rotation graph is the star graph. A second interesting rotation graph is the chain.

+ +

QR Factorisation using Rotation Graphs and Eliminated Orderings

+",4501,,,,,5/5/2020 12:56,,,,1,,,,CC BY-SA 4.0 +11866,2,,8651,5/5/2020 22:01,,1,,"

In addition to the mentioned papers, there has been some interesting research efforts in designing Quantum Distributed Consensus Algorithms. In one of the early approaches, Ellie D’Hondt and Prakash Panangaden has designed a Quantum Distributed Consensus Algorithm using the distinctive properties of W-State and GHZ-state systems. It is detailed in the following research paper. This paper outlines the state computation of quantum processors participating in the distributed consensus through a sequence of symmetric moves in the anonymous network.

+ +

As per this approach, in an anonymous network if the processors share the W -state then a trivial protocol allows them to solve the leader election problem. Similarly the GHZ-state is the only shared quantum resource that allows solution of distributed consensus. It has devised these state based quantum processors to realise a Quantum Leader Election and Quantum Distributed Consensus in an anonymous network.

+ +

The W state is one of the two non-biseparable classes of three-qubit states (the other being the GHZ state), which cannot be transformed into each other by local quantum operations. Thus W and GHZ represent two very different kinds of tripartite entanglement. This property is quite useful in constructing unique local views of quantum states among processors participating in the distributed consensus. It is also quite efficient to construct quantum distributed network state among the participants in the consensus. The emergence of GHZ state and W state in this consensus algorithm has definite role in the symmetry breaking state transitions and state termination events.

+ +

There is another relevant approach is proposed by Bogdan S. Chlebus, Dariusz R. Kowalski and Michał Strojnowski in the the following journal. This algorithm seems to be attempting a scalable quantum Consensus for crash failures, essentially focusing on designing a CFT consensus algorithm. One interesting aspect of this paper is that it factors the impact of quantum adversaries in a distributed consensus context. It is also attempting a randomised approach to arrive at the eventual finality.

+",4501,,,,,5/5/2020 22:01,,,,0,,,,CC BY-SA 4.0 +11867,1,,,5/6/2020 0:36,,2,49,"

I tried to run the starter program demonstrated on this page: +http://docs.rigetti.com/en/stable/start.html#installing-the-qvm-and-compiler-on-linux-deb

+ +

With the following code:

+ +
# construct a Bell State program
+p = Program(H(0), CNOT(0, 1))
+
+# run the program on a QVM
+qc = get_qc('9q-square-qvm')
+result = qc.run_and_measure(p, trials=10)
+for i in range(10):
+    print(result[i])
+
+ +

And all of result[i]'s turn out to be the same.

+ +

Is this expected? +If not, what might I be doing wrongly?

+",11944,,55,,5/10/2020 7:52,6/9/2020 8:04,Pyquil run_and_measure gives the same output across all the trials: is this expected?,,1,0,,,,CC BY-SA 4.0 +11868,2,,11867,5/6/2020 3:47,,1,,"
+

And all of result[i]'s turn out to be the same.

+
+ +

This is what I get from the program you posted:

+ +
[1 0 1 0 1 0 1 1 1 0]
+[1 0 1 0 1 0 1 1 1 0]
+[0 0 0 0 0 0 0 0 0 0]
+[0 0 0 0 0 0 0 0 0 0]
+[0 0 0 0 0 0 0 0 0 0]
+[0 0 0 0 0 0 0 0 0 0]
+[0 0 0 0 0 0 0 0 0 0]
+[0 0 0 0 0 0 0 0 0 0]
+[0 0 0 0 0 0 0 0 0 0]
+Traceback (most recent call last):
+  File ""test.py"", line 16, in <module>
+    print(result[i])
+KeyError: 9
+
+ +

The first 2 arrays are not the same as the rest, but they are correlated (that's what happens after CNOT is applied to an H).

+ +

The key error is because you are performing a run_and_measure on a 9 qubit device and you are trying to print 10 measurement arrays. Studying the docs for run_and_measure: ""This will measure all the qubits on this QuantumComputer, not just qubits that are used in the program. Returns a dictionary keyed by qubit index where the corresponding value is a 1D array of measured bits.""

+ +

Let's print out result

+ +
print(result)
+#0: array([1, 1, 0, 1, 1, 0, 0, 0, 0, 0]), 1: array([1, 1, 0, 1, 1, 0, 0, 0, 0, 0]), 2: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 3: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 4: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 5: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 6: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 7: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]), 8: array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])}
+
+ +

You can see that the 10 different results from run_and_measure of the first qubit and second are the same and the rest are 0's cause we don't apply gates to them.

+",362,,362,,5/6/2020 3:55,5/6/2020 3:55,,,,0,,,,CC BY-SA 4.0 +11869,2,,9826,5/6/2020 4:39,,2,,"

The problem is with installing on the default root conda environment, which already has the required dependencies. Solve by running it on a different conda environment.

+

Create a Conda Environment

+
conda create -n name_of_my_env python=3
+
+

Activate the Conda Environment

+
source activate name_of_my_env
+
+

Install the QiSkit Package

+
pip install qiskit
+
+",11945,,13968,,12/5/2020 23:14,12/5/2020 23:14,,,,5,,,,CC BY-SA 4.0 +11871,1,11876,,5/6/2020 13:06,,2,329,"

I'm reading Horsman et al. ""Surface code quantum computing by lattice surgery"" and I'm wondering about the rotated surface code.

+ +

Consider Figure 13:

+ +

+ +

This is supposed to have distance 5. But in (c), an $X$ error on the top left qubit and the qubit beneath it would be undetectable (brown plaquettes are $X$-stabilizer measurements). If there were a stabilizer measurement on every outside edge, this problem wouldn't occur. What am I misunderstanding?

+",4517,,,,,7/7/2021 13:11,Is there benefit to extra stabilizers in a rotated surface code?,,3,0,,,,CC BY-SA 4.0 +11872,1,11873,,5/6/2020 13:59,,6,204,"

According to Solovay-Kitaev theorem it is possible to approximate any unitary quantum gate by sequence of gates from small set of another gates. The approximation can be done with an arbitrary accuracy $\epsilon$.

+ +

One of such set of gates is composed of Hadamard gate, phase gate ($S$), $\pi/8$ gate ($T$) and CNOT gate. +However, it is also true that $S=T^2$ because $T$ gate is a rotation around $z$ axis by $\pi/4$ and $S$ gate a rotation by $\pi/2$ around the same axis.

+ +

Since $S$ gate can be composed of two $T$ gates, why do we add $S$ gate to the set? It seems that a set containing only $H$, $T$ and CNOT is equivalent. What am I missing?

+",9006,,,,,5/6/2020 14:13,Why is phase gate a member of universal gate set?,,1,0,,,,CC BY-SA 4.0 +11873,2,,11872,5/6/2020 14:13,,5,,"

You might want a small set of gates, but it doesn't necessarily mean that you want the smallest set possible. When you talk about a fault-tolerant quantum computer, what you really want to do is minimise the number of $T$ gates (typically the thing that is hard to implement). Other gates from, for example, the Clifford group, are (relatively) easy to implement, so you would much rather implement $S$ rather than $T^2$.

+",1837,,,,,5/6/2020 14:13,,,,0,,,,CC BY-SA 4.0 +11874,2,,11871,5/6/2020 14:33,,1,,"

The 𝑋 error on the top left qubit and the qubit beneath it indeed produce the same measurement syndrome, but this does not mean they are uncorrectable. Lets call 𝑋 on the top left qubit $𝑋_{topleft}$ and 𝑋 beneath it $X_{beneath}$. $X_{topleft} 𝑋_{beneath}$ is a stabilizer and acts as the identity gate on the logical qubit. So we can choose to correct both errors with either $𝑋_{topleft}$ of $X_{beneath}$.

+ +

Take a look at: +How does Surface-17 tell apart Z errors on Db and Dc?

+",9282,,,,,5/6/2020 14:33,,,,1,,,,CC BY-SA 4.0 +11875,1,11973,,5/6/2020 15:44,,6,249,"

I'm trying to understand the historical ordering and the practical differences between the Toffoli Gate and the Fredkin Gate.

+

Toffoli's February 1980 tech report MIT/LCS/TM-151 states: +

+

Where reference [7] is:

+

+

Conservative Logic is then published in 1982 in at least different guises: an article in International Journal of Theoretical Physics and a chapter in Collision-Based Computing.

+

So the implication to me is that the Fredkin gate precedes the Toffoli Gate.

+

Given that both gates are universal, what is the purpose of trying to simulate Fredkin gates with Toffoli gates, or vice-versa?

+

Also, Which gate is more commonly used, and why? A recent Google search finds 84 results for "Fredkin gate" in the Google index, and 86 results for "Toffoli gate." Both of those seem to be dramatic undercounts.

+",9482,,9482,,9/28/2020 4:06,9/28/2020 4:06,"What are the differences between the Toffoli and Fredkin gates (historical, practical, etc.)",,1,6,,,,CC BY-SA 4.0 +11876,2,,11871,5/6/2020 18:01,,4,,"
+

an X error on the top left qubit and the qubit beneath it would be undetectable

+
+ +

That error would be detected by the flipping of the four body Z stabilizer adjacent to the lower qubit you operated on:

+ +

+ +

If you or I got X and Z mixed up, then the error is undetectable, but it corresponds to a topologically trivial cycle from a boundary to itself, so it has no effect on the logical qubit:

+ +

+",119,,,,,5/6/2020 18:01,,,,0,,,,CC BY-SA 4.0 +11877,1,11890,,5/6/2020 18:52,,2,280,"

Knowing that CX and U3 (taking 3 parameters $\theta, \phi$ and $\lambda$) form a set of universal gates how can I construct an arbitrary CU3 gate using a decomposition of only CX and arbitrary U3 gates?

+",11952,,,,,5/8/2020 10:26,How to construct a CU3 gate using only CX and U3 gates?,,2,0,,,,CC BY-SA 4.0 +11878,2,,11877,5/6/2020 20:32,,3,,"

Here is a construction of $CU3$ gate on IBM Q:

+ +
  u1((lambda+phi)/2) c;
+  u1((lambda-phi)/2) t;
+  cx c,t;
+  u3(-theta/2,0,-(phi+lambda)/2) t;
+  cx c,t;
+  u3(theta/2,phi,0) t;
+
+ +

Where t is a target qubit and c is control qubit.

+ +

Note that $U1$ gate is a special case of $U3$, it holds that $U1(\lambda)=U3(0,0,\lambda)$.

+",9006,,9006,,5/6/2020 21:30,5/6/2020 21:30,,,,0,,,,CC BY-SA 4.0 +11879,1,11883,,5/6/2020 21:07,,1,213,"

I am a little stuck on understanding the measurement probabilities of a 3 qubit system (QCQI q 4.41).

+ +

1)H gates are applied to both $q_1$ and $q_2$

+ +

2) $C^{(1,2)}_3(X)$, a Toffoli, controlled by $q_1$ and $q_2$ is then applied to $q_3$

+ +

3) A Unitary (S gate) is then applied to $q_3$

+ +

4) $C^{(1,2)}_3(X)$, a Toffoli, controlled by $q_1$ and $q_2$ is then applied to $q_3$

+ +

5) H gates are applied to both $q_1$ and $q_2$

+ +

The probability of measuring $|q_1\rangle = |q_2\rangle = 0$ should be $\frac{5}{8}$, however I can only seem to derive $\frac{4}{8}$, by expanding out the tensors and then cancelling.

+ +

After step 4 the state I think is:

+ +

$(|00\rangle + |01\rangle + |10\rangle)\otimes S|q_3\rangle + |11\rangle \otimes XSX|q_3\rangle$

+ +

Then after applying step 5, expanding out and cancelling I am left with:

+ +

$(|00\rangle + |00\rangle + |00\rangle - |11\rangle)\otimes S|q_3\rangle + (|00\rangle - |01\rangle - |10\rangle + |11\rangle)\otimes XSX|q_3\rangle $

+ +

however I can't seem to find the missing $|00\rangle$, and also in this result the measurement of $|00\rangle$ corresponds to two different states of $q_3$. I think the error in my understanding is somewhere here:

+ +

Applying Hs (step 5) and expanding $|11\rangle \otimes XSX|q_3\rangle$

+ +

$(H|1\rangle \otimes H|1\rangle) \otimes IXSX|q_3\rangle$ = $(|00\rangle - |01\rangle - |10\rangle + |11\rangle)\otimes XSX|q_3\rangle $

+ +

Could it also be my misunderstanding that the state of $|q_1q_2\rangle$ going into both Toffoli gates can be different for step 2 & 4? I was assuming that if that state was $|11\rangle$ in the first Toffoli then it must be $|11\rangle$ into the second as well.

+",6139,,55,,6/23/2021 8:43,6/23/2021 8:43,Measuring Probability of Mixed States,,1,0,,,,CC BY-SA 4.0 +11881,1,14297,,5/7/2020 4:38,,2,253,"

What would be the best/prefered bibtex entry for citing cirq ? +Is this ok ?

+ +
@article{cirq,
+    title={Cirq, a python framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits},
+    note={\url{https://github.com/quantumlib/Cirq}}
+    }
+
+",9470,,,,,10/22/2020 17:36,How to cite cirq in a scientific article?,,1,0,,,,CC BY-SA 4.0 +11882,1,11884,,5/7/2020 6:52,,2,360,"

This question was inspired by the following reference:

+ +

Reference paper

+ +

We use the usual notation.  $N = 2^n$ ,  the number of all possible n-bit strings . The oracle  $U_\omega$ can be put in the form  

+ +

$U_\omega=I - 2  (\vert\omega\rangle\langle\omega \vert )$

+ +

$U_\omega$ is a reflection of any vector on the hyperplane orthogonal to $\vert\omega\rangle$

+ +

The vector $\vert s \rangle $ and operator $U_s$ are introduced. 

+ +

$\vert s \rangle = H^{\otimes n} \vert 0 \rangle^{\otimes n}$ , where $H^{\otimes n}$ is the n-qubit Hadamard transform. 

+ +

Operator $U_s$ reflects any vector with respect to $\vert s \rangle$

+ +

$U_s = 2\vert s \rangle \langle s \vert - I$    

+ +

The Grover iteration is $U_{Grover} = U_s U_\omega$

+ +

$U_{Grover}$ rotates (at every iteration) the initial vector $\vert s \rangle$ towards the desired vector $\vert\omega\rangle$ by the angle $2\theta$, where $sin\theta =  \frac{1}{\sqrt{N}}$

+ +

We note that a reflection is expressed by a unitary matrix. That means that the operator defined below is represented by a unitary matrix, therefore a quantum circuit can be designed in order to implement this operator (Edit. This statement was proven false by the answer to this question). 

+ +

We define the operator:

+ +

$U(\vert x \rangle , \vert y \rangle  ) = ( \vert x \rangle , U_x \vert y \rangle) $  , where  $U_x \vert y \rangle$ represents the reflection of $\vert y \rangle$  with respect to $\vert x \rangle$

+ +

In the following relations the vectors  $\vert \xi_i \rangle$ are implicitly defined based on the action of the operator U.

+ +

We consider the following sequence of transformations (based on the definition of the operator U):

+ +

$U(\vert s \rangle ,  U_\omega\vert  s \rangle  ) = (\vert s \rangle ,  U_sU_\omega \vert s \rangle) = (\vert s \rangle , \vert \xi_1 \rangle )$

+ +

$U(\vert \xi_1 \rangle ,  U_\omega\vert  s \rangle  ) = (\vert \xi_1 \rangle ,  U_{\xi_1}U_\omega \vert s \rangle) = (\vert \xi_1 \rangle , \vert \xi_2 \rangle )$

+ +

$U(\vert \xi_2 \rangle ,  U_\omega\vert  s \rangle  ) = (\vert \xi_2 \rangle ,  U_{\xi_2}U_\omega \vert s \rangle) = (\vert \xi_2 \rangle , \vert \xi_3 \rangle )$

+ +

.......................and so on..........................

+ +

$U(\vert \xi_{n-1} \rangle ,  U_\omega\vert  s \rangle  ) = (\vert \xi_{n-1} \rangle ,  U_{\xi_{n-1}}U_\omega \vert s \rangle) = (\vert \xi_{n-1} \rangle , \vert \xi_n \rangle )$

+ +

In other words, the vector to be reflected is fixed but the reflection axis is variable (in the original Grover algorithm it's the other way around ).

+ +

At every step  K of the algorithm above  the initial vector $\vert s \rangle$ is rotated towards the desired vector $\vert\omega\rangle$ by an angle which is at about $2^K\theta$ (as order of magnitude ), where $sin\theta =  \frac{1}{\sqrt{N}}$.  That means that this algorithm will only need about  $log_2 N$ (as order of magnitude ) steps  to reach the target.

+ +

Question 1. Can a quantum circuit be designed, that implements this algorithm, in principle ?

+ +

Question 2. Does this algorithm present an exponential speedup,  when compared to Grover's algorithm?

+ +

Edit. Unfortunately nothing from what I tried seems to work. You need a quantum circuit that takes as input the vector to be reflected and the vector that represents the reflection axis. The output of the quantum circuit must contain the reflected vector. That does not seem possible, as far as I understand. This reflection implementation problem, if ever solved, would lead to an exponential speedup of Grover's algorithm.

+ +

Related question

+",10110,,10110,,5/12/2020 7:38,5/12/2020 8:04,Exponential speedup of Grover's algorithm?,,1,0,,,,CC BY-SA 4.0 +11883,2,,11879,5/7/2020 8:04,,2,,"

I'm not sure that I agree with all of your calculation. I agree up to step 4 (but let's be careful and keep normalisation factors in there), +$$ +\frac{1}{2}(|00\rangle+|01\rangle+|10\rangle)\otimes S|q_3\rangle+|11\rangle\otimes XSX|q_3\rangle, +$$ +which I would even simplify to +$$ +\frac{1}{2}(|00\rangle+|01\rangle+|10\rangle)\otimes S|q_3\rangle+|11\rangle\otimes iS^\dagger|q_3\rangle. +$$ +Now we need to apply the Hadamards +$$ +\rightarrow\frac{1}{4}(|00\rangle+|01\rangle+|10\rangle+|11\rangle+ +|00\rangle-|01\rangle+|10\rangle-|11\rangle+ +|00\rangle+|01\rangle-|10\rangle-|11\rangle)\otimes S|q_3\rangle+i\frac{1}{4}(|00\rangle-|01\rangle-|10\rangle+|11\rangle)\otimes S^\dagger|q_3\rangle. +$$ +Let's simplify the first bracket +$$ +=\frac{1}{4}(3|00\rangle+|01\rangle+|10\rangle-|11\rangle)\otimes S|q_3\rangle+i\frac{1}{4}(|00\rangle-|01\rangle-|10\rangle+|11\rangle)\otimes S^\dagger|q_3\rangle. +$$ +So, we can now regroup terms as +$$ +\frac{1}{4}|00\rangle\otimes(3S+iS^\dagger)|q_3\rangle+\frac{1}{4}(|01\rangle+|10\rangle-|11\rangle)\otimes(S-iS^\dagger)|q_3\rangle. +$$ +At this point, you might get ahead of yourself and try to read off the amplitude for the $|00\rangle$ term, and determine the measurement probability from that. However, you need to be careful to take into account the normalisation of the state of the third qubit. For example, +$$ +(S-iS^\dagger)=(1-i)Z=\sqrt{2}e^{-i\pi/4}Z. +$$ +From this, we conclude that each of the other terms appears with probability $|\sqrt{2}e^{-i\pi/4}/4|^2=1/8$, and applies $Z$ on qubit 3. So, it is clear that the $|00\rangle$ answer must arise with probability 5/8. We just need to check what the rotation is. Let's maipulate it a bit +$$ +3S+iS^\dagger=\left(\begin{array}{cc} 3+i & 0 \\ 0 & 3i+1 \end{array}\right). +$$ +If we write $3+i=\sqrt{10}e^{i\phi}$, then this is +$$ +\sqrt{10}\left(\begin{array}{cc} e^{i\phi} & 0 \\ 0 & ie^{-i\phi}\end{array}\right)=\sqrt{10}e^{i\pi/4}\left(\begin{array}{cc} e^{i(\phi-\pi/4)} & 0 \\ 0 & ie^{-i(\phi-\pi/4)}\end{array}\right). +$$ +The $\sqrt{10}$ contributes to the amplitude of the overall state, so we get $|00\rangle$ with probability $|\sqrt{10}e^{i\pi/4}/4|^2$, as required. The unitary is of the form $R_z(\theta)$ with $\theta/2=\pi/4-\phi$. Hence, +$$ +\cos\theta=\cos\left(\frac{\pi}{2}-2\phi\right)=\sin(2\phi)=\frac{3}{5}. +$$

+",1837,,,,,5/7/2020 8:04,,,,5,,,,CC BY-SA 4.0 +11884,2,,11882,5/7/2020 8:45,,3,,"

TLDR: your operation $U$ does not exist (so the answer to question 2 is irrelevant, and I haven't thought about it).

+ +

You can show that $U$ does not exist in a very similar way to the way that you cloning is impossible. I'll give the very crude sketch here. There are mathematically more robust versions.

+ +

It suffices to show that the transformation is not unitary, provided we include an ancilla in the operation (any CP map can be described by a unitary operator on a sufficiently extended system). So, we want a transformation +$$ +|0\rangle|\psi\rangle|r\rangle\mapsto |0\rangle(I-2|0\rangle\langle 0|)|\psi\rangle|s\rangle +$$ +and a second one +$$ +|\phi\rangle|\psi\rangle|r\rangle\mapsto |\phi\rangle(I-2|\phi\rangle\langle \phi|)|\psi\rangle|s'\rangle. +$$ +Let's consider the inner products. Before the transformation, we have $\langle\phi|0\rangle$, which we'll assume to be non-zero. After the transformation, we have +$$ +\langle\phi|0\rangle \langle\psi|(I-2|\phi\rangle\langle\phi|)(I-2|0\rangle\langle 0|)|\psi\rangle\langle s'|s\rangle. +$$ +The two can only be equal (as required for a unitary) if $|s\rangle=|s'\rangle$ and +$$ +\langle\psi|(I-2|\phi\rangle\langle\phi|)(I-2|0\rangle\langle 0|)|\psi\rangle=1-2|\langle\phi|\psi\rangle|^2-2|\langle0|\psi\rangle|^2+4\langle\psi|\phi\rangle\langle\phi|0\rangle\langle0|\psi\rangle=1. +$$ +It's easy to find a counter-example to this. For example, $|\psi\rangle=|0\rangle$ and and $|\phi\rangle=\cos\theta|0\rangle+\sin\theta|1\rangle$ provided $0<\theta<\pi/2$.

+",1837,,8141,,5/12/2020 8:04,5/12/2020 8:04,,,,7,,,,CC BY-SA 4.0 +11885,1,11892,,5/7/2020 10:08,,4,150,"

I am referring to Nielsen and Chuang Quantum Computation and Quantum Information 10th Anniversary Edition Textbook, Chapter 8.3.

+ +

A linear operator $E_i:H_{QR}\longrightarrow H_Q $ is defined by:

+ +

$$E_i \bigg(\sum_j \lambda_j |q_j\rangle|j\rangle \bigg)\equiv \lambda_i |q_i\rangle$$

+ +

whereby $|q_j\rangle$ and $|j\rangle$ are arbitrary states of system Q and the basis of system R respectively. Define $\varepsilon$ to be the quantum operation with the operation elements {$E_i$}:

+ +

$$\varepsilon(\rho)\equiv \sum_i E_i \rho E_i^{\dagger}$$

+ +

The text went on to say:

+ +

$$\varepsilon(\rho\otimes|j\rangle\langle j'|)=\rho \space \delta_{j,j'}=tr_R(\rho\otimes|j\rangle\langle j'|)$$

+ +

Question: +I do not understand how to arrive at $\delta_{j,j'}$, and what form will be the operator representation of $E_i$ take? From what I've observed, system Q and R are not entangled in the last equation and $E_i$ seems to disregard whatever $|j\rangle$ basis of system R. +Help will be much appreciated.

+",5253,,55,,2/19/2021 18:29,10/24/2022 6:40,"Prove that the partial trace is a quantum operation, finding its Kraus representation",,2,0,,,,CC BY-SA 4.0 +11886,1,11887,,5/7/2020 11:03,,3,67,"

I am new to quantum computing, and I want to make a program to output 0 or 1 randomly by Hadamard gate, and use that information to make a GUI interface. For example, a coin flip program that output ""Tail"" when it is 1, and ""Head"" when it is 0. However, when I try to get raw data by job.result(job), I get the information of the result instead. By the way, here is the code:

+ +
from qiskit import *
+simulator = Aer.get_backend('qasm_simulator')
+qr = QuantumRegister(1)
+cr = ClassicalRegister(1)
+circuit = QuantumCircuit(qr, cr)
+circuit.h(qr[0])
+circuit.measure(qr, cr)
+job = execute(circuit, backend = simulator, shots=1024)
+a = job.result(job) #the problematic code
+print(a)
+
+ +

I use Qiskit with Python, and do not use Jupyter notebooks.

+",11962,,9006,,5/7/2020 11:33,5/7/2020 11:33,How can I make qiskit output raw data?,,1,0,,,,CC BY-SA 4.0 +11887,2,,11886,5/7/2020 11:30,,2,,"

You need to do .get_counts() to get a dictionary of the counts returned by the circuit. You would do this as follows

+ +
job = execute(circuit, backend = simulator, shots=100)
+result = job.result()
+counts_dict = result.get_counts()
+
+ +

Using your circuit and this code, counts_dict will look something like {'0':497, '1':503}. From there you might want to extract the key which has a higher value to be the result of your coin flip.

+",5955,,,,,5/7/2020 11:30,,,,1,,,,CC BY-SA 4.0 +11888,1,12418,,5/7/2020 11:32,,7,497,"

A $z$ rotation gate is defined as +$$ +Rz(\theta)=\mathrm{e}^{-i\frac{\theta}{2}Z}= +\begin{pmatrix} +\mathrm{e}^{-i\frac{\theta}{2}} & 0 \\ +0 & \mathrm{e}^{i\frac{\theta}{2}} +\end{pmatrix}, +$$

+ +

however, when one uses $Rz$ gate on IBM Q, the results are these (tested in Visualization of state vector):

+ +
    +
  • $Rz(\theta)|0\rangle = |0\rangle$
  • +
  • $Rz(\theta)|1\rangle = \mathrm{e}^{i\theta}|1\rangle$
  • +
+ +

This means that a matrix representation of such gate is

+ +

$$ +Rz^{\text{IBM}}(\theta)= +\begin{pmatrix} +1 & 0 \\ +0 & \mathrm{e}^{i\theta} +\end{pmatrix}. +$$

+ +

So, it seems that $Rz(\theta)$ is on IBM Q implemented with $U1(\theta)$ gate.

+ +

Since gates $Rz(\theta)$ and $Rz(\theta)^\text{IBM}$ differs only by global phase $\theta/2$ ($Rz^\text{IBM} = \mathrm{e}^{i\frac{\theta}{2}}Rz(\theta))$, this difference can be neglected. However, in case of controlled version of $z$ rotation the global phase matters.

+ +

Controlled version of $Rz$ is described by matrix

+ +

$$ +CRz(\theta)= +\begin{pmatrix} +1 & 0 & 0 & 0\\ +0 & 1 & 0 & 0\\ +0 & 0 & \mathrm{e}^{-i\frac{\theta}{2}} & 0 \\ +0 & 0 & 0 & \mathrm{e}^{i\frac{\theta}{2}} +\end{pmatrix} +$$

+ +

On IBM Q, controlled version of $Rz$ behaves according to this matrix which is right.

+ +

Despite the global phase can be neglected in case of single qubit gates, one would expect that relation between a single qubit gate $U$ and its contolled version, i.e.

+ +

$$ +CU= +\begin{pmatrix} +I & O \\ +O & U +\end{pmatrix}, +$$

+ +

will be preserved. In some cases the convention used by IBM for $Rz$ can be confusing (discussed for example here).

+ +

So far, I have counted with this fact but I am curious: Why does IBM use its own convention and does not follow definitions used in quantum physics?

+ +

(I would appreciate if somebody from IBM Q development team could give an insight to this).

+",9006,,9800,,5/10/2020 16:31,6/21/2020 19:41,Why is a different convention used for the $Rz$ implementation on IBM Q?,,1,1,,,,CC BY-SA 4.0 +11889,2,,11885,5/7/2020 11:59,,-1,,"

Say $\lambda_j=\delta_{j,k}$ so that the first equation gives:
+$$ +E_i\left|q_k\right>\left|k\right>=\delta_{k,i}\left|q_i\right> +$$ +Now, we can write $\rho$ as:
+$$ +\rho = \sum_k p_k \left|q_k\right>\left<q_k\right| +$$ +so that
+$$ +\varepsilon(\rho\otimes\left|j\right>\left<j'\right|)=\sum_i\sum_k p_k E_i \left|q_k\right>\left|j\right>\left<q_k\right|\left<j'\right|E_i\dagger = \sum_{i,k}p_k\delta_{j,i}\delta_{j',i}\left|q_k\right>\left<q_k\right| +$$ +This term is non-zero only when both kronecker deltas are 1 which happens only when $i=j$ and $i=j'$, which is only possible when $j=j'$. This gives us the required
+$$ +\varepsilon(\rho\otimes\left|j\right>\left<j'\right|)=\delta_{j,j'} \sum_k p_k \left|q_k\right>\left<q_k\right| = \rho \delta_{j,j'} +$$

+",10165,,2687,,5/7/2020 15:52,5/7/2020 15:52,,,,0,,,,CC BY-SA 4.0 +11890,2,,11877,5/7/2020 12:02,,5,,"

I use the ideas from these slides, specifically slide 8,9,10.

+ +

We can decompose any $U_{3}(\theta,\phi,\lambda)$ into a rotation around the $Z,Y$ & again $Z$ axis, because for any $U \in SU(2)$ we can write: +\begin{equation} +U = +\begin{bmatrix} +e^{i(\alpha-\frac{\beta}{2}-\frac{\delta}{2})}\cos(\frac{\gamma}{2}) +& +e^{i(\alpha-\frac{\beta}{2}+\frac{\delta}{2})}\sin(\frac{\gamma}{2}) +\\ +e^{i(\alpha+\frac{\beta}{2}-\frac{\delta}{2})}\sin(\frac{\gamma}{2}) +& +e^{i(\alpha+\frac{\beta}{2}+\frac{\delta}{2})}\cos(\frac{\gamma}{2}) +\end{bmatrix} += e^{i\alpha}R_{z}(\beta)R_{y}(\gamma)R_{z}(\delta), +\end{equation}

+ +

where $\beta$, $\gamma$ & $\delta$ can be computed straightforwardly from $\theta$, $\phi$ and $\lambda$.

+ +

Then, let $A = R_{z}(\beta)R_{y}(\gamma/2)$, $B = R_{y}(-\gamma/2)R_{z}(-\delta/2-\beta/2)$ and $C = R_{z}(\delta/2 - \beta/2)$.

+ +

A straightforward calculation shows that: +\begin{equation} +\begin{split} +ABC &= R_{z}(\beta)R_{y}(\gamma/2)R_{y}(-\gamma/2)R_{z}(-\delta/2-\beta/2)R_{z}(\delta/2 - \beta/2) = I\\ +AXBXC &= R_{z}(\beta)R_{y}(\gamma/2)XR_{y}(-\gamma/2)R_{z}(-\delta/2-\beta/2)XR_{z}(\delta/2 - \beta/2) \\ +&= R_{z}(\beta)R_{y}(\gamma/2)R_{y}(\gamma/2)XXR_{z}(\delta/2+\beta/2)R_{z}(\delta/2 - \beta/2) \\ +&= R_{z}(\beta)R_{y}(\gamma)R_{z}(\delta) = e^{-i\alpha}U. +\end{split} +\end{equation}

+ +

We can use this fact to implement $CU$ by using two $CX$ gates that we apply between the $A$&$B$ and the $B$&$C$ gates: +\begin{equation} +\begin{split} +&(I\otimes A)CX(I\otimes B)CX(I\otimes C) \\ += &\big(|0\rangle\langle0|\otimes ABC\big) + \big(|1\rangle\langle1|\otimes AXBXC\big) \\ += &\big(|0\rangle\langle0|\otimes I\big) + \big(|1\rangle\langle1|\otimes e^{-i\alpha}U\big) \\ += & CU \big(R_{z}(\alpha)\otimes I\big) +\end{split} +\end{equation} +where the last phase gate on the control qubit is needed because we have the phase $\alpha$ in our equality $U = e^{i\alpha}AXBXC$.

+ +

This allows us to implement any controlled-$U$ gate.

+",8141,,8141,,5/8/2020 10:26,5/8/2020 10:26,,,,1,,,,CC BY-SA 4.0 +11891,2,,11826,5/7/2020 12:28,,5,,"

To add on the answer of Martin Vesely:

+

RSA is not safe against a general quantum computer, because of Shor's algorithm (see link in other answers), which translates the problem at hand (in RSA) of factorizing large coprime numbers to a problem of period finding within a function (namely, the discrete logarithm). Quantum computers are, among other things, good in period finding through the quantum Fourier transform.

+

Moreover, RSA is not the only classical encryption standard that can be translated into period finding; for instance some forms of elliptic curve cryptography. All these standards are, to an extent, known as 'discrete logarithm' cryptography standards. The discrete logarithm is the source of the hardness of these standards.

+

For post-quantum cryptography, there are essentially two ways to go:

+
    +
  • Post-quantum (classical) cryptography, with a promising candidate forms of lattice based cryptography. The hardness in computing the keys for these standards are also evident on quantum computers (they are not all-powerful machines); in complexity theory terms we say that these problems are outside $BQP$, the $P$-equivalent of quantum computers.

    +
  • +
  • Quantum cryptography, where you use the powers of quantum computers (or rather quantum networks) to attain what some people call inherently safe cryptography: the key is not hidden through some hard-to-compute calculation as with RSA or other classical encryption standards, but the key is inherently not-computable or knowable (using one-time pad encryption, where the key is generated through the quantum cryptography protocol). Even if the adversary was all-powerful and had all the computable power imaginable, the encryption cannot be broken, provable based on our current understanding of nature (specifically, quantum physics).$^{1}$

    +
  • +
+

Note that all of the above is on public or asymmetrical cryptography, where the key is not shared in advance. For symmetric key encryption like AES, a quantum computer can have at most a quadratic speedup through Grover's search algorithm, which allows us to search the database of possible keys quadratically fast. This is, at least from a theoretical perspective, not an issue: just double the key size and breaking is equally hard again. In practice, symmetrical key encryption will not be impacted by quantum computers.

+

$^{1}$ This is the theoretical slimmed down version. Of course, in practice, there are many caveats and exclusions. For some more discussion see this previous question and answer and this answer it references on the cryptography stack exchange.

+",8141,,10480,,1/21/2021 17:58,1/21/2021 17:58,,,,1,,,,CC BY-SA 4.0 +11892,2,,11885,5/7/2020 12:30,,4,,"

I think the presentation in N&C is a little confusing because $\rho$ is used in two contexts. I'll substitute one of those for a $\sigma$.

+

You can define +$$ +E_i=I\otimes\langle i|, +$$ +which will certainly achieve the effect stated in your first equation. This lets us define the quantum operation +$$ +\mathcal{E}(\sigma)=\sum_iE_i\sigma E_i^\dagger +$$ +where $\sigma$ is a density matrix on $QR$.

+

Now, let $\rho$ be a density matrix on $Q$. We have +\begin{align} +\mathcal{E}(\rho\otimes|j\rangle\langle j'|)&=\sum_iE_i(\rho\otimes|j\rangle\langle j'|)E_i^\dagger\\ +&=\sum_i(I\otimes\langle i|)(\rho\otimes|j\rangle\langle j'|)(I\otimes|i\rangle)\\ +&=\sum_i\rho\otimes\langle i|j\rangle\langle j'|i\rangle\\ +&=\sum_i\rho\otimes\delta_{i,j}\delta_{j',i}\\ +&=\rho\otimes\delta_{j,j'}\\ +&=\rho\delta_{j,j'} +\end{align}

+",1837,,18369,,10/24/2022 6:40,10/24/2022 6:40,,,,1,,,,CC BY-SA 4.0 +11893,1,,,5/7/2020 13:03,,2,70,"

This question is from Nielson and Chuang's Quantum Computation and Quantum Information:

+ +

+ +

Here $|\alpha\rangle$ is given by: +$$\frac{1}{\sqrt{N-M}}\sum_{x} ""|x\rangle $$ +where $\sum_{x}"" |x\rangle$ is the sum of states which are not the solution.

+ +

and $|\beta\rangle $ is given by: +$$ \frac{1}{\sqrt{M}}\sum_{x} ' |x\rangle $$ +where it represents all $M$ solutions.

+ +

$\theta$ is defined by: +$$\cos\Big(\frac{\theta}{2}\Big) = \sqrt{\frac {N-M}{N}}$$

+ +

I understand everything mentioned above as well as the further geometric visualization. However, I am having trouble trying to come up with a justified way to solve this exercise. The only thing that I understand is that $G$ must be a unitary Matrix made up of trigonometric functions. How can I approach this problem?

+",10376,,55,,10/12/2020 21:25,10/12/2020 21:25,Writing Grover's Iterator in different computational phase,,1,0,,5/11/2020 22:58,,CC BY-SA 4.0 +11894,1,11914,,5/7/2020 14:33,,3,134,"

Is there already evidence today (e.g. basic theoretical research or even prototypes) on what the next technolgy will be/could be that is superior to quantum computers?

+ +

Or have we reached the ""pinnacle computing technology"" with quantum computers and the only thing left to do is to build larger and larger (in terms of qubits) quantum computers with a more advanced architecture? If the latter is true, why is that?

+ +

If this is not the correct Stack Exchange site to ask this question, I apologize. In that case, please, point me to a better suited one.

+",11849,,11849,,5/8/2020 7:12,5/8/2020 12:27,Is quantum computing the most advanced computing technology we will ever have?,,1,3,0,5/11/2020 22:28,,CC BY-SA 4.0 +11895,1,11955,,5/7/2020 15:45,,10,611,"

In supremacy experiment Google has used $\sqrt{X}$ and $\sqrt{Y}$ as two of their single qubit gates (paper).

+ +

So My questions are:

+ +
    +
  • Is there any specific reason for choosing these gates and not $X$ and $Y$ instead?
  • +
  • Is it because of technical issues like the natural choice for transmon qubits are these gates?
  • +
  • Or is it about complexity of the algorithm that is needed to simulate these gates?
  • +
+",10456,,2293,,5/11/2020 1:32,5/11/2020 2:45,Why Google has used $\sqrt{X}$ and $\sqrt{Y}$ instead of $X$ and $Y$ in supremacy experiment?,,1,1,,,,CC BY-SA 4.0 +11896,2,,11893,5/7/2020 16:03,,1,,"

You can rewrite $|\psi\rangle$ in terms of $\alpha$ and $\beta$ i.e. +$$ +|\psi\rangle = \cos(\theta/2)|\alpha\rangle + \sin(\theta/2)|\beta\rangle +$$ +Also, G rotates the state vector by $\theta$ towards $\beta$. +$$ +G|\psi\rangle = \cos(3\theta/2)|\alpha\rangle + \sin(3\theta/2)|\beta\rangle +$$ +$$ +\begin{bmatrix} + x_{11} & x_{12}\\ + x_{21} & x_{22}\\ +\end{bmatrix} +\begin{bmatrix} + \cos(\theta/2)\\ + \sin(\theta/2)\\ +\end{bmatrix} = +\begin{bmatrix} + \cos(3\theta/2)\\ + \sin(3\theta/2)\\ +\end{bmatrix} = +\begin{bmatrix} + \cos(\theta)\cos(\theta/2)-\sin(\theta)\sin(\theta/2)\\ + \sin(\theta)\cos(\theta/2)+\cos(\theta)\sin(\theta/2)\\ +\end{bmatrix} +$$ +By comparison, you can find the value of $x_{11},x_{12},x_{21}$ and $x_{22}$, and hence, G which comes out to be +$$ +\begin{bmatrix} + \cos(\theta) && -\sin(\theta)\\ + \sin(\theta) && \cos(\theta)\\ +\end{bmatrix} +$$

+",11932,,,,,5/7/2020 16:03,,,,0,,,,CC BY-SA 4.0 +11899,1,11924,,5/7/2020 18:54,,10,2274,"

I need to see an example of how Hamiltonian, i.e. any Hermitian matrix, can be decomposed into a linear combination of Pauli matrices.

+

I would prefer an option to do this in larger than 2 dimensions, if that is possible.

+",11968,,2293,,1/11/2022 1:42,1/25/2022 23:31,How can I decompose a matrix in terms of Pauli matrices?,,1,5,,,,CC BY-SA 4.0 +11900,1,,,5/7/2020 20:07,,3,274,"

I am new to this field and I have been baffled by the idea of Oracle for a long time.

+ +

I am aware of the procedure, but I am very confused about how we choose the oracle.

+ +

Let say we have 4 poker cards, the spade of Ace, the club of 7, the heart of 9, and the diamond of 7. I shuffled the four cards and now I want to know where is the spade of ace.

+ +

I would first encode the cards, say 00, 01, 10, and 11 respectively for the spade of Ace, the club of 7, the heart of 9, and the diamond of 7.

+ +

To solve the problem on a quantum computer, I will first initialize the system in the superposition of the four states, and I apply the oracle corresponding to $|00\rangle$ (see Qiskit), and evolve the state and everything, I will finally end up with the state $|00\rangle$.

+ +

My question is how does this result help me in any way? I wanted to know the position of the spade of Ace in the deck of cards but instead I got a state $|00\rangle$, which means spade of the Ace. Am I missing a step somewhere?

+ +

I would appreciate it if the answer could continue with the example, and show from beginning to end how one can find the position of the card.

+",7379,,,,,5/8/2020 9:33,How does the Grover's Algorithm work with a real example?,,1,3,,5/25/2020 12:34,,CC BY-SA 4.0 +11902,1,,,5/7/2020 20:41,,2,37,"

I was wondering, whether there are any problems that we already know are difficult to solve for a quantum computer, and that we could potentially use in cryptography, just as we do now with e.g. the factorization of integers?

+",2098,,,,,5/7/2020 21:52,"Do we already know some problems, that would be hard to solve for quantum computers, and use them in cryptography?",,1,1,,5/8/2020 13:56,,CC BY-SA 4.0 +11903,2,,11902,5/7/2020 21:52,,1,,"

As far as I know a cipher with random key cannot be broken, however, in classical realm it is problematic to distribute the key without being eavesdropped. Probably physical exchange of the key would be necessary which impractical for digital communication.

+ +

As to break random key cipher is not possible according to theory, it is not possible to do so even on a quantum computer. So there is a task difficult (or rather impossible) for a quantum computer which can be used in cryptography.

+ +

But at the same time, quantum computers are used to implement the cipher. A quantum realm allows to create and distribute the random key and the same time being able to realize whether you were eavesdropped or not. See BB84 protocol for more information how this is done.

+",9006,,,,,5/7/2020 21:52,,,,0,,,,CC BY-SA 4.0 +11905,1,11907,,5/7/2020 22:58,,2,249,"

The toffioli gate flips the target bit when both of the control bits are $\vert 1 \rangle $.

+ +

Would it be possible to instead have a gate which flips a target bit when both control bits are 'equal'?

+ +

Possible meanings of equal:

+ +
    +
  1. Control bits are identical: $\vert c1 \rangle = \alpha \vert 0 \rangle + \beta \vert 1 \rangle = \vert c2 \rangle$.

  2. +
  3. Control bits have the same sign/phase: doesn't flip if $\vert c1 \rangle = -\vert c2 \rangle$. Flips otherwise.

  4. +
+ +

I am thinking about this in the context of qubits which may or may not have been marked by the oracle in Grover's algorithm if that helps.

+ +

Many thanks

+",11970,,55,,5/8/2020 12:32,5/8/2020 15:45,Can you make a Toffoli-like gate which flips if control bits are equal?,,3,0,,,,CC BY-SA 4.0 +11906,2,,11905,5/8/2020 1:50,,2,,"

I propose a $3$-input ""Agnew"" gate acting on $\{0,1\}^3$ and producing $3$ outputs as follows:

+ +
1 2 T || 1 2 T
+==============
+0 0 0 || 0 0 1
+0 0 1 || 0 0 0
+0 1 0 || 0 1 0
+0 1 1 || 0 1 1
+1 0 0 || 1 0 0
+1 0 1 || 1 0 1
+1 1 0 || 1 1 1
+1 1 1 || 1 1 0
+
+ +

Here, 1 and 2 are the two control (qu)bits, while T is the target (qu)bit.

+ +

This can be written in matrix form as:

+ +

$$\mathsf{AGNEW}= +\left( +\begin{array}{cccc} + 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0\\ + 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ + 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0\\ + 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0\\ + 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0\\ + 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0\\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1\\ + 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0\\ +\end{array} +\right)$$

+ +

This of course can be written in many other ways.

+ +

This is a permutation matrix, and is unitary. Thus, it is reversible and can be achieved with a quantum computer.

+ +

However, this is a purely classical gate, and the comments in the question about control qubits having the same phase do not immediately fit in to this gate.

+",2927,,,,,5/8/2020 1:50,,,,1,,,,CC BY-SA 4.0 +11907,2,,11905,5/8/2020 2:37,,4,,"

You can decompose that operation into CNOTs and NOTs.

+ +

+",119,,,,,5/8/2020 2:37,,,,0,,,,CC BY-SA 4.0 +11908,1,,,5/8/2020 3:35,,9,449,"

A team of researchers has realized hybrid quantum algorithm for solving a linear system of equations with exponential speedup that utilizes quantum phase estimation, the algorithm demonstrates quantum supremacy and holds high promise to meet practically relevant challenges.

+

https://scirate.com/arxiv/2003.12770

+

https://www.swissquantumhub.com/quantum-supremacy-quantum-hybrid-hhl-algorithm-for-solving-a-system-of-linear-equation/

+

There is also a variational hybrid quantum-classical algorithm for solving linear systems, with the aim of reducing the circuit depth and doing much of the computation classically, called VQLS.

+

https://arxiv.org/abs/1909.05820

+

https://pennylane.ai/qml/demos/tutorial_vqls.html

+

How can we compare both algorithms?

+

In the part of the near-term application of H-HHL paper, they talk about Bayesian deep learning application: "One of the promising applications related to deep neural network training was discussed in [1]: since the extension of the Bayesian approach to deep architectures is a serious challenge, one can exploit the hybrid quantum HHL algorithm developed for Gaussian processes in order to calculate a model’s predictor" +[21].

+

Which algorithm should be better in the next-gen state-of-art 53-Qubits quantum computer for the Quantum Bayesian deep learning algorithm?

+",9226,,2293,,1/24/2021 3:10,1/24/2021 3:23,New Hybrid-HHL algorithm vs VQLS,,1,1,,,,CC BY-SA 4.0 +11909,2,,11905,5/8/2020 9:31,,1,,"
+
    +
  1. Control bits have the same sign/phase: doesn't flip if $\vert c1\rangle=−\vert c2\rangle$. Flips otherwise.
  2. +
+
+ +

is difficult.

+ +

If the state is $-\vert 000\rangle$, there's no way to decide

+ +

$\vert c1\rangle, \vert c2\rangle, \vert t\rangle = \vert 0\rangle, \vert 0\rangle, -\vert 0\rangle$ or

+ +

$\vert c1\rangle, \vert c2\rangle, \vert t\rangle = \vert 0\rangle, -\vert 0\rangle, \vert 0\rangle$.

+",9563,,2927,,5/8/2020 15:45,5/8/2020 15:45,,,,0,,,,CC BY-SA 4.0 +11910,2,,11900,5/8/2020 9:33,,1,,"

In your card example, since you've created the encoding, you've kind of already made Grover's algorithm useless. That is, you already know that 00 is the spade of Ace, so you don't need to search. Grover's algorithm would only help find the spade of Ace if you didn't already know which bitstring encoded it.

+ +

As an example: Suppose you shuffle the cards and you want to know where the spade of Ace is. If you have an encoding from bitstrings to the cards themselves, then of course this can't help you because that encoding doesn't have any information about the ordering after the shuffle.

+ +

Instead, imagine that the encoding was: 00 returned the first card, 01 returned the second card, etc. Now your question is: which card is the spade of Ace?

+ +

Suppose your Grover oracle is able to take this bitstring as input, look at the card in that position, and flip the phase if that card is the space of Ace. Then Grover's algorithm will work. If the spade of Ace is the first card, then Grover's algorithm with return 00.

+ +

Of course this example is a bit too small to really make sense anyway, since you can just look at all the cards. If you had a full deck of 52 cards, it would make a bit more sense: Grover's algorithm could tell you the position of the spade of Ace after only ""looking at"" $\approx\frac{\pi}{2}\sqrt{52}\approx 11$ cards (although you would need some way to look at cards in a coherent superposition).

+",4517,,,,,5/8/2020 9:33,,,,2,,,,CC BY-SA 4.0 +11911,1,11912,,5/8/2020 9:55,,1,82,"

It appears to me that in the survey by Gottesman (around Thm 2) as well as the book by Nielsen and Chuang (Thm 10.2) it is suggested that if a QEC code corrects errors $A$ and $B$ then it also corrects any linear combination of errors (in particular by Gottesman); the sources can be found here:

+ +

Gottesman: https://arxiv.org/abs/0904.2557 +Nielsen, Chuang: http://mmrc.amss.cas.cn/tlb/201702/W020170224608149940643.pdf

+ +

A simple QEC code like Shor's 9-qubit code can correct arbitrary single-qubit errors bc it can correct the Pauli errors if they occur on the same qubit, but clearly it cannot correct more than one error if they occur in the wrong places (e.g. two bitflip errors in the same block). But such an error would be a linear combination of a bitflip error X_1 hitting the first and a bitflip error X_2 hitting the second qubit in the code. What am I missing here?

+",11977,,,,,5/8/2020 10:22,Can a quantum error-correcting code really correct any linear combination of correctable errors?,,1,0,,,,CC BY-SA 4.0 +11912,2,,11911,5/8/2020 10:16,,0,,"

Let's make it even simpler by using the $3$-qubit bit-flip code. That code corrects the errors $E_{1} = XII$,$E_{2} = IXI$ and $E_{3} = IIX$.

+ +

The 'theorem' states that this code can then also correct any error which is a linear combination $E_{l}$ of these errors: +\begin{equation} +E_{l} = \alpha I + \beta E_{1} + \gamma E_{2} + \delta E_{3} +\end{equation}

+ +

Note, however, that the error you describe (a bit flip on the first and the second qubit, let's call it $K$) is described by the operator $K = XXI$, which is not a linear combination of $E_{1}, E_{2} \& E_{3}$. In other words: +\begin{equation} +XXI \not = XII + IXI. +\end{equation}

+ +

If you view the collection of all operators/errors as a space, then $E_{1} = XII$,$E_{2} = IXI$ and $E_{3} = IIX$ form a basis for a subspace of that entire space; the theorem is that every element of that subspace is then also correctable (i.e. you only need to make sure that you can correct the elements from a basis, and the rest of the space comes for free. Any operator outside that space will be non-correctable.

+ +

$K$ is what we call a correlated error: the flips on the first and second qubits are correlated. These errors (also called higher-weight errors) are normally non-correctable by QECC's, and therefore they need to be circumvented at all cost (through fault-tolerance and the likes).

+",8141,,8141,,5/8/2020 10:22,5/8/2020 10:22,,,,1,,,,CC BY-SA 4.0 +11913,1,11972,,5/8/2020 10:27,,3,121,"

I am trying to find a way to implement a unitary transformation in Q# that implements e^(iA) where A is a square matrix. However, I only found ways to do this in Q# if A can be represented as a tensors of Paulis (the Exp operation: https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.primitive.exp or using a PauliEvolutionSet when trying to do Hamiltonian simulation: https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.simulation.paulievolutionset).

+ +

Does anyone know how to do this for a generic matrix A? If for example you want to use a 8x8 matrix, you can't express it in terms of tensors of Paulis...

+ +

Thanks in advance for the help!

+",11979,,55,,5/10/2020 7:50,5/11/2020 18:12,Generic matrix exponential in Q#,,1,0,,,,CC BY-SA 4.0 +11914,2,,11894,5/8/2020 12:27,,3,,"

The question is fine, but I think still a bit difficult to answer in a non-subjective way.

+ +

A cursory exploration on google will provide you with examples of papers proposing computing paradigms based on things such as effects of general relativity (gravitational waves) or string theory, and probably other similar examples.

+ +

I am not qualified enough in those subjects to assess the accuracy or seriousness of such proposals. However, what I think it's fair to say is that there is no alternative model of computation that is widely believed to be ""better"" than quantum computation (or better stated, no physical phenomenon that is widely believed to not being efficiently simulatable with a quantum computer). This is sometimes referred to as the physical Church-Turing thesis.

+ +

Does this mean that there is no such thing? No, it means that we have no clear and non-controversial evidence pointing in that direction (I use these qualifiers because I guess it could be argued that there are phenomena which are not well-described by our current physical theories -- cue merging of QM and general relativity etc. -- so there could be room for something more happening there, but we simply don't know for certain yet).

+",55,,,,,5/8/2020 12:27,,,,0,,,,CC BY-SA 4.0 +11915,1,11935,,5/8/2020 13:49,,5,425,"

In an actual quantum computer, are we designing circuits with Toffoli Gates and then using compilers or optimizers to remove redundancies so that we can use fewer qubits than a full Toffoli gates would require? Or are multiple gates composed by the compilers into a single quantum circuit?

+ +

Are these operations mathematically equivalent if you use Toffoli Gates or Fredkin gates, or is one gate easier for optimizers to work with?

+",9482,,9482,,5/9/2020 12:11,5/10/2020 3:38,Are Toffoli gates actually used in designing quantum circuits?,,2,0,,,,CC BY-SA 4.0 +11916,1,,,5/8/2020 15:04,,8,362,"

Based on my current understanding, a qubit is represented as a vector $(a, b)$ which satisfy $a^2 + b^2 = 1$. Classical bit one can be represented as $(0, 1)$ and bit zero can be represented as $(1, 0)$.

+ +

And then we can have things that cannot be described isomorphically in classical computing such as $(\frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}})$.

+ +

Then, I came to a realization where this is quite similar to trigonometry identity where $\sin^2(t) + \cos^2(t) = 1$.

+ +

Thus, I'm wondering if a qubit is a point $p$ that lies anywhere on the circumference of a unit circle, can a qubit $(a, b)$ be described as $(\sin(t), \cos(t))$ where $t$ is the angle measured from positive $x$-axis to the line formed between $p$ and center of the circle?

+ +

Is this analogy faulty?

+",11980,,55,,10/12/2020 21:24,6/6/2022 9:28,Is it right to think of superposition as just angle?,,2,2,,,,CC BY-SA 4.0 +11917,2,,11916,5/8/2020 15:43,,6,,"

What you have described is a probabilistic bit, and is interesting in its own right, but not 'equal' to a proper quantum bit. A quick search gives for instance this talk (which I have not seen myself).

+ +

Your analogy fails because a general qubit's state cannot be written using one, but rather two free (real) parameters/angles:

+ +

\begin{equation} +|\psi\rangle = \cos(\frac{\theta}{2}) |0\rangle + e^{i\phi}\sin (\frac{\theta}{2})|1\rangle, +\end{equation} +where $\theta$ is divided by $2$ for reasons I briefly mention below.

+ +
    +
  • $\theta$ is like the angle that you have described, which describes the relative 'population' of the $|0\rangle$ and $|1\rangle$ states.
  • +
  • $\phi$ is commonly referred to as the phase (or relative phase) of the qubit, and there's not really a classical analogy. It is of vital importants to the power of the qubit/quantum computer, and some would say that quantum computing is actually only about manipulating this phase is smart ways.
  • +
+ +

Combining these two parameters (and continuing on your intuitive visualtization of viewing the state on a unit circle) we can visualize the state of a qubit as a point on a sphere, specifically the Bloch sphere.

+ +

The $|0\rangle$ and $|1\rangle$ state are the north- and south pole (on the $Z$-axis) of the sphere, respectively, and altering $\theta$ from $0$ to $2\pi$ rotates the state from the north- to the south pole. (Since this is actually just a rotation of $\pi$, we divide $\theta$ by $2$.)

+ +

The phase $\phi$ is then the angle the state vector makes with the $X$-axis (in the $X$-$Y$ plane).

+",8141,,8141,,5/8/2020 20:09,5/8/2020 20:09,,,,0,,,,CC BY-SA 4.0 +11918,2,,11915,5/8/2020 15:55,,5,,"

It depends on what you mean by an ""actual quantum computer"". For arithmetic circuits, and circuits to compute cryptographic operations to act as oracles for Shor's and Grover's algorithm, Toffoli gates are essential and ubiquitous. In fact many papers count Toffoli gates as the main resource.

+ +

I think part of the reason for this is that a Toffoli gate almost acts as a stand-in replacement for an ""AND"" gate. If you use $X$, CNOT, SWAP, and Toffoli, it's very natural to design arithmetic circuits, since these gates have a natural action on bits. If you wanted to design arithmetic circuits with a different gate set, it would probably be very difficult because the action of the gates would be very unintuitive.

+ +

Since there doesn't seem to be any quantum architecture that can perform Toffoli gates directly (they must be built out of other gates), maybe you would want to design a circuit directly out of these other gates and it would be more efficient. But if you do this, you need to pick a gate set, and maybe quantum architectures change and that gate set is no longer efficiently implementable. So then you have an overhead to convert from another gate set anyway, just as you would have if you designed in Toffoli gates.

+ +

That said, recently there has been work assuming a Clifford+T gate set where the T gate is the most expensive, based on the surface code. Then it makes sense to try to find things that are more efficient than just Toffolis. Although, in a lot of the research I've seen, it uses more qubits than a regular Toffoli, to try to make the circuit faster or use fewer T gates.

+",4517,,,,,5/8/2020 15:55,,,,2,,,,CC BY-SA 4.0 +11919,2,,11916,5/8/2020 16:10,,7,,"

That's not too far from the truth.

+

You can always describe the probabilities of a two-outcome event like that: you have $p_1+p_2=1$ and thus defining $c_i\equiv\sqrt{p_i}$ you observe that $(c_1,c_2)$ are distributed on a circle (more precisely, in the upper-right sector of one). +More generally, if an event has $n$ possible outcomes, you can describe the corresponding probabilities as the squares of the components of points on (one sector of) a hypersphere: $p_i\equiv c_i^2$ with $(c_i)_{i=1}^n\equiv\boldsymbol c\in S^{n-1}$.

+

Note that this has nothing to do with quantum mechanics, it's just something that follows from the mathematics on any probabilistic description of an event.

+

The question is, why would you ever want to do this? The answer is that, in QM, it turns out that describing states in the terms of the coefficients $c_i$ (let's call these amplitudes) is simpler. However, it also turns out that using values $c_i\in[0,1]$, as is the case when you define these as square roots of probabilities, is not sufficient to fully describe quantum states. This can be fixed by "promoting" these coefficients to be complex numbers, $c_i\in\mathbb C$. +In the case of a qubit, this amounts to the state being describable as a point on a sphere, rather than on a circle (the complex phases add an additional "phase angle" on top of the "angle" corresponding to the measurement probabilities).

+

In summary, yes you can naturally associate to every point on a circle (a hypersphere) a qubit (qudit). The inverse relation will not hold however: there are more quantum states than those describable in such a way. +It might be worth noting that if you are only interested in what happens in a single measurement basis, then you have a one-to-one relationship between outcome probabilities and a quarter of a circle. This is to be expected, as if you do not work with different measurement bases, everything can be described with classical probability theory.

+",55,,55,,6/6/2022 9:28,6/6/2022 9:28,,,,0,,,,CC BY-SA 4.0 +11920,1,,,5/8/2020 16:35,,1,155,"

I'm using SPSA as an optimizer in VQE algorithm.
+The code runs on ibmq-qasm-simulator.
+I've set SPSA max_trials parameter to 500, but, when I run the code, it makes 1000 iterations.
+I've tried with COBYLA optimizer too, and it makes correctly 500 iterations.
+Does someone know why?
+Thanks

+",11981,,55,,5/10/2020 7:49,5/10/2020 7:49,SPSA max_trials,,1,0,,,,CC BY-SA 4.0 +11921,1,11965,,5/8/2020 17:49,,3,386,"

In exercise 6.7 page 258 in Nielsen and Chuang book, they have a Hamiltonian $H = \left| x \right\rangle \!\!\left\langle x \right| + \left| \psi \right\rangle \!\!\left\langle \psi \right|$ and the purpose is implementing $\exp(-iHt)\left| \psi \right\rangle$, where $\left| \psi \right\rangle = \frac{\sum_{x}\left| x \right\rangle}{\sqrt N}$.

+ +

Regarding the first part of the Hamiltonian, I couldn't understand how I can figure out the circuit implementation (the gates) for the operator $\exp(-i \left| x \right\rangle \!\!\left\langle x \right| \Delta t)$.

+ +

In the book, they implement it as:

+ +

+ +

Could you please explain to me that circuit, and how they come out with it?

+ +

And what the oracle contains? an example with 4-qubits ($exp(-i \left| 0101 \right\rangle \left\langle 0101 \right| \Delta t)$) or else, would be too helpful.

+ +

And thank you.

+",8009,,23,,7/26/2020 18:06,7/26/2020 18:06,How to implement the exponential of an outer product?,,2,1,,,,CC BY-SA 4.0 +11922,2,,11920,5/8/2020 18:34,,2,,"

For each trial SPSA evaluations the objective function twice for + and - some small delta. Hence its total calls to the objective function are twice the max trials number. COBYA makes one evaluation for each iteration, that is what it's behavior is. Other optimizers, that are gradient based, where it's using finite difference method, will make many calls, depending on the number of params, to compute the gradient at each iteration. Oh, and SPSA, when it does calibration up front, will do a few more calls for this purpose.

+",9831,,,,,5/8/2020 18:34,,,,0,,,,CC BY-SA 4.0 +11923,2,,11921,5/8/2020 20:33,,3,,"

When exponentiating a diagonal matrix, you get a new diagonal matrix where the diagonals are exponentiated.

+ +

If the matrix: $-i|x\rangle\langle x|\Delta t$ = $\textrm{diag}(0,i\Delta t)$, the matrix exponential is $\textrm{diag}(e^0,e^{i\Delta t})$ as shown in the 2x2 gate in the figure you showed. You do not need ""oracles"" to do matrix exponentiation, and the fact that the ones in your diagram take several qubits as input, not just one, indicates to me that they have nothing to do with the matrix exponentiation but probably are related to some other part of the problem.

+ +

For your 4-qubit example, write down the diagonal matrix and then exponentiate the diagonals. You will get 15 elements being $e^0=1$, and you will get $e^{-i\Delta t}$ for the other element, depending on how you define $|0101\rangle$ (the way I have defined it, there is no negative sign, so that's why I have a negative sign in my exponential, while your diagram did not).

+",2293,,,,,5/8/2020 20:33,,,,12,,,,CC BY-SA 4.0 +11924,2,,11899,5/8/2020 21:10,,11,,"

I call this the "Paulinomial decomposition" as you are writing the matrix $H$ as a polynomial of Pauli matrices:

+

$H=a_{XX}X_1X_2 + a_{XY}X_1Y_2 +a_{XZ}X_1Z_2 + a_{XI}X_1 + a_{YY}Y_1Y_2 + \cdots $ (for the 2-qubit case).

+

To get the coefficients, you can use this formula:

+

$a_{AB}=\frac{1}{4}\textrm{tr}\left((A_1\otimes B_2)H\right)$

+

For example, here is a 2-qubit gate (the square root of the SWAP gate) written as a polynomial of Pauli matrices:

+ +

You can even do this for a $2^n \times 2^n$ Hamiltonian, for example an 8x8 Hamiltonian can be done like this:

+

$a_{ABC}=\frac{1}{8}\textrm{tr}((A_1\otimes B_2\otimes C_3))H)$

+

I have a code that can also do it for arbitrary matrices (not only $2^n \times 2^n$, but I haven't touched it for 2 years and might need to test it again). If it would be helpful, I can try to dig it up and polish it for you to use.

+",2293,,2293,,4/1/2021 3:47,4/1/2021 3:47,,,,7,,,,CC BY-SA 4.0 +11925,2,,4978,5/9/2020 0:01,,5,,"

While the procedure in the existing answer, based on channel-state duality, applies to general channels, there's a more direct way to obtain Kraus operators for this particular case of the depolarising channel, $\mathcal{E}(\rho) = (1-p)\rho + p \frac{I}{d}$, where $d$ is the Hilbert space dimension. Since $\mathrm{tr}(\rho) = 1$ for any density operator, we can write $\frac{I}{d} = \frac{I}{d}\mathrm{tr}(\rho)$. For any orthonormal basis $\{|1\rangle, \dots, |d\rangle\}$, $I = \sum_i |i\rangle \langle i|$ and $\mathrm{tr}(\rho) = \sum_i \langle i|\rho |i\rangle$, so +$$ \frac{I}{d} = \frac{1}{d}\sum_i|i\rangle\langle i| \sum_j \langle j|\rho|j\rangle = \frac{1}{d} \sum_{i,j} |i\rangle \langle j|\rho|j \rangle\langle i|,$$ +from which we see that a possible set of Kraus operators for $\mathcal{E}$ are $\{|i\rangle \langle j|/\sqrt{d}\}$, with $i,j \in \{1,\dots, d\}$. (You can check that these satisfy the completeness relation.)

+

For the one-qubit case, note that $\{I,X,Y,Z\}$ are related to $\{|0\rangle\langle 0|/\sqrt{2}, |0\rangle\langle 1|/\sqrt{2}, |1\rangle\langle 0|/\sqrt{2},|1\rangle\langle 1|/\sqrt{2}\}$ by a unitary, so by using the unitary freedom in the Kraus representation, we can get from the above representation to the standard $\frac{I}{2} = \rho + X\rho X + Y\rho Y + Z\rho Z$.

+",11984,,11984,,11/1/2021 1:29,11/1/2021 1:29,,,,1,,,,CC BY-SA 4.0 +11926,1,11927,,5/9/2020 9:32,,2,81,"

Statement of the problem.

+ +

I want to consider/design a quantum circuit that takes as input two vectors $\vert x \rangle$  and $\vert y \rangle$. The output of this quantum circuit must contain the reflected vector of   $\vert y \rangle$  with respect to  $\vert x \rangle$  (and whatever else that is irrelevant to the purpose ) . I can't find a solution to this problem.  I am not sure if this reference might give a clue towards a solution (programmable quantum gate arrays?). We work in a Hilbert space of fixed (but large) dimension.

+ +

Question.  Does such a quantum circuit exist?

+ +

Note that a solution for this problem is important,  because if such a quantum circuit exists, then an exponential speedup of Grover's algorithm would become a possibility (relevant for practical problems ),  as can be seen in this question .

+",10110,,55,,5/9/2020 16:53,5/9/2020 19:12,"Can a circuit map $|x,y\rangle$ to the reflection of $|y\rangle$ with respect to $|x\rangle$?",,1,3,,,,CC BY-SA 4.0 +11927,2,,11926,5/9/2020 13:22,,4,,"

Such an operation would not be linear in the $|x\rangle$ input.

+ +

Consider the simplest example with $|x\rangle$ and $|y\rangle$ two qubits. +We want an operation implementing the following transformation: +$$|x\rangle\otimes |y\rangle\to |\psi_{x,y}\rangle\otimes(-|y\rangle + 2|x\rangle\langle x|y\rangle),\tag1$$ +for some output qubit $|\psi_{x,y}\rangle$. +Consider how this would work on the computational basis: +$$\begin{align} + |0,0\rangle&\to \phantom{-}|\psi_{00},0\rangle, \\ + |0,1\rangle&\to -|\psi_{01},1\rangle, \\ + |1,0\rangle&\to -|\psi_{10},0\rangle, \\ + |1,1\rangle&\to \phantom{-}|\psi_{11},1\rangle. +\end{align}$$ +Now consider the action of this map on $|+,0\rangle$. +Eq. (1) would tell us that +$$|+,0\rangle\to -|0\rangle+2\frac{1}{\sqrt2}|+\rangle = |1\rangle.$$ +At the same time, linearity would imply +$$|+,0\rangle\to (|\psi_{00}\rangle-|\psi_{10}\rangle)\otimes|0\rangle,$$ +which is clearly not how the reflection operation should behave.

+ +

The fact that the operation is non-linear (rather than just non-unitary) tells you that there is no way of using additional ancillary degrees of freedom to implement it: there is no quantum channel achieving this operation. +At the same time, for every $x$, the action on $y$ is linear (and if this wasn't the case, that would be a rather big problem for anything Grover-related).

+ +

This means that $x$ needs to be part of the specification of $\Phi$, which is how it usually appears when discussing Grover (the projections are essentially unitaries parametrised by an $x$). +Now, this might appear contradictory: after all, if I ""enlarge enough the black box"", at some point I must be able to describe the choice of $x$ as input to some operation. +If I were to guess, the solution to this conundrum is that this reflection operation is possible, as long as you don't require it to work on all $x$. +In other words, it's fine to have this operation, provided you restrict the possible choices of $x$ to an orthogonal set of vectors (e.g. $|0\rangle$ and $|1\rangle$ in this case). Note how this is exactly the same situation you have for the ""cloning operation"".

+",55,,55,,5/9/2020 19:12,5/9/2020 19:12,,,,14,,,,CC BY-SA 4.0 +11928,1,11929,,5/9/2020 14:49,,1,395,"

As I understood, the X gate flips the state around : $X(|0\rangle) = |1\rangle$. It can also be visualized with a $\pi$ rotation around the $x$ axis in the Bloch sphere. I have no problem with that.

+ +

The problem is with the minus state. The Bloch sphere visualization of the Hadamard gate is a $\pi$ rotation around the $z$ axis and a $\pi/2$ rotation around the $y$ axis. This makes it that when we use the H gate on the basis state we obtain $H(|0\rangle) = \frac {|0\rangle+|1\rangle} {\sqrt 2} = |+\rangle$ and $H(|1\rangle) = \frac {|0\rangle-|1\rangle} {\sqrt 2} = |-\rangle$. I understand that without any problem.

+ +

These two states are on the $x$ axis, this means that applying an X gate and therefor create a rotation shouldn't change anything. This is the case with the $|+\rangle$ state since $X(|+\rangle) = |+\rangle$. However. I simply do not understand how the case of the $|-\rangle$ state can be explained $X(|-\rangle) = -|-\rangle$ using the Bloch sphere since a rotation of $\pi$ around the $x$ axis shouldn't change anything.

+ +

Thanks for reading, and I hope you can explain

+ +

PS : I do understand the other demonstration $X(|-\rangle) = X(\frac {1}{\sqrt 2}|0\rangle-\frac {1}{\sqrt 2}|1\rangle)=\frac {1}{\sqrt 2}|\rangle-\frac {1}{\sqrt 2}|0\rangle=-|-\rangle$

+",8746,,,,,5/9/2020 15:04,Effect of Pauli X gate on minus state using bloch sphere,,1,0,,,,CC BY-SA 4.0 +11929,2,,11928,5/9/2020 15:04,,1,,"

You are correct on the part that rotation about the X axis should not cause any change in the Bloch Sphere representation. In fact, $\left|-\right>$ and $-\left|-\right>$ do have the same Bloch sphere representation. Since $-\left|-\right>=e^{i\pi}\left|-\right>$, the two states differ only by a global phase factor. The the Bloch sphere representation is independent of the global phase as it has 'no observable effect' on the state.
+Section 1.2 of Nielson-Chuang (mainly page 15 in the 10th anniversary edition) can be a good reference!

+",10165,,,,,5/9/2020 15:04,,,,1,,,,CC BY-SA 4.0 +11932,1,11933,,5/9/2020 19:06,,6,3043,"

I am trying to make circuit for $C^3Z$ gate I have seen a circuit for $C^2Z$ or $CCZ$ gate made by using $CCX$ gate so is there any way to make circuit for $C^3Z$ in this similar manner( i.e by using $CCX$ gate) or i have to do something different then this method Fig. is below for $CCZ$ gate +

+",8527,,8527,,5/16/2020 7:30,5/16/2020 7:30,How to make circuit for n-control Z gate( i.e $C^3Z$ )?,,1,0,,,,CC BY-SA 4.0 +11933,2,,11932,5/9/2020 21:53,,7,,"

The circuit you showed above for the double-controlled $Z$ gate can be extended to a triple-controlled $Z$ by adding an extra Toffoli and ancilla:

+ +

+ +

Qiskit offers such circuits readily in the circuit library, where you have many different possibilities to implement your multi-controlled Z gate.

+ +

Using the MCMT (multi-controlled multi-target circuit) is one option. +You can either use the v-chain version with ancillas, which produces the same circuit as above:

+ + + +
from qiskit.circuit.library import MCMTVChain
+c3z = MCMTVChain('z', num_ctrl_qubits=3, num_target_qubits=1)
+c3z.draw(output='mpl')
+
+ +

+ +

Or you can use an ancilla-free version:

+ + + +
from qiskit.circuit.library import MCMT
+c3z = MCMT('z', num_ctrl_qubits=3, num_target_qubits=1)
+c3z.decompose().decompose().draw(output='mpl')
+
+ +

+ +

In principle you there's always a tradeoff in the number of ancilla qubits you can use and the depth of the circuit. More ancillas usually allows to use less gates, but more ancillas are costly or may not be available at all!

+ +

Excursion to multi-controlled $X$ gates

+ +

Since you know that $Z = HXH$ another possibility would be to use the multi-controlled $X$ gate from Qiskit. Since there are different methods on how the multi-controlled $X$ can be implemented you can choose the mode you want as either of 'noancilla' 'recursion' 'v-chain' 'v-chain-dirty-ancilla':

+ +
from qiskit import QuantumCircuit
+
+noancilla = QuantumCircuit(4)
+noancilla.h(3)  # H on target qubit
+noancilla.mcx([0, 1, 2], 3, mode='noancilla')
+noancilla.h(3)  # again H on target qubit
+noancilla.draw()
+
+
+q_0: ───────■───────
+            │       
+q_1: ───────■───────
+            │       
+q_2: ───────■───────
+     ┌───┐┌─┴─┐┌───┐
+q_3: ┤ H ├┤ X ├┤ H ├
+     └───┘└───┘└───┘
+
+ +

The recursion mode uses only one ancilla and recursively splits the number of controls until we have a 3 or 4 controls for which the controlled-X is hardcoded. Here, since you only have 3 controls, it does not need an ancilla (since Qiskit knows a concrete 3-controlled X implementation). But if you have more than 4 qubits you need an ancilla.

+ +
n = 5  # number of controls
+recursion = QuantumCircuit(n + 1 + 1)  # one for target, one as ancilla
+recursion.h(n)  # H on target qubit
+recursion.mcx(list(range(n)), n, ancilla_qubits=[n + 1], mode='recursion')
+recursion.h(n)  # again H on target qubit
+recursion.decompose().draw()
+
+q_0: ──────────────■─────────■───────────────────
+                   │         │                   
+q_1: ──────────────■─────────■───────────────────
+                   │         │                   
+q_2: ──────────────■─────────■───────────────────
+                   │         │                   
+q_3: ──────────────┼────■────┼────■──────────────
+                   │    │    │    │              
+q_4: ──────────────┼────■────┼────■──────────────
+     ┌──────────┐  │  ┌─┴─┐  │  ┌─┴─┐┌──────────┐
+q_5: ┤ U2(0,pi) ├──┼──┤ X ├──┼──┤ X ├┤ U2(0,pi) ├
+     └──────────┘┌─┴─┐└─┬─┘┌─┴─┐└─┬─┘└──────────┘
+q_6: ────────────┤ X ├──■──┤ X ├──■──────────────
+                 └───┘     └───┘                 
+
+ +

The v-chain implementation is similar to the $Z$ gate implementations with the Toffolis. Here you need $n - 2$ ancillas, if $n$ is the number of controls.

+ +
vchain = QuantumCircuit(n + 1 + n - 2)  # needs n - 2 ancillas
+vchain.h(n)  # H on target qubit
+vchain.mcx(list(range(n)), n, ancilla_qubits=list(range(n+1, 2*n-1)), mode='v-chain')
+vchain.h(n)  # again H on target qubit
+
+
+q_0: ───────■────────
+            │        
+q_1: ───────■────────
+            │        
+q_2: ───────■────────
+     ┌───┐┌─┴──┐┌───┐
+q_3: ┤ H ├┤0   ├┤ H ├  # if you decompose this you'll see
+     └───┘│  X │└───┘  # the exact implementation, try
+q_4: ─────┤1   ├─────  # vchain.decompose().decompose().draw()
+          └────┘     
+
+",9800,,,,,5/9/2020 21:53,,,,0,,,,CC BY-SA 4.0 +11934,1,11936,,5/10/2020 2:11,,1,940,"

I am importing from qiskit.circuit.library import MCMTVChain on python IDLE editor but it showing error ModuleNotFoundError: No module named 'qiskit.circuit.library' although it's working fine on google colab. Also why Qiskit does not work properly on python IDLE it's show lots of other error not just this one?

+",8527,,55,,5/10/2020 7:44,5/10/2020 7:44,ModuleNotFoundError: No module named 'qiskit.circuit.library',,1,0,,,,CC BY-SA 4.0 +11935,2,,11915,5/10/2020 3:38,,6,,"

I guess you assume that you can implement any quantum circuit using Toffoli gates only; this is not true.

+ +

Toffoli gate is classically universal, but not quantum universal. The importance of Toffoli gate in quantum information science is based on 2 facts:

+ +
    +
  • Toffoli gate is classically universal, that is you can implement any classical circuit using Toffoli gates only;
  • +
  • Toffoli gate is reversible, so it is also a quantum gate.
  • +
+ +

The existence of Toffoli gate is a proof that you can implement any classical circuit using quantum circuit.

+ +

The notion of universal quantum set of gates is more subtle compared with classical case. A set of quantum gates is said to be computationally universal if it can simulate any quantum circuit with arbitrarily small error, and the simplest computationally universal set of quantum gates is Toffoli and Hadamard gates; see A Simple Proof that Toffoli and Hadamard are Quantum Universal

+",2105,,,,,5/10/2020 3:38,,,,1,,,,CC BY-SA 4.0 +11936,2,,11934,5/10/2020 5:47,,3,,"

You most probably haven't installed the qiskit module. Qiskit can be installed via :

+ +
pip install qiskit
+
+ +

Try the following commands in command prompt, one of them should work (if your PATH variables are appropriately set):

+ +
py -m pip install qiskit
+
+ +

Or

+ +
python -m pip install qiskit
+
+ +

Or if you have more than one python versions, you can try:

+ +
py -'version number like 3.7' pip install qiskit
+
+ +

without the quotes.

+ +

This should install the qiskit module and then you can import it.

+",14,,,,,5/10/2020 5:47,,,,0,,,,CC BY-SA 4.0 +11937,1,11938,,5/10/2020 10:07,,0,41,"

Consider a Bell scenario: Alice and Bob perform measurements on a shared system, and each of them has a ""measurement box"" with a bunch of inputs (corresponding to different measurement settings) and corresponding outputs.

+ +

Say they can each choose from $m$ possible inputs, labelled as $x,y\in\{1,...,m\}$, and can get one of $\Delta$ possible outputs $a,b\in\{1,...,\Delta\}$ (taking the notation from (1303.2849)).

+ +

In this context, a behaviour is a set of joint probabilities $\boldsymbol p\equiv \{p(ab|xy)\}_{abxy}\in\mathbb R^{\Delta^2 m^2}$. +A local deterministic behaviour is a behaviour such that $p(ab|xy)=\delta_{a,a_x}\delta_{b,b_x}$ for some pair $(a_x,b_y)$ associated with each $(x,y)$.

+ +

I want to count the number of such behaviours.

+ +

To do this, I would have said that, for each $(x,y)$, there are $\Delta^2$ possible outcome assignments, as $a_x$ and $b_x$ can be chosen independently. At the same time, there are $m^2$ possible pairs $(x,y)$, and thus the total number should be $(\Delta^2)^{m^2}=\Delta^{2 m^2}$. +However, in (1303.2849) (between (17) and (18)) they state that this number is $\Delta^{2m}$. Why is my calculation off?

+",55,,,,,5/10/2020 10:07,What is the number of local deterministic behaviours in a Bell scenario?,,1,0,,,,CC BY-SA 4.0 +11938,2,,11937,5/10/2020 10:07,,1,,"

I figured out the answer while writing the question, but figured I'd still post it for future reference.

+ +

The problem with the calculation is that it was not taking into account the locality constraint. Namely, the fact that local deterministic behaviours also have to satisfy +$$p(ab|xy)=p(a|x)p(b|y).$$ +Taking this into account, we notice that there are $\Delta^m$ possible assignments for $p(a|x)$, and the same number of $p(b|y)$, making for a total number of +$(\Delta^m)^2=\Delta^{2m}$ local deterministic assignments, as reported in the reference.

+",55,,,,,5/10/2020 10:07,,,,0,,,,CC BY-SA 4.0 +11939,2,,10264,5/10/2020 13:26,,0,,"

I will here spell out more explicitly what the vertices of the local polytope look like.

+ +

The local polytope is generated by local deterministic behaviours

+ +

The local polytope is, by definition, comprised of behaviours $p(ab|xy)$ such that +$$p(ab|xy)=\sum_\lambda p_\lambda p_\lambda(a|x) p_\lambda(b|y).$$ +Moreover, for each $\lambda$ and $x$, we can always decompose $p_\lambda(a|x)$ as a convex combination of local deterministic assignments. For example, +if $p_\lambda(0|x)=q_{\lambda,0x}$ and $p_\lambda(1|x)=1-q_{\lambda,0x}$, then we can write +$$p_\lambda(a|x) = q_{\lambda,0x} \delta_{a,0} + (1-q_{\lambda,0x})\delta_{a,1}.$$ +

+ +

As a vector, this reads +\begin{align}\mathbf p_\lambda &= + (q_{\lambda,00}\mathbf e_{0} + (1-q_{\lambda,00})\mathbf e_{1}) + \oplus + (q_{\lambda,01}\mathbf e_{0} + (1-q_{\lambda,01})\mathbf e_{1}) \\ + &= (q_{\lambda,00},1-q_{\lambda,00},q_{\lambda,01},1-q_{\lambda,01}) \\ + &= (p_\lambda(0|0), p_\lambda(1|0), p_\lambda(0|1), p_\lambda(1|1)), +\end{align} +for $q_{\lambda,00},q_{\lambda,01}\in\{0,1\}$. +All such vectors are generated by the basis vectors +$\mathbf e_{ij}\equiv \mathbf e_i\oplus\mathbf e_j$, representing behaviours in which $x=0$ corresponds to $a=i$ and $x=1$ to $a=j$. Explicitly, these are spanned by the four length-four vectors: +$$(1,0,1,0),\quad (1,0,0,1),\quad (0,1,1,0), \quad (0,1,0,1).$$

+ +

(Behaviours in full space) Now, what about the actual behaviours corresponding to the full conditional probabilities $p(ab|xy)$? To accommodate any such distribution, these must be vectors with $(2^2)^{2^2}=2^8=256$ elements. The deterministic behaviours in such space are the vectors of the form +$$\underbrace{\mathbf e_{ij}}_{x=0,y=0}\otimes \underbrace{\mathbf e_{k\ell}}_{x=0,y=1}\otimes \underbrace{\mathbf e_{mn}}_{x=1,y=0}\otimes\underbrace{\mathbf e_{pq}}_{x=1,y=1},$$ +with each $\mathbf e_{ij}$ characterising the outputs $ab$ associated with a given pair of inputs $xy$. +Clearly, however, such vectors do not always correspond to local behaviours. For example, the vector +$$\mathbf e_{00}\otimes \mathbf e_{10}\otimes \mathbf e_{\bullet\bullet}\otimes \mathbf e_{\bullet\bullet}$$ +is not local, as it gives $(a,b)=(0,0)$ for $(x,y)=(0,0)$ but $(a,b)=(1,0)$ for $(x,y)=(0,1)$.

+ +

(Local behaviours in full space) +Local behaviours have the form +$$\mathbf e_{a_0b_0}\otimes +\mathbf e_{a_0b_1} \otimes +\mathbf e_{a_1b_0} \otimes +\mathbf e_{a_1b_1} \simeq \mathbf e_{a_0 a_1}\otimes\mathbf e_{b_0b_1}, +$$ +for some choice of $a_i,b_j\in\{0,1\}$. There are therefore only $(2^2)^2=16$ such basic vectors, whose convex combinations draw the subset of local behaviours in the bigger $256$-dimensional space of general behaviours.

+ +

Show that all local deterministic behaviours are vertices

+ +

Suppose +$$\left|\sum_{abxy} (-1)^{a+b+xy} P(ab|xy)\right|= 2.$$ +Explicitly, this amounts to the following two equations (I'll use $P_{ab,xy}\equiv P(ab|xy)$ for notational brevity): +$$ +(P_{00,00} + P_{11,00} - P_{01,00} - P_{10,00}) + +(P_{00,01} + P_{11,01} - P_{01,01} - P_{10,01}) + +(P_{00,10} + P_{11,10} - P_{01,10} - P_{10,10}) - +(P_{00,11} + P_{11,11} - P_{01,11} - P_{10,11}) = \pm2. +$$ +Taking into account the normalisation condition for each $(x,y)$, we can simplify this to +$$ +(\underbrace{P_{00,00} + P_{11,00}}_{\equiv a_{00}}) + +(\underbrace{P_{00,01} + P_{11,01}}_{\equiv a_{01}}) + +(\underbrace{P_{00,10} + P_{11,10}}_{\equiv a_{10}}) - +(\underbrace{P_{00,11} + P_{11,11}}_{\equiv a_{11}}) \in \{0,2\}. +\tag X$$ +Consider the possible deterministic assignments. Any such assignment corresponds to a choice of each of the above four terms on the LHS $-$ here denoted with $a_{xy}$ $-$ equaling one (if $P_{00,xy}=1$ or $P_{11,xy}=1$) or zero (if $P_{01,xy}=1$ or $P_{10,xy}=1$). +In other words, $a_{xy}\in\{0,1\}$ for all $x,y$. +The possible combinations are thus seen to be +$$ +\begin{array}{c|c|c|c|c} + a_{00} & a_{01} & a_{10} & a_{11} & S\\\hline + 1 & 0 & 0 & 1 & 0\\\hline + 0 & 1 & 0 & 1 & 0 \\\hline + 0 & 0 & 1 & 1 & 0 \\\hline + 1 & 1 & 1 & 1 & 2 \\\hline + 0 & 0 & 0 & 0 & 0 \\\hline + 1 & 1 & 0 & 0 & 2 \\\hline + 1 & 0 & 1 & 0 & 2 \\\hline + 0 & 1 & 1 & 0 & 2 \\\hline +\end{array} +$$ +Each of these rows corresponds to $2^4=16$ deterministic behaviours. However, this does not take into account the locality constraint. +To see this, focus for example on the first row. A compatible behaviour corresponding to this row is: +$$\mathbf e_{00}\otimes\mathbf e_{01}\otimes\mathbf e_{10}\otimes\mathbf e_{00}.$$ +This is nonlocal: the fourth assignment shouldn't be possible, as the first three established that $a=x$ and $b=y$, but here we get that $(1,1)\to(0,0)$.

+ +

More generally, a local deterministic behaviour must be factorisable: $$P(ab|xy)=p(a|x)q(b|y)\equiv p_{a|x}q_{b|y}=\delta_{a,a_x}\delta_{b,b_y},$$ +for some deterministic probability distributions $p$ and $q$. There are $(2^2)^2=16$ such assignments, +and the proper way to list them is via each possible assignment of four bits to the four variables $(a_0, a_1, b_0, b_1)$.

+ +

Let us rewrite (X) embedding the locality constraint in the expression. We get +$$ +(p_{00} + p_{01}) q_{00} + +(p_{00} - p_{01}) q_{01} + +(p_{10} + p_{11}) q_{10} + +(p_{10} - p_{11}) q_{11} \in \{0,2\}. +$$ +One can verify directly that each one of the possible $16$ assignments satisfies this equation, meaning that all possible deterministic local behaviours are vertices on the local polytope. +Half of these are vertices for the polytope corresponding to $S=2$, and the remaining $8$ for the $S=0$ polytope.

+",55,,55,,5/24/2020 10:31,5/24/2020 10:31,,,,0,,,,CC BY-SA 4.0 +11940,2,,11408,5/10/2020 14:17,,7,,"

There's actually a really great way to evaluate this with Qiskit Aqua's operator logic.

+ +

This module has the concept of statefunctions to represent $|\Psi\rangle$ and $\langle\Psi |$ and operators to represent operators such as $Z^{\otimes n}$. +Your operator would be created using the $Z$ primitive:

+ +
from qiskit.aqua.operators import Z
+
+operator = Z ^ Z  # ^ represents a tensor product 
+operator = Z ^ 2  # same thing, computes Z ^ Z
+operator = Z.tensorpower(2)  # same thing as Z ^ 2
+
+ +

Now you need to create your state $|\Psi\rangle$, for which you have different options. Say you know the circuit to prepare your state, then you can do

+ +
from qiskit import QuantumCircuit
+from qiskit.aqua.operators import StateFn
+
+psi_circuit = QuantumCircuit(2)
+# prepare your state ..
+psi = StateFn(psi_circuit)  # wrap it into a statefunction
+
+ +

Or you can also use prepared common statefunctions such as Zero = $|0\rangle$, One = $|1\rangle$, Plus = $|+\rangle$ or Minus = $|-\rangle$,

+ +
from qiskit.aqua.operators import Zero, Plus
+
+
+psi = Zero ^ Plus  # creates the state |0+>
+
+ +

To compute the expectation value you naturally need to evaluate $\langle \Psi | ZZ | \Psi\rangle$, which you can do as

+ +
expectation_value = (~psi @ operator @ psi).eval()
+expectation_value = (psi.adjoint().compose(operator).compose(psi)).eval()  # same as above
+
+ +

To explain the syntax: ~ computes the adjoint, so ~psi = $\langle\Psi|$. The @ sign is composition and sticks together your states and operators.

+ +

Full example

+ +

As an example, let's compute the expectation value of $\langle \Psi| ZZ | \Psi\rangle$ with $|\Psi\rangle = \frac{1}{\sqrt{2}} (|01\rangle + |10\rangle)$. +Calculating by hand, this should yield $-1$.

+ +
import numpy as np
+from qiskit.aqua.operators import Z, Zero, One
+
+operator = Z ^ Z 
+psi = 1 / np.sqrt(2) * ((One ^ Zero) + (Zero ^ One))
+expectation_value = (~psi @ operator @ psi).eval()
+print(expectation_value.real)  # -1.0
+
+",9800,,,,,5/10/2020 14:17,,,,2,,,,CC BY-SA 4.0 +11941,1,11948,,5/10/2020 14:36,,0,364,"

I need help with the exercise 4.34 from Nielsen & Chuang Book.

+ +

+ +

I am supposed to get a matrix corresponding to the circuit. Thanks

+",11997,,,,,5/10/2020 18:50,"Nielsen & Chuang Exercise 4.34 ""Measuring an operator""",,1,2,,,,CC BY-SA 4.0 +11942,1,11944,,5/10/2020 14:52,,2,241,"

This related to the proof of universality (pg 196),and partially related to the question Why is Deutsch's gate universal?, however i'm trying to workout a more rigorous proof and understanding of why irrationality is so important.

+ +

For $\theta_k \in [0,2\pi)$, $\theta_k = (k\theta)\text{mod }2\pi$, I am struggling to see how for a sequence $k \in \mathbb{Z}$, $k = {1\dots} N$ that the set of $\theta_k$ fills up the interval $[0,2\pi)$, and why is is important that $\theta$ is an irrational multiple of $2\pi$. Does irrationality indicate the uniqueness of each $\theta_k$? This is something I was trying to prove but can't seem to get very far, based on

+ +

$\alpha \mod \beta = a - \beta[\alpha/\beta]$, where $[]$ is the floor.

+ +

using $\alpha = \gamma(2\pi)$, where $\gamma$ is irrational, and $\beta=2\pi$

+ +

$\theta_k =k\gamma(2\pi) - 2\pi[k\gamma(2\pi)/2\pi] = k\gamma(2\pi) - 2\pi[k\gamma]$, however I can't see how this yields uniqueness for irrational $\gamma$ and not for a rational $\gamma$.

+ +

If $\gamma$ is rational $\gamma = \frac{p}{q}$, then $\frac{kp}{q}$ is still unique unless $k=1$.

+ +

....Or I could just be taking entirely the wrong approach!

+",6139,,6139,,5/10/2020 18:19,11/27/2022 8:19,"Universality and coverage of irrational multiples of $2\pi$ In $[0, 2\pi)$",,1,0,,,,CC BY-SA 4.0 +11943,1,,,5/10/2020 15:41,,3,998,"

I am digging into to the workings of the D-wave quantum annealing computers using this documentation. I find it very intuitive and well-explained, but their example of a ""simple QUBO problem"" does not seem an optimization problem to me as they are just trying to reproduce the XNOR (i.e., they fix the weights based on the kown solution, instead of getting a solution based on weights).

+ +

Is there a dead-simple example of a QUBO problem that also has some meaning? Up to 4 qubits for this example are fine, but it must be kind of meaningful.

+",11842,,2293,,5/10/2020 22:21,10/1/2020 17:09,What is an example of a simple QUBO problem?,,2,0,,,,CC BY-SA 4.0 +11944,2,,11942,5/10/2020 16:41,,4,,"

There are two statements in your question:

+
    +
  1. If $\theta$ is a rational number of $2\,\pi$, then $\left(\theta_k\right)_{k\in\mathbf{Z}}$ does not reach every $x\in[0\,;\,2\,\pi)$
  2. +
  3. If $\theta$ is an irrational number of $2\,\pi$, then $\left(\theta_k\right)_{k\in\mathbf{Z}}$ does reach every $x\in[0\,;\,2\,\pi)$
  4. +
+

We can prove that while the former is true, the latter is false.

+

Let us consider the first one for now. Let $\theta=2\,q\,\pi$ with $q\in\mathbf{Q}$. Then we can write $q=\frac{a}{b}$ with $(a,b)\in\mathbf{Z}^2$. We can then show that the sequence $\left(\theta_k\right)_{k\in\mathbf{Z}}$ contains at most (exactly actually, if $\frac{a}{b}$ is the irreducible form of $q$) $b$ different elements modulo $2\,\pi$. Indeed, we have:

+

$$\theta_{k+b}=(k+b)\,\theta\,\mathrm{mod}\,2\,\pi = k\,\theta+2\,a\,\pi\,\mathrm{mod}\,2\,\pi=k\,\theta\,\mathrm{mod}\,2\,\pi=\theta_k$$

+

Hence, the sequence $\left(\theta_k\right)_{k\in\mathbf{Z}}$ if $b$-periodic. As such, it contains at most $b$ different elements. Hence, the sequence $\left(\theta_k\right)_{k\in\mathbf{Z}}$ does not reach every $x\in[0\,;\,2\,\pi)$.

+

Let us now consider the second statement. Let $\theta=2\,\gamma\,\pi$ with $\gamma$ being an irrational number. Let $x=2\,k'\,\pi+x'$. Then:

+

$$\theta_k=x\,\mathrm{mod}\,2\,\pi\iff2\,k\,\gamma\,\pi=2\,k'\,\pi+x'$$

+

There are now two cases: either $\gamma\,\pi$ is rational, either it isn't. In the first case, $2\,k\,\gamma\,\pi$ is always rational. Hence, it cannot reach $1+2\,k'\,\pi$ whatever $k'$ is since it is an irrational number. Hence, let us now now consider that $\gamma\,\pi$ is irrational. Then $2\,k\,\gamma\,\pi$ is always irrational (for $k\neq0$). Let us consider $x'=\pi$ then. The equation becomes:

+

$$2\,k\,\gamma=2\,k'+1$$

+

Since $\gamma$ is irrational, then so is $2\,k\,\gamma$. However, $2\,k'+1$ is rational. Hence, this equation cannot hold. Hence, in every case, we found $x'\in[0\,;\,2\,\pi)$ such that $x'$ is not reached by the sequence $\left(\theta_k\right)_{k\in\mathbf{Z}}$.

+

However, what you can also prove is that every $x'\in[0\,;\,2\pi)$ can be approached as close as you want, given that $\gamma$ is irrational.

+

Indeed, let us consider the subgroup of $(\mathbf{R}, +)$ spanned by $\theta$ and $2\,\pi$, that is:

+

$$\left\{p\,\theta+2\,q\,\pi\middle|(p,q)\in\mathbf{Z}^2\right\}$$

+

As a subgroup of $(\mathbf{R}, +)$, it is either discrete (like $\mathbf{Z}$) or dense (like $\mathbf{Q}$) within $\mathbf{R}$. In our case, we can show that it is dense within $\mathbf{R}$.

+

Let us assume that it is discrete. Then, there exists $\lambda=p\,\theta+2\,q\pi$ such that every element $x$ of this set can be written as $x=k\,\lambda$, with $k\in\mathbf{Z}$. Since we know that $2\,\pi$ is in this group, we can write:

+

$$2\,\pi=k\,\lambda=2\,k\,p\,\gamma\,\pi+2\,k\,q\,\pi\iff 1=k\,p\,\gamma+k\,q\iff\gamma=\frac{\frac1k-q}{p}$$

+

Hence, it implies that $\gamma$ is rational, which we assumed to be false. Hence, this group is dense within $\mathbf{R}$. What that means is that every element of $\mathbf{R}$ can be approached arbitrarily close using an element of this subgroup. More formally:

+

$$\forall\varepsilon>0, \forall x\in\mathbf{R},\exists(p, q)\in\mathbf{Z}^2,|p\theta+2\,q\,\pi-x|<\varepsilon$$

+

By reducing modulo $2\,\pi$, you can finally conclude that every $x'\in[0\,;\,2\,\pi)$ can be approached arbitrarily close by a member of the sequence $\left(\theta_k\right)_{k\in\mathbf{Z}}$.

+",10454,,10454,,11/27/2022 8:19,11/27/2022 8:19,,,,4,,,,CC BY-SA 4.0 +11945,1,,,5/10/2020 17:09,,3,384,"

Isn't it more scalable to build multiple processors of a lower qubit and connect them in parallel instead of building one processor of a higher qubit?

+",11998,,55,,8/19/2020 17:34,8/19/2020 19:10,Why don't quantum computing scientists build two 50-qubit processors and connect them in parallel instead of building one 100-qubit processor?,,3,2,,,,CC BY-SA 4.0 +11946,2,,11943,5/10/2020 17:50,,1,,"

I asked a similar question on the Operations Research Stack Exchange. This answer lists about 20 different problems that can be solved by QUBO.

+ +

If you want a ""dead-simple"" example that has some meaning, I personally think that the algorithm for factoring integers using QUBO, is the simplest one to understand, but that is only my opinion.

+",2293,,,,,5/10/2020 17:50,,,,0,,,,CC BY-SA 4.0 +11947,1,11953,,5/10/2020 17:50,,1,143,"

I'm going through ""Quantum Computation & Quantum Information"" by Michael A. Nielsen and Isaac L. Chuang, and as a high school student with no previous knowledge, I cannot understand some things about linear transformations on the bloch sphere.

+",12015,,2927,,5/10/2020 18:10,5/10/2020 22:49,What kind of transformation does the Y-gate do on the bloch sphere?,,1,3,,,,CC BY-SA 4.0 +11948,2,,11941,5/10/2020 18:50,,1,,"

You can show that the circuit satisfies the problem's criteria like so: +

+ +

From here: https://github.com/rehaanahmad2013/NielsenChuang-QuantumComputingSolutions

+",11644,,,,,5/10/2020 18:50,,,,1,,,,CC BY-SA 4.0 +11949,2,,11945,5/10/2020 18:56,,6,,"

This reminds me of the Q20:20 engine that NQIT aimed to build over a 5-year period from January 2015 to January 2020, for which they received £38,000,000 of funding.

+ +

The goal was to build a 400-qubit quantum computer made up of 20 smaller processors, each with 20 qubits.

+ +

Unfortunately they failed in that aim, as most people would have predicted, because it was an unrealistic goal at the time.

+ +

Your suggestion of combining two processors instead of 20 processors, is a much better one.

+ +

This can indeed be done right now. For example, why not put two of Google's Sycamore chips next to each other and connect the two with some wires:

+ +

                                                        

+ +

This can be done, but I am not surprised that it hasn't been done yet, because even the first chip was only recently developed, and they were spending all their efforts on designing and optimizing the first chip, before even considering putting two of them together.

+ +

The next question is whether or not putting two chips together would even be the best thing to do right now. Putting two chips together seems like a smart thing to do once you've somewhat exhaustively optimized the performance/abilities of a single chip, and the only way to gain any further performance benefit would be to add a second chip and connect the two by some inter-chip connection which is by its very nature, not as efficient as intra-chip connections.

+ +

In the above chip, the grey qubits are connected by the blue connections in the picture below:

+ +

                                                

+ +

Should we continue to optimize the number of grey qubits and blue connections (i.e. the number of qubits in a single chip) or should we jump ahead and try to start connecting grey qubits from this chip to grey qubits on another chip?

+ +

What it boils down to is this: Do you want to rush and make a dual-processor with 50 qubits each by 2023 (total: 100), or do you want to first try to make a 100-qubit single chip by 2022, then connect two of them together by 2024 (total: 200)? The years I am giving here will certainly not be exact, but I am just trying to illustrate a point. Furthermore, most people in the field will say that neither of these choices are preferred, since what they really want is for the 50 qubits in a single chip (and the 2-qubit gates between them) to be more robust.

+",2293,,2293,,5/11/2020 13:46,5/11/2020 13:46,,,,2,,,,CC BY-SA 4.0 +11950,1,11952,,5/10/2020 21:06,,5,765,"

Is it possible to write an algorithm that returns a single bit that represents if a qubit is in superposition or not, without compromising the qubit's wavefunction? Example:

+ +

is_in_superposition($\vert 0 \rangle$) = 0

+ +

is_in_superposition($\dfrac{1}{\sqrt{2}} \vert 0 \rangle + \dfrac{1}{\sqrt{2}} \vert 1 \rangle$) = 1

+",12003,,12003,,5/10/2020 22:01,5/11/2020 0:40,How to check a qubit's state?,,1,0,,,,CC BY-SA 4.0 +11952,2,,11950,5/10/2020 21:49,,6,,"

Even though this gate wouldn't be unitary, it wouldn't even be linear. Let us write this down.

+ +

Let us call this gate $\mathbf{S}$. $\mathbf{S}$ has the following properties:

+ +

$$\mathbf{S}\,|x\rangle=\begin{cases}|0\rangle&\text{if } |x\rangle=|0\rangle\text{ or }|1\rangle\\|1\rangle&\text{otherwise}\end{cases}$$

+ +

Then we would have:

+ +

$$\mathbf{S}\,(\alpha\,|0\rangle+\beta\,|1\rangle)=|1\rangle$$

+ +

by assumption. But we also have:

+ +

$$\mathbf{S}\,(\alpha\,|0\rangle+\beta\,|1\rangle)=\alpha\,\mathbf{S}\,|0\rangle+\beta\,\mathbf{S}\,|1\rangle = \alpha\,|0\rangle+\beta\,|0\rangle$$

+ +

which is contradictory. Hence, such a gate doesn't exist. Actually, with the same argument, you cannot implement such a gate with additional qubits either: since the gate makes a distinction between superposed and non-superposed states, it cannot be linear and as such, cannot be a gate.

+ +

Maybe an algorithm that would do such a task, if you want a classical result rather than a quantum state, could be implemented as such:

+ +
    +
  1. Create the state you're interested in.
  2. +
  3. Measure it.
  4. +
  5. Repeat.
  6. +
+ +

If at least once you get different results (and if we don't consider noise that may affect the state), then you know that this quantum state is in a superposition. Of course, this is a very bad algorithm:

+ +
    +
  1. Creating the state can be computationally hard.
  2. +
  3. Noise can induce inaccuracies in the measurement.
  4. +
  5. You're never sure that a state really is not in a superposed state.
  6. +
+ +

Still, you would have noticed that a measurement is performed. Hence, the wavefunction is affected. Since you want to get a classical result, the only way you have for this is to perform a measurement.

+ +

Our only solution here is to add qubits to get this piece of information. Even there, it is not possible to do such a thing. We cannot get our answer as a quantum state using the same argument stated above. We cannot even use controlled gates to see whether $\alpha$ or $\beta$ is nil, since the measurement will then affect $|x\rangle$.

+ +

Unless I'm mistaken, it is thus impossible to perform such an operation.

+",10454,,10454,,5/11/2020 0:40,5/11/2020 0:40,,,,1,,,,CC BY-SA 4.0 +11953,2,,11947,5/10/2020 22:41,,3,,"

The nice thing about the Bloch sphere is that you can visualize the various rotations without having to think too much about complex numbers.

+ +

The $Y$ gate causes a 180-degree rotation around the $y$-axis of the sphere. (Imagine spinning the sphere a half-rotation around the $y$-axis.) For example, if your state is at either end of the $x$-axis, then rotating 180 degrees around the $y$-axis will move your state to the opposite end of the $x$-axis. Same if your state is at either end of the $z$-axis. But if your state is on the $y$-axis itself, then applying a $Y$ gate does not rotate the state — it remains in the same place.

+ +

Mathematically, yes, this is represented with complex numbers. If it helps, you can think of the $x$-$y$ plane of the Bloch sphere as sort of like polar coordinates representing the relative phase between the $\left|0\right>$ and $\left|1\right>$ parts of your superposition — the $x$-axis represents the real part, and the $y$-axis represents the imaginary part.

+",10473,,,,,5/10/2020 22:41,,,,0,,,,CC BY-SA 4.0 +11954,1,,,5/11/2020 1:49,,1,179,"

I learnt from this lecture (at 33:20) that Deutsch Oracle is way faster on quantum computers than on classical computers. However, it seems to me that this is just due to smart structuring of input data, which is also doable on classical computers.

+ +

Thus, for me, the only way to accept that Deutsch Oracle is indeed faster on quantum computers is due to the fact that some of the following gates run much faster on quantum computers than being simulated on classical computers:

+ +
    +
  1. Hadamard gate
  2. +
  3. CNOT gate
  4. +
+ +

So here's my questions, is the aformentioned statement true? If so, can you explain why some of the gates run faster on quantum computers? Also, which quantum mechanic principle was abused in this case?

+",11980,,11980,,5/11/2020 3:48,8/13/2022 15:07,How does Deutsch Oracle shows quantum supremacy?,,1,6,0,,,CC BY-SA 4.0 +11955,2,,11895,5/11/2020 2:45,,7,,"

While Craig Gidney (from Google) is correct in his comment which says that $X$ and $Y$ do not create superpositions on states that are not in superposition, such as $|0\rangle$ and $|1\rangle$; even if we assume that the initial state must not be in superposition, it is still possible to create superpositions with the 2-qubit gates, even if the 1-qubit gates are in fact $X$ and $Y$ (without the square roots).

+ +

It would still be a perfectly fair question to ask your exact same question, but for 2-qubit gates instead of 1-qubit gates:

+ +
    +
  • Is there any specific reason for not using text-book gates such as $\textrm{CZ}$ (controlled-Z) ?
  • +
  • Is it because of technical issues, such as the natural choice for transmon qubits not being these gates?
  • +
  • Or is it because of the complexity of the algorithm that is needed to +simulate these gates?
  • +
+ +

These are actually very, very good questions, and while the answer is subtle, the answer is in fact yes for all three questions.

+ +

I will start by pointing out that page 3 of the paper says:

+ +
+

The implementation of high-fidelity ‘textbook gates’ natively, such as + CZ or iSWAP, is work in progress.

+
+ +

Therefore the chips cannot yet do the text-book gates CZ or iSWAP with the high-fidelities demonstrated in the experiment to claim quantum supremacy.

+ +

The details about the reason for this, are buried all the way down to pages 15-16 of the Supplementary Information document. They say:

+ +
+

For quantum supremacy, the two-qubit gate of choice is the iSWAP gate. + For example, CZ is less computationally expensive to simulate on a + classical computer by a factor of two [37, 49]. A dominant + error-mechanism when trying to implement an iSWAP is a small + conditional-phase that is generated by an interaction of the + |11>-state with higher states of the transmons (|02> and |20>). For + this reason, the fSim gate with swap-angle θ ~ 90◦ and conditional + phase φ ~ 30◦ has become the gate of choice in our supremacy + experiment. gates. These gates result from the natural evolution of + two qubits making them easy to calibrate, high intrinsic fidelity + gates for quantum supremacy.

+
+ +

So now here are the answers to the three questions:

+ +
    +
  • Yes, there is a specific reason why they didn't implement the $\textrm{CZ}$ gate:
  • +
  • Yes, one reason is because of the complexity of the algorithm needed to simulate these gates: The $\textrm{iSWAP}$ gate happens to be two times harder to simulate on a classical computer than the $\textrm{CZ}$ gate. They do not give the specific numbers for how long the classical simulation would take if $\textrm{CZ}$ were used, but you can imagine that they might have to say that the classical computer would have to take only 5000 years (rather than 10,000 years). If you believe IBM's estimate, that using not only the RAM but also the HDD space on the Summit supercomputer, would allow the classical calculation to finish in 2.5 days rather than 10,000 years, then this could be reduced down to maybe 1.25 days if using the CZ gate (still significantly more than the 200 seconds it took Sycamore, but the calculation would be exact rather than merely a quantum calculation sampled one million times). So yes, they deliberately wanted to use iSWAP instead of CZ for a complexity reason, which is that the classical algorithm against which they were comparing in order to claim quantum supremacy, is 2 times slower for iSWAP than it is for CZ.
  • +
  • Yes, there is also a technical issue which caused them not to implement the iSWAP gate exactly, but instead what they call a ""partial-iSWAP gate"". The most natural way for them to implement an iSWAP gate is partially ""polluted"" by higher excited states which they label $|02\rangle$ and $|20\rangle$, so they instead implement a ""partial-iSWAP"" gate. This is in a sub-section of the Supplementary Information called ""The natural two-qubit gate for transmon qubits"" which is exactly what you suggested in your question, so you seem to have been very correct in your thinking!
  • +
+ +

Furthermore, I personally wouldn't call CZ or iSWAP ""text-book"" gates either. The 2-qubit gates most people are familiar with are the CNOT and the SWAP gates. They never mention why they can't do SWAP instead of iSWAP, but they do say that CNOT would require at least 3 of their ""natural"" gates instead of just 1. This would likely not affect the competing classical computer, as the bottleneck there is RAM and storage space, and a CNOT (containing only real elements) can be implemented far easier on a classical computer than iSWAP (which requires doing more complex/imaginry-number arithmetic), but it would badly affect the quantum computer's performance. They say the gate times were set to 12ns because any slower and there would be more decoherence and any faster and there would be leakage into the higher states, and who knows what consequences that would have on the whole experiment. If they have to do 3 times as many gates, they might have to have the gate times set to 4ns instead of 12ns to get similar levels of decoherence, and if the effect is linear this would mean 3 times as much leakage into excited states. No matter how you think of it (allow more decoherence, or cause more leakage into excited states) the performance of the quantum computer would be badly affected by switching from partial-iSWAP to CNOT.

+ + + +

In any case, the point of the paper still stands no matter what: A classical computer cannot simulate a 50-qubit system easily. We already knew this since the dawn of quantum mechanics in the 1920s, and we know that we also can't simulate a 50-spin Ising Hamiltonian or D-Wave's 2000-spin Ising Hamiltonian either. The difference is that Google's 53-qubit system can do 1-qubit and 2-qubit gates (for an extremely limited subset of the ${ 53 \choose{2}}$ possible qubit pairs, but at least they can apply up to four 2-qubit gates for each of the qubits) which would be required for the most general quantum algorithms like Shor's algorithm. Google's quantum computer still can't do Shor's algorithm on any number faster than the computer in a watch could factor it, and we're at least several years away from that type of accomplishment, but they made a 53-qubit machine that can do fairly impressive (by today's standards) 2-qubit gates on each of them, and no one had done that before.

+",2293,,,,,5/11/2020 2:45,,,,6,,,,CC BY-SA 4.0 +11956,1,11958,,5/11/2020 3:26,,1,150,"

In Quantum Country's post on the quantum search algorithm, they lay out the search algorithm for the case where there is exactly one solution $| s \rangle$. The key steps are to start in the equal superposition state $|E \rangle$ and then apply a Grover iteration $\pi \sqrt N / 4$ times. The Grover iteration is to reflect about the $|s \rangle$ state and then reflect about the $|E \rangle$ state, resulting in a rotation of the current state $|\psi \rangle$ towards $|s \rangle$.

+ +

I am having trouble seeing what we would do differently in the case where we do not assume there is one exact solution. The post recommends starting with thinking about the case where there are exactly two solutions, $|s_1 \rangle$ and $|s_2 \rangle$. It seems to me the exact same algorithm and circuit for rotating around $|s \rangle$ would work. Instead of rotating towards one specific solution in the first step of the Grover iteration, we would rotate towards the plane generated by $|s_1 \rangle$ and $|s_2 \rangle$. But that is okay, since getting our state very close the plane generated by the two solutions would mean we can measure the state and get a solution with high probability.

+ +

Is there anything else we must modify in the algorithm for search to handle two possible solutions (or N possible solutions)?

+ +

For context, the rotation about $|s \rangle$ looks like this, where $C_s$ is an oracle that flips the working bit if $|x \rangle$ is a solution (image from QC):

+ +

+",12005,,,,,5/11/2020 4:20,Quantum search algorithm with exactly 2 solutions,,1,0,,,,CC BY-SA 4.0 +11957,2,,11954,5/11/2020 4:09,,2,,"

The video at 33:20 is talking about the Deutsch problem, which is a problem that a quantum computer can solve with only 1 query whereas a classical computer needs 2 queries.

+

First of all, the quantum query is quite a lot more involved than doing a classical query, so doing 2 classical queries might be faster and easier than doing 1 quantum query, but a generalization of the Deutsch problem called the Deutsch-Jozsa problem, can be solved on a quantum computer with 1 query instead of $2^n$ on a classical computer, so let's continue.

+

You are asking whether or not the quantum computer performs better because of certain gates running faster than simulating them on classical computers:

+
+

Thus, for me, the only way to accept that Deutsch Oracle is indeed +faster on quantum computers is due to the fact that some of the +following gates run much faster on quantum computers than being +simulated on classical computers:

+
    +
  • Hadamard gate
  • +
  • CNOT gate
  • +
+
+

The answer, is that this is not the case.

+
    +
  • First of all, there's no CNOT in the quantum-computer solution to the Deutsch-Jozsa problem.
  • +
  • Second, the way a classical computer solves this problem is not by simulating the Hadamard gates.
  • +
+

The reason why quantum computers can theoretically outperform classical computers for solving Deutsch-Jozsa problems, is because they can evaluate the mystery function for all possible inputs at the same time. Classical computers cannot do this, they have to evaluate the mystery function for all possible inputs separately. I hope this helps you, and if you still want to know more, I have provided a resource here for you to see every step of how the Deutsch-Jozsa problems are solved on quantum computers. Unfortunately you'd have to at least know some basics such as Dirac notation and matrix-vector arithmetic, but it is a worthwhile exercise to understand the protocol.

+",2293,,2927,,8/13/2022 15:07,8/13/2022 15:07,,,,0,,,,CC BY-SA 4.0 +11958,2,,11956,5/11/2020 4:20,,1,,"

The only thing we need to modify is the number of iterations we do.

+ +

The geometric representation of the Grover iteration is a rotation of the system state by an angle $2\Delta$, where $\Delta \approx \sqrt{\frac{M}{N}}$ ($N$ is the size of the search space, and $M$ is the number of solutions, $M \ll N$).

+ +

You need to rotate the state by approximately $\frac{\pi}{2}$, which is going to take about $\frac{\pi}{4\Delta} \approx \frac{\pi}{4}\sqrt{\frac{N}{M}}$ iterations. In other words, the more solutions your problem has, the fewer iterations we need to do (which makes sense).

+",2879,,,,,5/11/2020 4:20,,,,0,,,,CC BY-SA 4.0 +11959,1,11961,,5/11/2020 5:19,,0,72,"

I am new to quantum computing. Can someone help me in calculating state of the qubit when $\alpha = \frac{3}{5}e^{i\pi/7}$ and $\beta = -\frac{4i}{5}$.

+ +

Thanks

+",12006,,2879,,5/11/2020 5:33,5/11/2020 14:05,Calculating the state of the qubit when $\alpha$ and $\beta$ are given,,1,2,,5/11/2020 16:29,,CC BY-SA 4.0 +11961,2,,11959,5/11/2020 8:52,,2,,"

The state is usually just expressed as +$$ +\alpha|0\rangle+\beta|1\rangle, +$$ +which is straightforward given that you're stating $\alpha$ and $\beta$.

+ +

However, if what you actually want is a geoemtric interpretation, that means mapping your system to something of the form +$$ +e^{i\gamma}(\cos\frac{\theta}{2}|0\rangle+\sin\frac{\theta}{2}e^{i\phi}|1\rangle) +$$ +where you want the values of $\theta$ and $\phi$. In this case, you immediately have $\gamma=\pi/7$ and $\cos\frac{\theta}{2}=\frac{3}{5}$. You want to be a little careful in your choice of $\sin\frac{\theta}{2}$ - you probably want it to be positive (as was also true of cos), so $\sin\frac{\theta}{2}=\frac{4}{5}$. Hence, +$$ +\sin\theta=2\cdot\frac{3}{5}\cdot\frac{4}{5}=\frac{24}{25}. +$$ +You can numerically evaluate this of you want, but it's probably better to leave it just like that.

+ +

Now we need to take care of $\phi$. We have +$$ +e^{i\phi}=-ie^{-i\pi/7}=e^{-i\pi/7-i\pi/2}, +$$ +so we conclude that +$$ +\phi=2\pi-\frac{\pi}{7}-\frac{\pi}{2}=\frac{19}{14}\pi, +$$ +since you're probably expected to give a value of $\phi$ in the range 0 to $2\pi$.

+",1837,,2293,,5/11/2020 14:05,5/11/2020 14:05,,,,0,,,,CC BY-SA 4.0 +11962,1,11963,,5/11/2020 11:14,,1,158,"

Using transpile with optimization_level = 3, which is the layout method used by default?

+",12013,,5955,,5/11/2020 11:17,5/11/2020 11:58,Layout Method in qiskit,,2,0,,,,CC BY-SA 4.0 +11963,2,,11962,5/11/2020 11:18,,1,,"

DenseLayout is used by default. You can see the code for the optimization level here and it is this line that sets the default to be the dense layout.

+",5955,,,,,5/11/2020 11:18,,,,4,,,,CC BY-SA 4.0 +11964,2,,11962,5/11/2020 11:58,,1,,"

You can pass a layout_method=... arg to set this yourself. It currently accepts 'dense', 'noise_adaptive' and 'trivial'.

+ +

(There is a also an option for routing_method=... which accepts 'basic', 'stochastic' and 'lookahead'.)

+ +

The difference between the various levels (0,1,2,3) is then what parameters these passes run with. At higher level, they run with more time-consuming parameters which will probably yield better results. For example the number of trials is higher, or the lookahead window is larger.

+",2503,,,,,5/11/2020 11:58,,,,2,,,,CC BY-SA 4.0 +11965,2,,11921,5/11/2020 12:42,,2,,"

Firstly let's use Taylor series (I will write $t$ instead of $\Delta t$):

+ +

\begin{equation} +e^{-i |x \rangle \langle x | t} = I + (-i |x \rangle \langle x | t) + \frac{(-i |x \rangle \langle x | t)^2}{2!} + \frac{(-i |x \rangle \langle x | t)^3}{3!} ... = +\\ + = \left( I + (-i t) + \frac{(-i t)^2}{2!} + \frac{(-i t)^3}{3!} ... \right) |x \rangle \langle x | + I(1 - |x \rangle \langle x|) = +\\ += I + (e^{-it} - 1) |x \rangle \langle x | +\end{equation}

+ +

So the circuit should implement the operator $I + (e^{-it} - 1) |x \rangle \langle x |$.

+ +

Now what does the Oracle (from the M. Nielsen and I. Chuang textbook):

+ +

$$|x\rangle |q\rangle \xrightarrow[]{\text{O}} |x\rangle |q \oplus f(x)\rangle$$

+ +

So, if $|q\rangle = |0\rangle$ as mentioned in the circuit, and note that $f(x) = 1$ only if $x$ is a solution, otherwise $f(x) = 0$. The operator that corresponds to the Oracle (here I am assuming (also assumed in the book) that we have only one solution):

+ +

$$O = \sum_{y \ne x} |y\rangle \langle y| I + |x\rangle \langle x| X = II + |x\rangle \langle x| (X - I) $$

+ +

Let's see what the combined action looks like (the phase gate is denoted as $P$ and $II \equiv I$):

+ +

\begin{equation} +O \: I \cdot P \: O = \left[ I + |x\rangle \langle x| (X - I) \right] I \cdot P \left[ I + |x\rangle \langle x| (X - I) \right]= +\\ += I \cdot P + |x\rangle \langle x| P(X - I) + |x\rangle \langle x| (X - I) P +|x\rangle \langle x| (X - I) P (X - I) = +\\ = I \cdot P - |x\rangle \langle x| P + e^{it}|x\rangle \langle x| P^{\dagger} +\end{equation}

+ +

because $XPX = e^{it}P^{\dagger}$. Let's take into account that the ancillary qubit starts in the $|0 \rangle$ state, then the combined operator will look like (by omitting the $P$ and $P^{\dagger}$ applyied on the ancillary qubit, because they do noting on the $|0 \rangle$ state and thus the ancillary qubit is ""out of the game""):

+ +

\begin{equation} +I - |x\rangle \langle x| + e^{it}|x\rangle \langle x| = I + (e^{it} - I)|x\rangle \langle x| +\end{equation}

+ +

How one can see there is the inconsistency of $-$ sign in the phase like in this answer to the related question, because, maybe I did a mistake, or perhaps, there is a typo in the book. Now let's draw an example when $|x\rangle = |0101\rangle$ (I will show the simplest example: the implementations can be different depending on what we want to find with Grover, but one thing should be the same: in all cases $|0101\rangle$ should be a solution):

+ +

                                                            +

+ +

where the leftmost qubit in $|0101\rangle$ corresponds to the first wire. The circuit is drawn with quirk. The way of implementing the Oracle shown above more explicitly can be understood from this answer about black and white dots in the circuit and this answer about multi-controlled gates.

+",9459,,9459,,5/11/2020 16:07,5/11/2020 16:07,,,,1,,,,CC BY-SA 4.0 +11966,1,,,5/11/2020 12:49,,1,1062,"

I have created a circuit and then run the following: +provider = IBMQ.get_provider('ibm-q') +And this is what I get:

+ +
IBMQProviderError                         Traceback (most recent call last)
+<ipython-input-24-d651cdcd236d> in <module>
+----> 1 provider = IBMQ.get_provider('ibm-q')
+
+~\anaconda3\lib\site-packages\qiskit\providers\ibmq\ibmqfactory.py in get_provider(self, hub, group, project)
+    352 
+    353         if not providers:
+--> 354             raise IBMQProviderError('No provider matches the criteria.')
+    355         if len(providers) > 1:
+    356             raise IBMQProviderError('More than one provider matches the criteria.')
+
+IBMQProviderError: 'No provider matches the criteria.'
+
+",,user12014,55,,10/12/2020 7:28,10/12/2020 7:28,Trying to get a provider from IBMQ but get 'No provider matches the criteria.',,3,0,,,,CC BY-SA 4.0 +11967,2,,11966,5/11/2020 13:20,,1,,"

There is no hub simply called ibm-q. I think what you are meaning to do is +provider = IBMQ.get_provider(). What you put in the brackets is the name of the hub, for example if your school was a registered hub you might have something to write in there but most users will leave the brackets blank. After this you can do backend = provider.get_backend(BACKEND_NAME) to get the backend you want to use.

+",5955,,,,,5/11/2020 13:20,,,,1,,,,CC BY-SA 4.0 +11968,1,11970,,5/11/2020 17:06,,1,163,"

I'm using qiskit 0.19.1, and I'm doing some simulation of QAOA, using the aqua class QAOA. I use a callback function in my program to see energy and std during optimization, but the evaluated standard deviation is always zero, at any step (This is clearly not true almost in the final state, that is a superposition of target Hamiltonian eigenstates). +I do not figure out why, because I used this code before the release 0.19 (apart of small changes because of new libraries that in principle shoud not affect the results) and it correctly gave me a non zero std. +Do any of you had the same problem or figure out why I have it? +Thanks!

+",12017,,,,,5/11/2020 17:41,Evaluated Standard deviation during QAOA/VQE optimization is always zero. Qiskit 0.19,,1,1,,,,CC BY-SA 4.0 +11969,1,,,5/11/2020 17:18,,0,114,"

I understand that X,Y and Z gates are rotations around the axes with the respective letters, but I cannot understand how can Y gate multiply the amplitude of 0 with unreal number and have it landing on the bloch sphere, or how can S gate add a phase of 90 degrees.

+",12015,,55,,8/27/2020 12:55,8/27/2020 12:55,Cannot interpret transformations on the bloch sphere as matrix multiplications,,1,0,,,,CC BY-SA 4.0 +11970,2,,11968,5/11/2020 17:41,,0,,"

if you are using Statevector simulation or the Aer Expectation Snapshot (which is enabled by default for better performance), the variance in the energy estimator is in fact zero, as the evaluation is done using matrix multiplication. If you'd prefer to perform a shot-based estimation, try setting the expectation property of your QAOA object to PauliExpectation(), where PauliExpectation is imported from qiskit.aqua.operators. Please keep in mind that this type of simulation will likely be much slower. The Aer Expectation Snapshot is an expectation value taken in C++ within Aer, so it saves a lot of resource consumption.

+",4379,,,,,5/11/2020 17:41,,,,0,,,,CC BY-SA 4.0 +11971,2,,11969,5/11/2020 17:51,,2,,"

First of all if you take at look at how the $X$ gate works:

+ +

$X|0\rangle = |1\rangle$

+ +

Now applying a $Y$ you get

+ +

$Y|0\rangle = i|1\rangle$ and $Y|1\rangle = -i|0\rangle$, so you can see that you are flipping the state of the qubit, i.e. an X rotation with a phase rotation (you can also see this from the commutor relation $[X,Z] = XZ - ZX =2iY $). In the case of the pure states $|1\rangle$ and $|0\rangle$ you can see that it ends up in another pure state, and as such the phases, $i$ and $-i$ applied by the $Y$ gates can be treated a global phase and in these cases 'ignored' when taking a measurement, you will always be measuring with probability $1$ the state that you are in.

+ +

Now in the more general case consider a state $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$, $Y|\psi\rangle = i\alpha|1\rangle -i\beta|0\rangle $, where $|i\alpha|^2 + |-i\beta|^2 = 1$, when measuring these states the factor of $i$, where $|i^2|=1$ can be ignored. However we should always keep track of phases as in mixed states they can't be ignored as they impact the probability of measurement.

+ +

Again when applying a phase gate to $|0\rangle$ and $|1\rangle$, you are only shifting the phase of $1\rangle$, but this doesn't change the probability of measuring the state.

+ +

So what about the $H$ gate, this is a combination of $Z$ and $Y$ rotations, and takes $H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$, in this case we can't ignore the phase $\frac{1}{\sqrt{2}}$, because $|\frac{1}{\sqrt{2}}|^2 = \frac{1}{2}$, and changes the measurement probability such that it is 50/50 measuring either $|0\rangle$ or $|1\rangle$.

+ +

As a side, to visualise the poles of the $Y$ axis, in (into the screen) and out (out of the screen), they are given by:

+ +

$|i\rangle = \frac{1}{\sqrt{2}}|0\rangle + \frac{i}{\sqrt{2}}|1\rangle$

+ +

$|o\rangle\ = \frac{1}{\sqrt{2}}|0\rangle - \frac{i}{\sqrt{2}}|1\rangle$

+ +

so on the Bloch Sphere applying a $Y$ gate to either of these poles flips between them.

+ +

I would recommend watching Prof Shor explain this better than me https://courses.edx.org/courses/course-v1:MITx+8.370.1x+1T2018/courseware/Week2/lectures_u1_3/?child=first

+",6139,,6139,,5/11/2020 18:33,5/11/2020 18:33,,,,0,,,,CC BY-SA 4.0 +11972,2,,11913,5/11/2020 18:05,,3,,"

One thing to point out is that because the Paulis form a basis, you can actually represent any $2^n \times 2^n$ matrix in terms of a sum of tensors of Paulis, i.e., members of the $n$-qubit Pauli group. That is, you can write any $8 \times 8$ matrix $A$ as a sum of the form +$$A =\sum_{i,j,k}h_{ijk}\ \sigma_i\otimes\sigma_j\otimes\sigma_k$$ +where $h_{ijk}$ are the coefficients in the Pauli basis. The answer to this related question describes how to solve for these coefficients.

+ +

Now, once you have expressed $A$ in the Pauli basis, you can use the Q# operations you mention to implement the evolution. Some more background on implementing this in Q# is available at this link. The general idea is that once you have expressed the matrix $A$ in the Pauli basis, you can now use something like a Trotter–Suzuki expansion to approximately express the exponential $e^{iA}$ as a product of exponentials of Paulis, which can then in turn be implemented on a quantum computer (and also via built-in Q# tools such as Exp and PauliEvolutionSet).

+ +

Why doesn't a language like Q# include a built-in library for implementing a matrix exponential $e^{iA}$ for some general matrix $A$? Essentially because such an operation is, in general, extremely inefficient to implement on a quantum computer. To understand why, note that for a general $n$-qubit unitary, there are $4^n$ coefficients required to represent it in a basis like the Pauli basis, which means that your resulting circuit depth will be on the order of $4^n$ -- far too deep to be practical for anything beyond very small systems.

+ +

The exception is the case where the matrix $A$ has ""sparsity"" in some representation -- for example, if only a constant number of the $4^n$ coefficients in the Pauli basis are non-zero. In that case, the circuit resulting from a Trotter-Suzuki decomposition would have only constant depth, rather than going as $4^n$.

+",10473,,1978,,5/11/2020 18:12,5/11/2020 18:12,,,,0,,,,CC BY-SA 4.0 +11973,2,,11875,5/11/2020 18:13,,5,,"

You can see from here, nmr.physics.ox.ac.uk/oxonly/C2/QIP2answers.pdf, that Toffoli can't be constructed from Fredkin without the use of ancilla qubits (which in practice qubits are a valuable resource), whilst Fredkin from Toffili doesn't require the use an additional ancilla qubit. Simulating gates with Toffoli is just a more compact way of constructing a circuit with cnots and single qubit controlled unitaries, as nqubit controlled gates can be decomposed as such.

+",6139,,9482,,5/11/2020 22:50,5/11/2020 22:50,,,,0,,,,CC BY-SA 4.0 +11974,1,11975,,5/11/2020 18:53,,1,219,"

I understand linear transformations on the plane but cannot understand the Bloch sphere. How can a three dimensional sphere be generated by two linearly dependent vecotrs (the basis states 0 and 1)?

+",12015,,23,,5/12/2020 14:56,5/12/2020 14:56,Where is $i|0\rangle$ located on the bloch sphere?,,1,3,,,,CC BY-SA 4.0 +11975,2,,11974,5/11/2020 20:00,,3,,"

If you read my previous answer here Cannot interpret transformations on the bloch sphere as matrix multiplications you can see that on the Bloch sphere $i|0\rangle$ lies on $|0\rangle$, because we can ignore the global phase here and the probability of being in state $|0\rangle$ is 1, when measuring you can't distinguish between the sign of $i^2$ and 1. But then what about $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ and $\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$ if we are saying we can ignore signs. We can only ignore signs for certain measurements, if you take a measurement of a single qubit gives you equal probability of being in $|0\rangle$ and $|1\rangle$, we can say the state of the qubit is in superposition, but we can't infer anything more. However these are still two distinct states as you can't take out a global phase to equate them, there is no number $\alpha$ where $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = \alpha\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$. However $i|0\rangle = \alpha|0\rangle$ where $\alpha=i$, thus they are not distinct states up to a phase of $i$.

+ +

The basis of the Bloch sphere is not that of the two states $|0\rangle$ and $|1\rangle$, the Bloch sphere is on the basis of the 3 spin states, $\sigma_x, \sigma_y, \sigma_z$.

+ +

So if we start by assuming we can measure spin on one axis we get either $|0\rangle$ or $|1\rangle$ depending on where our measuring device is 'pointing' at, lets call this the z-axis. Now if we point our measuring device perpendicular to this axis, say the x-axis, we record either measuring $|0\rangle$ or $|1\rangle$ both with equal chance, i.e our measuring device is inbetween $|0\rangle$ and $|1\rangle$ of the Z-axis. Now If we point our device perpendicular to BOTH the x and z axis, we lay on the y-axis, but hold on, we only have one set of two real numbers for each state, so how can we REPRESENT a 3rd, we use an imaginary value to expand our state space! Now we can define space of the 3rd axis, so to summarise each of our axes lay on:

+ +

$Z$ has poles $|0\rangle$ and $|1\rangle$,

+ +

$X$ has poles $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ and $\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$

+ +

$Y$ has poles $\frac{1}{\sqrt{2}}(|0\rangle + i|1\rangle)$ and $\frac{1}{\sqrt{2}}(|0\rangle - i|1\rangle)$

+ +

Rather than getting bogged down with imaginary numbers, just remember that $i^2=-1$, and that in the complex space we can represent a real number or a complex number using $re^{i\theta} = r(\cos(\theta) + i\sin(\theta))$, and that real numbers are just where we have $i\sin(\theta)=0$. In fact, you may be wondering why we can saying by using $i$ we have a perpendicular axis, well, $\cos$ and $\sin$ form an orthogonal basis $\cos(\pi/2)=0$ , $\sin(\pi/2)=1$, hence we can can now see that we can form the 3rd orthogonal axis from 2 complex numbers by using the $i$ component, and in the case of $x$ and $z$ axis we just have 0 imaginary part.

+ +

Also $|0\rangle$ and $|1\rangle$ are linearly independent, otherwise they wouldn't form an orthonormal basis, there is no such non trivial $\alpha \in \mathbb{R}$ s.t. $\alpha |0\rangle = |1\rangle$

+",6139,,6139,,5/12/2020 14:53,5/12/2020 14:53,,,,0,,,,CC BY-SA 4.0 +11976,2,,11945,5/12/2020 0:50,,2,,"

How do you connect your two processors and with high fidelity let them communicate?

+ +

As I'm sure you can imagine, it's probably fairly easy to do over classical channels, however to pass quantum information between them turns out to be very hard. Especially in the type of hardware being employed by Google and IBM.

+ +

Probably the highest fidelity ""flying"" qubit is a photon of light. But they face several challenges:

+ +
    +
  • How do you interface a photon of light with your stationary qubits?

  • +
  • How do generate heralded photons in the first place?

  • +
  • Can we actually transmit these photons between processors(tens of feet through fiber optics between refrigerators)

  • +
+ +

Quantum transduction is a very hot topic in basic research right now.

+",9579,,,,,5/12/2020 0:50,,,,1,,,,CC BY-SA 4.0 +11978,1,11979,,5/12/2020 9:29,,0,391,"

I have some problem in understanding the proof of the concavity of root fidelity given in Chapter 9.2 of Mark M. Wilde's "Quantum Information Theory". Here, the fidelity is defined by $F(\rho, \sigma) = ||\sqrt{\rho}\sqrt{\sigma}||_1^2$ where $||\cdot ||_1$ is a Schatten 1-norm and $\rho$ and $\sigma$ are density matrices. The joint concavity of root fidelity is the following property:

+

\begin{equation*} +\sqrt{F}\left( \sum_x p_X(x)\rho_x,\, \sum_x p_X(x)\sigma_x \right) \geq \sum_x p_X(x) \sqrt{F}(\rho_x, \sigma_x) +\end{equation*} +where $p_X(x)$ is a probability distribution. The proof of the joint concavity is given as below in the book:

+
+

Proof. Let $|\phi^{\rho_x}\rangle_{RA}$ and $|\phi^{\sigma_x}\rangle_{RA}$ be the respective Uhlmann purifications of $\rho_x$ and $\sigma_x$, i.e, $F(\rho_x, \sigma_x) = |\langle \phi^{\rho_x}| \phi^{\sigma_x}\rangle_{RA}|^2$ where $R$ denotes the environment system.

+

Let $|x\rangle$ be the orthonormal basis of the system $X$. Then +\begin{gather*} +|\phi^{\rho}\rangle = \sum_x \sqrt{p_X(x)}|\phi^{\rho_x}\rangle_{RA} |x\rangle_X, & |\phi^{\sigma}\rangle = \sum_x \sqrt{p_X(x)}|\phi^{\sigma_x}\rangle_{RA} |x\rangle_X +\end{gather*} +are respective purifications of $\sum_x p_X(x)\rho_x$ and $\sum_x p_X(x)\sigma_x$. Then +\begin{align*} +\sqrt{F}\left( \sum_x p_X(x)\rho_x,\, \sum_x p_X(x)\sigma_x \right) & \geq |\langle\phi^{\rho}|\phi^{\sigma}\rangle| \\ +& = \Bigg| \sum_x p_X(x) \langle\phi^{\rho_x}|\phi^{\sigma_x}\rangle \Bigg| \\ +& \geq \sum_x p_X(x) \,|\langle\phi^{\rho_x}|\phi^{\sigma_x}\rangle|\\ +& = \sum_x p_X(x) \sqrt{F}(\rho_x, \sigma_x) +\end{align*} +where the first inequality is due to Uhlmann's theorem.

+
+

I don't think that the second inequality holds in this proof. Which point am I missing? Is this proof correct? If not, how can I prove the joint concavity of root fidelity? I appreciate any help.

+",11510,,-1,,6/18/2020 8:31,5/12/2020 10:41,Joint Concavity of (Root) Fidelity,,1,2,,,,CC BY-SA 4.0 +11979,2,,11978,5/12/2020 10:41,,1,,"

You can assign an arbitrary phase to the purifications. This way, you can make $\langle \phi^{\rho_x}\vert\phi^{\sigma_x}\rangle\ge0$, and thus you have equality in the 2nd inequality.

+",491,,,,,5/12/2020 10:41,,,,1,,,,CC BY-SA 4.0 +11980,1,,,5/12/2020 12:54,,0,110,"

I have been trying to run my code on IBM's quantum computers, so I used the following commands to associate a quantum computer to the component qcomp:

+ +
provider = IBMQ.get_provider('ibm-q')
+qcomp = provider.get_backend('ibmq-16-melbourne')
+
+ +

But the queue is endless. +I live in Southern Europe.

+",12015,,5955,,5/12/2020 13:25,5/12/2020 13:25,How can I find the most suitable IBMQ provider for my location?,,1,0,,5/12/2020 13:30,,CC BY-SA 4.0 +11981,1,11992,,5/12/2020 13:00,,1,453,"

I want to do a circuit with more than 1 million shots. How do I change the number of max_shots of Aer qasm_simulator in Qiskit? When I run it, it said Number of shots specified: 1000001 exceeds max_shots property of the backend: 1000000.'. Can someone help me? Thanks!

+",7598,,7598,,5/12/2020 13:22,5/13/2020 9:28,How do I change the number of max_shots of Aer qasm_simulator in Qiskit running on my computer?,,3,0,,,,CC BY-SA 4.0 +11982,2,,11980,5/12/2020 13:10,,2,,"

All the machines are in New York so it does not matter which one you pick.

+",332,,,,,5/12/2020 13:10,,,,2,,,,CC BY-SA 4.0 +11983,2,,11981,5/12/2020 13:19,,1,,"

This limit is set in the configuration of the device. There is no way to edit this property as far as I know.

+",6180,,,,,5/12/2020 13:19,,,,1,,,,CC BY-SA 4.0 +11984,2,,11981,5/12/2020 13:24,,2,,"

I don't think that this parameter can be altered, I can't see a situation where you should need this many shots. You can pass more than one circuit to the execute function, so if you do execute([qc, qc], shots=100) each circuit will be run for 100 shots, giving you a total of 200 shots. You could use a method like this to get up to a larger number of shots if you needed.

+",5955,,,,,5/12/2020 13:24,,,,3,,,,CC BY-SA 4.0 +11985,1,11986,,5/12/2020 13:47,,2,529,"

If it is possible give me an intuition both with vectors on the plane and on the Bloch-Sphere.

+",12015,,9459,,5/12/2020 14:53,5/12/2020 15:14,What is the intuition of the outer product of two states?,,1,3,,,,CC BY-SA 4.0 +11986,2,,11985,5/12/2020 14:14,,2,,"

The outer product of two states is a matrix. Here are some often used outer products:

+ +

\begin{equation} +|0\rangle \langle 0 | = +\begin{pmatrix} 1&0\\0&0 \end{pmatrix} +\qquad +|0\rangle \langle 1 | = +\begin{pmatrix} 0&1\\0&0 \end{pmatrix} +\\ +|1\rangle \langle 0 | = +\begin{pmatrix} 0&0\\1&0 \end{pmatrix} +\qquad +|1\rangle \langle 1 | = +\begin{pmatrix} 0&0\\0&1 \end{pmatrix} +\end{equation}

+ +

For any $2$ by $2$ matrix we can write:

+ +

\begin{equation} +M = \begin{pmatrix} a&b\\c&d \end{pmatrix} = +a|0\rangle \langle 0 | + b|0\rangle \langle 1 | +c |1\rangle \langle 0 | +d|1\rangle \langle 1 | +\end{equation}

+ +

How to calculate the outer product of two vectors:

+ +

\begin{equation} +|v\rangle \langle w | = +\begin{pmatrix} v_1\\v_2 \end{pmatrix} +\begin{pmatrix} w_1^{\dagger}&w_2^{\dagger}\end{pmatrix} = +\begin{pmatrix} v_1 w_1^{\dagger} & v_1 w_2^{\dagger} \\ +v_2 w_1^{\dagger} & v_2 w_2^{\dagger}\end{pmatrix} +\end{equation}

+ +

The outer product of a state from the Bloch sphere $|\psi\rangle = \alpha |0\rangle + \beta |1\rangle$ with itself:

+ +

\begin{equation} +|\psi\rangle \langle \psi | = +\begin{pmatrix} |\alpha|^2 & \alpha \beta^{\dagger} \\ +\beta \alpha^{\dagger} & |\beta|^2 \end{pmatrix} = \rho +\end{equation}

+ +

It is equal to the density matrix $\rho$ that also describes the state of the system like the wavefunction $|\psi\rangle$ and has correspondence with the same point on the Bloch sphere as the $|\psi\rangle$ state.

+ +

Another useful thing to know about the outer products of two states. Assume we have orthonormal eigenbasis $|v_s \rangle$ and we have this matrix $| w \rangle \langle v_1 |$ (that is not a unitary matrix and $|w\rangle$ is some normalized state). What will be after the multiplication of this matrix with a geneal $|\psi \rangle = \sum_s \alpha_s |v_s\rangle$ state vector:

+ +

$$| w \rangle \langle v_1 | \sum_s \alpha_s |v_s\rangle = \alpha_1 | w \rangle$$

+ +

This kind of outer products are often used in QC. For example, for $X$ operator we can write:

+ +

$$ +X = | 0\rangle \langle 1| + | 1\rangle \langle 0| +$$

+",9459,,9459,,5/12/2020 15:14,5/12/2020 15:14,,,,0,,,,CC BY-SA 4.0 +11987,1,11988,,5/12/2020 15:19,,3,108,"

I have a state $|x\rangle$ and I want to get the expected result when measuring observable $A$ (i.e. get the result of $\langle x| A | x \rangle$). In my case $A$ can be any of the Pauli gates. Does anyone know how to do this in Q#? There doesn't seem to be an inner product function in the libraries.

+ +

Thanks for the help!

+",11979,,9459,,5/12/2020 15:27,5/16/2020 13:51,Inner product of states in Q#,,1,0,,,,CC BY-SA 4.0 +11988,2,,11987,5/12/2020 17:39,,2,,"

It sounds like you're really asking about how to measure in a given Pauli basis. (I'm assuming for simplicity that you are working with only a single qubit, but the below is generalizable to multiple qubits as well.)

+ +

Q# has a Measure operation which performs a measurement in a given Pauli basis. For example, if you have a Qubit object q in some state $|\psi\rangle$ and you want to measure it in the $X$ basis, you can write:

+ +
   let result = Measure([PauliX], [q]);
+
+ +

Here result will be either Zero or One. If you want to then estimate the expectation value of the measurement, you would need to repeat your full operation (including whatever you did to prepare your qubit in the state $|\psi\rangle$) many times and take an average of the measurement results.

+",10473,,10473,,5/16/2020 13:51,5/16/2020 13:51,,,,3,,,,CC BY-SA 4.0 +11990,1,11991,,5/12/2020 18:54,,2,87,"

First I would like to find the matrix corresponding to the transformation and then implement it with rotational gates. How can I do it?

+ +

+",8377,,,,,5/12/2020 19:29,How do I find the matrix and circuit equivalent to this transformation?,,1,0,,,,CC BY-SA 4.0 +11991,2,,11990,5/12/2020 19:06,,2,,"

The matrix for $\sigma_z \otimes \sigma_z$:

+ +

$$\sigma_z \otimes \sigma_z = +\begin{pmatrix} +1&0&0&0 \\ +0&-1&0&0 \\ +0&0&-1&0 \\ +0&0&0&1 \\ +\end{pmatrix}$$

+ +

The matrix for $e^{-i\sigma_z \otimes \sigma_z t}$, where $t$ is some parameter:

+ +

$$e^{-i\sigma_z \otimes \sigma_z t} = +\begin{pmatrix} +e^{-i t}&0&0&0 \\ +0&e^{i t}&0&0 \\ +0&0&e^{i t}&0 \\ +0&0&0&e^{-i t} +\end{pmatrix}$$

+ +

The circuit for this operator (like described in this paper):

+ +

                                                        +

+ +

where $R_z$'s argument is $2t$. An explicit explanation about why this circuit implements the operator mentioned above can be found here. Or can be seen after doing matrix multiplication for the gates presented in the circuit:

+ +

$$ +\text{CNOT} \cdot I \otimes R_z(2t) \cdot \text{CNOT} = \\ = +\begin{pmatrix} +1&0&0&0 \\ +0&1&0&0 \\ +0&0&0&1 \\ +0&0&1&0 +\end{pmatrix} +\begin{pmatrix} +e^{-i t}&0&0&0 \\ +0&e^{i t}&0&0 \\ +0&0&e^{-i t}&0 \\ +0&0&0&e^{i t} +\end{pmatrix} +\begin{pmatrix} +1&0&0&0 \\ +0&1&0&0 \\ +0&0&0&1 \\ +0&0&1&0 +\end{pmatrix} += e^{-i\sigma_z \otimes \sigma_z t} +$$

+",9459,,9459,,5/12/2020 19:29,5/12/2020 19:29,,,,0,,,,CC BY-SA 4.0 +11992,2,,11981,5/12/2020 19:25,,3,,"

backend._configuration.max_shots= ...

+ +

Will do what you want.

+",332,,5955,,5/13/2020 9:28,5/13/2020 9:28,,,,1,,,,CC BY-SA 4.0 +11993,1,,,5/12/2020 21:51,,2,981,"

Consider a $2^n\times 2^n$ Hermitian matrix $M$ containing up to two non-zero elements, which are $1$ (so, either $M_{ii}=1$ for some $i$, or $M_{ij}=M_{ji} = 1$ for some $i$ and $j$). Each such matrix can be expressed a linear combination of Pauli operators. For example: +$$ +\begin{pmatrix} +0 & 0 & 0 & 0 \\ +0 & 0 & 1 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 0 +\end{pmatrix} += +\frac{1}{2} (XX+YY) +\ ,\quad +\begin{pmatrix} +0 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 0 +\end{pmatrix} += +\frac{1}{4} (1 - Z_1 + Z_2 -Z_1 Z_2) +\ . +$$

+ +

What would be the general expression for such an expansion, for an arbitrary $n$ and $i,j=1\ldots2^n$?

+ +

CLARIFICATION

+ +

I'm looking for a solution different from the one which involves taking trace with all the possible Pauli operators. The problem with that solution is that it requires $O(4^n)$ operations, since this is the total number of Paulis on $n$ qubits.

+ +

The motivation for my question, of course, comes from expanding an arbitrary Hermitian $H$ in terms of Pauli operators. The number of parameters in such a matrix is $O(2^n)$, which sets the lower bound on the solution complexity ⁠— which, I believe, is possible to achieve. One way to do this would be to decompose $M$ from my question in $O(\operatorname{poly}(n)) $ steps. This would allow to expand $H$ in $O(2^n)$ instead of $O(4^n)$ steps, via expressing it in terms of Paulis entry by entry.

+",6313,,6313,,5/13/2020 13:40,5/13/2020 13:40,Expressing a term of an $n$-qubit Hamiltonian in terms of Pauli operators,,1,9,,,,CC BY-SA 4.0 +11994,1,11999,,5/12/2020 22:11,,1,232,"

CHSH inequality is defined in the following way. Let $Q, R, S, T$ be two outcomes $\{\pm 1\}$ measurements. The measurements are chosen in a certain way, but that is not our concern right now. We know that a state $|\psi\rangle$ would not admit to any hidden variable representation if it violates the following inequality:

+ +

$$ +\langle\psi| (\langle QS \rangle + \langle RS \rangle + \langle RT \rangle - \langle QT \rangle)|\psi\rangle \le 2, +$$ +where, $\langle . \rangle$ is defined as the expected value of those operators with respect to $|\psi \rangle$. My question is, why do we have a negative sign for $\langle QT \rangle$? Could we not have any other constant on the right and have all positive terms on the left? Why does it work?

+",2403,,55,,5/13/2020 14:48,5/13/2020 14:48,Why is the CHSH inequality defined with a minus sign?,,1,1,,,,CC BY-SA 4.0 +11995,1,11997,,5/12/2020 23:50,,3,336,"

The CNOT gate together with phase shift gates for all possible angles are not universal for quantum computing.

+ +

Are they also not universal for classical (reversible) computing?

+ +

Is it possible to characterize the set of classical Boolean functions that can be obtained using this set of gates?

+",12038,,,,,5/13/2020 7:35,Classical computations from restricted quantum gates,,2,0,,,,CC BY-SA 4.0 +11996,2,,8930,5/13/2020 0:02,,1,,"

Let $\{|u_a\rangle\}_{a\in A}$ and $\{|v_e\rangle\}_{e\in E}$ be orthonormal bases for the space $A$ and the environment space $E$ resp. Now, if we express $\rho_A=\sum_A \alpha_a |u_a\rangle \langle u_a|$ and $\rho_E=|v_0\rangle \langle v_0|$ assuming that $\rho_E$ is some pure state on the environment. Then we can write

+ +

$$ \mathcal{E}(\rho_A)=tr_E\left(U\left(\rho_A\otimes \rho_E\right)U^*\right)\\ += \sum_{A}\alpha_a\, +tr_E\left(\left(U|u_a\rangle |v_0\rangle\right)\left(U|u_a\rangle |v_0\rangle\right)^*\right)\\ += \sum_{A}\alpha_a\, +\sum_E\langle v_e|U|v_0\rangle |u_a\rangle \langle u_a|\langle v_0|U^*|v_e\rangle\\ +=\sum_E\langle v_e|U|v_0\rangle \left(\sum_A\alpha_a|u_a\rangle \langle u_a|\right)\langle v_0|U^*|v_e\rangle\\ +=\sum_E\langle v_e|U|v_0\rangle \rho_A\left(\langle v_e|U|v_0\rangle\right)^*,$$

+ +

taking $E_e=\langle v_e|U|v_0\rangle$ be obtain the Kraus operators which act on the space $A$. I think its conceptually easier to see that the partial-trace unitary representation (or Stinespring representation) of a quantum channel is the purification of the Kraus representation, rather than the other way around.

+",11793,,11793,,5/13/2020 15:25,5/13/2020 15:25,,,,0,,,,CC BY-SA 4.0 +11997,2,,11995,5/13/2020 5:05,,3,,"

Firstly, let us assume that we are restricted to measurements in the computational basis, i.e. outcomes of $|0\rangle$ or $|1\rangle$.

+ +

Next, since neither gates create any superposition (when applied to computational basis states) we can observe that without a Hadamard gate, our qubit state is always in a single computational basis state.

+ +

Hence, we can see that the computational power of our CNOT + phase gate set is not greater than that of just a simple CNOT, and so we can reduce the initial problem to simply considering the computational power of the classical CNOT.

+ +

So, in answer to the first question, a quick bit of googling reveals the answer is no, since the CNOT gate is not universal for classical computation, reversible or otherwise.

+ +

In answer to your second question, I guess the best answer I can give is simply that it is the same as the set produceable by circuits of CNOTs. I am not sure if this set of Boolean functions is well characterised or not, but perhaps this is worth posing in the CompSci stack exchange.

+",391,,,,,5/13/2020 5:05,,,,0,,,,CC BY-SA 4.0 +11998,2,,11995,5/13/2020 7:35,,4,,"

Just to add that phase shift has no meaning in classical (binary) computation as we work only with bits in state either 0 or 1.

+ +

CNOT is only another name for XOR operation which is not universal. In classical computation, universal sets of gates are for example:

+ +
    +
  • $\{\text{NAND}\}$
  • +
  • $\{\text{NOR}\}$
  • +
  • $\{\text{AND},\text{OR},\text{NOT}\}$
  • +
+",9006,,,,,5/13/2020 7:35,,,,2,,,,CC BY-SA 4.0 +11999,2,,11994,5/13/2020 7:35,,2,,"

Imagine you had a general formula +$$ +C=a_1QS+a_2RS+a_3RT+a_4QT. +$$ +Algebraically, we know that if $Q$, $S$, $R$ and $T$ are random variables with values $\pm 1$, then each term such as $QS\in\{\pm 1\}$. Hence, there is a trivial bound +$$ +C\leq |a_1|+|a_2|+|a_3|+|a_4| =C_\max. +$$ +This can never be beaten by any model, be it local hidden variable, quantum, post-quantum.... So, if there exists a local hidden variable model that achieves $C=C_\max$ for a particular set of $\{a_i\}$, then that set of $\{a_i\}$ is not very interesting to us because there's no possibility of getting a contradiction between the LHV prediction and the quantum case (for example).

+ +

In particular, if all the $a_i$ are positive, then the choices $Q=R=S=T=1$ saturate the bound. You can also check all cases where an even number of the $\{a_i\}$ are negative - you can always find a deterministic assignment to the random variables that saturates the $C_\max$ bound. So, for it to be interesting, we need an odd number of negative signs in the coefficients.

+ +

The particular choice of the numbers themselves is not so important, except that, ideally, you'd like as large a difference as possible between the value that an LHV can achieve and some other model can be predicted to achieve so that, experimentally, you've got the best chance of observing it. I won't go through the detail here but, given there's a large permutation symmetry, you might not be surprised to find that all the coefficients being equal fulfils this desire.

+ +

To give a vague illustration: let $a_1$, $a_2$, $a_3$ be positive, and $a_4$ be negative. $C_\max=a_1+a_2+a_3-a_4$. One choice of LHV is every variable being 1, so we can achieve the value $a_1+a_2+a_3+a_4$, making the gap between the two $2|a_4|$. So you'd think to make $|a_4|$ as large as possible. However, another choice is to set $T=-1$, in which case your LHV can achieve $a_1+a_2-a_3-a_4$, yielding a gap of $2|a_3|$. Which is bigger? Obviously whichever term is larger. The best balance is to set $|a_3|=|a_4|$. Repeat for other possibilities.

+",1837,,,,,5/13/2020 7:35,,,,0,,,,CC BY-SA 4.0 +12000,2,,11993,5/13/2020 7:40,,3,,"

There's a generalisation that one can make. Let $x\in\{0,1,2,3\}^n$ be a string of values. We can define an operator $\sigma_x$ to mean ""do identity on any qubit $i$ where $x_i=0$, do $X$ on any qubit $i$ where $x_i=1,\ldots$"". Then, because the Pauli matrices form a basis, we can write +$$ +H=\sum_{x\in\{0,1,2,3\}^n}\alpha_x\sigma_x. +$$ +If $H$ is Hermitian (as it should be for a Hamiltonian) then $\alpha_x$ is real. If you have $H$ in matrix form then you can find the $\alpha_x$ via the computation +$$ +\alpha_y=\frac{1}{2^n}\text{Tr}(H\sigma_y). +$$

+",1837,,,,,5/13/2020 7:40,,,,4,,,,CC BY-SA 4.0 +12001,1,12002,,5/13/2020 10:23,,1,378,"

Consider very simple Hamiltonian $\mathcal{H} = Z = \begin{pmatrix}1 & 0 \\ 0 & -1\end{pmatrix}$. It has eigenvalues 1 and -1 with coresponding eigenstates $|0\rangle$ and $|1\rangle$, respectively. Hence, a ground state is $|1\rangle$.

+ +

For Hamiltonian simulation we need to construct a gate $U(t) = \mathrm{e}^{-i\mathcal{H} t}$. For our $\mathcal{H}$, this gate is $U(t) = Rz(-2t)$ gate.

+ +

To simulate the Hamiltonian we apply gate $U(\Delta t)$ several times to get from state $|\psi_0\rangle$ to state $|\psi_t\rangle$ where number of steps (or application of the Hamiltonian) is $t/\Delta t$. This is called Trotter method.

+ +

Since our gate $U$ is $z$ rotation which is additive, i.e. $Rz(\alpha)Rz(\beta) = Rz(\alpha+\beta)$, we do not have to bother about steps $\Delta t$ and simply apply $Rz(-2t)$.

+ +

I tried to apply $Rz$ gate on some states generated by Hadamard gate and $Ry$ gate with different angle $\theta$ (to have states in different superpositions) and then measure the outcome. I would expect that measured state should be ground state of Hamiltonian. But this was not the case. Probably I am missing something.

+ +

So my question is how to build a circuit for finding the ground state of the Hamiltonian? I would appreciate if you could provide a circuit for finding ground state of $\mathcal{H}=Z$.

+",9006,,,,,5/13/2020 13:08,How to build a circuit for simulation of a simple Hamiltonian?,,1,1,,,,CC BY-SA 4.0 +12002,2,,12001,5/13/2020 12:25,,3,,"

If two operators $A$ and $B$ commute then we can always write $e^{i(A+B)t} = e^{iAt}e^{iBt}$, so we don't need to worry about the Trotterization. Otherwise if $A$ and $B$ don't commute, then $e^{i(A+B)t} \ne e^{iAt}e^{iBt}$ and that's why we will need to apply the Trotterization procedure. Both (in)equalities can be proved with the Taylor series.

+ +

Now about how to obtain the ground state of the $H=Z$ Hamiltonian.

+ +

If we will apply $e^{iHt} = R_z(-2t)$ to an arbitrary state $|\psi\rangle = \alpha |0\rangle + \beta |1\rangle$ we will obtain only some relative phase (desregarding the global phase):

+ +

$$R_z(-2t) |\psi\rangle = \alpha |0\rangle + e^{-it}\beta |1\rangle$$

+ +

So, by just applying the $R_z(-2t)$ on some fixed state we will not succeed. One way for obtaining the ground state of the Hamiltonian is using the VQE algorithm. Here is the circuit that we will need:

+ +

                                           +

+ +

With this circuit, one has a possibility to obtain all one-qubit states in the Bloch sphere, if the initial state is $|0\rangle$. For each given $\theta_1$ and $\theta_2$, the circuit will run $N$ times and we will measure the expectation value of the Hamiltonian $\langle H \rangle = \langle Z \rangle = \frac{N_0 - N_1}{N}$, where $N_0$ is the number of measured $|0\rangle$s and $N_1$ is the number of measured $|1\rangle$s. With some optimization method we will change $\theta$s in order to minimize $\langle Z \rangle$. After the optimization is over (we have found the state for which $\langle Z \rangle$ is minimal: in this case $\langle Z \rangle = -1$ is the minimal value), the circuit with the final $\theta$s can recreate the ground state of the Hamiltonian (the $|1 \rangle$ state, because $\langle 1| Z |1 \rangle = -1$). Note, that I haven't used the circuit for the Hamiltonian simulation $e^{iHt}$.

+ +

I hope and I am interested to see an answer that will use Adiabatic state preparation algorithm for the same job.

+",9459,,9459,,5/13/2020 13:08,5/13/2020 13:08,,,,5,,,,CC BY-SA 4.0 +12003,2,,11525,5/13/2020 13:22,,7,,"

The way that I think about this is to take a decomposition in Paulis, +$$ +\rho_z=(I+zZ\otimes Z-zX\otimes X-zY\otimes Y)/4. +$$ +I can group these as +$$ +((1-3z)I+z(I+Z\otimes Z)+z(I-X\otimes X)+z(I-Y\otimes Y))/4. +$$ +Each of the 4 terms is diagonal in a separable basis, and positive semi-definite (provided $z\leq 1/3$). This directly implies a separable decomposition +$$ +\frac{1-3z}{4}I+\frac{z}{2}(|00\rangle\langle00|+|11\rangle\langle 11|)+\frac{z}{2}(|+-\rangle\langle +-|+|-+\rangle\langle -+|)+\frac{z}{2}(|y_+y_-\rangle\langle y_+y_-|+|y_-y_+\rangle\langle y_-y_+|). +$$

+",1837,,,,,5/13/2020 13:22,,,,0,,,,CC BY-SA 4.0 +12004,1,12008,,5/13/2020 13:38,,4,880,"

I am in grade 11, so answers as simple as possible. I understand that in quantum teleportation, the bell measurement must be made on the teleportee and the sender, and I understand that yields one of four possible bell states:

+ +

+ +

I have yet to understand the actual REASONING behind some of them. For example, the first one shown says 'Both Alice and Bob's qubits are the same.' I got that. The second one says 'Either Alice or Bob's qubit is 1.' I got that. But what are the other two? I don't understand analogies for them, or if the subtraction is significant.

+ +

Any help appreciated, preferably in the form of an analogy!

+",12044,,23,,7/26/2020 18:06,7/26/2020 18:06,What does the minus sign in the four bell states represent?,,3,0,,,,CC BY-SA 4.0 +12006,2,,12004,5/13/2020 14:15,,1,,"

So the Bell states are states of entanglement this means that the state of qubit one is now correlated to the state of qubit two, if you measure one you know information about the other.

+ +

If you have a two qubit system, for which both qubits are in indepent superpostion, i.e $|q_1\rangle = |q_2\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle$, so both qubits are in state $|1\rangle$ and $|0\rangle$ at the same time! Then the combined state of the system you get a state of all four combinations of $|1\rangle$ and $|0\rangle$ for both qubits:

+ +

$|\psi\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \otimes \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = \frac{1}{2}(|00\rangle + |01\rangle + |10\rangle + |11\rangle)$

+ +

Now if we say that $|q_1\rangle$ and $|q_2\rangle$, are correlated, that means that if $|q_1\rangle$ is in a state $|1\rangle$ or $|0\rangle$ we can start off by determining that there are only two possible combinations of correlation; either $q_1$ and $q_2$ are in the same state so $|11\rangle$ and $|00\rangle$, or that $q_1$ and $q_2$ are in opposite states $|01\rangle$ and $|10\rangle$, so if they are always opposite from each other we can't possibly have the qubits in states where they are the same, and vice versa! This gives you the foundation of the Bell states you see.

+ +

Now we won't get bogged down into the math, but the different signs appear because of depending on the start state of the qubits (before we put them into superposition). If a qubit starts in state $|0\rangle$ when you put this qubit into superposition(via a $H$ gate) $H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$, so $|0\rangle$ and $|1\rangle$, however if you put $|1\rangle$ into superposition you get $H|1\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$, notice the minus sign. So the Bell States with the minus sign appear when you start with $q_1$ and $q_2$ in opposite states, one is in $|0\rangle$ and the other in $|1\rangle$ (if you do some multiplication of the two superposed states you can see how the minus sign appears), and the Bell states with the + sign occur when both $q_1$ and $q_2$ start in the same state!

+ +

So what is the implication of the minus sign, when measuring the probability of a state we can ignore the signs, but this is the only we can ignore them) because the probability is taking the square! However the minus signs are important as they determine unique states of the system, the Bell States form their own orthogonal basis, i.e. it is not possible to make another Bell State from a combination of adding or subtracting the others. Doing computation on these states with different signs may lead us to different results, so we can't ignore them!

+",6139,,6139,,5/13/2020 14:47,5/13/2020 14:47,,,,0,,,,CC BY-SA 4.0 +12007,2,,12004,5/13/2020 14:43,,7,,"

If we measure states $|\Psi^-\rangle$ and $|\Psi^+\rangle$ in computational basis, both look identical: if one qubit is measured $|0\rangle$, the other is measured $|1\rangle$; if one qubit is measured $|1\rangle$, the other is measured $|0\rangle$.

+ +

Similarly, if we measure states $|\Phi^-\rangle$ and $|\Phi^+\rangle$ in computational basis, both look identical: if one qubit is measured $|0\rangle$, the other is measured $|0\rangle$; if one qubit is measured $|1\rangle$, the other is measured $|1\rangle$.

+ +

But let us change to Hadamard basis:

+ +

\begin{align} +|+\rangle=\frac{|0\rangle+|1\rangle}{\sqrt{2}}\\ +|-\rangle=\frac{|0\rangle-|1\rangle}{\sqrt{2}} +\end{align}

+ +

The inverse transformation is

+ +

\begin{align} +|0\rangle=\frac{|+\rangle+|-\rangle}{\sqrt{2}}\\ +|1\rangle=\frac{|+\rangle-|-\rangle}{\sqrt{2}} +\end{align}

+ +

Now

+ +

\begin{align} +|\Psi^-\rangle&=\frac{1}{\sqrt{2}}\left(\frac{|+\rangle+|-\rangle}{\sqrt{2}}\otimes \frac{|+\rangle-|-\rangle}{\sqrt{2}} - \frac{|+\rangle-|-\rangle}{\sqrt{2}}\otimes \frac{|+\rangle+|-\rangle}{\sqrt{2}}\right)\\ +&=\frac{1}{\sqrt{2}}\left(-|+\rangle|-\rangle+|-\rangle|+\rangle \right) +\end{align}

+ +

\begin{align} +|\Psi^+\rangle&=\frac{1}{\sqrt{2}}\left(\frac{|+\rangle+|-\rangle}{\sqrt{2}}\otimes \frac{|+\rangle-|-\rangle}{\sqrt{2}} + \frac{|+\rangle-|-\rangle}{\sqrt{2}}\otimes \frac{|+\rangle+|-\rangle}{\sqrt{2}}\right)\\ +&=\frac{1}{\sqrt{2}}\left(|+\rangle|+\rangle-|-\rangle|-\rangle \right) +\end{align}

+ +

We can see that in Hadamard basis $|\Psi^-\rangle$ and $|\Psi^+\rangle$ states behave differently:

+ +
    +
  • with $|\Psi^-\rangle$ state, if one qubit is measured $|+\rangle$, the other is measured $|-\rangle$; if one qubit is measured $|-\rangle$, the other is measured $|+\rangle$.

  • +
  • with $|\Psi^+\rangle$ state, if one qubit is measured $|+\rangle$, the other is measured $|+\rangle$; if one qubit is measured $|-\rangle$, the other is measured $|-\rangle$.

  • +
+ +

You can check that $|\Phi^-\rangle$ and $|\Phi^+\rangle$ states also behave differently in Hadamard basis.

+",2105,,2105,,5/13/2020 19:28,5/13/2020 19:28,,,,0,,,,CC BY-SA 4.0 +12008,2,,12004,5/13/2020 14:53,,1,,"

Quantum states are defined by more than the outcome probabilities in a fixed measurement setting.

+ +

As you noticed, $|\Phi^+\rangle$ and $|\Phi^-\rangle$ correspond to the same identical output probabilities when measured in a fixed basis (here the computational basis). However, they react in different ways, and result in different outcomes, when measured in different ways.

+ +

You can think of the sign between the two terms as a way to describe concisely how exactly these states behave when measured in different ways

+",55,,,,,5/13/2020 14:53,,,,0,,,,CC BY-SA 4.0 +12009,1,,,5/13/2020 15:15,,3,275,"

I see a lot of Venn kind of diagrams to depict the distinction between separable and entangled mixed states. Like this one (apologize my poor "paint"ings):

+

$\hskip2.0in$

+

So there is an entangled state $\rho$. It is entangled because it is not inside the set of separable states. My question is inspired by the picture:

+
+

Is there a separable state that is furthest away from the entangled one?

+
+

I tried to indicate it in red, but can we calculate the separable state?

+

To be concrete: What is the separable state furthest away from a GHZ state:$(|00\cdots 0\rangle+|11\cdots 1\rangle)/\sqrt2$...

+",5280,,-1,,6/18/2020 8:31,5/22/2020 13:21,Is there a separable state that is furthest away from an entangled one?,,4,10,,,,CC BY-SA 4.0 +12010,2,,5972,5/13/2020 18:27,,2,,"

Disclaimer: I am learning it right now, so I can only give a partially satisfying answer. Nobody answered so far, so I'll give you the best I know waiting for somebody to give a more detailed answer.

+ +

I suggest you have a look at the qiskit book, which has a simple tutorial that I found super useful. They literally say that you don't have to compute the eigenvalues. This is because a matrix $A$ that is $N\times N$ can have up to $N$ distinct eigenvalues and therefore computing them will take at least $O(N)$ time, which means the exponential advantage is lost.

+ +

In general, I think the idea is that when you perform a QPE you have a state that encodes the values of the eigenvalues, but you cannot access them. In a similar way, you cannot directly access the solution vector. Thus, the QC can perform a controlled rotation based on the value of those eigenvectors because they are encoded in a quantum state.

+",11551,,,,,5/13/2020 18:27,,,,0,,,,CC BY-SA 4.0 +12012,1,,,5/13/2020 19:42,,1,134,"

In this paper, there is a diagram explaining how HHL works, which I attached below:

+ +

My question is, for the rotation part, how do you write $R$ as a combination of universal set of gates without knowing the eigenvalues a priori? Or what is a generic way of writing $R$ without doing any classical pre-computation regarding the eigenvalues?

+ +

In most of the implementations that I found online, it is assumed that the eigenvalues are known, and then one can find the angles of rotation by calculating for each eigenvalue: $\theta_i = arccos(\frac{C}{\lambda_i})$. After that, one can append for the ancilla register multiple $R_y$ gates with the aforementioned angles of rotation as arguments.

+ +

Thanks in advance for the help!

+",11979,,55,,5/14/2020 6:29,5/14/2020 20:41,"In the rotation part of HHL algorithm, how do you decompose $R$ in terms of universal gates?",,1,0,,,,CC BY-SA 4.0 +12013,2,,12009,5/13/2020 21:00,,4,,"

Whenever under the distance measure you are using, the set of separable states is closed, there is a furthest point - this is a feature of closed sets. This is certainly the case whenever the distance measure is continuous relative to any other measure relative to which the separable states are closed, such as the trace norm distance.

+ +

In particular, there is always a furthest state as measured by the trace norm distance.

+",491,,,,,5/13/2020 21:00,,,,2,,,,CC BY-SA 4.0 +12014,1,12015,,5/13/2020 22:13,,3,57,"

If the quantum states of the subsystems of two systems are close (for example: in terms of trace distance), are the states of the larger systems also close, i.e., if +$$ ||\rho_A - \rho_{A^\prime}||\leq \epsilon$$ and $$ ||\rho_B - \rho_{B^\prime}||\leq \epsilon,$$ +can we claim that $$ ||\rho_{AB} - \rho_{A^\prime B^\prime}||\leq \delta(\epsilon)$$? +Thanks in advance!

+",12047,,55,,5/13/2020 23:12,5/14/2020 8:51,Does the trace distance between marginals bound the distance between the overall states?,,1,0,,,,CC BY-SA 4.0 +12015,2,,12014,5/13/2020 23:10,,4,,"

No. Just take two Bell states. They have identical reduced density matrices yet are orthogonal, that is, as distant from each other as it gets.

+",491,,491,,5/14/2020 8:51,5/14/2020 8:51,,,,0,,,,CC BY-SA 4.0 +12016,1,12072,,5/14/2020 1:47,,3,252,"

$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$ +Assume there is an entangled pair $(q_1, q_2)$ owned by Alice and Bob, respectively, and some qubit $q_0$ in state $\ket{\psi}$ that Alice wants to teleport. Let Alice perform all the necessary operations to teleport $q_0$, namely, $\text{CNOT}(q_0, q_1)$, $H(q_0)$ (I'm not sure if this is sufficient, or if Alice has to measure her two qubits to collapse their superposition and complete the teleportation, but this isn't relevant to the question. Assume she does measure them if it is necessary). Now the state of $q_2$ should equal $\ket{\psi}$, or be closely related to it through one of the bell states. Assume that Alice and Bob coordinated on what time Alice would complete the teleportation, so that Bob is aware the teleportation has occurred.

+ +

What is keeping Bob from assuming that $q_2$ is in some particular bell state, and measuring $q_2$? It would seem that would allow faster than light communication 25% of the time. In fact, Bob could even produce imperfect clones of $q_2$, and my understanding is that he could somehow account for the imperfection of these clones. These imperfect clones would then allow him to extract more information from the single teleportation, and, assuming he knows the sort of thing he’s looking for, could provide an even higher chance that he receives meaningful information out of this communication - even if no classical information is sent from Alice.

+ +

What prevents this from working?

+ +

Edit

+ +

According to Holevo's Theorem, one can only retrieve up to $n$ classical bits given $n$ qubits. However, as I understand it, this does not prevent one from storing $n$ classical bits into a single qubit, imperfectly cloning it $n - 1$ times, and thus retrieving $n$ classical bits out. Given this, we can send a single qubit through teleportation and the receiver gets an accurate message approximately 25% of the time (less than this of course, due to the error introduced by the imperfect cloning).

+ +

In regards to the user not knowing whether the information is correct and thus it being no use, consider the classical case of $n$ one-way radios. Only 25% of the radios send the correct message, on channel $x$, the rest send random noise. Say the message is a recorded English sentence of some substantial length (say 20 words). An observer of this message, flipping through the channels, would be able to tell with high certainty which of these radios is transmitting the correct message. How does this differ in the quantum case, such that we cannot apply the same logic?

+",11742,,11742,,5/14/2020 14:40,5/19/2020 2:25,Why can’t I use quantum teleportation to transmit data FTL 1/4 of the time?,,2,9,,,,CC BY-SA 4.0 +12018,2,,12016,5/14/2020 2:51,,6,,"

Suppose Alice wants to send Bob a 1000 bit message. To receive the message, Bob flips 1000 coins and writes down the results as 0s and 1s. About 50% of the random bits in the message that Bob generated are the same as in the intended message. Clearly this is an even better faster-than-light communication method than teleportation, because it succeeds 50% of the time instead of 25% of the time! /sarc

+ +

When you are transmitting information, getting a bit right 50% of the time (or 25% of the time in the case of superdense coded quantum bits) is not enough. That's as bad as random noise. You have to do better than the noise floor to transmit information.

+",119,,119,,5/14/2020 2:58,5/14/2020 2:58,,,,7,,,,CC BY-SA 4.0 +12019,2,,12012,5/14/2020 5:17,,1,,"

I think you are misunderstanding what HHL is doing here. Let's recall the problem definition earlier in §3.1:

+ +
+

We are given a system of $N$ linear equations with $N$ unknowns which can be expressed as $Ax=b$, where $x$ is a vector of unknowns, $A$ is the matrix of coefficients and $b$ is the vector of solutions. If $A$ is an invertible matrix, then we can write that the solution is given by $x=A^{−1}b$.

+
+ +

From this we can see that it is in fact $x$, not $A$, that is the unknown to be found. So, since you know what $A$ is, you do in fact know the eigenvalues of $A$ beforehand. In fact, since $A$ must be known to implement $U$, you must even know them in steps a) and c) also! Hence what you describe as ""pre-computation"" is actually a necessary step, encoding the problem statement into the gates in the algorithm :)

+ +

Edit:

+ +

As Nelimee mentioned in the comments, it seems that you don't necessarily need to know the eigenvalues exactly, and it is sufficient to know an upper and lower bound, as discussed in a previous post.

+",391,,391,,5/14/2020 20:41,5/14/2020 20:41,,,,1,,,,CC BY-SA 4.0 +12020,2,,12009,5/14/2020 9:26,,4,,"

Here's an example based on entanglement witnesses. Let +$$ +|\psi\rangle=\frac{1}{\sqrt{2}}(|000\rangle+|111\rangle). +$$ +The aim is to define an operator $W$ such that $\text{Tr}(W\rho_\text{sep})\geq 0$ for all separable states $\rho_\text{sep}$. That means for any $\rho$ such that $\text{Tr}(W\rho)<0$, it must be entangled.

+ +

An easy way to define such an operator is +$$ +W=\alpha I-|\psi\rangle\langle\psi|, +$$ +where +$$ +\alpha=\max_{\rho_\text{sep}}\langle\psi|\rho_\text{sep}|\psi\rangle. +$$ +In this particular case, the maximisation is achieved with $\rho_\text{sep}=|0\rangle\langle 0|^{\otimes 3}$, I believe, so $\alpha=\frac12$.

+ +

Of course, $\text{Tr}(W|\psi\rangle\langle\psi|)=\alpha-1=-\frac12$, so we see that it's entangled.

+ +

Now consider any other state $\rho$. We can think of the value $\text{Tr}(W\rho)$ as measuring distance. The smallest possible value is $-\frac12$, and if you have that, you've got the state $|\psi\rangle$. The larger the value, there is a sense of getting further away from $|\psi\rangle$. Now, the maximum value of $\text{Tr}(W\rho)$ is $\alpha=\frac12$, which is achieved by $\langle\psi|\rho|\psi\rangle=0$. So this categorises the states that are furthest away according to this specific measure. There are separable states which are orthogonal to $|\psi\rangle$, such as $|001\rangle$, and so they can be considered the furthest separable states.

+",1837,,,,,5/14/2020 9:26,,,,3,,,,CC BY-SA 4.0 +12021,1,,,5/14/2020 11:30,,1,61,"

The paper Iterative Qubit Coupled Cluster approach with efficient screening of generators describes a new screening procedure for generators of the QCC ansatz.

+ +

How does one get from defining the flip indices $F(\hat{T})$ of a Pauli term $\hat{P}$:

+ +

$$F(\hat{P}) = \{j: \hat{f} ∈\hat{P}\}$$

+ +

to the partitioning of the second-quantised Hamiltonian as:

+ +

$$\hat{H}=\sum_{k}\hat{S}_{k},$$

+ +

where

+ +

$$\hat{S}_{k}=\sum_{j}\hat{C}_{j}\hat{P}_{j}$$

+ +

groups the terms with the same flip indices?

+ +

$$F(\hat{P}_{i})=F(\hat{P}_{j}),\quad ∀(\hat{P}_{i},\hat{P}_{j}) ∈ \hat{S}_{k}$$

+ +

And how is it that Pauli words possessing the same flip indices introduce an equivalence relation on the set of Hamiltonian terms?

+",9175,,55,,5/29/2020 7:40,6/18/2020 23:19,Screening procedure in an iterative qubit coupled cluster (iQCC) ansatz,,0,1,0,,,CC BY-SA 4.0 +12022,1,,,5/14/2020 11:40,,0,114,"

I'm doing a simulation of the QAOA algorithm with noise via the QAOA class of Qiskit 0.19. +Here's (part of) my code:

+ +
p=1
+In_params=np.random.rand(2*p)*np.pi/2
+optalg= SPSA(max_trials=1000)
+
+backend = Aer.get_backend('qasm_simulator')
+model_device= provider.get_backend('ibmq_16_melbourne')
+device_prop = model_device.properties()
+noisemodel= NoiseModel.from_backend(device_prop)
+
+quantum_instance=QuantumInstance(backend, shots=1024, noise_model=noisemodel)
+qaoa = QAOA(qubitOp, optalg, p, initial_point=In_params, callback= mycallback)
+qaoa.expectation=PauliExpectation()
+result = qaoa.run(quantum_instance)
+
+ +

I'm using the default initial state, that is $|+\rangle^{\otimes n}$, constructed automatically by QAOA using Hadamard gates. I'm using a noise model for the execution: is the initial state construction affected by noise also?

+ +

Thanks!

+",12017,,9800,,5/14/2020 17:43,5/14/2020 17:43,QAOA with Qiskit: Is the initial state affected by the noise model?,,0,3,,,,CC BY-SA 4.0 +12023,1,12024,,5/14/2020 13:07,,3,62,"

I am confused as to what is being measured in the boxes in the example drawings shown on the Entanglement and Bell Tests section in the IBM Q Experience:

+ +

+ +

https://quantum-computing.ibm.com/docs/guide/mult-entang/entanglement-and-bell-tests

+ +

My understanding is that the $(|00 \rangle + |11 \rangle)/ \sqrt{2}$ represents a superposition of two states, $|00 \rangle$ and $|11 \rangle$. And that $|00 \rangle$ is a two qubit entangled state. If Alice measures one of the qubits to be a $0$, the other qubit must be a $0$ as well due to the entanglement. The same is true if Alice measures a $1$.

+ +

My question comes from not understanding why $A$ and $A'$ are present in the box. What are they measuring? Is $A$ measuring one qubit while $A'$ is measuring the second qubit? Or is $A$ measuring one qubit while $A'$ measures the same qubit. Same questions for box $B$.

+ +

MY BACKGROUND: I am working through the IBM Q Experience. I have some exposure to QM through College level Physical Chemistry. I have a basic understanding of linear algebra, superposition, and entanglement.

+",12050,,9459,,5/14/2020 14:51,5/15/2020 17:00,"What are the two measurements per box being done in the Bell Tests in the IBM Quantum Experience ""Entanglement and Bell tests"" Section",,1,0,,,,CC BY-SA 4.0 +12024,2,,12023,5/14/2020 15:55,,2,,"

Both $A$ and $A'$ measure the same qubit, while $B$ and $B'$ are applied to the second qubit. Alice chooses (randomly) which of the two measurement settings ($A$ or $A'$) she will choose for each run of the experiment, while Bob chooses between $B$ and $B'$.

+ +

You mention the perfect correlation in the computational basis. +Note however that there's nothing ""quantum"" about correlation in a single basis. You can easily reproduce this in a ""classical"" theory. +Replace the photons by balls with color and the measurement by determining the color. The source is just someone (repeatedly) giving each of Alice and Bob one ball. It would not surprise you if you find that whenever Alice has a blue ball also Bob has a blue ball. +As a rule of thumb: If you do not find anything unusual about an experiment when you replace photons by balls then there's nothing quantum about it. ;-)

+ +

You need at least two measurement settings for both parties for a Bell inequality (that can be violated).

+",104,,104,,5/15/2020 17:00,5/15/2020 17:00,,,,2,,,,CC BY-SA 4.0 +12025,2,,10099,5/14/2020 18:31,,3,,"

It’s straightforward to see that a random element $U$ drawn from a design is, with very high probability, far away from any fixed unitary $V$, i.e. you can show that the distance between $U$ and $V$ (in operator norm or in the diamond norm of their channels) is on average very close to maximal.

+ +

But what you’re asking about is if there exists at least one element in the design which is close to some fixed unitary $V$. Without knowing anything else about the structure of the design, you’re asking when do unitary $t$-designs cover the unitary group (i.e. every $U$ in $U(d)$ is at most $\epsilon$ away, in some norm, from some element of the design. Equivalently, putting $\epsilon$-balls around each unitary, $U(d)$ is contained in the union of the balls.)

+ +

This doesn't address your question rigorously, but here's an argument for why the design order should be at least $t=O(d^2)$, in order for $t$-designs to cover $U(d)$. For an exact unitary $t$-design $\mathcal{E}$, a lower bound on the cardinality is $|\mathcal{E}| \geq d^{2t}/t!$. If the number of elements in $\mathcal{E}$ is some constant multiple of this lower bound, then we find that $|\mathcal{E}|$ becomes comparable to the volume of the unitary group (more precisely, the vol($U(d)$)/vol($\epsilon$-ball)) when $t\sim d^2$. But to rigorously show that for some $t$, unitary $t$-designs cover the unitary group will require more work.

+",12057,,12057,,5/14/2020 19:03,5/14/2020 19:03,,,,0,,,,CC BY-SA 4.0 +12026,1,12028,,5/14/2020 19:30,,1,61,"

Why does the entangled pair (the mechanism of teleportation) need to entangle to start with in order for the teleportation to proceed? After you perform the Bell measurement, doesn't it just break the entanglement anyway?

+",12044,,55,,10/12/2020 7:28,10/12/2020 7:28,Why does the entangled pair need to be entangled to perform teleportation?,,1,0,,,,CC BY-SA 4.0 +12027,1,12033,,5/14/2020 19:49,,10,517,"

While trying to simplify a certain 2-qubit quantum circuit, I managed to get it down to this:

+ +

+ +

But by inspecting the corresponding two-qubit unitary directly, I can come up with the arguably simpler:

+ +

+ +

where the rotation operator ""moved"" to the first qubit. +I am using the convention +$ +R_{\theta} := R_y(2\theta) = + \begin{pmatrix} + \cos\theta & -\sin\theta \\ + \sin\theta & \cos\theta + \end{pmatrix} +$. +The rotation $R_{\pi/4}$ is thus $=XH$.

+ +

How can I show that the two circuits are equivalent by ""elementary"" circuit identities, instead of just verifying that they amount to the same unitary? I tried many different simplifications without success.

+",8247,,8247,,5/14/2020 23:05,5/15/2020 11:28,"Simplification of ""rotation swapping"" circuit",,3,0,,,,CC BY-SA 4.0 +12028,2,,12026,5/14/2020 19:59,,6,,"

You can think of entanglement as a way to share the information between several qubits (this is definition of entanglement - the state of the system in which information is distributed across the whole system and can not be represented as states of individual subsystems).

+ +
    +
  • First Alice and Bob's parts of Bell pair are entangled.
  • +
  • Then Alice's message qubit is entangled with Alice's part of Bell pair, so that information carried by it (the $\alpha$ and $\beta$ in the $\alpha |0\rangle + \beta |1\rangle$ state) is distributed across the whole system.
  • +
  • Measuring two qubits in Alice's possession ""squeezes"" the information out of them and into the last part of the system, Bob's qubit.
  • +
+ +

Without the initial entanglement, Alice's qubits don't have a way to share information with Bob's qubit.

+ +

In more mathematical terms,

+ +
    +
  • If Alice's and Bob's qubits are not entangled initially, the state of the system can be represented as tensor product $|\psi_A\rangle\otimes|\psi_B\rangle$.
  • +
  • Adding message qubit corresponds to the state $|m_A\rangle \otimes |\psi_A\rangle\otimes|\psi_B\rangle$
  • +
  • Now, if you only perform gates on the first two qubits, you can always represent them as $G_A\otimes I_B$, and the state of Bob's qubit never changes.
  • +
+",2879,,,,,5/14/2020 19:59,,,,0,,,,CC BY-SA 4.0 +12029,2,,9143,5/15/2020 4:57,,1,,"

For more information on transpiling in Qiskit, see this StackOverflow post.

+ +

The previous answer captures most of the basic ideas. Transpiling at its most basic is converting one set of gate operations to an equivalent set of gate operations. This might involve approximating certain non-native gates which cannot be implemented directly on a given quantum computer. Using the Solovay-Kitaev Theorem, we know there is a way to approximate any arbitrary unitary gate using a set of basis gates, which you can read about in Nielsen & Chuang 4.5, and Appendix 3.

+ +

Refactoring gates into some other set of equivalent gates might involve something like changing a controlled-Z gate into a CNOT-gate conjugated by Hadamards if there is no implementation of a controlled-Z gate on a particular quantum computer. It might involve doing the reverse if one wishes to reduce gate counts. Reducing gate counts is often important because circuit depth increases runtime which leads to ""decoherence"", and the introduction of errors due to errors in the gates themselves.

+ +

To understand the mathematics behind transpiling, it's best to just look at the linear algebra and write out the matrix representations of the gates to prove they are equal (or at least approximately equal within some error bounds). In general, optimizing a quantum algorithm via transpiling is a ""QMA-complete"" problem, which is a sort of quantum version of NP-complete problems. So, in general it is not an easy thing to do. However, you can expect some cases to be easier. This is discussed more in Nielsen & Chuang. You might also want to read up on verifiable optimizations using automated theorem provers. This may prove important in the future since verifying quantum circuits without some formal proof system is in general too complex to do on a classical computer and requires a quantum computer in some cases.

+ +

One might also try a machine learning approach that takes into account the graph stricture of a quantum circuit as well as the semantics, but I haven't found any examples of this yet.

+ +

The transpiler in Qiskit at present doesn't seem to function well consistently, and I'm currently investigating exactly why this is. As of now (May 14, 2020), the StackOverflow link I gave above gives several counterexamples of gates that cannot be transpiled in Qiskit. Some of these include a permutation matrix on 3-qubits, and randomly generated unitary gates on 3 or more qubits using the random_unitary() function in Qiskit.

+ +

I hope this helps you understand transpilers somewhat better.

+",12060,,,,,5/15/2020 4:57,,,,0,,,,CC BY-SA 4.0 +12030,2,,8783,5/15/2020 7:16,,5,,"

Following are a few insightful journals on quantum information, computation and algorithms.

+ + +",4501,,,,,5/15/2020 7:16,,,,1,,,,CC BY-SA 4.0 +12031,2,,12027,5/15/2020 8:30,,5,,"

I am going to assume some usual transformations such as the involution of $H$ and CNOT. Rewriting the two gates $R$ with more standard gates, a possible derivation goes like this (details for equalities (1), (2) and (3) are given below):

+ +

+ +

I used in particular the identity:

+ +

+ +

from which I also derived:

+ +

+ +

I also used:

+ +

+ +

A very powerful tool for doing this kind of graphical proof is the ZX-Calculus (https://arxiv.org/abs/0906.4725), which I actually used for reasoning on your problem here, before turning the answer in circuit form.

+",7422,,,,,5/15/2020 8:30,,,,0,,,,CC BY-SA 4.0 +12032,2,,12027,5/15/2020 8:49,,3,,"

If $U_1 = U_2$, then $U_1 U_2^{\dagger} = I$. So let's add to the first circuit the inverse/dagger of the second one:

+ +

+ +

This whole thing should be an identity. Note that, for this, we should prove that whole circuit except last $R_y(-\theta) I$ should be equal to $R_y(\theta) I$. By remembering that the SWAP gate consists of 3 CNOT gates and $\text{SWAP} \cdot I R_y(\theta) \cdot\text{SWAP} = R_y(\theta) I$, we will have:

+ +

+ +

This should be equal to $R_y(\theta) I$. This circuit is equal to $U \cdot R_y(\theta) I \cdot U^\dagger$, where $U$ is this circuit:

+ +

+ +

Now we should try to prove that $U \cdot R_y(\theta) I \cdot U^\dagger = R_y(\theta) I$. After simplifying the $U$ I have obtained this circuit:

+ +

+ +

where I took into account that $HXH = Z$ and $I \otimes H \cdot \text{CNOT} \cdot I \otimes H = CZ$ (note that I have omitted the $\otimes$ sign in the previous expressions). If my calculations are right, then $U = \frac{1}{\sqrt{2}}(I \otimes I+iY \otimes X)$. So, by omitting again the $\otimes$ sign:

+ +

$$U \cdot R_y(\theta) I \cdot U^\dagger = \frac{1}{2}\left[II+iY X\right]\left[\cos(\theta)I I - i\sin(\theta)Y I\right]\left[I I-iY X\right] = R_y(\theta) I$$

+ +

So, the circuits are equivalent.

+",9459,,9459,,5/15/2020 11:28,5/15/2020 11:28,,,,0,,,,CC BY-SA 4.0 +12033,2,,12027,5/15/2020 8:59,,5,,"

Why not make it even smaller?

+ +

+ +

Initial state:

+ +

+ +

Change rotation basis:

+ +

+ +

Phase the parity on the top bit instead of the bottom bit:

+ +

+ +

Apply XZ = iY to the adjacent CX CZ operations:

+ +

+ +

Move the middle CNOT leftward, changing its interaction basis from XZ to XY to ZY to ZY as it moves through the single qubit gates, resulting in it become a CY:

+ +

+ +

Cancel the adjacent CYs, then propagate the non-parameterized rotations rightward. This changes the basis of the rotation back to Y, and transforms the NOTC into a CY.

+ +

+ +

Cancel the two X rotations and you're done.

+",119,,,,,5/15/2020 8:59,,,,0,,,,CC BY-SA 4.0 +12035,1,12036,,5/15/2020 17:55,,1,222,"

I've been trying to learn about Shor's algorithm by writing out implementations of the circuit for modular exponentiation, ${ a }^{ x }\; ({ mod }\; N)$, to find the period $r$ for small numbers such as:

+ +

$(N=15,\quad a=11)\quad \longrightarrow \quad r=2$,

+ +

$(N=35,\quad a=13)\quad \longrightarrow \quad r=4$,

+ +

$(N=21,\quad a=5)\quad \longrightarrow \quad r=6$.

+ +

I know these are incredibly small numbers, but I realised that in order to actually start building the cicuit at all (using the binary exponentiation method), I needed to calculate the values of ${ a }^{ { 2 }^{ k } }\; ({ mod }\; N)$ for all $0\;\le\;k \; <\; 2\; \lceil { \log _{ 2 }{ N } }\rceil $, which pretty much immediately made the values of $r$ obvious before I'd even started building the circuit.

+ +

For example, take the least trivial case from the above, where $r=6$. I needed to calculate:

+ +

${ 5 }^{ 0 }\; ({ mod }\; 21)=1$,

+ +

${ 5 }^{ 1 }\; ({ mod }\; 21)=5$,

+ +

${ 5 }^{ 2 }\; ({ mod }\; 21)=4$,

+ +

${ 5 }^{ 4 }\; ({ mod }\; 21)=16$,

+ +

${ 5 }^{ 8 }\; ({ mod }\; 21)=4$,

+ +

${ 5 }^{ 16 }\; ({ mod }\; 21)=16$.

+ +

Simply by inspection, I can already see what the value of $r$ must be, because the result is the same when $x$ increases by six or twelve, but not after increasing by two or three.

+ +

I therefore have two questions:

+ +
    +
  1. Is calculating these modular exponentials of $a$ to powers of two required when building these circuits, or is there some way of not even having to do that?

  2. +
  3. If we do need to calculate these values, can we not find the period $r$ of this modular exponentiation function classically in an efficient way, starting with these values and then using a method analogous to 'interval halving', or an I being misled by using small numbers? [SEE EDIT]

  4. +
+ +

Thanks in advance!

+ +

EDIT: As Mark S points out, the results of modular exponentiation have very little structure, and so although perhaps faster than $O(N)$, such an 'interval halving' method would not have logarithmic complexity, thus would be slower than Shor's algorithm for large enough $N$.

+",12068,,12068,,5/16/2020 2:07,5/16/2020 2:07,Building the period-finding circuit for Shor's Algorithm & the classical complexity of finding the period,,1,0,,,,CC BY-SA 4.0 +12036,2,,12035,5/15/2020 21:02,,2,,"

The fast ""modular exponentiation by repeated-squaring"" part of Shor's algorithm is only one of the many ideas in Shor's paper, and I think a more critical idea/breakthrough is the QFT itself. However, without something equivalent to modular exponentiation by repeated-squaring, you have no way of having a small circuit to evaluate $f(x)$, so that you can perform the QFT on $\vert x\rangle\vert f(x)\rangle$.

+ +

I also think you are being significantly misled by looking at such small numbers. You'll need to prepare a state $\vert x\rangle\vert f(x)\rangle$ somehow; here $f(x)$ is evaluated with repeated-squaring, which is honestly pretty darned fast already, when $x$ gets large. It's not clear if a ""binary search"" is not already what the repeated-squaring is effectively doing.

+",2927,,,,,5/15/2020 21:02,,,,3,,,,CC BY-SA 4.0 +12037,2,,10290,5/16/2020 1:39,,0,,"

As @el-capi and @chris-granade mentioned in comments, this looks like a problem with your .NET Core installation. Try the following to get yourself unblocked:

+ +
    +
  • Remove any existing installation of .NET Core SDK or .NET Core Runtime.
  • +
  • Install .NET Core 3.1 SDK (x64 or x86 to match your Windows installation) using the links here: https://docs.microsoft.com/en-us/dotnet/core/install/sdk?pivots=os-windows + +
    +

    In PowerShell, you can run [System.Environment]::Is64BitOperatingSystem to see whether you are running 64-bit Windows.

    +
  • +
  • Open a new command prompt and reinstall the latest version of IQSharp by running: + +
    dotnet tool uninstall -g Microsoft.Quantum.IQSharp
    +dotnet tool install -g Microsoft.Quantum.IQSharp
    +dotnet iqsharp install
    +
  • +
+",10473,,10473,,5/16/2020 1:51,5/16/2020 1:51,,,,0,,,,CC BY-SA 4.0 +12038,1,12193,,5/16/2020 2:01,,3,311,"

I first encounted this idea in Constructing finite dimensional codes with optical continuous variables where it mentions ""superpositions of an infinite number of infinitely squeezed states"" in the introduction.

+ +

I was able to find this question which states in regards to free fermions that:

+ +
+

you can argue that the wavefunctions are superpositions of an infinite number of space ""basis states""

+
+ +

I was also able to find references to the idea in Quantum Cosmology And Baby Universes where it is stated:

+ +
+

One can therefore regard the singular $K$ eigenstates as being superpostions of an infinite number of regular harmonic oscillator solutions.

+
+ +

Additionally, in this paper (PDF) on Quantum Theory of the Electric Field in the Coherent States section (page 6) it states:

+ +
+

Coherent states are superpositions of an infinite number of Fock states

+
+ +

Are objects that are in a superpostion of an infinite number of states used in practice or is it strictly a theoretical and/or mathematical concept?

+ +

Related:

+ + +",2645,,,,,5/26/2020 15:42,Are superpositions of an infinite number of states realizable?,,2,2,,,,CC BY-SA 4.0 +12039,1,12041,,5/16/2020 5:07,,1,273,"

Sorry, I am a newbie to quantum computing.

+ +

I am reading an overview paper (released just a week ago) titled Advances in Quantum Deep Learning: An Overview (Garg & Ramakrishnan, 2020). I am stuck on the following example from paper (shown in screenshot below).

+ +

+ +

I understand that one of the qubits was measured and it returned a value of $0$. Therefore, the state of entangled two-qubit quantum system has been updated as following:

+ +

$|\psi'\rangle = \frac{1}{\sqrt{2}} |00\rangle + \frac{1}{\sqrt{2}} |01\rangle.$

+ +

But in the initial state,

+ +

$|\psi\rangle = \frac{1}{\sqrt{3}} |00\rangle + \frac{1}{\sqrt{3}} |01\rangle + \frac{1}{\sqrt{6}} |10\rangle + \frac{1}{\sqrt{6}} |11\rangle$

+ +

the superposition state $\frac{1}{\sqrt{3}} |00\rangle + \frac{1}{\sqrt{3}} |01\rangle$ has the probability $\frac{2}{3}$ which according to the statement in paper has been measured to be $0$. Then why the updated state of quantum system is

+ +

$|\psi'\rangle = \frac{1}{\sqrt{2}} |00\rangle + \frac{1}{\sqrt{2}} |01\rangle$

+ +

which yielded $0$ instead of

+ +

$|\psi'\rangle = \frac{1}{\sqrt{2}} |10\rangle + \frac{1}{\sqrt{2}} |11\rangle$

+ +

which instead has the probability $\frac{1}{3}$ when it was not measured?

+",10428,,,,,5/16/2020 11:23,Which entangled qubit is measured in this example?,,1,1,,,,CC BY-SA 4.0 +12040,1,12042,,5/16/2020 6:26,,3,328,"

I'm trying to implement a controlled $\frac{\pi}{2}$ rotation along y axis and z axis (two individual gates) in Qiskit but I'm stuck. My thought was calculating the square root of the y and z pauli matrices (done), and implement using the CU3 gate. However, I wasn't able to find the correct parameters ($\theta, \phi, \lambda$) for the matrices I got. Is there a workaround for this? Thanks in advance.

+ +

Edit: I know if I remove the overall phase of $\sqrt{Y}$ then I can get the correct parameters, but I think since this is not an overall phase of all qubit so if I remove the phase I'll get a different gate?

+",9153,,9153,,5/16/2020 6:42,5/16/2020 18:15,Implementing controlled $\frac{\pi}{2}$ y and z rotation in Qiskit,,3,0,,,,CC BY-SA 4.0 +12041,2,,12039,5/16/2020 6:30,,1,,"

Firstly, note that the state is seperable (not entangled):

+ +

\begin{equation} +|\psi\rangle = \frac{1}{\sqrt{3}} |00\rangle + \frac{1}{\sqrt{3}} |01\rangle + \frac{1}{\sqrt{6}} |10\rangle + \frac{1}{\sqrt{6}} |11\rangle= \\ += \left(\frac{\sqrt{2}}{\sqrt{3}}|0\rangle + \frac{1}{\sqrt{3}}|1\rangle \right) \left(\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle \right) = |\psi_1 \rangle |\psi_2 \rangle +\end{equation}

+ +

where $|\psi_1 \rangle = \left(\frac{\sqrt{2}}{\sqrt{3}}|0\rangle + \frac{1}{\sqrt{3}}|1\rangle \right)$ and $|\psi_2 \rangle= \left(\frac{1}{\sqrt{2}}|0\rangle + \frac{1}{\sqrt{2}}|1\rangle \right)$ correspond to the first and the second qubit states. This $|\psi\rangle = |\psi_1 \rangle |\psi_2 \rangle$ is not possible if we have entangled states. The consequence of this is that after measuring $|0\rangle$ for the first qubit (in the example the measurement is done for the first qubit), the state of the first qubit becomes $|\psi_1 \rangle \rightarrow |0\rangle$ (the second qubit's state will not be changed) and the combined state:

+ +

$$|\psi\rangle= |0\rangle \left(\frac{1}{\sqrt{2}}|00\rangle + \frac{1}{\sqrt{2}}|01\rangle \right) = \frac{1}{\sqrt{2}}|00\rangle + \frac{1}{\sqrt{2}}|01\rangle$$

+ +

The explanation with the projective measurements:

+ +

We should renormalize the state after the measurement (after measurement the probabilities of the state should sum to $1$). If we apply the projective measurement, we should calculate the probability of measuring $m$ outcome:

+ +

$$p(m) = \langle \psi | P_m | \psi \rangle$$

+ +

where $P_m$ is is the projector onto the eigenspace of $M$ with eigenvalue $m$, $M$ is a Hermitian operator/observable, that describes the measuremet. Then the state after the measurement outcome $m$ will be equal to:

+ +

$$\frac{P_m |\psi \rangle}{\sqrt{p_m}}$$

+ +

The division to the $\sqrt{p_m}$ is for the renormalization of the state after the action of the projector. A more rigorous definition can be found in M. Nielsen and I. Chuang's textbook page 87.

+ +

In the case of the question the observable is $M = Z\otimes I$, the projector to the $|0\rangle$ state of the first qubit is $P_{+1} = |0\rangle \langle 0| \otimes I$, the $I$ means that we are not touching the second qubit, $m$ eigenvalue is $+1$. Then the probability of measuring the first qubit $|0\rangle$:

+ +

$$p_{+1} = \langle \psi | P_{+1} | \psi \rangle = \frac{2}{3}$$

+ +

The resulting state:

+ +

$$\frac{P_{+1} |\psi \rangle}{\sqrt{p_{+1}}} = \frac{\frac{1}{\sqrt{3}}|00\rangle + \frac{1}{\sqrt{3}}|01\rangle }{\sqrt{\frac{2}{3}}} = \frac{1}{\sqrt{2}}|00\rangle + \frac{1}{\sqrt{2}}|01\rangle$$

+",9459,,9459,,5/16/2020 11:23,5/16/2020 11:23,,,,5,,,,CC BY-SA 4.0 +12042,2,,12040,5/16/2020 6:49,,2,,"

The circuit for the controlled $R_y(t)$ that is true also for $R_z$ (just change the indexes). For $R_x$, instead of $cx$ we should use $cz = I \otimes H \cdot cx \cdot I \otimes H$:

+ +

+ +

The corresponding code:

+ +
t = np.pi/2 # for the question's case
+circuit = QuantumCircuit(2)
+circuit.ry(t/2, 1)
+circuit.cx(0, 1)
+circuit.ry(-t/2, 1)
+circuit.cx(0, 1)
+
+ +

Here are the expressions for $cx$ and $R_y(t)$:

+ +

\begin{equation*} +cx = |0\rangle \langle 0| I + |1\rangle \langle 1 | X +\qquad R_y(\theta) = \cos(\theta/2)I - i \sin(\theta/2)Y +\end{equation*}

+ +

By taking into account that $XYX = -Y$ and thus $XR_y(\theta)X = R_y(-\theta)$:

+ +

$$cx \cdot I \otimes R_y(-t/2) \cdot cx = |0\rangle \langle0|R_y(-t/2) + |1\rangle \langle 1| R_y(t/2)$$

+ +

and if we multiply this with $R_y(t/2)$ from the right side we will obtain:

+ +

$$|0\rangle \langle0| I + |1\rangle \langle 1| R_y(t) = cR_y(t)$$

+ +

because $R_y(\theta_1)R_y(\theta_2) = R_y(\theta_1 + \theta_2)$.

+",9459,,9459,,5/16/2020 7:17,5/16/2020 7:17,,,,5,,,,CC BY-SA 4.0 +12043,1,,,5/16/2020 7:00,,1,578,"

I am now practising using Qiskit. The example of Grover's algorithm in tutorials suggests using logical expression, truth table or circuit to construct the oracle. In most textbooks on quantum computation as far as I have read, they use a function $f$ mapping to 0 or 1 during constructing the oracle. So I want to know if there is any beautiful way to do this with Qiskit. For instance, to find 4 in the array of (3, 4, 5, 6, 8, 2, 7, 1), how to use some $f$ like returning 1 if matched, otherwise 0, to construct the oracle? I know I can obtain a truth table 01000000, but if it's too long to compute, how to use an $f$ directly, without calculating the truth table outside the part of quantum computation?

+ +

More generally, if elements in the array to search are obtained in iterations (e.g. in one iterate, I obtain one element $x_i$, which is sum of something else like $\sum_j y_j$), should I complete these iterations before doing Grover's algorithm? Or is it feasible to embed the iterations into quantum computation so that I do not need to traversal all the iterations?

+ +

In addition, I use the tutorial from https://github.com/Qiskit/qiskit-community-tutorials/blob/master/optimization/grover.ipynb

+",12073,,55,,5/18/2020 15:31,5/20/2020 3:22,How to write decent code for oracle in Qiskit without custom circuit or long truth table?,,2,1,,,,CC BY-SA 4.0 +12044,2,,12040,5/16/2020 7:24,,1,,"

You can use gate $CU3$ directly on IBM Q and then leave the gate decomposition on transpiler.

+ +

There are relations between rotational gates and U3 gate:

+ +

$$ +Ry(\theta) = U3(\theta, 0, 0) +$$

+ +

$$ +Rx(\theta) = U3(\theta, -\pi/2, \pi/2). +$$

+",9006,,,,,5/16/2020 7:24,,,,0,,,,CC BY-SA 4.0 +12045,1,12046,,5/16/2020 10:45,,2,119,"

I'm learning how to do error mitigation on Qiskit as my experiment result differs from the simulated result. I read the tutorial here, but I have some questions about it. If I have understood it correctly, we take each basis states and measure them, to find the mitigation matrix, then execute my experiment, obtain the result, then recover the correct result using the mitigation matrix. That means I have to execute two experiment. However, how do I ensure that the qubits that I use to find the mitigation matrix is the same as the qubits that I do my actual experiment?

+ +

For example, let's say I want to execute an experiment with 3 qubits. I first run a code like the one in the tutorial. The compiler (or whatever compiles my code into instructions) uses qubit A, B and C. Then, when I execute my actual experiment, the compiler may use qubit D, E and F. As the qubits are different, then I think the mitigation will not be valid? Am I correct? if so, then how do we solve this? Obviously we have to use the same backend but I think that is achievable, but I found no way to specify which qubits to use.

+ +

Thank you in advance!

+",9153,,2293,,8/17/2020 2:53,8/17/2020 2:53,Specifying qubits to achieve measurement error mitigation on Qiskit,,1,0,,,,CC BY-SA 4.0 +12046,2,,12045,5/16/2020 11:05,,3,,"

You can achieve this by providing a seed to the transpiler which guarantees that the layout will be the same every time you run it. This can be done as follows

+ +
job = execute(my_circuit, seed_transpiler=123)
+
+ +

Alternatively, if you would like to specify the layout yourself, you can do this by providing an initial_layout to the transpiler, and then setting the optimization_level=0. There are many potential formats for the initial layout, but the easiest to understand is a dictionary of the qubits in your circuit, to the physical qubits you would like them to take, for example {qr[0] : 3, qr[1]: 2}.

+ +

Overall, your code could then look something like this

+ +
my_layout = {qr[0] : 3, qr[1]: 2}
+job = execute(my_circuit, initial_layout=my_layout, optimization_level=0)
+
+",5955,,,,,5/16/2020 11:05,,,,0,,,,CC BY-SA 4.0 +12047,1,12049,,5/16/2020 11:38,,4,881,"

Consider the following situation, we import a 3-bit Toffoli gate as follows:

+ +
from qiskit.aqua.circuits.gates.multi_control_toffoli_gate import _cccx
+
+ +

I further define a Quantum Register of size 4 and a circuit containing it:

+ +
qr = QuantumRegister(4, 'q')
+circuit = QuantumCircuit(qr)
+
+ +

I form a small circuit by applying Hadamard on the last qubit followed by _cccx:

+ +
circuit.h(3)
+circuit.barrier()
+_cccx(circuit, q)
+circuit.barrier()
+circuit.draw(output=""mpl"")
+
+ +

The output of the following code is as follows:

+ +

+ +

As we can see that the underlying logic of _cccx is shown which makes the circuit too big, is there any way to display a higher-level abstraction which would consume less space and simply conceal the underlying gate logic?

+ +

Edit: This question is not limited to $n$-bit Toffoli gate but to any circuit which may even be defined by user.

+",10376,,9006,,5/17/2020 7:03,5/17/2020 9:56,How to format a qiskit circuit to only have a high level abstraction?,,1,0,,,,CC BY-SA 4.0 +12049,2,,12047,5/16/2020 12:00,,5,,"

You should use the mcx method of the circuit instead (methods with a leading underscore are usually for internal usage and not developed for users), then you can do

+ +
from qiskit import QuantumCircuit
+circuit = QuantumCircuit(4)
+circuit.h(3)
+circuit.mcx([0, 1, 2], 3)
+circuit.draw(output='mpl')
+
+ +

Which outputs

+ +

+ +

If you decompose or transpile the circuit you'll get down to the implementation of the multi-controlled X

+ +
from qiskit import transpile
+basis_gates = ['h', 'cx', 'cu1', 'u1', 'u3']
+transpiled = transpile(circuit, basis_gates=basis_gates)
+transpiled.draw(output='mpl', filename='c3x_decomp.png')
+
+ +

to get +

+ +

General logic wrapping into Instructions

+ +

To wrap any circuit logic into an abstract block you can use the Instruction object. First you define a subcircuit and then append it onto the larger circuit as Instruction. Here's a short example:

+ +
larger = QuantumCircuit(5)
+larger.h(4)
+
+sub = QuantumCircuit(4, name='My subcircuit')
+sub.ccx(0, 1, 2)
+sub.h([0, 1, 2, 3])
+sub.crx(0.2, 3, 0)
+
+larger.append(sub.to_instruction(), [1, 2, 3, 4])
+larger.draw(output='mpl')
+
+ +

+ +

If you decompose the larger circuit you'll see the components. If you don't want to wrap it into a block you can just directly append sub to the circuit using the compose method:

+ +
composed = larger.compose(sub, qubits=[1, 2, 3, 4)
+
+",9800,,9800,,5/17/2020 9:56,5/17/2020 9:56,,,,3,,,,CC BY-SA 4.0 +12051,1,,,5/16/2020 13:57,,2,64,"

I currently have a tablet I don't have a desktop or laptop to access the IBM Quantum Experience.

+ +

Do I have to upgrade to personal computer or laptop computer in order to be able to use the website or run code locally?

+",12074,,55,,7/26/2020 18:05,7/26/2020 18:05,Do I have to upgrade to personal computer or laptop computer in order to be able to use the IBM Quantum Experience website or run code locally?,,2,0,,,,CC BY-SA 4.0 +12052,2,,12051,5/16/2020 14:37,,2,,"

You can run IBM Quantum Experience from any modern browser in the Tablet. In IBM Quantum Experience, you can explore basic circuits. However, you may find it difficult to use Qiskit notebooks from Tablet. You can also use Quantum Computing Playground to see how basic gates, circuits and algorithms work. Please find a list of useful Quantum Computing Simulators in this article. However, I would recommend you to use a PC or a Laptop with a minimum of 8 GB RAM to learn how to use IBM Qiskit, Google Cirq, Pyquil etc as it would help you to understand the functionalities of the Quantum Gates and Circuits better.

+",4501,,5955,,5/16/2020 15:13,5/16/2020 15:13,,,,0,,,,CC BY-SA 4.0 +12053,2,,12009,5/16/2020 17:39,,0,,"

$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$

+ +

Let $\ket{GHZ}$ be a GHZ state with $n$ qubits. +So thanks to Norbert's answer I found the following separable pure states that maximize the trace distance: +$$ +\ket\psi=\frac1{2^{n/2}}\otimes_{k=1}^n(\ket0 +\exp{\left(i\pi f(k)\right)} \ket1), +$$ +with $\sum_{k=1}^n f(k)=1$. By that we get the coefficient of $\ket{00\cdots 0}$ to be $1$ and the one of $\ket{11\cdots 1}$ to be $-1$. Therefore $\bk\psi{GHZ}=0$ holds. They all have trace distance: +$$ +\frac12\sum |\lambda_i|=1, +$$ +where $\lambda_i$ are the eigenvalues of $\left(\ket{GHZ}\bra{GHZ}-\ket\psi\bra\psi\right)$. Both states share the same permutation symmetry if $f(k)=1/n$...

+",5280,,5280,,5/16/2020 18:29,5/16/2020 18:29,,,,1,,,,CC BY-SA 4.0 +12054,2,,12040,5/16/2020 18:15,,1,,"

If you don't know the decomposition for this kind of thing you can just program it at a high level in Qiskit and then rely on the compiler to decompose it.

+ +

For this you can do two things. Either start with an RYGate(pi/2) then control it; or start with a YGate(), raise it to power 1/2, then control it.

+ +

(Note the answer from these two approaches will differ by a relative phase, as YGate and RYGate(pi) have a global phase difference in their matrix definitions in Qiskit).

+ +

For the first approach, here's the code:

+ +
import numpy as np
+import qiskit as qk
+from qiskit.circuit.library import RYGate
+
+circ = qk.QuantumCircuit(2)
+
+circ.append(RYGate(np.pi/2).control(), [0, 1])
+
+print('before...')
+print(circ.draw())
+
+new_circ = qk.transpile(circ, basis_gates=['u3', 'cx'], optimization_level=3)
+
+print('after...')
+print(new_circ_1.draw(fold=100))
+
+ +
before...
+
+q_0: ─────■──────
+     ┌────┴─────┐
+q_1: ┤ RY(pi/2) ├
+     └──────────┘
+after...
+
+q_0: ──────────────────■─────────────────────■──────────────────────
+     ┌──────────────┐┌─┴─┐┌───────────────┐┌─┴─┐┌──────────────────┐
+q_1: ┤ U3(0,0,pi/2) ├┤ X ├┤ U3(-pi/4,0,0) ├┤ X ├┤ U3(pi/4,-pi/2,0) ├
+     └──────────────┘└───┘└───────────────┘└───┘└──────────────────┘
+
+",2503,,,,,5/16/2020 18:15,,,,0,,,,CC BY-SA 4.0 +12055,2,,12043,5/16/2020 18:35,,0,,"

The oracle of Grover's algorithm can be written as a phase oracle: for one computational basis state, induce a -1 phase, and do nothing for the other basis states. In Qiskit you can use a Diagonal operator for this.

+ +

In your example you are searching for the decimal 4 in 8 possibilities. You need 3 qubits for this problem, and the answer to search for would be 100 (little endian convention).

+ +
from qiskit.circuit.library import Diagonal
+from qiskit.quantum_info import Statevector
+
+mark_state = Statevector.from_label('100')
+mark_circuit = Diagonal((-1)**mark_state.data)  # circuit that induces a -1 phase on the mark_state
+
+ +

You can see a complete Grover example in Qiskit with this approach here: +https://github.com/ajavadia/qiskit-terra/blob/Demo/demo/Grover%20Interactive.ipynb

+",2503,,,,,5/16/2020 18:35,,,,1,,,,CC BY-SA 4.0 +12056,2,,12038,5/16/2020 18:40,,5,,"

For any problem which is described by an infinite dimensional Hilbert space, you can regard any state as a superposition of an infinite number of states. The only real question is thus whether infinite-dimensional Hilbert space are ""used in practice"".

+",491,,,,,5/16/2020 18:40,,,,2,,,,CC BY-SA 4.0 +12057,1,,,5/16/2020 18:59,,1,115,"

I'm new to the IBM Q Experience. In the Composer, I built a circuit consisting of two Hadamard Gates and an Ry:

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+qreg q[5];
+creg c[5];
+
+h q[0];
+h q[0];
+ry(pi/2) q[0];
+measure q[0] -> c[0];
+
+ +

The results returned are 50/50 probability. However, when I apply the matrices in a spreadsheet, I get a $\frac{28}{72}$ result. (See image below.) For the Hadamard matrices, I'm using one divided by the square root of two for the corresponding a, b, and c elements and minus one divided by the square root of two for the d element. For the Ry matrix elements a,b c, and d, I have $\cos\big(\frac{pi/2}{2}\big)$, $-\sin\big(\frac{pi/2}{2}\big)$, $\sin\big(\frac{pi/2}{2}\big)$ and $\cos\big(\frac{pi/2}{2}\big)$, where $\pi=180^{\text{o}}$. The output squared in the spreadsheet gives me 28/72 probability. I hate to be a pest with such a low level question, but where in the matrices am I going wrong?

+ +

For $\pi$ I used 3.14 instead of 180 degrees, and it came out 50/50.

+ +

+",12075,,9006,,5/17/2020 7:13,5/17/2020 11:30,Hadamard + Hadamard + Ry: Results in the IBM Q Experience don't match the matrix results,,2,0,,,,CC BY-SA 4.0 +12058,2,,12057,5/16/2020 19:59,,4,,"

Here are the gates:

+ +

\begin{equation} +H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\1&-1 \end{pmatrix} +\qquad +R_y(\theta) = \begin{pmatrix} \cos(\theta/2) & -\sin(\theta/2) \\\sin(\theta/2) & \cos(\theta/2) \end{pmatrix} +\end{equation}

+ +

Matrix multiplication (note that $HH = I$):

+ +

$$U = R_y(\pi/2) H H = R_y(\pi/2) = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & -1 \\ 1 & 1 \end{pmatrix}$$

+ +

If we will apply this $U$ to the $|0\rangle$ state, we will obtain:

+ +

$$U |0\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & -1 \\ 1 & 1 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix} = \frac{1}{\sqrt{2}} (|0\rangle + |1\rangle)$$

+ +

So with $50\%$ probability we will measure $|0\rangle$ (or $|1\rangle$) state.

+",9459,,,,,5/16/2020 19:59,,,,1,,,,CC BY-SA 4.0 +12059,2,,12057,5/17/2020 3:34,,2,,"
+

For pi I used 3.14 instead of 180 degrees, and it came out 50/50.

+
+ +

Sounds like you answered your own question. Sine and cosine functions would be expecting radians by default, so using $\pi=3.14 \cdots$ is correct.

+",10473,,10473,,5/17/2020 11:30,5/17/2020 11:30,,,,1,,,,CC BY-SA 4.0 +12060,2,,5263,5/17/2020 5:55,,2,,"

Quantum key distribution (QKD) is a secure communication method that enables two parties to produce a shared random secret key known only to them, which can then be used to encrypt and decrypt messages. Quantum key distribution is only used to produce and distribute a key, not to transmit any message data. The algorithm most commonly associated with QKD is the one-time pad, as it is provably secure when used with a secret, random key. QKD is more of a communication architecture than a cryptographic protocol.

+ +

Quantum Key Exchange (QKE) on the other hand is a cryptographic concept originally explored by Donald Beaver. There is a seminal paper of the deniability of QKE published in 2002 itself. There are a few variants of QKE like authenticated QKE, Entanglement Distillation QKE etc. Please refer to this recent paper on QKE with reference to the aspects of covert communication and entanglement distillation.

+ +

There are some clear distinctions between QKD and QKE such as the following.

+ +
    +
  • QKD usually relies on having an authenticated classical channel of communications whereas QKE is a collection of cryptographic properties of Quantum Information with a focus on the Quantum Computational Complexity theory
  • +
  • QKD uses classical encryption schemes such as one-time-pads whereas QKE does not employ any classical cryptographic devices and schemes.
  • +
+",4501,,,,,5/17/2020 5:55,,,,0,,,,CC BY-SA 4.0 +12061,2,,12051,5/17/2020 7:09,,1,,"

IBM Quantum Experience is web-based (or rather cloud-based) service, so all classical computation (i.e. circuit transpiling, simulations, showing state vectors etc.) are done on IBM servers. Your web browser serves as a viewer only. Hence you can use table or smartphone. Convenience of using is another question but it is up to you.

+ +

To run quantum computer simulation locally (for example in Python, MatLab etc.) you would need classical desktop (or laptop) because with incressing number of qubits, processing time and memory space generally increase exponentially (with exception to circuits composed only of Clifford gate - i.e. $H$, $S$ and $CNOT$ which can be simulated efficiently on classical computers).

+",9006,,,,,5/17/2020 7:09,,,,0,,,,CC BY-SA 4.0 +12062,2,,5053,5/17/2020 7:49,,2,,"

It is relevant to consider the following research paper from Mashiko Fukiyama on Nim Game on Graph to come up with an algorithmic approach . At first, to set a starting position of the game, we fix some finite undirected graph and assign to each edge a non-negative integer. Further we take one piece and put it at a vertex of the graph. From this given position, the game starts and proceeds by the two players’ alternate moves with the series of choices.

+ +
    +
  1. Choose an edge incident with the vertex of the piece
  2. +
  3. Decrease the value of this edge to any strictly smaller non-negative integer.
  4. +
  5. Move the piece to the adjacent vertex along this edge.
  6. +
+ +

The game ends when a player in his turn cannot move since the value of each edgeincident with the piece’s vertex is equal to zero. Then, according to the normal play convention, this player is taken as the loser.

+ +

This approach outlines scenarios when any graph of the game forms a bipartite graph without multiple edges except in a few conditions. Following MathOverflow discussion also explores the strategies when a Nim game is modelled on a bipartite graph. Two players are playing a game on a bipartite graph where all of the edges are nim-heaps of various sizes. A token starts on one of the vertices, and on your turn you must move the token over an edge and pick up some of the matchsticks in the nim heap corresponding to that edge. If all of the edges meeting the vertex containing the vertex are empty when you start your turn, you lose.

+ +

At this juncture, it is worth noting that bipartite graphs have recently been used in quantum information theory, e.g. for obtaining graph states to describe entanglement and for obtaining quantum walks for quantum search programs as outlined in the following paper on the Graph Approach to Quantum Systems. In addition a bipartite graph approach is also considered useful to model span programs, quantum walks, and quantum search. There are also other models of quantum information fields by means of hyper-graphs and lattices.

+ +

A bipartite entanglement of the states constructed from the algebra of a finite group with a bi-local representation acting on a separable reference state has been studied recently. If G is a group of spin flips acting on a set of qubits, these states are locally equivalent to bipartite (two-colorable) graph states and they include GHZ, CSS, cluster states, etc. Equivalence of CSS states (of which GHZ states are a special case) and bipartite graph states has been proved recently. The graph states form class of multipartite entangled states associated with combinatorial graphs which helps us to integrate a bipartite graph based quantum combinatorial game theoretical approach to Nim game.

+ +

Thus we can devise a quantum combinatorial game to implement Nim game on graph using the algorithms outlined in this research paper on Dynamic Programming based Quantum Graph Partitioning. It is an approach to convert a quantum circuit into a bipartite graph model, and then using a dynamic programming approach (DP) to partition the model into low-capacity quantum circuits. This dynamic programming based partitioning approach helps to minimise the connection between the parts in the circuit. In the algorithm to convert the quantum circuit into the graph, Qubits are in one part of bipartite graph G and gates are in other parts.

+ +

This approach is quite suited from a quantum game theoretic perspective where we superpose and entangle initial states. As explained earlier bipartite graph states would help us to initialise the quantum combinatorial game states. The following research paper on Oscillatory localisation of Quantum Walks can help also us in realising quantum combinatorial games. Oscillatory localisation produces a discrete- time quantum walk with Grover’s diffusion coin jumping back and forth between two vertices.

+",4501,,,,,5/17/2020 7:49,,,,0,,,,CC BY-SA 4.0 +12064,2,,7098,5/18/2020 5:26,,1,,"

The above answer did not work for me. This worked for me.

+ +
IBMQ.delete_account()
+
+ +

By deleting account, you should not be having any active accounts from IBMQ api. check that by getting active accounts

+ +
IBMQ.active_account()
+
+ +

After which generate a new token in your IBMQ experience website, https://quantum-computing.ibm.com/account

+ +

And then copy the new token, save that as a variable (I saved it into API_KEY), then save account in IBMQ

+ +
IBMQ.save_account(API_KEY, overwrite=True)
+
+",7344,,,,,5/18/2020 5:26,,,,0,,,,CC BY-SA 4.0 +12066,1,,,5/18/2020 14:56,,2,206,"

I'm running VQE algorithm on ibmq-qasm-simulator.
+I'm trying to implement a restart mechanism in order to be able to start a new computation from the result of a previous one.

+ +

To do so I've tried to set VQE' s initial_point parameter to result['optimal_point'], where result is the return value of vqe.run(quinstance) of the previous computation.

+The code has worked for a very small graph (4 nodes, 4 edges), anyway it continues to fail for little bigger graphs (5 and 6 nodes). It doesn't converge to a minimum energy state but continues to oscillate.

+Is this the correct way to implement a restart?
+Thanks

+",11981,,,,,6/17/2020 16:40,VQE restart from a previous computation,,1,5,,,,CC BY-SA 4.0 +12067,1,,,5/18/2020 15:58,,3,157,"

I am trying to create a unitary operator $U = \sum^{T - 1}_{k=0}$ $|k\rangle$ $\langle k |$ $ \otimes$ $e^{i A k}$ in Q#, where A is a Hermitian matrix. For the beginning, I just want A to be a combination of 2 Pauli matrices, say $A = X + 2Z$. This is the code that I have, where input is of type Qubit[3] and register of Qubit[2]:

+ +
   ...
+   let SIZE_OF_MATRIX = 2; 
+   let unitaryGenerator = (2 ^ SIZE_OF_MATRIX, ConstructU);
+   let registerLE = LittleEndian(register);
+
+   MultiplexOperationsFromGenerator(unitaryGenerator, registerLE, input);
+   ...
+
+function ConstructU (j : Int) : (Qubit[] => Unit is Adj + Ctl) {
+    let generatorSystem = GeneratorSystem(2, MapToGeneratorIndex);
+
+    let evolutionGenerator = EvolutionGenerator(PauliEvolutionSet(), generatorSystem);
+
+    let unitaryOperator = TrotterStep(evolutionGenerator, 1, - IntAsDouble(j));
+
+    return unitaryOperator;
+}
+
+// The purpose of this function is to map each part of the Hamiltonian generator
+// to a generator index.
+// Initially, we want to test the matrix A = X + 2Z.
+function MapToGeneratorIndex (index : Int) : GeneratorIndex {
+    // We only have 2 terms, hence index can only be 0 or 1
+
+    if (index == 0) {
+        // Here we just want X
+        return GeneratorIndex(([1], [1.0]), [0]);
+    }
+
+    elif (index == 1) {
+        // Here we want 2Z
+        return GeneratorIndex(([3], [2.0]), [0]);
+    }
+
+    // TODO: throw an error
+    return GeneratorIndex( ([1000], [1000.0]), [0]);
+}
+
+ +

Does anyone know what am I doing incorrectly? I am not getting the result that I am expecting. +I know the code is messy but I am just trying to make it work for a basic 2x2 matrix first.

+ +

Thanks for the help!

+",11979,,11979,,5/22/2020 10:36,5/27/2020 0:20,Creating Hamiltonian Simulation Operator in Q#,,1,4,,,,CC BY-SA 4.0 +12068,1,,,5/18/2020 19:17,,2,781,"

I would like to use the built-in Qiskit VQE() function, with my own variational form. What is the proper way to define it? I was expecting var_form to be simply a function returning an object of type QuantumCircuit for a particular set of parameters (that's how it's done in Pyquil).

+ +

More precisely: how do I manually create an instance of the VariationalForm class which would correspond to preparing the desired program for a given set of parameters?

+ +

So far my understanding is that I have to do smth like that:

+ +
 class my_var_form(VariationalForm):
+    def construct_circuit(self,
+                          parameters: Union[List[float], np.ndarray],
+                          q: Optional[QuantumRegister] = None) -> NoReturn:
+        circuit = QuantumCircuit(q)
+        ...
+        return circuit
+
+ +

Is this the proper way to do things?

+ +

CLARIFICATION

+ +

Let us define a function which would generate a Qiskit circuit for an arbitrary parameter of type float:

+ +
def black_box( param : float ):
+    qc = qskt.QuantumCircuit( 1 )
+    qc.u1( np.sqrt( param ), 0 )
+    return qc
+
+ +

np.sqrt() was chosen as a toy example, one could equally well replace it with any fucntion defined on floats. To make sure that the function makes sense, one can do this:

+ +
job = execute( black_box( 1. ), get_backend('qasm_simulator') ) # Works fine
+
+ +

Now, let us try to define a VariationalForm which will use our black_box function:

+ +
class my_var_form( VariationalForm ):
+    def __init__(self, numpar, numq, bnds) -> None:
+        super().__init__()
+        self._num_parameters = numpar
+        self._num_qubits = numq
+        self._bounds = bnds
+        pass
+    def construct_circuit(self,
+                          parameters: Union[List[float], np.ndarray],
+                          q: Optional[qskt.QuantumRegister] = None) -> NoReturn:
+    circuit = black_box( parameters[0] )
+    return circuit
+
+ +

However, the following code fails to work:

+ +
var_form_instance = my_var_form( 1, 1, [[-2., 2]] )
+vqe = VQE( WeightedPauliOperator( [1., Pauli([0.],[0.])] ),
+           var_form_instance,
+           L_BFGS_B(),
+           np.array([0])
+         )
+
+ +

With the following error:

+ +
TypeError: loop of ufunc does not support argument 0 of type Parameter which has no callable sqrt method
+
+ +

The problem is that Qiskit no matter what wants to use its built-in Parameter class which is based on the sympy package.

+ +

How can I overcome this issue? Or is there absolutely no way I could use the built-in VQE function without dealing with Parameter class?

+ +

My question arises from the fact that I use an external library to generate circuits which I then convert to Qiskit format. Thus, I have a function which returns a Qiskit circuit for a set of real parameters. I would like the Qiskit VQE() function to use my own black_box() function for generating the quantum circuit on each step of the minimization.

+ +

(Alternatively, I could just not use VQE() at all, and simply run the classical minimizer myself, only using Qiskit for evaluating the expectation value of the Hamiltonian on each step... but apparently there's no built-in function for calculating the expectation value neither of a Pauli string, nor even of individual Pauli operators! See my question here: to my understanding SnapshotExpectationValue() is an unphysical method, and does not allow one to calculate expectation values of Pauli strings using sampling on real devices.)

+",6313,,6313,,5/23/2020 4:14,9/18/2020 10:55,Creating a custom VariationalForm in Qiskit,,3,1,,,,CC BY-SA 4.0 +12069,2,,12068,5/18/2020 19:43,,5,,"

You can plug any parameterized QuantumCircuit into the VQE. +Parameterized means it contains Parameter objects e.g. as rotation angles. For instance

+ +
from qiskit.circuit import QuantumCircuit, ParameterVector
+from qiskit.aqua.algorithms import VQE
+
+params = ParameterVector(3)
+wavefunction = QuantumCircuit(3)
+wavefunction.ry(params[0], 0)
+wavefunction.ry(params[1], 1)
+wavefunction.ry(params[2], 2)
+
+vqe = VQE(var_form=wavefunction, ...)
+
+ +

I'd suggest you to have a look at the circuit library, especially the N-local circuits as e.g. the TwoLocal circuit.

+ +

This notebook explains this in more detail and shows some of the new functionality of Qiskit 0.19.0 concerning the circuit library and how it interacts with Aqua.

+",9800,,,,,5/18/2020 19:43,,,,9,,,,CC BY-SA 4.0 +12070,1,,,5/18/2020 21:35,,1,88,"

I'm running an experiment first on qasm_simulator backend from Aer provider and the most frequent result is the correct one with the minimal energy value. Then I'm running the same experiment with the same configuration and parameter set on ibmq_qasm_simulator backend from IBMQ provider and got different results (don't reach minimal energy value). What is the reason for this behavior?

+",10234,,,,,5/18/2020 21:35,ibmq_qasm_simulator from IBMQ provider and qasm_simulator from Aer provider gives different results,,0,4,,,,CC BY-SA 4.0 +12071,1,,,5/18/2020 23:39,,0,44,"

We consider  a quantum circuit that takes as input two vectors $\vert x \rangle$  and $\vert y \rangle$. The output of this quantum circuit must contain the reflected vector of   $\vert y \rangle$  with respect to  $\vert x \rangle$  (and whatever else that is irrelevant to the purpose ). +It can be proved that this operator is nonlinear in the first argument, and in general is not unitary.  So no chances of implementing this operator with a quantum circuit, in complete generality.

+ +

However, In the reference linked in my question Programmable quantum gate arrays it is proved that a deterministic programmable gate array must have as many Hilbert dimensions in the program register as programs are implemented (consequence of the orthogonality requirement of the program states). If each program is given as input on n qubits, then n programs would require the array to have $n^2$ qubits in the program register, but in principle possible. In our case $\vert x \rangle$ is the program, the reflection axis. So we can implement all the operators $U_{\xi_k}$ described below  for $k=1.2.3......n$

+ +

And that means that these operators allow an implementation (with one quantum circuit with $n^2$  input ""program"" qubits ) as long as the program states are orthogonal (as explained above ). 

+ +

And that means that the Grover-Sysoev algorithm can be implemented. This consists in the following $n$ steps: +$$|\xi_1\rangle = U_s U_\omega |s\rangle, +\quad +\vert \xi_2 \rangle = U_{\xi_1} U_\omega \vert s \rangle, +\quad +\cdots +\quad +\vert \xi_n \rangle = U_{\xi_{n-1}} U_\omega \vert s \rangle, +$$ +where $U_\omega\equiv I - 2  (\vert\omega\rangle\langle\omega \vert )$ +and +$U_s \equiv 2\vert s \rangle \langle s \vert - I$.

+ +

This algorithm finds a solution exponentially faster than Grover's. In other words, for a fixed large $n$ we can actually build this complex quantum circuit that would solve problems of practical interest efficiently.

+ +

The difference between this and the original Grover algorithm is that we perform an inversion about the previous state vector of the algorithm, rather than about the mean, at each step.

+ +

Note that the optimality proof in Grover 's original paper doesn't include operators with ""program""  registers as input. 

+ +

Question  1. Is this algorithm  possible to implement,  in principle?

+ +

Question 2. Is this algorithm exponentially faster that Grover, for a fixed, chosen n?

+ +

The way ""exponentially faster"" is defined implies considering arbitrarily large values of n, but the meaning of this question is clear from the context.

+ +

My calculations indicate that both questions allow ""yes"" answers, but I could be wrong.

+ +

Another related question I asked previously can be found here.

+",10110,,55,,5/19/2020 23:59,5/19/2020 23:59,Question about the Grover-Sysoev algorithm,,0,17,,5/20/2020 7:47,,CC BY-SA 4.0 +12072,2,,12016,5/19/2020 2:25,,1,,"

$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$If you could encode an arbitrary amount of bits into a single qubit, and then retrieve those bits, then yes, quantum teleportation would allow you to send a fully-accurate message 25% of the time, which is better than random chance, and would count as faster than light communication.

+ +

However, although you can encode an arbitrary amount of information into the state of a single qubit, due to Holevo's theorem, you can only ever get a single bit of classical information out.

+ +

Even imperfect cloning does not allow you to get around this, as commenters have mentioned, as the imperfect clones are entangled and thus measurement of one collapses them all, limiting the amount of useful information one can retrieve. This is stated in the paper ""Quantum copying: Beyond the no-cloning theorem"". In fact, even Quantum Computation and Quantum Information makes the following strong and damning statements (emphasis added) ""only if infinitely many identically prepared qubits were measured would one be able to determine $\alpha$ and $\beta$."" and ""the laws of quantum mechanics prevent [one] from determining the state when [one] only has a single copy of $\ket{\psi}$.""

+ +

Therefore, Holevo's theorem does prevent your single-qubit-with-arbitrary-encoded-information scheme from allowing faster than light communication. And, since due to Holevo's theorem you can only get one classical bit out of one qubit, that means that in order to send an $n$ bit message, you must send $n$ qubits. Since these qubits each have a 25% chance to be in a particular bell state, and they do not necessarily agree on the bell state, that means that only 25% of your bits will be correct, and you don't know which ones. As other answers have pointed out, this is worse than random chance and thus can't be considered communication.

+",11742,,,,,5/19/2020 2:25,,,,0,,,,CC BY-SA 4.0 +12073,1,12074,,5/19/2020 8:41,,1,116,"

I'm working with a program, which needs iterations of quantum computation like this

+ + + +
def quantum(n):
+    Grover(oracle).run(QuantumInstance(...))
+    #n is input size associated with oracle, 
+    #and some other components are omitted.
+
+for n in range(0,10):
+    start = time.time()
+    quantum(n)
+    end = time.time()
+
+ +

Now I have to wait for hours to run this on the 16-qubit quantum computer. So is there any way to pack all computation into one round?

+",12073,,12073,,5/19/2020 10:10,5/19/2020 10:10,How to reduce unnecessary waiting time when using IBM's backend?,,1,0,,,,CC BY-SA 4.0 +12074,2,,12073,5/19/2020 10:03,,2,,"

Assuming your quantum() method creates a circuit, you can run lots of circuits in one go by using the execute command. For example execute([grover_1, grover_2, grover_3], backed=my_backend).

+",5955,,,,,5/19/2020 10:03,,,,5,,,,CC BY-SA 4.0 +12075,1,12079,,5/19/2020 10:20,,5,244,"

Consider two quantum systems A and B, B goes through a depolarizing noise channel, while A is not changed, i.e., they go through the channel $\mathbb{I}_A \otimes \mathcal{E_{\text{depol}}} $. If the input is a density operator $\rho_{AB}$, is it correct that the output is $p \rho_A \otimes \mathbb{I}/2 + (1-p) \rho_{AB}$? How can this be generalized? +Thanks in advance!

+",12047,,55,,8/27/2020 12:55,8/27/2020 12:55,How to compute the tensor product of the depolarizing channel with the identity?,,1,2,,,,CC BY-SA 4.0 +12076,1,12081,,5/19/2020 10:45,,0,202,"

I'm trying to do error mitigation in IBM-Q quantum computers with qiskit. I followed the tutorial here. My thought was that in order to make sure that I'm correcting the qubits that I'm actually using in my circuits, I should specify the backend and qubits to make sure that the qubits used in my actual circuit and obtaining the correcting matrix are the same. I asked this question and followed along, but I have encountered some problems. Here is the part that is causing problem:

+ +
    qreg = qk.QuantumRegister(7)
+    layout = {qreg[0]: 12, 
+              qreg[1]: 11,
+              qreg[2]: 13, 
+              qreg[3]: 17, 
+              qreg[4]: 14, 
+              qreg[5]: 12, 
+              qreg[6]: 6}
+
+
+    ########## error mitigation ##########
+
+    meas_calibs, state_labels = complete_meas_cal(
+            qubit_list=[0, 1, 2], qr=qreg, circlabel='mcal') 
+    print(meas_calibs[0])
+
+    # This line below is causing error if I add ""initial_layout"" in both qk.compiler.transpile and qk.execute
+    qk.compiler.transpile(meas_calibs, backend=_backend, initial_layout=layout)
+
+ +

I receive the error

+ +
qiskit.dagcircuit.exceptions.DAGCircuitError: 'not a DAG' 
+
+ +

whenever I specify the layout. I googled about this error but found nothing. So my question is, what does this error mean? What have I done wrong and how can I fix it?

+ +

Thank you in advance.

+",9153,,2293,,8/17/2020 2:53,8/17/2020 2:53,Real-device error mitigation with qiskit,,1,0,,,,CC BY-SA 4.0 +12077,1,,,5/19/2020 10:50,,1,72,"

In Cleve et al.'s paper ""How to share a quantum secret"", two encodings of quantum states are mentioned. The first one encodes one qutrit into three qutrits,

+ +

$\alpha|0\rangle + \beta|1\rangle + \gamma|2\rangle \mapsto \\ \alpha(|000\rangle + |111\rangle + |222\rangle) \\ + \beta(|012\rangle + |120\rangle + |201\rangle) \\ + \gamma(|021\rangle + |102\rangle + |210\rangle).$

+ +

The second encoding is in fact a quantum error-correcting code and encodes one qubit into four qubits,

+ +

$\alpha|0\rangle + \beta|1\rangle \mapsto +\alpha(|0000\rangle + |1111\rangle) + \beta(|0011\rangle + |1100\rangle)$.

+ +

Such succinct ways of encoding pure quantum states can often be found in the literature of quantum error correction. I am wondering how the above encodings can be implemented unitarily and if there are any general results that these brief descriptions draw on that I am missing here.

+",11977,,11977,,5/19/2020 12:50,6/18/2020 15:01,How does the unitary encoding procedure in quantum secret sharing schemes or error correcting codes work?,,1,0,,,,CC BY-SA 4.0 +12078,1,12169,,5/19/2020 11:38,,4,254,"

Quantum simulation (also referred to as Hamiltonian simulation) is defined as follows:

+ +
+

In the Hamiltonian simulation problem, given a Hamiltonian $H$ ($2^n \times 2^n$ hermitian matrix acting on $n$ qubits), a time $t$ and maximum simulation error $\epsilon$, the goal is to find an algorithm that approximates $U$ such that $||U - e^{-iHt}|| \leq \epsilon$, where $e^{-iHt}$ is the ideal evolution and $||\cdot||$ is the spectral norm.

+
+ +

One of possible applications of quantum simulation is of course simulation of quantum systems, but I'm sure, that there are many others possible. I've read about some possible approaches to this problem (like Trotterization), but I haven't come accros any practical solutions obtained thanks to these methods (probably because of my laziness :) ).

+ +

My question is - what is preventing us from solving real world problems, defined in terms of Hamiltonian simulation, on currently available quantum computers? Is this just the number of qubits available? Or maybe, it would be at least theoretically possible to create some hybrid solutions, by inventing new algorithms operating on currently available architectures, to get some results that are beyond the reach of classical algorithms?

+",2098,,,,,5/25/2020 12:26,What are the biggest obstacles currently preventing us from solving real world problems defined in terms of quantum simulation?,,1,1,,,,CC BY-SA 4.0 +12079,2,,12075,5/19/2020 11:56,,4,,"

Let $\Phi_{dp}$ denote the fully depolarising channel: $\Phi_{dp}(\rho)=\operatorname{Tr}(\rho) I/d$ with $d$ the dimension of the space.

+ +

The depolarising channel $\mathcal E_{depol}$ in the OP can be written as $\mathcal E_{depol}=(1-p) \operatorname{Id} + p \Phi_{dp}$ with $\operatorname{Id}$ the identity channel. It follows that +$$\operatorname{Id}\otimes \mathcal E_{depol} = (1-p) \operatorname{Id}\otimes \operatorname{Id} + p \operatorname{Id}\otimes \Phi_{dp}.$$ +The only thing that might appear nontrivial is how the second term acts on states. +There are several ways to compute this. For example:

+ +

$$(\operatorname{Id}\otimes\Phi_{dp} )\rho += \sum_{ijk\ell} \rho_{ijk\ell} (\operatorname{Id}\otimes\Phi_{dp} ) (|ij\rangle\!\langle k\ell|) += \sum_{ijk\ell} \rho_{ijk\ell} |i\rangle\!\langle k|\otimes \underbrace{\Phi_{dp} (|j\rangle\!\langle\ell|)}_{=\delta_{j\ell}/d} \\ += \sum_{ijk} \rho_{ijkj} |i\rangle\!\langle k|\otimes I / d +\equiv \operatorname{Tr}_B(\rho) \otimes I/d, +\equiv \rho_A\otimes I/d. +$$

+ +

Similar calculations can be performed in different representations of the map (natural, Choi, etc) with analogous results.

+ +

Working out tensor products of more depolarising channels is analogous.

+ +

TL;DR: Yes, that's correct.

+",55,,55,,6/5/2020 9:47,6/5/2020 9:47,,,,0,,,,CC BY-SA 4.0 +12080,1,12210,,5/19/2020 12:04,,12,5182,"

I'm wondering how in Qiskit one can calculate the expectation value of an operator given as a WeightedPauli (or, at least, of a single Pauli operator...) in a certain state (given as a QuantumCircuit object ⁠— meaning that the actual state is the result of the action of this circuit on the computational basis state). I would like the inputs of such a procedure to be floats, not Parameters (it is an essential requirement — I'm using an external library to form the circuit for each set of parameters, and then converting it gate-by-gate to Qiskit format).

+ +

This would be useful if, say, we wanted to manually implement VQE, and for that needed a function calculating the expectation value of the Hamiltonian on a quantum computer. More importantly, we would need this for implementing generalizations of VQE, such as subspace search.

+ +

I guess, PauliBasisChange may be involved...

+",6313,,6313,,5/23/2020 6:34,10/14/2021 12:36,Evaluating expectation values of operators in Qiskit,,1,3,,,,CC BY-SA 4.0 +12081,2,,12076,5/19/2020 12:38,,1,,"

You have assigned 2 virtual qubits to the same physical qubit, both qreg[0] and qreg[5] are assigned to physical qubit 12. If you change one of these to be a different physical qubit, it should work.

+",5955,,,,,5/19/2020 12:38,,,,2,,,,CC BY-SA 4.0 +12082,2,,12077,5/19/2020 14:19,,2,,"

Let's say you're given a transformation +$$ +\sum_i\alpha_i|\psi_i\rangle\mapsto\sum_i\alpha_i|\phi_i\rangle +$$ +where $\langle\psi_i|\psi_j\rangle=\langle\phi_i|\phi_j\rangle=\delta_{ij}$. What this really means is that you want a unitary $U$ that transforms +$$ +U|\psi_i\rangle=|\phi_i\rangle +$$ +for all $i$.

+ +

Now, in the cases you give, the Hilbert space dimensions don't match, so that's a problem. We get around this by introducing ancillas. Basically, we introduce extra quantum systems, in a known state (usually denoted $|0\rangle$) to make up the Hilbert space to the correct dimension. So, perhaps we really mean +$$ +U|\psi_i\rangle|00\rangle=|\phi_i\rangle, +$$ +for example.

+ +

Now, this set of conditions basically means that you can fill out several columns of the unitary matrix. Then, you are completely free to fill out the remaining columns however you want so long as the matrix at the end is unitary. Basically, that just means making every column length 1, and making it orthogonal to all other columns. That freedom of choice is typically helpful in making the circuit corresponding to the unitary as simple as possible. However, for the sorts of results you're talking about, they're not really worried about finding good circuits, they just need to know that a circuit exists (which is does due to universality results, provided you can write the matrix down, which you always can). Since it's a unitary of a finite size, the circuit to create it is never going to be too bad.

+ +

For example, if you're looking at the transformation $\alpha|0\rangle+\beta|1\rangle\mapsto \alpha|00\rangle+\beta|11\rangle$, we know that +$$ +U|00\rangle=|00\rangle,\qquad U|10\rangle=|11\rangle. +$$ +This tells us certain parts of the unitary: +$$ +U=\left[\begin{array}{cccc} +1 & ? & 0 & ? \\ +0 & ? & 0 & ? \\ +0 & ? & 0 & ? \\ +0 & ? & 1 & ?\end{array} +\right]. +$$ +Orthogonality of the two remaining columns means we can fill in a bit more +$$ +U=\left[\begin{array}{cccc} +1 & 0 & 0 & 0 \\ +0 & ? & 0 & ? \\ +0 & ? & 0 & ? \\ +0 & 0 & 1 & 0\end{array} +\right]. +$$ +The remaining $2\times 2$ submatrix can be any $2\times 2$ unitary that you want, but the choice +$$ +U=\left[\begin{array}{cccc} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0\end{array} +\right] +$$ +conveniently corresponds to the controlled-not gate.

+",1837,,,,,5/19/2020 14:19,,,,0,,,,CC BY-SA 4.0 +12083,1,12084,,5/19/2020 14:59,,5,333,"

Inspired by the comments in this question How to approximate $Rx$, $Ry$ and $Rz$ gates?, there is the errata for question 4.11 pg 176 in N&C. The original form states that for any non parallel $m$ and $n$, then for an arbitrary $U$:

+ +

$U = e^{i\alpha}R_n(\beta)R_m(\gamma)R_n(\delta)$, for appropriate $\alpha,\beta, \gamma, \delta$

+ +

The errata, http://www.michaelnielsen.org/qcqi/errata/errata/errata.html, corrects this s.t.

+ +

$U = e^{i\alpha}R_n(\beta_1)R_m(\gamma_1)R_n(\beta_2)R_m(\gamma_2)\dots$.

+ +

However I found that other textbooks such as Kayes and Mosca (pg. 66, thm 4.2.2), and various online material still quotes the original form of the theorem. As such I am wondering is the errata correct, and is just that all the other material has 'incorrectly' quoted the result from N&C?

+",6139,,2927,,5/19/2020 23:39,5/19/2020 23:39,Correct Formulation of N&C Exercise 4.11 and other textbooks misquoting,,1,0,,,,CC BY-SA 4.0 +12084,2,,12083,5/19/2020 15:05,,7,,"

The errata is correct. I had a project student who erroneously took one of these mis-quotes and she spent ages working with it, realising it didn't make sense, and subsequently proving that the stated formula was incorrect, only later to find the N&C erratum. As you say, it has propagated far and wide!

+ +

If you want some insight about the problem, imagine $n$ and $m$ are two axes that are almost parallel (visualise this on the Bloch sphere). Now imagine I start with a state that is aligned with the $n$ axis. With a sequence $n-m-n$, so the claim goes, I should be able to produce any state on the surface of the Bloch sphere. But the first $n$ does nothing because of what our initial state is. Then the $m$ only creates a rotation preserving the angle of the initial state with the axis, and so it's always close to where it stated. The same again with the final rotation about the $n$ axis.

+",1837,,,,,5/19/2020 15:05,,,,1,,,,CC BY-SA 4.0 +12085,1,12086,,5/19/2020 18:17,,2,477,"

+ +

I understand the simple quantum teleportation protocol and why it uses X and Z gate at the end of the circuit.

+ +

I was researching about the Qiskit and I came across this video

+ +

https://www.youtube.com/watch?v=mMwovHK2NrE

+ +

which uses the following algorithm for quantum teleportation.

+ +

I don't understand why they use CX and CZ gate with qubits $q_0$ and $q_1$ as controls and qubit $q_2$ as the target at the end.

+ +

Please try to explain why they're using CZ and CX gate at the end of the circuit.

+",11906,,2879,,5/20/2020 6:49,5/20/2020 6:49,"In Qiskit quantum teleportation protocol, why they use CZ and CX gate at the end?",,2,1,,,,CC BY-SA 4.0 +12086,2,,12085,5/19/2020 20:30,,2,,"

The top circuit uses classically controlled X and Z gates - gates that are conditioned on the measurement result.

+ +

The bottom circuit uses quantum version of controlled X and Z gates - gates that are conditioned on the state of another qubit. Since each of the control qubits have been measured before applying CX and CZ gates, their state matches exactly the measurement results: measurement result 1 (which would lead to gates applied in the top circuit) corresponds to qubit state $|1\rangle$ (which leads to gates applied in the bottom circuit).

+ +

More generally, you can do teleportation even without those two measurements in the bottom circuit, following the principle of deferred measurement.

+",2879,,,,,5/19/2020 20:30,,,,0,,,,CC BY-SA 4.0 +12087,2,,12085,5/19/2020 21:55,,0,,"

Let's say Alice is transferring her qubit to Bob. Alice measures her own qubits and tells the outcome to Bob. Depending on the measurement result of Alice, Bob applies some operations on his qubit so that he obtains exactly the same qubit intended to sent by Alice.

+ +

If Alice observes 1 in her first qubit, then Bob should apply Z and if she observes 1 in her second qubit, then Bob should apply Z. As indicated in the first picture, those are classically controlled operations, that is performed according to the measurement results written in the classical register.

+ +

You can check the following notebook for implementation and more details. +https://gitlab.com/qkitchen/basics-of-quantum-computing/-/blob/master/bronze/B56_Quantum_Teleportation.ipynb

+",7986,,,,,5/19/2020 21:55,,,,0,,,,CC BY-SA 4.0 +12089,2,,11320,5/19/2020 23:37,,6,,"

I propose the following advantages to quantum money, over and above blockchain-based cryptocurrencies.

+ +
    +
  1. The security of Nakomoto-style cryptocurrencies (read, Bitcoin) is based on computational assumptions, at least in that there is a assumption that inverting SHA256 hashes is likely computationally difficult. However, Wiesner-style private-key based quantum money is based on more information-theoretic assumptions, namely the no-cloning theorem/no signaling theorem/etc. Accepting that the no-cloning theorem is a better assumption than the difficulty of inverting hash functions may not be for everyone, but at least it's a difference.

  2. +
  3. Nakomoto-style blockchains have a famous problem in their energy usage, which appears to grow exponentially with acceptance of the cryptocurrency. But both Wiesner-style (""private-key""), and even ""public-key"" quantum money schemes such as those based on knots don't appear to have a lot of similar disadvantages in energy usage; there is no ""proof-of-work"" at play in quantum money.

  4. +
  5. Investigating schemes for quantum money may also provide schemes for digital signatures/commitment. For example, for certain public-key systems, if a scheme cannot easily be used as quantum money then it may be used for commitment. Bitcoin doesn't seem to have similar win-win opportunities.

  6. +
  7. For me, quantum money is fun to think about, and proposes some interesting problems in-and-of themselves, that are orthogonal to that of bitcoin. For example, I would like to learn more about Kane's proposal on modular forms, and Shor has recently teased quantum money based on lattices. Does anyone seriously envision quantum money with valuations/market capitalization similar to that of bitcoin ($120B), say, in the next 10 years? I doubt it, but still, fun to think about.

  8. +
+",2927,,,,,5/19/2020 23:37,,,,0,,,,CC BY-SA 4.0 +12090,1,12105,,5/20/2020 0:53,,1,192,"

I want to implement the Grover iteration instead of the multi-control qubit implemented as in this picture:

+ +

+ +

I want to implement them like in this example of five qubits: +

+ +

I mean how can I decompose them in the circuit (picture1)?

+ +

This is my attempt but I failed to get the amplitude increases for the state |1111> (after measuring the wires 1,2,3 and 6)

+ +

If you could do it in the Quirk simulator, that will be too helpful.

+",8009,,8009,,5/20/2020 20:33,5/21/2020 6:52,Question about Grover algorithm implementation in the Quirk simulator,,1,9,,,,CC BY-SA 4.0 +12091,2,,12043,5/20/2020 3:22,,1,,"

If your function is defined in a way that requires you to iterate over all possible inputs to implement the oracle, you clearly lose the advantage of using Grover's algorithm. This question goes into detail about using Grover's search for unordered database search, which is pretty much your example.

+ +

Instead, the function should be defined in a way that allows to recognize the answer much faster checking it against a table of all inputs. An excellent example of such functions are SAT problems: the number of operations you need to do to evaluate the given Boolean formula for an input depends on the size of the formula, rather than the size of the search space.

+ +

This paper discusses the practicality of using Grover's algorithm for solving various types of problems.

+",2879,,,,,5/20/2020 3:22,,,,4,,,,CC BY-SA 4.0 +12092,1,12121,,5/20/2020 6:47,,2,62,"

Current quantum processors have constrained connectivity among qubits. For example Starmon-5 processor by Quantum Inspire has only one qubit connected to others, effectively it looks like a star. The situation is similar in case of IBM Q processors (the most obvious case is 15 qubits Melbourne processor).

+ +

I understand that connectivity among qubits is constrained by used technology. In case of semiconductor processors, probably the fact that structures are planar is the biggest obstacle. To tackle this, it would be perhaps needed to have three dimensional structures. Moreover, it seems that having full connectivity would increase a noise in NISQ processors.

+ +

My question: Is there any proposal how to build a quantum processor with full connectivity?

+",9006,,,,,5/22/2020 17:37,Is it possible to build a quantum processor with connections among all qubits?,,1,0,,,,CC BY-SA 4.0 +12093,1,12100,,5/20/2020 7:30,,3,94,"

I have been reading Quantum Teleportation (Pg. 27) from Nielsen and Chuang and noticed that after the Hadamard operation, the state obtained was re-written by regrouping the terms to obtain the following states:

+ + + +
+

This state may be re-written in the following way, simply by + regrouping terms:

+ +

$$\begin{align} +|\phi_2\rangle=\frac{1}{2}\big[|00\rangle(\alpha|0\rangle+\beta|1\rangle)+|01\rangle(\alpha|1\rangle+\beta|0\rangle)\\ ++|10\rangle(\alpha|0\rangle-\beta|1\rangle)+|11\rangle(\alpha|1-\beta|0\rangle)\big]\end{align}$$

+
+ +

but I am uncomfortable by this regrouping. Mathematical regrouping doesn't mean the qubits themselves get regrouped right? Moreover, how do we know that Alice is not measuring the unknown state (state to be teleported) after she measures her part of the EPR pair?

+",9906,,27,,5/20/2020 9:46,5/20/2020 18:27,Rearrangement of qubits in Quantum Teleportation Protocol,,1,1,,,,CC BY-SA 4.0 +12094,1,12098,,5/20/2020 12:53,,0,87,"

Does anyone know how you can obtain a new state |z> from two pre-existing states |x> and |y> using the Tensor product in Q#? i.e. |z> = |x> ⊗|y> ?

+ +

Thanks in advance for the help!

+ +

Edit: for clarity, the states that I am working with are

+ +

$|x\rangle = \frac{1}{\sqrt{2}} \sum^{3}_{j=0} \sin \frac{\pi (j + 0.5)}{4} |j\rangle$

+ +

$|y\rangle = \sum^{1}_{i=0} b_i |i\rangle$

+ +

where the $b_i$'s are just real numbers.

+",11979,,9006,,5/21/2020 6:27,5/21/2020 6:27,Tensor Product in Q#,,1,3,,,,CC BY-SA 4.0 +12095,1,12097,,5/20/2020 13:52,,3,130,"

Given the the two states $\rho$ and $\sigma$ of a quantum system, with $|\psi\rangle$ and $|\varphi\rangle$ as their purification respectively, the fidelity is defined as:

+ +

$$F(\rho,\sigma)=\max_{|\psi\rangle,|\varphi\rangle}|\langle\psi|\varphi\rangle|$$

+ +

During the derivation of the expresssion, $|\langle\psi|\varphi\rangle|$ follows this inequality:

+ +

$$ |\langle\psi|\varphi\rangle|\leq tr|\sqrt{\rho}\sqrt{\sigma}|=tr\sqrt{\rho^{\frac{1}{2}}\sigma\rho^{\frac{1}{2}}}$$

+ +

My workings for $tr|\sqrt{\rho}\sqrt{\sigma}|$ is as follows:

+ +

$$tr|\sqrt{\rho}\sqrt{\sigma}|=tr\sqrt{(\sqrt{\rho}\sqrt{\sigma})^\dagger(\sqrt{\rho}\sqrt{\sigma})}$$ +$$=tr\sqrt{(\sqrt{\sigma}\sqrt{\rho})(\sqrt{\rho}\sqrt{\sigma})}$$ +$$=tr\sqrt{\sigma^{\frac{1}{2}}\rho\sigma^{\frac{1}{2}}} $$

+ +

Why do I get an expression that is different from the definition?

+",5253,,55,,5/22/2020 16:25,5/22/2020 16:25,Why does the state fidelity satisfy $\operatorname{tr}|\sqrt{\rho}\sqrt{\sigma}|=\operatorname{tr}\sqrt{\sigma^{1/2}\rho\sigma^{1/2}}$?,,1,0,,,,CC BY-SA 4.0 +12096,1,,,5/20/2020 14:05,,1,231,"

I want to execute multiple circuits in one round on IBM's backends, especially the 16-qubit one, to save time. For instance, execute([grover_1, grover_2, grover_3], backend).

+ +

However, I found result given by that quantum processor contain only one overall time like this:

+ +

{'backend_version': '2.1.0', 'backend_name': 'ibmq_16_melbourne', 'results': [{'header': ..., 'success': True, 'shots': 1024, 'meas_level': 2, 'data': {'counts': {}}, 'memory': False}],}, {'header': ..., 'success': True, 'shots': 1024, 'meas_level': 2, 'data': {'counts': {}}, 'memory': False}], 'qobj_id': ..., 'status': 'Successful completion', 'date': '...', 'header': {'backend_version': '2.1.0', 'backend_name': 'ibmq_16_melbourne'}, 'success': True, 'job_id': '...', 'execution_id': '...', 'time_taken': 7.73473865282683}

+ +

while simulators can provide time counted for each circuit in the result of one instance like:

+ +

{'date': '...', 'results': [{'shots': 1024, 'header': ..., 'data': {}, 'success': True, 'status': 'DONE', 'time_taken': 0.00136636000000000003, ...}, {'shots': 1024, 'header': ..., 'data': {}, 'success': True, 'status': 'DONE', 'time_taken': 0.00263673800000000008, ...}], 'header': {'backend_version': '0.1.547', 'backend_name': 'ibmq_qasm_simulator'}, 'backend_version': '0.4.1', 'job_id': '...', 'success': True, 'status': 'COMPLETED', 'qobj_id': '...', 'backend_name': 'ibmq_qasm_simulator', 'time_taken': 0.00438376, 'metadata': {..., 'time_taken': 0.00438376}}.

+ +

So anyone knows why and how to deal with the issue of counting time for each circuit executed on quantum processors without iteration which takes too much waiting time?

+ +

Or alternatively, how to make circuits executed in distinct instances queued sequentially, instead of queueing one after finishing the previous one, if I can only do something like:

+ + + +
for n in range(1,10):
+    start = time.time()
+    quantumAlgorithm(n)
+    end = time.time()
+
+",12073,,12073,,5/21/2020 0:44,10/21/2022 19:00,How to get running time for each circuit executed on IBM's quantum processors in one round?,,1,0,,,,CC BY-SA 4.0 +12097,2,,12095,5/20/2020 14:10,,4,,"

The expressions are equivalent:

+ +

$$ F(\rho,\sigma) =\operatorname{tr}\sqrt{\sigma^{1/2}\rho\sigma^{1/2}}= +\operatorname{tr}\sqrt{\rho^{1/2}\sigma\rho^{1/2}} \\ += \operatorname{tr}|\sqrt\rho\sqrt\sigma| = +\operatorname{tr}|\sqrt\sigma\sqrt\rho| = +\max_{\psi_\rho,\psi_\sigma}|\langle\psi_\rho|\psi_\sigma\rangle|.$$

+ +

See also this question about the symmetry of the fidelity, and the relevant Wikipedia page, as well as this question and links therein.

+",55,,,,,5/20/2020 14:10,,,,0,,,,CC BY-SA 4.0 +12098,2,,12094,5/20/2020 15:59,,1,,"

If you have an array of Qubit objects, and you prepare the individual qubits into arbitrary states, then the array effectively contains the tensor product of all of the original qubits.

+ +

To quickly illustrate what I mean:

+ +
using (qubits = Qubit[2]) {
+    // do something to prepare qubits[0] individually
+    // do something to prepare qubits[1] individually
+
+    // now the state of ""qubits"" is the tensor product of the two
+    // individual qubit states that you prepared
+}
+
+ +

This also generalizes if you're preparing groups of qubits within the array that you allocated.

+",10473,,10473,,5/20/2020 16:22,5/20/2020 16:22,,,,0,,,,CC BY-SA 4.0 +12099,1,12132,,5/20/2020 17:23,,3,59,"

I am in grade 11 and am trying to work on a project, but I find this question a little confusing. I am trying to talk about the implications of quantum teleportation, specifically quantum encryption but I have not found a good source to help me understand how they are related. Also, if you have any other cool implications of quantum teleportation please share! Thanks.

+",12044,,55,,8/27/2020 12:55,8/27/2020 12:55,How does quantum teleportation relate to quantum encryption?,,1,1,,,,CC BY-SA 4.0 +12100,2,,12093,5/20/2020 17:33,,3,,"

As @Rammus points out this is just shorthand for taking the tensor product, rather than algebraically multiplying out as you may first assume. If we take the first term of $\phi_2$ and expand it out more explicitly with subscripts $A$ for Alice and $B$ for Bob:

+ +

$|0_A0_A\rangle(\alpha|0_B\rangle + \beta|1_B\rangle) = |0_A0_A\rangle \otimes (\alpha|0_B\rangle + \beta|1_B\rangle) = (|0_A0_A\rangle \otimes \alpha|0_B\rangle) + (|0_A0_A\rangle \otimes \beta|1_B\rangle) = \alpha|0_A0_A0_B\rangle + \beta|0_A0_A1_B\rangle$.

+ +

If we start with the original $|\phi_2\rangle$ given by e.q. 1.31

+ +

$|\phi_2\rangle = \frac{1}{2}[\alpha(|0_A\rangle + |1_A\rangle)(|0_A0_B\rangle + |1_A1_B\rangle)+ \beta(|0_A\rangle + |1_A\rangle)(|1_A0_B\rangle + |0_A1_B\rangle)]$

+ +

if we expand this out keeping track of the subscripts and remembering to keep ordering from left to right (as the tensor product is noncommutive, this means $A \otimes B \neq B \otimes A$), you can see that we will get the same terms as expanding out the rewritten form with the same ordering (grouping) of qubits for both Alice and Bob.

+ +

The second part, Alice is measuring two qubits, one which is part of her EPR pair and the other that WAS $|\phi\rangle$ however during the teleportation protocol she acts on this state and mixes this with her part of the EPR pair so we no longer have the original pure state $|\phi\rangle$. We know she can't measure $|\phi\rangle$ otherwise this would violate the no-cloning theorem as Alice and Bob would then both have a quibit in state $|\phi\rangle$ at the end of teleportation!

+ +

Daftwullie gives a great explanation here Quantum teleportation: second classical bit for removing entanglement?

+",6139,,6139,,5/20/2020 18:27,5/20/2020 18:27,,,,0,,,,CC BY-SA 4.0 +12101,1,,,5/20/2020 17:50,,2,697,"

In Chapter 8 of Nielsen and Chuang's Quantum Computation and Quantum Information, a mathematical framework is developed to describe the dynamics of open quantum systems. +Suppose the initial state of principal system is $\rho$ and the initial state of the environment is $\rho_{env}$. Let the principal-system-environment system start out in the product state $\rho \otimes \rho_{env}$. Let's say after some unitary evolution $U$, we want to extract the ""evolved"" state of the principal system. We do this by tracing over the environment i.e. averaging over the states of environment as shown below +$$\mathcal{E}(\rho) = tr_{env}(U(\rho \otimes \rho_{env})U^{\dagger})$$ +Let ${|e_k\rangle}$ be some orthonormal basis of the state space of the environment and $\rho_{env} = |e_0\rangle\langle e_0|$. Then we have +

+ +

Now in the text, it is said that $tr(\mathcal{E}(p))$ can be less than 1 or $\sum_k E_kE^{\dagger}_k <I$. But how can this be true? Is the basis ${|e_k\rangle}$ not complete?

+ +

In the text, non-trace preserving that follow the above properties are said to ""not provide a complete description of the process that may occur in the system"". An example is used to illustrate this :

+ +

+ +

Granted $\mathcal{E}_0(\rho)$ and $\mathcal{E}_1(\rho)$ don't provide full description of the system but that is only because the basis for these operations are not complete. So are non trace preserving quantum operations those that don't account for a complete orthonormal basis of environment? If not, is there a better example or physical intuition of understanding this ""non trace preserving"" property?

+",7943,,55,,5/24/2022 18:38,5/24/2022 18:38,Physical Interpretation of Non-Trace Preserving Quantum Operations,,2,0,,,,CC BY-SA 4.0 +12102,1,12106,,5/20/2020 17:53,,3,122,"

When the commutator of two operators vanishes then we can measure one without affecting the other. I'm not sure how this translates in the case of density matrices.

+ +

If the density matrices are representing pure states then the density matrices would represent projection operators onto the subspace spanned by the given state. So I think a vanishing commutator on two density matrices could mean that either the subspace spanned by the two states are orthogonal or that they are the same. Is this correct?

+",,user12101,,,,5/21/2020 7:11,What does it mean geometrically (in terms of vectors in the Bloch sphere) if the commutator of two density matrices $ρ_1$ and $ρ_2$ vanishes?,,1,0,,,,CC BY-SA 4.0 +12103,1,12117,,5/20/2020 19:16,,3,1700,"

How to create Ising Hamiltonian and implement it with qiskit (the output should be in the form of WeightedPauliOperator) for the following problem:

+ +

$$ +H = A \big(K - \sum_{i}^{N} t_i x_i \big)^2\\ +x_i=\{0,1\}\\ +t_i \in \mathbb{N}_{>0}\\ +K\in \mathbb{N}\\ +A \in \mathbb{R}_{>0}\\ +$$

+ +

I want to choose any number of variables $x_i$, that the sum $\sum_{i}^{N} t_i x_i$ will equal exactly $K$.

+",10234,,434,,5/21/2020 13:09,5/21/2020 16:49,Creating Ising Hamiltonian with Qiskit,,1,1,,,,CC BY-SA 4.0 +12104,1,12120,,5/20/2020 21:25,,9,789,"

Suppose I have a black-box unitary $U_p$ which is described as follows: given a finite probability distribution $p:\{1,\ldots,n\}\rightarrow \mathbb{R}_{\geq0}$, where $\sum_{x=1}^n p(x)=1$, the action of the black box on a basis is given by $$U_p:|x\rangle|0\rangle\mapsto |x\rangle |p(x)\rangle,$$ where I am assuming I can encode each $p(x)$ into some register of quantum states (say using binary encoding into qubits). Then applying $U_p$ to a superposition of inputs is easy and I can easily construct a circuit that prepares the state $$\frac{1}{\sqrt{n}}\sum_{x=1}^n |x\rangle |p(x)\rangle.$$ My question is the following, using what I have described above or otherwise how could I prepare the quantum state $$|p\rangle:=\sum_{x=1}^n \sqrt{p(x)}|x\rangle$$ given access to $U_p$.

+

Remarks: My question could be seen as how one can make this fit into the amplitude amplification scheme.

+

One can see that this is a generalization of the typical quantum search, since if $p(x)=\delta_{x,y}$ (the distribution that is $1$ if $x=y$ and 0 if $x\neq y$) then $U_p$ is the quantum black-box for one marked item quantum search, and therefore preparing the state $|y\rangle$ can be done with $\Theta(\sqrt{n})$ queries to $U_{\delta(x,y)}$.

+

Update: I think this might boil down to someone explaining how I might implement the relative-phase like transformation $$ V:|x\rangle|f(x)\rangle\mapsto |x\rangle \big(\sqrt{\tfrac{f(x)}{2^m}}|0\rangle+\sqrt{1-\tfrac{f(x)}{2^m}}|1\rangle\big)$$ using some sort of controlled rotation?

+",11793,,11793,,5/28/2022 1:30,5/28/2022 1:37,Preparing a quantum state from a classical probability distribution,,1,7,,,,CC BY-SA 4.0 +12105,2,,12090,5/21/2020 6:52,,2,,"

In the second half of the circuit you're mixing up which qubits are your ancillae and which are the ones you want to operate on. You can't use one of your system qubits as an ancilla.

+ +

+",119,,,,,5/21/2020 6:52,,,,1,,,,CC BY-SA 4.0 +12106,2,,12102,5/21/2020 7:11,,4,,"

If two operators commute, they have the same eigenvectors. For the density matrix of a qubit, the eigenvectors can be visualised as being along a particular axis of the Bloch sphere, corresponding to the direction of the Bloch vector. So, two density matrices commute if their Bloch vectors ($\vec{n}$ and $\vec{m}$) are parallel, i.e. there exists a real number $\alpha$ such that $\vec{n}=\alpha\vec{m}$ (note the $\alpha$ may be negative. I'm also ignoring the trivial case of $\vec{m}=0$).

+",1837,,,,,5/21/2020 7:11,,,,5,,,,CC BY-SA 4.0 +12107,1,,,5/21/2020 9:17,,0,77,"

I am calculating the reduced density matrix of a bipartite system, I ended up getting that it was the sum of two density matrices of pure states each with a probability $1/3$. My understanding was that the coefficients in this ensemble should add up to $1$. But perhaps this is only for density matrices of whole systems and not for a reduced density matrix? So have I made an error in the calculation (I don't think I have) or the result I got possible?

+",,user12101,55,,7/26/2021 22:59,8/26/2021 0:07,Can an ensemble of pure states give probability less than 1?,,1,2,,,,CC BY-SA 4.0 +12108,1,12110,,5/21/2020 9:39,,2,144,"

I understand that the intuition behind a unitary operator is that it preserves the length of the vector it acts upon. Also $U^\dagger U = I$. Doesn't that just mean that $U$ is just an invertible operator which preserves distance? And that $U^\dagger$ is the inverse?

+ +

If not, where am I making my mistake in reasoning? How should I rewire my thinking to avoid this flawed paradigm?

+ +

If so, does that then mean that all distance preserving and invertible operators are also normal operators?

+",10485,,,,,5/21/2020 12:58,Why does the concept of a unitary matrix seem so similar to that of an invertible matrix?,,1,0,,,,CC BY-SA 4.0 +12109,2,,12107,5/21/2020 9:59,,2,,"

Given $\rho\equiv\sum_{ijk\ell}\rho_{ij,k\ell}|ij\rangle\!\langle k\ell|$, the reduced state is +$$\rho_A = \sum_{ik} \left(\sum_j \rho_{ij,kj} \right)|i\rangle\!\langle k|.$$ +Therefore, +$$\operatorname{Tr}(\rho_A)\equiv \sum_i (\rho_A)_{ii} = \sum_{ijk}\rho_{ij,ij}=1.$$

+ +

Equivalently, +$$\operatorname{Tr}(\rho_A)=\operatorname{Tr}(\operatorname{Tr}_B(\rho)) += (\operatorname{Tr}_A\otimes\operatorname{Tr}_B)\rho=\operatorname{Tr}(\rho)=1.$$

+ +

+",55,,,,,5/21/2020 9:59,,,,0,,,,CC BY-SA 4.0 +12110,2,,12108,5/21/2020 11:34,,5,,"

This is one of the definitions of a unitary $-$ a (bounded) linear surjective map that preserves distances (the inner product). From this it can be deduced that $U$ is invertible and $U^{-1} = U^\dagger$.

+

Also, it's enough to require the preservation of the lengths of all vectors (instead of all inner products) due to Polarization identity

+

Unitaries are normal because $U^\dagger U = U U^\dagger$, clearly.

+",5870,,-1,,6/18/2020 8:31,5/21/2020 12:58,,,,1,,,,CC BY-SA 4.0 +12111,1,,,5/21/2020 11:40,,7,57,"

According to the circuit model, the output for a quantum computation on $n$ qubits is an $n$-bit string. But what if we instead got a full two qubit tomography for all $n(n-1)$ pairs of qubits?

+ +

This would need to be calculated over many shots. If we simple used 1 shot, then we could easily just read out the resulting bit string. If we had infinite shots, and hence arbitrarily accurate tomography, perhaps we'd get some undesirable superpowers. Let's rule out both with the restriction that the number of shots must be both upper and lower bounded by $\textrm{poly}(n)$.

+ +

For algorithms with deterministic outputs, all shots give the same output. So in these cases, we'll still just be able to read out the standard result.

+ +

For algorithms with random outputs (like Shor's which gives random factors), things might be more tricky.

+ +

So what kinds of algorithms could be run with this restriction? And what kind of speed-ups could be obtained?

+",409,,,,,5/21/2020 11:40,"If we could only get two-qubit tomography as an output, what algorithms are possible",,0,3,,,,CC BY-SA 4.0 +12112,1,12119,,5/21/2020 12:19,,6,371,"

From a few VQE tutorials online I see that they normally start with something like:

+ +
+

VQE is a way of getting a good estimate for the upper bound of the ground state of a quantum system's Hamiltonian. The Hamiltonian is known.

+
+ +

Then they proceed to show you a single qubit Hamiltonian as a 2x2 matrix, and go through the VQE algorithm to get the ground state energy (the smaller of the two eigenvalues).

+ +

Cool, but as devil's advocate, I could have just pulled out my high school maths to analytically get the smaller of the two eigenvalues. And with larger matrices, a classical computer will do the job well (which afaik is not a hard problem).

+ +

My question then is at what point does a Hamiltonian's matrix representation become so large, that even though we know it, we'd go to the trouble of probing the quantum system itself rather than solving for the eigenvalues on a classical computer? And how does that relate to the current and near future statuses of classical and quantum computing?

+ +

Please feel free to completely sidestep my question and nudge me back on track if I'm off-paradigm or started from the wrong premise.

+",10485,,10485,,5/21/2020 14:29,5/21/2020 20:45,What's the point of VQE if classical computers can solve for eigenvalues easily?,,1,0,,,,CC BY-SA 4.0 +12113,1,12122,,5/21/2020 13:22,,12,3911,"

Starting from:

+ +

$$ +-i\hbar \frac{d|\psi⟩}{dt} = H|\psi⟩ +$$

+ +

I was able to do some working to prove that $U$ in the corresponding discrete representation

+ +

$$ +U(t_1,t_2) = exp\frac{-iH(t_2-t_1)}{\hbar} +$$

+ +

is unitary if and only if $H$ is Hermitian. That is:

+ +

$$ +U^\dagger(t_1,t_2)U(t_1,t_2) = I \iff H = H^\dagger +$$

+ +

Cool! But now I'm stuck trying to understand the physical significance of the fact that $H$ is Hermitian. I try to see $H$ as a ""velocity function"" because it gives the instantaneous change in $|\psi⟩$. That's as far as my intuition goes in terms of understanding the Hamiltonian.

+ +

So what's another intuitive way of understanding why the Hamiltonian must be Hermitian? And as a bonus, can the Hamiltonian also be unitary?

+ +

EDIT

+ +

I think the following ""intuitive"" description works best for me (the answers led me here):

+ +

So we start from my idea that $H$ is like a ""velocity function"" that takes as input the current state vector $|\psi⟩$ and spits out the infinitesimal change $d|\psi⟩/dt$. Now we consider two things:

+ +

1) $H$ being hermitian means it has real eigenvalues (the proof of that is off-topic). So if you apply it to a state vector you're just scaling each of its components by a purely real number. Or in math speak, if you apply $H$ to $|\psi⟩ = \sum_i{c_i}|\psi_i⟩$ (where I've just expressed $|\psi⟩$ as a weighted sum over basis vectors $|\psi_i⟩$), you end up getting $\sum_iR_ic_i|\psi_i⟩$ where $R_i$ are purely real.

+ +

2) But then we also consider that $H$ is also multiplied by $i$. So that turns all those purely real coefficients to purely imaginary coefficients. Switching to the polar description of complex numbers, the infinitesimal change to the state vector is just a phase added to each of its components, and no amplitude scaling.

+ +

Therefore $H$ is like an instantaneous tangential nudge to the vector. So by integrating, the corresponding discrete operator $U$ is unitary.

+",10485,,10485,,5/22/2020 16:44,5/25/2020 12:42,Why does a Hamiltonian have to be Hermitian?,,3,9,,,,CC BY-SA 4.0 +12114,2,,12113,5/21/2020 13:31,,2,,"

I will basically quote directly from Susskind as its a great explanation. First of all being Hermitian tells us that $H$ is an observable, secondly, it has a complete set of eigenvectors and eigenvalues that define the energy levels of the system by spectral decompsition:

+ +

$H = \sum E |E\rangle \langle E|$

+ +

To derive the condition for $H$ being Hermitian we look at the evolution of a system. Firstly for any time change of a system, the change needs to be unitary thus:

+ +

$U^\dagger U = I$,

+ +

based on smoothness of time evolution we also require $U$ be of the form that:

+ +

$U = I - i\epsilon H$,

+ +

thus for $U$ to remain unitary we must have:

+ +

$U^\dagger U = \left(I + i\epsilon H^\dagger\right)\left(I - i\epsilon H\right) = I$,

+ +

expanding this out we find that:

+ +

$H^\dagger - H = 0$,

+ +

which is our condition of being Hermitian.

+ +

Can $H$ be unitary? For $H$ to have a spectral decomposition the eigenvalues need to be real, and we cannot guarantee this for a unitary. Secondly for $H$ to be Unitary and Hermitian, this means that:

+ +

$H = (2P - I)$,

+ +

where $P$ is an orthogonal projector. This will have eigenvalues $\pm 1$, thus you will have degenerate energy levels. So yes you can, but you are rather limited.

+",6139,,23,,5/21/2020 15:22,5/21/2020 15:22,,,,4,,,,CC BY-SA 4.0 +12115,1,12118,,5/21/2020 14:26,,0,176,"

With regard to this question/answer:

+

How's the generalized behaviour of a two-qubit gate for the resulting two qubits?

+

Here e.g. CNOT:

+

If I apply the CNOT matrix to the tensor product, also the control qubit seems to get affected:

+

Control qubit

+

$$ \text{ctrl} = \begin{pmatrix} x \\ y \end{pmatrix} $$

+

Target qubit +$$ \text{target} = \begin{pmatrix} \alpha \\ \beta \end{pmatrix} $$

+

Tensor product tp:

+

$$ +\text{tp} = \text{ctrl} \otimes \text{target} = +\begin{pmatrix} x \\ y \end{pmatrix} +\otimes +\begin{pmatrix} \alpha \\ \beta \end{pmatrix} += +\begin{pmatrix} x\alpha \\ x\beta \\ y\alpha \\ y\beta \end{pmatrix} +$$

+

Applying the CNOT gate with control qubit a and target qubit b:

+

$$ +\text{res}_1 = +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0 \\ +\end{pmatrix} +\begin{pmatrix} x\alpha \\ x\beta \\ y\alpha \\ y\beta \end{pmatrix} += +\begin{pmatrix} x\alpha \\ x\beta \\ y\beta \\ y\alpha \end{pmatrix} +$$

+

How to get the two results for the both qubits a and b out of this res1 vector representation (tensor product of the two resulting qubits?)?

+

Acc. to the linked answer, the resulting value for the target qubit b may be the vector built from the upper two values, i.e.

+

$$ \text{res}_\text{target} = \begin{pmatrix} x\alpha \\ x\beta \end{pmatrix} $$

+

Does the control qubit also get affected in that case? e.g.

+

$$ \text{res}_\text{ctrl} = \begin{pmatrix} y\beta \\ y\alpha \end{pmatrix} $$

+

Clearly building the tensor product of those two results wouldn't result in the

+",12108,,-1,,6/18/2020 8:31,5/23/2020 7:17,Generic maths for two-qubit gates,,3,0,0,8/12/2020 21:15,,CC BY-SA 4.0 +12116,2,,12115,5/21/2020 16:04,,1,,"

So it is easier to understand if we properly write out the state of the system:

+ +

$|\phi\rangle = (x|0\rangle + y|1\rangle)\otimes(\alpha|0\rangle + \beta|1\rangle) = x\alpha|00\rangle + x\beta|01\rangle + y\alpha|10\rangle + y\beta|11\rangle$,

+ +

you can see now that the cnot will only invoke $\sigma_x$ on the second qubit when the first qubit is $1$, so the output state afterwards will be:

+ +

$C^1(\sigma_x)|\phi\rangle = x\alpha|00\rangle + x\beta |01\rangle + y\beta |10\rangle + y\alpha|11\rangle$,

+ +

so you can see in your vector output you are correct, but you have to remember the actual states and the basis you are corresponding to rather than the amplitudes representing the states as you had assumed.

+",6139,,6139,,5/21/2020 16:26,5/21/2020 16:26,,,,0,,,,CC BY-SA 4.0 +12117,2,,12103,5/21/2020 16:49,,5,,"

You can use Qiskit's new optimization module. This allows you to use docplex to build your model:

+ +
# required imports
+from docplex.mp.model import Model
+from qiskit.optimization.problems import QuadraticProgram
+from qiskit.optimization.converters import QuadraticProgramToIsing
+
+# specify problem
+n = 3
+a = 1.0
+k = 2
+t = range(1, n+1)
+
+# build model with docplex
+mdl = Model()
+x = [mdl.binary_var() for i in range(n)]
+objective = a*(k - mdl.sum(t[i]*x[i] for i in range(n)))**2
+mdl.minimize(objective)
+
+# convert to Qiskit's quadratic program
+qp = QuadraticProgram()
+qp.from_docplex(mdl)
+
+# convert to Ising Hamiltonian
+qp2ising = QuadraticProgramToIsing()
+H, offset = qp2ising.encode(qp)
+print('Offset:', offset)
+print('Ising Hamiltonian:')
+print(H.print_details())
+
+ +
+

Offset: 4.5

+ +

Ising Hamiltonian:

+ +

IIZ (-1+0j)

+ +

IZI (-2+0j)

+ +

ZII (-3+0j)

+ +

IZZ (1+0j)

+ +

ZIZ (1.5+0j)

+ +

ZZI (3+0j)

+
+ +

You can find some tutorials introducing the functionality here: +https://qiskit.org/documentation/tutorials/optimization/index.html +or here +https://github.com/Qiskit/qiskit-tutorials/tree/master/tutorials/optimization

+",10429,,,,,5/21/2020 16:49,,,,2,,,,CC BY-SA 4.0 +12118,2,,12115,5/21/2020 18:43,,2,,"

You seem to be confusing tensor product and direct sum. Direct sum is the stacking of top two over bottom two, but tensor product is as you wrote with quadratic combinations of the coefficients. This is because of the unfortunate situation that $2*2=2+2$.

+ +

So you are correct in getting

+ +

$$ +\begin{pmatrix} +x\alpha\\ +x\beta\\ +y\beta\\ +y\alpha +\end{pmatrix} +$$

+ +

for the composite system. But you can't just take top two and bottom two entries to get results for target and control. That would be the direct sum decomposition not the tensor product decomposition.

+ +

That was just a coincidence in in the other answer. $x=1$ and $y=0$ there so the top two happened to give you the correct coefficients for something you could interpret as $res_{target}$.

+ +

But in this case you can't get back to something of the form $res_{control} \otimes res_{target}$, let alone being able to read them off from a direct sum decomposition.

+",434,,,,,5/21/2020 18:43,,,,1,,,,CC BY-SA 4.0 +12119,2,,12112,5/21/2020 20:40,,6,,"

The computational advantage of using quantum computers can be reached if the classical resources (memory; number of operations), required to solve a particular problem, grow exponentially in a certain parameter, while the quantum resources (memory; number of operations; number of measurements) grow polynomially in the same parameter.

+ +

Finding the lowest eigenvalue of an arbitrary matrix may very well NOT be a problem which you can solve on a quantum computer with an exponential improvement over the classical methods. (Please someone correct me if I'm wrong.)

+ +

However, if you are interested in finding the lowest eigenvalue of a Hamiltonian representing some physical system, there is a good chance that using quantum computers (in general) and VQE (in particular) may give you some advantage.

+ +

Consider, as an example, a Hamiltonian describing a system of $n$ particles. The Hilbert space size in this case grows with the number of particles as $N=O(\operatorname{exp}(n))$. For any reasonable encoding, the number of qubits required to encode the state of such a system in a quantum computer grows as $O(\operatorname{poly}(n))$. If you want to use VQE, the other parameters you are concerned with are:

+ +
    +
  • The number of Pauli operators in the expansion of the Hamiltonian — grows as $O(\operatorname{poly}(n))$ for local interactions.
  • +
  • The number of gates required to prepare an ansatz state — grows as $O(\operatorname{poly}(n))$ for many known cases (e.g. look up UCCSD for quantum chemistry: one, two).
  • +
+ +

Therefore, in this case all the quantum resources grow polynomially in $n$:

+ +

Memory; number of gates; number of measurements $=O(\operatorname{poly}(n))$.

+ +

In the classical case, one would have to generally deal with vectors and matrices in $N = O(\operatorname{exp(n)})$ dimensions. Therefore, in this case we clearly have an improvement in memory and, quite likely, in the number of operations (asymptotically) as well.

+",6313,,6313,,5/21/2020 20:45,5/21/2020 20:45,,,,7,,,,CC BY-SA 4.0 +12120,2,,12104,5/21/2020 22:41,,5,,"

Suppose we have two quantum circuits, the first one $S$ computes (or at least approximates) the classical squareroot function ($\sqrt{\cdot}$) via $$S|x\rangle|0\rangle=|x\rangle |\sqrt{x}\rangle,$$ while the second circuit $A$ computes (again could probably just approximate) the $\arccos(\cdot)$ function via $$A|x\rangle|0\rangle=|x\rangle |\arccos(x)\rangle.$$ Lastly, suppose we have are able to preform controlled single qubit rotations $R$ (or at least approximately preform these) in the following sense $$R|\theta\rangle|0\rangle=|\theta\rangle(\cos(\theta)|0\rangle+\sin(\theta)|1\rangle).$$

+

Then using the oracle $$U_p|x\rangle|0\rangle=|x\rangle|p(x)\rangle,$$ along with a bunch of extra qubits (which I won't write out in detail) we can create a circuit $C$ which computes (or at least approximates) the state $$C|x\rangle|0\rangle \mapsto |x\rangle(\cos(\arccos(\sqrt{p(x)})|0\rangle+\sin(\arccos(\sqrt{p(x)})|1\rangle)\\=|x\rangle(\sqrt{p(x)}|0\rangle+\sqrt{1-p(x)}|1\rangle).$$ Now, using $\log(n)$ qubits we can create the superposition $\frac{1}{\sqrt{n}}\sum_{x=1}^n |x\rangle$ using Hadamards. Applying $C$ to this superposition we can create the state $$\frac{1}{\sqrt{n}}\sum_{x=1}^n(\sqrt{p(x)})|0\rangle+\sqrt{1-p(x)})|1\rangle)|x\rangle.$$ If we rewrite this state as $$\frac{1}{\sqrt{n}}(\sum_{x=1}^n\sqrt{p(x)}|x\rangle)|0\rangle+\frac{1}{\sqrt{n}}(\sum_{x=1}^n\sqrt{1-p(x)}|x\rangle)|1\rangle\\ +=\sqrt{\tfrac{1}{n}}|p\rangle|0\rangle+\sqrt{\tfrac{n-1}{n}}|\tilde{p}\rangle|1\rangle,$$ then in this form it is clear that the amplitude amplification algorithm can output the state $|p\rangle$ in $\Theta(\sqrt{n})$ queries with high probability.

+",11793,,11793,,5/28/2022 1:37,5/28/2022 1:37,,,,0,,,,CC BY-SA 4.0 +12121,2,,12092,5/22/2020 0:57,,2,,"

Small ion trap quantum computers have all-to-all connectivity. Two-qubit gates can be executed between any arbitrary pair of ions in the trap. This has been demonstrated on up to 11 qubits (see, for example, https://www.nature.com/articles/s41467-019-13534-2).

+ +

But it becomes difficult to maintain this control when the number of ions gets too large. A linear chain of somewhere around 50 ions is the limit of feasibility to maintain good two-qubit gate fidelities. There are proposals for allowing multiple chains of ions to interact, but you no longer have direct all-to-all connectivity the way you would in a single chain.

+ +

So if by ""full connectivity"" you really mean all-to-all connectivity, such that you can execute gates directly between any arbitrary pair of qubits, this requires $n(n-1)/2$ physical connections between qubits. It really seems that this becomes infeasible for large $n$ beyond, say, a few hundred. Even going to three-dimensional structures wouldn't get you too far.

+",10473,,10473,,5/22/2020 17:37,5/22/2020 17:37,,,,0,,,,CC BY-SA 4.0 +12122,2,,12113,5/22/2020 2:26,,5,,"

More Pragmatic Answer after Dialogue with OP in Comments

+ +

Rearranging the wave equation in the question to +$$\frac{d \vert \Psi \rangle}{dt} = \frac{i}{\hbar} H \vert \Psi \rangle \tag{1}$$ +should make it obvious that wavefunction takes the form +$$\vert \Psi \rangle = e^{\frac{i}{\hbar} H t}. \tag{2}$$ +However, the wavefunction is not only a function of time, but also of position. We can${}^\ast$ think about the time evolution of the system as +$$\vert \Psi(t) \rangle = e^{\frac{i}{\hbar}Et} \vert \psi_{r} \rangle, \tag{3}$$ +where $\vert \psi_{r} \rangle$ depends on the position within some coordinate system and is independent of time, and $E$ generally represents the energy in the system, which is a scalar value.

+ +

We can now consider the time derivative of Eqs. (2) and (3) in the $\vert \psi_r \rangle$ basis,

+ +

$$\frac{d \vert \Psi \rangle}{dt} = \frac{i}{\hbar} H \,e^{\frac{i}{\hbar}Et} \vert \psi_{r} \rangle=\frac{i}{\hbar} E \, e^{\frac{i}{\hbar}Et} \vert \psi_r \rangle, \tag{4}$$ +and rearrange to get +$$-\left( i \, \hbar \, e^{\frac{-i}{\hbar}Et} \right) \, \frac{d \vert \Psi \rangle}{dt} = H \vert \psi_{r} \rangle= E \vert \psi_r \rangle.$$ +The second equality here is the eigenvalue equation. It follows directly that if we need energy to be real and positive, which we do, $H$ must have positive real eigenvalues. The eigenvalue equation above also implies that $H$ is diagonalizable. As noted in the comments to your question, these two conditions are sufficient to require that $H$ is Hermitian.

+ +

${}^\ast$ After thinking about this some more, I should point out that Eq. (3) amounts to an assumption that at least one eigenvalue of $\vert \Psi \rangle$ can be expressed as a function of time (independent of position). Similarly, Eq. (4) amounts to an assumption that the positional basis $\vert \psi_r \rangle$ is independent of time.

+ +

Einstein showed that these assumptions are only low velocity approximations, i.e. that time is not independent of space. This is one way of seeing why the Shrödinger equation is inherently non-relativistic.

+ +

Original Less Pragmatic Answer/Geometric Intuition Regarding Hermitian Matrices

+ +

The intuition behind Hermitian matrices, is that they are the ""real"" matrices in $\mathbb{C}^{n \times n}$. The most basic property of any Hermitian matrix ($H$) is that it equals its conjugate transpose $H=H^\dagger$ (in direct analogy to $r \in \mathbb{R}$ where $r = r^\ast$). Equally fundamental, a Hermitian matrix has real eigenvalues and it's eigenvectors form a unitary basis that diagonalizes $H$.

+ +

Those are the key mechanical properties, but they probably don't do much for intuition. I'll try to give a sense of the geometric role that Hermitian matrices play in complex spaces in hopes that it may help you intuit the more direct and less transparent explanations that you've probably already seen.

+ +

Consider the familiar case of generating a 1-sphere in $\mathbb{C}^1$ by taking the exponent $e^{i \theta}$, with $\theta \in \mathbb{R}$, such that $i\theta$ is a purely imaginary value. In this case, our implicit real basis for the real parameter $\theta$ is $1$, and not very interesting. If we wanted to be pedantic we could call $[1]$ a $1 \times 1$ Hermitian matrix.

+ +

In the same manner, we can generate a 3-sphere in $\mathbb{C}^{2 \times 2}$ by $U = e^{\frac{i}{2} \vec{\phi} \, \cdot \, \vec{\sigma}}$, where $\vec \phi$ is a vector in $\mathbb{R}^3$, and $\vec \sigma$ are the three Hermitian Pauli matrices (which are much more interesting than $[1]$). This guarantees that $U$ is an arbitrary element of $SU(2)$, which is isomorphic to the 3-sphere. Setting $\vec \phi = \alpha (\hat \phi_1, \hat \phi_2, \hat \phi_3)$, Taylor expansion gives +$$U=e^{\frac{i}{2} \vec{\phi} \, \cdot \, \vec{\sigma}}=\begin{bmatrix} \cos \frac{\alpha}{2} + i \hat \phi_3 \sin \frac{\alpha}{2} & \sin \frac{\alpha}{2} (\hat \phi_2 + i \hat \phi_1) \\ \sin \frac{\alpha}{2} (-\hat \phi_2 + i \hat \phi_1) & \cos \frac{\alpha}{2}- i \hat \phi_3 \sin \frac{\alpha}{2} \end{bmatrix}.$$ +The elements of the Pauli basis generate a representation of the (real) Lie algebra $\mathfrak{su_2}$, and are related to the three independent rotations ($R_n$), by $\sigma_n = 2i \frac{\partial R_n}{\partial\alpha} |_{\alpha=0}$. Although $\sigma_2$ makes use of imaginary numbers, the Pauli basis is real in all the ways that matter. For example $\sigma_n^2 = I$ and $(\vec \phi \cdot \vec \sigma)^2 = \vert \vec \phi \vert^2$. Just as in the case of $i \theta$, when we multiply the $\sigma_n$ by $i$, they become purely imaginary, i.e. $(i \sigma_n)^2 = -I$ and $(i \vec \phi \cdot \vec \sigma)$ is isomorphic to the pure quaternions (the imaginary part of the quaternions).

+ +

Recalling that $\sigma_n^2 = I$, if we forgo the $i$ in the exponentiation, we get something directly analogous to the 1-dimensional case of exponentiating with the split complex number, $k^2=1$, where $e^{k \beta} = \cosh{\beta} + k \sinh{\beta}$. In the three dimensional case we have, by Taylor expansion again:

+ +

$$ V = e^{\frac{1}{2} \vec \phi \, \cdot \, \vec \sigma} = \begin{bmatrix} \cosh \frac{\alpha}{2} + \hat \phi_3 \sinh \frac{\alpha}{2} & \sinh \frac{\alpha}{2} (\hat \phi_1 - i \hat \phi_2) \\ \sinh \frac{\alpha}{2} (\hat \phi_1 + i \hat \phi_2) & \cosh \frac{\alpha}{2} - \hat \phi_3 \sinh \frac{\alpha}{2} \end{bmatrix}, $$ +which are Hermitian matrices with unit determinant and Minkowski signature $(+,-,-,-)$. This matrix can be directly identified with a real 4-vector as discussed below. The 1-dimensional projection operators $\frac{1}{2}(1 \pm k)$ are also strikingly similar to the 3-dimensional Hermitian projection operators $\frac{1}{2}(I \pm \hat \phi \cdot \vec \sigma)$.

+ +

Pauli used his namesake matrices to formulate the Pauli equation, which is unfortunately non-relativistic since it fails to treat space and time on an equal footing. One of Dirac's great breakthroughs was generalizing the Pauli matrices into the gamma matrices, which enabled him to formulate the Dirac equation, which was one of the great breakthroughs of the past century.

+ +

Attempting to explain Dirac spinors at an intuitive level would be quite a task (I can provide some good references if you like), but we're only a breath away from coordinate generating spin matrices, which provide great insight into the value and necessity of Hermitian matrices. This is largely due to Wheeler's great presentation of them in Section 41.3 of Gravitation, which I highly recommend.

+ +

Essentially if we take a direct sum $\mathfrak{su}_2$ (which generates the element $U$ above) with $i \mathfrak{su}_2$ (which generates $V$ above) we get the 6-dimensional (complex) Lie algebra $sl_{2 \mathbb{C}}$, which generates the universal cover of the Lorentz group $SL(2,\mathbb{C})$, providing both Lorentzian rotations ($U$), boosts ($V$) and combinations of the two ($L \in SL(2,\mathbb{C}$)). In other words, any $L$ has unique left and right polar decompositions as $UV_R$ or $V_L U$, where $V$ is analogous to a radius, and $U$ to an angle. ($U$ and $V$ commute iff they share the same unit vector $\hat \phi$).

+ +

Wheeler calls the matrix $L$, which effects an arbitrary Lorentz transformation, a Lorentzian spin transformation matrix. $L$ acts on an Hermitian ""coordinate-generating spin matrix"" ($X$), +$$X=\begin{bmatrix} t + z & x-iy \\ x+iy & t-z \end{bmatrix},$$ +(note the same Hermitian structure and Minkowski signature as $V$) according to $X^\prime = L X L^\dagger$.

+ +

The structure $X$ and $L$ ensures that $X^\prime$ remains Hermitian by +$$ (X^\prime)^\dagger = (LXL^\dagger)^\dagger = (L^\dagger)^\dagger(X)^\dagger(L)^\dagger = LXL^\dagger = X^\prime $$ +and thus $(t,x,y,z) \mapsto (t',x',y',z')$ remains real.

+ +

I'm not sure I answered the question, as I didn't say much specifically about Hamiltonians, but in some sense that boils down to Hamiltonians describe real things (specifically kinetic energy + potential energy of a system) in complex spaces, and Hermitian matrices are mathematical representations of real things in complex spaces. Alternative explanations sometimes take forms like (quoting Weyl) ""In an infinitesimal unitary rotation of a vector field the velocity $\frac{d \chi}{d \tau}$ is related to $\chi$ by by means of a correspondence whose matrix is i times an Hermitian matrix.""

+ +

Hopefully the color above about the role Hermitian matrices play in complex spaces helps make sense of the generally unintuitive direct answers to your question.

+ +

EDIT: I forgot to answer the bonus question. The Pauli matrices are both unitary and Hermitian. The Hadamard matrix, +$$\begin{bmatrix}\frac{1}{\sqrt{2}}&\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \end{bmatrix}, $$ +which is prominent in QIS/QIT, is also unitary and Hermitian.

+",8623,,8623,,5/25/2020 12:42,5/25/2020 12:42,,,,8,,,,CC BY-SA 4.0 +12123,2,,12009,5/22/2020 4:58,,1,,"

A somewhat informal comment.

+ +

Some intuition can be developed from the fact that the pure states are rays in the complex projective space (subject to an additional normalization constraint). The most 'different' the two vectors in such a space can be is 'perpendicular' ⁠— if you keep $v_1$ moving away from $v_2$ in a certain plane, the distance will start increasing once you pass the perpendicular direction (think about the distance along the arc between two points on a circle, or about the maximum angle between any two lines passing through the origin). We also know that, because of the normalization condition, there is a maximum value for the scalar product between two vectors ⁠— given by the vectors' norm. Thus, in the sense of a particular norm, the two states can be as close as $0$, and as far as $1$ apart from each other.

+ +

Note that the trace norm distance between the states, which I was implicitly referring to, is precisely the one inherited from the scalar product of two vectors in the complex projective space (which, in turn, is inherited from the usual scalar product of vectors in $\mathbb{C}^n$): while for vectors we have $d(|\psi\rangle,|\psi'\rangle)=|\langle \psi | \psi' \rangle|$, for the corresponding pure density matrices we have +$d(|\psi\rangle\langle\psi|, +|\psi'\rangle\langle\psi'|) +=\operatorname{tr} (|\psi\rangle\langle\psi||\psi'\rangle\langle\psi'| )$, which is obtained by squaring the previous expression.

+",6313,,6313,,5/22/2020 13:21,5/22/2020 13:21,,,,0,,,,CC BY-SA 4.0 +12124,2,,12115,5/22/2020 7:37,,1,,"

The main issue is that CNOT gate creates an entangled state, i.e. state of one qubit is dependent on other one. If a state is entangled, you cannot write it down (decompose) as a tensor product of two (or more) qubits.

+ +

You can see this nicely on coefficents. While $x\alpha$ and $x\beta$ remained on same places in output vector, $y\alpha$ and $y\beta$ are switched. It is not possible to find tensor product of two vectors which would allow you to have $\alpha$ and $\beta$ on first and second coordinate, respectivelly and then $\beta$ and $\alpha$ on first (third) and second (fourth), respectively.

+ +

EDIT:

+ +

Just note that in some special cases, an output of CNOT gate can be decomposed to tensor product. For example if the input are z-basis states:

+ +
    +
  • $CNOT(|00\rangle)=|00\rangle=|0\rangle\otimes|0\rangle$
  • +
  • $CNOT(|01\rangle)=|01\rangle=|0\rangle\otimes|1\rangle$
  • +
  • $CNOT(|10\rangle)=|11\rangle=|1\rangle\otimes|1\rangle$
  • +
  • $CNOT(|11\rangle)=|10\rangle=|1\rangle\otimes|0\rangle$
  • +
+",9006,,9006,,5/23/2020 7:17,5/23/2020 7:17,,,,0,,,,CC BY-SA 4.0 +12125,1,12126,,5/22/2020 9:46,,2,464,"

I'm confused about the state of a system after a measurement. Say we have a particle $v$ in the state: $ |\psi\rangle= \sqrt{1/4} \ |0\rangle + \sqrt{3/4} \ |1\rangle $.

+ +

From my understanding, if one were to measure the state of $v$, one would get the result $|0\rangle$ with probability $|\sqrt{1/4}|^2=1/4$, and similarly, $|1\rangle$ with probability $3/4$.

+ +

However, I've also learned that a measurement is always done by an observable (a unitary operator), e.g. $Z=|0\rangle \langle 0|-|1\rangle \langle 1|$, and that the outcome of the measurement is an eigenvalue of this operator, and that the state we get after the measurement is always dependent on the observable we use, and similarly for the probability of getting that state.

+ +

Now, by inspection, I noticed that when I measure $Z$, I do get the state $|0\rangle$ with probability $1/4$, and $|1\rangle$ with probability $3/4$, as expected. But I don't get these results when I measure the Pauli operator $X$, for example.

+ +

Does that mean that the claim in my second paragraph always assumes a measurement of $Z$?

+",10033,,55,,7/11/2021 11:01,7/11/2021 11:01,What is the state of a qubit after measuring some a Pauli operator?,,2,1,,,,CC BY-SA 4.0 +12126,2,,12125,5/22/2020 10:43,,2,,"

$X$ basis measurement means that after the measurement we will have either $|+\rangle$ or $|-\rangle$ state (the eigenbasis vectors for the $X$ operator). To see the corresponding probabilities we should rewrite the $|\psi\rangle$ state in $X$ basis:

+ +

$$|\psi\rangle = \frac{1}{\sqrt{4}}|0\rangle + \frac{\sqrt{3}}{\sqrt{4}}|1\rangle = \frac{1}{2}\frac{1}{\sqrt{2}}(|+\rangle + |-\rangle) + \frac{\sqrt{3}}{2}\frac{1}{\sqrt{2}}(|+\rangle - |-\rangle) = \\ += \left(\frac{1 + \sqrt{3}}{\sqrt{2^3}}\right)|+\rangle + \left(\frac{1 - \sqrt{3}}{\sqrt{2^3}}\right)|-\rangle$$

+ +

where $|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ and $|-\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$. The probability of measuring $|+\rangle$ is equal to $\left| \frac{1 + \sqrt{3}}{\sqrt{2^3}}\right|^2$ and the probability of measuring $|-\rangle$ is equal to $\left| \frac{1 - \sqrt{3}}{\sqrt{2^3}}\right|^2$. In general case:

+ +

$$|\psi \rangle = \alpha |0\rangle + \beta |1\rangle = \frac{\alpha + \beta}{\sqrt{2}} |+\rangle + \frac{\alpha - \beta}{\sqrt{2}} |-\rangle$$

+ +

The statement in the second paragraph of the question assumes that the measurement is done in $Z$ basis because $|0\rangle$ and $|1\rangle$ are eigenbasis vectors of $Z$ operator. If we will do a measurement in $X$ basis we will never have $|0\rangle$ or $|1\rangle$ state after the measurement.

+",9459,,9459,,5/22/2020 11:37,5/22/2020 11:37,,,,0,,,,CC BY-SA 4.0 +12127,1,,,5/22/2020 10:43,,1,51,"

There is DOcplex module that generates WeightedPauliOperator for the DOcplex Model by calling docplex.get_operator(model). I want to understand what are the steps for creating the qubit operators (List of WeightedPauliOperator) without DOcplex module? +As I understand it is necessary to map problem to QUBO form.

+",10234,,,,,5/22/2020 10:43,Creating qubit operators for optimization problem,,0,0,,,,CC BY-SA 4.0 +12128,2,,12101,5/22/2020 11:11,,3,,"

Let's consider a simple example to try and clarify the issue.

+ +

Consider a one-qubit state $|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$ measured in the computational basis. +You can describe the results of such a measurement via the map $\Phi$ acting as +$$\newcommand{\ketbra}[1]{|#1\rangle\!\langle #1|}\Phi(|i\rangle\!\langle j|)=\delta_{ij}\ketbra i,$$ +so that +$$\Phi(\ketbra\psi)=|\alpha|^2\ketbra0+|\beta|^2\ketbra1.$$ +You can equivalently write this map as +$$\Phi(\rho)=\operatorname{Tr}_E[U(\rho\otimes\ketbra0)U^\dagger]$$ +with $U$ such that $U|0,0\rangle\equiv|0,0\rangle$ and $U|1,0\rangle=|1,1\rangle$ (more generally, any unitary $U$ such that $U|0,0\rangle=|0,u\rangle$ and $U|1,0\rangle=|1,u_\perp\rangle$ with $\langle u|u_\perp\rangle=0$ does the job). +The corresponding Kraus operators are then +$E_0=\ketbra0$ and $E_1=\ketbra1$.

+ +

Now, what happens if I consider another map $\tilde\Phi(\rho)=E_0\rho E_0^\dagger$? Clearly this is not trace-preserving, and the physical interpretation of this is that you are not describing the full array of possible outputs. Because any physical process always gives some output state (by the definition itself of what ""process"" means here), there must always be a trace-preserving map describing it.

+ +

Another example is $\Phi(\rho)=\ketbra0$, which corresponds to $E_0=|0\rangle\!\langle0|$ and $E_1=|0\rangle\!\langle 1|$. Now a corresponding non-trace-preserving version could be $\tilde\Phi(\rho)=E_0\rho E_0^\dagger$. This is again non-trace-preserving, but the interpretation is slightly different than before. Rather than ignoring possible outputs, we are considering only one of the output environment states. You could think of this as focusing on what happens on $\rho$ when the environment has been found in the state $|0\rangle$, that is, as the output state of the system post-selected over an environment state.

+ +

More generally, a non-trace-preserving map can be thought of as describing the output state post-selected on a subset of the possible environment states. I should mention that it can be debatable whether such an interpretation of a map as generated by measuring the environment is sensible. In some cases, e.g. when the map describes a measurement, whether you accept such an interpretation as sensible boils down to whether you choose to interpret collapse as due to environmental decoherence or something else. Nevertheless, mathematically things can always be described in this fashion.

+ +

A next question would be: when is it useful to use non-trace-preserving maps to describe what happens in a physical scenario? I don't think I ever encountered such a situation. If anyone can think of any please let me know.

+",55,,55,,5/23/2020 7:07,5/23/2020 7:07,,,,1,,,,CC BY-SA 4.0 +12130,1,,,5/22/2020 12:18,,2,132,"

I want to examine the graph of 2 sets consisting of 1000 numbers created with quantum random number generator which were created by entangled qubits and see if there is a pattern in the randomly generated number series.

+ +

How can I do this with Q#?

+ +

So by doing that I think,I can entangle two qubits in Sample Quantum Random Number Generator

+ +
operation SampleQuantumRandomNumberGenerator() : Result {
+// Allocate two qubits
+using ((q1, q2) = (Qubit(), Qubit()))  {
+    // Prepare Bell state (|00⟩ + |11⟩) / sqrt(2) on them
+    H(q1);
+    CNOT(q1, q2);
+    // The measurement results are going to be correlated: you get 0,0 in 50% of the cases and 1,1 in 50%
+    return (MResetZ(q1) == Zero ? 0 | 1, 
+            MResetZ(q2) == Zero ? 0 | 1);
+}
+
+ +

But how can I use qubits ( qs(0) for one set qs(1) for one set ) in here for getting 2 sets consisting of 1000 numbers between 0 and 100 ?

+ +
operation SampleRandomNumberInRange(max : Int) : Int {
+    mutable bits = new Result[0];
+    for (idxBit in 1..BitSizeI(max)) {
+        set bits += [SampleQuantumRandomNumberGenerator()];
+    }
+    let sample = ResultArrayAsInt(bits);
+    return sample > max
+           ? SampleRandomNumberInRange(max)
+           | sample;
+}
+
+@EntryPoint()
+operation SampleRandomNumber() : Int {
+    let max = 100;
+    Message($""Sampling a random number between 0 and {max}: "");
+    return SampleRandomNumberInRange(max);
+}
+
+",11913,,11913,,5/24/2020 8:53,5/24/2020 8:53,Are there patterns in the numbers created with qrng by entangled qubits?,,1,11,,,,CC BY-SA 4.0 +12131,2,,12125,5/22/2020 12:22,,2,,"

Yes, the claim in your second paragraph implicitly assumes a measurement of $Z$.

+ +

The states $|0\rangle$ and $|1\rangle$ are not well-defined unless you specify which basis you're referring to (e.g. the $Z$-basis). To make this completely clear, it's better to write out the states as $|Z = 0\rangle$and $|Z = 1\rangle$ whenever there's any ambiguity as to the basis.

+",551,,,,,5/22/2020 12:22,,,,0,,,,CC BY-SA 4.0 +12132,2,,12099,5/22/2020 16:09,,1,,"

The question reads like quantum encryption is a special example of quantum teleportation, which is not the case.

+ +

Teleportation solves the following problem: Alice wants to send Bob a qubit, but has no way to physically transport it without destroying it. However, Alice and Bob already share an entangled state, and they can communicate classically. They can use quantum teleportation to get the qubit to Bob without transporting any physical qubits.

+ +

For encryption, Alice and Bob simply want to communicate some classical bits without being eavesdropped on without their knowledge. For quantum key distribution, is it not important whether the quantum states are sent to Bob in some physical mail system or via teleportation. The system is secure against an evil postman who opens the package to read or modify it.

+",9626,,,,,5/22/2020 16:09,,,,0,,,,CC BY-SA 4.0 +12133,2,,11861,5/22/2020 17:54,,8,,"

Ross and Selinger have solved this problem here: Optimal ancilla-free Clifford+T approximation of z-rotations

+ +

and provide a command-line tool for generating Clifford+T approximations to Rz gates, which you can download here: https://www.mathstat.dal.ca/~selinger/newsynth/

+",9626,,9006,,5/23/2020 7:05,5/23/2020 7:05,,,,1,,,,CC BY-SA 4.0 +12134,2,,12113,5/22/2020 18:00,,2,,"

Let's say we take for granted that physical states are described by complex vectors $|\psi\rangle\in\mathbb C^n$ defined up to their normalisation and (global) phase.

+ +

(Unitaries are the general way to map states to states) We now want to describe how these things evolve in time. +The natural way to describe how a vector changes into another vector is via a linear operator (that is, a matrix). Let's call it $U$. We want this $U$ to map states into states. That means $U$ should preserve normalisation and don't care about the global phases. Moreover, crucially, we want such an operation to not destroy nor create information, that is, we want it to be time-reversible (we could and do consider more general situations involving loss of information, using so-called quantum channels, but that's a discussion for another day). +Putting these requirements together identifies $U$ as an element of the group of unitary matrices $SU(n)$.

+ +

(Unitaries don't have a notion of time) But there is something rather unphysical about the above description: where is time? Indeed, describing the evolution of a state via unitary operators, $|\psi\rangle\mapsto U|\psi\rangle$, corresponds to considering the state at only different ""time snapshots"". In other words, unitaries are akin to ""black boxes"": they describe the overall effect of some physical evolution, but don't delve about the details actually making it up.

+ +

(Bringing time into the picture: families of unitaries) Real physical interactions act on states by continuously changing them. In other words, there must be a notion of infinitesimal changes, and these changes must depend on the specifics of the situation (and thus in particular on the input state). Given our above conclusions regarding unitaries, we can write quite generally the time evolution of a state $|\psi\rangle$ as the (continuous) set of states $|\psi(t)\rangle=U(t)|\psi\rangle$, where $U(t)$ is a unitary for each $t$, and satisfies a bunch of conditions to make it model a proper time evolution. In particular, we must have $U(t_1)U(t_2)=U(t_1+t_2)$ for all $t_1,t_2$.

+ +

(Finally, where Hamiltonians are born) Ok, so we know how to describe time evolutions via families of unitaries. What happens now if the time $t$ is taken to be very small? It is a natural question to ask in ""what direction"" the state is changing at any given time. Mathematically, this amounts to studying +$$\frac1 {dt} (|\psi(dt)\rangle-|\psi(0)\rangle) = \frac{U(dt) - I}{dt}|\psi(0)\rangle.$$ +But now look at the kind of expression we got: infinitesimal changes are described by operators of the form $\frac{U(dt)-I}{dt}$ in the limit $dt\to0$, with $t\mapsto U(t)$ such that $U(0)=I$. As it turns out, these objects are skew-Hermitian operators. More precisely, there is always some Hermitian $H$ such that $U(t)=e^{it H}$. +And there you have it: if you want to describe infinitesimal evolution of quantum states, you must do so via Hermitian operators called ""Hamiltonians"".

+ +

(Physically, how do Hermitians act?) Hermitians are those matrices which are orthonormally diagonalisable and have real eigenvalues. Their appearing via exponentials means that $e^{iHt}$ are (orthonormally) diagonalisable and have phases as eigenvalues. This means that these are operators which do nothing but add phase shifts between specific components of the input state.

+",55,,55,,5/22/2020 18:14,5/22/2020 18:14,,,,0,,,,CC BY-SA 4.0 +12135,2,,4886,5/22/2020 18:14,,2,,"

What you are asking is: How to create a Dicke State?

+ +

A Dicke state is a balanced superposition of bit string of length n with hamming weight $k$.

+ +

Refer to Deterministic Preparation of Dicke States for the solution.

+",12118,,9006,,5/23/2020 7:01,5/23/2020 7:01,,,,0,,,,CC BY-SA 4.0 +12136,1,,,5/22/2020 19:09,,1,37,"
import cirq
+
+
+def set_io_qubits(qubit_count):
+    input_qubits = [cirq.GridQubit(i, 0) for i in range(qubit_count)]
+    return (input_qubits)
+
+def debug_oracle(input_qubits):
+    yield (cirq.H(input_qubits[0]))
+
+
+def make_grover_circuit(input_qubits, oracle):
+    c = cirq.Circuit()
+
+    c.append(oracle)
+    c.append(oracle)
+    c.append(oracle)
+
+    c.append(cirq.measure(*input_qubits, key='result'))
+
+    return c
+
+
+def main():
+    input_qubits = set_io_qubits(2)
+
+    oracle = debug_oracle(input_qubits)
+
+    circuit = make_grover_circuit(input_qubits, oracle)
+    print('Circuit:')
+    print(circuit)
+
+if __name__ == '__main__':
+    main()
+
+ +

I add c.append(oracle) three times in make_grover_circuit. However, when I print the circuit, it seems there is only one oracle. Is it a bug? Or just I can't .append my oracle more than once? Here is my result of the program.

+ +
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 /Users/a123/Desktop/Cirq/test.py
+Circuit:
+(0, 0): ───H───M('result')───
+               │
+(1, 0): ───────M─────────────
+
+Process finished with exit code 0
+
+",12120,,55,,5/24/2020 10:48,7/23/2020 19:08,Can't append multiple times with self-defined oracle,,1,0,,,,CC BY-SA 4.0 +12137,1,12150,,5/22/2020 20:00,,3,322,"

I'm trying to implement an efficient circuit for the Szegedy quantum walk on a cyclic graph with number of nodes N = 8. I found the circuit in this thesis (page 39), the two images below show graph and circuit. I've already wrote the code using Qiskit.

+ +

+

+ +

The problem I am facing is how to perform a step, so how to pass as input the superposition of qubits that represents my current position and how to retrieve the next possible positions.

+ +

As suggested in the reference for the current position I'm using as state vector|$\phi_{0}\rangle = [0,\frac{1}{\sqrt{2}},0,...,0,\frac{1}{\sqrt{2}}]^{T}$ that is the column in the transition matrix P that represents node 0 then considering a state |x,y$\rangle$ as a state for the Szegedy QW I place the vector $|\phi_{0}\rangle$ in position x expecting the output in y.

+ +

To construct the vector |$\phi_{0}\rangle$ I am using an Hadamard gate and some C-NOT gates in sequence This simulation in Quirk explains better what I said before showing what I am trying to do. I don't know if I am making any serious theoretical mistakes but the results doesn't make so much sense.

+",12121,,55,,5/23/2020 13:46,5/23/2020 17:22,Quantum circuit for Szegedy quantum walk on a cyclic graph,,1,1,,,,CC BY-SA 4.0 +12138,1,12146,,5/22/2020 20:05,,4,221,"

This is a fairly broad question, I hope it fits here. I am wondering if the BB84 protocol is an example of ""quantum supremacy"", ie. something a quantum computer can do but something that is assumed a classical computer cannot do the equivalent of. Are there any classical algorithms that can allow for the equivalent of secure key distribution as accomplished through BB84, with unconditional security proof? If not, what would it mean if there did exist such protocol?

+",10023,,55,,5/24/2020 10:48,6/28/2022 19:03,"Is the BB84 protocol an example of ""quantum supremacy""?",,1,1,,,,CC BY-SA 4.0 +12139,2,,12136,5/22/2020 21:16,,1,,"

The issue is that you are using the result of a generator method multiple times:

+
def gen():
+    yield 1
+g = gen()
+print(list(g))  # prints [1]
+print(list(g))  # prints []
+
+

This is a common mistake to make in Python. The solution is to store a list of the items instead of the generator:

+
def gen():
+    yield 1
+
+gen_items_safe_to_reuse = list(gen())
+
+",119,,119,,6/23/2020 18:05,6/23/2020 18:05,,,,0,,,,CC BY-SA 4.0 +12140,2,,12101,5/22/2020 23:57,,1,,"

The basis $| e_k\rangle$ is complete, and quantum operations that take the form in your question are indeed always trace-preserving. Non-trace-preserving quantum operations are associated with measurements, which cannot be straightforwardly described by the unitary time evolution assumed in your question.

+ +

In the Copenhagen interpretation, it's just postulated that measurement processes aren't unitary, so the unitary time evolution assumed in your question doesn't apply. In the many-worlds interpretation, all time evolution is unitary, and any apparent non-unitarity from measurement processes just means that you aren't considering the full wave function of the universe, which allows superpositions large enough to encompass the observer. In this interpretation, if you need to use a non-trace-preserving quantum operation to describe the time evolution of your system, then you didn't actually purify your environment Hilbert space ""large enough"" to capture the rest of the universe, including yourself - because if you had, then you'd get time evolution of the form described in your question, which as you point out must be trace-preserving.

+",551,,551,,5/23/2020 13:25,5/23/2020 13:25,,,,0,,,,CC BY-SA 4.0 +12141,1,,,5/23/2020 3:51,,1,40,"

Is it possible to use built-in qiskit.chemistry tools, such as VQE, UCCSD, etc., without using the notion of spins ('alpha'/'beta')?

+ +

Let's say, I want to decsribe a system having 5 fermionic modes in the second-quantized formalism. I want to start from a state in which 3 of them are occupied. I can provide a second-quantized Hamiltonian written in terms of $h_1$ and $h_2$ coefficients and ladder operators.

+ +

How do I do all that?

+",6313,,55,,5/24/2020 10:49,5/24/2020 10:49,How to ignore spins is Qiskit chemistry package?,,0,0,,,,CC BY-SA 4.0 +12142,2,,12130,5/23/2020 4:13,,3,,"

You can base your code on this Q# sample, adjacent to the one you've been looking at.

+ +
+ +

The simplest thing is generating random bits 0 or 1 that are perfectly correlated; you can do that using Bell state $|\Phi^+\rangle$:

+ +
operation GenerateCorrelatedRandomNumbers () : (Int, Int) {
+    // Allocate two qubits
+    using ((q1, q2) = (Qubit(), Qubit()))  {
+        // Prepare Bell state (|00⟩ + |11⟩) / sqrt(2) on them
+        H(q1);
+        CNOT(q1, q2);
+        // The measurement results are going to be correlated: you get 0,0 in 50% of the cases and 1,1 in 50%
+        return (MResetZ(q1) == Zero ? 0 | 1, 
+                MResetZ(q2) == Zero ? 0 | 1);
+    }
+}
+
+@EntryPoint()
+operation SampleCorrelatedRandomNumbers () : Unit {
+    for (i in 1 .. 10) {
+        Message($""{GenerateCorrelatedRandomNumbers()}"");
+    }
+}
+
+ +

This will give you

+ +
(0, 0)
+(1, 1)
+(1, 1)
+...
+(0, 0)
+
+ +
+ +

If you want the bits to be perfectly anti-correlated, you can use the state $|\Psi^+\rangle$:

+ +
    using ((q1, q2) = (Qubit(), Qubit()))  {
+        // Prepare Bell state (|10⟩ + |01⟩) / sqrt(2) on them
+        H(q1);
+        CNOT(q1, q2);
+        X(q1);
+        // The measurement results are going to be correlated: you get 0,1 in 50% of the cases and 1,0 in 50%
+        return (MResetZ(q1) == Zero ? 0 | 1, 
+                MResetZ(q2) == Zero ? 0 | 1);
+    }
+
+ +
+ +
    +
  • If you want your bits to still be correlated but yield outcomes with different probabilities than 50%/50%, you can use a rotation gate Ry instead of H to prepare a state $\alpha |00\rangle + \beta |11\rangle$ - that will give you (0,0) with probability $\alpha^2$ and (1,1) with probability $\beta^2$ (you don't need to use complex coefficients if you only care about simple measurement probabilities).
  • +
  • If you want your bits to be correlated strongly but not perfectly, you can prepare a superposition of all basis states with different amplitudes - for example, something like $\frac{1}{\sqrt{20}}(3|00\rangle + |01\rangle + |10\rangle + 3|11\rangle)$ will give you equal bits in 90% of the cases and distinct bits in 10% of the cases.
  • +
  • You can learn more about Q# programming and preparing quantum states using Q# in the Quantum Katas - the first set of tutorials and exercises focuses on the basic constructs like allocating qubits and applying gates and preparing states on them.
  • +
+ +
+ +

To address the updated question:

+ +

You can allocate two registers of 7 qubits each to generate pairs of 7-bit integers (up to 128), entangle qubits of two registers between themselves to force correlations that you want, similar to how I've shown in the preparation of Bell state, and filter out the generated numbers that end up being greater than 100, as shown in the code in your question. To generate a 1000 pairs, you can call the Q# code from classical driver multiple times and aggregate the results; this might be better than doing it in Q#, since then you'll be able to use Python libraries to analyze and visualize the correlations nicely.

+ +

I'm not providing the code here, as I believe you have all the pieces to build it yourself, and such an exercise will be very beneficial.

+",2879,,2879,,5/24/2020 0:26,5/24/2020 0:26,,,,2,,,,CC BY-SA 4.0 +12143,1,,,5/23/2020 6:02,,4,161,"

In their original paper (last part of the paper), Abrams and Lloyd present a quantum algorithm that could potentially efficiently solve NP complete problems (in linear time). Their algorithm, robust to small errors, depends on the possible implementation of a nonlinear OR gate. A short presentation can be found here .

+ +

Classical irreversible logical  gates can be simulated by unitary gates that involve some ancillary qubits, as can be seen here and here.

+ +

Question. What exactly is the reason why the Abrams - Lloyd algorithm does not allow implementation using unitary gates and ancillary qubits?

+ +

Note that these ancillary qubits can be set and measured when necessary, during the operation of the algorithm, and these operations introduce nonlinearity into the state evolution.

+",10110,,9006,,5/24/2020 7:14,6/9/2020 5:06,What exactly is the reason why the Abrams - Lloyd algorithm does not allow implementation using unitary gates and ancillary qubits?,,1,10,,,,CC BY-SA 4.0 +12144,2,,11770,5/23/2020 7:32,,2,,"

The idea of squeezing arises when discussing the state of a quantum harmonic oscillator (e.g. a bosonic system). Such systems differ from simpler qudit systems in that, even when only a single mode is being considered, the system is infinitely dimensional.

+ +

A common way to describe these systems is via pairs of non-commuting observables, often the ""position"" and ""momentum"" operators $\hat x$ and $\hat p$. For an arbitrary pair of observables $\hat A,\hat B$, the corresponding uncertainties are bounded by $\sigma_A^2\sigma_B^2\ge\frac14|\langle[A,B]\rangle|^2$. +Whenever a state is such that $\sigma_A<\frac12|\langle[A,B]\rangle|$ (or the same holds for $\sigma_B$) we talk of a squeezed state.

+ +

More formally, a squeezed state can be written by having a squeezing operator $$S(\xi)\equiv\exp\left[\frac12(\xi a^{\dagger 2}-\xi^*a^2)\right],\quad \xi\in\mathbb C$$ act on some other state. For example, squeezed vacuum states have the form $S(\xi)|0\rangle$.

+ +

The higher the amount of squeezing, the more the uncertainty of one observable is smaller and the other one is larger. This can be pictured in the phase-space representation of the state as a stretching of the function in some direction.

+ +

The limit of infinite squeezing corresponds to the uncertainty of one observable being zero and the other one being infinite. Think position eigenstates corresponding to infinite uncertainty over the momentum. +Now, are such states physical? Not really: you can never generate a really infinitely-squeezed state. But one can generate enough squeezing that in a given application you can simplify the model by assuming infinite squeezing. It's just an approximation, which can be useful depending on the circumstances. +See this review to read more about squeezing.

+",55,,,,,5/23/2020 7:32,,,,5,,,,CC BY-SA 4.0 +12146,2,,12138,5/23/2020 13:52,,5,,"

This is an interesting question that reflects a conflation of some concepts in quantum information sciences. TL/DR - there is no task in BB84 that corresponds to what we when we speak of quantum computation, so BB84 is not evidence of what researchers mean when they speak of "quantum supremacy". But historians will likely still consider the initial hardware implementing BB84 as a sort of quantum advantage, in much the same way that the "Enigma" machine is a bit of a precursor to an (electronic) computer.

+

In more detail, lately there's been a push to ask for and discuss evidence of "quantum computational supremacy", with an emphasis on "computation". Adding the word "computational" into the phrase is seen as a means to move away from the loaded phrase "quantum supremacy."

+

However, this also helps to emphasize that quantum computers may do computational tasks much faster than classical computers. Indeed, this appears to be the sense in to which Preskill referred when coining the phrase.

+

That is, a key aspect of a programmable quantum computer is the ability to fully explore much of the Hilbert space afforded it. This means that a programmable quantum computer having $n$ qubits can prepare the qubits into a superposition in a Hilbert space of dimension $2^n$ - e.g., exponential in the number of qubits.

+

Turning to BB84, the BB84 scheme in quantum cryptography does not use any entanglement, and Alice and Bob (and Eve) only work on product states of the $n$ photons traded therebetween. The dimension of their Hilbert space only grows linearly with the length of the secret key. There is no computation in the BB84 quantum key exchange. Similarly, although E92 uses entangled Bell pairs, the Hilbert space dimension of E92 still only grows linearly with the number of qubits exchanged.

+

The information-theoretical security of BB84 is contingent on the uncertainty principle - which can be recast as a purely classical phenomenon. However, that's not to say that BB84 is not using a uniquely quantum resource - indeed, Alice provides Bob with quanta of light (photons.) This does seem unique and different from that of, for example, classical one-time pads (OTPs.)

+

Added

+

In his 1989 article for New Scientist describing the prototype quantum key distribution device that implemented BB84, David Deutsch exclaimed that Bennett, Smolin, and friends who built the machine:

+
+

...have created the first information processing device with capabilities that exceed those of the Universal Turing Machine. This is a theoretical model proposed by the English mathematician Alan Turing in 1936... The lasting significance of [the BB84 scheme] will be for the foundations of computer science. The Turing machine is no longer a universal model for practical computations. (Emphasis added)

+
+

Thus from Deutsch's 1989 perspective espoused above, devices that implement the BB84 protocol are certainly post-classical, but from the narrower interpretation as used since, e.g., Preskill's 2012 paper the BB84 machines don't explore the entanglement frontier and hence may not be deemed evidence of quantum supremacy.

+",2927,,2927,,6/28/2022 19:03,6/28/2022 19:03,,,,0,,,,CC BY-SA 4.0 +12147,1,,,5/23/2020 15:29,,4,100,"

I would like to know more about quantum simulations, so as to start on a few standard physical models (maybe particle in a box, harmonic oscillator, etc.) and then build up on more complex things. But I find that the literature on this subject seems a bit scattered all over the place. I only know some guide lines, I know that I have to look into trotterization, VQE and (maybe?) QAOA. But is there a ""place"" or book that compiles all of it?

+",5620,,,,,8/8/2020 5:38,Resource recommendation on quantum simulations,,1,0,,,,CC BY-SA 4.0 +12148,1,12156,,5/23/2020 17:03,,3,387,"

I recently listened to a presentation for Introductory Quantum Computing. It was very general and meant to give the listeners an idea about the potential for Quantum Computing.

+ +

The speaker ended the talk with a kind of ""On the Other Hand"" talking point by mentioning that some people are concerned that the noise in Quantum Computers will grow at such a rate that limits their overall potential.

+ +

I was wondering if anyone on this channel has any experience with this issue or knowledge about it? Is this a theoretical limit of physics of an engineering problem? What is the current state of thinking about this issue and do recent breakthroughs in Quantum Error Correction do anything to address it?

+",12050,,55,,8/27/2020 12:56,8/27/2020 12:56,Exponential Growth of Noise in Quantum Computers,,1,0,,,,CC BY-SA 4.0 +12150,2,,12137,5/23/2020 17:22,,2,,"

It's been a long while since I've looked at my thesis, so a lot of my knowledge is pretty rusty, but here goes.

+ +

If you're looking for the circuit representation of $C_8$, here's the Quirk simulation for it. The first two columns prepare the state $|\phi_0\rangle = \frac{1}{\sqrt{2}}(|001\rangle+|111\rangle)$ in big-endian order (the dominant convention years back), which in Quirk is $\frac{1}{\sqrt{2}}(|100\rangle+|111\rangle)$ because it uses little-endian order.

+ +

One important difference from your Quirk simulation is that only 6 qubits are needed, 3 for each register. The circuit shown in the figure was meant to display the generic circuit for any $N=2^n$ (it looks like it was missing a few vertical dots to between the second and third qubits of each register to denote the generalisation), not $N=2^3=8$ specifically. Note also how the L (left-rotation) and R (right-rotation) operators are defined.

+ +

To make sense of the results, the qualitative way of looking at this is that the initial state $|\psi_0\rangle=|0\rangle|\otimes|\phi_0\rangle$ means that we start at the vertex 0 on the graph $C_8$, with a half-half mixture of the edge states on said vertex. So when we propagate the edge states, we'd expect the amplitudes to shift to the adjacent vertices $|100\rangle$ and $|111\rangle$ (in little-endian) after one time-step. Measuring the probability of being on a particular vertex is done by measuring the probability distribution over the first register of qubits (the first 3 in this instance). From the output of the Quirk circuit, we see a 50% probability on the adjacent vertices, which matches the expectation.

+ +

We can also inspect this analytically. +The Szegedy operator is defined as $U_{walk}=S(I-2\Pi)$, where the swap operator $S$ acts as $S|i,j\rangle=|j,i\rangle$, and $\Pi=\sum_{i=0}^{N-1}|\psi_i\rangle\langle\psi_i|=\sum_{i=0}^{N-1}(|i\rangle\otimes|\phi_i\rangle)(\langle i|\otimes\langle\phi_i|)$. +With the initial state $|\psi_0\rangle=|0\rangle|\otimes|\phi_0\rangle$, and given that $\langle\psi_i|\psi_j\rangle=\delta_{i,j}$, it can be easily shown that $U_{walk}|\psi_0\rangle=-|\phi_0\rangle\otimes|0\rangle$, which matches the qualitative expectation, and the Quirk circuit output.

+ +

I hope that helps! :)

+ +

-Thomas

+",12130,,,,,5/23/2020 17:22,,,,1,,,,CC BY-SA 4.0 +12151,2,,11650,5/23/2020 19:52,,3,,"

This is at least NP hard. The basic problem is that the circuit can encode things like ""if the first N qubits encode a computational basis solution to the hard-coded 3-SAT problem X then apply Hadamards to the remaining qubits, otherwise do nothing"". Deciding whether such a circuit is classical-ish requires determining if the 3-SAT problem it encodes is satisfiable or not.

+",119,,119,,5/23/2020 22:00,5/23/2020 22:00,,,,0,,,,CC BY-SA 4.0 +12152,1,,,5/23/2020 20:11,,2,258,"

According to bloch sphere interpretation, any point on the surface of the sphere corresponds to a pure state and any point inside the sphere corresponds to a mixed state. Suppose you have a point inside the bloch sphere C corresponding to a mixed state. Draw a ray connecting C and origin O of the bloch sphere. Now extend this ray OC such that we get some point C' on the surface of the sphere. Now C' = cC for which c is a real number. +

+ +

So can we say that the mixed state corresponding to point C when normalized becomes a pure state? Or is there a problem with this logic?

+",7943,,55,,5/24/2020 10:51,12/5/2020 15:12,Does normalizing a mixed state give a pure state?,,2,1,,,,CC BY-SA 4.0 +12153,2,,12152,5/23/2020 21:10,,1,,"

An arbitrary one qubit density matrix $\rho$:

+ +

$$\rho = \begin{pmatrix} \rho_{00} & \rho_{01} \\ \rho_{10} & \rho_{11}\end{pmatrix} = \frac{I + \vec{r} \cdot \vec{\sigma}}{2}$$

+ +

where $\vec{r} \cdot \vec{\sigma} = r_x \sigma_x + r_y \sigma_y + r_z \sigma_z$, $\sigma$s are Pauli matrices, $r$ is the corresponding vector for the density matrix in the Bloch sphere.

+ +

The probability of measuring $|0\rangle$ state is equal to $\rho_{00}$ and the probability of measuring $|1\rangle$ state is equal to $\rho_{11}$. Thus, the normalization of the probabilities of measuring $|0\rangle$ or $|1\rangle$ states for the density matrix corresponds to the statement $Tr(\rho) = \rho_{00} + \rho_{11} = 1$. In this sense it is already a normalized state if $Tr(\rho) = 1$, but still the vector $\vec{r}$ in the Bloch sphere formalizm will be inside the sphere for a mixed state.

+ +

I am not sure how the action described in the question can be related to the normalization, because both mixed (inside the sphere) and pure (on the sphere) states should be normalized.

+",9459,,9459,,5/24/2020 11:16,5/24/2020 11:16,,,,0,,,,CC BY-SA 4.0 +12154,1,12155,,5/24/2020 0:56,,3,378,"

How can I plot custom labels for specific qubits on the left and right side similar to the picture shown here (A, B, Sum ...):

+ +

+",,user12136,55,,5/25/2020 9:20,5/25/2020 9:20,How to plot custom labels for quantum registers in Qiskit?,,1,1,,,,CC BY-SA 4.0 +12155,2,,12154,5/24/2020 5:51,,3,,"

A partial answer.

+ +

How to customize the labels of QuantumRegisters:

+ +
from qiskit import *
+
+red_qubit = QuantumRegister(1,'red')
+blue_qubit = QuantumRegister(1, 'blue')
+green_qubit = QuantumRegister(2, 'green')
+
+circuit = QuantumCircuit(red_qubit, blue_qubit, green_qubit)
+
+circuit.h(red_qubit[0])
+circuit.x(blue_qubit[0])
+circuit.x(green_qubit[0])
+circuit.cx(red_qubit[0], blue_qubit[0])
+circuit.cx(red_qubit[0], green_qubit[0])
+circuit.cx(red_qubit[0], green_qubit[1])
+
+%matplotlib inline
+circuit.draw(output=""mpl"")
+
+ +

The output:

+ +

+",9459,,9459,,5/24/2020 6:20,5/24/2020 6:20,,,,0,,,,CC BY-SA 4.0 +12156,2,,12148,5/24/2020 7:24,,4,,"

According to so-called threshold theorem, it is possible to get rid of errors in quantum computation with arbitrary precision. However, there is an assumption that you have enough qubits.

+ +

To ilustrate the idea, you can encode one qubit $|q\rangle=\alpha|0\rangle+\beta|1\rangle$ with more qubits, for example $|q\rangle=\alpha|0000\rangle+\beta|1111\rangle$ and after calculation, based on majority rule, to decide about result.

+ +

As you can see, you need high number of qubits to found and correct errors which is a main obstacle in current quantum computers having only few qubits. E.g. IBM Tokyo proccesor has 20 qubits and a processor with 53 qubits is planned. Publicly available processors have even less qubits, e.g. 5 qubits - IBM Q or less - 2 qubits on 2-spin Quantum Inspire processor.

+ +

To conclude, it is possible to reduce noise but we need more qubits. Increasing number of qubits would theoretically leads to quantum processor with no (or at least low level) noise.

+",9006,,,,,5/24/2020 7:24,,,,0,,,,CC BY-SA 4.0 +12157,2,,12152,5/24/2020 8:40,,3,,"

Bloch vector $\vec{v}$ of a density matrix +$$ +\rho_C = \frac{1}{2}(I + \vec{v}\cdot\vec{\sigma}) +$$ +can be shorter than 1 i.e. $|\vec{v}| \le 1$, when the the density matrix represents a mixed state.

+ +

If you normalize it $\vec{n} = \vec{v}/|\vec{v}|$ then you will get the density matrix of the C' pure state +$$ +\rho_{C'} = \frac{1}{2}(I + \vec{n}\cdot\vec{\sigma}). +$$

+ +

When it comes to interpretations, I don't know of any simple relation between C and C' like e.g. measurements of C won't bring you to C.

+",12140,,,,,5/24/2020 8:40,,,,0,,,,CC BY-SA 4.0 +12159,2,,10264,5/24/2020 12:44,,2,,"

Not quite. Consider the following no-signalling distribution $PR_1$ which I will write in the form

+ +

$$ +\begin{pmatrix} +p(00|00) & p(01|00) & p(00|01) & p(01|01) \\ +p(10|00) & p(11|00) & p(10|01) & p(11|01) \\ +p(00|10) & p(01|10) & p(00|11) & p(01|11) \\ +p(10|10) & p(11|10) & p(10|11) & p(11|11) \\ +\end{pmatrix}, +$$ +$$ +PR_1 = \begin{pmatrix} +1/2 & 0 & 1/2 & 0 \\ +0 & 1/2 & 0 & 1/2 \\ +1/2 & 0 & 0 & 1/2 \\ +0 & 1/2 & 1/2 & 0\\ +\end{pmatrix}. +$$ +This distribution has $E_{00} = E_{01} = E_{10} = - E_{11} = 1$ and so achieves the algebraic maximum of $4$ of the CHSH expression as you write it in the question. Now consider another no-signalling distribution $PR_2$, derived from $PR_1$ by relabelling the inputs of Alice ($x \mapsto x + 1 \mod 2$), i.e. +$$ +PR_2 = \begin{pmatrix} +1/2 & 0 & 0 & 1/2 \\ +0 & 1/2 & 1/2 & 0 \\ +1/2 & 0 & 1/2 & 0 \\ +0 & 1/2 & 0 & 1/2 \\ +\end{pmatrix}. +$$ +$PR_2$ is another no-signalling distribution that is not local $PR_2 \notin \mathcal{L}$ -- (sketch) the local set is closed under relabellings of inputs/outputs, $PR_2$ is a relabelling of $PR_1$ (and vice versa) and $PR_1 \notin \mathcal{L}$. Now $PR_2$ results in the expectation values $E_{00} = 1, E_{01} = -1, E_{10} = 1, E_{11} = 1$ and so $E_{00} + E_{01} + E_{10} - E_{11} = 0$. Therefore, we have found a distribution that cannot be explained by a local model but nevertheless satisfies the CHSH inequality.

+ +

We can however still get a converse statement by including relabelled versions of the CHSH inequality. Suppose a no-signalling distribution $p$ satisfies all of the following inequalities +$$ +\begin{aligned} +|E_{00} + E_{01} + E_{10} - E_{11}| &\leq 2 \\ +|E_{10} + E_{11} + E_{00} - E_{01}| &\leq 2 \\ +|E_{01} + E_{00} + E_{11} - E_{10}| &\leq 2 \\ +|E_{11} + E_{10} + E_{01} - E_{00}| &\leq 2 +\end{aligned} +$$ +then $p \in \mathcal{L}$. In other words $\mathcal{L}$ has $8$ non-trivial facets.

+",9854,,9854,,5/24/2020 12:54,5/24/2020 12:54,,,,7,,,,CC BY-SA 4.0 +12160,1,12165,,5/24/2020 16:29,,1,60,"

I have already made a small Q# program and ran it using Python on VSCode, my question is how can I run it on Azure Quantum to make it run faster?

+ +
    +
  • Q# program :

    + +
    namespace QubitTest {
    +open Microsoft.Quantum.Convert;
    +open Microsoft.Quantum.Math;
    +open Microsoft.Quantum.Measurement;
    +open Microsoft.Quantum.Canon;
    +open Microsoft.Quantum.Intrinsic;
    +
    +operation QChange() : Int {
    +// on retourne un qubit   
    + using ( q = Qubit()) {
    + for (i in 1..500000){
    +     H(q);
    +     Message($"" Qubit {i} : {q}"");
    + }
    + return 0;
    + }
    +}
    +
    +}
    +
  • +
  • Python Simulation :

    + +
     import qsharp
    +
    + from QubitTest import QChange 
    +
    + QChange.simulate()
    +
  • +
+",12137,,9006,,5/25/2020 7:52,5/25/2020 8:38,How can I run Q# program in Azure Quantum,,1,0,,,,CC BY-SA 4.0 +12161,1,,,5/24/2020 19:50,,5,894,"

I can't seem to wrap my head around the suzuki-trotter formula. I have seen This answer but I am still confused of the applicability of the formula. Let me explain:

+ +

As I understand it Trotterization lets us use directly the Schrodinger equation $|\psi(t)\rangle = e^{-i H t} |\psi(0)\rangle$ where we approximate $e^{-iHt}=e^{\sum_k H_kt}\approx \bigg(\prod_k e^{-iH_k\Delta t}\bigg)^N$ where $\Delta t=t_{final}/N$. This is formula is approximate to $O(\Delta t^2)$ and we can get further precision if we consider more terms in the expansion with the commutators. In sum, we have a way to get $|\psi(t)\rangle$ from an initial state. But now let's get a familiar physical model to apply this to: the Harmonic oscillator. Then our Hamiltonian is (in 1 dimension):

+ +

$$ +\hat{H}=\frac{\hat{P}^2}{2m}+\frac{1}{2}m\omega^2\hat{X}^2 +$$

+ +

if we want to evolve this system we can do so in a position or momentum basis, so that the $\hat X$ operator will just be a diagonal matrix in our discrete space and $\hat P$ will also be diagonal given that we express it as $\hat X$ wrapped around the Fourier transform as $\hat P=\hat{(QFT)}\hspace{1mm}\hat X \hspace{1mm}\hat{(QFT)}^{-1}$. So we clearly have a way to study the system. Another way is to express in terms of the creation and destruction operators $A$ and $A^\dagger$, so that our Hamiltonian can be written as $\hat H=\hat A \hat A^\dagger +\hat I/2$. These operators can be easily be constructed from the position and momentum basis. Normally in a physical system we don't know how to diagonalize a priori our Hamiltonian but in this case we can.

+ +

Having said this, here's what I don't get:

+ +
    +
  1. Suppose we start with the position basis and our goal is to measure the energy spectrum. In order to do so we could make use of the kickback phase and the phase estimation circuit to know this given that our initial state was already an eigenstate of the Hamiltonian, but how could we know this beforehand? In this case, we could have since its a simple model, but usually we don't, there had to be some state preparation and then evolve it in time, and if that's the case, then this render the algorithm useless.
  2. +
  3. Another way to view this would be to start with some state that was not an energy eigenstate of the Hamiltonian in the position basis. But how would that be useful?
  4. +
  5. Then we can look at the energy basis and we can work on that to evolve our system and check its final state, and go again through some phase kickback and estimation to know the eigenvalue, but again, this assumes some state preparation that was already known that it was an eigenstate.
  6. +
+ +

I know I am wrong but I just can't see the applications due to my lack of experience. I also reckon that if my goal was to find the energy spectrum I would better off with the VQE (even though I haven't studied it yet). What are the practical uses of the Trotter formula?

+ +

PS: I have looked into these papers for the harmonic oscillator application:

+ +

DOI: 10.13140/RG.2.2.18996.81284

+ +

DOI: 10.1109/NYSDS.2018.8538959

+",5620,,8787,,4/19/2022 14:51,4/19/2022 17:34,What is the usefulness of the Suzuki-Trotter formula?,,1,1,,,,CC BY-SA 4.0 +12162,1,,,5/25/2020 2:06,,3,303,"

I want to measure the depth of a circuit, but I do not know which quantum gates should be used when the circuit is decomposed. For example, $ZZ$ rotation (i.e. $e^{i\theta \sigma_z^i\sigma_z^{i+1}}$) can be decomposed as $\text{CNOT}\,R_z(\theta)\,\text{CNOT}$. So, I think the depth of $ZZ$ rotation is 3. However, if $ZZ$ rotation gate exists, then the depth should be 1.

+ +

My question is as follows: Which gate set should be used when I measure the depth of a circuit?

+",9894,,55,,9/9/2020 20:44,9/9/2020 20:44,Which gate set should be used when I measure the depth of a circuit?,,2,0,,,,CC BY-SA 4.0 +12163,2,,12162,5/25/2020 2:23,,8,,"

There's no universal convention. Normally there will be some context that suggests a gate set to use (e.g. you plan to run on certain hardware that only supports certain gates, or you plan to use a particular error correcting code where certain gates are transversal).

+",119,,,,,5/25/2020 2:23,,,,0,,,,CC BY-SA 4.0 +12164,2,,12162,5/25/2020 6:52,,2,,"

As the above answer mentioned depending on hardware it varies. It can be verified on Qiskit and cirq as they both support depth view, try comparing there standards.

+",8588,,,,,5/25/2020 6:52,,,,0,,,,CC BY-SA 4.0 +12165,2,,12160,5/25/2020 8:38,,1,,"

Azure Quantum is in private preview right now. You can sign up to request early access here.

+",2918,,,,,5/25/2020 8:38,,,,0,,,,CC BY-SA 4.0 +12168,1,,,5/25/2020 12:19,,2,205,"

I am trying to implement the 4-qubit example outlined in showed in section 3 of the qiskit tutorial on the HHL algorithm. Does anyone know what are the 2 angles that the Ry gate needs to be applied with? They say what the values of C and the approximated values of the eigenvalues are ($\tilde {\lambda_1}$ and $\tilde {\lambda_2}$), but they don't mention the rotation angles. Are they just $\theta_1 = \arccos(\frac{C}{\tilde {\lambda_1}})$ and $\theta_2 = \arccos(\frac{C}{\tilde {\lambda_2}})$ ?

+",11979,,10480,,1/30/2021 6:51,1/30/2021 6:53,Angles of rotation in HHL example,,1,0,,,,CC BY-SA 4.0 +12169,2,,12078,5/25/2020 12:26,,5,,"
+

What is preventing us from solving real world problems, defined in terms of Hamiltonian simulation, on currently available quantum computers?

+
+ +

Short answer: it depends on the ""real world problem"" considered, but one or several of qubit number, coherence time or gate errors.

+ +

The real answer is really problem-dependant.

+ +

Disclaimer: I am not an expert of VQE, please double or triple-check the claims I am making in the following paragraph.

+ +

For VQE and quantum chemistry applications we are mostly limited by the number of qubits available and gate errors. Quantum chemistry problems and VQE are one of the main area of research for useful problem solvable on NISQ computers, mainly because they only use Pauli gates that have some very desirable properties. One of them is the possibility to estimate $\langle \psi \vert U \vert \psi \rangle$ with direct measurements instead of indirect ones. See Methodology for replacing indirect measurements with direct measurements for more information on this.

+ +

In general, any problem that can be efficiently formulated with Pauli operators is interesting for NISQ quantum computers, thanks to the properties of Pauli operators to be able to replace a costly indirect measurement (Hadamard-test for example) with a direct measurement. For problems that are in this category, I would say that the limiting factors can be gate errors or the number of available qubits.

+ +

A few research papers have analysed the cost of simulating more complex Hamiltonians. Here are the two I am aware of:

+ +
    +
  1. Concrete resource analysis of the quantum linear-system algorithm used to compute the electromagnetic scattering cross section of a 2D target. The authors have used an automatic oracle synthesis tool but they write that

    + +
    +

    In the current state of our investigations, we believe that, even with hand-coding, these numbers could only be improved upon by a factor of 5, or + perhaps at most a factor of 10.

    +
    + +

    The overall number of gates and circuit are depicted at pages 41 and 42. The paper is really detailed and it seems like every implementation steps have been explained.

  2. +
  3. Disclaimer: I am the main author of this paper.

    + +

    Practical Quantum Computing: solving the wave equation using a quantum approach. Here the Hamiltonian is given as an Hermitian matrix and is simulated using Trotter-Suzuki formula.

  4. +
+ +

The overall results from the 2 papers above is: oracles are super-costly, mostly because of the heavy use of arithmetic subroutines. Moreover the repetition imposed by the Hamiltonian simulation algorithm to ensure a given precision $\epsilon$ is one of the reason why the number of gates is so high.

+ +

So for this kind on application, the number of qubits may or may not be a limitation depending on the problem, but the number of gates is huge and so gate errors and coherence time are the real bottleneck here.

+ +

Note also that the execution time starts to be an issue for the two previous algorithms. Even if you could execute gates in 1ns (which is absolutely not the case on current hardware, CNOTs are closer to 100-400ns), executing $10^{20}$ gates would require $10^{11}$ seconds, i.e. more than 3000 years.

+ +

Conclusion: Hamiltonian simulation is costly and depending on your specific problem you will be limited by either the number of qubits or thegate errors.

+ +

PS: I did not had the time to read the paper yet, but you might be interested in Hamiltonian Simulation Algorithms for Near-Term Quantum Hardware.

+",1386,,,,,5/25/2020 12:26,,,,0,,,,CC BY-SA 4.0 +12170,1,,,5/25/2020 12:47,,7,98,"

I'm planning to write my master thesis in quantum computing. The subject of the thesis is to find out which attributes (properties, features) of quantum algorithms respectively their implementations (circuits) are important to decide which quantum device to use. Quantum devices differ in connectivity, number of qbits, gate fidelity etc. So what kind of attributes of the algorithms would be important? Number of swap-operations? Number of ancilla bits? Breadth? Depth? Entanglement depth? ...

+ +

Here an illustrative use case:

+ +

An user has some database (e.g. phone book) and some data (number) and wants to find out if the data is a phone number and if so who it belongs to. So the user decides to use grover's algorithm and lets say IBM's Q experience. In IBM's Q experience the user can decide which device to use (Q 5 Tenerife, Q 14 Melbourne, ...). All with different properties. How should the user decide which one to use? What does it depend on? What aspects of the given algorithm contributes to the decision?

+ +

Does anybody know some good literature or papers to read, or as a starting point ? +Or good keywords to search for? +Should I look into compilers, even though papers in that direction never really name the attributes of the algorithms? +In which topic area do I have to look into?

+ +

I can't find much. And if there is no much research in that area, I guess it won't be possible to write a thesis about that.

+ +

Thanks in advance.

+ +

Best regards, +krsp.

+",12150,,55,,8/27/2020 12:56,4/23/2022 0:48,How to decide which quantum device to use if a quantum algorithm is given?,,0,1,,,,CC BY-SA 4.0 +12171,1,12184,,5/25/2020 15:32,,4,88,"

The problem of factoring large numbers may be in the so-called ""intermediate"" regime. These are problems that are in $\mathrm{NP}$, but are neither likely to be easy enough to be in $\mathrm{P}$ nor hard enough to be complete. Following Shor's algorithm and a general consensus that $\mathrm{NP}\not\subseteq\mathrm{BQP}$, focus quickly turned to such difficult intermediate problems, with modest success. Now, a general consensus is that $\mathrm{BQP}$ and $\mathrm{NP}$ are likely incomparable, and research focus has moved a bit to problems, such as forrelation, that are in $\mathrm{BQP}$ but are not likely even in $\mathrm{NP}$ or even in any point of the polynomial hierarchy.

+ +

Nevertheless, one problem that appears to me to be in this ""intermediate"" area is that of finding small Golomb rulers.

+ +

Imagine marking a 6"" ruler only at the 1"" position and the 4"". To measure something one-inch in size, measure between the left edge and the 1"" mark; to measure something two-inches in size, measure between the 4"" mark and the right edge; to measure something three-inches in size, measure between the 3"" mark and the 4"" mark; etc. We can measure anything between one inches and six inches, with only two marks on the ruler.

+ +

Is there any hope of a quantum computer finding a large Golomb ruler? + That is, of finding a string of $0$'s and $1$'s that possess the Golomb property of not having distances measurable more than once?

+ +

Here I think of having $n=O(m^2)$ qubits, and preparing them in a uniform superposition having a fixed Hamming weight of $O(m)$ ; using the $i$'th index ($i$'th qubit) of the ruler as a way to perform a controlled rotation by $e^{i/n}$ I think would assign a random phase to all vectors but those corresponding to Golomb rulers... or something

+ +
+ +

EDIT

+ +

Upon consideration, perhaps it's best to ask for a quantum algorithm for the dual problem of generating a string on $n=O(m^2)$ qubits that has the Golomb ruler property, with a Hamming weight of $n$.

+ +

For example, a solution with $m=4$ and $n=6$ is the already-described string

+ +

$$\vert 1010011\rangle;$$

+ +

or equivalently

+ +

$$\vert 1100101\rangle;$$

+ +

a solution with $m=5$ and $n=11$ is

+ +

$$\vert 110010000101\rangle;$$

+ +

etc.

+ +

For a given length (given number of qubits $n$), what's the largest Hamming weight (largest $m$) that can be created for having the Golomb property?

+",2927,,2927,,5/26/2020 0:10,5/26/2020 0:10,Could finding Golomb rulers be in $\mathrm{BQP}$?,,1,2,,,,CC BY-SA 4.0 +12172,1,12180,,5/25/2020 16:29,,1,204,"

Recently I was learning about QFT(Quantum Fourier Transform). I was learning how QFT is applied with H and cROT gates. I was playing with QFT here. I was testing with 3-Qubit set as you can see in the link. The expression used for calculating is
+ +Note:-$[0.x_1x_2x_3...x_n] = \sum_{i=1} ^n x_i2^{-i} $. +I got the above expression from here
+As you can see from the link given above I was doing QFT on |100>, which should yield a phase of $0$ or $2\pi$ (first qubit)(calculated from the above expression) but from the simulator it is showing phase f $\pi/4$. I also did the same simulation on Qiskit, i got the same Bloch representation, the same phase for the first Qubit $\pi/4$. Now my question is why the difference? Why the difference between calculated phase and the Bloch representation in the simulators? Please help!!

+",12154,,12154,,5/25/2020 16:35,5/25/2020 19:01,QFT of 3-bit system,,1,0,,,,CC BY-SA 4.0 +12173,2,,12168,5/25/2020 16:34,,1,,"

Just to be really precise, let's take the definition of the $R_y$ gate as

+

$$ +R_y(\theta) = \exp(-i\frac{\theta}{2}Y) = \begin{pmatrix} +\cos\frac{\theta}{2} & -\sin\frac{\theta}{2} \\ +\sin\frac{\theta}{2} & \cos\frac{\theta}{2} +\end{pmatrix} +$$

+

from the Qiskit documentation, and the values from the textbook example. Then you would have to apply a $2$-controlled $R_y(\theta_1)$ by $01$ with $\theta_1 = -2\arcsin\left(\frac{3/8}{1/4}\right)$, and similarly, a $2$-controlled $R_y(\theta_2)$ by $10$ with $\theta_2 = -2\arcsin\left(\frac{3/8}{1/2}\right)$.

+",4223,,10480,,1/30/2021 6:53,1/30/2021 6:53,,,,2,,,,CC BY-SA 4.0 +12176,1,12182,,5/25/2020 17:06,,0,106,"

Assume my function Qiskit receives a certain circuit as an input. How do I check if this circuit already has some measurements appended to it? If so, how can I modify them? For example, if there are measurements on certain qubits, I would like to remove those in order to add some more gates, and then add the measurement of all qubits.

+",6313,,5955,,5/25/2020 19:33,5/25/2020 19:38,Modifying measurements in a Qiskit circuit,,1,0,,,,CC BY-SA 4.0 +12177,1,12178,,5/25/2020 17:21,,3,258,"

From the VQE paper they claim that a Hamiltonian can be expressed as a polynomial series of pauli operators (equation 1).

+ +

While coding up VQE from scratch I made a function which would allow me to specify coefficients up to 2nd order to build the corresponding Hamiltonian (for 1 qubit).

+ +

But I noticed that $\sigma_y\sigma_z$ is in fact not hermitian, and so it doesn't give me purely real energy eigenvalues.

+ +

So is it not true the other way around? Can I not specify an arbitrary polynomial series of Pauli operators such that the result is a Hamiltonian for a closed system?

+ +

EDIT

+ +

See the accepted answer. I actually misunderstood the equation in the paper, not realising that the higher order terms were actually tensor products and only applicable to more-than-single-qubit systems.

+",10485,,10485,,5/25/2020 19:22,5/26/2020 7:00,VQE: Can I build a non-hermitian Hamiltonian with just Pauli matrices?,,1,4,,,,CC BY-SA 4.0 +12178,2,,12177,5/25/2020 17:43,,2,,"

The Hamiltonian of the closed system is by definition a Hermitian operator. A quote from M. Nielsen and I. Chuang textbook page 82:

+ +
+

Postulate 2': The time evolution of the state of a closed quantum system is + described by the Schrödinger equation,

+ +

$$i \hbar \frac{d |\psi\rangle}{dt} = H |\psi\rangle$$

+ +

In this equation, $\hbar$ is a physical constant known as Planck’s constant whose value must be experimentally determined. The exact value is not important to us. In practice, it is common to absorb the factor $\hbar$ into $H$, effectively setting $\hbar$ = 1. $H$ is a fixed Hermitian operator known as the Hamiltonian of the closed system.

+
+ +

The operator $\sigma_y \otimes \sigma_z$ is Hermitian, because $(\sigma_y \otimes \sigma_z)^\dagger = \sigma_y^{\dagger} \otimes \sigma_z^{\dagger} = \sigma_y \otimes \sigma_z$

+ +

For decomposing the Hamiltonian matrix into the sum of Pauli terms look in this thread.

+ +

About non-Hermitian Hamiltonians (they are not conventional Hamiltonians) can be found in this answer.

+",9459,,9006,,5/26/2020 7:00,5/26/2020 7:00,,,,4,,,,CC BY-SA 4.0 +12179,1,12181,,5/25/2020 18:01,,1,105,"

Looking at the single-qubit, toy example of VQE it's pretty much trivial that arbitrary X and Y rotations are sufficient to cover all of state space for our toy system.

+ +

Unfortunately, the toy example doesn't do enough to illustrate to me why it would be any harder to do the same for a larger system. So in what situations is it hard to find an ansatz?

+ +

EDIT

+ +

After reading through some of the resources from the accepted answer I came up with a response that works best for me:

+ +
    +
  • The number of parameters required to describe all possible states of an n-qubit quantum system scales exponentially with n.
  • +
  • So an ansatz which can cover all possible states would need an exponential number of parameters. And that just won't do because:

    + +
      +
    • We'd then need a classical optimistion algorithm which can search through an exponentially large parameter space.
    • +
    • We'd need an exponential number of gates to actually prepare the state (certainly not good for a NISQ device with short coherence times).
    • +
  • +
  • So we actually need to be able to find ansatzes who's parameters grow at most polynomially with the size of the system. But then of course, we can't cover all states.

  • +
  • So then the challenge is in balancing the tradeoff between keeping the number of ansatz parameters small, but still being confident that the spanning space of the ansatz covers our ground state.

  • +
+",10485,,10485,,5/26/2020 12:00,5/26/2020 12:00,In which situations is it hard to find an ansatz?,,1,2,,,,CC BY-SA 4.0 +12180,2,,12172,5/25/2020 19:01,,2,,"

I think this is an issue of endianness of input. The Wikipedia article follows Nielsen & Chuang convention which assumes that both input and output are in big endian: the top wire has the most significant bit of the number. You can see the manually implemented circuit and the corresponding amplitudes - the phase is non-zero only on the 3rd qubit, $|0\rangle + e^{2\pi i [0.100]}|1\rangle$.

+ +

The library implementation in Quirk uses little-endian notation, so it's processing an input $|001\rangle$, and the phases of all three qubits are non-zero.

+",2879,,,,,5/25/2020 19:01,,,,1,,,,CC BY-SA 4.0 +12181,2,,12179,5/25/2020 19:08,,1,,"

If you haven't read the Qiskit chapter on Simulating Molecules Using VQE yet, that's a good place to start. There's also a related response to a similar question here, which you might find helpful.

+ +

If you want to see an example of a problem that researchers are actively dealing with, you might try reading up on the ongoing progress around FeMoco simulation. A better understanding of this molecule could drastically reduce the energy cost of fertilizer production (which is about 1.2% of worldwide energy consumption), so it's a very attractive target for quantum computing.

+ +

This paper from Google was a significant advance in that effort, and it has a good introduction section that should give you a sense of the challenges that researchers are facing in constructing effective and efficient molecule simulations.

+",8623,,8623,,5/25/2020 19:20,5/25/2020 19:20,,,,1,,,,CC BY-SA 4.0 +12182,2,,12176,5/25/2020 19:38,,2,,"

The easiest way to do this is probably by converting the circuit to a DAGCircuit, which can be done using the method from qiskit.converters import circuit_to_dag. From the DAG you can get properties, such as any measurement operations, by using the function my_dag.named_nodes('measurement'). DAGNode objects are returned which will tell you the properties of the measurement. You can then remove nodes using my_dag.remove_op_node(a_measurement_node), it is preferable to remove and add nodes than to modify inplace. Following this you could convert the DAGCircuit back to a QuantumCircuit using from qiskit.converters import dag_to_circuit and then append any measurement operations as desired.

+",5955,,,,,5/25/2020 19:38,,,,4,,,,CC BY-SA 4.0 +12183,1,,,5/25/2020 20:15,,4,155,"

After a successful first run without problems, I found that I cannot connect any longer.

+ +

Code:

+ +
from qiskit import IBMQ
+IBMQ.load_account() #previously enabled and saved, even updated
+IBMQ.providers()  # returns empty why???
+provider = IBMQ.get_provider()
+backend = provider.get_backend('ibmq_16_melbourne')
+
+ +

I re-added the token, overwrite the saved token and could successfully activate my account, but it seems that no provider can be found now. +I get this error

+ +
ibmqfactory.load_account:WARNING:2020-05-25 22:08:25,390: Credentials are already in use. The existing account in the session will be replaced.
+
+ +
ibmqfactory._initialize_providers:WARNING:2020-05-25 22:08:29,324: Unable to instantiate provider for {'hub': 'ibm-q', 'group': 'open', 'project': 'main'}: ""{'online_date': ['Not a valid datetime.']}""
+
+ +
ibmqfactory.load_account:WARNING:2020-05-25 22:08:29,325: No Hub/Group/Projects could be found for this account.
+
+ +

Even if I directly add the same hub, group and project, I am not able to retrieve a single provider. +If I run IBMQ_provider() I get an empty list.

+ +

It is summarized as IBMQProviderError: 'No provider matches the specified criteria

+ +

If you could give me a had, I would be very thankful.

+",12157,,5955,,5/26/2020 10:34,6/28/2020 14:06,IBMQfactory._initialize_providers Error,,2,3,,,,CC BY-SA 4.0 +12184,2,,12171,5/25/2020 20:47,,3,,"

Here's a theorem that gives a nice, elegant (yet not optimal in the ruler sense) algorithm that can run on any computer (classical, quantum, basically any turing complete system):

+ +

Theorem : For any $n\in \mathbb N^*$, and for a fixed $c\in\{1,2\}$, the sequence $cnk^2+k,\ k\in[n-1]$ forms a Golomb ruler.

+ +

Proof : For $c=2$, we start with $$2n(x^2+y^2)+(x+y)=a.$$ Given that $0\le\frac{x+y}{2n}<1$, we get $$x^2+y^2=\lfloor a/2n\rfloor.$$ Thus $$x+y=a-2n\lfloor a/2n\rfloor=a\ \mathrm{mod}\ 2n$$ and $$xy=\frac12\{(x+y)^2-(x^2+y^2)\}=\frac12\{(a\ \mathrm{mod} \ 2n)^2-\lfloor a/2n\rfloor\}.$$

+ +

The last 2 equations show that ${x,y}$ are the two roots of a polynomial of degree 2, hence determined in at most one way.

+ +

For $c=1$, we start with $$n(x^2-y^2)+(x-y)=a,\ x<y$$ and since $0\le x-y<n$, it follows that $$x^2-y^2=\lfloor a/n\rfloor.$$ Then $$x-y=a-n\lfloor a/n\rfloor=a\ \mathrm{mod}\ n.$$ Dividing the above two equations, we get $$x+y=\frac{\lfloor a/n\rfloor}{a\ \mathrm{mod}\ n}.$$

+ +

The last 2 equations form a system of 2 equations with 2 unknowns and hence uniquely define $\{x,y\}$. This completes the proof.

+ +

This algorithm can generate the sequence in $\mathcal O(n)$ time. I believe that a quantum algorithm using this will run on the same time since this is a deterministic algorithm.

+",14,,,,,5/25/2020 20:47,,,,2,,,,CC BY-SA 4.0 +12185,1,12192,,5/25/2020 21:09,,5,103,"

I can't find the true difference between Quantum Neural Network (QNN) and Quantum-Inspired Neural Network (QINN).

+ +

I have multiple guesses:

+ +
    +
  1. QINN and QNN are absolutely the same thing (all QNNs are actually QINNs unless the true quantum computing hardware is developed)

  2. +
  3. QINNs are the neural nets ensembles.

  4. +
  5. Something else.?

  6. +
+ +

Thank you a lot for any information!

+",12158,,55,,6/8/2020 12:30,6/8/2020 12:30,Quantum NN vs Quantum-Inspired NN,,1,0,,,,CC BY-SA 4.0 +12186,1,,,5/25/2020 21:33,,-1,236,"

+ +

C:/snippet_.qs(1,85): error QS3001: Syntax does not match any known patterns. +C:/snippet_.qs(1,26): error QS6104: No namespace with the name ""Microsoft.Quantum.Intrinsic"" exists. +C:/snippet_.qs(7,17): error QS5022: No identifier with the name ""ArcSin"" exists. +C:/snippet_.qs(7,30): error QS5022: No identifier with the name ""Sqrt"" exists. +C:/snippet_.qs(8,5): error QS5022: No identifier with the name ""Ry"" exists. +C:/snippet_.qs(11,25): error QS5022: No identifier with the name ""H"" exists.

+",11600,,2879,,5/25/2020 22:53,7/31/2022 13:12,Error running Q# notebooks: Syntax does not match any known patterns,,1,0,,,,CC BY-SA 4.0 +12187,2,,12186,5/25/2020 22:10,,2,,"

You can see in the output of the first cell that the versions of packages Microsoft.Quantum.Standard and Microsoft.Quantum.Katas do not match; they have to match for you to be able to use %kata command that invokes unit test (the first line of the second cell).

+ +
    +
  1. If you want to run the Katas (and run unit tests on your code), you need to update your local installation of IQ# to match the version used in %package command. All katas have instructions on how to update IQ# to a specific version, or you can use these instructions.
  2. +
  3. If you want to run Q# notebooks without the katas, just to run some Q# code, you need to remove the first cell and the %kata command from the second cell.
  4. +
+",2879,,,,,5/25/2020 22:10,,,,1,,,,CC BY-SA 4.0 +12188,1,12189,,5/26/2020 2:45,,3,173,"

How do IBM, D-Wave, etc. change phase physically? In real hardware?

+",8491,,9006,,5/26/2020 6:55,5/28/2020 8:10,"How do IBM, D-Wave, etc. change phase physically?",,1,0,,,,CC BY-SA 4.0 +12189,2,,12188,5/26/2020 8:28,,2,,"

If by 'change phase' you mean the relative phase of the $|0\rangle$ and $|1\rangle$ state, then the short answer is: IBM doesn't, D-Wave doesn't really care.

+

For IBM:

+

Whenever a phase gate (that is, a rotation around the $Z$-axis in the Bloch sphere picture) is applied in the circuit that needs to be run on the hardware, the compiler keeps track of this phase change but does not actually physically implement anything. Rather, it changes the orientation of the $X$- and $Y$-axis, so that any subsequent rotation around these new axes is as if they were the original axes preceded by the $Z$ rotation. In essence, the entire Bloch sphere is rotated 'through software' along the $Z$-axis.

+

This only works because of two things:

+
    +
  • the $X$- and $Y$-axis are a relatively arbitrary choice (they of course still need to be orthogonal). We like to think about the $X$-axis as "that axis for which the angle along the $Z$-axis is $0$", but we can just as equal think of it the other way around: Setting the $X$-axis (completely arbitrary) then actually defines not only the $Y$-axis but also the (angle of) the $Z$-axis.
  • +
  • The non-trivial rotations (that is, the rotations along axes in the $X-Y$ plane) that can be physically implemented are not limited to any two axes in that plane; a continuous range of axes can be implemented. The angle of the rotation is determined by the phase of the incident microwave$^{1}$; any phase can then be used to implement any angle. Therefore, the physical operations that performs the $X$- and $Y$-rotations are the same x-rays, only differing in phase.
  • +
+

For D-Wave

+

D-Wave has an entirely different type of quantum computer: the adiabatic/annealing-model. I am far from an expert on this, but I do believe that this computational model can always be used in such a way that $Z$-rotations are irrelevant. Please correct me if I am wrong.

+

Further reference

+

A good introduction on transmons, the type of qubits that IBM uses, can be found here:

+ +

With D-Wave I'm much less familiar but I know that the 'standard' or 'beginning' Hamiltonian of the system is slowly transformed to the target Hamiltonian by applying (transverse (?)) magnetic fields.

+

Footnotes

+
    +
  1. This is a gross oversimplification and should not be perpetuated:)
  2. +
+",8141,,-1,,6/18/2020 8:31,5/28/2020 8:10,,,,6,,,,CC BY-SA 4.0 +12191,2,,11863,5/26/2020 9:39,,1,,"

We found the mistake. +In the first figure, when we compute q2x from q1x by : +1/ purple ccnot for the carry +2/ blue cnot for the summation +we unroll them in the wrong way (purple then blue instead blue then purple).

+",11936,,,,,5/26/2020 9:39,,,,0,,,,CC BY-SA 4.0 +12192,2,,12185,5/26/2020 12:51,,2,,"

A QNN is a ""quantum implementation of a NN"" that actually runs on a quantum device. +Look for example at this paper by Tacchino et al.

+ +

A QINN instead is a complex model that runs on traditional hardware (maybe special-purpose, but still classical).

+ +

For quantum vs. quantum inspired computing, look at this white paper.

+",5551,,,,,5/26/2020 12:51,,,,1,,,,CC BY-SA 4.0 +12193,2,,12038,5/26/2020 15:42,,3,,"

First things first, theoretically infinite dimensional Hilbert space is natural in quantum mechanics due to the relation $[x,p]=ih$. This produces the Heisenberg algebra. This algebra is solvable and then invoking the Lie-Kolchin theorem, if the dimension of representation is finite, then it is necessarily one dimensional which is not useful as it would make everything commute and nothing would happen. So we consider the other alternative which is that our Hilbert space is infinite dimensional.

+ +

Fair enough, the mathematical ground is solid. But in reality, since we use only a finite space and work for finitely small time scales, we generally approximate the operators in our infinite Hilbert space to a finite subspace of it. Classic examples are this

+ +
+

The spectrum and eigenstates of any field quadrature operator restricted to a finite + number N of photons are studied, in terms of the Hermite polynomials. By (naturally) + defining approximate eigenstates, which represent highly localized wavefunctions with up + to N photons, one can arrive at an appropriate notion of limit for the spectrum of the + quadrature as N goes to infinity, in the sense that the limit coincides with the spectrum of + the infinite-dimensional quadrature operator. In particular, this notion allows the spectra + of truncated phase operators to tend to the complete unit circle, as one would expect. A + regular structure for the zeros of the Christoffel-Darboux kernel is also shown.

+
+ +

and this

+ +
+

We present several new techniques for approximating spectra of linear operators (not necessarily bounded) on an infinite-dimensional, separable Hilbert space. Our approach is to take well-known techniques from finite-dimensional matrix analysis and show how they can be generalized to an infinite-dimensional setting to provide approximations of spectra of elements in a large class of operators. We conclude by proposing a solution to the general problem of approximating the spectrum of an arbitrary bounded operator by introducing the n-pseudospectrum and argue how that can be used as an approximation to the spectrum. + .

+
+ +

But does that mean that infinite Hilbert spaces are relegated to the corners of theoretical physics? The answer is, not surprisingly, no. The experimenters did find application of this, and is technically known as continuous-variable quantum information.

+ +

Quoting Wikipedia :

+ +
+

One approach to implementing continuous-variable quantum information protocols in the laboratory is through the techniques of quantum optics. By modeling each mode of the electromagnetic field as a quantum harmonic oscillator with its associated creation and annihilation operators, one defines a canonically conjugate pair of variables for each mode, the so-called ""quadratures"", which play the role of position and momentum observables. These observables establish a phase space on which Wigner quasiprobability distributions can be defined. Quantum measurements on such a system can be performed using homodyne and heterodyne detectors.

+
+ +

But remember what we had mentioned in the beginning, about why theoretically our Hilbert space needs to be infinite dimensional? Well, even that exact formulation has been proposed as the basis of a quantum computer.

+ +
+

Another proposal is to modify the ion-trap quantum computer: instead of storing a single qubit in the internal energy levels of an ion, one could in principle use the position and momentum of the ion as continuous quantum variables.

+
+ +

And all these have been formalised. For example, one can look here:

+ +
+

The science of quantum information has arisen over the last two decades centered on the manipulation of individual quanta of information, known as quantum bits or qubits. Quantum computers, quantum cryptography and + quantum teleportation are among the most celebrated ideas that have emerged from this new field. It was realized + later on that using continuous-variable quantum information carriers, instead of qubits, constitutes an extremely + powerful alternative approach to quantum information processing. This review focuses on continuous-variable + quantum information processes that rely on any combination of Gaussian states, Gaussian operations, and Gaussian measurements. Interestingly, such a restriction to the Gaussian realm comes with various benefits, since on + the theoretical side, simple analytical tools are available and, on the experimental side, optical components effecting Gaussian processes are readily available in the laboratory. Yet, Gaussian quantum information processing + opens the way to a wide variety of tasks and applications, including quantum communication, quantum cryptography, quantum computation, quantum teleportation, and quantum state and channel discrimination. This review + reports on the state of the art in this field, ranging from the basic theoretical tools and landmark experimental + realizations to the most recent successful developments.

+
+ +

and here:

+ +
+

Quantum error-correcting codes are constructed that embed a finite-dimensional code space in the infinite-dimensional + Hilbert space of a system described by continuous quantum + variables. These codes exploit the noncommutative geometr + y + of phase space to protect against errors that shift the value + s + of the canonical variables + q and + p. In the setting of quantum + optics, fault-tolerant universal quantum computation can be + executed on the protected code subspace using linear optical operations, squeezing, homodyne detection, and photon + counting; however, nonlinear mode coupling is required for + the preparation of the encoded states. Finite-dimensional + versions of these codes can be constructed that protect encoded quantum information against shifts in the amplitude + or phase of a + d-state system. Continuous-variable codes can + be invoked to establish lower bounds on the quantum capacity + of Gaussian quantum channels.

+
+ +

and finally here:

+ +
+

We consider the quantum processor based on a chain of trapped ions to propose an architecture wherein the motional + degrees of freedom of trapped ions (position and momentum) could be exploited as the computational Hilbert space. We + adopt a continuous-variables approach to develop a toolbox of quantum operations to manipulate one or two vibrational + modes at a time. Together with the intrinsic non-linearity of the qubit degree of freedom, employed to mediate the + interaction between modes, arbitrary manipulation and readout of the ionic wave function could be achieved.

+
+ +

Thus, there are several proposals for using infinite dimensional Hilbert spaces, and the same is used in optics sometimes. These are just a few ways in which this can be utilised, and more are expected to open as research progresses.

+",14,,,,,5/26/2020 15:42,,,,4,,,,CC BY-SA 4.0 +12194,1,12201,,5/26/2020 18:29,,3,84,"

What are the ways to rewrite a single-qubit gate follow by a signle-qubit error?

+",12162,,12162,,5/29/2020 20:35,5/29/2020 20:35,single-qubit gate followed by a single-qubit error,,1,2,,,,CC BY-SA 4.0 +12196,1,12197,,5/26/2020 23:14,,2,289,"

I have a Kraus operator $M$. $M$ is composed of a list of matrices $M_k$ satisfying

+ +

$$\sum_{k} M_k^\dagger M_k = I$$

+ +

I would like to control the application of $M$ using a control qubit. This controlled operation will have a Kraus operator $C(M)$. Given $M$ as a list of matrices, how do I compute a list of matrices describing the Kraus operator $C(M)$?

+ +

For example, what are Kraus operators for the controlled amplitude damping channel?

+ +

Note that a perfectly valid answer to this question is ""this concept of controlling a Kraus operator is ambiguous, here's why"".

+ +

Let me clarify what I mean when I say ""controlled Kraus operator"". Any quantum operation can be translated into a unitary circuit acting on the system of interest as well as an external environment that will be traced out at the end. If you derive that circuit for the original operation, introduce a new system qubit and control every operation in the circuit using that new system qubit, then the circuit now implements the controlled Kraus operation.

+ +

My initial idea was to treat each $M_k$ as if it was a unitary operation and created a derived $C(M_k) = \begin{bmatrix} I & 0 \\ 0 & M_k \end{bmatrix}$, but this produces a list of matrices whose upper left corner violates the $\sum_{k} C(M)_k^\dagger C(M)_k = I$ requirement.

+",119,,119,,5/26/2020 23:59,6/3/2020 6:21,Deriving a controlled Kraus operator from an uncontrolled Kraus operator,,3,2,,,,CC BY-SA 4.0 +12197,2,,12196,5/27/2020 0:20,,2,,"

The concept of controlling a Kraus operator is not well defined. It produces ambiguous results.

+ +

For example, consider the dephasing operation. This operation can be represented as a circuit where the qubit-to-dephase is CNOT'd into the environment which is then traced out:

+ +

+ +

But another completely valid circuit representation uses the opposite kind of control:

+ +

+ +

If you produce the ""controlled dephasing operation"" by controlling the first circuit, you get a circuit that dephases the 11 subspace from the 00,01,10 subspace:

+ +

+ +

Whereas if you choose the other starting circuit, you get a circuit that dephases the 10 subspace from the 00,01,11 subspace:

+ +

+ +

These controlled operations are not equivalent. They do different things. But both were derived using the definition from the question. Therefore the definition is ambiguous and the problem cannot be solved.

+ +

In more detail, the problem comes down to the fact that, after the Kraus operator, you can apply any unitary operation $U$ to the environment. The uncontrolled operator is unaffected by $U$'s presence, but the controlled operator is affected. There would need to be some convention around fixing this $U$ in order to derive a specific controlled operation, similar to how there is a convention around how unobservable global phase becomes observable relative phase when controlling unitary operations.

+",119,,119,,5/27/2020 0:25,5/27/2020 0:25,,,,19,,,,CC BY-SA 4.0 +12198,2,,12067,5/27/2020 0:20,,1,,"

Check your arguments to TrotterStep(). You are passing -IntAsDouble(j) as the trotterStepSize argument, but I believe this should just be a constant, since it indicates the simulation time for each Trotter step.

+ +

If I change that line of your code to do something like:

+ +
let unitaryOperator = TrotterStep(evolutionGenerator, 1, 0.1);
+
+ +

where I arbitrarily chose a value of 0.1 for trotterStepSize, I get some behavior that I believe is more like what you are expecting.

+",10473,,,,,5/27/2020 0:20,,,,3,,,,CC BY-SA 4.0 +12199,1,12200,,5/27/2020 1:18,,5,121,"

+ +

I am trying to understand the meaning of the equation shown in the above image taken from this paper, but I am unfamiliar with the tensor network notation. My current strategy is trying to write down matrix representations for the LHS and RHS separately and see from there that they are the same, but I am having difficulty doing it. To me, the LHS looks like $I\otimes I$ and the RHS looks like $$\frac{I\otimes I+X\otimes X+Y\otimes Y+Z\otimes Z}{2},$$ +but clearly they are not equal.

+ +

Could anybody shed more light on this?

+",12167,,10480,,3/10/2021 3:20,3/10/2021 3:20,Pauli Identity Using Tensor Network Notation,,2,1,,,,CC BY-SA 4.0 +12200,2,,12199,5/27/2020 7:51,,1,,"

In your computation of the RHS of the equation, you treat the two $\sigma$s as if they were a tensor product of two 1-qubit operators, whereas you should consider the first as an effet (the dagger of a state), and the second as a state.

+ +

So this calculation should look like this in terms of matrices: +$$\frac12\left( +\begin{pmatrix}1\\0\\0\\1\end{pmatrix}^\dagger\otimes\begin{pmatrix}1\\0\\0\\1\end{pmatrix}+ +\begin{pmatrix}0\\1\\1\\0\end{pmatrix}^\dagger\otimes\begin{pmatrix}0\\1\\1\\0\end{pmatrix}+ +\begin{pmatrix}0\\-i\\i\\0\end{pmatrix}^\dagger\otimes\begin{pmatrix}0\\-i\\i\\0\end{pmatrix}+ +\begin{pmatrix}1\\0\\0\\-1\end{pmatrix}^\dagger\otimes\begin{pmatrix}1\\0\\0\\-1\end{pmatrix} +\right)$$

+ +

Aternatively, using the map/state duality, you could prove this equality by showing: +$$\frac{I\otimes I^\dagger+X\otimes X^\dagger+Y\otimes Y^\dagger+ Z\otimes Z^\dagger}2 = \begin{pmatrix}1\\0\\0\\1\end{pmatrix}^\dagger\otimes\begin{pmatrix}1\\0\\0\\1\end{pmatrix}$$

+",7422,,7422,,5/27/2020 7:57,5/27/2020 7:57,,,,0,,,,CC BY-SA 4.0 +12201,2,,12194,5/27/2020 8:15,,3,,"

Let's assume that your single qubit gate is $U$, and it's followed by some noise operator $A$. So, overall, you've implemented $AU$. You want to know if this can be written in the form $UB$ where $B$ is a new noise operator. So, you just want to solve +$$ +AU=UB. +$$ +To rearrange for $B$, just pre-multiply by $U^\dagger$: +$$ +B=U^\dagger AU. +$$ +As a bonus, if $A$ was unitary, you can easily see that $B$ is unitary. If $A$ is Kraus operator, then you might have a trace preserving property such as +$$ +\sum_iA_i^\dagger A_i=I, +$$ +then this also applies to your new description: +$$ +\sum_iB_i^\dagger B_i=\sum_iU^\dagger A_i^\dagger UU^\dagger A_iU=U^\dagger\left(\sum_iA_i^\dagger A_i\right)U=U^\dagger IU=I. +$$

+",1837,,,,,5/27/2020 8:15,,,,0,,,,CC BY-SA 4.0 +12202,1,12206,,5/27/2020 8:48,,2,148,"

I am reading the book ""Quantum Computing verstehen"" by Matthias Homeister.

+ +

At the moment i'm having a look at the BB84 protocol (which is described in kind of an abstract way).

+ +

In this chapter a quantum circuit is shown, describing how Alice creates and sends a qubit and how Bob measures it. +

+ +

Now Alice qubit-creation step is described as:

+ +

$\text{1. generate a random classical bit } a \text{ and initialize the qubit } | x \rangle \gets |a\rangle$

+ +

$\text{2. generate a second random classical bit } a' \text{ . If } a'=1 \text{ apply the Hadamard matrix to }|a\rangle$

+ +

I'm wondering how to interpret this Hadamard-gate with two inputs, since i havent seen it with two inputs before. Is it supposed to apply the Hadamard matrix only if the second input is 1?

+",12168,,55,,5/27/2020 16:17,5/27/2020 16:17,Hadamard gate with two inputs in the circuit for the BB84 protocol?,,1,5,,,,CC BY-SA 4.0 +12205,1,12248,,5/27/2020 12:54,,0,286,"

In regards to ""Classification with Quantum Neural Networks on near term processors"" (which you can find here) , there are still a few things that do not make entirely sense to me.

+ +

First of all, why is the architecture called a ""neural network""? As far as my knowledge goes, in classical ML, the fundamental unit of Neural Networks is the perceptron. However, in Farhi and Neven's paper, they never mention any form of Quantum Perceptron.

+ +

Secondly, I do not understand the figure describing the architecture (it's Figure 1 in the paper). If you look closely, there is some cross wiring, etc. (I have to admit, the figure looks like a Neural Network, but it doesn't make sense to me). I was able to implement the Subset Parity Problem using Qiskit (because nonetheless, I understand the math behind the model), and the circuit I got doesn't look like the one in the figure.

+ +

I hope you can clarify this for me.

+ +

Thank you in advance!

+",9407,,55,,8/1/2020 11:37,8/1/2020 11:37,"Why is Farhi and Neven's architecture described in ""Classification with Quantum Neural Network on near term processors"" called a Neural Network?",,1,5,,,,CC BY-SA 4.0 +12206,2,,12202,5/27/2020 12:56,,3,,"

This is an example of a controlled gate. It means that the gate is applied to the target qubit (the one with the gate on) when the control qubit (the one with the small circle on) is 1. Another example of a gate like this you might have seen is the CNOT gate, that applies an x gate to the target qubit when the control is 1. This gate works in exactly the same way, only that it applies the h gate instead of the x gate.

+",5955,,,,,5/27/2020 12:56,,,,0,,,,CC BY-SA 4.0 +12207,1,12284,,5/27/2020 13:06,,6,139,"

I'm wondering if anyone has information regarding the current status of Microsoft quantum hardware? How many working qubits do they have? What are the gate depth/fidelity? Any details about realization? (besides ""we're focused on sustainable solutions that will change the world""; ""in the future, topological qubits will allow us to reach fault-tolerance"", etc.)

+",6313,,6313,,5/31/2020 17:53,6/2/2020 0:15,Is there any legitimate information about Microsoft quantum hardware?,,1,0,,,,CC BY-SA 4.0 +12209,2,,6496,5/27/2020 17:04,,2,,"

There's a known theorem known as the Solovay-Kitaev theorem which can be used to deduce the order of the number of gates required to approximate any unitary operator of arbitrary dimension quantum systems.

+ +

As an example, suppose we have a quantum system with states in $\mathbb C^n$. We take a universal family of gates (the OP wants 1 and 2 qubit ones, so...) say $\{CNOT, H, X, Z, R(\pi/8)\}$. Then one can approximate any unitary operator $U$ with accuracy $\epsilon$ with $\mathcal O(n^2\log^4\frac1{\epsilon})$ gates.

+",14,,,,,5/27/2020 17:04,,,,0,,,,CC BY-SA 4.0 +12210,2,,12080,5/27/2020 17:40,,16,,"

Note: This post is a bit older and Qiskit Aqua is now deprecated. Replace all occurences of qiskit.aqua.operators with qiskit.opflow to be compatible with Qiskit Terra 0.17.0 and above.

+

The operators in Qiskit Aqua allow the evaluation of expectation values both exactly (via matrix multiplication) or on shot-based sampling (closer to real quantum computers). The basic principle is the same both times, it only differs in how the expectation value is evaluated in the end.

+

First, you need to define the operator $O$ you're interested in and the state $|\psi\rangle$ with respect to which you want to compute the expecation value. So we're looking for +$$ +E = \langle\psi|O|\psi\rangle. +$$ +In the code below we have $O$ = op and $|\psi\rangle$ = psi. +See also there for your use-case of a WeightedPauliOperator.

+
# you can define your operator as circuit
+circuit = QuantumCircuit(2)
+circuit.z(0)
+circuit.z(1)
+op = CircuitOp(circuit)  # and convert to an operator
+
+# or if you have a WeightedPauliOperator, do
+op = weighted_pauli_op.to_opflow()
+
+# but here we'll use the H2-molecule Hamiltonian
+from qiskit.aqua.operators import X, Y, Z, I
+op =  (-1.0523732 * I^I) + (0.39793742 * I^Z) + (-0.3979374 * Z^I) \
+    + (-0.0112801 * Z^Z) + (0.18093119 * X^X)
+
+# define the state you w.r.t. which you want the expectation value
+psi = QuantumCircuit(2)
+psi.x(0) 
+psi.x(1)
+
+# convert to a state
+psi = CircuitStateFn(psi)
+
+

There are now different ways to evaluate the expectation value. The straightforward, "mathematical", approach would be to take the adjoint of $|\psi\rangle$ (which is $\langle\psi|$) and multiply with $O$ and then $|\psi\rangle$ to get the expectation. You can actually do exactly this in Qiskit:

+
# easy expectation value, use for small systems only!
+print('Math:', psi.adjoint().compose(op).compose(psi).eval().real)
+
+

to get

+
Exact: -1.0636533199999998
+
+

This is only suitable for small systems though.

+

To use the simulators, and the also get the shot-based result, you can use the PauliExpectation (shots), AerPauliExpectation (exact) or MatrixExpectation (exact). +Here's how to do it:

+
from qiskit import Aer
+from qiskit.aqua import QuantumInstance
+from qiskit.aqua.operators import PauliExpectation, CircuitSampler, StateFn
+
+# define your backend or quantum instance (where you can add settings)
+backend = Aer.get_backend('qasm_simulator') 
+q_instance = QuantumInstance(backend, shots=1024)
+
+# define the state to sample
+measurable_expression = StateFn(op, is_measurement=True).compose(psi) 
+
+# convert to expectation value
+expectation = PauliExpectation().convert(measurable_expression)  
+
+# get state sampler (you can also pass the backend directly)
+sampler = CircuitSampler(q_instance).convert(expectation) 
+
+# evaluate
+print('Sampled:', sampler.eval().real)  
+
+

which yields

+
Sampled: -1.0530518430859401
+
+

This result varies if you execute multiple times.

+

For comparison, here the other methods to evaluate the expecation value

+
expectation = AerPauliExpectation().convert(measurable_expression)
+sampler = CircuitSampler(backend).convert(expectation)  
+print('Snapshot:', sampler.eval().real) 
+
+expectation = MatrixExpectation().convert(measurable_expression)
+sampler = CircuitSampler(backend).convert(expectation)  
+print('Matrix:', sampler.eval().real) 
+
+

which produces

+
Snapshot: -1.06365328
+Matrix: -1.06365328
+
+

I hope that clarifies how to compute the expectation value!

+",9800,,9800,,10/14/2021 12:36,10/14/2021 12:36,,,,21,,,,CC BY-SA 4.0 +12212,1,,,5/28/2020 0:03,,3,311,"

I am trying to show that for any qubit state p, the following holds:

+ +

$$I = \frac{\rho + \sigma_x\rho\sigma_x +\sigma_y\rho\sigma_y + \sigma_z\rho\sigma_z}{2}$$

+ +

I have tried different manipulations, but got stuck... Will be grateful for any help!

+",12162,,55,,7/26/2020 18:17,7/28/2020 15:33,Show that $I = \frac{\rho + \sigma_x\rho\sigma_x +\sigma_y\rho\sigma_y + \sigma_z\rho\sigma_z}{2}$ for all states $\rho$,,7,1,,,,CC BY-SA 4.0 +12213,1,,,5/28/2020 0:53,,3,440,"

Hi I am quite new to Quantum Mechanics and I came across with this confusion.

+ +

Let's say there are 2 entangled particles A and B.

+ +

1. When A is measured to be state 0 (doesnt measure B) does it automatically collapse B to 1 or does it imply B should be 1 ?

+ +

2. If A is measured (result is 1) and doesn't measure B, by any chance if we change the state of A to state 0 will it change the state of B ?

+ +

Thank you very much.

+",9759,,9759,,5/28/2020 1:15,5/28/2020 4:36,Quantum Entanglement : Changing states after measurement,,1,0,,,,CC BY-SA 4.0 +12214,1,12223,,5/28/2020 4:21,,2,373,"

Is it known/proven what the smallest quantum error correction code is that can correct arbitrary two-qubit Pauli errors? I can think of the nested/concatenated 5-qubit code or a 25-qubit version of the Shor (repetition) code, but I am not sure if there are codes requiring fewer qubits.

+",12178,,55,,10/12/2020 7:27,10/12/2020 7:27,Smallest Distance-5 Quantum Error Correction Code?,,2,1,,,,CC BY-SA 4.0 +12215,2,,12213,5/28/2020 4:36,,4,,"
    +
  1. If you measure one of the entangled particles, the other one collapses automatically. However, the state to which it collapses depends not only on measurement result of the first particle, but also on the state in which they were entangled.
  2. +
+ +

For example, if the original state was $\frac{1}{\sqrt2}(|01\rangle + |10\rangle)$, measuring the first particle in state $|0\rangle$ will indeed collapse the second one to $|1\rangle$. But if the original state was $\frac{1}{\sqrt2}(|00\rangle + |11\rangle)$, the state of the second particle will be $|0\rangle$, and if it was $\frac{1}{2}|0\rangle\otimes(|0\rangle + |1\rangle) + \frac{1}{\sqrt2}|11\rangle$, the second particle will end up in $\frac{1}{\sqrt2}(|0\rangle + |1\rangle)$.

+ +
    +
  1. Once you measure the first particle, it's no longer entangled with the second one, and whatever you do to it doesn't affect the state of the second particle. Unless you entangle them again...
  2. +
+",2879,,,,,5/28/2020 4:36,,,,3,,,,CC BY-SA 4.0 +12216,1,12276,,5/28/2020 5:21,,1,45,"

I'm a complete beginner in Q#.

+ +

Consider the code in the following image:

+ +

+ +

For some reason, there always is an error message when I try to import anything. It also implies to keywords like Length. The error message is :

+ +
No namespace with the name ""Microsoft.Quantum.Canon"" exists.
+
+ +

However, my code works just fine. The code in the image is taken directly from user guide of Q#.

+ +

Any Suggestions?

+",10376,,55,,6/4/2020 15:03,6/4/2020 15:03,'Unable to import' error message in Q# using VS Code,,1,0,,,,CC BY-SA 4.0 +12217,1,12219,,5/28/2020 6:47,,2,106,"

I am writing an Excel spreadsheet to work through the matrix algebra for a simple Bell's game with the following parameters.

+ +

$$\newcommand{\bra}[1]{\langle #1|}\newcommand{\ket}[1]{|#1\rangle}A_\pm = \frac{1}{2}\times(I \pm Z)$$

+ +

$$A'_\pm = \frac{1}{2}\times(I \pm X)$$

+ +

$$B_\pm = \frac{1}{2}\times(I \pm \frac{1}{\sqrt{2}}\times(X+Z))$$

+ +

$$B'_\pm- = \frac{1}{2}\times(I \pm \frac{1}{\sqrt{2}}\times(X-Z))$$

+ +

For completion, I will define the matrices:

+ +

$$I = \begin{bmatrix}1&0\\0&1\end{bmatrix},\qquad +X=\begin{bmatrix}0&1\\1&0\end{bmatrix},\qquad +Z = \begin{bmatrix}1&0\\0&-1\end{bmatrix}.$$

+ +

The expectation value is calculated using the following: +Use matrix multiplication to calculate the probability of the outcome. If the outcomes are both positive or both negative, ie A+B+, then the outcome is +1. If the one is positive and the other negative (or vice versa) then the value is -1.

+ +

Sample calc: +$Pr(A_+,B_+) = \bra{Phi} A\otimes{B} \ket{Phi}$

+ +

$<AB> = Pr(A_+,B_+)\times1 + Pr(A_-,B_-)\times1 + Pr(A_+,B_-)\times(-1) + Pr(A_-,B_+)\times(-1)$

+ +

The CHSH Inequality states: +$ <AB>-<AB'>+<A'B>+<A'B'> \leq 2$

+ +

What is typically shown is that when Phi equals an entangled state, the outcome violates the CHSH Inequality.

+ +

For example, running through the above calcs with Phi equal to:

+ +

$Phi = \frac{\ket{00}}{\sqrt{2}} + \frac{\ket{11}}{\sqrt{2}}$

+ +

You can show the expectation value is $2\sqrt{2}$.

+ +

I then calculated the sum with Phi equal to:

+ +

$Phi = \ket{00}$

+ +

The expectation value I got is $\sqrt{2}$.

+ +

My question is two parts.

+ +
    +
  • First, is this value correct?

  • +
  • Second, I want to know how to state in words the calculation being done when the states are separated. It seems to me, in the last situation, this is equivalent to what would happen if the bits were classical bits that both happened to be 0. I imagine a scenario where Alice and Bob are both given a classical bit and then asked to measure it. The sum value I am showing is the outcome of the game when the bits they receive are both 0 (played many times to generate a sample size sufficient to obtain the probabilities).

  • +
+",12050,,55,,5/28/2020 7:57,5/28/2020 7:57,What would the CHSH inequality be equal to if the two qubits were separable?,,1,0,,,,CC BY-SA 4.0 +12218,2,,12212,5/28/2020 7:49,,2,,"

For arbitrary one qubit density matrix we have:

+ +

$$\rho = \frac{I}{2} + \frac{r_x \sigma_x + r_y \sigma_y + r_z \sigma_z}{2}$$

+ +

where $|r| \le 1$. Here we should take into account that $\sigma_i \sigma_j \sigma_i = -\sigma_j$ where $i \ne j$ and $i, j \in \{x, y, z\}$, and, also $\sigma_i\sigma_i=I$. With this we will obtain the equality presented in the question. Let's see, for example what will be equal the $\sigma_x \rho \sigma_x$ term:

+ +

$$\sigma_x \rho \sigma_x = \frac{I}{2} + \frac{r_x \sigma_x - r_y \sigma_y - r_z \sigma_z}{2}$$

+ +

Similarly, we will obtain:

+ +

$$\frac{\rho + \sigma_x\rho\sigma_x +\sigma_y\rho\sigma_y + \sigma_z\rho\sigma_z}{2} = \\ +=I + \frac{2r_x \sigma_x + 2r_y \sigma_y + 2r_z \sigma_z -2r_x \sigma_x - 2r_y \sigma_y - 2r_z \sigma_z}{2} = I $$

+",9459,,9459,,5/28/2020 11:05,5/28/2020 11:05,,,,0,,,,CC BY-SA 4.0 +12219,2,,12217,5/28/2020 7:50,,2,,"
+

First, is this value correct?

+
+ +

Yes, it is. If you expand out the calculation you're doing, this is the same as +$$ +\sqrt{2}\langle\psi|X\otimes X+Z\otimes Z|\psi\rangle +$$ +for any two-qubit state $|\psi\rangle$. In the particular case $|\psi\rangle=|00\rangle$, it's easy to extract that this is $\sqrt{2}$. Indeed, for any separable state of the form +$$ +|\psi\rangle=(\cos\theta_1|0\rangle+\sin\theta_1|1\rangle)\otimes(\cos\theta_2|0\rangle+\sin\theta_2|1\rangle), +$$ +you get the same answer.

+ +
+

It seems to me, in the last situation, this is equivalent to what would happen if the bits were classical bits that both happened to be 0

+
+ +

Not really. If the bits are classical, the only measurement you can make on them is in the $Z$ basis. You don't have all these funky measurements that are performed, so it isn't really comparable in that way. The only way I see to describe it is simply as two independent single-qubit experiments.

+",1837,,,,,5/28/2020 7:50,,,,0,,,,CC BY-SA 4.0 +12220,2,,12212,5/28/2020 7:53,,1,,"

Given that you're only working with a single qubit state it is possible to also show this by direct calculation on a parametrised state. That is, we can write any single qubit $\rho$ as +$$ +\rho = \begin{pmatrix} +a & \beta \\ +\overline{\beta} & 1-a +\end{pmatrix} +$$ +with $a\in[0,1]$ and $\beta \in \mathbb{C}$ such that $(1-2a)^2 + 4 |\beta|^2 \leq 1$. Then we can directly compute the action of the Pauli conjugation +$$ +\sigma_x \rho \sigma_x = \begin{pmatrix} +1-a & \overline{\beta} \\ +\beta & a +\end{pmatrix} +$$ +$$ +\sigma_y \rho \sigma_y = \begin{pmatrix} +1-a & -\overline{\beta} \\ +-\beta & a +\end{pmatrix} +$$ +$$ +\sigma_z \rho \sigma_z = \begin{pmatrix} +a & -\beta \\ +-\overline{\beta} & 1-a +\end{pmatrix}. +$$ +Summing these up with $\rho$ and dividing through by $2$ we get the desired result.

+",9854,,,,,5/28/2020 7:53,,,,0,,,,CC BY-SA 4.0 +12222,2,,12212,5/28/2020 8:10,,0,,"

Assuming $\rho$ is a pure state, these are the explicit calculations. You can easily generalize to mixed states.

+ +

$\newcommand{\ket}[1]{|{#1}\rangle}$ +$\newcommand{\bra}[1]{\langle{#1}|}$ +Let $\ket{\psi} = \alpha\ket{0}+ \beta\ket{1}$, where $\alpha,\beta \in \mathbb{C}^2$ and $|\alpha|^2 + |\beta|^2 = 1$.

+ +

Thus $\rho = \ket{\psi}\bra{\psi} = \begin{pmatrix} \alpha\alpha^* & \alpha\beta^* \\ \beta\alpha^* & \beta\beta^*\end{pmatrix}$.

+ +

Now $\sigma_x = \begin{pmatrix} 0 & 1 \\ 1 & 0\end{pmatrix}$, so $ \sigma_x \rho \sigma_x = \begin{pmatrix} \beta\beta^* & \beta\alpha^* \\ \alpha\beta^* & \alpha\alpha^*\end{pmatrix}$.

+ +

Similarly, you can compute $\sigma_y\rho\sigma_y = \begin{pmatrix} \beta\beta^* & -\beta\alpha^* \\ -\alpha\beta^* & \alpha\alpha^*\end{pmatrix}$ and $\sigma_z\rho\sigma_z = \begin{pmatrix} \alpha\alpha* & -\alpha\beta* \\ -\beta\alpha* & \beta\beta*\end{pmatrix}$.

+ +

Finally, summing up:

+ +

$\frac{1}{2} (\rho + \sigma_x \rho \sigma_x + \sigma_y \rho \sigma_y + \sigma_z \rho \sigma_z) = \frac{1}{2}\begin{pmatrix} 2(\alpha\alpha^* + \beta\beta^*) & 0 \\ 0 & 2(\alpha\alpha^* + \beta\beta^*) \end{pmatrix} = I$.

+",5551,,5551,,5/29/2020 17:47,5/29/2020 17:47,,,,0,,,,CC BY-SA 4.0 +12223,2,,12214,5/28/2020 8:10,,2,,"

If you look in this paper, section 7, they give an [[11,1,5]] code, and show that it is the smallest you can have.

+ +

In general, for these sorts of questions, a great starting point is Gottesman's thesis. That's where I found this result stated.

+",1837,,,,,5/28/2020 8:10,,,,0,,,,CC BY-SA 4.0 +12224,2,,12212,5/28/2020 8:36,,2,,"

This method is largely similar to Davit's (this covers a slightly more general case where $\rho$ is any arbitrary matrix with trace 1, and you easily see how to adjust it without the trace 1 condition). Any $2\times 2$ matrix can be decomposed as $aI+\vec{n}\cdot\vec{\sigma}$ if we allow $a$ and $\vec{n}$ to take on arbitrary complex values. Moreover, two $2\times 2$ matrices are equal if an only if their values of $a$ and $\vec{n}$ are equal. So, let +$$ +\tau=\frac{\rho + \sigma_x\rho\sigma_x +\sigma_y\rho\sigma_y + \sigma_z\rho\sigma_z}{2}. +$$ +We want to show that $a=1$ and $\vec{n}=0$. Now, +$$ +a=\text{Tr}(\tau)/2,\qquad n_i=\text{Tr}(\sigma_i\tau)/2. +$$ +Remember that trace is invariant under cyclic permutations, so +$$ +a=\frac{1}{4}\text{Tr}(\rho + \sigma_x\rho\sigma_x +\sigma_y\rho\sigma_y + \sigma_z\rho\sigma_z)=\frac{1}{4}\text{Tr}(\rho + \rho\sigma_x^2 +\rho\sigma_y^2 + \rho\sigma_z^2)=\text{Tr}(\rho)=1. +$$ +Similarly, +$$ +n_x=\frac12\text{Tr}(\sigma_x\rho + \rho\sigma_x +\sigma_x\sigma_y\rho\sigma_y + \sigma_x\sigma_z\rho\sigma_z)=\frac12\text{Tr}(2\sigma_x\rho +\rho\sigma_y\sigma_x\sigma_y + \rho\sigma_z\sigma_x\sigma_z). +$$ +Now use the anti-commutation properties of the Pauli matrices to get +$$ +n_x=\frac12\text{Tr}(2\rho\sigma_x -\rho\sigma_x - \rho\sigma_x)=0. +$$ +The other two components are just the same.

+",1837,,,,,5/28/2020 8:36,,,,0,,,,CC BY-SA 4.0 +12225,1,,,5/28/2020 12:33,,3,60,"

I am trying IBM's code for graphing T1 and I keep getting the following error:

+ +
ibmqfactory.load_account:WARNING:2020-05-28 12:28:57,538: Credentials are already in use. The existing account in the session will be replaced.
+/opt/conda/lib/python3.7/site-packages/qiskit/util.py:109: DeprecationWarning: The QuantumCircuit.iden() method is deprecated as of 0.14.0, and will be removed no earlier than 3 months after that release date. You should use the QuantumCircuit.i() method instead.
+  return func(*args, **kwargs)
+
+ +

The link to the code is here: https://quantum-computing.ibm.com/docs/guide/wwwq/decoherence

+",7856,,55,,6/8/2020 12:29,7/8/2020 14:04,Graphing T1 using Qiskit,,1,0,,,,CC BY-SA 4.0 +12226,1,,,5/28/2020 12:43,,2,153,"

Is there a tool which takes the adjacency matrix of a graph as input and prints out a table with all stabilizer measurements?

+",5705,,55,,5/28/2020 15:31,5/30/2020 21:38,Is there a tool that shows me all $2^n$ stabilizers for a given graph state?,,1,0,,,,CC BY-SA 4.0 +12227,2,,12226,5/28/2020 13:44,,6,,"

To obtain the stabilisers of a graph state, from its adjacency matrix:

+ +
    +
  1. Change all 1s to Zs
  2. +
  3. Change all 0s to identity operators
  4. +
  5. Put X operators on the diagonal
  6. +
+ +

Each row then represents a stabiliser of the graph state, and any nontrivial stabiliser is a product of one or more rows.

+",124,,,,,5/28/2020 13:44,,,,3,,,,CC BY-SA 4.0 +12228,1,,,5/28/2020 14:12,,1,65,"

I'm trying to construct a circuit that performs the quantum transformation :

+ +

+ +

Where $f$ is some function. Is there a way to do it without going through every possible value of $i$ ?

+",12041,,55,,7/26/2020 18:04,7/26/2020 18:04,How to construct a multi-qubit controlled rotation with variable angle?,,0,2,,7/29/2020 0:30,,CC BY-SA 4.0 +12229,2,,12199,5/28/2020 16:03,,1,,"

I would read the picture from left to right, as a quantum channel acting on density matrices -- here, the lower layer is ket, and the upper bra.

+ +

Then, the left side is the identity map +$$ +\mathcal E_L(\rho)=\rho\ , +$$ +and the right side is the map +$$ +\mathcal E_R(\rho) = \sum \sigma_i \mathrm{tr}(\sigma_i\rho)\ . +$$ +So the claim is that $E_R(\rho)$ is the identity channel.

+ +

This can be seen in various way, e.g. such as in Renaud's answer, or (from a more high-level perspective) understanding the space of density matrices as a Hilber space with scalar product $\mathrm{tr}[X^\dagger Y]$, and observing that the Paulis (including the identity) for a basis for that space, so the right hand side is just a resolution of the identity -- in a vector notation, this would amount to +$$ +|\rho\rangle = \sum_i |\sigma_i\rangle\langle\sigma_i|\rho\rangle +$$ +with an orthonormal basis $|\sigma_i\rangle$.

+",491,,,,,5/28/2020 16:03,,,,0,,,,CC BY-SA 4.0 +12231,2,,12212,5/28/2020 19:19,,1,,"

Chapter VII. E. in Daniel Lidar's notes. Use $\rho = \frac{1}{2}(I + \vec{v}\cdot\vec{\sigma})$ and products of Pauli matrices:

+

Check for each pair that: +$\sigma_i \sigma_j = \delta_{ij} I + i \epsilon_{ijk}\sigma_k$

+

Use it to show: +$ +\sigma_i \sigma_j \sigma_k = \delta_{ij} \sigma_k - \delta_{ik} \sigma_j + \delta_{jk} \sigma_i ++ i \epsilon_{ijk} I +$

+

One more step +$ +\sigma_i \sigma_j \sigma_i = +2\delta_{ij} \sigma_i - \sigma_j = +\begin{cases} ++\sigma_j &, i = j\\ +-\sigma_j &, i \neq j +\end{cases} +$

+

with this go to eq. 189 from Daniel Lidar: +$$ +\sigma_x(I + \vec{v}\cdot \vec{\sigma}) \sigma_x = +I + v_x \sigma_x - v_y \sigma_y - v_z \sigma_z +$$ +$$ +\sigma_y(I + \vec{v}\cdot \vec{\sigma}) \sigma_y = +I - v_x \sigma_x + v_y \sigma_y - v_z \sigma_z +$$ +$$ +\sigma_z(I + \vec{v}\cdot \vec{\sigma}) \sigma_z = +I - v_x \sigma_x - v_y \sigma_y + v_z \sigma_z +$$

+

add it together with +$$ +I(I + \vec{v}\cdot \vec{\sigma}) I = +I + v_x \sigma_x + v_y \sigma_y + v_z \sigma_z +$$

+

to get +$$ +2(\rho ++ \sigma_x \rho \sigma_x ++ \sigma_y \rho \sigma_y ++ \sigma_z \rho \sigma_z) += +4I +$$

+",12140,,-1,,6/18/2020 8:31,5/28/2020 19:19,,,,0,,,,CC BY-SA 4.0 +12232,2,,8300,5/28/2020 20:07,,4,,"

To form a RNOT gate , the basic gate operations HAD and PHASE() can be used.

+
         ┌───┐┌───────────┐┌───┐ 
+        ─┤ H ├┤ U1(-pi/2) ├┤ H ├─ 
+         └───┘└───────────┘└───┘ 
+
+

Qiskit code

+
qc.h(reg)
+qc.u1(math.radians(-90), reg)
+qc.h(reg)
+
+",12189,,12280,,7/10/2020 5:54,7/10/2020 5:54,,,,0,,,,CC BY-SA 4.0 +12233,2,,12214,5/29/2020 4:39,,0,,"

Another good place to find codes with your desired parameters is this website: http://www.codetables.de/

+ +

The standard format to describe a quantum code is [[n,k,d]], where n is the number of physical qubits whose joint entangled state stores the logical information, k is the number of logical qubits encoded, and d is the distance to which they are protected.

+ +

The table is n vs k, where the distance d is the # in the box, so the smallest distance-5 code is the (11,1) entry

+",3056,,,,,5/29/2020 4:39,,,,0,,,,CC BY-SA 4.0 +12234,2,,12212,5/29/2020 7:26,,2,,"

This is a special instance of a general linear algebra result.

+

Note that the identity matrix $\newcommand{\vec}{\operatorname{vec}}I$ can be decomposed as $I=\sum_k v_k\otimes v_k^*$ for any orthonormal basis $\{v_k\}_k$, and vice versa any such decomposition identifies the identity matrix.

+

Now notice that the Pauli matrices are an orthonormal basis in an enlarged Hilbert space, meaning that +$$\operatorname{Tr}[(\sigma_i/\sqrt2)(\sigma_j/\sqrt2)]=\delta_{ij}.$$ +More explicitly, this is saying that we can think of the matrices $\sigma_i$ as orthonormal vectors in some space, $i.e.$ we have +$\langle \vec(\sigma_i/\sqrt2),\vec(\sigma_j/\sqrt2)\rangle=\delta_{ij}$, where $\vec(B)$ is the vectorisation of the operator $B$.

+
+

If $A_a\in\mathrm{Lin}(\mathcal X,\mathcal Y)$ are a set of such orthonormal operators, we have +$$\mathrm{tr}(A_a^\dagger A_b)=\delta_{ab} \Longleftrightarrow \langle\mathrm{vec}(A_a),\mathrm{vec}(A_b)\rangle=\delta_{ab},$$ +where $\vec(A_a)\in\mathcal Y\otimes\mathcal X$ is the vectorisation of $A_a$. +If the set is a basis, then we also have +$$\sum_a (A_a)_{12} (A_a^*)_{34} = \delta_{13}\delta_{24} +\Longleftrightarrow +\sum_a\vec(A_a)\vec(A_a)^\dagger = I_{\mathcal Y\otimes\mathcal X} +$$ +Now, the statement we are interested in is of the form +$\sum_a A_a \rho A_a^\dagger = I$. This amounts to +$$ \sum_{a34} (A_a)_{13} (A_a^*)_{24} \rho_{34} = \delta_{12} +\Longleftrightarrow +\sum_a (A_a\otimes A_a^*)\vec(\rho) = \lvert m\rangle, +$$ +where $\lvert m\rangle\equiv\sum_k \lvert k,k\rangle$. +The question is thus, what type of operator is $\sum_a A_a\otimes A_a^*$? +Componentwise, the relation with $\sum_a \vec(A_a)\vec(A_a)^\dagger$ is clear: +$$(A_a\otimes A_a^*)_{ij,nm} = (A_a)_{in} (A_a^*)_{jm} += (\vec(A_a)\vec(A_a)^\dagger)_{in,jm} = \delta_{ij}\delta_{nm},$$ +that is, $A_a\otimes A_a^*$ is the Choi of $\vec(A_a)\vec(A_a)^\dagger$. Summing over $a$ this is the identity, which means that $\sum_a A_a\otimes A_a^*$ is the Choi of the identity, which is the projector over the maximally entangled state: +$$\sum_a A_a\otimes A_a^*=\lvert m\rangle\!\langle m\rvert.$$ +We conclude that +$$\sum_A A_a \rho A_a^\dagger += \operatorname{unvec}\left(\sum_a (A_a\otimes A_a^*) \vec(\rho)\right) += \operatorname{unvec}(\lvert m\rangle ) = I_{\mathcal X}.$$

+",55,,55,,7/27/2020 12:17,7/27/2020 12:17,,,,5,,,,CC BY-SA 4.0 +12235,2,,12225,5/29/2020 9:51,,1,,"

This is not an error, there are two messages here and they are both just warnings.

+ +

The first Credentials are already in use error means that you have called load_account() when you already had an account loaded.

+ +

The second message, DeprecationWarning, is letting you know that a method that you are using will be removed in a future version of Qiskit and so it is best to move code over to using a different method. In this case, it means that you need to used .i() instead of .iden()

+",5955,,,,,5/29/2020 9:51,,,,0,,,,CC BY-SA 4.0 +12236,2,,12183,5/29/2020 9:55,,1,,"

It is possible your credentials file has got messed up in someway. The best thing to do would be to run IBMQ.delete_account() to remove the current account details, regenerate the API token in the IBM Quantum Experience and then save this new token with IBMQ.save_account(token=new_token, overwrite=True)

+",5955,,,,,5/29/2020 9:55,,,,0,,,,CC BY-SA 4.0 +12237,2,,12183,5/29/2020 14:03,,0,,"

This is likely due to a mismatch of qiskit-terra and qiskit-ibmq-provider versions. If you're using qiskit-ibmq-provider 0.7 it requires qiskit-terra 0.14. There's a bug in qiskit-ibmq-provider's setup.py that missed this dependency.

+",12195,,,,,5/29/2020 14:03,,,,0,,,,CC BY-SA 4.0 +12240,1,,,5/29/2020 21:00,,2,49,"

I have been doing some practice problems from ""Gentle introduction to Quantum Computing"". I am a little bit lost with this one:

+ +

The generalized Pauli group $\mathcal G_n$ is defined by all elements of $\mathcal G_n$ being of the form $\mu A_1\otimes A_2 \otimes \ldots\otimes A_n$ where $A_j\in\left\lbrace I, X, Y, Z\right\rbrace$ and $\mu\in\left\lbrace 1, i, -1, -i\right\rbrace$.

+ +
+

Show that generalized set of Pauli elements for a basis for the linear transformations on the vector space associated with an n-qubit system.

+
+ +

Is there any formal proof for this problem? And how do I approach it?

+",12200,,55,,6/4/2020 15:01,6/4/2020 15:01,Generalized set of Pauli elements for a basis for the linear transformations on the vector space,,0,1,,6/3/2020 18:50,,CC BY-SA 4.0 +12241,1,12245,,5/30/2020 10:04,,1,37,"

I am starting with Q# and I would like to know how can I get the following qubit state:

+ +
0.8|0⟩ + 0.2|1⟩
+
+ +

from a qubit initialized as |0⟩.

+ +

Thanks in advance!

+",12203,,,,,5/30/2020 18:25,Change single qubit state in Q#,,1,0,,,,CC BY-SA 4.0 +12243,1,,,5/30/2020 15:05,,0,663,"

I know that the wave like nature of the electrons allows the qubits to interfere with each other amplifying correct answers and canceling out wrong answers. But what kind of problems that use this kind of phenomena? I am still a beginner in the field so please point out any mistake I made along the way. +And if there are any research papers or articles regarding my question please let me know.

+",12207,,55,,10/12/2020 7:27,10/12/2020 7:27,For what kinds of problems is quantum interference used in quantum computers?,,2,1,,,,CC BY-SA 4.0 +12244,2,,12243,5/30/2020 15:16,,2,,"

Welcome, Yousef.

+ +

A quick answer to your question: Grover's algorithm, among others.

+ +

Your first statement is a bit confused: ""the wave like nature of the electrons allows the qubits to interfere with each other amplifying correct answers and canceling out wrong answers.""

+ +

Indeed, interference is between ""paths of quantum computation"": some are amplified, others cancel out. You may see a quantum computation as the evolution over time of the state of a quantum system (a single qubit or a set of qubits). I suggest you to read the following interview to Scott Aaronson:

+ +

https://blogs.scientificamerican.com/cross-check/scott-aaronson-answers-every-ridiculously-big-question-i-throw-at-him/

+",5551,,,,,5/30/2020 15:16,,,,1,,,,CC BY-SA 4.0 +12245,2,,12241,5/30/2020 18:25,,2,,"

First, a clarification that in order to have a properly-normalized state, you probably intend to create a state something like: +$\sqrt{0.8} \left| 0 \right> + \sqrt{0.2} \left| 1 \right>$. +Here the probability of measuring $\left| 0 \right>$ is 0.8 and the probability of measuring $\left| 1 \right>$ is 0.2, when measuring in the computational basis.

+ +

Now, starting with a qubit in the $\left| 0 \right>$ state, you can just apply an Ry operation with the appropriate angle. You need to choose the angle such that $\cos({\theta}/{2}) = \sqrt{0.8}$. The ArcCos function will help you here.

+",10473,,,,,5/30/2020 18:25,,,,1,,,,CC BY-SA 4.0 +12246,2,,12243,5/30/2020 18:33,,2,,"

An example of the interference in the quantum circuit model of computation:

+ +

Let's say we have some arbitrary one qubit state $|\psi \rangle = \alpha|0\rangle + \beta|1\rangle$. After applying the Hadamard gate we will have:

+ +

$$H |\psi \rangle = \frac{1}{\sqrt{2}}(\alpha|0\rangle + \alpha|1\rangle + \beta|0\rangle - \beta|1\rangle) = \frac{1}{\sqrt{2}}\big((\alpha +\beta) |0\rangle + (\alpha - \beta)|1\rangle\big)$$

+ +

because:

+ +

\begin{equation} +H|0\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \qquad +H|1\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle) +\\ +H = \frac{1}{\sqrt{2}} \begin{pmatrix}1&1\\1&-1 \end{pmatrix} +\end{equation}

+ +

If $\alpha = \beta = \frac{1}{\sqrt{2}}$, we will have constructive interference for $|0\rangle$ state and destructive interference for $|1\rangle$ state:

+ +

\begin{equation} +H \frac{1}{\sqrt{2}}( |0\rangle + |1\rangle) = \frac{1}{2}( |0\rangle + |1\rangle + |0\rangle - |1\rangle) = |0\rangle +\end{equation}

+ +

Here is a video lecture (starting from 4:19) about a similar example (with another gate) for the interference.

+ +

One of the applications of the interference in QC can be found in the Deutch algorithm. The main concept is that in the algorithm depending on the property of the Oracle (a function that is in the consideration of the algorithm) we will have constructive interference for some outcome and destructive interference for another outcome. For more info: video lecture about the Deutch algorithm (from 50:20 to 1:10:00).

+",9459,,9459,,5/30/2020 19:28,5/30/2020 19:28,,,,0,,,,CC BY-SA 4.0 +12248,2,,12205,5/30/2020 23:41,,2,,"

On page 2, the authors of the paper write ""We continue to use the +word 'neural' to describe our network since the term has been adopted by the machine +learning community recognizing that the connection to neuroscience is now only historical"".

+ +

As for the question about subset parity, you implement subset parity with controlled unitary gates. However, controlled unitaries can be written as a product of n^2 two qubit unitaries. These two-qubit unitaries are exactly what is present in the diagram you mentioned in your question.

+ +

However, for other problems like MNIST classification, the authors randomly assign two qubit unitaries in the circuit. The Reed-Muller formula that is used for subset parity is just another way to think about the two-qubit unitaries.

+",11644,,,,,5/30/2020 23:41,,,,0,,,,CC BY-SA 4.0 +12249,1,,,5/31/2020 1:06,,0,94,"

I want to know experimentally or circuit wise diagram to know how to create a circuit that will produce 3-qubit uniform superposition wave function +Can somebody help me in that +Thank you in advance

+",12209,,55,,6/8/2020 12:29,6/8/2020 12:29,How to create a Quantum circuit to implement the generation of 3-qubit uniform superposition wavefunction,,1,1,,,,CC BY-SA 4.0 +12250,1,,,5/31/2020 5:36,,1,96,"

I need to realise a Python code program on Qiskit. It works on fuzzy logic. How should I realise the same using quantum processors using Qiskit? Is there any support on realising Python code for Fuzzy logic using quantum logic gates. Fuzzy logic uses IF THEN rules. How is this to be done?. Which logic gate would be appropriate for the circuit.

+",12211,,9006,,5/31/2020 6:34,5/31/2020 6:34,Conversion of python code on Machine learning to realise on quantum processor,,1,0,,,,CC BY-SA 4.0 +12251,2,,12250,5/31/2020 6:30,,1,,"

It is always difficult to force classical algorithms to quantum devices. And this is maybe a signal that quantum algorithms should be something different and new. Actually, quantum systems have unique properties like entanglement, that classical systems don't have.

+ +

However, look at the following paper for a study on the relation between fuzzy and quantum logic:

+ +

https://www.researchgate.net/publication/225320983_On_the_Relation_between_Fuzzy_and_Quantum_Logic

+",5551,,,,,5/31/2020 6:30,,,,0,,,,CC BY-SA 4.0 +12252,1,12256,,5/31/2020 6:43,,0,61,"

I'm currently reading the paper: https://arxiv.org/pdf/1802.06002.pdf

+ +

I'm a little bit stuck on the step of how to determine the following quantity:

+ +

+ +

Where U is a unitary operator acting on $|z,1\rangle$. The paper states the following: + +

+ +

I'm completely confused with the transition between expression 27 to the expression right after. How does applying a Hadamard to the auxiliary qubit result in the expression:

+ +

$$\frac{1}{2}(|z,1\rangle + iU|z,1\rangle |0\rangle) + \frac{1}{2}(|z,1\rangle-iU|z,1\rangle |1\rangle)$$ +Shouldn't it result in +$$\frac{1}{2}(|z,1\rangle |0\rangle + iU|z,1\rangle |0\rangle) + \frac{1}{2}(|z,1\rangle |0\rangle -iU|z,1\rangle |1\rangle)$$

+ +

And if this is the case, I'm confused as to how the probability of the auxiliary qubit being 1 is $\frac{1}{2}-\frac{1}{2}Im(\langle z, 1|U|z,1\rangle)$. Could someone explain why this is the case, and perhaps what I'm missing here?

+",11644,,,,,6/30/2020 12:05,Question About Measuring an Operator For Quantum Neural Network Paper,,1,0,,,,CC BY-SA 4.0 +12253,2,,12249,5/31/2020 6:45,,2,,"

A uniformly distributed superposition can be prepared by Hadamard gate. +If you apply a Hadamard on single qubit in state $|0\rangle$ you get state $\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$. Both states $|0\rangle$ and $|1\rangle$ are measured with same probability $50 \%$.

+ +

To prepare uniformly distributed state having $n$ qubits, simply apply Hadamard on each of them. This leads to a operator $H \otimes H \otimes \dots \otimes H = \otimes^nH$. A state produced by this operation after application on initial state $|00\cdots00\rangle$ is

+ +

$$\frac{1}{\sqrt{2^n}}\big(|00\dots00\rangle+|00\dots01\rangle + |00\dots10\rangle+\cdots+|11\dots10\rangle+|11\dots11\rangle\big),$$

+ +

i.e. all combinations of $0$ and $1$ on $n$ qubits are presented with equal probability.

+",9006,,9459,,5/31/2020 9:23,5/31/2020 9:23,,,,0,,,,CC BY-SA 4.0 +12254,1,12255,,5/31/2020 6:58,,5,343,"

Moore's law states that performance of classical computers doubles every two years (later revised to 18 months) and a price for computing resources halves during same time period.

+ +

Currently, it seems that similar statement can be made for quantum annealers in term of number of qubits (D-Wave). Maybe, also for universal quantum gate-based computers. IBM plans to introduce 53 qubit processor, but so far the highest number of qubits is 20 in Tokyo processor.

+ +

My question: Is there any paper/article/business analysis dealing with Moore's law for quantum computer?

+",9006,,5955,,5/31/2020 12:07,7/12/2021 20:13,Moore's law for quantum computers,,2,0,,,,CC BY-SA 4.0 +12255,2,,12254,5/31/2020 8:03,,5,,"

Moore's law deals with the number of transistors in an integrated circuit, which is used as a proxy for computational power. In a quantum computing device the analogy would be the number of qubits. However, this by itself would be a poor benchmark, namely because it is easy to build lots of qubits. Building many qubits with properties such as long coherence times, low crosstalk, good readout fidelity etc... is what is actually difficult to achieve. So in the quantum world, number of qubits is not a proxy for computational power. Instead, it is the number of number of qubits combined with the quality of those qubits, as measured by their error rates and coherence times, that determines the overall computational power of a quantum device.

+ +

The notion of ""computational power"" is the next question. To quantify this we need some kind of benchmark that we can use to quantify the performance of a give quantum device, and compare it to others. One such benchmark for gate-based quantum devices is the Quantum Volume, developed by IBM [1] (disclosure, I am on this paper). This is a benchmark using random quantum circuits to mimic the performance of an average quantum circuit on a given device. It takes into account both the number of qubits and their quality as is necessary for quantum devices (at least noisy ones). IBM uses this as their benchmark and have seen exponential scaling of this value every year[2]; they aim to double the Quantum Volume every year. There are of course infinitely many benchmarks possible, and a suite of benchmarks is likely at some point in the future, however Quantum Volume seems to be gaining traction. See for example Refs.[3,4].

+ +

Note also that the 53-qubit Rochester device from IBM has been out for some time, and can be accessed by members of the IBM Quantum Network. All of the devices, along with their Quantum Volume, can be see on the IBM Quantum Experience website [5].

+ +

[1] https://arxiv.org/pdf/1811.12926.pdf

+ +

[2] https://www.ibm.com/blogs/research/2019/03/power-quantum-device/

+ +

[3] https://www.honeywell.com/en-us/newsroom/news/2020/03/quantum-volume-the-power-of-quantum-computers

+ +

[4] https://www.honeywell.com/content/dam/honeywell/files/HQS-QCCD-Demonstration.pdf

+ +

[5] https://quantum-computing.ibm.com/docs/cloud/backends/systems/

+",332,,332,,6/1/2020 17:56,6/1/2020 17:56,,,,0,,,,CC BY-SA 4.0 +12256,2,,12252,5/31/2020 10:17,,1,,"

$\newcommand{\ket}[1]{|{#1}\rangle}$ +$\newcommand{\bra}[1]{\langle{#1}|}$

+ +

Applying $H$ to the auxiliary qubit results in:

+ +

$\frac{1}{2}(\ket{z,1}(\ket{0}+\ket{1}) + iU\ket{z,1}(\ket{0}-\ket{1}))$

+ +

$= \frac{1}{2}(\ket{z,1} + iU\ket{z,1})\ket{0} + \frac{1}{2}(\ket{z,1} - iU\ket{z,1})\ket{1}$

+ +

Then the probability of having one on the auxiliary qubit is

+ +

$p(1) = ||P_1\ket{\psi}||^2$

+ +

where $\ket{\psi}$ is the whole state and $P_1 = I \otimes \ket{1}\bra{1}$.

+",5551,,5551,,5/31/2020 10:22,5/31/2020 10:22,,,,0,,,,CC BY-SA 4.0 +12258,1,12259,,5/31/2020 20:34,,2,215,"

I need to implement a 2-qubit gate of the following form in qiskit (I've barely started using it, so I'm happy to try a different package if that's worth it)

+ +

$$ A(\vec c)=\prod_{j=1}^3[I\otimes I\cos(c_j/2)-i\sigma_j\otimes\sigma_j\sin(c_j/2)] $$

+ +

(this is taken from this paper https://arxiv.org/abs/1306.2811).

+ +

Perhaps qiskit is the wrong tool, but I've been trying to find something in the documentation, but I find it very difficult to parse. There is UnitaryGate https://qiskit.org/documentation/stubs/qiskit.extensions.UnitaryGate.html +and Gate https://qiskit.org/documentation/stubs/qiskit.circuit.Gate.html#qiskit.circuit.Gate, +but apart from saying that the function needs parameters, there isn't any more documentation.

+ +

There is also the UnitaryGate.power(x) which could be useful if I knew how to define say a function that returns a generic XX gate.

+ +

Yet another option could be to have a function that would take a matrix, such as

+ +
g = twoQubitGateFrom4-by-4Matrix( -- some 4x4 matrix that is the desired unitary -- )
+
+ +

Such that later I can apply it some where, e.g.,

+ +
myQuantumCircuit.g(3,5)
+
+ +

or even parameterized?

+ +
myQuantumCircuit.g(3,5,vecAlpha)
+
+",12213,,55,,6/4/2020 15:02,6/4/2020 15:02,Generic 2-qubit gate in qiskit,,2,0,,,,CC BY-SA 4.0 +12259,2,,12258,5/31/2020 20:55,,2,,"

The iso() function allows you to add a gate, defined by means of a unitary, to your quantum circuit:

+ +

https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.iso.html

+",5551,,,,,5/31/2020 20:55,,,,2,,,,CC BY-SA 4.0 +12260,1,12262,,5/31/2020 22:17,,1,523,"

I know that a Hadamard states is a purely probabalistic one; e.g.

+ +

$$H\vert 0\rangle=a\vert 0\rangle+b\vert 1\rangle$$

+ +

where $a^2=0.5$ and $b^2=0.5$.

+ +

Are there any states in which the probabilities differ, and if there are how are they important?

+",12207,,55,,10/12/2020 7:26,10/12/2020 7:26,Is there a gate that puts a qubit into superposition with a not so purely probabalistic (50 50) outcome?,,2,1,,,,CC BY-SA 4.0 +12261,1,14352,,5/27/2020 3:18,,8,171,"

The asymptotic time complexity of Grover's algorithm is the square root of the time of a brute force algorithm. However, according to Perlner and Liu, the thermodynamic behavior (theoretical minimum on energy consumption) is asymptotically the same as brute force.

+ +

Is there an analogous limit of Shor's algorithm? If so, this could potentially affect some cryptographic protocols.

+",12235,Nic,12235,,6/2/2020 16:01,10/27/2020 11:04,What are the thermodynamic limits of Shor's algorithm,,1,0,,,,CC BY-SA 4.0 +12262,2,,12260,6/1/2020 0:37,,5,,"

Welcome to QCSE.

+ +

You already know that $a^2=b^2=0.5$. For a single qubit gate akin to the Hadamard gate you can achieve any two probabilities you want, as long as they add to $1$.

+ +

For example one trick that I learned was that you could choose ratios of Pythagorean triples, i.e. numbers $a$,$b$,$c$ such that $a^2+b^2=c^2$. Let's have a gate called $\mathrm{YOUSEF}$ defined as:

+ +

$$\mathrm{YOUSEF}\vert 0\rangle=\frac{3}{5}\vert 0\rangle+\frac{4}{5}\vert 1\rangle.$$

+ +

Such a gate may be useful in biasing your transition probabilities in a manner your algorithm dictates.

+",2927,,45,,6/1/2020 11:42,6/1/2020 11:42,,,,5,,,,CC BY-SA 4.0 +12263,2,,12260,6/1/2020 8:30,,7,,"

You can use $Ry$ gate to prepare a qubit in superposition with arbitrary probabilities. +When you apply the gate on qubit in state $|0\rangle$, you get a qubit in superposition +$$ +|\psi\rangle = \cos(\theta/2)|0\rangle + \sin(\theta/2)|1\rangle. +$$

+ +

By chaning angle $\theta$ you can set any probability you want.

+ +

For setting $\theta = \pi/2$ you will get equally distributed superposition because $\cos(\pi/4) = \sin(\pi/4)=\frac{1}{\sqrt{2}}$, for setting $\theta = \pi$ you will get qubit $|\psi\rangle = |1\rangle$ because $\cos(\pi/2) =0$, etc.

+ +

Changing $\theta$ continously from $0$ to $\pi$, probability of measuring $|0\rangle$ is decreasing from $1$ to $0$ while probability of measuring $|1\rangle$ is increasing from $0$ to $1$.

+",9006,,,,,6/1/2020 8:30,,,,0,,,,CC BY-SA 4.0 +12264,1,,,6/1/2020 8:51,,0,111,"

I'm an engineering student. As my end of year project I've simulated BB84 protocol using simulaqron(python). I'm thinking about publishing a paper about this simulation. +I haven't published any research paper before, do you have any suggestions about where to publish? or about how to represent my ideas?

+",11560,,5955,,6/1/2020 10:18,8/13/2020 20:03,Is it a good idea to publish a research paper about the simulation of BB84 protocol?,,1,1,,,,CC BY-SA 4.0 +12265,2,,12264,6/1/2020 9:31,,4,,"

First of all, it depends on the level of detail of your simulation. SimulaQron does not take into account noise, so I presume your simulation is only functional. Many BB84 functional simulations have been developed so far, and no one was so interesting to deserve publication in a research paper.

+ +

Notice also that BB84 is the reference example in the following tutorial by the authors of SimulaQron:

+ +

http://www.simulaqron.org/wp-content/uploads/2019/04/instructions_2018_2.pdf

+ +

If you want to simulate BB84 in a detailed fashion, you may try QuISP, a novel simulation tool whose focus is ""on protocol design and emergent behavior of complex, heterogeneous networks at large scale, while keeping the physical layer as realistic as possible.""

+",5551,,5551,,6/1/2020 9:52,6/1/2020 9:52,,,,3,,,,CC BY-SA 4.0 +12266,1,,,6/1/2020 10:49,,2,347,"

How to implement NOR gate functionality within a quantum circuit? Having $3$ input bits $f(x) \rightarrow y$, I would like to achieve $y=1$ every time when $x=?00$ is on input ($x=000$ or $x=100$).

+",12220,,9459,,6/1/2020 12:22,6/1/2020 12:22,Quantum NOR Gate,,1,0,,,,CC BY-SA 4.0 +12267,2,,12196,6/1/2020 10:49,,1,,"

Unlike the concept of a controlled unitary, a controlled CP map is not uniquely defined.

+ +

As an example, consider the Identity map $I$, seen as a CP map. Then, the controlled-Identity map (as a CP map) can be defined in different ways, e.g. +$$ +\mathcal E(\rho) = \rho +$$ +or $$\mathcal E(\rho) = \tfrac12I_A\otimes\mathrm{tr}_A(\rho)\ , +$$ +where the $A$ (first) system is the control qubit. Specifically, you can think of the second map as the first map, where afterwards, a dephasing channel is applied to the control qubit.

+ +

Indeed, this is a degree of freedom which you always have: Dephasing the control qubit after the application of the channel. However, it is not clear whether this always gives a different channel (i.e. whether this is a actual degree of freedom.)

+ +

One approach would be that you want that the control qubit is affected as little as possible. For instance, you could demand that if the $B$ system is in a fixed point $\sigma_B$ of the CP map (such a $\sigma_B$ always exists), then the control qubit should remain unchanged. This e.g. fixes the controlled-identity channel uniquely. Whether this always uniquely fixed the channel, I am not sure.

+",491,,,,,6/1/2020 10:49,,,,0,,,,CC BY-SA 4.0 +12268,2,,12266,6/1/2020 11:14,,1,,"

A possible implementation for NOR gate by using one Toffoli gate and X gates:

+ +

+ +

Note that the last qubit is always in the $|0\rangle$ state and the output of this implementation for NOR gate will be stored in the state of that qubit. The first two qubits are for the input state. +Here one can find more about similar gates. The main idea is that the X gate will be applied only if both top qubits are in $|0\rangle$ state, otherwise, the gate(s) will do nothing. Hence the action on different inputs look like this $|000\rangle \rightarrow |100\rangle$, $|001\rangle \rightarrow |001\rangle$, $|010\rangle \rightarrow |010\rangle$, $|011\rangle \rightarrow |011\rangle$ (the bottom qubit is the leftmost qubit in this notation).

+",9459,,9459,,6/1/2020 12:19,6/1/2020 12:19,,,,0,,,,CC BY-SA 4.0 +12270,1,,,6/1/2020 13:29,,2,390,"

I am trying to learn Q# and have very limited knowledge in Q#. As the title suggests, I am trying to pass an array of qubits into an operation using a python script to call the operation which is written in Q#.

+ +

For Example: Consider the following Q# code:

+ +
operation SlightlyComplicated(register : Qubit[], pauli : String[]):
+        Bool { // Does something and returns a bool value
+}
+
+ +

The above operation is saved in a file called Program.qs which is saved in the same folder as the python code under the name TempQuant and then here's the python code that is responsible for calling this operation:

+ +
import qsharp
+from qsharp import Result
+from Quantum.TempQuant import SlightlyComplicated
+
+res = SlightlyComplicated.simulate(register = , pauli = ['X', 'Y', 'Z', 'Z'])
+print(res)
+
+ +

Since pauli is an array of Strings, it is easy to pass it through python since they share this type, but for types like qubit, Result, Pauli(which are exclusively present in Q#), how am I supposed to pass them through python into their respective counterparts in Q#?

+ +

For reference, I am using Visual Studio Code to write the codes.

+",10376,,55,,6/4/2020 15:05,6/4/2020 15:05,Passing an array of qubits into Q# using Python,,2,0,,,,CC BY-SA 4.0 +12271,2,,12270,6/1/2020 14:20,,2,,"

In general, any logic that relates to Q#-specific types like Qubit should live in your Q# code.

+ +

The specific answer depends on what you are trying to do. For example, if you want your Python code to specify the number of qubits, you could have something like an nQubits : Int parameter to your Q# operation. Your Python code could pass this as an integer, and then your Q# code could allocate the array of the appropriate number of qubits.

+ +

For the Pauli and Result types, there are actually Python enums defined such that you could pass those values directly if you want to. See qsharp.types.Pauli and qsharp.types.Result.

+ +

You may also find the answers to this similar question helpful: +How do you send an array of qubits to an operation in Q#?

+",10473,,10473,,6/1/2020 15:23,6/1/2020 15:23,,,,0,,,,CC BY-SA 4.0 +12272,2,,12270,6/1/2020 15:08,,4,,"

Building off of Ryan's answer (https://quantumcomputing.stackexchange.com/a/12271/12224), it's important to recognize that the Qubit type should not only live just in the Q# code but also have its scope bounded by either a using statement or a borrowing statement. See Working with Qubits for more guidance on how to allocate qubits for use in an operation.

+ +

As an option for how to pass an initial state of a register as a series of ones and zeros, you could pass your input register from Python as an array of bools, and then use ApplyToEachIndex from Microsoft.Quantum.Cannon to map that array onto the array of qubits:

+ +
    operation test(bools : Bool[]) : Unit {
+        using (qs = Qubit[Length(bools)]) {
+            ApplyToEachIndex(InitializeFromBoolArray(_, bools, _), qs);
+        }
+    }
+
+    operation InitializeFromBoolArray(index : Int, bools : Bool[], qubit : Qubit) : Unit {
+        if (bools[index]) {
+            X(qubit);
+        }
+    }
+
+ +

Note that this also uses a callable invocation expression to create an operation with the signature expected by ApplyToEachIndex.

+",12224,,,,,6/1/2020 15:08,,,,0,,,,CC BY-SA 4.0 +12273,1,,,6/1/2020 16:53,,1,201,"

English/Englisch: +Hi, could anyone help me please?I have a problem with the API-token

+ +
line 8, in random_qubit
+
+IBMQ.load_account('API-token is normally standing here but I delete it for the question')
+
+TypeError: load_account() takes 1 positional argument but 2 were given
+
+ +

If someone has the solution or the same problem, please comment it below this question +And sorry for my bad english.

+ +

German/Deutsch: +Hey könnte mir wer bitte helfen? Ich hab ein Problem und zwar

+ +
line 8, in random_qubit
+
+IBMQ.load_account('API-Token hab ich heraus gelöscht wegen Kommentar sonst würde hier der API-Token stehen')
+
+TypeError: load_account() takes 1 positional argument but 2 were given
+
+ +

Falls jemand die Lösung bzw das gleiche Problem hat / hatte bitte unter diesen Kommentar kommentieren

+",12225,,,,,6/1/2020 17:07,Problem with the API-token from IBM TypeError,,1,0,,,,CC BY-SA 4.0 +12274,2,,12273,6/1/2020 17:07,,2,,"

IBMQ.load_account() doesn't take any parameters. It loads the credentials saved locally, if you did a IBMQ.save_account() prior. If you want to use the credentials for just a single session, you can use IBMQ.enable_account(API_TOKEN).

+",12195,,5955,,6/1/2020 17:07,6/1/2020 17:07,,,,0,,,,CC BY-SA 4.0 +12275,1,,,6/1/2020 17:18,,6,675,"

This may be a very basic and common question (also discussed a lot), but strikingly enough I couldn't find the answer in the books or elsewhere.

+ +

The projective measurement is given by the PVM on the space $H$: +$$\sum P_i = I,$$ +where $P_i$ are mutually orthogonal projections. +The post-measurement state of a density matrix $\rho$ is +$$P_i \rho P_i ~/~ \text{Tr}(P_i \rho P_i),$$ +with the probability $\text{Tr}(P_i \rho P_i)=\text{Tr}(\rho P_i)$.

+ +

The general measurement is given by the set of operators $M_i$ that corresponds to the POVM on $H$: +$$\sum M_i^\dagger M_i = I.$$

+ +

The post-measurement state of a density matrix $\rho$ is +$$M_i \rho M_i^\dagger ~/~ \text{Tr}(M_i \rho M_i^\dagger),$$ +with the probability $\text{Tr}(M_i \rho M_i^\dagger) = \text{Tr}(\rho M_i^\dagger M_i)$.

+ +

Note that POVM itself doesn't describe the post-measurement state, because $M_i^\prime = UM_i$ for some unitary $U$ gives the same POVM but different post-measurement results (I mean states, though the probability will be the same).

+ +

It's known that, roughly speaking, general measurements correspond to projective measurements on a larger space. But the best exact statement I could find is that general measurement corresponds to an indirect projective measurement! The indirect measurement is when we add some ancilla state to a target system, perform a unitary evolution of a joint state followed by a projective measurement on that ancilla space and finally trace out the ancilla system.

+ +

So, the question is $-$ what if we perform PVM on the whole joint system, not just on the ancilla? Will the post-measurement results correspond to some general measurement?

+ +

Formally, let $H$ is the target system, $H_a$ - ancilla space with some fixed density matrix $\rho_0$ on it, $U$ is a unitary on $H \otimes H_a$ and $\sum P_i = I$ is a PVM on the whole $H \otimes H_a$. The post-measurements states of this scheme are +$$ \text{Tr}_a ( P_i U \cdot \rho \otimes \rho_0 \cdot U^\dagger P_i) ~/~ n_i,$$ +with the probability $n_i$ where $n_i$ is just the trace of the numerator. +The question is $-$ are there operators $M_i$ such that those post-measurement states equal to $$M_i \rho M_i^\dagger ~/~ \text{Tr}(\rho M_i^\dagger M_i) ?$$

+ +

I know how to prove that there exists a unique corresponding POVM $\sum F_i=I$ on $H$ that can be used to compute probabilities, i.e. $n_i = \text{Tr}(\rho F_i)$, but it's not clear how to derive the exact $M_i$ or even prove that they exist.

+ +

Update
+Also, we can consider a related quantum channel +$$ \Phi(\rho) = \sum_i \text{Tr}_a ( P_i U \cdot \rho \otimes \rho_0 \cdot U^\dagger P_i) $$ and derive Kraus decomposition +$$ +\Phi(\rho) = \sum_j K_j \rho K_j^\dagger, +$$ +but it still doesn't answer the question. It's not even clear if Kraus decomposition has the same number of summands.

+",5870,,5870,,6/2/2020 9:33,6/2/2020 20:02,Projective vs general measurements - a missing piece,,2,3,,,,CC BY-SA 4.0 +12276,2,,12216,6/1/2020 17:22,,1,,"

If your code builds and runs successfully, this error has to come from IntelliSense.

+ +

Are you using .NET Core 3.1.300? I think QDK release 0.11.2004.2825 has IntelliSense issues with .NET Core 3.1.300 specifically, and downgrading .NET Core to 3.1.201 fixes this issue - you can try that.

+ +

Edit: the relevant issue on GitHub.

+",2879,,,,,6/1/2020 17:22,,,,1,,,,CC BY-SA 4.0 +12277,1,,,6/1/2020 17:33,,2,283,"

I am trying to run the QFT algorithm for n=5 (n number of qubits). The number of experiments that it generates is bigger than the one allowed by the IBM devices (i.e. 75). Therefore, I have tried to used the IBMQJobManager but this is not working as my result is not the counts but the density matrix obtain from the tomography process. Is it possible to make it work? I have made the following attempt (qft is a function that I have created that implements the QFT algorithm):

+ +
n=5
+beta=0.5*np.pi
+state=initial_state_QFT(n,beta)
+qr=QuantumRegister(n)
+cr=ClassicalRegister(n)
+qc=QuantumCircuit(qr)
+
+qc.initialize(state,qr)
+qft(qc,n)
+qst = tomo.state_tomography_circuits(qc, qr)
+job = job_manager.run(qst, backend=device, name='foo',shots=8192)
+statefit = tomo.StateTomographyFitter(job.results(), qst)
+p, M, weights = statefit._fitter_data(True, 0.5)
+M_dg = np.conj(M).T
+linear_inversion_matrix = np.linalg.inv(M_dg @ M) @ M_dg
+rho = linear_inversion_matrix @ p
+rho = np.reshape(rho, (2**n, 2**n))
+
+ +

Thank you in advance for your answer!

+",9887,,55,,10/26/2021 21:03,10/26/2021 21:03,How to obtain the density matrix using tomography in the real device?,,1,0,,,,CC BY-SA 4.0 +12278,2,,12258,6/1/2020 17:58,,3,,"

For completeness, the operator $A$ you're describing can be implemented more efficiently using the rotations $R_{XX}, R_{YY}$ and $R_{ZZ}$: +$$ A(\vec c)=\prod_{j=1}^3[I\otimes I\cos(c_j/2)-i\sigma_j\otimes\sigma_j\sin(c_j/2)] = R_{XX}(c_1)R_{YY}(c_2)R_{ZZ}(c_2)$$ +as +$$ +R_{XX}(\theta) = e^{-i\theta/2 X \otimes X} = \cos\left(\frac{\theta}{2}\right) I \otimes I - i\sin\left(\frac{\theta}{2}\right) X \otimes X +$$ +and analogously for $YY$ and $ZZ$. The isometry and initialize functions are very generic and work for any input. Therefore the gate decompositions might not be optimal, especially if the number of qubits gets large.

+ +

In Qiskit that would simply be

+ +
from qiskit import QuantumCircuit
+
+c = [0.2, 0.3, 0.4]
+A = QuantumCircuit(2)
+A.rzz(c[2])  # remember: R_ZZ is applied first to the state!
+A.ryy(c[1]) 
+A.rxx(c[0]) 
+
+",9800,,,,,6/1/2020 17:58,,,,0,,,,CC BY-SA 4.0 +12279,1,12434,,6/1/2020 18:48,,1,88,"

You can find the paper here , in which they describe the architecture of a QNN that can be used to learn binary functions and correctly classify unseen data.

+

They say that for each binary label function $l(z)$ where $l(z) = -1$ or $l(z) = 1$, there exists a unitary $U_l$ such that, for all input strings $z = z_0z_1...z_{n-1}$ (where each $z_i = -1,1)$, $$\langle z,0 | U_l^{\dagger} Y_{n+1} U_l |z,0 \rangle = l(z)$$

+

If you assume that $U_l = \text{exp}(i\frac{\pi}{4}l(z)X_{n+1})$, then it can be easily proven that $\langle z,0 | U_l^{\dagger} Y_{n+1} U_l |z,0 \rangle = l(z)$

+

Now let's consider the subset parity problem. Here, $l(z) = 1-2B(z)$, where $B(z) = \oplus^{n-1}_{j=0} \phantom{a} a_j \cdot \frac{1}{2}(1-z_j)$, which, when plugged into $U_l$ gives us $$\text{exp}(i\frac{\pi}{4}X_{n+1}) \prod^{n-1}_{j=0} \text{exp}(-i \frac{\pi}{2}a_j \cdot \frac{1}{2}(1-z_j))$$

+

Now, for the subset parity problem, what you want to learn is $\frac{\pi}{2}a_j$, which you do not know beforehand.

+

So, during learning, you assume that $$U_l(\vec\theta) = \text{exp}(i\frac{\pi}{4}X_{n+1}) \prod^{n-1}_{j=0} \text{exp}(-i \theta_j \cdot \frac{1}{2}(1-z_j))$$ (our goal is to update $\vec\theta$ s.t when we compute the estimated label, we get close to the actual label)

+

This method seems to be working fine for this problem (I get an accuracy of 96%).

+

Right now, I am trying to use a QNN for another binary classification problem. Contrary to the subset parity problem, I do not actually know $l(z)$ (which I thought was perfect, because the QNN allows me to design a circuit that correctly classifies my strings). Therefore, I assumed that $$U_l(\vec\theta) = \text{exp}(i\frac{\pi}{4}X_{n+1}) \prod^{n-1}_{j=0} \text{exp}(-i \theta_j \cdot \frac{1}{2}(1-z_j))$$, just like the subset parity problem.

+

It seems to be working fine. I get an accuracy of 76%, which isn't bad. However, I am not sure if I can assume this and I am starting to wonder if my initial assumption about $U_l$ for this new problem is legit or not (it could be a coincidence or an error in my code).

+",9407,,-1,,6/18/2020 8:31,6/13/2020 9:20,Initial assumption of the unitary that allows us to estimate the label function,,1,1,,,,CC BY-SA 4.0 +12280,1,,,6/1/2020 20:52,,0,98,"

I was wondering if it's possible to use qiskit inside a django project. I found some ways to install jupyter notebooks, but I am not sure what is happening with qiskit. +Ideally I would like to import and use qiskit to a web app with a very simple user interface. I haven't found anything similar. +Any ideas? Thank you!

+",9569,,55,,6/4/2020 15:03,6/4/2020 15:03,Install qiskit in django project,,1,0,,,,CC BY-SA 4.0 +12281,1,12283,,6/1/2020 21:59,,3,189,"

To my basic knowledge I know that solving a generalized Sudoku problems is an NP-complete problem so, is there any possible way quantum computers give an advantage over classical computers in this type of problem?

+",12207,,55,,10/12/2020 7:26,10/12/2020 7:26,Does quantum computers give any advantage over classical computers in Sudoku?,,1,0,,,,CC BY-SA 4.0 +12282,2,,12277,6/1/2020 22:20,,1,,"

IBMQJobManager.run() returns a ManagedResult, but StateTomographyFitter expects a Result object. Unfortunately there is no easy way to convert the former into the latter, so you'll have to combine the results yourself:

+ +
job_set = job_manager.run(qst, backend=device, name='foo',shots=8192)
+jobs = job_set.jobs()
+new_result = copy.deepcopy(jobs[0].result())
+for idx in range(1, len(jobs)):
+    new_result.results.extend(jobs[idx].result().results)
+statefit = tomo.StateTomographyFitter(new_result, qst)
+
+ +

This is an interesting use case. Looks like Job Manager should really support returning a Result object.

+",12195,,12195,,6/3/2020 12:46,6/3/2020 12:46,,,,7,,,,CC BY-SA 4.0 +12283,2,,12281,6/1/2020 23:55,,6,,"

You are correct that solving Sudoku for $n^2 \times n^2$ grids with $n\times n$ blocks is an NP complete problem.

+ +

The quantum complexity class BQP is the class of decision problems solvable by a quantum computer in polynomial time (with an error probability of at most 1/3 in all cases). The relationship between BQP and the classical complexity classes P and NP-Complete is currently an open problem, but most experts think that quantum computers cannot solve NP-Complete problems in polynomial time:

+ +

+ +

This is an excerpt from this Wikipedia article:

+ +
+

It is suspected that NP $ \nsubseteq $ BQP; that is, it is believed + that there are efficiently checkable problems that are not efficiently + solvable by a quantum computer. As a direct consequence of this + belief, it is also suspected that BQP is disjoint from the class of + NP-complete problems (if an NP-complete problem were in BQP, then it + would follow from NP-hardness that all problems in NP are in BQP).

+
+ +

Therefore quantum comptuers are unlikely to be able to solve an $n^2 \times n^2$ Sudoku puzzle in polynomial time. It is quite possible that quantum computers will have to pay $\mathcal{O}(2^n)$ to solve the puzzle, as would be the case for classical computers, however this doesn't rule out the possibility that the quantum computer could beat the classical computer by having a smaller constant hidden under the big O, or by having a smaller pre-factor in the exponent.

+ +

The original question:

+ +
+

""is there any possible way quantum computers give an advantage over + classical computers in this type of problem?""

+
+ +

is a bit vague, because what is meant by ""advantage"" ? +Many people would only consider it to be an ""advantage"" if there is there is an improvement in the scaling of the cost with respect to $n$, which is why at first I mentioned computational complexity considerations. However if you just want to know whether or not a quantum computer can finish the puzzle with fewer logic gates than a classical computer, of course the quantum computer will have an advantage because all classical computers are quantum computers, so by definition there is absolutely no way a classical computer can finish the puzzle with fewer gates. Whether or not quantum gates can be performed as efficiently (energy-wise) compared to classical gates though, is an open problem. So the answer depends on what you consider to be an ""advantage"" and how you define things, but you can certainly define things in a way in which a quantum computer would have an advantage.

+",2293,,,,,6/1/2020 23:55,,,,0,,,,CC BY-SA 4.0 +12284,2,,12207,6/2/2020 0:15,,2,,"

I'm glad that you inserted this quote:

+
+

"in the future, topological qubits will allow us to reach fault-tolerance"

+
+

So you are at least aware that Microsoft is invested in topoligical quantum computing. You can even see it directly from microsoft.com:

+

+

So now the answer to your question:

+

Topolgical quantum computing is quantum computing that would use anyons. If you read this question of mine you will see that confirming the existence of anyons is still an open problem (unfortunately there is an "answer" to the question, but it is about simulating anyons, not actually realizing them in real life). My answer here explains what anyons are in more detail, and my answer here explains that since using anyons is part of the definition of topological quantum computing, there is no way for Microsoft to make a topological quantum computer by skipping the step of confirming the existence of anyons.

+

So you ask:

+
+

"I'm wondering if anyone has information regarding the current status of Microsoft quantum hardware?" How many working qubits do they have? What are the gate depth/fidelity?

+
+

This is what they have so far:

+
    +
  • # of qubits = 0
  • +
  • gate depth = 0
  • +
  • fidelity = 0
  • +
+

We need to wait until anyons are confirmed to actually exist, before we can create a quantum computer out of them. While it is possible that Microsoft is working on some other type of quantum computing without telling us, all we know for sure is that their website says "Our approach focuses on topological quantum computing" which means that they do not have any physical device yet. They have made plenty of achievements in quantum computing theory though, as well as software such as liquid. No hardware though.

+",2293,,-1,,6/18/2020 8:31,6/2/2020 0:15,,,,0,,,,CC BY-SA 4.0 +12285,1,12328,,6/2/2020 1:53,,1,81,"

Are there Quantum-enhanced Machine Learning algorithms that can be implemented via Qiskit in IBM Q Experience and obtain valuable inferences faster than their classical counterparts from datasets of let's say Kaggle?

+ +

Please also link important papers and articles that you think are worth reading. Thank you!

+",12229,,491,,6/6/2020 20:53,6/6/2020 20:53,IBM Q Experience - Can it be used draw out ML inferences?,,1,3,,6/9/2020 0:54,,CC BY-SA 4.0 +12286,2,,9990,6/2/2020 2:44,,4,,"

The result you're looking for is effectively Proposition 19 of the paper: Almost all quantum channels are equidistant; which I'm rewriting here for convenience:

+ +

Let $U, V \in \mathcal{U}(d)$ be two independent random variables, at least one of them being Haar-distributed. Then, with overwhelming probability as $d \rightarrow \infty$, the quantum channels $\Phi(X)=U X U^{\dagger}$ and $\Psi(X)=V X V^{\dagger}$ become perfectly distinguishable: for $d$ large enough, +$$ \mathbb{P}\left[\|\Phi-\Psi\|_{\diamond}=2\right] \geq 1-\exp \left(-\frac{\log 2}{2} d^{2}\right) $$

+ +

If you're familiar with typicality results, then this is an example of concentration of measure phenomenon.

+ +

Note that this result is general than the one you're looking for since it requires only one of the channels to be Haar. Moreover, it fits nicely with the insights that John Watrous provided above; and the rest of the paper has generalizations to random matrix theory.

+",1108,,,,,6/2/2020 2:44,,,,2,,,,CC BY-SA 4.0 +12287,1,12289,,6/2/2020 5:17,,0,292,"

I've started learning quantum computing using 'Learn quantum computation using qiskit', +and I've stumbled upon what I think is a bug in the code in chapter 1.3: Representing Qubit States +when I reached the part and run the code:

+ +
qc = QuantumCircuit(1) 
+initial_state = [0,1]   
+qc.initialize(initial_state, 0)
+qc.draw()   
+
+ +

It returned 'Attribute Error' +Saying that 'Initialize' object has no attribute 'label'

+",12233,,55,,6/3/2020 19:27,7/8/2020 0:30,Problem with code in 'Learning quantum computation using qiskit,,1,1,,,,CC BY-SA 4.0 +12288,2,,12275,6/2/2020 7:42,,2,,"

Let me start with a clarification:

+ +
+

Note that POVM itself doesn't describe the post-measurement state, + because $M′_i=UM_i$ for some unitary U gives the same POVM but different + post-measurement results.

+
+ +

The formalism you're talking about here is not POVMs. POVMs is when you only use the operators $E_i=M_i^\dagger M_i$, the point being that with these you can calculate the probability of the measurement outcome but cannot calculate the final state because, given $E_i$, I cannot find $M_i$ because any $M'_i$ would do just as well. If you are given the $\{M_i\}$, then the post-measurement state, as you state, is well defined: +$$ +\frac{M_i\rho M_i^\dagger}{\text{Tr}(\rho M_i^\dagger M_i)}. +$$ +The fact that other $M_i'$ give different outcomes is irrelevant. They're due to different measurements!

+ +

As I understand your actual question, you're wanting to understand the correspondence between +$$ +\text{Tr}_a ( P_i U \cdot \rho \otimes \rho_0 \cdot U^\dagger P_i) ~/~ n_i +$$ and +$$M_i \rho M_i^\dagger ~/~ \text{Tr}(\rho M_i^\dagger M_i) ?$$ +In particular, you want to go from $\{P_i\}$ and $U$ to finding $\{M_i\}$.

+ +

Let me start the other way around. If you're given a set $\{M_i\}$, then you can introduce an ancilla in the $|0\rangle$ state, and define a $U$ such that +$$ +U|\psi\rangle|0\rangle=\sum_i(M_i|\psi\rangle)\otimes|i\rangle, +$$ +in which case $P_i=I\otimes |i\rangle\langle i$. Note that, if we were given $U$ and $\{P_i\}$ of this form, we could easily calculate the $M_i$: +$$ +M_i=I\otimes\langle i|\cdot U\cdot I\otimes|0\rangle. +$$

+ +

Now, generically, if we're given $U$ and $\{P_i\}$, can we write down $\{M_i\}$? No, because they don't exist. Note that when $M_i$ acts on a pure state (every pure state), it must give a pure state output. That is extremely constraining on the possible forms of $U$ and $P_i$: $P_iU|\psi\rangle|0\rangle$ must be separable for all $|\psi\rangle$ and all $i$ that have non-zero outcome probabilities. To all intents and purposes, this reduces you to the previous case, up to a local unitary on system $a$.

+",1837,,1837,,6/2/2020 13:03,6/2/2020 13:03,,,,9,,,,CC BY-SA 4.0 +12289,2,,12287,6/2/2020 7:46,,2,,"

This is a known bug in Qiskit (https://github.com/Qiskit/qiskit-terra/issues/4439).

+ +

As a workaround, you can create an initialize gate and add the missing label using:

+ +
from qiskit.extensions import Initialize
+
+qc = QuantumCircuit(1)
+initial_state = [0,1]
+
+init_gate = Initialize(initial_state) # Create a new initialize gate
+init_gate.label = ""init""    # Add a label to avoid the bug
+
+qc.append(init_gate, 0)     # Perform the gate on the 0th qubit
+qc.draw()    # Draw the circuit (to complete your code block)
+
+ +

Hope this helps!

+",10415,,,,,6/2/2020 7:46,,,,0,,,,CC BY-SA 4.0 +12290,1,,,6/2/2020 8:11,,3,76,"

A similar question has been previously asked & has an excellent answer discussing half, full & ripple carry adders. I am curious to find out how these adders would be constructed in the setting of photonic quantum computers (eg. with continuous variable qumodes instead of qubits).

+",2645,,,,,6/2/2020 8:11,How do I add 1+1 using a photonic computer?,,0,1,,,,CC BY-SA 4.0 +12291,2,,12280,6/2/2020 9:13,,3,,"

Qiskit is simply a python library so you can use it in the same way you would use any other python library in a Django project.

+ +

I am not sure how you would envision the user interface, but you could always use some kind of text input to allow the user to write code, have it execute on the backend and then pass the results back.

+",5955,,,,,6/2/2020 9:13,,,,0,,,,CC BY-SA 4.0 +12292,1,12315,,6/2/2020 12:03,,1,666,"

How could we construct a circuit with quantum gates for desired time-dependent hamiltonian?

+

For example suppose we wanna construct for below 3 types of hamiltonian :

+
    +
  1. a simple hamiltonian and time_independent without dissipation :$ 2\sigma_x+ 3 \sigma_z$
  2. +
  3. a time dependent hamiltonian without dissipation : $2\sigma_x+ 3t \sigma_z$
  4. +
  5. time dependent hamiltonian with dissipation
  6. +
+

Is there a general solution for construct gates for these hamiltonians ?

+",11971,,11971,,7/19/2020 13:18,7/19/2020 13:18,quantum gates hamiltonian,,1,0,,6/10/2020 10:34,,CC BY-SA 4.0 +12293,1,12317,,6/2/2020 16:39,,2,127,"

Here is the first article I could find on this idea in 2016:

+ +

https://arxiv.org/abs/1611.07690

+ +

And here is a patent in 2017 for a quantum electronic device developed with one of the authors of the paper, Mohammad Choucair along with Martin Fuechsle (who invented a single atom transistor):

+ +

https://patentscope.wipo.int/search/en/detail.jsf?docId=WO2017091870

+ +

The two are now working at Archer Materials to commercialize this idea.

+ +

Fuechsle is known for inventing a single-atom transistor, which has applications to the mentioned quantum device:

+ +

https://www.researchgate.net/publication/221840938_A_single-atom_transistor

+ +

This leads me to my questions:

+ +
    +
  1. How promising is a carbon-based qubit? Any disadvantages to this approach?
  2. +
  3. If topological quantum computing prevails, could a room temperature qubit based on carbon still be beneficial to topological quantum computing?
  4. +
  5. Is anyone outside of Archer Materials researching this approach?
  6. +
+",12236,,12236,,6/2/2020 17:57,7/3/2020 18:00,How promising is the possibility of carbon-based qubits to make a qubit that’s stable at room temperature?,,1,0,,,,CC BY-SA 4.0 +12294,1,12311,,6/2/2020 16:50,,3,420,"

In this Question Why do optical quantum computers not have to be kept near absolute zero while superconducting quantum computers do? +A comment said that the most common way to encode q information in photons is using their internal degrees of freedom, not using a ""there/not there"" encoding. +So does that mean that optical quantum computers that use photons doesn't suffer or suffers less from decoherence?

+ +

What sort of environmental noise causes decoherence?

+ +

What is the expected number of qubits that will allow us to build a universal quantum computer?

+",12207,,55,,6/3/2020 19:18,6/9/2020 13:13,Do photons also suffer from decoherence?,,1,0,,,,CC BY-SA 4.0 +12295,2,,12275,6/2/2020 20:02,,1,,"

I'll try to explain DaftWullie's answer as I see it. We assume $\rho_0 = |0\rangle\langle0|$.

+ +

If we have $P_i = I \otimes |i\rangle \langle i|$ then for any unitary $U$ on $H \otimes H_a$ operators $M_i$ can be computed by the formula +$$ M_i=I\otimes\langle i|\cdot U\cdot I\otimes|0\rangle.$$ +It shows that indirect projective measurement (in which PVM acts on the ancilla only) can be seen as a general measurement on the target system.
+This also works in the other direction $-$ general measurement $\{M_i\}$ on the target system can be seen as a unitary evolution $U$ of $\rho \otimes |0\rangle\langle0|$ followed by a PVM on the ancilla. The unitary can be derived from the equation +$$U|\psi\rangle|0\rangle=\sum_i(M_i|\psi\rangle)\otimes|i\rangle.$$

+ +

Such equivalence between measurements also known as Naimark's theorem.

+ +

Now, if $P_i$ is a PVM on the whole $H \otimes H_a$ then there are no $\{M_i\}$ in general.
+To see this consider $\rho = |\psi\rangle \langle \psi|$. In general, the state $P_iU|\psi\rangle|0\rangle$ will not be separable. In such case the state +$$\text{Tr}_a ( P_i U \cdot |\psi\rangle \langle \psi| \otimes |0\rangle \langle 0| \cdot U^\dagger P_i) ~/~ n_i $$ +will be mixed. But +$$M_i |\psi\rangle \langle \psi| M_i^\dagger ~/~ \text{Tr}(|\psi\rangle \langle \psi| M_i^\dagger M_i)$$ +is a pure state $-$ a contradiction, so there are no such $\{ M_i \}$.

+ +

But we can write that +$$\text{Tr}_a ( P_i U \cdot \rho \otimes |0\rangle \langle 0| \cdot U^\dagger P_i) ~/~ n_i = $$ +$$ = \sum_j I \otimes \langle j| \cdot P_i U \cdot \rho \otimes |0\rangle \langle 0| \cdot U^\dagger P_i \cdot I \otimes |j\rangle ~/~ n_i = $$ +$$ = \sum_j \big(I \otimes \langle j| \cdot P_i U \cdot I \otimes |0\rangle \big) \rho \otimes 1 \big(I \otimes \langle 0| \cdot U^\dagger P_i \cdot I \otimes |j\rangle \big) ~/~ n_i = $$ +$$ = \sum_j M_{ij} \rho M_{ij}^\dagger ~/~ n_i,$$ +where +$$ M_{ij} = I \otimes \langle j| \cdot P_i U \cdot I \otimes |0\rangle.$$

+ +

So, the $i$-th post measurement state can be seen as an output of some quantum channel (that depends on $i$). Though, this was natural to expect, according to the general theory.

+",5870,,,,,6/2/2020 20:02,,,,0,,,,CC BY-SA 4.0 +12296,1,12310,,6/2/2020 20:12,,-1,78,"

I'm very new to quantum computing. I was just wondering if a quantum computer simulator could be faster than a normal computer when running on a normal computer. Could it?

+",12238,,,,,6/3/2020 8:03,Could a quantum computer simulator be faster than a normal computer when running on a normal computer?,,2,0,,,,CC BY-SA 4.0 +12297,2,,12296,6/2/2020 20:53,,1,,"

No, it could not.

+ +

First of all, when you simulate a quantum computer, you simulate it at executing a quantum algorithm on a specific problem instance. If you manage to simulate such an execution on a classical computer, this means that the result of your quantum computation could be achieved by means of a classical algorithm, so it is not interesting.

+",5551,,,,,6/2/2020 20:53,,,,0,,,,CC BY-SA 4.0 +12298,2,,12196,6/2/2020 21:31,,0,,"

I think there is an unambiguous (in some sense) definition of a controlled quantum channel (also see the update).

+ +

Any quantum channel from $H$ to $H$ (actually, from $\mathcal{L}(H)$ to $\mathcal{L}(H)$) has a representation +$$ \Phi(\rho) = \text{Tr}_2 (U \rho \otimes \rho_2 U^\dagger),$$ +where $U$ is a unitary on $H \otimes H_2$, $H_2$ is the ancilla space, $\rho_2$ is a density matrix on $H_2$ and $\rho$ is on $H$.

+ +

Clearly, this formula doesn't depend on the phase of $U$. But we have similar situation in the simple case of controlled unitaries. Moreover, as I've learned from physicists, phases of physical unitaries matter $-$ we can distinguish them (e.g. if we are given some physical blackbox unitaries).

+ +

So, the controlled version of it is the channel +$$ C(\Phi)(\rho') = \text{Tr}_2\big(C(U) \cdot \rho' \otimes \rho_2 \cdot C(U)^\dagger\big),$$ +where we introduce control qubit space $H_0$, so $\rho'$ is a density matrix on $H_0 \otimes H$ and $C(U)$ is the controlled unitary on $H_0 \otimes H \otimes H_2$.

+ +

It's hard to say what this means from the point of view of Kraus decomposition (which ignores the phase).

+ +

Update
+Actually, not only the phase of $U$ matters. From the Craig Gidney's answer we see that if $\rho_2 = |0\rangle\langle0|$ on the 1-qubit ancilla, $U_1 = CNOT$, $U_2 = X\otimes I \cdot CNOT \cdot X\otimes I$ then +$$ \Phi_1(\rho) = \Phi_2(\rho), $$ +but +$$ C(\Phi_1)(\rho') \neq C(\Phi_2)(\rho').$$

+ +

But I still think that this straightforward idea of fixing $U$ related to a quantum channel representation is the way to go.

+",5870,,5870,,6/3/2020 6:21,6/3/2020 6:21,,,,2,,,,CC BY-SA 4.0 +12299,1,,,6/2/2020 23:05,,1,318,"

Consider a pure state $\boldsymbol{\eta} \in \mathcal{H}_{AB}$. There exist orthonormal sets $\{\alpha_1, \alpha_2 \dots \alpha_i\} \subset \mathcal{H}_A$ and $\{\beta_1, \beta_2 \dots \beta_i\} \subset \mathcal{H}_B$, and real numbers $\lambda_k > 0$ such that +\begin{equation*} +\boldsymbol{\eta} = \sum_{i=1}^d \lambda_i \alpha_i \otimes \beta_i +\end{equation*} +My question is if it is it possible (if so, how?) to find $d$ without using the decomposition above.

+ +

What I have done so far is that I have set $\text{dim}\mathcal{H}_A=m$ and $\text{dim}\mathcal{H}_B = n$. This means that $d \leq \min(m,n)$. Besides this, I do not know what to do. I know about a theorem called Caratheodory's theorem, but I am not sure if it will help me here. Can I use any of this to show that $d$ only depends on $\boldsymbol{\eta}$? Thanks!

+",8400,,55,,10/12/2020 7:25,10/12/2020 7:25,Find the number of elements in the Schmidt decomposition of a pure state,,2,2,,,,CC BY-SA 4.0 +12300,1,,,6/2/2020 23:49,,3,115,"

For a quantum state on the form $$|\psi \rangle = \alpha |0 \rangle + \beta |1 \rangle$$ which possible qubit states can you construct from this? I know that $\alpha$ and $\beta$ must satisfy $$|\alpha|^2 + |\beta|^2 = 1$$ but are there any other requirements besides this?

+",8400,,491,,6/6/2020 21:06,6/6/2020 21:06,What are the possible qubit states?,,2,2,,,,CC BY-SA 4.0 +12301,1,12302,,6/3/2020 0:37,,1,173,"

I am interested in implementing a operation in Q#. The operation should follow the algorithm below: +

+ +

When $A=0$ it is quite easy to see that the algorithm states if the qubitt is in nullspace apply a transformation to flip the sign of the qubit.

+ +

I am not sure how to use the algorithm for the 'i is in A' case.

+",12239,,9006,,6/3/2020 7:44,6/30/2020 19:24,How can I code a Conditional phase shift transform?,,2,0,,,,CC BY-SA 4.0 +12302,2,,12301,6/3/2020 3:21,,2,,"

The trick here is to define a new operation whose unitary representation is +\begin{align} + S_a|i\rangle = \begin{cases} + -|i\rangle \text{ if } i = a \\ + |i\rangle \text{ otherwise } + \end{cases}. +\end{align}

+ +

At that point, $S_A = \prod_{a \in A} S_a$. +In Q#, you can implement $S_a$ easily using the ControlledOnInt operation, an auxillary qubit in the $|-\rangle$ state, and an X operation:

+ + + +
operation ApplyConditionalPhase(subset : Int[], register : LittleEndian)
+: Unit is Adj + Ctl {
+    using (aux = Qubit()) {
+        within {
+            // prepare aux in the |−⟩ state. 
+            H(aux);
+            Z(aux);
+        } apply {
+            for (element in subset) {
+                (ControlledOnInt(element, X))(register!, aux);
+            }
+        }
+    }
+}
+
+ +

This works using the same phase kickback principle as in the Deutsch−Jozsa algorithm; for more details on how phase kickback works, check out Chapters 6 and 7 of my book.

+",1978,,,,,6/3/2020 3:21,,,,11,,,,CC BY-SA 4.0 +12303,1,,,6/3/2020 6:47,,2,92,"

+ +

Hi. I'm trying to make a circuit including some Toffoli gates in Qiskit.

+ +

The problem is that, because of connectivity between qubits, some gates should be modified to satisfy it.

+ +

I've read this post similar to this problem: How is it possible to perform a c-not on 4 qubits using the same control qubits on IBM Q computers?

+ +

This helped me a lot, but I'm still uncertain that these two circuits are equivalent &

+ +

SWAP gates applied to $q_1, q_2, q_3$ don't affect after all works are done.

+ +

Thanks a lot.

+",12240,,9006,,6/3/2020 7:43,6/3/2020 7:43,Are these two circuits equivalent (using swap gates with control qubits)?,,1,0,,,,CC BY-SA 4.0 +12304,2,,12303,6/3/2020 7:42,,2,,"

Yes, they are equivalent. You've managed to include the ""uncompute"" sequences of swaps after the Toffoli, which are quite easy to overlook.

+ +

The way that I convinced myself that it was correct was to take each of the qubits $q_1$ to $q_3$ in turn ($q_0$ and $q_4$ being obvious). You can go from the start, and trace its effective position through the swaps and check that each of them comes out in the correct place (i.e. the same position as it started) and that what started as $q_3$ goes through the control of the Toffoli.

+",1837,,,,,6/3/2020 7:42,,,,0,,,,CC BY-SA 4.0 +12305,2,,12300,6/3/2020 7:47,,2,,"

There are no additional constraints on $\alpha$ or $\beta$. This means that we cannot directly answer the question of ""which possible qubit states can you construct"" because that suggests an enumeration, but this corresponds to a continuum of states!

+ +

Note that a particularly convenient way of writing these is +$$ +e^{i\gamma}(\cos\theta|0\rangle+\sin\theta e^{i\phi}|1\rangle), +$$ +with $\theta\in[0,\pi)$ and $\phi\in[0,2\pi)$, as this automatically takes care of the normalisation in the parametrisation. Also, the $e^{i\gamma}$ term is strictly unnecessary because it has no observable consequences, but I left it in there so that it gives a mathematical identity with the $\alpha,\beta$ formulation.

+ +

If you are asking how to go from the state $|0\rangle$ to any state $|\psi\rangle$ that you want, then start from the parameterisation above, and consider +$$ +R_y(2\theta)|0\rangle=(I\cos\theta-i\sin\theta Y)|0\rangle=\cos\theta|0\rangle+\sin\theta|1\rangle, +$$ +so that you can then just follow it up with +$$ +R_z(\phi)R_y(2\theta)|0\rangle=(I\cos\frac{\phi}{2}-i\sin\frac{\phi}{2} Z)(\cos\theta|0\rangle+\sin\theta|1\rangle)=e^{-i\phi/2}|\psi\rangle +$$ +So you can prep any state you want with two single-qubit rotations (up to an irrelevant global phase).

+",1837,,1837,,6/4/2020 8:18,6/4/2020 8:18,,,,0,,,,CC BY-SA 4.0 +12306,2,,12300,6/3/2020 7:51,,2,,"

Any unitary transformation preserves angles and length of vectors it is applied upon.

+ +

Therefore, an unitary transformation applied on your states $|\psi\rangle$ will lead to state $|\psi_1\rangle = \alpha_1|0\rangle + \beta_1|1\rangle$ satisfying $|\alpha_1|^2+|\beta_1|^2=1$.

+ +

Since any gate in a quantum computer must be unitary (if we do not count measurement which is special case), you can do any operation you want and requirements on qubit will be preserved.

+ +

Taking appropriate unitary trasformation $U$, you can convert any state $|\psi\rangle$ to any other state $|\psi_1\rangle$.

+",9006,,,,,6/3/2020 7:51,,,,3,,,,CC BY-SA 4.0 +12307,1,12309,,6/3/2020 7:56,,1,193,"

IBM Q backends have many different names, see for example this link. We have for example processors called Melbourne, Tokyo, Armonk etc.

+ +

I am curious where these names come from? For example, I know that IBM headquarter is placed in Armonk, NY. But what about others? Is there any special logic behind naming IBM processors?

+",9006,,5955,,6/3/2020 11:11,6/3/2020 11:11,Names of IBM Q backends,,1,2,,,,CC BY-SA 4.0 +12308,2,,12299,6/3/2020 7:59,,2,,"

A priori, the only thing you can know is, as you say, $d\leq\min(m,n)$. To get more information, you're going to have to do a state-dependent calculation.

+ +

Let's say you're told $|\eta\rangle$ but not its Schmidt decomposition. So, you possibly have +$$ +|\eta\rangle=\sum_{i,j}\eta_{ij}|i\rangle_A|j\rangle_B, +$$ +and you want to know how many non-zero Schmidt coefficients it has. There are several ways which are all variants on making a start to finding the Schmidt decomposition. For example, you could calculate +$$ +\rho_A=\text{Tr}_B|\eta\rangle\langle\eta|. +$$ +In this case, $d=\text{rank}(\rho_A)$, so you just have to find the number of non-zero eigenvalues of $\rho_A$.

+ +

Equally, just write the coefficients $\eta_{ij}$ as an $m\times n$ matrix and find the rank (i.e. number of non-zero singular values).

+",1837,,,,,6/3/2020 7:59,,,,0,,,,CC BY-SA 4.0 +12309,2,,12307,6/3/2020 8:02,,3,,"

The documentation states that ""All quantum systems are given a city name, e.g., ibmq_johannesburg. This name does not indicate where the actual quantum system is hosted.""

+ +

https://quantum-computing.ibm.com/docs/cloud/backends/configuration

+ +

Some cities (e.g., Yorktown) host IBM Research centers.

+",5551,,,,,6/3/2020 8:02,,,,0,,,,CC BY-SA 4.0 +12310,2,,12296,6/3/2020 8:03,,3,,"

I could argue your answer in either way, based on semantics.

+ +

The basic answer is as Michele said: no. The classical simulation of a quantum algorithm is itself a classical algorithm. So that cannot outperform the best possible classical algorithm.

+ +

However, you can turn that around a little bit. It is possible that the classical simulation of a quantum algorithm can outperform the best classical algorithm currently known. You get a new ""quantum inspired"" algorithm that performs better than anything we had before. In that sense, it can be a valuable research direction, for example.

+",1837,,,,,6/3/2020 8:03,,,,1,,,,CC BY-SA 4.0 +12311,2,,12294,6/3/2020 8:13,,3,,"
+

A comment said that the most common way to encode q information in photons is using their internal degrees of freedom, not using a ""there/not there"" encoding.

+
+ +

When using photons, quantum information can indeed be encoded into an internal degree of freedom; for instance the polarization of the photon.

+ +

However, there are plenty of other systems where the information is encoded into an internal degree of freedom; a very clear example is an electron confined to a quantum dot (also loosely known as a semiconductor qubit). Here, the information is encoded into the qubits spin, which is definitely 'internal'. Such a semiconducting qubit definitely needs to be cooled (although its temperature can be higher than that of superconducting qubits!).

+ +

Moreover, there exist many encodings of quantum information for photons, and not all of them are 'internal'. In QKD systems, (on of) the most used encoding is the time-bin encoding, which to me is absolutely (in your terms) a ""there/not there"" encoding.

+ +
+

So does that mean that optical quantum computers that use photons doesn't suffer or suffers less from decoherence?

+
+ +

With those two previous things in mind I would argue that the discerning property for the amount of decoherence is not the 'internal-vs-external' encoding nature of the qubit. +You might be able to argue that photonic (quantum) computers suffer from different kinds of decoherence though...

+ +
+

What sort of environmental noise causes decoherence?

+
+ +

Well, pretty much anything. Decoherence is quite a broad term and can be seen as loosing the coherent quantum information because the system couples (uncontrolled and unknowingly) with the environment. Thermal noise is a huge issue for many qubit architectures, and indeed it is less so a problem for photonic quantum computers.

+ +

What is a large source of decoherence of photonics quantum computers is photon loss. Dependent on the encoding of the qubit, you may treat this as leakage (for 'internal' encodings) or as decoherence (or even amplitude damping; for 'external' encodings). Whatever you call it, photons may exit the system through modes that you don't intend/expect it to.

+ +

Of course there are other types of environmental noise, including, but not limited to:

+ +
    +
  • Magnetic coupling
  • +
  • Electric coupling
  • +
  • Stray photons
  • +
  • Mechanical (not an issue for most architectures)
  • +
+ +
+

What is the expected number of qubits that will allow us to build a universal quantum computer?

+
+ +

This is an entirely different questions, and we need to treat it carefully. +If we are talking about a universal fault-tolerant computer (loosely speaking the high-in-the-sky 'end goal' of all quantum computer manufacturing efforts) the answer is:

+ +

many, many many qubits. No I really mean a lot. This paper states the need of $20$ million noisy (by then state-of-the-art noise levels, if I recall correctly) qubits to factor a $2048$ RSA key in $8$ hours. This number can be brought down in four ways:

+ +
    +
  • Better noise characteristics for the physical qubits.
  • +
  • Better error correction and fault-tolerance schemes.
  • +
  • Better connectivity between the qubits to reduce overhead.
  • +
  • Smarter compilation & algorithms.
  • +
+ +

With the current fault-tolerant methods it is actually quite hard to determine the actual total need of physical qubits for a general fault-tolerant universal quantum computation, so that's why this paper was actually worth publishing at all.

+ +

If we are talking about quantum supremacy (loosely speaking the moment that we have a quantum computer that can perform something that a classical computer cannot do sensibly; some people don't even put on the constraint that it has to be something useful) then I would say that at around $~100$ qubits we will have a definite answer. Something useful (if not very limited) coming out of the computation will impose the need for a multiplying factor of (I guess) $2$ or $3$.

+",8141,,8141,,6/9/2020 13:13,6/9/2020 13:13,,,,0,,,,CC BY-SA 4.0 +12312,1,,,6/3/2020 8:52,,1,76,"

What kind of software is used for modelling quantum processor architectures? Not just simulate the output, but the one that is actually used in research.

+",1844,,491,,7/17/2020 23:41,4/14/2021 1:54,Software used for modelling quantum processors,,2,1,,,,CC BY-SA 4.0 +12313,1,,,6/3/2020 12:27,,8,845,"

I am trying to understand a test called Hadamard Overlap Test, which consists of a destructive swap test (section IV of swap test and Hong-Ou-Mandel effect are equivalent) right after a Hadamard test. The circuit is from the Variational Quantum Linear Solver paper:

+ +

+ +

The authors claim that ""conditioning the measurement on the ancilla qubit to yield the $|\boldsymbol{0}\rangle$ +state, we can perform the depth-two Overlap circuit between registers S1 and S2 to get"": +\begin{equation} +\begin{aligned} +P(0) &=\frac{1}{2}\left(\left\langle\mathbf{0}\left|U^{\dagger} V\right| \mathbf{0}\right\rangle\left\langle\mathbf{0}\left|V^{\dagger} U\right| \mathbf{0}\right\rangle\right.+\left\langle\mathbf{0}\left|U^{\dagger} A_{l^{\prime}} A_{l} V\right| \mathbf{0}\right\rangle\left\langle\mathbf{0}\left|V^{\dagger} A_{l}^{\dagger} A_{l^{\prime}}^{\dagger} U\right| \mathbf{0}\right\rangle \\ +&\left.+\operatorname{Re}\left[\left\langle\mathbf{0}\left|U^{\dagger} A_{l} V\right| \mathbf{0}\right\rangle\left\langle\mathbf{0}\left|V^{\dagger} A_{l^{\prime}}^{\dagger} U\right| \mathbf{0}\right\rangle\right]\right) +\end{aligned} +\end{equation}

+ +

$|\boldsymbol{0}\rangle$ represents a vector of 0 qubits, those making up the registers $S_1$ or $S_2$. +I can't understand how to derive this result. In particular, I have the following questions:

+ +
    +
  • What are we exactly measuring by $P(0)$? From the circuit, it seems like all the qubits are measured, and that is also the case when you do a swap test according to the reference above. I initially thought that $P(0)$ is the probability of getting 0 in the ancilla, but this should not be the case, because otherwise what is the effect of the CNOT and H performed? What I mean is that the gates inside the box are not controlled on the ancilla, so they cannot change the outcome of the ancilla.
  • +
  • How do you get to this result? Below is my attempt and what I achieved so far
  • +
+ +

\begin{equation} +\begin{aligned} +& |0 \rangle |\boldsymbol{0} \rangle |\boldsymbol{0} \rangle \xrightarrow{V, U} |0 \rangle V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle \xrightarrow{H}\frac{1}{\sqrt{2}}\left(|0 \rangle +|1 \rangle \right)V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle \xrightarrow{A_l, A_{l'}^{\dagger}}\\ &\frac{1}{\sqrt{2}}\left(|0 \rangle V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle +|1 \rangle A_lV|\boldsymbol{0} \rangle A_{l'}^{\dagger}U|\boldsymbol{0} \rangle \right) \xrightarrow{H}\\ +& \frac{1}{2}\left[|0 \rangle(V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle +A_lV|\boldsymbol{0} \rangle A_{l'}^{\dagger}U|\boldsymbol{0} \rangle )+|1 \rangle (V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle -A_lV|\boldsymbol{0} \rangle A_{l'}^{\dagger}U|\boldsymbol{0} \rangle )\right] +\end{aligned} +\end{equation} +Now, one measures the ancilla, if it results in a 0 state, the system collapses in +\begin{equation} +\frac{1}{2}(V|\boldsymbol{0} \rangle U|\boldsymbol{0} \rangle +A_lV|\boldsymbol{0} \rangle A_{l'}^{\dagger}U|\boldsymbol{0} \rangle) +\end{equation} +How does one implement the the CNOTs and H now? What are the further steps that yields the results of the authors?

+",11551,,55,,7/26/2020 18:04,10/14/2022 18:24,Hadamard Overlap Test,,1,3,,,,CC BY-SA 4.0 +12314,2,,12096,6/3/2020 14:01,,0,,"

For you first question, I do not think you can get the time_taken for each individual circuit that were sent bundled into one job. I believe, like you saw in your example, it will only show the time_taken to complete the entire job.

+ +

For your second question, it is possible to queue multiple jobs without waiting for one of them to finish. The only blocker that will not allow you to continue until it completes, is calling job.result(). If you call this and then try to submit another job, the next job will not go through until you receive the results from the previous one. However, if you do not call job.result() right away, then you can continue to submit jobs, even though the previous ones have not completed.

+ +

So, you should be able to run something similar to the following code snippet to accomplish what you want:

+ +
jobs = []
+for _ in range(<num_of_iterations>):
+    job = execute(circ, backend)
+    jobs.append(job)
+
+for j in jobs:
+    print(j.result().time_taken)
+
+ +

That should execute each job sequentially without waiting for the previous one to finish. It then stores each job in a list so you can retrieve the time_taken of each job afterwards. Though, if running through the general ""open"" provider, there is a 5 simultaneously queued/running jobs limit, so you will not be able to submit more than that limit at one time.

+",6180,,,,,6/3/2020 14:01,,,,0,,,,CC BY-SA 4.0 +12315,2,,12292,6/3/2020 14:34,,1,,"

Given an initial state $\vert \psi_0 \rangle$ and a Hamiltonian $H$ for the system, the system evolves (in the non-relativistic limit) from time $t_0$ to $t_1$ by +$$\vert \psi_1 \rangle = e^{-iH(t_1-t_0)}\vert \psi_0 \rangle = U_t \vert \psi_0 \rangle,$$ +where $H$ is Hermitian resulting in $U_{t}$ being unitary. The time evolution described by this equation can be represented in a quantum circuit by preparing the state $\vert \psi_0 \rangle$ and then applying a $U_{t}$ gate.

+ +

Setting $\vert \psi_0 \rangle = \vert 0 \rangle$ and $t = t_1-t_0$ a quantum circuit representing the equation above is nothing more than

+ +

+ +

For the Hamiltonian in your question, $H=2 \sigma_x+3 \sigma_z$, you can calculate $U(t)$ for any given $t$. For an easy example, consider $t=\frac{\pi}{2\sqrt{13}}$, +$$U \left(\frac{\pi}{2\sqrt{13}} \right) = \begin{bmatrix} -\frac{3}{\sqrt{13}}i & -\frac{2}{\sqrt{13}}i \\-\frac{2}{\sqrt{13}}i & \frac{3}{\sqrt{13}}i \end{bmatrix}.$$

+ +

To actually run this on a quantum chip, we would need to decompose the general unitary transformation (the pseudo-gate $U(t)$) from the equations describing the system into some combination of transformations available in the set of available universal quantum gates (up to global phase).

+ +

If we wanted to perform the transformation above in IBM's environment (Qiskit), for example, the eigendecomposition is all we need. This is not generally true, but in this particularly simple example $U$ decomposes into two $SO(2)$ rotations and a $Z$ transformation. Define the rotation

+ +

$$ R_y = \begin{bmatrix} \sqrt{\frac{1}{2}+\frac{3}{2 \sqrt{13}}} & -\sqrt{\frac{1}{2}-\frac{3}{2 \sqrt{13}}} \\ \sqrt{\frac{1}{2}-\frac{3}{2 \sqrt{13}}} & \sqrt{\frac{1}{2}+\frac{3}{2 \sqrt{13}}} \end{bmatrix},$$ +then +$$U \left(\frac{\pi}{2\sqrt{13}} \right) = -i R_y \sigma_z R_y^\dagger.$$ +Noting that the leading $-i$ is a global phase factor and can be disregarded, we can turn this into actual Qiskit code to generate this transformation on actual IBM hardware.

+ +
qc=QuantumCircuit(1)
+qc.ry(2*acos(sqrt(1/2+3/(2*sqrt(13)))),0)
+qc.z(0)
+qc.ry(-2*acos(sqrt(1/2+3/(2*sqrt(13)))),0)
+
+ +

+ +

There are any number of other possible ways to implement this transformation in Qiskit, this is just one possible approach.

+",8623,,8623,,6/3/2020 19:16,6/3/2020 19:16,,,,0,,,,CC BY-SA 4.0 +12316,1,12735,,6/3/2020 15:15,,5,379,"

I am trying to understand just the first step of the proof fo Lemma 53 of this paper, with scarce success.

+

Before starting, let me state this definition:

+

Definition: Block encoding of operator A. +Let $A$ be a $s$-qubit operator, and $\alpha, \epsilon \in \mathbb{R}_+$ and $a \in \mathbb{N}$. Then, we say that a $(s+a)$-qubit unitary $U$ is a $(\alpha, a, \epsilon)$ block encoding of $A$ if: +$$\|A - \alpha(\langle0|^{\otimes a} \otimes I) U (|0\rangle^{\otimes a} \otimes I) \| \leq \epsilon $$

+

This is the statement I would like to prove:

+

Lemma 53: (Product of block-encoded matrices) +If $U$ is an $(\alpha, a, \delta)$-block encoding of an $s$-qubit operator $A$, and $V$ is an $(\beta,b,\epsilon)$-block encoding of a s-qubit operator $B$, then $(I_b \otimes U)(I_a \otimes V)$ is an ($\alpha\beta, a+b, \alpha\epsilon + \beta\delta)$-block encoding of $AB$.

+

The first step of the proof is writing the definition of block encoding, which for this case s: +$$\| AB - \alpha\beta(\langle 0| ^{\otimes a+b} \otimes I )(I_b \otimes U)(I_a \otimes V)(|0\rangle^{\otimes a+b} \otimes I) \| =$$

+

I understand all the steps of the proof, but I don't understand the first passage. Why the previous equation should be equal to:

+

$$=\|AB - \alpha(\langle 0| ^{\otimes a} \otimes I )U(|0\rangle ^{\otimes a} \otimes I )\beta(\langle 0|^{b} \otimes I)V(|0\rangle^{\otimes b} \otimes I) \| $$

+

This looks similar to the cases where I can apply the property that: +$$(A \otimes B)(|x\rangle \otimes |y\rangle) = (A|x\rangle \otimes B|y\rangle) $$

+

But I really don't see how in this case. I suppose there is some abuse of notation hidden somewhere. Probably, knowing the dimension of the various $I$ identity matrices would help the understanding..

+

Remark: in the statement of the Theorem there is a small footnote where they claim +"The identity operators act on each others ancilla qubits, which is hard to express properly using simple tensornotation, but the reader should read this tensor product this way."

+",1644,,1644,,7/1/2020 9:13,7/1/2020 10:52,Product of block-encoded matrices,,1,0,,,,CC BY-SA 4.0 +12317,2,,12293,6/3/2020 17:12,,5,,"

In my opinion this is not a very promising qubit for quantum computing, though it may hold more promise for quantum sensing or communication.

+ +

Making a qubit, a two-level quantum system, is not that hard, but making a good qubit is very hard. David DiVincenzo laid out 5 criteria on which you could gauge how good a qubit is for quantum computing. https://en.m.wikipedia.org/wiki/DiVincenzo%27s_criteria +Going through those criteria it becomes obvious where the system demonstrated in the first paper falls short.

+ +

First what they did right, they developed and characterized a new spin qubit and demonstrated that they can manipulate it with microwaves in a magnetic field. (Somewhat fulllfilling criteria 1 and 4)

+ +

They also demonstrated long, for this type of system, coherence times (175 ns). However, if you consider their minimum gate times, about 16 ns, those coherence times really aren't that long. And just as an example other organic radicals (which could be considered qubits) can exceed 10 us at room temperature. https://doi.org/10.1021/acs.jpcb.5b03027

+ +

Next the biggest problem comes from scaling the systems, both down to the single qubit level(criteria 5) and to multi-qubit systems (criteria 1 and 3).

+ +

They were working with ensembles of qubits, I'd you want to use those qubits in a fashion similar to topological QC's, you ideally need to work with single qubits. Single spin magnetic resonance is very hard and there are really only two solutions: a superconducting microwave resonator, which commonly require low temperature; or optical detection, which require very specific photophysical processes in order to read out the spinstate. Nitrogen vacancy centers are a good example of a spin system with optical detection.

+ +

That said, there are proposal about how to perform ensemble quantum computing, where you basically get your statistics out in one shot which would render that point moor.

+ +

Scaling up to multi-qubit devices also poses a challenge. One way to have qubits communicate is through spin spin interactions, but those tend to also destroy the coherence times. There might be other clever ways to enable communication between qubits so we can use two qubit gates but I'm unfamiliar with them.

+ +

Lastly, the biggest issue with spin qubits in in criteria 2, initialization. Unfortunately, many of the spin qubits systems rely on thermal Boltzmann population and T1 relaxation to provide polarization. In order to get close to a pure starting state one needs to go to very high fields(>3T) and very low temperature (<4K) +Though, optically generated polarization is a thing but just like with optical readout, you need to satisfy very specific photophysical conditions.

+ +

Overcoming these challenges is not just unique to the paper you cited, but to the very diverse field of electron spin qubits(which includes solid state defects, and a huge range different sized and composition molecules).

+",9579,,,,,6/3/2020 17:12,,,,0,,,,CC BY-SA 4.0 +12318,1,12319,,6/3/2020 21:16,,3,80,"

I've been trying to solve this question

+ +

+ +

It seems that in order to show it has unit length, we must show that $$ \frac{1}{d} \sum_{m, n=0}^{d=1} \lvert U_{m, n}\rvert ^2 = 1 $$

+ +

I've tried searching online for this type of relation on unitary matrices but haven't succeeded in finding anything. Would appreciate any help.

+",12243,,55,,6/4/2020 15:01,6/4/2020 15:01,Bipartite states whose coefficients are entries of a unitary matrix,,2,0,,,,CC BY-SA 4.0 +12319,2,,12318,6/3/2020 22:32,,2,,"

It may be more helpful to think about the relationship you need to show in terms of the Hermitian form $\sum \limits_{m,n=0}^{d-1} U_{m,n} U_{m,n}^\ast = d$, which is a necessary condition for the defining unitary relationship $UU^\dagger = I$.

+ +

To see this explicitly, consider the four equations implicit in the $d=2$ case: $$UU^\dagger=\begin{bmatrix} U_{1,1} & U_{1,2} \\ U_{2,1} & U_{2,2} \end{bmatrix} \begin{bmatrix} U_{1,1}^\ast & U_{2,1}^\ast \\ U_{1,2}^\ast & U_{2,2}^\ast \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}.$$ +The diagonal terms are what you need for the desired relationship: +$$(U_{1,1} U_{1,1}^\ast + U_{1,2} U_{1,2}^\ast) + (U_{2,1} U_{2,1}^\ast + U_{2,2} U_{2,2}^\ast) = 1 + 1 = 2.$$ +It should not be hard to convince yourself that this generalizes to any $d$.

+",8623,,8623,,6/3/2020 22:42,6/3/2020 22:42,,,,0,,,,CC BY-SA 4.0 +12320,2,,12318,6/4/2020 0:14,,2,,"

A matrix is unitary iff its columns (equivalently, rows) are orthonormal (see e.g. Wikipedia).

+ +

The sum $\sum_{nm}|U_{nm}|^2$ can be thought of as the sum of the squared norms of the rows of $U$ (equivalently, of the columns of $U$). As each such row (column) has unit norm, the sum of these norms must equal $d$.

+ +

Being $U$ unitary, its SVD has the form $U=\sum_k |u_k\rangle\!\langle k|$ for some orthonormal basis $(|u_k\rangle)_k$. The corresponding state $|\Psi\rangle$ thus reads +$$|\Psi\rangle = \frac{1}{\sqrt d}\sum_{k=1}^d |u_k\rangle\otimes|k\rangle,$$ +which is the maximally entangled state.

+",55,,,,,6/4/2020 0:14,,,,0,,,,CC BY-SA 4.0 +12321,1,12322,,6/4/2020 2:26,,3,974,"

How to decompose a unitary single qubit gate? I have read some paper or books, which told me a unitary single qubit gate could be decomposed by universal quantum gates set. For example {phase gate, Hadamard gate} is one of them. But they don't tell me how to do. I just understand the method of decomposition is exist, but I don't know how to decompose. The existence is proved by Solovay–Kitaev theorem, and some paper also show that {phase gate, Hadamard gate} can be used as a universal quantum gate set. But is there a pratical method to solve ""how to use {phase gate, Hadamard gate} to decompose a single qubit quantum gate? I want to know about the specific procedure.For example, How to use {phase gate, Hadamard gate} to decompose Pauli Z ?

+",11765,,55,,6/8/2020 12:29,6/8/2020 12:29,How to decompose a unitary single qubit gate by universal quantum gate set?,,2,1,,,,CC BY-SA 4.0 +12322,2,,12321,6/4/2020 4:21,,2,,"

The phase gate, $S = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix}$ is just the square root of Pauli Z, so the specific decomposition in your question is nothing more than $Z = SS$.

+ +

The Hadamard gate can be used, for example, with Z to decompose Pauli X as $X = HZH$, which is an eigendecomposition of X. So if by chance you didn't have S, but had $\lbrace X, H \rbrace$ instead, you could get Z from $Z=HXH$.

+ +

As a practical matter, finding decompositions of arbitrary unitary gates into a discrete set of universal gates is not straightforward. In fact, as far as I know, finding the theoretical limit of the Solovay-Kitaev theorem is still an open problem. Section 4.5 of Nielsen and Chuang gives a good overview if you're looking for a solid foundation in the basic principles.

+",8623,,8623,,6/4/2020 4:35,6/4/2020 4:35,,,,3,,,,CC BY-SA 4.0 +12323,2,,12312,6/4/2020 6:26,,1,,"

As mentioned in the comment, you can use simulators in web-interfaces of quantum processors providers. Here are links to the providers offering their platforms for free:

+ + +",9006,,,,,6/4/2020 6:26,,,,0,,,,CC BY-SA 4.0 +12324,2,,12321,6/4/2020 7:22,,4,,"

You need to be a little careful with terminology. When you say ""phase gate"", what precisely do you mean? Often, that terminology refers to the gate $S=\sqrt{Z}$. In this context, I am assuming this is not what you mean because $S$ and $H$ are not universal for single-qubit gates. However, for completeness, you were asking how to make $Z$, which is trivial: $Z=S^2$.

+ +

You might mean an arbitrary phase gate $R_z(\theta)=e^{iZ\theta/2}$ where you can choose any/all $\theta$ values. In that case, your special case is $Z=R_z(\pi)$ (up to a global phase). You can decompose any arbitrary single-qubit unitary, making use of Euler angles (or just brute force) to give the decomposition +$$ +U=e^{i\delta}R_z(\alpha)HR_z(\beta)HR_z(\gamma). +$$ +There are other questions.answers on this site with more details about how to find what the parameters are.

+ +

What you seem to imply in comments is that you're really interested in the set $H$ and $T$ ($S=T^2$). In that case, $Z=T^4$. If you want to find a good decomposition of an arbitrary single-qubit unitary in terms of $H$ and $T$, you need the Solovay-Kitaev algorithm. Dawson wrote quite a useful paper on how to do it.

+ +

More recent work has reduced the number of gates needed to synthesise the same unitary. Unless things have moved on, the way that I understand it working is that you first have to run the Solovay-Kitaev algorithm. This finds a good approximation of your unitary $U$ in the particular formulation required for an exact decomposition. It even gives you a sequence that makes it. But if you run Algorithm 1 from the Kliuchnikov et al. paper, that will give you a shorter sequence (guaranteed to be the shortest sequence up to some finite overhead). I find algorithm 1 to be pretty clear, it just leaves you with two technical problems: (i) evaluating the sde for a given unitary, and (ii) enumerating all the sde$\leq 3$ cases and how to make them. Persumably the code they provide could help you with those.

+",1837,,,,,6/4/2020 7:22,,,,0,,,,CC BY-SA 4.0 +12325,1,12329,,6/4/2020 12:45,,4,791,"

The term 'classical computer' is always used to mean standard digital computation (Turing model, Boolean circuits or just good old RAM). I have never seen it to mean other models of computation based on classical physics (such as analog computation). This is evident when papers talk about the classical complexity of a problem, when what is meant is the complexity defined given a digital model of computation.

+ +

Do we gain anything by 'classical' instead of 'digital', or is it just a shibboleth?

+",409,,,,,6/5/2020 2:06,Why do we say 'classical computer' to mean 'digital computer'?,,2,0,,,,CC BY-SA 4.0 +12326,2,,12299,6/4/2020 13:09,,0,,"

It is important to refer the the concept of Schmidt rank to understand the minimum number of terms required in this summation expression. The Schmidt rank of vectors (pure states) and Schmidt number of states in a bipartite finite dimensional Hilbert space are measures of entanglement.

+ +

The concept of a subspace that does not contain any vector of Schmidt rank is quite useful to understand the bounds. It is proved by T. Cubitt, A. Montanaro, and A. Winter that the dimension of any subspace with Schmidt rank is bounded.

+",4501,,,,,6/4/2020 13:09,,,,0,,,,CC BY-SA 4.0 +12327,2,,12325,6/4/2020 13:21,,1,,"

I think the reason is that 'classical' is more effective.

+ +

Maybe too much. Some colleagues of mine that are not working on quantum computing, do not like the expression 'classical computing' as they think it is used with a derogatory intent, meaning 'old fashioned', 'outdated'.

+",5551,,5551,,6/4/2020 13:29,6/4/2020 13:29,,,,0,,,,CC BY-SA 4.0 +12328,2,,12285,6/4/2020 13:23,,1,,"

Quantum machine learning can help you to enhance classical machine learning algorithms by outsourcing difficult calculations to a quantum computer. You can also optimise quantum algorithms using classical machine learning architectures.

+ +

IBM researchers have developed a series of quantum algorithms that show how entanglement can improve AI classification accuracy. It is demonstrating a Quantum Classifier. It is available online on IBM Bluemix in the following link. Also IBM has demonstrated Hybrid quantum - classical neural networks with PyTorch and Qiskit online in the following documentation.

+ +

When you are working on a Quantum Classifier for a dataset, we need to first encode the data into the amplitudes of a quantum state. In fact, one needs to first normalise the data such that it can be represented as a vector on a high-dimensional Bloch sphere. Quantum routines to encode data in amplitudes, so called arbitrary state preparation routines, are known to do this with a runtime that is linear in the data size, and this is arguably the best our algorithm can do in terms of runtime, since the data is the input to the problem.

+",4501,,,,,6/4/2020 13:23,,,,0,,,,CC BY-SA 4.0 +12329,2,,12325,6/4/2020 14:02,,4,,"

I think we do gain a little bit by saying ""classical"" instead of ""digital"".

+ +

As you point out, you can certainly build classical analog computers, and in the past these were very useful. But I believe that such classical analog computer can all be efficiently simulated by digital computers - not in the sense that a digital circuit can necessarily mimic the exact physical evolution of the computer, but in the sense that they can in principle solve any given problem with a similar asymptotic runtime (possibly up to polynomial speedups or slowdowns). In other words, I think it's generally believed that the extended Church-Turing thesis holds for all physically realizable computers whose behavior does not essentially rely on quantum mechanics. (You might argue that this claim is vague or even circular, but I think that with some work you can make it both true and noncircular. Note that this claim certainly hasn't been rigorously proven, but I think it's generally accepted to be true in our world.)

+ +

So I think that referring to these computers by the broad term ""classical"" usefully conveys the highly nontrivial insight of the extended Church-Turing thesis: that if you just care about ""macro"" features like the asymptotic runtime, then it doesn't actually matter whether your computer is digital or analog - what matters is whether it can use inherently quantum phenomena like superpositions and entanglement in a controlled fashion.

+ +

Edited to add. James Wootton asks in a comment whether it's been proven that classical analog computers can be efficiently simulated. The answer is no, but I personally think that that question is making a bit of a category error. The way I see it, the extended Church-Turing thesis is not quite a sharp enough statement to be mathematically provable or falsifiable (although restricted versions may be). It's more like a general principle that evidence can accumulate to either suggest is useful or not useful. (More along the lines of a statement like ""All physical regimes can be described by some type of action principle"" than a mathematical proposition.)

+ +

By the way, I highly recommend Scott Aaronson's paper ""NP-complete problems and physical reality"" (PDF), which proposes a claim somewhat similar to the extended Church-Turing thesis - that no physically realizable process at all (classical, quantum, or whatever) can act as a computer that efficiently solves NP-complete problems.

+",551,,551,,6/5/2020 2:06,6/5/2020 2:06,,,,5,,,,CC BY-SA 4.0 +12330,2,,12312,6/4/2020 14:20,,1,,"

Are you looking for something that simulates the actual hardware, or something that runs quantum circuits?

+ +

If you're looking for circuit simulation with the widest variety of possible operations, the closest thing we can do on a classical computer is Density Matrix simulation.

+ + + +

are two that I've used, but others are also out there.

+ +

If you actually want to simulate the physics happening on the hardware level, the question is very hardware specific.

+",3056,,,,,6/4/2020 14:20,,,,0,,,,CC BY-SA 4.0 +12334,1,15732,,6/4/2020 16:57,,3,317,"

Some background: I'm currently running the same training algorithm with a classical neural network and a quantum circuit, respectively. The NN is implemented in Keras with a TensorFlow backend, the circuit is implemented in TFQ.

+ +

My circuit has only 4 qubits and 88 trainable parameters, and training is still at least a factor 10 slower than training a NN with two dense layers (10 units each) and 182 trainable parameters. (All hyperparameters are identical.) At this moderate circuit size I don't expect circuit training to be that much slower than training the classical NN.

+ +

Looking at the CPU usage, I see that TFQ uses all cores, but only to a fraction. My suspicion is that the circuit is too small to reach the threshold where multiprocessing makes sense, so this might be a source of the slowness. However, I can't seem to find a way to turn multiprocessing off.

+ +

Question: Is there a way to disable multiprocessing in TensorFlow Quantum?

+",562,,10480,,1/28/2021 7:54,1/28/2021 19:27,How to turn off multiprocessing in TensorFlow Quantum,,1,1,,,,CC BY-SA 4.0 +12335,1,12339,,6/4/2020 17:40,,2,277,"

For noise parameter $Q$ and a density matrix $\rho$, we know that the depolarization channel $\mathcal{E}$ would act like:

+ +

$$ +\mathcal{E}(\rho) = (1 - Q)\rho +Q\frac{I}{2}, +$$ +where $I$ is the identity matrix in 2 dimensions. Now, an interesting question is, what happens to a Bell state $|\Phi^{+}\rangle = \frac{1}{2}(|00\rangle + |11\rangle)$, when we apply $\mathcal{E}$ to each qubits of the Bell state separately. What would be the resulting state?

+ +

Meaning, what is:

+ +

$$ +(\mathcal{E} \otimes \mathcal{E})(|\Phi^{+}\rangle \langle\Phi^{+}| ) +$$ +Remembering that, operation on the first qubit would collapse the state. Is it physically possible?

+",2403,,491,,6/6/2020 20:53,6/6/2020 20:53,What happens when you send a Bell state through depolarizing channel?,,2,1,,,,CC BY-SA 4.0 +12336,1,,,6/4/2020 18:10,,3,115,"

I am reading this error mitigation paper by the IBM team and I am slightly confused about the meaning of "coupling coefficients" when describing multi-qubit Hamiltonian.

+

+

I have only seen coupling coefficients in terms describing interaction between atom and external electric field. What do these coefficients mean in terms of pauli gates and why are they time dependent?

+",7943,,10480,,3/18/2021 5:46,4/17/2021 6:46,"What do coupling coefficients mean in terms of Pauli gates, and why are they time dependent?",,1,1,,,,CC BY-SA 4.0 +12337,2,,6128,6/4/2020 18:46,,2,,"

There are some common Quantum Arithmetic Circuits such as Basic Quantum Adders and Multipliers, QFT based circuits, Integer adders, Galois Field Multipliers etc. are used in various quantum algorithms and implementations. Among these, QFT focused circuits are studied in various quantum arithmetic circuit complexity related discussions. The measures of the complexity of a quantum circuit are the size of the circuit, the depth of the circuit, and the number of qubits in the circuit.

+ +

We can find a seminal research paper on Quantum Arithmetic Circuits by Takahashi Yasuhiro quite relevant to this topic. There is a recent research paper on the Arithmetic of QFT that approaches various aspects of circuit complexity. QFT provides an alternative way to perform arithmetic operations on a quantum computer. There is another research paper published in nature about Automated Optimisation of large quantum circuits with continuous parameters which talks about the complexity of quantum arithmetic circuits.

+",4501,,,,,6/4/2020 18:46,,,,0,,,,CC BY-SA 4.0 +12338,2,,6128,6/4/2020 23:12,,3,,"

Here's a really old reference:

+ +

""Quantum Networks for Elementary Arithmetic Operations"" by Vedral et al (1995)

+ +

And here's some state of the art stuff:

+ + + +

Sorry for the number of self-cites. I got really interested in this problem for awhile.

+ +

There's also some cool papers like ""Addition on a quantum computer"" by Draper (2000) which uses a totally-unique-to-quantum method for performing an addition, but unfortunately the overhead of doing it fault tolerantly is extremely high.

+",119,,119,,6/4/2020 23:18,6/4/2020 23:18,,,,0,,,,CC BY-SA 4.0 +12339,2,,12335,6/5/2020 5:29,,2,,"

From my understanding of what you are asking, you may take the product of two depolarization operations, using the reduced density matrix of each qubit in the Bell state in the expression.

+ +

Let's denote our two qubits as $\mathrm{A}$ and $\mathrm{B}$. The Bell state of these two qubits is then: +$$ +|\beta_{00} \rangle =\frac{|0 \rangle_\mathrm{A} \otimes |0 \rangle_\mathrm{B} + |1 \rangle_\mathrm{A} \otimes |1 \rangle_\mathrm{B}}{\sqrt{2}} = \frac{|00 \rangle + |11 \rangle}{\sqrt{2}} +$$ +With a density matrix: +$$ +\rho = | \beta_{00} \rangle \langle \beta_{00} | = \frac{ |00 \rangle \langle 00| + |00 \rangle \langle 11 | + |11 \rangle \langle 00| + |11 \rangle \langle 11 |}{2} +$$

+ +

Which makes the two reduced density matrices: +$$ +\rho_\mathrm{A} = \text{tr}_\mathrm{B}(\rho) = \frac{|0 \rangle \langle 0| + |1 \rangle \langle 1|}{2} = \frac{I}{2} +$$

+ +

$$ +\rho_\mathrm{B} = \text{tr}_\mathrm{A}(\rho) = \frac{|0 \rangle \langle 0| + |1 \rangle \langle 1|}{2} = \frac{I}{2} +$$

+ +

The operation can then be defined as (assuming the same noise parameter $Q$ on both applications of the operation): +$$ +\mathcal{E} \otimes \mathcal{E} = (Q \; \frac{I}{2} + (1-Q) \rho_\mathrm{A}) \otimes (Q \; \frac{I}{2} + (1-Q) \rho_\mathrm{B}) +$$

+ +

Which ultimately simplifies to: +$$ +\mathcal{E} \otimes \mathcal{E} = Q(2-Q) \; \frac{I}{2} \otimes \frac{I}{2} + (1-Q)^2 \; \rho +$$

+ +

Because both reduced density matrices for the Bell state given are equivalent to the density matrix for a completely mixed state, i.e. $\frac{I}{2}$.

+ +

Hope this helps!

+",12070,,,,,6/5/2020 5:29,,,,1,,,,CC BY-SA 4.0 +12340,1,,,6/5/2020 9:30,,5,5061,"

As still quarantine is going on for some of us. I was wondering how to make a Quantum Computer in your garage. What may be the total cost for building one?

+ +

Was inspired by this youtube video.

+",12255,,55,,7/26/2020 18:17,7/26/2020 20:54,How to build a quantum computer in your house?,,6,3,,,,CC BY-SA 4.0 +12341,1,12343,,6/5/2020 9:33,,3,813,"

Let's say we have the GHZ state with 3 qubits:

+ +

$$ |\mathrm{GHZ}\rangle = \dfrac{1}{\sqrt{2}}\Big(|000\rangle + |111\rangle \Big)$$

+ +

I want to find the stabilizer group of this state, that is, the $M_i$ operators such that $M_i|\mathrm{GHZ}\rangle = |\mathrm{GHZ}\rangle$ with $M_i \in P_3$, being $P_3$ the Pauli group for $3$ qubits.

+ +

Of course, in this case, by testing with brute force we can find: +$$\begin{align} +M_1 &= XXX\\ +M_2 &= ZZ1\\ +M_3 &= Z1Z\\ +M_4 &= 1ZZ +\end{align} $$

+ +

But I do have a couple of questions:

+ +
    +
  1. Shouldn't I get $3$ stabilizers instead of $4$? because as I understand it, the number of stabilizers is given by $n-k$ where $n$ is the number of physical bits and $k$ is the number of logical or information bits, and in our case we have $n=3,\ k=0$.
  2. +
  3. There is no more rigorous method to find the stabilizers, without having to try all the combinations? perhaps through the Hamming matrix as in the classical codes?
  4. +
+",9716,,8141,,6/5/2020 12:59,6/8/2020 9:22,How to get the stabilizer group for a given state?,,2,1,,,,CC BY-SA 4.0 +12342,2,,12335,6/5/2020 10:13,,1,,"

As also discussed here you can write your channel as +$$\mathcal E = p\mathcal E_{dp} + (1-p) \operatorname{Id}, +\quad \mathcal E_{dp}(\rho)\equiv\operatorname{Tr}(\rho)I/d.$$ +where $p\in[0,1]$ and, in your case, $d=2$.

+ +

You thus have +$$\mathcal E\otimes\mathcal E=p^2 \mathcal E_{dp}\otimes \mathcal E_{dp} + p(1-p) [\mathcal E_{dp} \otimes \operatorname{Id} + \operatorname{Id}\otimes \mathcal E_{dp}] + (1-p)^2 \underbrace{\operatorname{Id}\otimes \operatorname{Id}}_{\equiv \operatorname{Id}}.$$

+ +

When the input is a maximally entangled state, $\sqrt d|\Phi\rangle=\sum_k |u_k,v_k\rangle$ for some $u_k,v_k$ with $\langle u_k,u_\ell\rangle=\langle v_k,v_\ell\rangle=\delta_{k\ell}$, we get +$$ + (\mathcal E_{dp}\otimes \mathcal E_{dp})\Phi = + \frac{1}{d}\sum_{jk} \mathcal E_{dp}(|u_j\rangle\!\langle u_k|)\otimes \mathcal E_{dp}(|v_j\rangle\!\langle v_k|) = + \frac{1}{d^2}I\otimes I\equiv \frac{1}{d^2}I, \\ + (\mathcal E_{dp}\otimes \operatorname{Id})\Phi = + \frac{1}{d}\sum_j \mathcal E_{dp}(|u_j\rangle\!\langle u_k|)\otimes |v_j\rangle\!\langle v_k| = + \frac{1}{d^2}I\otimes I\equiv \frac{1}{d^2}I. +$$ +where we are using the notation $\Phi\equiv |\Phi\rangle\!\langle \Phi|$. +In conclusion, +$$(\mathcal E\otimes\mathcal E)\Phi= \underbrace{[p^2+2p(1-p)]}_{=p(2-p)} \frac{I}{d^2} + (1-p)^2\Phi.$$

+",55,,,,,6/5/2020 10:13,,,,0,,,,CC BY-SA 4.0 +12343,2,,12341,6/5/2020 10:36,,5,,"

You need to watch out when you say 'stabilizer' or 'stabilizers' because there is a little bit of ambiguity in that terminology$^{1}$.

+ +

The stabilizer $\mathcal{S}$ of a state $|\psi \rangle$ is the group of $n$-qubit Paulis of which $|\psi \rangle$ is a $+1$ eigenstate. That is, $|\psi \rangle$ is the shared $+1$ eigenspace of all these operators. We can generalize this by having a stabilizer code where the shared eigenspace is of dimension $2^{n-l}$ instead of $1$, because we now take only $l$ Paulis for an $n$-qubit system. We then get $k = n-l$ logical qubits.

+ +

The number of elements in any stabilizer is $2^{l}$, because if $P_{1}, P_{2} \in \mathcal{S}$, then evidently $P_{12} = P_{1}P_{2} \in \mathcal{S}$ as well. That is, the elements of $\mathcal{S}$ form a group (hence why we refer to it as the stabilizer group). Our $l$ Paulis are generators for the group; but there are $2^{l}$ elements in the group, because any multiplication of our generators will give an element of the stabilizer as well.

+ +
+

Shouldn't I get 3 stabilizers instead of 4? because as I understand it, the number of stabilizers is given by n−k where n is the number of physical bits and k is the number of logical or information bits, and in our case we have n=3, k=0

+
+ +

You should get $3$ generators for the state, since the number of generators is $l = n-k = (3 - 0)$. The four Paulis that you have listed are not mutual exclusive generators, because $M_4 = M_{2}M_{3}$ (or any other permutation). Hence, to generate this specific stabilizer we only need $M_{1}$ and any two of the set $M_{2},M_{3},M_{4}$.

+ +

To illustrate, consider the operator $M_{5} = M_{1}M_{4} = (XXX)(IZZ) = (XYY)$ (up to a phase). Evidently, $M_{5}|\psi\rangle = XYY|\psi\rangle = (+1)|\psi\rangle$, so $M_{5}$ is also an element of the stabilizer of $|\psi\rangle$. However, we can 'generate' $M_{5}$ with $M_{1}\& M_{4}$ (and therefore with $M_{1}, M_{2} \& M_{3}$ as well), so we don't need to keep track of $M_{5}$.

+ +
+

There is no more rigorous method to find the stabilizers, without having to try all the combinations? perhaps through the Hamming matrix as in the classical codes?

+
+ +

This is actually pretty hard to do in general. However, it is also not needed very often: normally we define a stabilizer and then 'just' find the corresponding state or codespace. +Also, please note that only a subset of all valid quantum states can have a stabilizer comprised of Pauli matrices.

+ +
    +
  1. In fact,Daniel Gottesman, who developed the stabilizer formalism, said (and I paraphrase): ""I can't stop you from calling them stabilizers, but I do not condone it."" :)
  2. +
+",8141,,8141,,6/8/2020 9:22,6/8/2020 9:22,,,,0,,,,CC BY-SA 4.0 +12345,2,,12340,6/5/2020 10:51,,9,,"

A serious answer: you pretty much can't. It's not that you in particular can't, it's that no one can. Huge companies pour in huge amounts of money to try and make a proof-of-concept quantum computer (there is actually no 'proper' quantum computer yet).

+

A slightly less serious answer: some odd $10-100$ Million would get you started I would say. It all depends on what type of quantum bits you want to build; most of them require the need of cooling them down to single digits (or much, much less) above absolute zero. You need 'special' refrigerators for that will do this, and they are pricey.

+

Oh, and do you have a nanofabrication lab or a clean room adjecent to your garage? Because you're probably gonna need one of those as well:)

+

This is not intended to shoot you down, but more as a light joke:)

+

Edit: +Actually, what might be in reach for a personal investment is some very rudimentary version of a photonic quantum computer. Basically you need some glass fiber, a couple of beam splitters, a lot of attenuators and some lasers. (And a idiotically expensive single-photon detector, but we'll sweep that under the rug for now).

+",8141,,8141,,7/26/2020 20:54,7/26/2020 20:54,,,,1,,,,CC BY-SA 4.0 +12346,2,,12341,6/5/2020 11:14,,1,,"

If you know the quantum circuit for generating a particular state, starting from the all-zero state, it's easy enough to work out the stabilizers. You just start with stabilizers $K=III\ldots IZII\ldots I$, where you have one with a $Z$ on each qubit (i.e. the stabilizers of the all-zero state), and you just update them to $UKU^\dagger$. Particularly if you're using a circuit comprised of Clifford gates, there are good methods (basically, see Gottesman-Knill theorem) for updating the stabilizers from one gate to the next. Of course, for a generic $U$, there's no guarantee that the output will be a nice tensor product of Paulis.

+",1837,,,,,6/5/2020 11:14,,,,0,,,,CC BY-SA 4.0 +12347,1,12350,,6/5/2020 13:28,,7,257,"

I'm looking at a circuit from this paper on quantum machine learning.

+ +

+ +

So to introduce my own notation:

+ +
    +
  • we start with $|\psi_0⟩ = |0,a,b⟩ = a_0b_0|000⟩ + a_0b_1|001⟩ + a_1b_0|010⟩ + a_1b_1|011⟩$
  • +
  • after the first $H$-gate we have $|\psi_1⟩$
  • +
  • after the controlled-SWAP we have $|\psi_2⟩$
  • +
  • after the second $H$-gate we have $|\psi_3⟩$
  • +
+ +

The paper says that at the end we measure $|0⟩$ for the top qubit with the following probability:

+ +

$$ +P(|0⟩_{\psi_3}) = \frac{1}{2} + \frac{1}{2}|⟨a|b⟩|^2 +$$

+ +

As I'm new to this I decided to do the expansion by hand.

+ +

+ +

The first two rows are grouped for $\vert 0xx\rangle$ and the second two rows are for $\vert 1xx\rangle$. As I understand, I can get $P(|0⟩_{\psi_3})$ by summing the probability amplitudes for the first two rows.

+ +

Here's what's baffling me:

+ +

The first two rows are basically what you would get back if you skipped the controlled-swap. You'd just come back to $|\psi_0⟩$. And as before, you'd get:

+ +

$$ +P(|0⟩_{\psi_0}) = |a_0b_0| + |a_0b_1| + |a_1b_0| + |a_1b_1| +$$

+ +

So that means the probability amplitudes of the first two rows sum up to 1. Which leaves me very confused because there are still two more rows to consider which would add on another $|a_0b_1| + |a_1b_0|$.

+ +

Thanks for your time!

+",10485,,2035,,6/7/2020 10:18,8/12/2020 15:50,How to do quantum circuit arithmetic?,,2,6,,,,CC BY-SA 4.0 +12348,2,,12347,6/5/2020 14:58,,3,,"

Found it! To me it actually feels very sneaky so I'll take the time to explain it.

+

Focussing on just the top two rows of my handwritten expansion:

+

I made the mistake of taking vertically adjacent pairs of coefficients, adding them together, and dividing by 2.

+

So from left to right in vertical pairs:

+

$$ +\frac{1}{2}\big[2a_0b_0|0xx⟩\big] + \frac{1}{2}\big[2a_0b_1|0xx⟩\big] + \frac{1}{2}\big[2a_1b_0|0xx⟩\big] + \frac{1}{2}\big[2a_1b_1|0xx⟩\big] \tag{1A} +$$

+

Then I just cancelled the 2's and was left with:

+

$$ +|a_0b_0| + |a_0b_1| + |a_1b_0| + |a_1b_1| = 1 \tag{2A} +$$

+

hence my confusion.

+

The mistake was made when I did the grouping for the first |0⟩ disregarding the rest of the state. But if we look at the columns 2 and 3 we see that the 2nd and 3rd qubits are inverted, so I can't do the grouping. The proper way of what I meant to do in (1A) would then be:

+

$$ +\frac{1}{2}\big[2a_0b_0|000⟩\big] + \frac{1}{2}\big[a_0b_1|001⟩\big] + \frac{1}{2}\big[a_0b_1|010⟩\big] + \frac{1}{2}\big[a_1b_0|010⟩\big] + \frac{1}{2}\big[a_1b_0|001⟩\big] + \frac{1}{2}\big[2a_1b_1|011⟩\big] \tag{1B} +$$

+

And actually once you take the norms with these coefficients you get

+

$$ +|a_0 b_0|^2 ++ \frac{1}{2} | a_0 b_1 + a_1 b_0 |^2 ++ |a_1 b_1|^2 \neq 1 \tag{2B} +$$

+

And that makes up the gap.

+

EDIT Also as pointed out in the comments, the whole point of this section in the paper is to express the result in terms of the fidelity $|⟨a|b⟩|$. This answer explains how to do that.

+",10485,,12643,,8/12/2020 15:50,8/12/2020 15:50,,,,1,,,,CC BY-SA 4.0 +12349,1,12363,,6/5/2020 15:34,,3,229,"

This question is related and complementary to this one: +How to get the stabilizer group for a given state?

+ +

What I want is to find the stabilizer group generators for the following state:

+ +

$$|W\rangle = \dfrac{1}{\sqrt{3}}\Big(|011\rangle + |101\rangle + |110\rangle \Big)$$

+ +

In theory, I should find $n-k = 3-0=3$ independent non trivial generators. +But the only one I can find is $M_1 = Z\otimes Z\otimes Z$ because any other combination, like $-Z\otimes Z\otimes -Z$ or $iZ\otimes iZ\otimes -Z$ actually is equivalent to the first one, and there cannot be a combination with $X$ because it would alter the difference between 0s and 1s that is conserved in each sum.

+ +

Where are the other two generators?

+",9716,,55,,6/6/2020 13:31,12/2/2021 2:10,What is the stabilizer group of a $|W\rangle$ state?,,2,7,,,,CC BY-SA 4.0 +12350,2,,12347,6/5/2020 15:46,,3,,"

For completeness i'm going to give the proof of the swap test:

+ +

The initial state is given as, where I will use a slight abuse of notation on the R.H.S ($|0\rangle|a\rangle|b\rangle \equiv |0\rangle \otimes|a\rangle \otimes|b\rangle$, where $|a\rangle$ and $|b\rangle$ are states NOT bases).

+ +

$|\phi_1 \rangle = a_0b_0|000\rangle + a_1b_0|010\rangle + a_0b_1|001\rangle + a_1b_1|011\rangle = |0\rangle|a\rangle|b\rangle$

+ +

applying $H$

+ +

$H|0\rangle|a\rangle|b\rangle = \frac{1}{\sqrt{2}}|0\rangle|a\rangle|b\rangle + \frac{1}{\sqrt{2}}|1\rangle|a\rangle|b\rangle $,

+ +

Now, if we were to take the measurement of either $|0\rangle$ or $|1\rangle$ now the inner products of the measurements would give:

+ +

$P(0) = (\frac{1}{\sqrt{2}}\langle b|\langle a| \langle 0|)(\frac{1}{\sqrt{2}}|0\rangle|a\rangle|b\rangle) = \frac{1}{2}$

+ +

Which isn't very useful, so by applying the swap:

+ +

$|\phi_3\rangle = \frac{1}{\sqrt{2}}|0\rangle|a\rangle|b\rangle + \frac{1}{\sqrt{2}}|1\rangle|b\rangle|a\rangle$

+ +

we will see that this changes the inner product of the measurements.

+ +

Applying the second $H$

+ +

$H|\phi_3\rangle = \frac{1}{2}|0\rangle|a\rangle|b\rangle + \frac{1}{2}|1\rangle|a\rangle|b\rangle + \frac{1}{2}|0\rangle|b\rangle|a\rangle - \frac{1}{2}|1\rangle|b\rangle|a\rangle = \frac{1}{2}|0\rangle \left[|a\rangle|b\rangle + |b\rangle|a\rangle\right] + \frac{1}{2}|1\rangle \left[|a\rangle|b\rangle - |b\rangle|a\rangle \right]$.

+ +

So first by inspection we can see with at least probability $\frac{1}{2}$ that we will measure the first qubit in $|0\rangle$.

+ +

Now we take the inner product for the $|0\rangle$ measurement:

+ +

$P(0) = \frac{1}{4}(\langle a|\langle b| + \langle b|\langle a|)\langle 0 |0\rangle(|a\rangle|b\rangle + |b\rangle|a\rangle) = \frac{1}{4}(\langle a| \langle b| a \rangle |b\rangle + \langle a| \langle b| b \rangle |a\rangle + \langle b| \langle a| a \rangle |b\rangle + \langle b| \langle a| b \rangle |a\rangle) = \frac{1}{2} + \frac{1}{2}\langle b| \langle a| b \rangle |a\rangle = \frac{1}{2} + \frac{1}{2}|\langle a|b\rangle|^2 $

+ +

(remembering the abuse of notation s.t. $\langle a | b \rangle \neq 0$ because it is the inner product of the states $|a\rangle = a_0|0\rangle + a_1|1\rangle$ and not the bases of type $|a\rangle$ and $|b\rangle$. However by completion we know that $\langle a | a \rangle = 1$)

+ +

Finally how can $\langle b| \langle a| b \rangle |a\rangle)$ be the fidelity? We will use some rearranging and remeber that the inner product is a scalar, however we need to be careful because it is a complex scalar! So we can write

+ +

$\langle b| \langle a| b \rangle |a\rangle = \langle a| b \rangle\langle b| a \rangle$,

+ +

by shuffling the scalar terms, and we can also see that

+ +

$\langle b| \langle a| b \rangle |a\rangle = \langle a| b \rangle\langle b| a \rangle = \langle a| \langle b| a \rangle |b\rangle$

+ +

However $ \langle a| b \rangle \neq \langle b| a \rangle$ so we can't just square the inner product term. But we can use the relation via the complex conjugate:

+ +

$\langle b| a \rangle = \langle a| b \rangle^\dagger$.

+ +

Hence we can write this as the modulus squared

+ +

$\langle a| b \rangle\langle b| a \rangle = \langle a| b \rangle\langle a| b \rangle^\dagger = |\langle a| b \rangle|^2$

+",6139,,6139,,6/5/2020 17:18,6/5/2020 17:18,,,,8,,,,CC BY-SA 4.0 +12351,2,,12340,6/5/2020 16:13,,7,,"

With current technology, there's not much of a chance to build a true quantum computer, but you may be able to build some interesting quantum circuits with a fairly sizable (but still on the scale of ""self-funded"" for the ordinary person) budget, using the optical photon model. For instance, one could use the linear optical quantum computing model. Using beamsplitters as $\hat{y}$ rotations and phase shifters as $\hat{z}$ rotations, one can construct arbitrary one-qubit quantum gates. With the addition of a nonlinear medium (like Kerr Media), one can construct some interesting circuits. For reference, here are the transformations that each of those optical tools performs: +$$ +\mathrm{B}_\theta = \begin{bmatrix} +\text{cos}(\theta) & -\text{sin}(\theta) \\ +\text{sin}(\theta) & \text{cos}(\theta) +\end{bmatrix} +$$ +$$ +\mathrm{P}_\phi = \begin{bmatrix} +e^{i \phi} & 0 \\ +0 & 1 +\end{bmatrix} +$$ +$$ +\mathrm{K}_\mathcal{E} = \begin{bmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 1 & 0 \\ +0 & 0 & 0 & e^{i \mathcal{E}} +\end{bmatrix} +$$ +The parametrizations on the first two matrices have to do with the properties of the materials used in creating the optical tools, and don't necessarily have anything to do with the physical angle which they are placed.

+",12070,,,,,6/5/2020 16:13,,,,0,,,,CC BY-SA 4.0 +12352,1,,,6/5/2020 19:17,,0,60,"

According to the Grover's algorithm section in the IBM Quantum Experience, if I have two qubits in the ""one"" state (vectors (0,1) and (0,1)), and I apply a Hadamard gate to each of them, and then input the tensor product output to a CZ gate, my resulting amplitudes should be (.5, .5, .5, and -.5). However, no matter how I fiddle with the matrices, my resulting amplitudes are (.5, -.5, -.5, and -.5) Am I screwing up the product of the results of the two Hadamards? +

+",12075,,491,,6/6/2020 20:54,6/6/2020 20:54,"Grover oracle result: vectors (0,1) & (0,1) => two Hadamards => product of two H results => CZ = (.5, .-5, -.5, -.5)",,1,2,,,,CC BY-SA 4.0 +12353,2,,12352,6/5/2020 21:25,,1,,"

Could you point to the source? Your calculations seem correct, in Dirac notation:

+ +
    +
  • start with $|1\rangle \otimes |1\rangle$
  • +
  • apply H to each qubit: $|-\rangle \otimes |-\rangle = \frac12(|00\rangle - |01\rangle - |10\rangle + |11\rangle)$
  • +
  • Apply CZ: the sign of $|11\rangle$ changes, for the final result $\frac12(|00\rangle - |01\rangle - |10\rangle - |11\rangle)$
  • +
+ +

Could it be that the source starts with qubits in $|0\rangle \otimes |0\rangle$ state? In that case the resulting amplitudes will indeed be $\frac12(|00\rangle + |01\rangle + |10\rangle - |11\rangle)$.

+",2879,,,,,6/5/2020 21:25,,,,10,,,,CC BY-SA 4.0 +12354,1,,,6/5/2020 21:32,,2,225,"

Suppose you replace both QFTs in Shor's discrete logarithm algorithm with simpler QFTs with small prime base w. Does this algorithm extract the discrete logarithm modulo w? It seems it does, provided you guarantee that the full discrete logarithm is not too large, and that the Hadamards in the second register only generate a smaller range of values, $max(b)$ such that $max(b)max(\alpha) < p-1$, where $\alpha$ is the full discrete logarithm. So for instance, if $max(b)$ = $max(\alpha)$ = $\frac{2^{\lfloor \log p \rfloor}}{64}$, then the modified Shor's algorithm will output $\alpha \mod w$. The modified Shor circuit will end in state:

+ +

$$ + \sum_{c=0}^{2^{\lceil \log p \rceil}} \sum_{d=0}^{max(b)} \sum_{a=0}^{2^{\lceil \log p \rceil}} \sum_{b=0}^{max(b)} \exp(\frac{2 \pi i}{w}(ac+bd))|c,d,g^ax^{-b} \mod p\rangle +$$

+ +

The restricted range of $b$ works for the following reason. If we write $y \equiv g^k$ (the power of $x$ can be written as a power of $g$), then $a-rb \equiv k \mod (p-1)$ and

+ +

$$ +a = rb + k - (p-1)\lfloor \frac{br+k}{p-1} \rfloor +$$

+ +

$a$ should have the entire range of $2^{\lceil \log p \rceil}$ and $b$ should be restricted to $max(b)$. This isn't a problem because any $a$ will have a $k$ which ranges from $0$ to $p-1$, so $a$ and $b$ will always have solutions. $r$ in the substitution should be chosen to be in the range $[0,max(r)]$ in order to avoid errors with taking the second modulus.

+ +

Following Shor, the amplitude is +$$ +\frac{1}{w\sqrt{ max(b)max(a)}} \sum_{b=0}^{max(b)} \exp\big( \frac{2\pi i}{w}(brc+kc+bd-c(p-1)\lfloor \frac{br+k}{p-1} \rfloor)\big) +$$

+ +

Factor out a factor of $\exp(2\pi i \frac{kc}{w})$ that doesn't affect the probability and get

+ +

$$ +\frac{1}{w\sqrt{ max(b)max(a)}} \sum_{b=0}^{max(b)} \exp(\frac{2\pi i}{w}bT)\exp(\frac{2\pi i}{w}V) +$$ +where +$T = rc + d - \frac{r}{p-1}\{c(p-1)\}_w$ and

+ +

$V = \big( \frac{br}{p-1} - \lfloor \frac{br+k}{p-1} \rfloor\big) \{c(p-1)\}_w$

+ +

$V$ is automatically small as in the normal algorithm. For $T$, those $c,d$ such that $rc+d=0\mod w$ encode the period modulo $w$. $\frac{\{c(p-1)\}_w}{w} < 1$, so if $\frac{max(b)r}{p-1} << 1$ then the exponentials for all terms will be close to 1 for pairs $c,d$ such that $rc+d=0\mod w$, so that the $max(b)+1$ sums will all be constructive. If $rc+d \neq 0 \mod w$, then $\exp(\frac{2\pi i}{w}bT)$ will contain terms at least as ""cycled through"" as $\exp(\frac{2\pi i}{w}max(b))$, and destructive interference will guarantee their sum is nearly 0.

+ +

From the Chinese Remainder Theorem, multiple runs with different small primes can be used to reconstruct the entire discrete logarithm. Note that the small prime circuit has the same asymptotic complexity as the full discrete logarithm circuit and would require O(n) runs to construct the entire logarithm, so it would be much slower in practice. All notation is from Peter Shor's original paper, except for $\alpha$.

+ +

https://arxiv.org/abs/quant-ph/9508027

+",9305,,9305,,6/14/2020 19:46,8/13/2020 2:57,Shor's Discrete Logarithm Algorithm with a QFT with a small prime base,,2,2,,,,CC BY-SA 4.0 +12355,1,12357,,6/6/2020 5:18,,1,138,"

I have downloaded two codes of SK algorithm from GitHub and try to understand how to decompose a unitary single qubit gate. These code are https://github.com/DEBARGHYA4469/Quantum-Compiler and https://github.com/cryptogoth/skc-python. +As SK algorithm needs two parameters - an unitary single qubit gate $U$ and deepth $n$. I tried to put $n=2$ and make a unitary qubit gate as $U$. If I set the accuracy $\epsilon = 0.125$, which means the sequence should include $O(\log 3.97\cdot 0.05)$ gates. I calculated it ($\log 3.97 \cdot 0.01$ is around 2). But actually the sequence I get from code is far more than 2 gates:

+ +

SHTHTHTHTHHTHTHTHTHTHTHHTHhthhththththshthhththththtSTHTHSHTHSHTHTHTHTHHTHTHTHHTHTHTHTHSHTHhthththhththththshththththTHTHSHHSTHTHShthshthshthtsTHTHTHTHTHHTHSHTHTHTHTHHTHhthhththththththhththththsshthtshhshthtHTHTHTHTHSHTHTHTHTHHTHTHTHhthshththththhthththhththtTHTHSHTHSHTHSTHSSTHTHSTHHHshthshthshththhhtshthtsshtHHTHTHHHHTHSH

+ +

ACCURACY 0.053661016216388954

+ +

So I just want to know why?

+",11765,,55,,6/6/2020 13:41,6/6/2020 13:41,Understanding the length of the sequence obtained via Solovay-Kitaev decomposition,,1,0,,,,CC BY-SA 4.0 +12356,1,12359,,6/6/2020 6:42,,1,781,"

Transpiler Error: Number of qubits (2) in circuit11 is greater than maximum (1) in the couplings map

+ +
# Initialize two qubits and create Entanglement using Hadamard and CX/CNOT Gate
+q = qiskit.QuantumRegister(2)
+c = qiskit.ClassicalRegister(2)
+qc = qiskit.QuantumCircuit(q, c)
+qc.h(q[0])
+qc.cx(q[0], q[1])
+qc.measure(q, c)
+job_exp = qiskit.execute(qc, backend=backend, shots=1024, max_credits=3)
+
+
+ +

Error:

+ +
---------------------------------------------------------------------------
+TranspilerError                           Traceback (most recent call last)
+<ipython-input-11-7b13276b10ae> in <module>()
+      9 qc.cx(q[0], q[1])
+     10 qc.measure(q, c)
+---> 11 job_exp = qiskit.execute(qc, backend=backend, shots=1024, max_credits=3)
+
+2 frames
+/usr/local/lib/python3.6/dist-packages/qiskit/execute.py in execute(experiments, backend, basis_gates, coupling_map, backend_properties, initial_layout, seed_transpiler, optimization_level, pass_manager, qobj_id, qobj_header, shots, memory, max_credits, seed_simulator, default_qubit_los, default_meas_los, schedule_los, meas_level, meas_return, memory_slots, memory_slot_size, rep_time, parameter_binds, schedule_circuit, inst_map, meas_map, scheduling_method, **run_config)
+    249                                 seed_transpiler=seed_transpiler,
+    250                                 optimization_level=optimization_level,
+--> 251                                 backend=backend)
+    252 
+    253     if schedule_circuit:
+
+/usr/local/lib/python3.6/dist-packages/qiskit/compiler/transpile.py in transpile(circuits, backend, basis_gates, coupling_map, backend_properties, initial_layout, layout_method, routing_method, seed_transpiler, optimization_level, pass_manager, callback, output_name)
+    205                                            callback, output_name)
+    206 
+--> 207     _check_circuits_coupling_map(circuits, transpile_args, backend)
+    208 
+    209     # Transpile circuits in parallel
+
+/usr/local/lib/python3.6/dist-packages/qiskit/compiler/transpile.py in _check_circuits_coupling_map(circuits, transpile_args, backend)
+    245                                   'in {} '.format(circuit.name) +
+    246                                   'is greater than maximum ({}) '.format(max_qubits) +
+--> 247                                   'in the coupling_map')
+    248 
+    249 
+
+TranspilerError: 'Number of qubits (2) in circuit11 is greater than maximum (1) in the coupling_map'
+
+",9365,,55,,6/6/2020 11:35,6/6/2020 11:35,Transpiler Error: Number of qubits greater than maximum in coupling map,,1,2,,6/23/2020 19:38,,CC BY-SA 4.0 +12357,2,,12355,6/6/2020 6:46,,4,,"

According to the paper The Solovay-Kitaev algorithm (pg. 7) a number of single qubits gates approximating unitary $U$ is

+ +

$$ +l = O(\ln^{\ln5/\ln(3/2)}\frac{1}{\epsilon}), +$$

+ +

where ${\ln5/\ln(3/2)} = 3.97$. So, in your case with accuracy $\epsilon = 0.125$, you have $\ln^{3.97}\frac{1}{0.125}=\ln^{3.97} 8 = 18.29$.

+ +

For $\epsilon = 0.05$, you will get 77.93.

+ +

Moreover, a complexity of the algorithm is expressed in O-notation. This means that there can be a constant before expession in brackets. There is no limit on this constant, so it can be pretty big.

+",9006,,,,,6/6/2020 6:46,,,,1,,,,CC BY-SA 4.0 +12358,2,,12340,6/6/2020 7:34,,7,,"

Note that while you probably can't build a quantum computer at home, you can simulate one with a classical computer, at the cost of merely an exponential slowdown. There's a rather long list of available software at https://www.quantiki.org/wiki/list-qc-simulators.

+",12268,,,,,6/6/2020 7:34,,,,0,,,,CC BY-SA 4.0 +12359,2,,12356,6/6/2020 10:45,,4,,"

This error means that you are trying to execute a circuit on a backend that has fewer qubits than used in your circuit. In this case you are trying to execute a 2 qubit circuit on a device that only has one qubit. To fix this I would use a different backend which has 2 or more qubits. You can see how many qubits a backend has by looking at it on the IBM Quantum website or by calling backend.configuration()

+",5955,,,,,6/6/2020 10:45,,,,0,,,,CC BY-SA 4.0 +12360,1,,,6/6/2020 11:54,,5,500,"

I have been trying to run two circuits in the ibmq_london device, the one resulting of applying one X gate on qubit $0$ and the one that applies two X gates. I know that applying two X gates is the same as doing nothing because of its properties, but I am interested in the study of noise so I really want Qiskit to apply both gates. I have tried to place a barrier between both X gates but it does not seem to be working because I obtain the following results:

+ +

X circuit

+ +



+ +

XX circuit

+ +

+ +

I have tried to write the following code:

+ +

job_device = execute(qc, device,shots=8192,basis_gates=None,optimization_level=0)

+ +

for the execution, but it does not seem to be working as due to the effect of noise I will expect a lower value for the XX circuit (two gates applied), even taking into account the thermal relaxation.

+",9887,,55,,6/6/2020 13:42,7/25/2020 9:47,How to not optimize the quantum gates in a qiskit circuit when running it in the real device?,,1,6,,,,CC BY-SA 4.0 +12361,2,,12360,6/6/2020 12:40,,5,,"

Optimization level 0 does not perform 1 qubit gate optimization and it will send 2 X gates (well 2 U3 gates after it unrolls to the basis set). You can see the passes optimization level 0 runs here: https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/transpiler/preset_passmanagers/level0.py It will only map the circuit to the device and unroll the gates to the basis set. You can see what the compiled circuit which will be sent to the device looks like with:

+ +

print(transpile(qc, device, optimization_level=0))

+ +

Which should show you 2 U3(pi,0,pi) gates next to each other. For example, when I ran it locally it shows:

+ +
>>> print(transpile(qc, backend, optimization_level=0))
+               ┌─────────────┐┌─────────────┐ ░ ┌─┐      
+      q_0 -> 0 ┤ U3(pi,0,pi) ├┤ U3(pi,0,pi) ├─░─┤M├──────
+               └─────────────┘└─────────────┘ ░ └╥┘┌─┐   
+      q_1 -> 1 ───────────────────────────────░──╫─┤M├───
+                                              ░  ║ └╥┘┌─┐
+      q_2 -> 2 ───────────────────────────────░──╫──╫─┤M├
+                                              ░  ║  ║ └╥┘
+ancilla_0 -> 3 ──────────────────────────────────╫──╫──╫─
+                                                 ║  ║  ║ 
+ancilla_1 -> 4 ──────────────────────────────────╫──╫──╫─
+                                                 ║  ║  ║ 
+       meas_0: ══════════════════════════════════╩══╬══╬═
+                                                    ║  ║ 
+       meas_1: ═════════════════════════════════════╩══╬═
+                                                       ║ 
+       meas_2: ════════════════════════════════════════╩═
+
+",5529,,,,,6/6/2020 12:40,,,,3,,,,CC BY-SA 4.0 +12363,2,,12349,6/6/2020 19:55,,3,,"

To cite from my answer from over at physics.SE: +The W state is not a stabilizer state - for a stabilizer state, the 1-site reduced density matrices must be maximally mixed or pure, which they aren't.

+ +

Or, to phrase it without reduced density matrices: For a stabilizer state, if you measure $X$, $Y$, or $Z$ for any single qubit, the probability of getting either outcome is either $0$, $1/2$, or $1$. This is clearly not the case for a $Z$ measurement on the W state above, where the probability of getting $0$ is $1/3$.

+",491,,491,,6/8/2020 8:27,6/8/2020 8:27,,,,3,,,,CC BY-SA 4.0 +12364,2,,12340,6/6/2020 20:45,,4,,"

It's actually an interesting question. And the previous answers (""strictly speaking, you can't,"" ""you can simulate quantum computers,"" and ""photonics-based processing holds some promise"") are all true.

+ +

According to a pioneer in photonics computing we won't see real quantum computing until around 2035. I've not yet seen anything to justify thinking to the contrary. Some of the downstream work of these photonic computing pioneers has yielded the fastest data interconnects that scale perfectly in parallel b/c there's no photon-electron conversion (and because there's an ingenious breakthrough at the core). There's also a really compelling set of demonstrations using these interconnects to run QC simulations , like running Grover's algorithm and QFT, fast. See https://www.datavortex.com/research/quantum-simulation/.

+ +

There's nothing wrong with simulating, there's nothing wrong with waiting 15 years, and there's nothing wrong with jumping in and trying to make it happen in one's garage. All one needs is some advanced mathematical training, some electricity, some money, and a refusal to quit.

+",12277,,,,,6/6/2020 20:45,,,,0,,,,CC BY-SA 4.0 +12365,1,,,6/6/2020 21:42,,1,294,"

I was trying to initialize to an arbitrary state of n qubits with the initialize() from Qiskit but it doesn't generate a state with the same amplitudes passed as an argument, instead, it creates a state that when compared to the wanted state will have fidelity equals $1$. (described here)

+ +

My question is: Is there any method that can generate a state that will have numerically same wanted amplitudes ?

+ +

Edit: Just found the PrepareArbitraryState in Q# that does the same thing, they are based in the same paper but some results seen different between then. If someone could explain me the technical differences between then it will be perfect.

+ +

Edit(2): Here is the test cited in the Qiskit tutorial:

+ +

$\left|\psi\right\rangle = \frac{i}{4}\left|000\right\rangle + \frac{1}{\sqrt{8}}\left|001\right\rangle + \frac{1+i}{4}\left|010\right\rangle + \frac{1+2i}{\sqrt{8}}\left|101\right\rangle + \frac{1}{4}\left|110\right\rangle$

+ +

Applied to Q# (this result is the same as input and is what I want):

+ +
|0⟩     5.970914908063292E-17 + 0.25000000000000017𝑖
+|1⟩     0.3535533905932739 + 3.251767952832691E-17𝑖
+|2⟩     0.2500000000000002 + 0.25000000000000017𝑖
+|3⟩     -2.4061305817955694E-17 + -4.7860913024955035E-18𝑖
+|4⟩     -4.845288669732255E-17 + 1.506300336842906E-16𝑖
+|5⟩     0.3535533905932743 + 0.7071067811865478𝑖
+|6⟩     0.2500000000000002 + -7.897235558417238E-17𝑖
+|7⟩     4.7022165029227935E-18 + -4.194489669218219E-17𝑖
+
+ +

Applied to Qiskit (same as the cited tutorial, have fidelity(input, output) = 1, but it doesn't match with the Q# result and it is not what I want):

+ +
|0⟩     2.50000000e-01 + 0.j
+|1⟩     2.77555756e-17 - 0.35355339j,
+|2⟩     2.50000000e-01 - 0.25j
+|3⟩     0.00000000e+00 + 0.j
+|4⟩     0.00000000e+00 + 0.j
+|5⟩     7.07106781e-01 - 0.35355339j
+|6⟩     5.89805982e-17 - 0.25j
+|7⟩     0.00000000e+00 + 0.j
+
+",12278,,55,,6/8/2020 12:07,8/5/2020 6:47,How can I initialize a state with chosen amplitudes in Qiskit?,,1,3,,,,CC BY-SA 4.0 +12366,2,,12143,6/7/2020 5:21,,1,,"

Since my question has no answer yet (for about two weeks now) I thought it would be appropriate to include my own conclusions (at the present time ) in the form of an answer.

+ +

In Abrams' PhD Thesis (partial, freely available on the Internet  )  there is a partial  answer to this question, pages 79-80  

+ +

The Abrams  - Lloyd algorithm depends on the possible implementation of a nonlinear OR gate. This nonlinear OR gate can be simulated (imbedded/embedded  into,  if you like ) by a higher dimensional unitary gate , by setting the extra ancillary qubit(s) to a definite state (that's equivalent to measuring the ancillary qubit(s)). The problem is that the output qubits are entangled,  so at the next iteration if I try to set the ancillary input qubits to a definite state (in order to simulate again the nonlinear OR gate) then I collapse the whole system to an eigenstate, I destroy the superposition.  

+ +

However you could increase the dimensionality of the embedding unitary gate for each iteration (that means increasing the number of input/output qubits , including ancillary qubits ). In other words for the first iteration the nonlinear OR gate will be simulated by a unitary gate $U_1 $ of dimension $n+k$ (where $k$ is a constant), with some ancillary qubits set on input to state $\vert 0 \rangle$ for example. All the $n+k$ output qubits of $U_1$ are entangled.  At the next iteration,  I simulate $U_1$ using a unitary $U_2$ gate of dimension $n+2k$ , by setting some extra ancillary qubits to $\vert 0 \rangle$.  At the next iteration,  I simulate $U_2$ using a unitary gate $U_3$ of dimension $n+3k$ , by setting some extra ancillary qubits to $\vert 0 \rangle$.  And so on. This way I can simulate the nonlinear OR gate for each iteration and I do not collapse the whole system to an eigenstate at any intermediate stage of the algorithm. We just have to track the right qubits to measure at the end of the algorithm. 

+ +

In other words, there might be some hope related to the implementation of this algorithm, but I would not make a large bet on it, because simulating $U_1$ $U_2$ , $U_3$ , ..... is not exactly the same thing as simulating the nonlinear OR gate (even if $U_1$ with some ancillary qubits set to $\vert 0 \rangle$ does indeed simulate the nonlinear OR gate). When you set the ancillary qubits of $U_2$ to $\vert 0 \rangle$ you need $U_2$ to simulate $U_1$ when its own ancillary qubits are set to $\vert 0 \rangle $. (in order to simulate the nonlinear OR gate). When you set the ancillary qubits of $U_3$ to $\vert 0 \rangle$ you need $U_3$ to simulate $U_2$ when its own ancillary qubits are set to $\vert 0 \rangle$ , and so on. The problem requires a careful analysis, and at this point I don't know if it allows a solution.

+",10110,,10110,,6/9/2020 5:06,6/9/2020 5:06,,,,1,,,,CC BY-SA 4.0 +12367,2,,12340,6/7/2020 6:32,,1,,"

All previous answers are true. I would like to contribute with a serious question and a comment.

+ +

Would it make sense to build a quantum computer in your house?

+ +

They are and will be hard to maintain. In my opinion, having them in the cloud is and will be the best solution.

+ +

Beecause of economy of scale, the cost of a home-made quantum computer will be always greater than the cost of industrial quantum devices deployed in server farms located in cold countries (e.g., Norway) and exposed as cloud services.

+",5551,,,,,6/7/2020 6:32,,,,2,,,,CC BY-SA 4.0 +12368,1,,,6/7/2020 6:42,,3,239,"

I'm looking at the Qiskit getting started documentation, https://qiskit.org/documentation/getting_started.html. They create a quantum circuit and run an approximate simulation on it 1000 times:

+

+
    +
  1. Why bother with an approximate solution when you can get an exact solution? In this case, you can simulate everything with matrices and get this result: +$$ +\begin{bmatrix}{1 \over {\sqrt 2}} \\ 0 \\ 0 \\ {1 \over {\sqrt 2}}\end{bmatrix} +$$
  2. +
+

From this you know the exact probabilities of each output: 00 occurs $1 \over 2$ the time, 11 occurs $1 \over 2$ the time. Is an exact simulator available in Qiskit?

+
    +
  1. How does an approximate simulator work? For instance, after passing through the Hadamard gate, we have the qubit
  2. +
+

$$ +\begin{bmatrix} +{1 \over {\sqrt 2}} \\ +{1 \over {\sqrt 2}} +\end{bmatrix} +$$

+

At that point, does the simulator immediately collapse the qubit to $|0\rangle$ or $|1\rangle$ to avoid potential superpositions? Or would that not be sufficient, and an approximate simulator is more complicated?

+",12262,,-1,,6/18/2020 8:31,8/11/2020 10:10,"How to run an approximate simulation, and why",,2,3,,,,CC BY-SA 4.0 +12369,1,12427,,6/7/2020 22:36,,2,406,"

A couple of questions regarding the conversion between Jordan-Wigner (JW) and Bravyi-Kitaev (BK) states in Qiskit.

+ +

The JW $\rightarrow$ BK conversion matrix I refer to below is the one from equation (29) here. (I'm not referring to equation (24) in Ibid. for it contains a typo.)

+ +
    +
  1. Is there a way to generate a circuit which would map JW-encoded states to BK-encoded states? (The circuit is actually very simple since it multiplies the input $n$-qubit vector by a $n\times n$ matrix $\operatorname{mod} 2$; since the matrix is upper-triangular, it is rather trivial to construct it out of CNOTs.)

  2. +
  3. Assuming that the answer to the previous question is NO: is there a way to, at least, generate the matrix implementing the conversion between the Jordan-Wigner and Bravyi-Kitaev states, for a given number of qubits $n$?

  4. +
+",6313,,55,,6/11/2020 22:46,6/11/2020 22:46,Jordan-Wigner $\leftrightarrow$ Bravyi-Kitaev transformation in Qiskit,,1,0,,,,CC BY-SA 4.0 +12370,1,,,6/8/2020 1:02,,1,51,"

At any result of a job in this last version of the Circuit Composer, at the OpenQasm tab inside the Circuit Diagram, I am unable to use the tradicional copy or ctrl-c to get the transpiled circuit selected text for further studies.

+ +

Is this an error or it is functioning correctly, because in before versions it was possible doing it?

+",11650,,9006,,6/8/2020 7:45,6/8/2020 7:45,Who cares about Transpiled Circuit Text?,,1,1,,6/8/2020 18:53,,CC BY-SA 4.0 +12371,2,,12370,6/8/2020 1:26,,1,,"

I think its an error. If you want a poor temporary solution you can try to select the whole box starting at the big title Transpiled Circuit to the last code line. It will copy the line numbers together with the QASM code but I think it will be better than nothing.

+",12278,,9006,,6/8/2020 7:45,6/8/2020 7:45,,,,0,,,,CC BY-SA 4.0 +12372,2,,12340,6/8/2020 2:44,,1,,"

He has basically described how to build the Cirac-Zoller quantum computer.

+ +

In the most simple approach the qubit states are electronic states of the trapped ions. Two qubit gates are possible thanks to the coupling of the qubit states to the vibrational modes of the trap -- this is cool as in superconducting architectures the two qubits that are far apart on the chip are not coupled directly.

+ +

The trapping of ions was already demonstrated a while ago e.g. here or here. As he has mentioned the next big step in his design will be placing the trap inside an ultra high vacuum (UHV) chamber i.e. less than 100nPa. This is necessary as otherwise the atoms from the air would bump into the ions and would cause decoherence.

+ +

But the really challenging step is implementation of the lasers as they do the whole job -- this might be really difficult to achieve at home, however, judging on his current progress, I hope that he will pull it off.

+ +

A real competition to his start-up is a company called ionQ that is building quantum processors with a use of this architecture. The ion trap based quantum computers are known for having qubits and gates of v high fidelity. The drawback is that they are difficult to scale up. This is the most commonly attributed to anomalous heating.

+ +

Here you can check out other architectures with their strengths and weaknesses.

+",12140,,,,,6/8/2020 2:44,,,,0,,,,CC BY-SA 4.0 +12373,2,,12368,6/8/2020 9:08,,5,,"
+

Why bother with an approximate solution when you can get an exact solution?

+
+

The reason to have an 'approximate' simulation rather than an exact simulation (and result) is that it more closely resembles our understanding of and interaction with a real quantum computer.

+

In a real quantum computer, the state of the qubits before measurement is indeed the exact superposition, but retrieving information from this system will always be done through measurements, and those measurements cannot give the full system state - they will only give one bit of information per measurement. Repeated experiments + measurements then allows us to approximate the exact state we believe the system to be in.

+
+

Is an exact simulator available in Qiskit?

+
+

Qiskit can indeed handle exact simulations - there is the 'statevector_simulator' which will do this; you can retrieve it with aer.get_backend('statevector_simulator'). Note that this does not allow for density matrix simulations, so the methods to simulate noise and error are severely limited. The statevector can then be retrieved from the results object using the .get_statevector() method. See also this webpage from IBM/qiskit.

+
+

How does an approximate simulator work?

+
+

The simulations do not collapse the superpositions before the actual measurements - if the superpositions were collapsed in an intermediary state of the circuit, there can be no simulations of all things that make a quantum computer 'quantum' - entanglement, interference etc.

+

For simplicity, if we assume the measurement to take place at the very end of the circuit, just before the measurement the entire state of the system is known (which would be a $2^{n} \times 2^{n}$ density matrix; however you can use various insights and tricks to reduce the memory usage. It will always be exponential though.)

+

A measurement is then a random draw from the distribution of possible measurement outcomes, weighted to their probabilities. For a statevector, this is of course the $|\alpha|$'s and $|\beta|$'s. For density matrices, it is a bit more intricate as you use projection matrices.

+",8141,,8141,,8/11/2020 10:10,8/11/2020 10:10,,,,3,,,,CC BY-SA 4.0 +12374,1,12375,,6/8/2020 11:20,,1,51,"

I have understood the concept of ""universal quantum gates"" in real quantum computer, and the quantum gates and states can be emulated as matrix in classical computer, and the matrix operation can be regarded as gate operation. In real quantum system, we can realize a set of universal quantum gates to decompose any unitary quantum gates to reduce the complexity.

+ +

So I want to know is if in a quantum emulator there is the same procedure of decomposition, or just matrix operations without any decomposition? Because from my perspective, if it can be emulated as a matrix operation, it seems there is no need to do the procedure of decomposition.

+",11765,,55,,6/8/2020 12:28,6/8/2020 12:28,A question about how to emulate quantum states and computation on classical computer,,1,0,,,,CC BY-SA 4.0 +12375,2,,12374,6/8/2020 12:22,,3,,"

In simulation, it is normally not needed to perform the process of decomposition - so your perspective is right, in principle.

+ +

Of course, it can be actually useful to perform the decomposition and synthesis, for various reasons, including but not limited to:

+ +
    +
  • The gate decomposition algorithm itself needs to be simulated (Rather than the algorithm/computation).
  • +
  • Gate decomposition and synthesis might offer easier methods of circuit compilation, limiting or bringing down the number of operations that need to be simulated.
  • +
  • Simulations with noise often try to resemble some specific physical implementation; here the noise characteristics are only known/applicable to the gates from the specific gateset.
  • +
  • Simulations can sometimes be sped up/the memory usage can be brought down if all the entangling gates in the circuit are bundled together and/or pushed as far back in the circuit. Performing decompositions (of the multi-qubit gates, specifically) can help in determining the use-cases of this.
  • +
+",8141,,,,,6/8/2020 12:22,,,,0,,,,CC BY-SA 4.0 +12376,1,,,6/8/2020 13:10,,6,729,"

In some texts I see $X$ and $Z$ Pauli operators as being said as boost and shift operators respectively. +But I came across some text that defines its own operators, namely:

+ +
+

$$ +X \vert j\rangle = \vert j+1\,\mod\,d\rangle \\ +Z \vert j\rangle = \omega^j\vert j\rangle, \quad \omega = \exp \left( \frac{2\pi i}{d} \right) +$$

+
+ +

I am confused as to what is the standard meaning of it, and why such a name.

+ +

Update: I realized Boost operator has something to do with quantum mechanics, where it is said to:

+ +
+

shift expectation value of momentum

+
+ +

Since I am not from physics background, it would be great if someone could explain it in simple words.

+",12298,,55,,7/26/2020 18:04,7/26/2020 18:04,What are boost and shift operators and why are they called so?,,2,3,,,,CC BY-SA 4.0 +12377,1,12379,,6/8/2020 16:40,,5,281,"

In two places so far, I've heard statements of the sort ""... and we need the Hamiltonian to be non-commuting. If not, the algorithm is classical, and we get no benefit from using a quantum computer.""

+ +

For reference, here are two timestamped youtube links to my examples:

+ + + +

So why is this the case? Looking for any good answers, but for me 1 to 3 intuitive ""ways of looking at it"" works best, even if they aren't airtight explanations.

+",10485,,,,,6/9/2020 13:18,"Why does one need a non-commuting Hamiltonian for an algorithm to exhibit ""quantumness""",,2,0,,,,CC BY-SA 4.0 +12378,1,12412,,6/8/2020 18:24,,2,324,"

In Qiskit, how do I construct a circuit corresponding to the Trotter expansion of a Pauli sum $A+B+C+\ldots$ given as a WightedPauliSum object?

+ +

$$ +\operatorname{e}^{A + B + C + \ldots } \overset{?}{\mapsto} +\left\{\begin{alignedat}{9} +U &= \operatorname{e}^{A}\operatorname{e}^{B}\operatorname{e}^{C}\ldots \ &&, \quad &&\text{(first order)}\\ +U &= \operatorname{e}^{A/2}\operatorname{e}^{B/2}\operatorname{e}^{C/2}\ldots\operatorname{e}^{C/2}\operatorname{e}^{B/2}\operatorname{e}^{A/2} \ &&, \quad &&\text{(second order)}\\ + & \ldots +\end{alignedat}\right. +$$ +I guess, PauliTrotterEvolution should do the job, but I have not found a tutorial.

+",6313,,55,,6/11/2020 22:47,6/11/2020 22:47,Trotterizing a Pauli sum in Qiskit,,1,0,,,,CC BY-SA 4.0 +12379,2,,12377,6/8/2020 18:25,,4,,"

First, a minor point: it doesn't make any sense to say that ""a Hamiltonian commutes"". You mean that the different terms in the Hamilonian commute. When it comes to commutation, it takes two (or more) to tango.

+ +

It is indeed often said that if all the terms of a Hamiltonian commute, then the Hamiltonian is classical. But that isn't really true in my opinion. It's true that if all the terms in the Hamiltonian commute, then there exists a basis of the Hilbert space that simultaneous diagonalizes every term. After you've found this basis and rotated into it, the Hamiltonian does indeed become effectively classical, because each term in the Hamiltonian just contributes a value (that term's eigenvalue) to the total energy, without changing the state at all. Since the Hamiltonian doesn't modify these basis states, its ""operator"" nature effectively falls away and it basically just becomes a scalar energy function.

+ +

But the energy eigenstates are typically complicated superpositions of computational basis states, so they can be nontrivial to calculate (and certainly to engineer experimentally). So the ""quantum-ness"" only vanishes after you've finished the highly quantum step of finding the simultaneous eigenstates of each term in the Hamiltonian.

+ +

For example, the toric code Hamiltonian has every term commuting, and you do sometimes hear the toric code described as ""classical"", but I personally would say that it's highly quantum.

+ +

Finally, saying that ""all terms in the Hamiltonian commute"" is somewhat ambiguous anyway, because you can sometimes group smaller non-commuting terms together into larger terms that do commute. There's no unambiguous definition of what counts as ""a single term"" in the Hamiltonian.

+",551,,,,,6/8/2020 18:25,,,,3,,,,CC BY-SA 4.0 +12380,1,,,6/8/2020 21:31,,2,224,"

Under Qiskit QAOA's tutorial (https://qiskit.org/textbook/ch-applications/qaoa.html), the authors specify that a cost function $C(x)$ representing the optimization objective of a Binary Combinatorial Optimization problem (x is a vector or list of Boolean variables) can be mapped to a hamiltonian in $H^{2^n}$ via the transformation

+ +

$x_i \rightarrow \frac{1}{2}(1-Z_{i})$ where $x_i$ is a Boolean variable of $x$ and $Z_i$ is the pauli-Z operator applied to qubit i.

+ +

I was wondering what was the intuition behind the transformation and if there is a way to propose different alternatives.

+ +

Thank you!

+",12302,,12302,,6/9/2020 22:18,6/11/2020 7:41,Why do we transform a Boolean variable into a a Pauli Z matrix,,1,3,,,,CC BY-SA 4.0 +12382,1,,,6/9/2020 6:51,,6,3489,"

When I tried to use the Qiskit textbook module, it threw the following error:

+ +

Command was:

+ +
from qiskit_textbook.tools import array_to_latex
+array_to_latex(final_state, pretext=""\\text{Statevector} = "")
+
+ +

Error was:

+ +
---------------------------------------------------------------------------
+ModuleNotFoundError                       Traceback (most recent call last)
+<ipython-input-9-fe86c66f7ae0> in <module>
+----> 1 from qiskit_textbook.tools import array_to_latex
+      2 array_to_latex(final_state, pretext=""\\text{Statevector} = "")
+
+ModuleNotFoundError: **No module named 'qiskit_textbook'**
+
+ +

When I looked up the version I had, it showed the following:

+ +

+{'qiskit-terra': '0.12.0',
+ 'qiskit-aer': '0.4.1',
+ 'qiskit-ignis': '0.2.0',
+ 'qiskit-ibmq-provider': '0.5.0',
+ 'qiskit-aqua': '0.6.4',
+ 'qiskit': '0.16.1'}
+
+
+ +

Can someone help me in resolving the issue?

+",12304,,5955,,6/9/2020 10:49,12/6/2020 11:17,Unable to use qiskit_textbook module,,2,1,,,,CC BY-SA 4.0 +12386,2,,12382,6/9/2020 10:52,,3,,"

The qiskit textbook is not a standard module included with qiskit, it has to be installed separately. The repo where it is kept is here. This link explains how to pip install from a git repo, you need to use a slightly different command to normal pip installs.

+",5955,,,,,6/9/2020 10:52,,,,0,,,,CC BY-SA 4.0 +12387,1,12388,,6/9/2020 12:05,,0,221,"

I have a question about how to decompose a unitary quantum gate in a currently existing simulator or emulator. I have read some papers about SK algorithm and other algorithms which aim to decompose unitary quantum gates. Is there any specific method to decompose a quantum gate in a currently existing simulator? Some papers about decomposition methods mention Trotter-Suzuki decomposition but I don't exactly know if this is true? To be more specific, what is the decomposition algorithm in Qiskit or Project Q?

+",11765,,55,,10/12/2020 7:25,10/12/2020 7:25,How to decompose unitary quantum gate in current simulator or emulator?,,1,0,,,,CC BY-SA 4.0 +12388,2,,12387,6/9/2020 12:11,,2,,"

In Qiskit, the iso() function allows you to add a gate, defined by means of a unitary, to your quantum circuit:

+ +

https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.iso.html

+ +

The decomposition used in the iso() function was introduced by Iten et al. in https://arxiv.org/abs/1501.06911.

+ +

Of course this is related to the circuit, not to the backend (which can be real or simulated).

+",5551,,,,,6/9/2020 12:11,,,,7,,,,CC BY-SA 4.0 +12389,2,,12377,6/9/2020 13:18,,1,,"

For all we know, it seems that fully-fledged quantum computations indeed require gates (and thus Hamiltonians generating those gates) which don't commute. (But this does not mean that we know this for sure!)

+ +

However, it is not true that otherwise, the system can be classically simulated (at least, again, there is strong evidence for that). That is, such a system might not constitute a fully-fledged quantum computer, yet it is more powerful than a classical device. A specific scheme is ""instantaneous quantum computing"", where all gates commute, yet where evidence has been given that it cannot be classically simulated.

+",491,,,,,6/9/2020 13:18,,,,0,,,,CC BY-SA 4.0 +12390,1,12391,,6/9/2020 15:59,,2,102,"

For Mosca Keynes, ex 7.1.5:

+ +

You are asked to prove:

+ +

$\text{QFT}^{-1}_{mr}|\phi_{r,b}\rangle = \frac{1}{\sqrt{r}}\sum_{k=0}^{r-1}e^{-2\pi i \frac{b}{r}k}|mk\rangle$

+ +

where

+ +

$|\phi_{r,b}\rangle = \frac{1}{\sqrt{m}}\sum_{z=0}^{m-1}|zr + b\rangle$

+ +

with period $r$, shift $b$ and $m$ repetitions.

+ +

I have an answer, I don't want to write my full workings so not to ruin the exercise for others, but I am looking to clarify a step in my workings to make sure I didn't just 'force' the proof.

+ +

I get to a point where I can factor to QFT result into two parts where get:

+ +

$\frac{1}{m\sqrt{r}}\sum_{z=0}^{m-1}\sum_{k=0}^{r-1}e^{-2\pi izk}e^{-2\pi i \frac{b}{r}k}|mk\rangle$

+ +

To get the final result I assume that:

+ +

$\sum_{z=0}^{m-1}\sum_{k=0}^{r-1}e^{-2\pi izk} = m$, given that $e^{-2\pi izk} = 1$ where $z,k\in\mathbb{Z}$, is this final stage of my proof correct or have I gone in completely the wrong direction?

+",6139,,,,,6/9/2020 19:46,Proof of QFT for a Periodic Function,,1,0,,,,CC BY-SA 4.0 +12391,2,,12390,6/9/2020 19:39,,1,,"

If you assume that $e^{−2\pi z k} = 1$ then the sum is +$ +\sum_{z=0}^{m-1} \sum_{k=0}^{r-1} 1 = \sum_{z=0}^{m-1} r = mr, +$

+ +

EDIT:

+ +

However, at the same time

+ +

$$ +\begin{split} +&\frac{1}{m\sqrt{r}}\sum_{z=0}^{m-1}\sum_{k=0}^{r-1}e^{-2\pi izk}e^{-2\pi i \frac{b}{r}k}|mk\rangle \\ +=& +\frac{1}{m\sqrt{r}}\sum_{z=0}^{m-1}\sum_{k=0}^{r-1}e^{-2\pi i \frac{b}{r}k}|mk\rangle \\ +=& +\frac{1}{m\sqrt{r}}m\sum_{k=0}^{r-1}e^{-2\pi i \frac{b}{r}k}|mk\rangle +\end{split} +$$ +the $m$s cancel and it looks like you get your result.

+",12140,,12140,,6/9/2020 19:46,6/9/2020 19:46,,,,1,,,,CC BY-SA 4.0 +12392,1,,,6/9/2020 19:45,,0,155,"

We have a classical reversible circuit $U$ implementing a classical boolean function $f: \left\{0, 1\right\}^n \to \left\{0, 1\right\}$, which also takes some $a$ ancilla bits, and has side effect of outputting garbage $g(x)$. Then we have the following circuit diagram for uncomputing the garbage.

+ +

The trick is to CNOT the answer qubit (which I'll call the 2nd qubit) $f(x)$ with a fresh ancilla (the 1st qubit) initialized to $|0\rangle$, which changes the state of the first qubit to $f(x)$. Then we use the inverse of the circuit and get back $|x\rangle$ and other ancilla qubits back to $|0\rangle$.

+ +

If we are using this circuit with classical inputs, then it is clear that $f(x) \in \left\{0, 1\right\}$. Then, $f(x)$ CNOT $0$ is the same as taking the XOR of the two bits.

+ +

If we feed the input a uniform superposition of all the inputs, then we want the circuit to behave as follows: $$\frac{1}{\sqrt{2^n}}\sum_{x \in \left\{0,1\right\}^n} |x\rangle \otimes |0\rangle^{\otimes a+1} \mapsto \frac{1}{\sqrt{2^n}}\sum_{x \in \left\{0,1^n \right\}} |x\rangle \otimes |f(x)\rangle \otimes |0\rangle^{\otimes a}.$$

+ +

Now this is the part I don't understand. In the quantum case, $|f(x)\rangle$ can be a general quantum state $a|0\rangle + b|1\rangle$, and CNOT has the effect of entangling the first qubit with the second one, such that the joint state of the two qubits is now $a |00\rangle + b|11\rangle$. Now, $U^{-1}$ undoes everything done inside $U$, but it does not undo the CNOT between the first two bits. Therefore, after everything, the first two qubits should still be entangled, right? In that case, why can we write each term in the output as $|x\rangle \otimes |f(x)\rangle$, which indicates that they are not entangled.

+ +

+",12309,,,,,6/10/2020 20:54,CNOT in reversible computing and entanglement,,3,0,,,,CC BY-SA 4.0 +12393,2,,12392,6/9/2020 21:00,,1,,"

When we talk about reversible computing, $f(x)$ is the scalar value of the function of the input vector $x$, and $|f(x)\rangle$ is a single basis vector, not a superposition of basis vectors. So it all works out and leaves the first qubit entangled with just the inputs, not the garbage qubits.

+",2879,,,,,6/9/2020 21:00,,,,2,,,,CC BY-SA 4.0 +12394,1,12395,,6/9/2020 21:17,,1,37,"

Updated and edited question:

+ +

Let $N_{\delta}:P(\mathcal{H}_A)\rightarrow P(\mathcal{H}_B)$ be a completely positive trace nonincreasing map from the set of positive semidefinite operators in $\mathcal{H}_A$ to positive semidefinite operators in $\mathcal{H}_B$. For any $\rho\in P(\mathcal{H}_{A})$, we want $\sigma = N_{\delta}(\rho)$ such that all its positive eigenvalues are greater than $\delta$ and all remamining eigenvalues are zero.

+ +

Can such a map $N_\delta$ be constructed?

+ +

Based on a previous version of the question, the comment of @Rammus and the answer of @NorbertSchuch suggested using a projection operation $P$ into the eigenspace with eigenvalues larger than $\delta$. However, the required projector depends on the input state $\rho$, which I would like to avoid.

+",4831,,4831,,6/9/2020 22:09,6/9/2020 22:18,Quantum operation to get rid of small but nonzero eigenvalues,,1,4,,,,CC BY-SA 4.0 +12395,2,,12394,6/9/2020 21:32,,1,,"

Answer to the new version:

+ +

No, such a map cannot exist. CP maps are linear, i.e., +$$ +\mathcal E(\lambda\rho) = \lambda \mathcal E(\rho)\ . +$$ +Thus, you can easily see that for $\lambda\ne 1$, this is inconsistent with your definition.

+ +
+ +

Answer to the original version:

+ +

Sure, just project onto the eigenspace which you want to keep: +$$ +\rho\mapsto P\rho P^\dagger +$$ +with $P$ the orthogonal projector onto the eigenspace.

+ +

This is in Kraus form, and thus CP.

+",491,,491,,6/9/2020 22:18,6/9/2020 22:18,,,,2,,,,CC BY-SA 4.0 +12396,2,,12392,6/9/2020 22:09,,1,,"

An illuminating example is reported in the last page of the following lecture notes:

+ +

http://people.cs.uchicago.edu/~ftchong/33001/lecture09.pdf

+",5551,,,,,6/9/2020 22:09,,,,0,,,,CC BY-SA 4.0 +12397,1,12399,,6/9/2020 22:19,,5,840,"

What is a difference between error rates and qubit/gate fidelity? A bit of maths in the explanation is fine but I am an A Level student doing a research project so definitions would be preferred.

+",12312,,55,,5/12/2022 8:05,5/12/2022 8:05,What is a difference between error rates and qubit/gate fidelity?,,2,0,,,,CC BY-SA 4.0 +12398,1,12400,,6/10/2020 0:10,,3,124,"

I have read a paper about ""approximated decomposition"" of a unitary single gate (Solovay-Kitaev algorithm) which told us a any unitary single gate can be decomposed into {Hadamard, Phase} with any accuracy $\epsilon$ . The number of {Hadamard, Phase} grows exponentially as the $\epsilon$ becomes lower and the result is a better approximation of the gate. However, in simulator or emulator such as project Q and Qiskit, the $U3$ gate seems exacted decomposition which means only one parameterized $U3$ gate can realize any unitary single gate.

+ +

So if we can realize ""exact unitary single gate"" in quantum computer, why still so many people focus on the ""approximated one"" and try to optimized the sequence after decomposition?

+",11765,,55,,10/8/2020 17:54,10/8/2020 17:54,a question about quantum gate decomposition on simulator or emulator,,1,0,,,,CC BY-SA 4.0 +12399,2,,12397,6/10/2020 4:04,,4,,"

Usually, error rate for a qubit is defined as probability of undesired change in the qubit state (see for example this paper).

+ +

Then we have state fidelity, which is a measure of the difference between the state we have and the state we would like to have, for any (single or multi qubit) quantum system. Quantum state tomography is a means to characterize the actual state.

+ +

Finally, gate fidelity is a measure of the difference between the operation the gate actually performs and the operation we would like the gate to be performed. In this case, you need quantum process tomography.

+",5551,,,,,6/10/2020 4:04,,,,2,,,,CC BY-SA 4.0 +12400,2,,12398,6/10/2020 6:43,,3,,"

The restricted gate set of, for example, $\{H,T\}$, is more relevant when you start talking about error corrected quantum computation. It may be that when you act on individual, physical, qubits, you can implement and arbitrary single-qubit rotation.

+ +

However, when you encode in an error correcting code, and you want to implement a gate directly on the logical qubit, the set of logical gates that you can enact may be restricted. For example, it is common to restrict to a set of gates comprising the Clifford gates + $T$. This is because, for many codes, the Clifford gates can be implemented with relatively low cost. The fault-tolerant threshold (the limit of error rate that you need to be under in order to have properly managed errors) is primarily dependent on the implementation of any other gates. So, we keep things as simple as possible and implement a single extra gate that we try to do as well as possible. Typically, that's the $T$ gate.

+ +

Yes, it is possible to implement other logical gates, and it might be in practice that this is what you'd do, but it's still going to be a finite set of gates and you have to trade off between the complications and added overheads of extending the gate set versus the reduction in sequence length.

+",1837,,,,,6/10/2020 6:43,,,,6,,,,CC BY-SA 4.0 +12401,2,,12392,6/10/2020 6:44,,1,,"

This statement is not quite right: CNOT has the effect of entangling the first qubit with the second one, such that the joint state of the two qubits is now a|00⟩+b|11⟩. +In your circuit CNOT only applies operation but does not entangle state, because there are no Hadamard gates.

+ +

I.e. This state is not entangled: +

+ +

and this one is:

+ +

+",9456,,9456,,6/10/2020 20:54,6/10/2020 20:54,,,,2,,,,CC BY-SA 4.0 +12402,2,,12380,6/10/2020 7:01,,3,,"

The main thing that you're trying to do is create Hamiltonians whose ground states have a correspondence to basis vectors $|x\rangle$. So, the point of an operator +$$ +R=\frac12(1-Z)=\left(\begin{array}{cc} 0 & 0 \\ 0 & 1 \end{array}\right) +$$ +is that it has two eigenvectors $|0\rangle$ and $|1\rangle$, so $R$ has a ground state $|0\rangle$ and $-R$ has a ground state $|1\rangle$. The 0 and 1 are the things you're trying to directly correspond to binary variables.

+ +

You might ask why one bothers to include the $I$ term as that only shifts the eigenvalues, it doesn't change the eigenvectors. Usually it's just for convenience. People often like to have the ground state to have 0 energy (in which case, you'd use $\frac12(I+Z)$ instead of $-R$ to get the $|1\rangle$ state as a ground state).

+ +

So, let's say I want to create a ground state corresponding to the binary string $x=01$. I can use a Hamiltonian $H=R_1-R_2$. (This is obviously diagonal, so the computational basis states are all eigenstates). In general, for any $x\in\{0,1\}^n$, I can use +$$ +H=\sum_{i=1}^n(-1)^{x_i}R_i +$$ +to make the ground state $|x\rangle$. (There are several other ways that we could construct a Hamiltonian with the correct ground state, but this is a particularly simple one.)

+ +

This is then the starting point of developing some logic. Let's say we don't know what basis state we want to be the ground state, but we want it to satisfy $x_1=x_2$. You could do something like $\frac12(I-Z_1Z_2)$. You find a ground state (with energy 0), perhaps $|11\rangle$, and that tells you $x=11$ is a solution to $x_1=x_2$.

+ +

If we take this a little further, you could ask if there's a satisfying formula $x_1=x_2$, $x_2=x_3$ and $x_3\neq x_1$ (OK, obviously not, but with more complex formulae, it's not so obvious). +You'd set up a Hamiltonian +$$ +H=\frac12(I-Z_1Z_2)+\frac12(I-Z_2Z_3)+\frac12(I+Z_1Z_3), +$$ +and ask if it has a 0 energy eigenvalue. If not, there are no solutions to the given conditions. If so, the corresponding basis vector gives you a satisfying $x$.

+",1837,,1837,,6/11/2020 7:41,6/11/2020 7:41,,,,2,,,,CC BY-SA 4.0 +12403,1,12404,,6/10/2020 7:59,,2,268,"

I hope you don't mind me having two questions.

+ +

Firstly, I was running a Qiskit HHL simulation on a 12x12 matrix and a 12x1 vector, leading to a 16x16 matrix after expansion, and it resulted in a circuit width of 10 qubits and depth of 198 gates.
+What is the maximum depth possible on a quantum computer?

+ +

Secondly, on a smaller problem in the HHL of size 2x2 the depth is 326 and width of 7 qubits. Are my results wrong? It seems odd to have a lower depth than such a small problem.

+ +

[1] https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#implementationsim

+",12316,,9006,,6/10/2020 9:17,6/10/2020 9:17,The maximum depth possible on quantum computers,,1,0,,,,CC BY-SA 4.0 +12404,2,,12403,6/10/2020 9:07,,1,,"

This is quite a broad question. In fact it seems that you have 2 questions:

+ +
    +
  1. How can a smaller (in term of size) matrix result in a longer quantum circuit?
  2. +
  3. What is the maximum depth current quantum computer can execute (reliably)?
  4. +
+ +

About question 1, the number of quantum gates and depth of the quantum circuit generated depends a lot on the matrix $A$ of your linear system, on the method used to implement the evolution $e^{-iAt}$ and on how you ""load"" the right-hand side $b$ in a quantum register.

+ +

Efficient methods to construct the quantum circuit that implements $e^{-iAt}$ exist when $A$ satisfy some properties (like sparsity or locality). But here, efficient does not mean NISQ-compliant, it only means that the circuits generated by the method have a number of quantum gates that scale well with the size of the matrix. Some examples of generic methods can be found here and an example of an hand-craft method for specific matrices has been written here.

+ +

Another point that might impact a lot the final depth of the circuit is the encoding of $b$ into a quantum register.

+ +

It is not possible to know if your issue is caused by one of the previous points or not without the actual matrix and right-hand side you used.

+ +

About your second question, have a look at this answer. Do not use the numbers in it as they are probably outdated, but you can use the method with up-to-date error rates.

+ +

The short answer is: in most of the quantum circuits depth is not the important figure, CNOT number and CNOT error rates seems to have a greater impact.

+",1386,,,,,6/10/2020 9:07,,,,0,,,,CC BY-SA 4.0 +12405,1,12407,,6/10/2020 9:35,,0,146,"

I was playing with approximation of gates with Clifford+T group on IBM Q. Everything works well on simulator, however, when I tried to run my circuit on actual quantum processor, a transpiler optimized circuit so only one $U3$ gate remained. Hence, I was not able to run my original circuit and assess effect of decoherence etc based on depth of the circuit.

+ +

To given an example, my original circuit is

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+qreg q[1];
+creg c[1];
+
+h q[0];
+s q[0];
+t q[0];
+sdg q[0];
+h q[0];
+measure q[0] -> c[0];
+
+ +

After transpiling (on IBM Q Armonk), the resulting QASM code is as follows:

+ +
OPENQASM 2.0;
+include ""qelib1.inc"";
+
+qreg q[1];
+creg c[1];
+
+u3(-0.7853981633974483, 1.5707963267948966, 4.71238898038469) q[0];
+measure q[0] -> c[0];
+
+ +

I tried to add barriers before first h q[0]; and after last h q[0]; to prevent optimizer from working, however, without success.

+ +

I understand that basic gates on IBM Q are $I$, $U1$, $U2$ and $U3$ and that $H$, $S$, $S^\dagger$ and $T$ are eventually impleted by these $U$ gates.

+ +

However, is it possible to avoid optimization so that the original number of gates is preserved? In other words, Hadamard will be presented by one $U3$ gate, phase gate and $T$ by one $U1$ gate each etc.

+",9006,,,,,6/10/2020 11:37,How to stop optimization of a circuit during transpiling in web-interface of IBM Q?,,2,0,,,,CC BY-SA 4.0 +12406,2,,12405,6/10/2020 9:53,,1,,"

When you transpile (either when calling execute or transpile), you should be able to set optimization_level=0 so the transpiler only maps the qubits to the backend. You can see an example here.

+",10415,,,,,6/10/2020 9:53,,,,0,,,,CC BY-SA 4.0 +12407,2,,12405,6/10/2020 11:37,,2,,"

In the web based composer there is currently no way to adjust the optimization level. As a workaround, you can put a barrier before and after each gate. This will prevent them from being joined.

+",332,,,,,6/10/2020 11:37,,,,1,,,,CC BY-SA 4.0 +12408,1,12409,,6/10/2020 12:39,,2,86,"

As far as I know the single qubit gate

+ +

$$ +e^{i\beta\sigma_z} = +\begin{bmatrix} +e^{i\beta} & 0 \\ +0 & e^{-i\beta} +\end{bmatrix} += e^{i\beta} +\begin{bmatrix} +1 & 0 \\ +0 & e^{-i2\beta} +\end{bmatrix} = e^{i\beta} R_Z(-2\beta). +$$

+ +

However, I have seen the above gate implemented using $U_1(2\beta)$, where +$ +U_1(\lambda) = +\begin{bmatrix} +1 & 0 \\ +0 & e^{i\lambda} +\end{bmatrix} +$

+ +

Is $e^{i\beta} R_Z(-2\beta)$ equivalent to $U_1(2\beta)$?

+ +

Update:

+ +

As Davit explains below, $e^{i\theta/2} R_Z(\theta) = U_1(\theta)$, so with $\frac{\theta}{2}=\beta$ we have $e^{i\beta} R_Z(2\beta) = U_1(2\beta)$. Note the difference: in this case the $Z$-rotation is positive, whereas in my original question it is negative.

+",8282,,8282,,6/10/2020 23:10,6/11/2020 7:10,Is $e^{i\beta} R_Z(-2\beta)$ equivalent to $U_1(2\beta)$?,,1,2,,,,CC BY-SA 4.0 +12409,2,,12408,6/10/2020 13:03,,2,,"

$R_z$ gate from M. Nielsen and I. Chuang textbook (page 174):

+ +

$$R_z(\theta) = e^{-i\theta Z/2} =\begin{pmatrix} e^{-i \theta /2} &0 \\ 0&e^{i \theta /2} \end{pmatrix}$$

+ +

If we use this definition for $R_z(\theta)$ then:

+ +

$$R_z(\theta) = e^{-i \theta/2} \begin{pmatrix} 1 &0 \\ 0&e^{i \theta} \end{pmatrix} = e^{-i \theta/2} U_1(\theta)$$

+ +

Therefore, $R_z(\theta)$ and $U_1(\theta)$ can be regarded as equivalent gates, because the global phase $e^{-i \theta/2}$ can be neglected. Note that this comparison is not true for their controlled versions: $cR_z(\theta)$ and $cU_1(\theta)$ can't be regarded as equivalent gates.

+",9459,,9459,,6/11/2020 7:10,6/11/2020 7:10,,,,4,,,,CC BY-SA 4.0 +12410,1,,,6/10/2020 17:19,,2,128,"

This question is available in Quantum Katas here

+

In Task 2.6 of this notebook, we are required to create the W State for $2^k$ qubits.

+
+

Input: $𝑁=2^𝑘$ qubits in the |0…0⟩ state.

+

Goal: Change the state of the qubits to the W state - an equal superposition of 𝑁 basis states on 𝑁 qubits which have Hamming weight of 1.

+

For example, for $𝑁=4$ the required state is $\frac{1}{2}(|1000⟩+|0100⟩+|0010⟩+|0001⟩)$

+
+

And since this problem is taken from Katas, it came with a solution which is as follows: +s

+
operation WState_PowerOfTwo (qs : Qubit[]) : Unit is Adj+Ctl {
+    let N = Length(qs);
+
+    if (N == 1) {
+        // base of recursion: |1⟩
+        X(qs[0]);
+    } else {
+        let K = N / 2;
+        using (anc = Qubit()) {
+            H(anc);
+            
+            (ControlledOnInt(0, WState_PowerOfTwo))([anc], qs[0 .. K - 1]);
+            (ControlledOnInt(1, WState_PowerOfTwo))([anc], qs[K .. N - 1]);
+
+            for (i in K .. N - 1) {
+                CNOT(qs[i], anc);
+            }
+        }
+    }
+}
+
+

While there is absolutely nothing wrong with the proposed answer, I was trying to solve this task without using an ancilla qubit, here's my approach to this question:

+
operation WState_PowerOfTwo (qs : Qubit[]) : Unit {
+    let length_qs = Length(qs);
+    if (length_qs == 1){
+        X(qs[0]);
+    }
+    else{
+    H(qs[0]);
+    
+    for(i in 1..length_qs-1){
+        if(i != length_qs-1){
+            for (j in 0..i-1){
+                X(qs[j]);
+            }
+            Controlled H(qs[0..i-1], qs[i]);
+            for (j in 0..i-1){
+                X(qs[j]);
+            }
+        }
+        else{
+            for (j in 0..i-1){
+                X(qs[j]);
+            }
+            Controlled X(qs[0..i-1], qs[i]);
+            for (j in 0..i-1){
+                X(qs[j]);
+            }
+        }
+    }
+}
+}
+
+

This logics works fine till N=2 but it shows the following error when testing for hidden cases:

+
The desired state for N = 1
+# wave function for qubits with ids (least to most significant): 0
+∣0❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]                   
+∣1❭:     1.000000 +  0.000000 i  ==     ******************** [ 1.000000 ]     --- [  0.00000 rad ]
+The actual state:
+# wave function for qubits with ids (least to most significant): 0
+∣0❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]                   
+∣1❭:     1.000000 +  0.000000 i  ==     ******************** [ 1.000000 ]     --- [  0.00000 rad ]
+Test case passed
+The desired state for N = 2
+# wave function for qubits with ids (least to most significant): 0;1
+∣0❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]                   
+∣1❭:     0.707107 +  0.000000 i  ==     ***********          [ 0.500000 ]     --- [  0.00000 rad ]
+∣2❭:     0.707107 +  0.000000 i  ==     ***********          [ 0.500000 ]     --- [  0.00000 rad ]
+∣3❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]                   
+The actual state:
+# wave function for qubits with ids (least to most significant): 0;1
+∣0❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]                   
+∣1❭:     0.707107 +  0.000000 i  ==     ***********          [ 0.500000 ]     --- [  0.00000 rad ]
+∣2❭:     0.707107 +  0.000000 i  ==     ***********          [ 0.500000 ]     --- [  0.00000 rad ]
+∣3❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]                   
+Test case passed
+Testing on hidden test cases...
+Released qubits are not in zero state.
+Try again!
+
+

I cannot find a root for this problem, is there any error in my logic or am I missing something here?

+",10376,,23,,7/26/2020 18:02,7/26/2020 18:02,Creating a W state for $2^k$ qubits,,1,0,,,,CC BY-SA 4.0 +12411,2,,12410,6/10/2020 18:11,,3,,"

Yes, there is an error in your logic.

+ +

If you take the task one step further, to $N = 4$, the desired state is $\frac{1}{2}(|1000\rangle + |0100\rangle + |0010\rangle + |0001\rangle)$, and the state your solution prepares is $\frac{1}{\sqrt2}|1000\rangle + \frac{1}{2}|0100\rangle + \frac{1}{2\sqrt2}(|0010\rangle + |0001\rangle)$. You can see this for yourself if you modify the testing harness in VS or VS Code to have AssertEqualOnZeroState(4, WState_PowerOfTwo, WState_PowerOfTwo_Reference, true, ""N = 4""); so that it prints the expected state and the actual state when testing your solution.

+ +

You have a linear combination of the right basis states but the amplitudes are incorrect, since you apply

+ +
    +
  • one H gate to modify the amplitude of the state in which $1$ is in the first position,
  • +
  • two H gates to modify the amplitude of the state in which $1$ is in the second position,
  • +
  • and three H gates to modify the amplitude of the states in which $1$ is in the third or fourth positions.
  • +
+ +

It is possible to solve this task without allocating extra qubits, but you'll need to use arbitrary rotations to adjust the amplitudes with more control than the H gate allows; for example, on the first step you'll need to convert $|0000\rangle$ to $\frac{1}{2}|1000\rangle + \frac{\sqrt3}{2}|0000\rangle$ so that the amplitude of the first state is correct. You can check the reference solution for task 2.7 for this approach.

+",2879,,,,,6/10/2020 18:11,,,,0,,,,CC BY-SA 4.0 +12412,2,,12378,6/10/2020 23:44,,2,,"

Looks like this works:

+ +
qc_trotter = paulistring.evolve( evo_time = 1, 
+                                 expansion_order = 2)
+
+ +

where qc_trotter is an object of type WeightedPauliOperator, see here.

+ +

Be mindful though that using circuits generated in this way may sometimes result in errors, as reported here.

+",6313,,6313,,6/11/2020 14:03,6/11/2020 14:03,,,,1,,,,CC BY-SA 4.0 +12413,1,12414,,6/11/2020 3:01,,1,291,"

If we choose double-slit, can we put multiple ""slits"" and create calculation for just one algorithm (problem, solution...)?

+ +

Not general purpose quantum CPU, just for one.

+ +

Same question for Stern-Gerlach.

+",8491,,55,,6/13/2020 5:40,6/13/2020 5:40,Is it possible to create a quantum computer with a double-slit or Stern-Gerlach apparatus?,,2,0,,,,CC BY-SA 4.0 +12414,2,,12413,6/11/2020 6:53,,3,,"

To all intents and purposes, the double-slit experiment is the same as the Mach-Zehnder interferometer (a photon can go one of two paths before interfering at the output). Since the Mach-Zehnder interferometer implements Deutsch's algorithm, you could claim that the double slit experiment will do the same. Effectively, what you'd be talking about is by putting a piece of glass (of the correct optical depth) over one of the two slits, or not, creating two different interference patterns. If you can tell which pattern you've got, you can tell if the piece of glass is there or not.

+ +

However, what you lose is any evidence of a speed-up. The Mach-Zehnder interferometer works with a single photon, so it has a clear interpretation as `a single run of the computation', compared to the equivalent classical calculation, which requires two runs. Once you go over to the double slit, you need to create an interference pattern. To observe that, you're going to need many photons.

+ +

The Stern-Gerlach experiment is basically just a measurement of a qubit in a specific basis. You need more than that for an algorithm....

+",1837,,1837,,6/11/2020 9:47,6/11/2020 9:47,,,,0,,,,CC BY-SA 4.0 +12415,2,,12397,6/11/2020 7:40,,3,,"

For a single operation, the notions of error rate and fidelity are clearly closely related. Error rate is the probability with which something goes wrong, while fidelity measures how accurately the actual output matches the desired one.

+ +

Let me illustrate this with an example. Let's say I have an initial state $|0\rangle$ which I'm just storing. So my expected output is $|\psi_\text{target}\rangle=|0\rangle$. However, what actually happens is that with probability $p$, there is an $X$ error (this flips the bit value). So my real output is a density matrix +$$ +\rho_\text{out}=(1-p)|0\rangle\langle 0|+p X|0\rangle\langle 0|X=(1-p)|0\rangle\langle 0|+p |1\rangle\langle 1|, +$$ +which you can interpret as ""with probability $(1-p)$, I get the 0 state, and with probability 1, I get the 1 state"".

+ +

The error rate in this case is simply $p$. (If you want to interpret it as a rate, it's a probability $p$ per operation.) The fidelity, on the other hand, is +$$ +F=\langle\psi_\text{target}|\rho|\psi_\text{target}\rangle=1-p. +$$ +So, in that sense, the error rate and fidelity are opposite sides of the same coin: one is how badly things go wrong, while the other is to what extent things go right.

+ +

However, it's not quite that simple, because while the error rate doesn't depend on the input state, the fidelity does. If I repeat my previous example with the input state $|+\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$, then the error rate is still $p$. However, $\rho_\text{out}=|+\rangle\langle +|$, and thus, the fidelity is 1. This particular input was unaffected by noise.

+ +

This is why you might prefer, instead, to evaluate the fidelity of the operation rather than the fidelity of the state. This might be the average of the state fidelity over all possible inputs, or it could be the worst-case fidelity.

+",1837,,,,,6/11/2020 7:40,,,,0,,,,CC BY-SA 4.0 +12416,2,,11861,6/11/2020 9:52,,1,,"

According to the answer of Simon Crane and an algorithm provided in the question, it is possible to implement any $Rz(\theta)$ gate with gates $X$, $H$, $S$ and $T$.

+ +

The provided algorithm is based on number theory (in particular on solving specific Diophanine equation). According to the paper Optimal ancilla-free Clifford+T approximation of z-rotations, the algorithm is optimal and faster than general Solovay-Kitaev algorithm for the gate set mentioned above. So, now we can prepare any $Rz(\theta)$.

+ +

Based on identities

+ +
    +
  • $X=HZH$
  • +
  • $Y=-SXS^\dagger$
  • +
  • $\mathrm{e}^{-i\frac{\theta}{2}A}=\cos\frac{\theta}{2}I-i\sin\frac{\theta}{2}A$, where $A \in \{X;Y;Z\}$
  • +
+ +

it can be shown that

+ +
    +
  • $Rx(\theta) = HRz(\theta)H$
  • +
  • $Ry(\theta) = S^\dagger HRz(-\theta)HS$ (note that $S^\dagger$ is not in the gate set above but it holds that $S^\dagger = S^3$)
  • +
+ +

Hence, we can implement any $x$ and $y$ rotation with $z$ rotation. Consequently we can create any rotation with gates $X$, $H$, $S$ and $T$ only.

+",9006,,,,,6/11/2020 9:52,,,,0,,,,CC BY-SA 4.0 +12417,1,,,6/11/2020 9:57,,1,79,"

In natural basis $| 0 \rangle = \begin{pmatrix} 1 \\0 \end{pmatrix}$, $| 1 \rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$, what physical situation/model does the following Hamiltonian represent: $H = \alpha \Big( |01 \rangle \langle10| + | 10 \rangle \langle 01| \Big)$?. Here, $\alpha$ has the dimensions of energy.

+",8290,,55,,6/13/2020 5:38,6/13/2020 5:38,What is the physical meaning of the Hamiltonian $H = \alpha ( |01 \rangle \langle10| + | 10 \rangle \langle 01| )$?,,1,0,,,,CC BY-SA 4.0 +12418,2,,11888,6/11/2020 10:30,,3,,"

I'm not from IBM Q development team, but here is how I understand the problem:

+

Qiskit's definition of $R_z$ gate coincides with the conventional definition used, for example, in M. Nielsen and I. Chuang's textbook (page 174):

+

$$R_z(\theta) = \begin{pmatrix} e^{-i \theta/2} &0 \\ 0&e^{i \theta/2} \end{pmatrix}$$

+

The "problem" is not in the definitions, the "problem" is in the implementations.

+

Although Qiskit's implementation of rz gate coincides with the u1 gate, the implementations of crz and cu1 are different and coincide with the conventional definitions. Nevertheless, I think this still can cause some problems. For example, after creating a circuit with rz gate in it, one may want to create a controlled version of the circuit with Qiskit's get_controlled_circuit method that will not give crz gate, but cu1, as a result, there will be some logical errors.

+

Here are the codes and corresponding circuits in qasm format for all mentioned 4 gates

+

$R_z$ gate:

+
circuit_rz = QuantumCircuit(1)
+circuit_rz.rz(1.4, 0)
+circuit_rz = transpile(circuit_rz, basis_gates=['u1', 'u2', 'u3', 'cx'], optimization_level=0)
+---------------------------------------------------------------------------------------------
+u1(1.4) q[0];
+
+

$cR_z$ gate:

+
circuit_crz = QuantumCircuit(2)
+circuit_crz.crz(1.4, 0, 1)
+circuit_crz = transpile(circuit_crz, basis_gates=['u1', 'u2', 'u3', 'cx'], optimization_level=0)
+---------------------------------------------------------------------------------------------
+u1(0.7) q[1];
+cx q[0],q[1];
+u1(-0.7) q[1];
+cx q[0],q[1];
+
+

$u1$ gate:

+
circuit_u1 = QuantumCircuit(1)
+circuit_u1.u1(1.4, 0)
+---------------------------------------------------------------------------------------------
+u1(1.4) q[0];
+
+

$cu1$ gate:

+
circuit_cu1 = QuantumCircuit(2)
+circuit_cu1.cu1(1.4, 0, 1)
+circuit_cu1 = transpile(circuit_cu1, basis_gates=['u1', 'u2', 'u3', 'cx'], optimization_level=0)
+---------------------------------------------------------------------------------------------
+u1(0.7) q[0];
+cx q[0],q[1];
+u1(-0.7) q[1];
+cx q[0],q[1];
+u1(0.7) q[1];
+
+",9459,,9459,,6/21/2020 19:41,6/21/2020 19:41,,,,0,,,,CC BY-SA 4.0 +12419,1,12431,,6/11/2020 11:49,,4,260,"

Now I have understood that physical implementation of quantum computer need a universal quantum gate set like Clifford+T to realize any unitary quantum gate. However, I don't know if it is all the same gate sets for different physical implementation of quantum computer. For example, if the trapped ion and photonic implementation of quantum computer own the same universal quantum gate set. On the other hand, can the quantum computer of IBM and Google implement the same universal quantum gate?

+ +

I am interested in quantum simulator now, and I know that any unitary quantum gate will be decomposed into single qubit gate, and this process is done in simulator. After that, the simulation will send the after-decomposed single qubit gate into backend, which is a really physical implementation of quantum computer or emulator of classical computer and during this procedure the single qubit gates will be decomposed approximately into a sequence of gates within the universal quantum gates.

+ +

I don't know if my understanding of this issue is right.

+",11765,,55,,6/13/2020 5:43,6/13/2020 5:43,Do all physical architectures for quantum computers use the same universal gate sets?,,1,1,,,,CC BY-SA 4.0 +12420,1,12424,,6/11/2020 12:17,,4,102,"

I'm working on a QuantumCircuit which measures the fidelity of one point (my ""test vector"") and two other points (my ""data set"", containing of states phi_1 and phi_2) at once. I'm using Afham; Basheer, Afrad; Goyal, Sandeep (2020) to reproduce their circuit. My circuit right now looks as follows:

+ +
                                          ░ ┌───┐                    ┌───┐ ░ ┌─┐   
+          control_0: ─────────────────────░─┤ H ├────────────■──■──■─┤ H ├─░─┤M├───
+                     ┌──────────────────┐ ░ └───┘            │  │  │ └───┘ ░ └╥┘   
+state_to_classify_0: ┤0                 ├─░──────────────────X──┼──┼───────░──╫────
+                     │                  │ ░                  │  │  │       ░  ║    
+state_to_classify_1: ┤1 INIT TEST STATE ├─░──────────────────┼──X──┼───────░──╫────
+                     │                  │ ░                  │  │  │       ░  ║    
+state_to_classify_2: ┤2                 ├─░──────────────────┼──┼──X───────░──╫────
+                     └──────────────────┘ ░      ┌─────────┐ │  │  │       ░  ║    
+     train_states_0: ─────────────────────░──────┤0        ├─X──┼──┼───────░──╫────
+                                          ░      │         │    │  │       ░  ║    
+     train_states_1: ─────────────────────░──────┤1        ├────X──┼───────░──╫────
+                                          ░      │  oracle │       │       ░  ║    
+     train_states_2: ─────────────────────░──────┤2        ├───────X───────░──╫────
+                                          ░ ┌───┐│         │               ░  ║ ┌─┐
+       comp_basis_0: ─────────────────────░─┤ H ├┤3        ├───────────────░──╫─┤M├
+                                          ░ └───┘└─────────┘               ░  ║ └╥┘
+     meas_control_0: ═════════════════════════════════════════════════════════╩══╬═
+                                                                                 ║ 
+  meas_comp_basis_0: ════════════════════════════════════════════════════════════╩═
+
+ +

Where the INIT TEST STATE is used to initialise my test state on a 3-qubit register, and my oracle is defined as follows:

+ +
                     ┌────────┐     ┌────────┐
+train_states_0: ─────┤0       ├─────┤0       ├
+                     │        │     │        │
+train_states_1: ─────┤1 phi_0 ├─────┤1 phi_1 ├
+                     │        │     │        │
+train_states_2: ─────┤2       ├─────┤2       ├
+                ┌───┐└───┬────┘┌───┐└───┬────┘
+  comp_basis_0: ┤ X ├────■─────┤ X ├────■─────
+                └───┘          └───┘          
+
+ +

So that my train_states register is in a superposition of my full data set. I want to be able to measure the fidelity between multiple points, so what I'm doing right now is just create my circuit where I call qiskit.extensions.quantum_initializer.Isometry to initialize my registers into the desired state. If I want to test another test state, I reproduce my entire circuit.

+ +

For now this works, but eventually I want to move onto larger datasets with thousands of points, I can imagine that recreating a QuantumCircuit from scratch for every data point can become a bottleneck. Hence my question: can I make INIT TEST STATE in such a way that I can define an example function like:

+ +
def apply_new_datapoint(new_init_gate, old_circuit):
+    old_circuit.data.replace(0, new_init_gate)
+
+ +

I have no idea if the above works, but this is what I'm trying to reach eventually.

+",12194,,,,,6/12/2020 8:42,"Is there a ""parameterized initialization"" that I can apply to a QuantumRegister to re-use a circuit?",,2,0,,,,CC BY-SA 4.0 +12422,2,,4354,6/11/2020 14:26,,1,,"

You may find some base information how D-Wave qubit is implemented in this article +Introduction of D-Wave hardware

+ +

D-Wave is not universal quantum computer and for this reason does not satisfy DiVincenzo's criteria. +Related question, answer

+",9456,,,,,6/11/2020 14:26,,,,1,,,,CC BY-SA 4.0 +12423,2,,12420,6/11/2020 15:17,,1,,"

John Preskill identified the bottleneck you described as a fundamental problem in quantum deep learning (section 6.5, here). In particular,

+ +
+

But typical proposals for quantum machine learning applications are + confounded by severe input/output bottlenecks. For applications to + large classical data sets one should take into account the cost of + encoding the input into QRAM, which can nullify the potential + advantages.... These bottlenecks arise when we try to train a quantum + network to learn about correlations in classical data.

+
+ +

Although he is somewhat skeptical of the value of quantum annealing in other parts of the paper, Preskill hints at the end of this section that quantum annealers might ultimately be a solution to overcoming these bottlenecks.

+",8623,,,,,6/11/2020 15:17,,,,3,,,,CC BY-SA 4.0 +12424,2,,12420,6/11/2020 16:07,,2,,"

There is no replace() method, but you can do the trick by means of pop() and insert().

+ +

Example:

+ +
from qiskit import QuantumCircuit, Aer, execute
+from qiskit.extensions.standard import XGate
+
+simulator = Aer.get_backend(""qasm_simulator"")
+
+qc = QuantumCircuit(4,4)
+qc.h([0,1,2,3])
+qc.measure([0,1,2,3], [0,1,2,3])
+print(qc.draw())
+result = execute(qc, backend=simulator, shots=1000).result()
+counts = result.get_counts(qc)
+print(""\nTotal counts:"",counts)
+
+qc.data.pop(0)
+qc.data.insert(0,(XGate(),[qc.qregs[0][0]],[]))
+print(qc.draw())
+result = execute(qc, backend=simulator, shots=1000).result()
+counts = result.get_counts(qc)
+print(""\nTotal counts:"",counts)
+
+",5551,,5551,,6/12/2020 8:42,6/12/2020 8:42,,,,6,,,,CC BY-SA 4.0 +12425,2,,12368,6/11/2020 16:21,,1,,"

Here's how you can use statevector_simulator to get an exact answer:

+ + + +
import numpy as np
+from qiskit import QuantumCircuit, execute, Aer
+from qiskit.visualization import plot_histogram
+
+# Use Aer's statevector_simulator
+simulator = Aer.get_backend(""statevector_simulator"")
+
+# Create a Quantum Circuit acting on the q register
+circuit = QuantumCircuit(2, 2)
+
+# Add a H gate on qubit 0
+circuit.h(0)
+
+# Add a CX (CNOT) gate on control qubit 0 and target qubit 1
+circuit.cx(0, 1)
+
+# Execute the circuit on the qasm simulator
+job = execute(circuit, simulator)
+
+# Grab results from the job
+result = job.result()
+
+out_state = result.get_statevector()
+print([abs(q ** 2) for q in out_state])
+
+ +

Running this prints:

+ +
[0.5000000000000001, 0.0, 0.0, 0.4999999999999999]
+
+ +

So 00 occurred 50% of the time, and 11 occurred 50% of the time. The minor error is due to floating point rounding.

+",12262,,,,,6/11/2020 16:21,,,,0,,,,CC BY-SA 4.0 +12427,2,,12369,6/11/2020 18:39,,1,,"

I have not found such functionality in Qiskit. However, one can use the openfermion function openfermion.transforms._encoder_bk():

+ +
def _encoder_bk(n_modes):
+    """""" Helper function for bravyi_kitaev_code that outputs the binary-tree
+    (dimension x dimension)-matrix used for the encoder in the
+    Bravyi-Kitaev transform.
+
+    Args:
+    n_modes (int): length of the matrix, the dimension x dimension
+
+    Returns (numpy.ndarray): encoder matrix
+    """"""
+    reps = int(numpy.ceil(numpy.log2(n_modes)))
+    mtx = numpy.array([[1, 0], [1, 1]])
+    for repetition in numpy.arange(1, reps + 1):
+        mtx = numpy.kron(numpy.eye(2, dtype=int), mtx)
+        for column in numpy.arange(0, 2 ** repetition):
+            mtx[2 ** (repetition + 1) - 1, column] = 1
+    return mtx[0:n_modes, 0:n_modes]
+
+ +

With the aid of this function, one constructs the JW → BK circuit as follows:

+ +
def jw_to_bk_circuit_qiskit(n):
+    """"""
+    Creates a Qiskit circuit which performs the JW -> BK transformation on qubits.
+    One needs this function to prepare initial states when using BK encoding.
+    :param n: Number of qubits.
+    :return:
+    """"""
+
+    # Initializing qubits:
+    qc = qiskit.QuantumCircuit( n )
+
+    # JW->BK encoder (lower-triangluar!) matrix
+    bk_encoder = openfermion.transforms._encoder_bk( n )
+    # print(bk_encoder)
+    # Matrix multiplication mod 2 using CNOTs (starting from the bottom row)
+    for i in reversed( range( 1, n ) ):
+        for j in range( i  ):
+            if bk_encoder[i, j] == 1:
+                qc.cx(j,i)
+
+    return qc
+
+ +

Not that it is crucial to perform the matrix multiplication using CNOTs starting from the bottom row, since the encoder matrix is lower-triangular.

+",6313,,,,,6/11/2020 18:39,,,,6,,,,CC BY-SA 4.0 +12428,2,,4354,6/11/2020 18:53,,2,,"

D-Wave works more like a quantum simulator. It has a grid of two-level quantum system 'qubits'. However any single qubit cannot be arbitrarily rotated like in a universal QC.

+ +

All qubits form a collective state that is the ground state of some Hamiltonian. The Hamiltonian is parametrized by a set of coefficients. Initially the coefficients are set so that the ground state is something simple and it is implemented in the state of the qubits.

+ +

The As the 'quantum computation' proceeds, the Hamiltonian coefficients are slowly changed and the ground states becomes something more complicated. If the change is slow enough the initial ground state should become the final ground state - the object of interest.

+ +

The qubits are still the same thing - two level quantum systems, however, the way in which they can be manipulated is very different from the one in a universal QC.

+ +

There are works that show that the D-Wave model of computations is equivalent to the circuit one, but this requires a lot of qubits.

+",12140,,,,,6/11/2020 18:53,,,,0,,,,CC BY-SA 4.0 +12429,1,12430,,6/11/2020 22:45,,1,707,"

I'm having trouble running the following cell:

+ +

+ +

The system told me ""The 'ibmq_qasm_simulator' backend is not installed in your system."" I'm so confused. Is there a way I can install this backend in my system? Thanks!

+ +

+",12334,,55,,6/13/2020 5:49,6/13/2020 5:49,How can I install the 'ibmq_qasm_simulator' backend?,,1,0,,,,CC BY-SA 4.0 +12430,2,,12429,6/11/2020 22:48,,2,,"

The ibmq_qasm_simulator is a cloud-based simulator. You need to say

+ +
from qiskit import IBMQ
+provider = IBMQ.load_account()
+sim = provider.backends.ibmq_qasm_simulator
+
+",332,,,,,6/11/2020 22:48,,,,4,,,,CC BY-SA 4.0 +12431,2,,12419,6/12/2020 3:51,,6,,"

So any universal gate set can replicate any other, since both are universal, but different architectures generally have different physical gates. While Clifford+T is a universal gate set that is very nice to think about theoretically, it isn't generally close to the one used in the lab.

+ +

In most experimental setups, the physical level universal gate set used is composed of arbitrary angle Pauli rotations, along with a single entangling gate which is either always maximally entangling, or also variable angle.

+ +

For trapped ion systems, we use single qubit Paulis along with a gate known as the Mølmer-Sørenson gate. This gate is a rotation about the XX axis of two qubits which uses the shared motion of the ions in the trap to get distant entanglement.

+ +

Superconductors use different entangling gates, if I remember correctly IBM uses a gate called the 'Cross-Resonance gate' which I think is a ZX rotation gate, and on the Google Sycamore chip, they use a gate which ends up being a combination of CZ and iSWAP.

+ +

To understand how these are universal gate sets, lets use the ion trap gate set to build the pieces of the initial set you described, Clifford+T. First, lets condense that set into the three elements [H, CNOT, T]. A T gate is just a Z rotation, so by having the arbitrary Pauli rotations we are covered there. A Hadamard gate is an X rotation followed by a Y rotation, so we have that one as well. Through this we have all possible single qubit gates already. Now to get the CNOT, we can wrap the XX gate in 4 single qubit Paulis, as described in Fig. 1 of this paper. As a result we have a full universal set. The only difference for the SC gate sets would be a different decomposition of CNOT.

+",3056,,3056,,6/12/2020 17:17,6/12/2020 17:17,,,,2,,,,CC BY-SA 4.0 +12432,1,,,6/12/2020 9:45,,2,41,"

This question is about the effect of available information on random quantum channels.

+ +

Suppose there are two black box devices.

+ +

Device 1. +We have a black box device with a single qubit in it. Once we turn it on, this device does the following noisy quantum channel on the qubit $\rho \to (1-p) I \rho I^\dagger + p X \rho X^\dagger$, with certainty. Here $p \in (0,1)$. No measurement takes place after this device.

+ +

Device 2. This black box device has an identically prepared qubit in it. Furthermore, within this device there is a physical switch hidden that can be in state 'Heads' or 'Tails'. If the switch is in state Heads, nothing is guaranteed to happen; and if it is in state Tails, then the quantum bit-flip channel is guaranteed to happen. The switch is operated internally according to the outcome of a classical probability distribution, for example by a biased coin that flips Tails say with probability $q \in (0,1)$. Once we turn this device on, the device flips the coin internally, and therefore thus executes either $\rho \to \rho$ with probability $q$ or $\rho \to X \rho X^\dagger$ with probability $1-q$. No measurement takes place after this device.

+ +

We haven't yet but are about to turn on both devices.

+ +

Question 1. Suppose we will be informed of the outcome of the coin flip. If $p = q$, in this moment in time (so prior to turning on either device), are the two processes that are about to happen different or identical from a modeling perspective? Critically, assume that we do have access to all of the information above.

+ +

Question 2. Suppose we will not be informed of the outcome of the coin flip. What would be the answer now?

+",12339,,,,,6/12/2020 10:53,The effect of available information on random quantum channels,,1,0,,,,CC BY-SA 4.0 +12433,2,,12432,6/12/2020 10:53,,1,,"

This question gets right to the heart of what information does a density matrix contain about the state of a qubit. Critically, it is a subjective state of knowledge. So, if I don't know the outcome of the coin flip, my best description of the system is the same in both cases.

+ +

At the moment that I learn the outcome of the coin flip, I have to update my description of the system based on the information that I have, in which case, I'll just record the pure state that I have. If I've done any operations on it, I have to propagate that updated state through the sequence of operations to have the best description of the state that I hold. If somebody else still doesn't know what the coin flip outcome was, they still hold a description based on their possible knowledge, i.e. the mixed state outcome.

+",1837,,,,,6/12/2020 10:53,,,,3,,,,CC BY-SA 4.0 +12434,2,,12279,6/12/2020 11:23,,1,,"

As far as I understand from the paper, eq. (13) gives $U_l$ as a product of two qubit unitaries, independently of $l(z)$. Then the authors present two cases, subset parity and subset majority, and derive their specific $U_l$. Thus I guess your classification problem will need its own specialization of eq. (13). If you get an acceptable accuracy with the subset parity $U_l$, it may be a coincidence. Or maybe it is not, it depends on how your classification problem (that we do not know) relates to subset parity.

+",5551,,5551,,6/13/2020 9:20,6/13/2020 9:20,,,,0,,,,CC BY-SA 4.0 +12435,1,12437,,6/12/2020 12:40,,2,83,"

Concerning the Von Neumann Entropy $S(\rho) = H(pi) + \sum_{i}p_{i}S(\rho_{i})$, under what circumstances does $\sum_{i}piS(\rho_{i})$ become greater than 0? I am aware it occurs when $\rho_{i}$ is not pure itself. However. under what circumstances does this actually occur? Most of my experience with the Von Neumann Entropy up to this point has been when $\rho$ is the result of tracing out a larger system that it was correlated with, and as a result it is mixed. But when does this result in not only an uncertainty of which of the index i, but also what $\rho$ itself is?

+ +

For context I am only just learning this stuff, and none of my sources seem to comment on this or ask any questions regarding it.

+",4991,,55,,10/8/2020 17:54,10/8/2020 17:54,Under what situation is $\sum_{i} p_{i}S(\rho_i)$ > 0,,1,0,,,,CC BY-SA 4.0 +12436,1,,,6/12/2020 14:56,,1,48,"

I have already read through the answers here.

+ +

So I understand that if the Hamiltonians commute, then they have the same eigenstates but not necessarily the same energy eigenvalues.

+ +

To formulate my question (skip to last paragraph if you prefer), we have the Hamiltonian $H_B$ with known lowest energy eigenstate $|\psi_{B_0}\rangle$ and corresponding energy eigenvalue $E_{B_0}$. Then our time-depenent Hamiltonian is

+ +

$$ +H(t) = (1-\alpha(t))H_B + \alpha(t) H_C +$$

+ +

where $H_C$ is the problem Hamiltonian with lowest energy eigenstate $|\psi_{C_0}\rangle$ and corresponding energy eigenvalue $E_{C_0}$, and $\alpha \in [0,1]$ is a time varying function that gradually moves from $0$ to $1$.

+ +

As I understand, if $H_C$ and $H_B$ don't commute, then $|\psi_{B_0}\rangle$ is an eigenstate of both of them, and therefore also of $H$. So the state won't evolve out of $|\psi_{B_0}\rangle$, and we aren't guaranteed that it is equal to $|\psi_{C_0}\rangle$. Another way people state it, which to me feels equivalent, is that there will be a crossover of energy bands and this degeneracy will cause the adiabatic speed limit to go to 0.

+ +

Here's my question. As I said we aren't guaranteed that $|\psi_{B_0}\rangle = |\psi_{C_0}\rangle$. But does that mean that we are sure $|\psi_{B_0}\rangle \neq |\psi_{C_0}\rangle$? Are there situations where $H_C$ and $H_B$ commute and we can know in advance that $|\psi_{B_0}\rangle = |\psi_{C_0}\rangle$ and can do QAA anyway?

+",10485,,10485,,6/12/2020 15:01,6/12/2020 15:01,Is it absolutely necessary for Hamiltonians to not commute in QAA?,,0,4,,,,CC BY-SA 4.0 +12437,2,,12435,6/12/2020 15:00,,4,,"

Mathematically when is $\sum_i p_i S(\rho_i) > 0$?

+ +

I am assuming that $\{p_i\}$ form a probability distribution (and that none of the $p_i = 0$) and each $\rho_i$ is a normalised state.

+ +

As $p_i \geq 0$ and $S(\rho_i) \geq 0$ we have $\sum_i p_i S(\rho_i) = 0 \iff S(\rho_i) = 0$ for all $i$. Then we can ask the question under what circumstances do we have that each $S(\rho_i) = 0$. But a state $\rho_i$ has $S(\rho_i) = 0 \iff \rho_i$ is a pure state.

+ +

To see this let $\{\lambda_x\}_x$ be the eigenvalues of $\rho_i$. We can then compute $S(\rho_i) = - \sum_x \lambda_x \log \lambda_x$. Now as $\rho$ is a positive semi-definite matrix we have for each $x$, $\lambda_x \geq 0$ and as $\rho$ is normalized we have $ \sum_x \lambda_x = 1$. Putting these two constraints together we must have that for each $x$, $0 \leq \lambda_x \leq 1$. This means that for each term in the sum we have $- \lambda_x \log \lambda_x \geq 0$. So $-\sum_x \lambda_x \log \lambda_x = 0 \iff -\lambda_x \log \lambda_x = 0$ for all $x$. But $- \lambda_x \log \lambda_x = 0 \iff \lambda_x \in \{0,1\}$. Combining this with the fact that we need $\sum_x \lambda_x = 1$ we must have exactly one $x$ for which $\lambda_x = 1$ and the rest must vanish. Finally, if $\rho_i$ is a state with a single nonzero eigenvalue then it is a pure state. Hence $S(\rho_i) = 0 \implies \rho_i $ is pure. The other direction follows readily.

+ +

tl;dr $\sum_i p_i S(\rho_i) > 0 \iff \exists i$ such that $p_i>0$ and $\rho_i$ is not pure.

+ +

An example +Let $\rho_{AB} = |\psi \rangle \langle \psi |$ where $\psi = \tfrac{1}{\sqrt{2}}(|00\rangle + |11 \rangle)$. Suppose we measure on the first system the POVM $\{M, \mathbb{I} - M\}$ where $M = \frac{\mathbb{I} + \gamma \sigma_z}{2}$, $\gamma \in [0,1]$ is some parameter and $\sigma_z$ is the Pauli z operator. The $\gamma$ parameter is sometimes referred to as the strength/sharpness of the measurement. When $\gamma = 1$ the measurement is projective and when $\gamma = 0$ the measurement is trivial (doesn't interact with the system). Labelling the measurement outcomes $0,1$ respectively we get outcome $0$ with probability +$$ +p_0 = \mathrm{Tr}[(M^{1/2} \otimes \mathbb{I}) \rho_{AB} (M^{1/2} \otimes \mathbb{I})] +$$ +and +$$ +p_1 = \mathrm{Tr}[((\mathbb{I}-M)^{1/2} \otimes \mathbb{I}) \rho_{AB} ((\mathbb{I}-M)^{1/2} \otimes \mathbb{I})]. +$$ +Similarly the normailised state on system B after receiving outcome $0$ is +$$ +\rho_{B}(0) = \frac{\mathrm{Tr}_A[(M^{1/2} \otimes \mathbb{I}) \rho_{AB} (M^{1/2} \otimes \mathbb{I})]}{\mathrm{Tr}[(M^{1/2} \otimes \mathbb{I}) \rho_{AB} (M^{1/2} \otimes \mathbb{I})]} +$$ +and on outcome $1$, +$$ +\rho_{B}(1) = \frac{\mathrm{Tr}_A[((\mathbb{I}-M)^{1/2} \otimes \mathbb{I}) \rho_{AB} ((\mathbb{I}-M)^{1/2} \otimes \mathbb{I})]}{\mathrm{Tr}[((\mathbb{I}-M)^{1/2} \otimes \mathbb{I}) \rho_{AB} ((\mathbb{I}-M)^{1/2} \otimes \mathbb{I})]}. +$$ +We can represent the correlations between system $B$ and the outcome of our measurement on system $A$ by some cq-state +$$ +\rho_{A'B} = p_0 |0\rangle\langle 0 | \otimes \rho_B(0) + p_1 |1\rangle\langle 1 | \otimes \rho_B(1). +$$ +The entropy of this state is +$$ +S(\rho_{A'B}) = H(\{p_i\}) + \sum_i p_i S(\rho_B(i)), +$$ +like in your question. Now for the particular state we picked we can calculate the eigenvalues of both $\rho_0$ and $\rho_1$ to be $\{(1+\gamma)/2, (1-\gamma)/2\}$. So we see our states are pure only when $\gamma = 1$. Note that this is exactly when the measurement $M$ is projective and not just a POVM. In general (I think but you should check) for any pure two-qubit state, if we measure one qubit with a binary projective measurement then the resulting reduced states on of the other qubit will be pure. And if we measure with a two-outcome non-projective measurement then the resulting reduced states will be mixed.

+ +

This situation frequently arises in cryptography where we measure a system which may be entangled with an adversaries system. Then we try to estimate how much information they have about our measurement outcomes given their quantum system. However this estimation usually uses conditional entropies like $S(A'|B) = S(A'B) - S(B)$.

+",9854,,9854,,6/12/2020 16:07,6/12/2020 16:07,,,,8,,,,CC BY-SA 4.0 +12438,1,,,6/12/2020 15:15,,2,167,"

I understand that every Hilbert space $H$ can be decomposed into two mutually orthogonal subspaces $H_1$ and $H_2$ whose direct sum is $H$.

+

Therefore, every vector $v\in H$ can be decomposed into $v_1\in H_1$ and $v_2\in H_2$ such that direct sum of $v_1$ and $v_2$ is $v$.

+

I just want to see the mathematical procedure for an arbitrary quantum state.

+",12342,,10480,,1/27/2021 2:54,1/27/2021 3:09,How do you decompose an arbitrary quantum state into its corresponding projection subspaces such that their direct sum is the quantum state?,,1,1,,,,CC BY-SA 4.0 +12439,1,,,6/12/2020 15:48,,10,500,"

I'm working my way through one of the quantum circuits sections in Nielsen and Chuang and I'm struggling to get a feel for the basics of circuit construction. For example, one of the exercises is as follows: +

+ +

This exercise seems really simple on the surface, however I'm struggling to figure out how to go from a question posed like this to implementation. I can obviously write down the action in terms of the computational basis, but after this I get stuck.

+ +

I'm not so much looking for a specific solution to this exercise but rather using this as an instance of how to get into the correct frame of mind / use the correct procedures to solve problems with circuits.

+",12344,,55,,6/13/2020 5:39,8/13/2021 22:21,Procedures and intuition for designing simple quantum circuits?,,2,0,,,,CC BY-SA 4.0 +12440,2,,12439,6/12/2020 16:49,,8,,"

Here are the actions for the given transformation on the computational basis states:

+ +

$$|000\rangle \rightarrow |000\rangle \qquad |001\rangle \rightarrow |010\rangle \qquad |010\rangle \rightarrow |011\rangle \qquad |011\rangle \rightarrow |100\rangle +\\ +|100\rangle \rightarrow |101\rangle \qquad |101\rangle \rightarrow |110\rangle \qquad |110\rangle \rightarrow |111\rangle \qquad |111\rangle \rightarrow |001\rangle +$$

+ +

Let's label the qubits in this format: $|q_2 q_1 q_0 \rangle$ (Qiskit's labeling). Here are some ideas. $|001\rangle \rightarrow |010\rangle$ and $ |010\rangle \rightarrow |011\rangle$ transformations can be done with CNOT(0, 1) and CNOT(1, 0) gates. $|011\rangle \rightarrow |100\rangle$ transformation can be done by adding Toffali(0, 1, 2) before the two CNOTs presented above and adding CNOT(2, 0) after the two CNOTs. $|110\rangle \rightarrow |111\rangle$ transformation can be done with Toffali(2, 1, 0). With this ideas we can construct the circuit (the ordering is important, but can be changed in some places):

+ +

+ +

For checking the correctness of the circuit we can try to give different inputs to the circuit and check the outputs or we can do matrix multiplications and see if the final matrix will be equal to the given matrix or we can use tools from Qiskit:

+ +
from qiskit import *
+import qiskit.quantum_info as qi
+
+circuit = QuantumCircuit(3)
+
+circuit.ccx(0, 1, 2)
+circuit.cx(0, 1)
+circuit.cx(1, 0)
+circuit.cx(2, 0)
+circuit.ccx(2, 1, 0)
+
+matrix = qi.Operator(circuit)
+print(matrix.data)
+
+ +

The output:

+ +
[[1 0 0 0 0 0 0 0]
+ [0 0 0 0 0 0 0 1]
+ [0 1 0 0 0 0 0 0]
+ [0 0 1 0 0 0 0 0]
+ [0 0 0 1 0 0 0 0]
+ [0 0 0 0 1 0 0 0]
+ [0 0 0 0 0 1 0 0]
+ [0 0 0 0 0 0 1 0]]
+
+",9459,,9459,,6/12/2020 17:23,6/12/2020 17:23,,,,0,,,,CC BY-SA 4.0 +12441,1,,,6/12/2020 17:00,,1,92,"

I need to manipulate phases in 2 qubits. I will eventually create 34 distinct phase sets to map to an alphabet I built.

+ +

I see https://github.com/oreilly-qc/oreilly-qc.github.io/blob/master/samples/Qiskit/ch07_08_qft_rotating_phases.py

+ +

Is there a simple qiskit or qc example of a 2 qubit program that results in the following by using 45, and 90 degree phasing(see pic added)?:

+ +

As the letters change, so will each phase in each qubit. Any help appreciated. Here is the first ""letter"" (>)

+ +

+",12346,,55,,6/13/2020 5:44,6/13/2020 5:44,Example of Simple phase Change Using 2 Qubits,,0,8,,6/18/2020 8:29,,CC BY-SA 4.0 +12442,2,,12413,6/12/2020 20:03,,2,,"

To get a quantum gate with single photons, you need something of the form:

+ +

$$(|0\rangle+e^{i*0}|1\rangle)|1\rangle \rightarrow (|0\rangle+e^{i\pi}|1\rangle)|1\rangle$$

+ +

Putting this in English, it means that a second photon causes a phase shift in the first photon. This type of interaction can't occur simply by overlapping or interfering photons, but requires a ""nonlinear"" interaction where one photon sort-of ""pushes"" the other. In a lab setting, this typically happens through some other material. For instance, a photon shining on a gas of atoms might change the energy of the gas, which will change the properties of the medium, and the second photon will experience a different phase as a result. (For example, maybe the first photon causes the medium to slow down the speed of the second photon).

+ +

Getting these types of interactions to work (where one photon changes the phase of a second photon) is extremely difficult and is an active field of research. If it was developed, then it would be a big deal - and we wouldn't just have another competitor for a new quantum computing architecture, but we would also be able to do some interesting things like quantum nondemolition measurement.

+",2660,,,,,6/12/2020 20:03,,,,0,,,,CC BY-SA 4.0 +12443,2,,12439,6/12/2020 21:37,,9,,"

Here are three strategies for learning to make this kind of circuit. They all involve being initially loose with what is allowed and gradually tightening constraints until everything is accounted for.

+

A) Work up in stages from a classical circuit

+

Start by making a classical-ish circuit that prepares the correct output for each input without worrying about uncomputing the input. Then try to simplify that. Then, for each possible output, make sure you're uncomputing the input. Then try to simplify that. Then swap the uncomputed input for the computed output at the end of the circuit, making it a proper quantum circuit with some intermediate work qubits. Then try to simplify that and eliminate work qubits one by one.

+

B) Fix one state at a time, without breaking previous states

+

Pick the first input that is being sent to the wrong output. For example, $|001\rangle$ staying fixed instead of becoming $|010\rangle$. Apply a few operations that fix this without breaking any of the states you previously fixed. Repeat until all states are correct. Then look at the resulting circuit and start trying to make optimizations.

+

C) Recognize approximate patterns

+

The "each entry shifted down by one" pattern in the unitary matrix is what an increment looks like. So this matrix is applying an increment to the 1..7 subset of the state space while leaving 0 alone. This means that applying an increment operation (or learning how one is applied) is probably pretty close to the right answer, and from there you can try to fix up the differences.

+",119,,119,,8/13/2021 22:21,8/13/2021 22:21,,,,5,,,,CC BY-SA 4.0 +12444,2,,12417,6/12/2020 22:24,,1,,"

I'm not sure for this specific problem, and more broadly Hamiltonians are typically in the ""eye of the beholder.""

+ +

For example, for quantum chemistry problems, Hamiltonians are really clean mappings from problems that were originally in quantum chemistry. For example, there are ""annihilation/creation operators"" (discussed more here) that could be converted into quantum simulation problems through the Jordan-Wigner Transforms.

+ +

$$ +a^{\dagger} = \frac{X + i Y}{2}, a = \frac{X - i Y}{2} +$$

+ +

Even though $ a^{\dagger}, a $ aren't unitary, we can exponentiate the transformations:

+ +

$$ +e^{a^{\dagger} + a} = e^{1/2}e^{X + iY} e^{1/2}e^{X - iY} + O(*) +$$

+ +

(Where $O(*)$ is some error term, because matrix exponentiation isn't like scalar exponentials). This produces a bunch of matrix exponentials that are implementable on a quantum computer, whereas $a^{\dagger}, a$ were not.

+ +

I believe there are some commonalities that hold, like how the expectation value of a Hamiltonian represents the energy level, but I'd appreciate additional clarification from community members in other fields.

+",8343,,,,,6/12/2020 22:24,,,,0,,,,CC BY-SA 4.0 +12445,1,,,6/13/2020 1:05,,4,109,"

I was reading over the proof of the Deutsch-Jozsa algorithm, which in its simplest case, involves at least 2 qubits.

+ +

Is there an example of a quantum algorithm that is better than it's classical counterpart which only involves a single qubit?

+ +

If not, could you provide an explanation of why such an algorithm cannot exist?

+ +

Thank you very much. I have only recently started my journey into quantum computing.

+",12347,,55,,6/13/2020 5:33,6/18/2020 5:45,Example of a quantum algorithm better than its classical counterpart which involves only $1$ qubit?,,2,0,,,,CC BY-SA 4.0 +12446,2,,12445,6/13/2020 1:13,,5,,"

There aren't many examples! The main reason for advantages in quantum computers is the ability to constructively combine amplitudes - if you've only got 1 qubit, there aren't any amplitudes to combine!

+ +

The best use case I can think of is randomness. A quantum computer (implemented with arbitrary error) could theoretically be a near perfect source of entropy, whereas a classical computer requires some outside source to contribute randomness (see random.org for more stuff on randomness!)

+ +

Seriously, though, to take advantage of constructive interference, you'll need amplitudes over different bitstrings to constructively interfere. :)

+ +

Great question!

+",8343,,,,,6/13/2020 1:13,,,,1,,,,CC BY-SA 4.0 +12447,1,,,6/13/2020 1:48,,1,65,"

I'm trying to implement Grover's algorithm. For the oracle I have three nodes which are represented by two qubits for each node. How can I check if the states of two nodes are not equal?

+ +

+",,user12136,55,,6/13/2020 5:31,6/13/2020 5:31,Equality comparator for two qubits each,,0,4,,,,CC BY-SA 4.0 +12448,1,12449,,6/13/2020 4:00,,1,984,"

I have looked at the following:

+ +

What is the difference between a relative phase and a global phase? In particular, what is a phase?

+ +

Global and relative phases of kets in QM

+ +

Global phases and indistinguishable quantum states, mathematical understanding

+ +

If two states differ by a scalar of magnitude of 1, then they are indistinguishable. Consider: +\begin{align} +\vert \psi_1 \rangle &= \dfrac{1}{\sqrt{2}} \vert 0 \rangle + \dfrac{i}{\sqrt{2}} \vert 1 \rangle\\ +\vert \psi_2 \rangle &= \color{red}{i}\left(\dfrac{-i}{\sqrt{2}} \vert 0 \rangle + \dfrac{1}{\sqrt{2}} \vert 1 \rangle\right). +\end{align}

+ +

Which of the following is true about $\vert \psi_1 \rangle$ and $\vert \psi_2 \rangle$?

+ +
    +
  1. $\vert \psi_1 \rangle = \vert \psi_2 \rangle$
  2. +
  3. $\vert \psi_1 \rangle \neq \dfrac{-i}{\sqrt{2}} \vert 0 \rangle + \dfrac{1}{\sqrt{2}} \vert 1 \rangle$
  4. +
  5. $\vert \psi_1 \rangle = \dfrac{-i}{\sqrt{2}} \vert 0 \rangle + \dfrac{1}{\sqrt{2}} \vert 1 \rangle$ up to global phase.
  6. +
  7. If we just ignore the global phase in $\vert \psi_2 \rangle$ and only deal with $\dfrac{-i}{\sqrt{2}} \vert 0 \rangle + \dfrac{1}{\sqrt{2}} \vert 1 \rangle$ , do we still have the state vector on a Bloch sphere yields the same projection as $\vert \psi_1 \rangle$?
  8. +
+ +

Lastly, since the global phase is not physically observable, is it mathematically evident?

+",7528,,55,,7/19/2021 20:54,7/19/2021 20:54,How do two qubit states differing by a global phase relate to each other?,,1,3,,,,CC BY-SA 4.0 +12449,2,,12448,6/13/2020 5:16,,1,,"

1) So $|\psi_1\rangle \neq |\psi_2\rangle$, but it effectively is since they give the exact same distributions for any measurement in any basis.

+ +

2) Same discussion as above.

+ +

3) True

+ +

4) States in the Bloch sphere are of the form

+ +

$$|\psi\rangle = \cos(\theta/2)|0\rangle + e^{i\phi}\sin(\theta/2)|1\rangle,$$

+ +

so the state you describe technically is not directly on the Bloch sphere. I think a better way of thinking about global phase is that it's an infinite equivalence class of states with the exact same physical properties, and one representative (the one with a real coefficient in front of $|0\rangle$) is on the Bloch sphere.

+ +

You cannot measure the global phase. Phases are only relevant when they are relative, and consequently affect superpositions/measurements.

+",3056,,9006,,6/13/2020 6:33,6/13/2020 6:33,,,,4,,,,CC BY-SA 4.0 +12450,1,12451,,6/13/2020 5:38,,2,117,"

I have been given a LittleEndian register. I want to know the following things:

+ +
    +
  1. How many bits there are in the LittleEndian?
  2. +
  3. How to convert the LittleEndian into a Qubit[] Array.
  4. +
  5. How to access individual qubits of LittleEndian?
  6. +
  7. How to apply simple and controlled gates onto individual qubits of LittleEndian?
  8. +
+",8757,,55,,6/13/2020 17:51,6/13/2020 17:51,How to apply a gate to a LittleEndian in Q#,,1,0,,,,CC BY-SA 4.0 +12451,2,,12450,6/13/2020 6:03,,3,,"

The LittleEndian type is basically a wrapper for a register of qubits to let the user know how to interpret it as another value. It changes nothing about the register it wraps.

+ +
    +
  1. There is no fixed number of bits in a LittleEndian, it only documents that the least significant bit of a register is index 0 (on the left).
  2. +
  3. If you want to get back just the register not wrapped in the LittleEndian type, you can use the ! operator like this:
  4. +
+ + + +
using (register = LittleEndian(Qubit[3]) {
+    ResetAll(register!);
+}
+
+ +
    +
  1. Similar to #2 if you us ! to unwrap the LittleEndian type you can then index it like normal.
  2. +
  3. Same as #3, just unwrap the type and you should be able to do the gates as you would regularly. The controlled functor may be of use to you.
  4. +
+ +

I also have a section in my book that talks about how to use UDTs or User Defined Types which LittleEndian is an example of (provided by the Numerics library)

+",4211,,,,,6/13/2020 6:03,,,,1,,,,CC BY-SA 4.0 +12452,1,,,6/13/2020 6:14,,4,565,"

I wish to calculate the expectation and variance for an observable on a particular qubit of a multi qubit quantum state. I'm using a quantum computing simulation library which allows me to apply operators to a state vector and perform calculations such as computing inner products between state vectors.

+ +
+ +

To compute the expectation value:

+ +

I can use the definition of expectation value $\langle\psi|O|\psi\rangle$ to achieve this computation as follows:

+ +
    +
  1. Create a copy of the given state vector $\psi$, apply the observable to the required qubit to obtain $O|\psi\rangle$.

  2. +
  3. Calculate the inner product of the state calculated in 1 with the conjugate transpose of $|\psi\rangle$ that is $\langle\psi|O|\psi\rangle$.

  4. +
+ +

Is the method for computing the expectation values correct ?

+ +
+ +

For computing the variance:

+ +

I'm thinking of using the following definition: +$$\text{Variance}(O) = \text{Expectation}(O^2) - \text{Expectation}(O)^2.$$

+ +

If I understand correctly, I need to compute the following two quantities:

+ +

a. $\text{Expectation}(O)^2$: This is simply the square of the expectation value that I can calculate using the method stated earlier.
+ b. $\text{Expectation}(O^2)$: For calculating this, I think I need to apply the observable to the target qubit in the state vector twice (Is that right?). If so, in case my observable is unitary, I can avoid applying the unitary altogether. So this value should simply be $\langle\psi|\psi\rangle$ (which should be 1 since my state is normalized).

+ +
    +
  1. Is this correct?
  2. +
  3. Is there a better (more efficient) way to accomplish this?
  4. +
+",12349,,55,,6/13/2020 18:02,6/13/2020 18:02,Computing variance under the action of a unitary operator,,2,2,,,,CC BY-SA 4.0 +12453,2,,12452,6/13/2020 8:21,,2,,"

Calculating the expectation value for a specific Hermitian operator

+ +

This approach can be implemented with real Quantum Hardware and with a simulator. Every Hermitian operator can be decomposed in the sum of Pauli tensor product terms (Pauli terms) with real coefficients (see this thread [1])

+ +

$$H = a \cdot \sigma_z \otimes I + b \cdot\sigma_y \otimes \sigma_y + c \cdot\sigma_x \otimes I, $$

+ +

where $a,b,c$ are real numbers. The expectation value of $H$:

+ +

$$\langle \psi | H | \psi \rangle = \langle \psi | \sigma_z \otimes I | \psi \rangle + \langle \psi | \sigma_y \otimes \sigma_y | \psi \rangle + \langle \psi | \sigma_x \otimes I | \psi \rangle $$

+ +

So, finding the expectation value of $H$ operator can be calculated from summing separately calculated expectation values of the Pauli terms with their real coefficients. Now we should run separate experiments for calculating the expectation value of each Pauli term. Note that in some cases when the Pauli terms commute we can combine the expectation value estimation procedure for them like was shown for the two-qubit state in this question [2] (or here [3]). It is not our case, because our Pauli terms do not commute with each other.

+ +

Note that any one-qubit state can be expressed with different eigenbasis (like every vector in a 2D real space can be expressed with a combination of any set of 2 orthonormal 2D vectors):

+ +

$$|\psi \rangle = c_0 |0 \rangle + c_1| 1 \rangle = c_+ | + \rangle + c_-| - \rangle$$

+ +

where $c$s are complex numbers, $|0 \rangle$ and $| 1 \rangle$ are eigenbasis for $\sigma_z$, $|+ \rangle = \frac{1}{\sqrt{2}}(|0 \rangle + | 1 \rangle)$ and $| - \rangle = \frac{1}{\sqrt{2}}(|0 \rangle - | 1 \rangle)$ are eigenbasis for $\sigma_x$. For the two-qubit case, we can use Bell basis that is also an eigenbasis for $\sigma_y \otimes \sigma_y$ [2], [4]

+ +

$$ +|\psi \rangle = c_{\Phi^+}|\Phi^+\rangle + c_{\Phi^-}|\Phi^-\rangle + c_{\Psi^+}|\Psi^+\rangle + c_{\Psi^-}|\Psi^-\rangle +$$

+ +

where $|\Phi^+\rangle$, $\Phi^-\rangle$, $|\Psi^+\rangle$ and $|\Psi^-\rangle$ are Bell states. By taking this into account we can obtain:

+ +

$$\langle \psi| \sigma_z | \psi \rangle = |c_0|^2 - |c_1|^2 +\\ +\langle \psi| \sigma_x | \psi \rangle = |c_+|^2 - |c_-|^2 +\\ +\langle \psi| \sigma_y \otimes \sigma_y | \psi \rangle = -|c_{\Phi^+}|^2 + |c_{\Phi^-}|^2 + |c_{\Psi^+}|^2 - |c_{\Psi^-}|^2 +$$

+ +

""+"" and ""-"" sign comes from $P |\lambda \rangle = \pm |\lambda \rangle$ for a Pauli term $P$ with correspoding eigenvector $|\lambda \rangle$. Here $|c_0|^2 = \frac{N_0}{N}$, $|c_1|^2 = \frac{N_1}{N}$ for big enough $N$, $N$ is the number of the measurements, $N_0$ is the number of $|0\rangle$ measurements, $N_1$ is the number of $|1\rangle$ measurements. The same for $\sigma_x$: $|c_+|^2 = \frac{N_+}{N}$, $|c_-|^2 = \frac{N_-}{N}$ for big enough $N$, $N_+$ is the number of $|0\rangle$ measurements, $N_-$ is the number of $|1\rangle$ measurements. Similarly for the Bell states. So by just measuring in the appropriate basis we will be able to calculate the expectation value of the Pauli terms. Here we can have a problem, if our quantum computer don't have a possibility to measure in arbitrary eigenbasis. For a given $P$ Pauli term this problem can be overcomed by applying such $U$ unitary operator before the $\sigma_z$ (default) measurements (like was presented here [5]), that:

+ +

$$ \langle \psi |P| \psi \rangle = \langle \psi | U^{\dagger} \sigma_z \otimes \sigma_z \otimes ...\otimes \sigma_z U | \psi \rangle$$

+ +

Note that in the product $\sigma_z \otimes \sigma_z \otimes ...\otimes \sigma_z$ in some places we can have $I$ instead of $\sigma_z$: it just means that we will not do any measurement for the corresponding qubit. For $P = \sigma_x$ this can be done with $U = H$ gate. For $\sigma_y \otimes \sigma_y$ we can take $U = (H\otimes I) CNOT$ [2], [4].

+ +

The same can be done for $H^2$ because it is also a Hermitian operator and hence with this method, we will be able also to calculate the variance of $H$.

+",9459,,9459,,6/13/2020 11:36,6/13/2020 11:36,,,,0,,,,CC BY-SA 4.0 +12454,1,12456,,6/13/2020 9:16,,2,300,"
+

Suppose we have a quantum state $|\psi \rangle$ of $n$ qubits, where $|\psi\rangle=\sum_{x∈\{0,1\}^n}\alpha_x |x\rangle$,and we measure the first qubit of $|\psi\rangle$ in the computational basis. What is the probability that the measurement outcome is $1$, in terms of the $\alpha_x $ coefficients?

+
+ +

I'm not quite sure how to approach this. Usually the computational basis is $\{|0\rangle,|1\rangle\}$ and I'm not sure what ket I am meant to apply to the $|\psi\rangle$.

+ +

I'm also not sure what matrix I need to use to do the measurement.

+",4336,,55,,6/13/2020 18:06,6/13/2020 18:06,Find the probability of a measurement outcome in terms of the coefficients of the state,,2,0,,,,CC BY-SA 4.0 +12455,2,,12454,6/13/2020 9:33,,1,,"

The probability that the measurement outcome is 1 in the first qubit is $\sum|\alpha_x|^2$ for all $x$ whose first bit is 1.

+",5551,,5551,,6/13/2020 9:44,6/13/2020 9:44,,,,0,,,,CC BY-SA 4.0 +12456,2,,12454,6/13/2020 9:39,,1,,"

$x \in \{0, 1\}^n$ means that in the sum we have all possible bitstrings with length $n$. Let's take $n = 3$:

+ +

$$|\psi\rangle = \sum_{x \in \{0, 1\}^n} \alpha_x |x\rangle= \alpha_{000} |000\rangle + \alpha_{001} |001\rangle + \alpha_{010} |010\rangle + \\ ++ \alpha_{011} |011\rangle + \alpha_{100} |100\rangle + \alpha_{101} |101\rangle + \alpha_{110} |110\rangle + \alpha_{111} |111\rangle$$

+ +

If we use projecter $P = |1\rangle \langle 1 | \otimes I \otimes I$ then the probability of measuring first qubit $|1\rangle$ will be equal to:

+ +

$$p = \langle \psi | P | \psi \rangle = |a_{100}|^2 + |a_{101}|^2 + |a_{110}|^2 + |a_{111}|^2$$

+ +

More about projective measurements can be found in M. Nielsen and I. Chuang's textbook pages 87-88 (for $M$ in the textbook one can take $Z \otimes I \otimes I$ operator).

+",9459,,9459,,6/13/2020 9:47,6/13/2020 9:47,,,,0,,,,CC BY-SA 4.0 +12457,1,,,6/13/2020 10:46,,1,194,"

I am trying to use the HalfMoon Classifier in Quantum Machine Learning Sample Examples. I am trying to run it locally. However I keep getting this error.

+ +
No namespace with the name ""Microsoft.Quantum.MachineLearning"" exists.
+
+ +

This error is then followed by multiple errors of the identifiers under this namespace not existing. +In my python Host.py file

+ +

I have the following Import Lines

+ +
import qsharp
+qsharp.packages.add(""Microsoft.Quantum.MachineLearning::0.11.2006.403"")
+qsharp.reload()
+
+
+ +

Edit:

+ +

Replacing Package Version and Making it same as dotnet iqsharp --version did work. However I still seem to getting fail: warnings saying identifiers don't exist and

+ +
No namespace with the name ""Microsoft.Quantum.MachineLearning"" exists.
+
+ +

The program runs correctly but the warnings don't go away. +Hence I ask is there anyway to fix these warnings?

+",8757,,55,,6/14/2020 12:34,6/14/2020 12:34,Q# Quantum.MachineLearning namespace doesn't exist error,,0,5,,,,CC BY-SA 4.0 +12458,1,12460,,6/13/2020 11:54,,3,1911,"
+

Show that a $CZ$ gate can be implemented using a $CNOT$ gate and Hadamard gates and write down the corresponding circuit.

+

Recall from Quantum Information Theory that $Z=HXH$. As $CNOT$ is a controlled-$X$ operation, we would expect that $CZ= (I \otimes H)CNOT(I\otimes H)$.

+
+

Why would we expect this form? Where does this come from?

+",4336,,-1,,6/18/2020 8:31,6/14/2020 12:25,Show that a $CZ$ gate can be implemented using a $CNOT$ gate and Hadamard gates,,3,0,,,,CC BY-SA 4.0 +12459,2,,12458,6/13/2020 12:51,,2,,"

The form $(I \otimes H)CNOT(I \otimes H)$ just means that you have a control qubit whose state is left unchanged (applying the $I$ operator), and a target qubit whose state is operated with $H$, controlled-$X$ and $H$ again. This is actually a controlled-$Z$ operator applied to a two-qubit system.

+",5551,,,,,6/13/2020 12:51,,,,0,,,,CC BY-SA 4.0 +12460,2,,12458,6/13/2020 12:54,,2,,"

Here is the CNOT gate:

+ +

$$CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$$

+ +

So:

+ +

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes HH + |1\rangle \langle 1| \otimes HXH$$

+ +

If we will take into account $HXH = Z$ and $HH = I$, then:

+ +

$$(I \otimes H) CNOT (I \otimes H) = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes Z = CZ$$

+ +
+ +

Let's show that $CNOT = |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X$:

+ +

$$ |0\rangle \langle 0|\otimes I + |1\rangle \langle 1| \otimes X = \begin{pmatrix}1&0 \\ 0&0 \end{pmatrix} \otimes\begin{pmatrix}1&0 \\ 0&1 \end{pmatrix} + \begin{pmatrix}0&0 \\ 0&1 \end{pmatrix} \otimes\begin{pmatrix}0&1 \\ 1&0 \end{pmatrix} = +\\ +=\begin{pmatrix} +1&0&0&0 \\ +0&1&0&0 \\ +0&0&0&0 \\ +0&0&0&0 \\ +\end{pmatrix} + +\begin{pmatrix} +0&0&0&0 \\ +0&0&0&0 \\ +0&0&0&1 \\ +0&0&1&0 \\ +\end{pmatrix} = +\begin{pmatrix} +1&0&0&0 \\ +0&1&0&0 \\ +0&0&0&1 \\ +0&0&1&0 \\ +\end{pmatrix} = CNOT$$

+",9459,,9459,,6/14/2020 12:25,6/14/2020 12:25,,,,0,,,,CC BY-SA 4.0 +12461,1,12463,,6/13/2020 13:53,,3,246,"
+

Applying the above construction to AND we get the map $(x1,x2,y) \rightarrow (x1,x2,y⊕(x1∧x2))$ for $x1,x2,y \in \{0,1\}$. The unitaryoperator which implements this is then simply the map $|x1〉|x2〉|y> \rightarrow |x1〉|x2〉|y \oplus (x1∧x2)〉$.

+

Written as a matrix with respect to the computational basis this is

+
+

$$\begin{bmatrix} 1&0&0&0&0&0&0&0\\0&1&0&0&0&0&0&0\\0&0&1&0&0&0&0&0\\0&0&0&1&0&0&0&0\\0&0&0&0&1&0&0&0\\0&0&0&0&0&1&0&0\\0&0&0&0&0&0&0&1\\0&0&0&0&0&0&1&0 +\end{bmatrix}$$

+

How can you just spot what the matrix is with respect to the computational basis?

+",4336,,-1,,6/18/2020 8:31,6/13/2020 20:56,How to spot the matrix representation of the quantum NOT operation,,3,0,,,,CC BY-SA 4.0 +12462,2,,12461,6/13/2020 14:51,,1,,"

Something that might help is that this gate is pretty common - it's the Toffoli! (or CCNOT).

+ +

More generally, you can make matrices by considering the action of the unitary on every input; for example, what is Toffoli($|000\rangle$), Toffoli($|001\rangle$), ... etc.

+ +

Notice that the first two bits are unaffected, and the third bit is only changed from $|y\rangle$ when $x_1, x_2$ are $1$. So, the only inputs where the transformation isn't the identity is $|110\rangle, |111\rangle$. Running through the computation, Toffoli($|110\rangle$) = $|111\rangle$ and Toffoli($|111\rangle$)=$|110\rangle$, which is shown in the matrix.

+",8343,,,,,6/13/2020 14:51,,,,0,,,,CC BY-SA 4.0 +12463,2,,12461,6/13/2020 15:06,,2,,"

This is the CCNOT gate, but let's try to derive it. Note that the action of the matrix on $|000\rangle$ is the first colomn of the matrix. Let me use a 2-dimensional case in order to have smaller matrices. So I am going to prove that the first column is the state after applying the matrix to the $|00\rangle$ state:

+ +

$$ +A |00\rangle = +\begin{pmatrix} +a_{11}&a_{12}&a_{13}&a_{14}\\ +a_{21}&a_{22}&a_{23}&a_{24}\\ +a_{31}&a_{32}&a_{33}&a_{34}\\ +a_{41}&a_{42}&a_{43}&a_{44} +\end{pmatrix} +\begin{pmatrix} +1\\0\\0\\0 +\end{pmatrix} = +\begin{pmatrix} +a_{11}\\ +a_{21}\\ +a_{31}\\ +a_{41} +\end{pmatrix} +$$

+ +

Another example for $|10\rangle$:

+ +

$$ +A |10\rangle = +\begin{pmatrix} +a_{11}&a_{12}&a_{13}&a_{14}\\ +a_{21}&a_{22}&a_{23}&a_{24}\\ +a_{31}&a_{32}&a_{33}&a_{34}\\ +a_{41}&a_{42}&a_{43}&a_{44} +\end{pmatrix} +\begin{pmatrix} +0\\0\\1\\0 +\end{pmatrix} = +\begin{pmatrix} +a_{13}\\ +a_{23}\\ +a_{33}\\ +a_{43} +\end{pmatrix} +$$

+ +

This is true also for other computational basis states. Here is the truth table for the transformation described in the question:

+ +

$$\begin{array}{c|c} +|x_1 x_2 y \rangle & |x_1 x_2 (y \oplus x_1 ∧x_2) \rangle\\ +\hline +|000 \rangle & |000 \rangle \\ +|001 \rangle & |001 \rangle \\ +|010 \rangle & |010 \rangle \\ +|011 \rangle & |011 \rangle \\ +|100 \rangle & |100 \rangle \\ +|101 \rangle & |101 \rangle \\ +|110 \rangle & |111 \rangle\\ +|111 \rangle & |110\rangle +\end{array}$$

+ +

So we just need to put in the first column the vector that is presented as an output for $|000\rangle$, the second column is the output of the $|001\rangle$, and so on. From truth table one can notice that the first 6 columns will coincide with the input basis vectors, and the 7th column will be equal to $|111\rangle$ and 8th column will be equal to $|110\rangle$. This way we will obtain the matrix presented in the question: the CCNOT gate.

+ +

More schematically if we have some $M$ matrix, for which we only know the outputs for basis vectors, then (for our case):

+ +

$$M = \big(M|000\rangle \; M|001\rangle \; M|010\rangle \; M|011\rangle \; M|100\rangle \; M|101\rangle \; M|110\rangle \; M|111\rangle \big) = +\\ += \big(|000\rangle \; |001\rangle \; |010\rangle \; |011\rangle \; |100\rangle \; |101\rangle \; |111\rangle \; |110\rangle \big) = +\\ += +\begin{pmatrix} +1&0&0&0&0&0&0&0\\0&1&0&0&0&0&0&0\\0&0&1&0&0&0&0&0\\0&0&0&1&0&0&0&0\\0&0&0&0&1&0&0&0\\0&0&0&0&0&1&0&0\\0&0&0&0&0&0&0&1\\0&0&0&0&0&0&1&0 +\end{pmatrix} +$$

+ +

Also, this might be interesting answer for a different matrix. I have used the approach presented there.

+",9459,,9459,,6/13/2020 16:44,6/13/2020 16:44,,,,3,,,,CC BY-SA 4.0 +12464,2,,12452,6/13/2020 18:00,,2,,"

I'll comment on how you would obtain these quantities in a (generic, idealised) experimental scenario.

+ +

To compute an expectation value $\langle \psi|O|\psi\rangle$ you need to be able to measure in the eigenbasis of $O$. Being observables, by definitions, Hermitian operators, you can always write $O$ as +$O = \sum_k \lambda_k |u_k\rangle\!\langle u_k|$, where $O|u_k\rangle=\lambda_k|u_k\rangle$ and $|u_k\rangle$ are an orthonormal basis.

+ +

In terms of these quantities, the expectation value reads +$$\langle\psi|O|\psi\rangle = \sum_k \lambda_k |\langle u_k|\psi\rangle|^2.$$ +What you need to do is therefore measure $|\psi\rangle$ in the basis $\{|u_k\rangle\}_k$. Each such measurement will give you as output one of the possible output state (e.g. you might find $|u_1\rangle$ at the first run, $|u_3\rangle$ at the second run, etc.). Running the experiment multiple times you can estimate the probabilities of each outcome. When a sufficient number of measurements are performed, these will approach the true probabilities $p_k\equiv |\langle u_k|\psi\rangle|^2$.

+ +

Once you estimated these probabilities, the expectation value is obtained by simply attaching (multiplying) the number $\lambda_k$ to each probability $p_k$ and summing the resulting values.

+ +

Measuring $\langle\psi|O^2|\psi\rangle$ is fully analogous, and doesn't require additional measurements. The only difference is that each $p_k$ is multiplied by $\lambda_k^2$ rather than by $\lambda_k$.

+ +
+ +

With regards to the calculation involving applying $O$ to $|\psi\rangle$, it is important to note that this is useful as a mathematical trick to compute this quantity, but does not represent a physical operation. Observables are not physical operations that transform states into other states.

+",55,,,,,6/13/2020 18:00,,,,0,,,,CC BY-SA 4.0 +12465,2,,12461,6/13/2020 18:18,,3,,"

Whenever a unitary is a permutation matrix, it corresponds to an operation which can be described using a simple truth table. In other words, it corresponds to a simple reshuffling of computational basis elements.

+ +

Once you notice this, you just need to observe that the $i$-th column of the matrix tells you where the $i$-th state is sent (where some ordering of the states has been defined). More precisely, the $i$-th input state is sent to the $j$-th output state with $j$ the row in the $i$-th column that corresponds to a value $1$.

+ +

For example, observe in your case how the first column tells you that the first input is sent to the first output. The second column tells you that the second input is sent to the second output. +More generally, the $i$-th input is sent to the $i$-th output for all $i=1,...,6$. +However, the seventh input goes to the eigth output, and the eight input to the seventh output.

+ +

The standard ordering in the computational basis for three qubits is +$$|000\rangle, |001\rangle, |010\rangle, |011\rangle, |100\rangle, |101\rangle, |110\rangle, |111\rangle.$$ +This means that the matrix corresponds to the following transformation rules: +$$ +|000\rangle \to |000\rangle, \quad +|001\rangle \to |001\rangle, \quad +|010\rangle \to |010\rangle, \\ +|011\rangle \to |011\rangle, \quad +|100\rangle \to |100\rangle, \quad +|101\rangle \to |101\rangle, \\ +|110\rangle \to |111\rangle, \quad +|111\rangle \to |110\rangle, +$$ +which you can observe corresponds to a CCNOT operation.

+",55,,55,,6/13/2020 20:56,6/13/2020 20:56,,,,0,,,,CC BY-SA 4.0 +12466,1,12468,,6/13/2020 20:28,,4,230,"

I'm trying to add the Q# machine learning library to my program by

+ +
import qsharp
+qsharp.packages.add(""Microsoft.Quantum.MachineLearning::0.11.2004.2825"")
+qsharp.reload()
+
+ +

but it throws the errors below. Any solutions?

+ +

P.S. I have the qsharp package and iqsharp installed. Normal programs in python that use qsharp work correctly.

+ +
dotnet iqsharp --version
+iqsharp: 0.11.2006.403
+Jupyter Core: 1.3.60623.0
+.NET Runtime: .NETCoreApp,Version=v3.1
+
+ +

and

+ +
'iqsharp': LooseVersion ('0.11.2006.403'),
+ 'Jupyter Core': LooseVersion ('1.3.60623.0'),
+ '.NET Runtime': LooseVersion ('.NETCoreApp,Version=v3.1'),
+ 'qsharp': LooseVersion ('0.11.2006.403')
+
+ +

Also even if I don't add the Machine Learning library and just run

+ +
import qsharp
+qsharp.reload()
+
+ +

It still throws the same error

+ +

Errors:

+ +
Adding package Microsoft.Quantum.MachineLearning::0.11.2004.2825.
+---------------------------------------------------------------------------
+IQSharpError                              Traceback (most recent call last)
+<ipython-input-15-b3244a777be2> in <module>
+      1 import qsharp
+      2 qsharp.packages.add(""Microsoft.Quantum.MachineLearning::0.11.2004.2825"")
+----> 3 qsharp.reload()
+
+~\anaconda3\lib\site-packages\qsharp\__init__.py in reload()
+     70     Q# compilation errors are raised as an exception.
+     71     """"""
+---> 72     client.reload()
+     73 
+     74 def get_available_operations() -> List[str]:
+
+~\anaconda3\lib\site-packages\qsharp\clients\iqsharp.py in reload(self)
+    117 
+    118     def reload(self) -> None:
+--> 119         return self._execute(f""%workspace reload"", raise_on_stderr=True)
+    120 
+    121     def add_package(self, name : str) -> None:
+
+~\anaconda3\lib\site-packages\qsharp\clients\iqsharp.py in _execute(self, input, return_full_result, raise_on_stderr, output_hook, **kwargs)
+    207         # There should be either zero or one execute_result messages.
+    208         if errors:
+--> 209             raise IQSharpError(errors)
+    210         if results:
+    211             assert len(results) == 1
+
+IQSharpError: The Q# kernel raised the following errors:
+    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(2,10): error QS6104: No namespace with the name ""Microsoft.Quantum.Convert"" exists.
+    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(3,10): error QS6104: No namespace with the name ""Microsoft.Quantum.Intrinsic"" exists.
+    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(60,21): error QS5022: No identifier with the name ""Default"" exists.
+    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(61,16): error QS5022: No identifier with the name ""Structure"" exists.
+    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(62,16): error QS5022: No identifier with the name ""Parameters"" exists.
+    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(63,16): error QS5022: No identifier with the name ""Bias"" exists.
+    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(11,16): error QS5022: No identifier with the name ""Length"" exists.
+    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(30,23): error QS5022: No identifier with the name ""Mapped"" exists.
+    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(32,13): error QS5022: No identifier with the name ""Zip"" exists.
+    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(35,13): error QS5022: No identifier with the name ""Mapped"" exists.
+    C:/Users/Shreyas/Documents/jupyter/Quantum/MLADS2020-QuantumClassification-master/MLADS2020-QuantumClassification-master/test/Operation.qs(46,9): error QS5022: No identifier with the name ""Message"" exists.
+
+",12355,,55,,6/14/2020 7:47,6/17/2020 17:35,qsharp.reload() throws error in python,,1,5,,,,CC BY-SA 4.0 +12467,1,,,6/13/2020 22:11,,2,32,"

Question about the practical use of super dense coding in information transmission: +We know that by using super dense coding it is possible to transmit 2n classical bits transmitting n qubits, belonging to a set of 2n entangled qubits. +Problem is, it is necessary, before starting the transmission, to deliver n qubits to Alice and n qubits to Bob, entangled together. In my opinion this fact makes super dense coding of no practical interest because normally in a transmission system the sequence of information (classical) bits is of indefinite length and consequently the length n of entangled bits given to Alice (the transmitter) should be equally of indefinite length. Which is practically very difficult! +Am I correct or am I missing something? +Thanks.

+",12357,,55,,10/8/2020 17:54,10/8/2020 17:54,Question about the practical use of super dense coding in information transmission,,0,0,,6/17/2020 7:51,,CC BY-SA 4.0 +12468,2,,12466,6/13/2020 23:28,,0,,"

@ChrisGranade solved my problem:

+ +
+

It looks like your IQ# version is 0.11.2006.403, but you're trying to add version 0.11.2004.2825 of the Microsoft.Quantum.MachineLearning package. I'd suggest either downgrading IQ# to 0.11.2004.2825, or modifying the qsharp.packages.add call to use 0.11.2006.403

+
+",12355,,23,,6/17/2020 17:35,6/17/2020 17:35,,,,0,,,,CC BY-SA 4.0 +12469,1,,,6/14/2020 2:50,,3,51,"

Given two qubit states $\rho_1$ and $\rho_2$. By applying some unitary $U$ we get $\rho = U(\rho_1 \otimes \rho_2)U^\dagger$. Can $\rho$ be entangled if either of $\rho_1$ or $\rho_2$ is a maximally mixed state?

+",8290,,55,,6/14/2020 8:05,6/14/2020 9:28,Can $U(\rho_1\otimes\rho_2)U^\dagger$ be entangled if either of $\rho_1$ or $\rho_2$ is a maximally mixed state?,,1,0,,,,CC BY-SA 4.0 +12470,1,12488,,6/14/2020 3:57,,2,71,"

I just have a question about where can I find tutorials/examples about correcting gate errors (amplitude errors and phase errors) in a quantum circuit? Are there any resources I can learn from? Thanks!

+",12334,,,,,6/15/2020 4:46,Where can I find tutorials about correcting gate errors in the quantum circuit?,,1,2,,,,CC BY-SA 4.0 +12471,1,12472,,6/14/2020 5:06,,0,127,"

https://export.arxiv.org/ftp/arxiv/papers/1908/1908.07943.pdf +page 4 point 1 states that we use the bits of an integer as a basis in our space. I understand that BigEndian grabs our largest bit and creates a qubit. I am wondering if there is a function within Q# that does this for me.

+",12239,,12239,,6/15/2020 0:08,6/15/2020 0:08,How do I encode integers into BigEndian in Q#?,,1,0,,,,CC BY-SA 4.0 +12472,2,,12471,6/14/2020 5:52,,2,,"

I don't think there's a single function, but here's how you can do this with several library functions:

+ +
open Microsoft.Quantum.Arrays;
+open Microsoft.Quantum.Convert;
+open Microsoft.Quantum.Diagnostics;
+
+operation Demo () : Unit {
+    let N = 12;
+    Message($""Number: {N}"");
+    let bitsLE = IntAsBoolArray(N, 4);
+    Message($""Bits in little endian: {bitsLE}"");
+    let bitsBE = Reversed(bitsLE);
+    Message($""Bits in big endian: {bitsBE}"");
+    using (qs = Qubit[N]) {
+        ApplyPauliFromBitString(PauliX, true, bitsBE, qs);
+        DumpMachine();
+        ResetAll(qs);
+    }
+}
+
+ +
    +
  • IntAsBoolArray converts an integer to a bit string with the given number of bits (in this case [False,False,True,True]).
  • +
  • Reversed returns the bits of the array in reverse order, i.e., converts them from little endian to big endian ([True,True,False,False]).
  • +
  • ApplyPauliFromBitString applies an X gate to each of the qubits that correspond to true elements of the bitsBE array ($|1100\rangle$).
  • +
+",2879,,,,,6/14/2020 5:52,,,,6,,,,CC BY-SA 4.0 +12473,2,,12458,6/14/2020 6:34,,2,,"

In simple words:

+ +
    +
  • if a control qubit of CNOT is $|0\rangle$, $I$ is applied on target qubit. Since $H^2=I$, $HIH=I$ and nothing is done on the target qbubit
  • +
  • if the control qubit of CNOT is $|1\rangle$, an operator $HXH=Z$ is applied on the target qubit.
  • +
+ +

Hence we have controlled $Z$.

+",9006,,,,,6/14/2020 6:34,,,,0,,,,CC BY-SA 4.0 +12474,1,12479,,6/14/2020 9:16,,4,226,"

This may be a dumb question, if so please forgive me, it is late at night.

+ +

I have learned that a classical computer can simulate a quantum computer in exponential time and space, but classical computers are bound to non-quantum phenomenon.

+ +

How then, would one be able to simulate say CHSH, which produces fundamentally quantum probabilities that cannot be explained locally/classically? Am I misinterpreting the meaning of simulate?

+ +

In general, how could a classical computer simulate quantum phenomena that cannot be explained classically (such as the dynamics of more than a single particle)? I would think that one could not generate random numbers violating any of Bell's inequalities, i.e. necessarily quantum correlations are off limits.

+",7655,,55,,6/14/2020 12:50,6/14/2020 12:50,How does a classical computer simulate nonclassical correlations?,,2,1,,,,CC BY-SA 4.0 +12475,2,,12469,6/14/2020 9:21,,2,,"

The question is equivalent to the following: can a balanced mixture of (not all separable) states be entangled?

+ +

To see the equivalence, observe that if $\rho_2=I/d$ ($d$ is here the dimension of the space) then +$$\rho=\frac1 d\sum_{k=1}^d U(\rho_1\otimes|k\rangle\langle k|)U^\dagger,$$ +and if we don't put further restrictions on $U$ and $\rho_1$, then the only thing we know about $U(\rho_1\otimes |k\rangle\langle k|)U^\dagger$ is that they are orthogonal states (and if we are to hope the mixture is entangled, the states cannot be all separable).

+ +

This is not the case. As a counterexample in the two-qubit scenario, consider +$$ +\sqrt2|\Phi_+\rangle \equiv |00\rangle + |11\rangle, +\qquad +\sqrt3|\Psi\rangle \equiv |00\rangle + |10\rangle - |11\rangle. +$$ +You can then verify that $(|\Phi_+\rangle\!\langle\Phi_+|+|\Psi\rangle\!\langle\Psi|)/2$ is still entangled (using e.g. the PPT criterion).

+ +

Translated into the notation of the question, this example would correspond to $\rho_1=|0\rangle\langle 0|$ (or any other pure state), and $U$ such that $U|0,0\rangle=|\Phi_+\rangle$ and $U|0,1\rangle=|\Psi\rangle$.

+ +

This paper might be of interest to figure out when mixing pure maximally entangled states can result in an entangled state: (Flores and Galapon 2016).

+",55,,55,,6/14/2020 9:28,6/14/2020 9:28,,,,0,,,,CC BY-SA 4.0 +12477,1,,,6/14/2020 12:26,,2,45,"

Let $n$ be the number of qubits we're using, and let $$\mathrm H=\sum_{i=1}^T\alpha_i\mathrm U_i|0\rangle\langle0|\mathrm U_i^\dagger$$ be an $n$-qubit hermitian observable where $T=O(\mathrm{poly}(n))$, $\alpha_i\in\mathbb R\!\setminus\!\{0\}$ and $\mathrm U_i$ a unitary that can be implemented as a circuit of size $O(\mathrm{poly}(n))$.

+ +

For my purposes, I would like to express $\mathrm H$ as an observable consisting of only a single term, without any ancillary qubits; thus, the most general desired form is $\mathrm H=\mathrm W\mathrm D\mathrm W^\dagger$ with $\mathrm W$ an $n$-qubit unitary and $\mathrm D$ a $2^n\times2^n$ real diagonal matrix.

+ +

Question: is there a construction of $\mathrm W$ and $\mathrm D$ that can be computed in time $O(\mathrm{poly}(n))$, possibly exploiting that $\mathrm H$ is of low rank (namely polynomial in $n$)? Clearly, $\mathrm W$ and $\mathrm D$ can be brute forced by diagonalising $\mathrm H$, but from what I have found even the fastest diagonalisation algorithms still run in time proportional to the dimensionality of $\mathrm H$, which is exponential.

+ +

Of course, if you know of any papers related to this question, sharing would be highly appreciated. Thanks!

+",2687,,,,,6/15/2020 7:19,Efficient diagonalisation of low-rank observables,,1,0,,,,CC BY-SA 4.0 +12478,2,,12474,6/14/2020 12:32,,2,,"

There are two definitions of simulation that are commonly used in this context.

+ +

We consider a quantum computation to be: +1. loading an input +2. performing some processing +3. doing a measurement

+ +

This defines a distribution on possible measurement outcomes for each input.

+ +

Weak Simulation would be a classical randomised algorithm that could sample from these distributions, given a suitable description of the quantum computation as defined above.

+ +

Strong Simulation is the ability to approximately calculate individual probabilities.

+ +

A naive simulation algorithm that uses exponential time and space is to store the state as a big vector (of length $2^n$) and then multiply it by the matrices for each of the gates (size $2^n \times 2^n$). Then measurement probabilities can also be calculated by finding the eigenspaces for the measurement operator, and projecting the final state vector onto the one of interest.

+ +

This doesn't violate any laws of quantum physics, because it is simulating the whole system, not simulating each qubit locally

+",9626,,,,,6/14/2020 12:32,,,,0,,,,CC BY-SA 4.0 +12479,2,,12474,6/14/2020 12:46,,2,,"
+

How then, would one be able to simulate say CHSH, which produces fundamentally quantum probabilities that cannot be explained locally/classically? Am I misinterpreting the meaning of simulate?

+
+ +

Quantum phenomena cannot be ""explained classically"" only when locality is taken into consideration. +In other words, classical phenomena cannot reproduce (some types of) quantum correlations provided that we don't allow for certain types of correlations.

+ +

As a concrete example, consider a standard CHSH scenario. We can compute the outcome probability distributions for each measurement setting (it's what you do when you study the protocol), therefore you can trivially write some code to ""simulate"" the results of an experiment, meaning to draw a possible sequence of measurement outcomes you would find in an experiment. But this is clearly not the same as observing nonlocality with a classical computer: you would just be crunching some numbers that you know, in some situations, can be interpreted as markers of nonclassical correlations.

+ +

Put in another way, you can always sample from an arbitrary probability distribution $p(ab|xy)$. Whether such a distribution is ""nonclassical"" is only meaningful in relation to some imposed restriction (e.g. defining ""classical"" when it can be written as $p(ab|xy)=\sum_\lambda p_\lambda p_\lambda(a|x) p_\lambda(b|y)$). When you simulate such a distribution on a computer, you don't need to respect such restrictions, so there is no problem.

+ +
+

In general, how could a classical computer simulate quantum phenomena that cannot be explained classically

+
+ +

Aside from locality constraints, such as those described above, quantum mechanics does not predict output probability distributions that are incompatible with classical physics. The difference is in how those outputs can be obtained: quantum mechanic can produce output probability distributions in a radically different way than what classical physics allows for, and in some cases these new behaviours are more efficient.

+",55,,,,,6/14/2020 12:46,,,,0,,,,CC BY-SA 4.0 +12480,2,,12376,6/14/2020 14:02,,5,,"

The shift operator takes his name from the fact that it shifts the position of its input, as in, it sends $1\to2$, $2\to3$ etc, with the last computational basis element being sent back to the first one: $d\to 1$ (or the same thing starting with $0$, depending on notation).

+ +

As per the ""boost"" operator $Z$, I have usually seen those referred to as ""clock matrices"", as in the Wikipedia page. Such name comes from the fact that they are diagonal matrices, whose diagonal elements are phases of the form $\omega_d^k$ where $\omega_d\equiv e^{2\pi i/d}$. Represented in the complex plane, this are $d$ unit vectors pointing in equidistant directions, thus somewhat resembling hands on a clock.

+ +

Both definitions give the usual Pauli matrices for $d=2$.

+ +

As per their usefulness, it depends on the context. One thing that comes to mind is that they are used to find the ""easy"" examples of mutually unbiased bases, see e.g. here and here.

+",55,,,,,6/14/2020 14:02,,,,0,,,,CC BY-SA 4.0 +12481,1,,,6/14/2020 15:24,,5,191,"

Suppose that we have a quantum state of the form:
+$$|\psi\rangle = \sqrt{p}|0\rangle + \sqrt{1-p}|1\rangle$$
+In order to get an estimate of the probability of reading $|0\rangle$ or $|1\rangle$, we need to sample $|\psi\rangle$. How many times do we need to sample to have an $\epsilon$-estimate ? Keep in mind that this is different from quantum tomography because i we don't want to reconstruct the state from measurements, i just want to find an approximation of the probability of reading some state. In Supervised Learning with Quantum Computers, Schuld,M, et.al, the authors say that sampling from a qubit is equivalent to sampling from a bernoulli distribution,thus we can use the Wald interval:
+$$\epsilon = z\sqrt{{\bar{p}(1-\bar{p})}\over S}$$ where $z$ is the confidence level, $\bar{p}$ is the average and $S$ the number of samples.
+In the case of $p$ being close to either 0 or 1, we can use Wilson Score interval:
+$$ +\epsilon = {z \over {1 + {z^2\over S}}}\sqrt{{{\bar{p}(1-\bar{p})}\over S} + {z^2 \over 4S^2}} +$$ +Now, the i ask the following question: What if i have a state with multiple qubits? How do i get an $\epsilon$-estimate of the probability of reading some state? If you can suggest some references, i would appreciateit. Thank you very much.

+",10315,,55,,6/25/2020 16:16,6/25/2020 16:17,How many samples are required to estimate the probabilities of a state?,,1,0,,,,CC BY-SA 4.0 +12482,1,,,6/14/2020 16:53,,0,73,"

+ +

installing Q# version g --version 0.1.2.3 in jupyter. but this command line dotnet iqsharp install responds system cannot find path specified . what should i do . +i have also installed vscode 2019 is it the cause. +i need help please

+",11600,,10473,,6/16/2020 10:34,6/16/2020 10:34,"dotnet iqsharp install gives error ""FileNotFoundError: The system cannot find the path specified""",,1,1,,,,CC BY-SA 4.0 +12483,1,14255,,6/14/2020 16:58,,7,163,"

I'm reading the proof of ""nonlocality without inequality"" presented in (Hardy 1992). +In this protocol, we consider two particles (say, an electron and a positron) evolving almost independently: they both pass through one of two beamsplitters independently from the other's path, but can cross paths. If that happens, they annihilate each other with unit probability, and therefore are not measured at the end. +Here is the setup as given in the paper:

+ +

+ +

Here, $C^\pm$ and $D^\pm$ are the possible output events, and $P$ is the point at which $e_+$ and $e_-$ interact if they both pass through it. Note how, if there was no point of interaction $P$, the two particles would evolve independently, and the beamsplitters cancel each other out.

+ +

We focus on the output events in four scenarios: 1) when all BSs are as in the above figure, 2) when BS2$^+$ is removed, 3) when BS2$^-$ is removed, 4) when both BS2$^+$ and BS2$^-$ are removed.

+ +

Using the convention for beamsplitter evolutions in which a phase $i$ is introduced upon reflection, $a_1\to a_1 + i a_2$ and $a_2 \to ia_1 + a_2$, we can compute the output states in the four cases, and find the following

+ +

\begin{align} + &\,\,\,\,\,\text{both BS}\,: &&-3|cc\rangle + \,\,\,i |cd\rangle + \,\,\,i |dc\rangle - |dd\rangle, \\ + &\text{only BS2$^+$}: &&\phantom3-|cc\rangle + 2i |cd\rangle + \,\,\,i|dc\rangle, \\ + &\text{only BS2$^-$}: &&\phantom3-|cc\rangle + \,\,\,i| cd\rangle + 2i |dc\rangle, \\ + &\,\,\,\,\,\text{no BS2$^\pm$}: &&\phantom1 \qquad\qquad\,\,\, i| cd\rangle + \,\,\,i |dc\rangle + |dd\rangle. +\end{align}

+ +

We now consider what happens when the output $|dd\rangle$ is observed when both BSs are used. This happens with probability $1/16$. Then, the author remarks that

+ +
    +
  1. From the only BS2$^+$ case, we conclude that observing $d_+$ (i.e. $d$ for the first particle) implies that we should observe $c_-$ when no BS2$^-$ is used.
  2. +
  3. From the only BS2$^-$ case, we conclude that observing $d_-$ (i.e. $d$ for the second particle) implies that we should observe $c_+$ when no BS2$^+$ is used.
  4. +
  5. The above two observations tell us that, when neither BS2$^+$ nor BS2$^-$ are used, we should observe the output $|cc\rangle$. But this is incompatible with the output state we know we have in this instance, which assigns zero probability to such event.
  6. +
+ +

We then conclude that observing $|dd\rangle$ contradicts local realistic explanations.

+ +

The latter conclusion is what I'm trying to understand. I follow all the calculations, but fail to see clearly the connection with the local realistic hypothesis. +Why can we mix the output states in the four different scenarios (yes/no BS$^+$/BS$^-$) like this? Why does it matter what we would observe when one of the two BSs is removed, when both of them are present in the considered experimental run?

+",55,,,,,10/19/2020 16:28,"Understanding Hardy's proof of ""nonlocality without inequalities""",,1,0,,,,CC BY-SA 4.0 +12484,1,12490,,6/14/2020 19:08,,4,446,"

Can we say, in general, that the qubits of a system of n-qubits are entangled if at least one basis vector is missing from the probability distribution? +For example, in a system of 3-qubits, after a certain circuitry, I measure all the qubits. I found that

+ +
c1% probability of |000>, 
+c2% of |001>,
+c3% of |010>,
+c4% of |101>,
+c5% of |111>
+
+ +

so that c1+c2+c3+c4+c5 = 100.

+ +

Can I then say that the system of 3-qubits is an entangled one?

+",9201,,55,,6/17/2020 6:52,6/17/2020 6:52,Can we say that an $n$-qubit system is entangled if at least one basis vector is missing?,,3,0,,,,CC BY-SA 4.0 +12485,2,,12484,6/14/2020 19:48,,8,,"

In general this is not correct. Consider two systems: one in state $\frac{1}{\sqrt2}(|00\rangle + |01\rangle)$ and another in state $\frac{1}{\sqrt2}(|00\rangle + |11\rangle)$. Both of them have exactly two basis vectors missing from the measurement results, but the first one can be represented as $|0\rangle\otimes\frac{1}{\sqrt2}(|0\rangle + |1\rangle)$ and thus is not entangled, while the second one cannot be represented as a tensor product of 1-qubit states and is entangled.

+",2879,,,,,6/14/2020 19:48,,,,2,,,,CC BY-SA 4.0 +12486,2,,12482,6/14/2020 21:59,,1,,"

If you installed IQ# with --version 0.1.2.3, then this would have installed a very old version on your machine, which had this bug that is probably affecting you here. You can run dotnet iqsharp --version to see which version you have installed. (Check here for the latest released version numbers.)

+ +

If so, you should install the latest version of IQ# by running dotnet tool update -g Microsoft.Quantum.IQSharp, followed by dotnet iqsharp install. That should fix your problem.

+",10473,,,,,6/14/2020 21:59,,,,1,,,,CC BY-SA 4.0 +12488,2,,12470,6/15/2020 4:46,,1,,"

For quantum circuits:

+ +

So the main answer is that far-term quantum computers will implement Quantum Error Correction, where each logical qubit is composed out of a number of physical qubits and the information is stored in a complex entangled state. Errors on these physical qubits can be caught and corrected, and these error correction steps will occur between each logical gate.

+ +

In terms of NISQ/smaller algorithms, it depends on the type of error your system has. This is a paper our group wrote on correcting overrotation type errors in QEC circuits. There is also other work on other types of errors. In general Flag qubit schemes can catch errors, although they generally don't give enough information to correct the error fully.

+ +

For quantum control: +This really depends on the architecture you're considering, but most gates have their physical implementations set up to be robust to some types of noise in order to improve fidelity. For example SK1 and BB1 are two composite pulse techniques that allow gates to be less noisy by making them robust to overrotation errors.

+",3056,,,,,6/15/2020 4:46,,,,0,,,,CC BY-SA 4.0 +12489,2,,12484,6/15/2020 6:45,,3,,"

Recall that for a tripartite quantum state $| \psi_{ABC} \rangle$, one needs to specify the partition along which we're studying entanglement. For example, consider the $W$-state $| \mathrm{W} \rangle = \frac{1}{\sqrt{3}} \left( | 100 \rangle + | 010 \rangle + | 001 \rangle \right)$, which is entangled across all partitions. However, a state of the form, $\frac{1}{\sqrt{2}}\left( | 00 \rangle + | 11 \rangle \right) \otimes | \alpha \rangle$, where $| \alpha \rangle$ is any single-qubit state, is entangled across the $A:BC$ partition but is not entangled on the $AB:C$ partition.

+ +

Note that, in general, unless you specify the partitions (for a $n$-qubit system with $n>2$) and the coefficients (in your case the set $\{ c_{1}, \cdots, c_{5} \}$), one cannot say if the state is entangled or not. Moreover, the question becomes even more complex if the state in consideration is a mixed state and not a pure state. Here's a (classic) review paper on entanglement: An introduction to entanglement measures by Plenio and Virmani. If this is a bit advanced for you then I'd recommend studying the standard textbook: Nielsen and Chuang.

+ +

Also, if you're looking for numerical tools to check if a given state with some coefficients is entangled or not, consider using tools like QETLAB (or others, an exhaustive list can be found on Quantiki). For example, here is a numerical function to check if a given pure state is entangled or not. But I'd highly recommend learning some more foundational ideas before using the numerical tool.

+",1108,,,,,6/15/2020 6:45,,,,0,,,,CC BY-SA 4.0 +12490,2,,12484,6/15/2020 7:04,,5,,"

There's two sides to this. First, the question you actually ask: No. Consider the state +$$ +|00\rangle +$$ +This is clearly not entangled, but misses many basis states. Of course, for the specific example you give, once you know what the values of the ci coefficients are, you might be able to say something about the entanglement. (You might need to know more, such as the amplitudes rather than just the probabilities).

+ +

On the other side (I know you didn't ask), but there are entangled states which contain all basis states. For example, +$$ +\frac12(|00\rangle+|01\rangle+|10\rangle-|11\rangle). +$$You can see that this is entangled by writing it as +$$ +\frac{1}{\sqrt{2}}(|0+\rangle+|1-\rangle), +$$ +which is just one of the standard Bell states + a Hadamard rotation on one qubit (which therefore cannot affect the entanglement).

+",1837,,,,,6/15/2020 7:04,,,,0,,,,CC BY-SA 4.0 +12491,2,,12477,6/15/2020 7:19,,1,,"

There are a few things you can say quite easily. Let +$$ +|\psi_i\rangle=U_i|0\rangle. +$$ +Now, let $|\phi\rangle$ be a state that is orthogonal to all of these states. Then +$$ +H|\phi\rangle=0. +$$ +This is most of your job done given that the Hilbert space is of dimension $2^n$, and your space spanned by the $|\psi_i\rangle$ is no more than size poly($n$).

+ +

So, now, I'd probably construct a matrix +$$ +H'=\sum_{i,j}|i\rangle\langle j| \langle\psi_i|H|\psi_j\rangle, +$$ +which only has polynomial size. I don't know how easily you can construct this - it might depend on exactly what you're assuming you know but, frankly, if you cannot compute these values, there's not a whole lot you will be able to do classically! If you can diagonalise $H'$ (which should be fine), you can diagonalise $H$.

+",1837,,,,,6/15/2020 7:19,,,,0,,,,CC BY-SA 4.0 +12493,1,12495,,6/15/2020 10:09,,2,94,"

In the theory of universal quantum gates,I have known a common universal gate set is the Clifford + T gate set, which is composed of the CNOT, H, S and T gates. Then there is a concept called ""accuracy"", which means use the composition of this set of gates can achieve any accuracy of the gate we want to approximately simulate.

+ +

However, in real quantum computer hardware, for example, ion-trapped quantum computers, the two parameterized gates in this paper can be regareded as universal quantum gates to realize any quantum gates (https://arxiv.org/pdf/1603.07678.pdf), and the concept of ""accuracy"" is also no longer mentioned.

+ +

It mentioned a concept of ""fidelity"" instead. So does that means, the process of simulation will be 100% right if we don't take the influence of hardware realization into account? If so, why do we still need to learn so much about ""universal quantum gates""?

+",11765,,55,,6/15/2020 12:23,6/15/2020 17:04,A question about a real programmable quantum computer,,2,0,,,,CC BY-SA 4.0 +12494,1,,,6/15/2020 14:17,,1,111,"

I have been trying to follow the Quantum machine learning kata by using vscode and jupyter notebook, I was using the wrong version of iqsharp so changed it in the code like so:

+ +

+ +

As can be seen the attempt to import the machine learning package returns an error and also attempting to use it does not work. +I then went back to try and use the code on vscode but now even attempting to import qsharp is giving this error (it worked before attempting to change the jupyter code): +

+ +

I have tried uninstalling and reinstalling iqsharp and the QDK, but that doesn't work. Does anyone know what I might have done to break it and how to fix it?

+",12373,,,,,6/15/2020 14:17,Attempting to use the QuantumMachineLearning Repositry with vscode and now import qsharp is reporting 'Fail',,0,3,,,,CC BY-SA 4.0 +12495,2,,12493,6/15/2020 15:07,,1,,"

The author in that paper allows himself arbitrary angle single and two qubit gates. With this set it is generally pretty easy to exactly match a given unitary, since the two qubit gates can give you the backbone of the correct entanglement structure, and the single qubit gates can conjugate the gate into the exactly correct basis.

+ +

The reason that accuracy is a concern for the CNOT/H/T gate set is that it is a discrete set, so for a rotation of some irrational angle (in multiples of $\pi$), I believe you would generically need infinite gates to exactly match it. The reason this gate set is still considered is that due to the Eastin-Knill theorem, Quantum Error Correcting Codes can only allow a discrete logical gate set, so in Fault-Tolerant Quantum Computers, a discrete set might be the best that we can do.

+",3056,,,,,6/15/2020 15:07,,,,0,,,,CC BY-SA 4.0 +12496,1,12502,,6/15/2020 15:51,,6,902,"

I am currently creating a blackbox for a grover search algorithm to solve the graph colouring problem with qiskit. One of my search criteria is that one node can only have one color. Therefore, with my current problem having 4 colours and 8 nodes, I need to design something like an XOR gate with 4 control qubits. So that the target qubit flips, only if one of the control qubits is |1>.
+What would be an efficient way to design such a gate (best case for n control qubits)?

+",12143,,5955,,6/15/2020 15:59,11/21/2020 16:19,XOR gate for n control qubits in qiskit,,3,0,,,,CC BY-SA 4.0 +12497,2,,12493,6/15/2020 17:04,,1,,"

Considering a fixed set of universal gates has several advantages. As a broad principle, standardization has proven extremely useful in computer science. Choosing a fixed set of primitive operations - even if they aren't always the best ones for every possible specific application - allows everyone to be on the same page, which makes it easier to focus on optimizing the physical realizations of those particular operations. Knowing that you only need to engineer a finite number of quantum gates in order to approximate an arbitrary unitary gives a much more achievable target than needing to be able to generate an infinite number of different primitive unitaries. Also, it makes it easier to compare performance across different algorithms, etc. if everyone's working from the same toolkit.

+ +

It's too earlier to tell whether actual useful implementations of quantum computers will only use a finite set of primitive unitaries, or whether they'll be able to engineer arbitrary unitaries out of a continuous set. But either way, it's useful to think about the possibilities enabled within both paradigms.

+",551,,,,,6/15/2020 17:04,,,,0,,,,CC BY-SA 4.0 +12498,2,,12496,6/15/2020 18:13,,8,,"

You can create gates that are controlled on 0 or on 1. You could therefore implement this condition as several gates in a row, each controlled by 1 in the index of the qubit and 0 elsewhere. This will only flip the target qubit if exactly one of the other qubits it 1.

+ +

You should be able to do this using C4XGate. This would look something like

+ +
from qiskit.circuit.library.standard_gates import C4XGate
+qr = QuantumRegister(5)
+qc = QuantumCircuit(qr)
+
+gate = C4XGate(qr, ctrl_state='1000')
+qc.append(gate, qr)
+gate = C4XGate(qr, ctrl_state='0100')
+qc.append(gate, qr)
+gate = C4XGate(qr, ctrl_state='0010')
+qc.append(gate, qr)
+gate = C4XGate(qr, ctrl_state='0001')
+qc.append(gate, qr)
+
+",5955,,,,,6/15/2020 18:13,,,,0,,,,CC BY-SA 4.0 +12499,1,12508,,6/15/2020 19:01,,2,249,"

Start with Shor's codeword for $|0 \rangle$:

+ +

$|\psi\rangle = \frac{1}{\sqrt{8}}(|000\rangle + |111\rangle)\otimes(|000\rangle + |111\rangle)\otimes(|000\rangle + |111\rangle)$.

+ +

Now, assume that instead of an $X$ flip or a $Z$ flip, the first qubit is measured. +Can Shor's error correction algorithm correct for this error and recover the original $|0\rangle$? Show the calculations to justify your answer.

+ +

My guess is that it can succesfully correct, because of the Deferred Measurement Principle.

+ +

My attempt at a solution: +Let's say that the result of the measurement of the first qubit is $|0\rangle$. Thus the entire state collapses to:

+ +

$|\psi_0\rangle = \frac{1}{\sqrt{4}}(|000\rangle)\otimes(|000\rangle + |111\rangle)\otimes(|000\rangle + |111\rangle)$.

+ +

In step 1 we detect and correct for $X$ errors. Since there is no bit flip, this step doesn't change the state.

+ +

In step 2 we look for $Z$ errors. My question is, how to calculate a phase-flip check on $|\psi_0\rangle$, and how do I interpret the result to correct the error? Same question for the state after measuring $|1\rangle$.

+ +

Thanks!

+",11927,,8141,,6/16/2020 7:19,6/17/2020 7:47,Can Shor's 9 Qubit Code Correct for a measurement on the first qubit?,,1,0,,,,CC BY-SA 4.0 +12500,1,12503,,6/15/2020 20:34,,2,124,"
+

A parity function $f_s:\{0,1\}^{n}\rightarrow\{0,1\}$, for some $s\in \{0,1\}^n$, is a function of the form $f_s(x) = x \cdot s$, where the inner product is taken modulo 2.

+

Show that $f_s$ is a balanced function for all $s$

+

We have $f_s(x) =\sum_i x_is_i \mod 2$. If $s \neq 0^n$, then there exist $i$ such that $s_i \neq 0$. So, for all $x$, $f_s(x) \neq f_s(x^i)$, where $x^i$ the string obtained from by inverting bit $i$. Hence $f_s$ is balanced.

+
+

I really don't understand the second from last sentence. Why this does this imply the function is balanced?

+",4336,,-1,,6/18/2020 8:31,6/17/2020 6:53,Why is the function $f_s(x)=\sum_i x_i s_i \pmod 2$ balanced?,,1,0,,,,CC BY-SA 4.0 +12501,2,,12496,6/15/2020 21:11,,2,,"

If we are allowed to use ancillary qubits, then this will work (here is an answer about multi-control qubit gates and answer that can show why there are $X$ gates in the following circuit):

+ +

The $q[0 - 3]$ qubits are controlled qubits, the $q[4]$ qubit is the target qubit, $q[5 - 6]$ are ancillary qubits. One small optimization can be done by erasing $15$th and $16$th $CCNOT$ gates (nearby two $X$s commute with them). This solution can be extended for $n$ qubits (with more ancillary qubits).

+

This answer to the related question might be interesting.

+",9459,,9459,,11/21/2020 16:19,11/21/2020 16:19,,,,0,,,,CC BY-SA 4.0 +12502,2,,12496,6/15/2020 22:22,,8,,"

For the general case, you can use a counting strategy like this:

+ +

+ +

This has a gate count of $O(n \lg n)$ and a work qubit count of $O(\lg n)$. Much better than the naive $O(n^2)$ gate count.

+ +

You can improve the gate count to $O(n)$ if you're willing to use more ancilla qubits, by using a recursive strategy where you classify the first half and second half of the input as ""none, one, more"" and then merge. This will increase the ancilla qubit count from $O(\lg n)$ to $O(n)$. Though that count can probably be reduced by playing pebble games with the intermediate values.

+ +

Note that for specific $n$ you can often find improvements that pretty substantially reduce the gate count over the generic strategies. For example, for the four control case you can do much better: four Toffolis, one ancilla, and six CNOTs is sufficient.

+ +

+ +

(verification in Quirk via state channel duality)

+ +

Start from the obvious solution:

+ +

+ +

Conjugate adjacent ""controls differ in two places"" pairs with CNOTs to reduce the big operation count in half:

+ +

+ +

Move CNOTs to the sides and decompose the triple-controlled NOTs into Toffolis, being sure to use the controls common to both big operations as the controls for the temporary accumulator:

+ +

+ +

There are once again two adjacent operations that differ in controls at two places. They can be downgraded into CNOTs, producing the solution at the top.

+",119,,119,,6/16/2020 1:07,6/16/2020 1:07,,,,0,,,,CC BY-SA 4.0 +12503,2,,12500,6/15/2020 22:37,,4,,"

Let's say that the first bit of $s$ $s_0=1$ (the argument will be exactly the same for any bit, just for convenience).

+ +

You can split the space of inputs $x \in \{0,1\}^n$ in two halves: one half where $x_0 = 0$ and the other half where $x_0 = 1$. For each bitstring $x$ from the first half you'll have a bitstring $\tilde{x}$ from the second half which will be equal to $x$ in all bits except the first one, and will differ from $x$ in the first bit.

+ +

Now consider $f_s(x)$ and $f_s(\tilde{x})$; you'll have $f_s(x) = x_0s_0 + F$ and $f_s(\tilde{x}) = \tilde{x}_0s_0 + F$ ($F$ is the sum of all terms except the first one). You know that $x_0 = 0$ and $\tilde{x}_0 = 1$, so you'll have $F = f_s(x)$ and $f_s(\tilde{x}) = 1 + F$, so you're guaranteed that $f_s(x) \neq f_s(\tilde{x})$.

+ +

This way you can split all possible $x$ in $2^{n-1}$ pairs, and each of the pairs will have different values of $f_s$ - which means that exactly $2^{n-1}$ values are 0 and $2^{n-1}$ are 1, and the function is balanced.

+",2879,,,,,6/15/2020 22:37,,,,1,,,,CC BY-SA 4.0 +12504,1,,,6/16/2020 1:26,,4,434,"

And if a specific country or nation-state gets a breakthrough and keeps quiet about it, can they go about quietly decrypting everything online with us none the wiser and expecting/thinking we're safe?

+ +

EDIT: +A previous question with link was presented. I've read it but it doesn't address a couple things:

+ +
    +
  • the top answer states ""...just elect to do a hard fork to post-quantum cryptography."" Will PQC be easily available to crypto creators/admins and is it really that trivial and easy to do? Is it as simple as switching certs or will software have to be rewritten?
  • +
  • can someone (person, entity, organization) get a breakthrough and keeps quiet about it and be quietly decrypting everything online (crypto, ecommerce, private comms) without anyone noticing?
  • +
+ +

EDIT 2: +What TinaS said about a nation or company intercepting and storing current communications and decrypting it later when the technology is available worries me. Crypto wallet keys and mnenomic seeds are immutable and will be the same years from now when the QC breakthrough happens. Credit card numbers, expiration dates and security codes are good for the life of the card which is usually 4 years. Bank account info, private conversations (phone, videochat, etc), sensitive info (members list, contacts, etc) and private documents (archives, photos, signatures) are also long-term.

+ +

The solution cannot be reactive, it can't be ""post-quantum"". It can't simply be ""electing to do a hard fork"" or installing new certs. It certainly won't be flipping a switch. It will be too late then.

+ +

Once it is revealed, both the direct and collateral damage will result in carnage along with the scramble to rewrite a ton of software. I'm skeptical of this redesign & rewrite of software - what I consider the ""adapt & survive"" phase. As Michele Amoretti says, there will be a collapse in the markets and unpredictable consequences. Just think of all the things that hackers can do with the strong encryption and layers of security that we have now. The consequences of bad actors getting a hold of the info I listed above would be anyone's guess but it would be likely that some businesses, organizations and entities will cease to exist. What happens if we can't transact in cryptocurrencies or do ecommerce for 12-18 months? What happens to people who depend on TOR or Signal to get things done?

+ +

EDIT 3: +Can current non-QC software be modified or rewritten (moving away from RSA based encryption) to prevent decryption by quantum computing or will everyone implementing cryptocurrencies, ecommerce, and private communications have to upgrade to QC software AND hardware to be able to implement encryption that can hold up to decryption attempts by quantum computing?

+ +

Let's say a person or lab working on QC achieves a breakthrough and publishes it in a scientific journal for everyone to see, what exactly are the steps we take to secure our current encrypted systems? If the answer to my question above is the latter, maybe would things play out this way: +1. chip makers start working on a QC chip or chipset +2. when #1 is achieved, OS vendors would start rewriting code for an operating system for that chip +3. when #2 is achieved, vendors for software development platform (Java, .NET, etc) would start rewriting their code +4. when #3 is achieved, vendors for software for cryptocurrencies, ecommerce, and private comms would start (re)writing code

+",12378,,12378,,6/18/2020 6:59,6/18/2020 23:20,"Will quantum computing kill cryptocurrencies, ecommerce and private communications (Signal, TOR, etc)?",,2,3,,,,CC BY-SA 4.0 +12505,2,,12504,6/16/2020 3:59,,1,,"

I think that if someone (Government / big company) would learn how to break currently used cryptographic algorithms, this could be unnoticed for a while but not for a long time. At that point, panic would cause a major collapse of the markets. This would have unpredictable consequences even for the Government / big company that initiated it.

+ +

On the other hand, it is likely that PQC will be widely available before that could happen. For examples, look at this page.

+",5551,,5551,,6/16/2020 6:01,6/16/2020 6:01,,,,1,,,,CC BY-SA 4.0 +12506,2,,12504,6/16/2020 4:31,,4,,"

Quantum computing will not kill private communication, cryptocurrency or ecommerce but will cause fundamental changes in how these are implemented. For instance, RSA encryption standards will no longer be effective since factoring is a problem that can easily be solved with a powerful quantum computer. This will lead to the need for post-quantum cryptography (or quantum resistant encryption based on newly identified standards like QKD). +Also, a nation or big company could not only keep quiet about their developments, but also possibly intercept and store all communications as of now, and encrypt it later when the technology is available.

+",12379,,,,,6/16/2020 4:31,,,,1,,,,CC BY-SA 4.0 +12507,1,,,6/16/2020 5:52,,8,733,"

It can be shown that any classical function $f$ can be implemented by a quantum circuit $Q_f$, so that +$$ +\sum_{x}|x,0^k\rangle \xrightarrow{\mathit{Q_f}} \sum_{x}|x,f(x)\rangle +$$ +where $f$ has $k$ output bits, and ingnoring normalization. I have seen such circuits called quantum oracles and treated +as black boxes in quantum algorithms. If I want to write a +quantum computer program that includes the circuit $Q_f$, it is convenient to write a classical program for $f$ +in a high level language (like C or Java or python) and have it compiled to a quantum circuit. +

+My question is: is there an implementation of a compiler (preferably open source) that will compile my classical high-level program for $f$ +into some representation of the quantum circuit $Q_f$ (e.g. using OpenQASM)? If not, is there a compiler that will +compile into reversible gates? +

+Thanks!
+kgi

+",12380,,8141,,6/16/2020 6:55,6/26/2020 23:35,Compiling a classical function to a quantum circuit in practice,,3,2,,,,CC BY-SA 4.0 +12508,2,,12499,6/16/2020 7:17,,3,,"

You can think of this measurement as an 'error' on the (encoded) state that needs to be corrected. Quantum error correction is all about subspaces of the Hilbert space, and during QECC we are always trying achieve information in what subspace our state lies.

+ +

The state lies in some subspace, which is either the codespace or some orthogonal space. With every space we identify an error (with the codespace it is the trivial 'error' - $I$). There are many other errors that map to a specific codespace, but we cannot always* correct for these errors.

+ +

For the $9$-bit Shor code, the subspaces are those associated with all the single-qubit bit flips $X_{i}$, and furthermore with all the single qubit phase flips $Z_{i}$. There is some degeneracy in the code where there are cases that sometimes you can correct mulitple (correlated!) $Z$-flips, but we'll disregard that in our discussion.

+ +

Now we are ready to investigate our measurement: after measureing, the state $|\psi_{0}\rangle$ does not lie in any of the subspaces associated with the $9$-bit Shor code, but it is rather a specific superposition:

+ +

\begin{equation} +\begin{split} +|\psi_{0}\rangle = &\frac{1}{2}|000\rangle \otimes \big(|000\rangle+|111\rangle\big) \otimes \big(|000\rangle+|111\rangle\big) \\ += &\frac{1}{4}\big(|000\rangle+|111\rangle\big) \otimes \big(|000\rangle+|111\rangle\big) \otimes \big(|000\rangle+|111\rangle\big) \\ ++& \frac{1}{4}\big(|000\rangle-|111\rangle\big) \otimes \big(|000\rangle|111\rangle\big) \otimes \big(|000\rangle+|111\rangle\big) \\ += & \frac{1}{\sqrt{2}}\big(|\psi\rangle + Z_{1}|\psi\rangle\big) = \frac{1}{\sqrt{2}}\big(|\psi\rangle + Z_{2}|\psi\rangle\big) = \frac{1}{\sqrt{2}}\big(|\psi\rangle + Z_{3}|\psi\rangle\big), +\end{split} +\end{equation}

+ +

We thus see that the state $|\psi_{0}\rangle$ is a superposition of no + error having happened, and of a phase flip on either the first, second or third having happened.

+ +

Measuring out stabilizers will not only collapse this superposition to either of the two (so either no error or a phase flip), the measurement outcome (the error syndrome) will also indicate what subspace we have projected to. The correction is then straightforward.

+ +

If the measurement on qubit $1$ resulted in the state $|1\rangle$, we obtain a different 'superposition of subpsaces'. It is not that different though (the $+$ in the beginning of the third line changes to a $-$), and the code doesn't really 'care': it projects all the same, to the same kind of subspaces. The correction process is therefore (in this particular case) exactly the same.

+ +

*I say not always, because it depends if the error acts the same as the correctable error on the codespace or not - if it acts the same (then it only differs from the correctable error by a stabilizer) then it is correctable.

+",8141,,8141,,6/17/2020 7:47,6/17/2020 7:47,,,,0,,,,CC BY-SA 4.0 +12509,1,12510,,6/16/2020 8:11,,0,43,"

https://qiskit.org/textbook/ch-algorithms/grover.html +I am looking for a visual, or just probabilities like the ones given in the link.Is this possible on Q#?

+",12239,,55,,6/17/2020 6:54,6/17/2020 6:54,Is there a way to grab probablities of my qubits in Q#?,,1,0,,,,CC BY-SA 4.0 +12510,2,,12509,6/16/2020 8:23,,1,,"

You can use DumpMachine to dump the amplitudes and probabilities of the states; for Grover search it will give you something like this:

+ +

+",2879,,,,,6/16/2020 8:23,,,,1,,,,CC BY-SA 4.0 +12511,2,,12354,6/16/2020 9:53,,1,,"

I'm going to change the notation slightly to make it a bit easier for me: I'll assume it's an arbitrary group of order $N$.

+ +

There is a minor mistake in your first equation, which is that the QFT will have different moduli for the different integers. That is, $a$ is an $n$-bit register, so the QFT will produce a phase modulo $2^n$, whereas $b$ is a $\lceil \lg w\rceil$ bit register to which you are applying a QFT modulo $w$. I will also assume the QFT on $a$ is done modulo $N$, as that makes the analysis much easier. This leaves a state of

+ +

$$\sum_{c=0}^{N-1}\sum_{d=0}^{w-1}\sum_{a=0}^{N-1}\sum_{b=0}^{w-1}\exp\left(2\pi i \left(\frac{ac}{N}+\frac{bd}{w}\right)\right)\left\vert c,d,g^k\right\rangle$$ +where $a-rb\equiv k\mod N$.

+ +

I'll focus on the state corresponding to some fixed value of $k$. The set of states in superposition will be all $c$ and $d$, plus pairs $(a,b)$ in the set

+ +

$$K =\left\{(a,b) : a- rb\equiv k \mod N, 0\leq a \leq N-1, 0\leq b\leq w-1\right\}$$

+ +

In the usual Shor's algorithm, every value of $a$ (or $b$) is in a pair in this set, and for each one there is approximately one value of $b$ (or $a$) forming such a pair. Here, there will be many values of $a$ that are not in the set. But maybe that's fine, because for a fixed value of $b$, there will still be a unique value of $a$ such that $a\equiv k+rb\mod N$.

+ +

So, for a fixed $c, d, k$ we get

+ +

$$\sum_{b=0}^{w-1}\exp\left(2\pi i\left(\frac{(k+rb)c}{N}+\frac{bd}{w}\right)\right)\left\vert c,d,g^k\right\rangle$$

+ +

where I used the fact that powers of an $N$th root of unity are isomorphic to integers mod $N$.

+ +

Let $N'\equiv N^{-1}\mod w$ (assume $w$ and $N$ are co-prime):

+ +

$$=\exp(2\pi i\tfrac{kc}{N})\sum_{b=0}^{w-1}\exp\left(2\pi i\frac{b}{w}\left(rcN' + d\right)\right)\left\vert c,d,g^k\right\rangle$$

+ +

This will be non-zero if and only if $rcN'\equiv -d \mod w$. When we measure $c$ and $d$, we will thus find $-dc^{-1}N\equiv r\mod w$.

+ +

So I think this technique will work to recover the discrete log modulo $w$.

+ +

I don't think it's correct when you say ""$a$ and $b$ will always have solutions"". For a given $b$, $k$, and $r$, if $0\leq a\leq 2^{\lceil\lg p\rceil} -1$, there might be $1$ or $2$ solutions for $a$ such that $a-rb\equiv k\mod p -1$. Suppose $b=k=0$; then we have $a=p-1$ and $a=2(p-1)$ as solutions. +The analysis for using $a\in \{0,\dots, 2^{\lceil\lg p\rceil}-1\}$ will probably be really tricky to get right, but it should work in principle.

+ +

Normally Shor's algorithm for DLP needs $2\lceil\lg p\rceil$ computations of the group action in a single run. Your technique reduces it to $\lceil \lg p\rceil + \lceil \lg w\rceil$, but you need to repeat roughly $\frac{\lg p}{\lg w}$ times. So the total cost in quantum gates goes up, but each individual run can be smaller. Maybe this would be preferable because of error correction: Since each run must be smaller, the error tolerance can be higher and maybe it can use less error correction overhead.

+",4517,,,,,6/16/2020 9:53,,,,10,,,,CC BY-SA 4.0 +12512,2,,12376,6/16/2020 11:05,,5,,"

The orthonormal basis $|j\rangle$ of the $d$ dimensional finite Hilbert space corresponds to a configuration space of equally spaced clockwise ordered $d$ points on a circle $S^1$ or equivalently, the vertices of a $d$-dimensional regular polygon.

+ +

One may think of a point as a discrete location of a particle, then the shift operator $X$ shifts the particle position by one step clockwise. Thus, we may think of this orthonormal basis as the position basis.

+ +

More precisely, the configuration space may also be considered as the cyclic group $Z_d$, by defining the action of its points on themselves as modulo $d$ addition.

+ +

In ordinary quantum mechanics, where space is continuous, there is a dual basis: the momentum basis given by the action of the continuous Fourier transform on the position basis. In the discrete case, the momentum basis of the finite Hilbert space is given by the discrete Fourier transform of the position basis. +$$|k\rangle\rangle = \sum_{j=0}^{d-1}\omega^{-jk}|j\rangle$$ +It is not hard to see that the action of the operators on the dual basis is given by: +$$X|k\rangle\rangle = \omega^{k} |k\rangle\rangle$$ +and: + $$Z|k\rangle\rangle = |k+1 \mod d\rangle\rangle$$ +Thus, the operator $Z$, is the shift operator in the momentum basis. A shift in the momentum is a boost. This is the reason for this terminology.

+ +

So far, this is the standard explanation given in most quantum information resources. But it seems certainly strange at the first sight that a boost operator doesn't affect a position state (since a global phase shift doesn't define a new state). In elementary physics we are taught that a boost does indeed change the position of a particle. I'll try to explain this point and its manifestation in quantum information theory.

+ +

In classical mechanics, a (non-relativistic or Galilean) boost acts on the position and momentum observables as: +$$q\rightarrow q' = q+vt$$ +$$p\rightarrow p' = p+mv$$ +($m$ is the particle mass, and $v$ is the boost velocity). While the second equation, shows that the Boost indeed introduces a jump in the value of the momentum, the first equation shows that it also changes the position.

+ +

However, the analog of a state in classical mechanics is not the position and momentum, but rather their initial values, i.e., at $t=0$. We see that indeed the Galilean boost introduces an instantaneous jump to the momentum but doesn't change the position at $t=0$ similar to the above discrete quantum boost, in agreement with the above finding.

+ +

In standard quantum mechanics (on a continuous space), the (infinitesimal) Galilean boost $\mathbf{G}$ is given by: +$$\mathbf{G} = m \mathbf{Q}$$ +Where $\mathbf{Q}$ is the position operator. This is clearly an operator which does not introduce a change in the particle position. This relation is given in equation (3.51) in Ballentine's book: Quantum mechanics: A modern development. Ballentine proves that the above relation is the only compatible choice for a system whose kinematics is governed by the Heisenberg commutation relation: +$$[\mathbf{Q}, \mathbf{P}] = i \hbar \mathbf{I}$$ +Returning to the discrete case, we observe that the momentum basis $|k\rangle\rangle$ can also be modeled on a circle $S^1$ (or a regular polygon). The Cartesian product of the two discrete circles is called a phase space, and in our case, it is the collection of integer points on the torus $S^1\times S^1$. Of circumference $d$. Equivalently, the phase space is the group $\mathbb{Z}_d \times \mathbb{Z}_d$.

+ +

A phase space is the set of pure classical states. (In classical mechanics one can define a state with a definite discrete position and discrete momentum, but in the discrete Hilbert space there is no mutual eigenvector $X$ and $Z$). However, the phase space remains very important also in quantum theory, because both observables and states can be equally represented (in many ways) by functions on the phase space (in the case of operators, these functions are called operator symbols). In this representation, the associative composition of operators is called a star product which is useful for example in quantum tomography. In particular, Quasi-probability distributions describing quantum states are functions on the phase space. A prototypical example is the Wigner function, which is the Weyl symbol of the density matrix, whose expression for the discrete phase space:

+ +

$$W_{\rho}(p, q) = \frac{1}{d} \mathrm{tr}(\rho w(p, q)),\quad p,q\in \mathbb{Z}_d,$$

+ +

where the Weyl operator is given by: +$$w(p, q) = \omega^{-\frac{pq}{2}}Z^pX^q$$

+ +

Now, we know that boosts are elements of the Galilei group. Hence what is left is to see how the discrete Galilei group acts on the discrete phase and the corresponding Hilbert space.

+ +

The Galilean group consists of translations (shifts), rotations, boosts and time translations. When the configuration (position) space is a one-dimensional lattice $Z_d$ as in our case, there are no rotations. In addition, we do not want to commit to a single dynamics, so we consider the group without time translations (in non-relativistic theories this is possible, since the notion of simultaneity exists). This group is known by the name: isochronous Galilean group, which in our case consists of a single shift and a single boost. The action of its generators on the classical phase space: +$$ x: q\rightarrow q' = q+1\mod d, \quad p\rightarrow p'=p$$ +$$ z: q\rightarrow q' = q, \quad p\rightarrow p'=p+1\mod d$$ +This action cannot be lifted to the quantum Hilbert space, where a central extension of the Galilean group is realized by means of the operators $X$ and $Z$. +$$ZX=\omega XZ$$ +The origin of the central extension is the noncommutativity of the shift and boost after quantization. The need of a central extension is characteristic to quantization problems, where the action on the quantum space is realized by a central extension of the action on the phase space.

+ +

Thus, in the discrete phase space, the Galilean group is isomorphic to the (generalized) Pauli group generated by $X$, $Z$, $\omega$.

+ +

For the action of the full Galilean group on the discrete phase space and on the finite Hilbert space, please see: ŠŤoviček and Tolar. For the definition of the generalized Pauli group on the finite (qudit) Hilbert space please see Tolar.

+",4263,,,,,6/16/2020 11:05,,,,0,,,,CC BY-SA 4.0 +12513,1,12514,,6/16/2020 13:05,,6,951,"

I am trying to understand the Schmidt Decomposition, currently in my QC class. We had a tutorial where we were told if $|\psi\rangle$ is a pure state of a composite system A then there exists $|i_A\rangle$ and $|i_B\rangle$ which are orthonomral states for systems A and B respectively.

+ +

$$|\psi\rangle = \sum_i \lambda_i |i_A\rangle|i_B\rangle$$

+ +

I more or less understand that we write $|\psi\rangle$ as:

+ +

$$ |\psi\rangle = \sum_{j,k} c_{jk}|a_j\rangle|b_k\rangle$$

+ +

Where $|a_j\rangle_j$ and $|b_k\rangle_k$ are orthonormal bases for A and B and $C=(c_{jk})$ a complex matrix. Then proceed by using singular value decomposition on C. My question is how should I move on to apply the Schmidt decomposition on a numerical example such as the $|\beta_{00}\rangle$. Some pointers would be lovely as I struggle to understand, and would prefer it if there were no direct answers as I want to struggle through it myself as much as possible. Thanks!

+",12303,,55,,6/17/2020 6:55,6/17/2020 6:55,How to apply the Schmidt Decomposition to a Bell state?,,1,0,,,,CC BY-SA 4.0 +12514,2,,12513,6/16/2020 13:20,,4,,"

First suggestion: don't try it on a Bell state! This is already in the Schmidt basis, and lots of things that you do to the state will keep in Schmidt decomposed as well!

+ +

Instead, why not try an example such as +$$ +|\psi\rangle=\frac{3}{5\sqrt{2}}|00\rangle+\frac{3}{5\sqrt{2}}|01\rangle+\frac{4}{5\sqrt{2}}|10\rangle-\frac{4}{5\sqrt{2}}|11\rangle +$$ +So, as you say, work out what the matrix $C$ is, and perform a singular value decomposition on it. From there, try to extract $|i_A\rangle, |i_B\rangle$ and $\lambda_i$ values. (is this all you were after? since you don't want too many hints, I'm not sure what else to say.)

+",1837,,,,,6/16/2020 13:20,,,,3,,,,CC BY-SA 4.0 +12516,2,,11861,6/16/2020 18:57,,3,,"

Recently the Starmon-5 system was upgraded. Single qubit rotations Rx, Ry and Rz are now available, see https://www.quantum-inspire.com/kbase/starmon-5-operational-specifics/

+",5473,,,,,6/16/2020 18:57,,,,1,,,,CC BY-SA 4.0 +12517,1,,,6/16/2020 20:46,,0,124,"

+ +

How can I fix this error? I am installing the newest version of Qiskit.

+",11600,,55,,7/29/2020 18:12,7/29/2020 19:50,Installing Qiskit Error: Building wheel for ecos error,,1,1,,,,CC BY-SA 4.0 +12518,2,,1474,6/16/2020 23:37,,3,,"

Silq is new high level Quantum Computing language. +As quoted on their site: +""Silq is a new high-level programming language for quantum computing with a strong static type system, developed at ETH Zürich.""

+ +

Silq

+",1863,,,,,6/16/2020 23:37,,,,0,,,,CC BY-SA 4.0 +12519,2,,12507,6/17/2020 9:00,,0,,"

In theory:

+ +

Any classical algorithm can be expressed in an assembly language containing instruction of a processor. Any instruction is somehow connected with a logical circuit(s) composed of logical gates. Any logical gate can be decomposed to basic gates (for example NAND or set consisting of AND, OR and NOT).

+ +

Toffoli gate implements AND which can be easily converted to universal NAND. Hence any classical algorithm (code) can be implemented on quantum computer. Resulting quantum circuit can be simplified and after that expressed in assembly language of a quantum processor.

+ +
+ +

To sum up, in theory it is possible to convert any classical code into quantum code (gates, QASM etc.). However, this seems to be difficult to do in practice. Maybe, this can be done only for the simplest codes.

+",9006,,,,,6/17/2020 9:00,,,,1,,,,CC BY-SA 4.0 +12520,1,12522,,6/17/2020 10:59,,4,522,"

I'm having trouble getting the namespace Microsoft.Quantum.MachineLearning.

+ +

Here is an example Q# code:

+ +
namespace Temp {
+    open Microsoft.Quantum.Math;
+    open Microsoft.Quantum.Canon;
+    open Microsoft.Quantum.Intrinsic;
+    open Microsoft.Quantum.MachineLearning;
+
+    operation Hello () : Unit{
+        Message(""Hello"");
+    }
+}
+
+ +

Here is the python script which drives the code:

+ +
import qsharp
+from qsharp import Result
+import json
+import os
+from Temp import Hello
+Hello.simulate()
+
+ +

Here's the error that the VSCode terminal shows:

+ +
Preparing Q# environment...
+fail: Microsoft.Quantum.IQSharp.Workspace[0]
+      QS6104: No namespace with the name ""Microsoft.Quantum.MachineLearning"" exists.
+Traceback (most recent call last):
+  File ""Driver.py"", line 5, in <module>
+    from Temp import Hello
+ModuleNotFoundError: No module named 'Temp'
+
+ +

Here are my component versions:

+ +
>>> qsharp.component_versions()
+{'iqsharp': LooseVersion ('0.11.2004.2825'), 'Jupyter Core': LooseVersion ('1.3.52077.0'), '.NET Runtime': LooseVersion ('.NETCoreApp,Version=v3.1'), 'qsharp': LooseVersion ('0.11.2004.2825')}
+
+ +

I've tried adding the package manually into my conda environment:

+ +
>>> qsharp.packages.add(""Microsoft.Quantum.MachineLearning::0.11.2004.2825"")
+Adding package Microsoft.Quantum.MachineLearning::0.11.2004.2825.>>> qsharp.reload()
+
+ +

But that doesn't help.

+ +

Also, it's worth to note that there is no such problem when I try to do the same in a local Jupyter Notebook which is weird since they run in the same environment.

+",10376,,,,,6/20/2020 4:21,"Q# Error: No namespace with the name ""Microsoft.Quantum.MachineLearning"" exists",,2,0,,,,CC BY-SA 4.0 +12521,2,,12507,6/17/2020 13:48,,4,,"

Using Qiskit you can compile a boolean function to a Quantum circuit. +2 options are available: Using a logical expression LogicalExpressionOracle() or a thuth table TruthTableOracle().

+ +

The Logical Expression Oracle constructs circuits for any arbitrary input logical expressions. It also supports input strings in the DIMACS CNF format, for specifying SAT problems.

+ +

an example with LogicalExpressionOracle()

+ +
from qiskit.aqua.components.oracles import TruthTableOracle, LogicalExpressionOracle
+expression = 'Or(And(v0, v1, v2), And(~v0, ~v1, ~v2))'
+#expression = '(v0&v1&v2) | (~v0&~v1&~v2)'
+oracle=LogicalExpressionOracle(expression, optimization=True)
+
+# then get the OpenQasm code from the circuit 
+print(oracle.circuit.qasm())
+OPENQASM 2.0;
+include ""qelib1.inc"";
+qreg v[3];
+qreg c[2];
+qreg o[1];
+mcx v[0],v[1],v[2],c[0];
+u3(pi,0,pi) c[0];
+x v[0];
+x v[1];
+x v[2];
+mcx v[0],v[1],v[2],c[1];
+u3(pi,0,pi) c[1];
+x v[0];
+x v[1];
+x v[2];
+u3(pi,0,pi) o[0];
+ccx c[0],c[1],o[0];
+u3(pi,0,pi) c[0];
+u3(pi,0,pi) c[1];
+mcx v[0],v[1],v[2],c[0];
+x v[0];
+x v[1];
+x v[2];
+mcx v[0],v[1],v[2],c[1];
+x v[0];
+x v[1];
+x v[2];
+
+",9934,,,,,6/17/2020 13:48,,,,1,,,,CC BY-SA 4.0 +12522,2,,12520,6/17/2020 13:53,,3,,"

You'll need to actually add these two lines into your Python script:

+ +
qsharp.packages.add(""Microsoft.Quantum.MachineLearning::0.11.2004.2825"")
+qsharp.reload()
+
+ +

This causes the packages to be loaded and available at runtime.

+ +

You need those two lines before you call from Temp import Hello, otherwise you will get the errors since you try to open the Microsoft.Quantum.MachineLearning namespace inside your Temp namespace.

+ +

Notice that you may still see an error message that says No namespace with the name ""Microsoft.Quantum.MachineLearning"" exists due to the behavior of import qsharp (see this issue for more details), but your code should then compile and run successfully anyway, in which case you can ignore that error message.

+",10473,,,,,6/17/2020 13:53,,,,2,,,,CC BY-SA 4.0 +12523,2,,12517,6/17/2020 15:39,,3,,"

This error seems to be reported by various users as per the Qiskit GitHub repository. Could you please try the following steps.

+ +
    +
  1. Install Anaconda
  2. +
  3. Create a python 3.7 environment: conda create --name your_env python=3.7
  4. +
  5. conda activate your_env
  6. +
  7. pip install qiskit
  8. +
+ +

You can report the specific details of the issues in the following GitHub repository issue log if it is persisting after following these steps.

+ +

Qiskit GitHub Repository Issue Log

+",4501,,,,,6/17/2020 15:39,,,,1,,,,CC BY-SA 4.0 +12524,2,,12066,6/17/2020 16:40,,5,,"

You can use a callback function to save the parameters for each iterations of your vqe algorithm and even store the mean, std. +Below an example:

+ +
# Create the callback function to store intermediate values in vqe
+counts = []
+values = []
+parameters_list=[]
+std_list=[]
+def store_intermediate_result(eval_count, parameters, mean, std):
+    counts.append(eval_count)
+    values.append(mean)
+    parameters_list.append(parameters)
+    std_list.append(std)
+# Create your vqe instance by specifying the callback function and run it on the simulator
+# You already created your operator, varational form and optimizer.
+
+vqe = VQE(op, var_form, optimizer, callback=store_intermediate_result)
+result=vqe.run(simulator)
+
+ +

Your parameters_list will be filled by the parameters used at each step of the algorithm. You can take the last parameters or others if you want and start a new vqe instance from them.

+ +
last_parameters=parameters_list[-1]
+# The initial_point option allow to start from specific parameters.
+vqe2=VQE(op, var_form, optimizer, callback=store_intermediate_result, initial_point=last_parameters)
+# Run the algorithm from your last iteration
+result2=vqe2.run(simulator)
+
+",12386,,,,,6/17/2020 16:40,,,,0,,,,CC BY-SA 4.0 +12525,2,,4399,6/17/2020 17:26,,0,,"

The concept of quantum computing clusters could be formalised into a generalised distributed quantum computers. We will need both quantum networks and distributed quantum computing algorithms to realise such distributed quantum computers. These distributed quantum computers work by linking multiple quantum processors through a quantum network by sending qubits in-between them. Doing this creates a quantum computing cluster and therefore creates more computing potential.

+ +

It is already proven that even in case of small quantum devices, two clustered devices can provide an exponential speedup with respect to isolated devices. As mentioned in the other answer, quantum teleportation is the key strategy to enable distributed quantum computing, which requires to perform operations between qubits physically located on multiple remote quantum devices. However there is a trade off to this teleportation operation. There will be a time overhead induced by teleporting operations in distributed quantum computing.

+ +

+ +

Currently quantum processors are only separated by short distances. To scale this quantum networks, we will need better quantum communication links and secure quantum key distribution systems. To make such an infrastructure, we will need optical switches capable of delivering qubits to the quantum processors. These switches need to preserve the quantum coherence. We will also need quantum repeaters to transport qubits over long distances. Since qubits cannot be copied, classical signal amplification would not be possible.

+",4501,,,,,6/17/2020 17:26,,,,0,,,,CC BY-SA 4.0 +12526,1,,,6/17/2020 20:02,,1,226,"

I'm wondering if the gate errors on any of the IBM devices are low enough so that we could use some error correcting codes which do not require too many qubits? (such as 5- or 7-qubit codes). Even running programs with on little as 2 logical qubits would be cool.

+",6313,,,,,6/18/2020 7:43,Quantum error correction on IBM devices?,,1,1,,,,CC BY-SA 4.0 +12527,2,,12445,6/18/2020 5:45,,0,,"

We can construct quantum verified delay functions ( QVDF ) and delay authentication ( QDA ) circuits using single quibit quantum circuits. Like quantum randomness generators ( QRN ), these delay functions can be used for auction and lottery systems. We can possibly construct quantum ring structures (QRS) as building blocks for quibit storage, sensing elements and oscillators. Quantum Ring Oscillators ( QRO ) are the circuits where the feedback qubit state alternates in binary basis states with a period proportional to the delay of the circuit elements. When the overall transfer function for the feed-forward stage in a QRS is equivalent to a Pauli-X rotation, it results in a QRO. Qubit storage is achieved through continuous regeneration of the qubit state rather than attempting to preserve the same qubit. Please find further details about single qubit Quantum Ring Structures and the applications in the following research report.

+ +

Single Qubit Quantum Ring Structures and Applications

+",4501,,,,,6/18/2020 5:45,,,,0,,,,CC BY-SA 4.0 +12528,1,12533,,6/18/2020 6:59,,2,74,"

Suppose I have two states $\rho$ and $\sigma$. We are given that,

+ +

$$Tr((\rho - \sigma)|\psi\rangle\langle\psi|) \geq \epsilon$$ +where $|\psi\rangle$ is a fixed state and $\epsilon \rightarrow 0$,

+ +

Then can we conclude anything about the closeness of two states $\rho$ and $\sigma$ in any distance measure?

+",8748,,55,,10/8/2020 17:54,10/8/2020 17:54,What can be said about the closeness of two states if the difference of their fidelity measured with respect to a fixed state is close to 0?,,2,0,,,,CC BY-SA 4.0 +12529,1,,,6/18/2020 7:30,,1,89,"

I wrote some code in QASM in the IBM Q Experience web interface and then I added some comments. After that I saved the code and run it. However, the code was rearranged (for example some gates were moved on other places - probably because of optimization). Moreover, all comments were removed. The same occurs when I save the code and return to it later Fortunately more recent codes are intact, i.e. there are comments I put there previously, but I was afraid to run them because of a risk of losing comments.

+

I am used to this behavior when I write a code and then do some edits in composer. In that case comments are also removed and the code is rearranged. But the above described issue seems to be a bug.

+

Does anyone face similar problems? Can anybody from IBM check this and fix?

+
+

EDIT:

+

As there was a misunderstanding when the comments disappear, here is a screenshot which place of web interface I meant. The code is of course rearranged during transpiling process. However, the problem is that IBM Q erase comments and rearrange code in Circuit editor.

+

+
+

EDIT 2:

+

This code I wrote to Circuit editor:

+
OPENQASM 2.0;
+include "qelib1.inc";
+
+qreg q[5];
+creg c[5];
+
+x q[1]; //ancila
+
+h q[0]; //init
+h q[1];
+h q[2];
+//Oracle f = 11.x
+cx q[0],q[1];
+cx q[2],q[1];
+//measurement in Hadamard basis
+h q[0];
+h q[2];
+measure q[0] -> c[1];
+measure q[2] -> c[0];
+
+

Then I clicked on Save, closed the the circuit, opened again from Dashboard and the code changed to this:

+
OPENQASM 2.0;
+include "qelib1.inc";
+
+qreg q[5];
+creg c[5];
+
+h q[0];
+x q[1];
+h q[2];
+h q[1];
+cx q[0],q[1];
+h q[0];
+cx q[2],q[1];
+h q[2];
+measure q[0] -> c[1];
+measure q[2] -> c[0];
+
+

So, the code is changed to transpiled code. I would like to avoid this behavior.

+",9006,,9006,,6/23/2020 7:43,6/23/2020 7:43,Problem with comments and code rearranging in IBM Q web interface,,1,0,,,,CC BY-SA 4.0 +12530,2,,12526,6/18/2020 7:43,,2,,"

You might find some examples in this two-year-old question :)

+ +

To the best of my knowledge, the most recent work that implements some code on IBMQ's quantum devices is about the repetition code (see the textbook or the paper). If you only want to do the simulation, there should be no problem to take a further step towards more advanced codes. But if you mean real quantum devices, the circuit depth (increased by parity checks and swap operations), and sometimes post-measurement quantum operations would make the implementation quite hard. See this paper for example, which says

+ +
+

Although the fault-tolerant gates offer an impressive improvement in fidelity, the computation as a whole is not below the fault-tolerance threshold because of noise associated with state preparation and measurement on this device.

+
+ +

(I have to admit that it's about fault-tolerant quantum computation and not a very good example.)

+ +

Still, like these recent work, you could try to test some QEC codes on IBMQ devices instead of perfectly implementing them.

+",4178,,,,,6/18/2020 7:43,,,,0,,,,CC BY-SA 4.0 +12531,1,,,6/18/2020 8:02,,3,59,"

I'm studying quantum walk and quantum simulated annealing. While reading the paper Quantum algorithms for simulated annealing, I feel a little confused about the quantum walk they gave in Sec 2.1 Quantum walks for QSA, which is

+
+

$W=X^\dagger PXPRPX^\dagger PXR,$

+
+

where $P$ is the swapping opertor, $R=\mathbb{I}-2|\vec{0}\rangle\langle \vec{0}|$, and $X$ satisfies

+

$$X|\sigma_i\rangle |\vec{0}\rangle =\sum_{j=0}^{d-1} \sqrt{Pr_\beta (\sigma_j|\sigma_i)} |\sigma_i\rangle + |\sigma_j\rangle, \qquad +\vec{0}=\sigma_0,$$ +and $\{\sigma_i\}_{i=0}^{d-1}$ can be considered as the full space of configurations.

+

As mentioned in the paper,

+
+

the detailed balance condition implies $W\sum_{i=0}^{d-1} \sqrt{\pi_\beta(\sigma_i)} |\sigma_i\rangle|\vec{0}\rangle=\sum_{i=0}^{d-1} \sqrt{\pi_\beta(\sigma_i)} |\sigma_i\rangle|\vec{0}\rangle$

+
+

where $\pi_\beta(\sigma_i)$ in the eigenstate are the probabilities given by the Gibbs distribution dependent on $\beta$. And

+
+

the goal of QSA is to prepare the corresponding eigenstate of $W$.

+
+

My questions are:

+
    +
  1. How do we write $X$ in the operator form? Is $$\sum_{i=0}^{d-1} \sum_{j=0}^{d-1} \sqrt{Pr_{\beta}(\sigma_j|\sigma_i)} |\sigma_i\rangle\langle \sigma_i| \otimes |\sigma_j\rangle\langle \vec{0}|$$ correct?

    +
  2. +
  3. Which qubits do the $R$s act on? I think it's the first qubit for the first $R$ and the second one for the second, otherwise, the $R$s would make no sense...

    +
  4. +
  5. What does this walk mean? With the assumptions about $X$ and $R$, I tried to compute $$W\sum_{i=0}^{d-1} \sqrt{\pi_\beta(\sigma_i)} |\sigma_i\rangle|\vec{0}\rangle,$$ +which seems to be +$$\sum_{i=0}^{d-1}\sqrt{\pi_\beta(\sigma_i)} \sum_{b=0}^{d-1} \sum_{c=0}^{d-1} (-1)^{I(i=0)+I(b=0)} \sqrt{Pr_\beta(\sigma_b|\sigma_i) Pr_\beta(\sigma_i|\sigma_b) Pr_\beta(\sigma_c|\sigma_b) Pr_\beta(\sigma_b|\sigma_c)} |c\rangle|0\rangle$$ ($(-1)^{I(i=0)+I(b=0)}$ could take different forms due to the location of $R$s). But is there any relationship between the balance condition and the walk c->b->i->b->c ?

    +
  6. +
+

Thanks!

+",4178,,55,,6/18/2020 9:50,6/18/2020 9:50,Quantum walk for quantum simulated annealing in arXiv: 1512.03806,,0,2,,,,CC BY-SA 4.0 +12532,2,,12529,6/18/2020 8:41,,4,,"

You'e just experienced code transpilation. Transpilation is when source-to-source compilation takes place, as you have mentioned here. You can prevent the rearranging of the gates by using the "barriers", the Barrier operation is used to make your quantum program more efficient, the compiler will try to combine gates. The barrier is an instruction to the compiler to prevent these combinations being made.

+

+

When the code is transpiled the comments are omitted, but they are unchanged in the original code

+",9898,,,,,6/18/2020 8:41,,,,6,,,,CC BY-SA 4.0 +12533,2,,12528,6/18/2020 9:13,,4,,"

In general, it would seem no. The quantity +$$ +\mathrm{Tr}[(\rho - \sigma)|\psi\rangle\langle\psi|] +$$ +is only concerned with the distance between $\rho$ and $\sigma$ on the subspace $\mathrm{span}(|\psi\rangle)$. For example, we know we can decompose the Hilbert space as $\mathcal{H} = \mathrm{span}(|\psi\rangle) \oplus \mathrm{span}(|\psi\rangle)^{\perp}$. Then take $\rho', \sigma'$ to be operators with support only on $\mathrm{span}(|\psi\rangle)^{\perp}$. Then for any $\epsilon \geq 0$ define $ \rho_{\epsilon} = (1-\epsilon)\rho' + \epsilon |\psi \rangle \langle \psi |$ and $\sigma = \sigma'$. For these states we have +$$ +\mathrm{Tr}[(\rho_{\epsilon} - \sigma)|\psi\rangle\langle\psi|] = \epsilon. +$$

+

However, as you mention in your question $\epsilon$ is small so we have (most of the time) a lot of freedom with how we can define the operators on the orthogonal subspace. If we take $\rho' = \sigma'$ then +\begin{align} +\|\rho_{\epsilon} - \sigma\| &= \|-\epsilon \rho' + \epsilon |\psi\rangle\langle\psi|\| \\ +&= \epsilon \| \rho' - |\psi\rangle\langle\psi|\| +\end{align} +which is small if $\epsilon$ is small. However, in general if we use the fact that norms are continuous we have +$$ +\begin{aligned} +\lim_{\epsilon \rightarrow 0} \| \rho_{\epsilon} - \sigma\| &= \|\lim_{\epsilon \rightarrow 0} \rho_{\epsilon} - \sigma \| \\ +&= \|\rho' - \sigma' \|. +\end{aligned} +$$ +So as $\epsilon \rightarrow 0$ the distance between $\rho$ and $\sigma$ just becomes the distance between $\rho'$ and $\sigma'$. But we were free to choose $\rho'$ and $\sigma'$ as we wished so this distance has no nontrivial a priori bound.

+

Caveat +The case is different for qubits. There the orthogonal subspace is one-dimensional so if we tried to play the same trick we don't have any freedom in how to choose $\rho'$ and $\sigma'$. In this case we end up in the first example again where for $\epsilon \rightarrow 0$ we found $\|\rho_{\epsilon} - \sigma\| \rightarrow 0$. For qubits you can probably work out some concrete bounds on the distance.

+",9854,,,,,6/18/2020 9:13,,,,0,,,,CC BY-SA 4.0 +12534,1,,,6/18/2020 10:53,,1,193,"

I am using amplitude encoding to encode my features in a quantum circuit. With this I expect to encode e.g. 32 features in five qubits.

+

For the encoding I use qiskit's StateVectorCircuit. I expect to receive the same state vector when using the StateVectorCircuit with the 'statevector_simulator' as I put in.

+

However, I experienced, that the sign of the real part (I don't use complex numbers) doesn't matches.

+

Here is a small example:

+
state_vector = [-1/2, -1/2, -1/2, -1/2]
+
+state_vector_circuit = StateVectorCircuit(state_vector).construct_circuit()
+
+job = execute(state_vector_circuit, Aer.get_backend('statevector_simulator'), optimization_level=0)
+result = job.result()
+
+outputstate = result.get_statevector(state_vector_circuit)
+
+print(outputstate)
+print(state_vector)
+
+

Running this code, I receive the following output, where the second line is the expected one:

+
[0.5+0.j 0.5+0.j 0.5+0.j 0.5+0.j]
+[-0.5, -0.5, -0.5, -0.5]
+
+

Measuring the circuit will have the same results. However, I don't want to measure it immediately instead I have this circuit as an input for my Quantum Neural Network. And, in this case I guess the sign matters.

+

Where is the wrong sign coming from? Is it the StateVectorCircuit or the 'statevector_simulator'? And more importantly is there a way from preventing this?

+

On the other hand, I figured I could use only positive amplitudes. However, I feel this would be a limitation.

+

Edit: I created an example jupyter notebook on my GitHub page: StateVectorCircuitTest.ipynb

+",5461,,5461,,6/18/2020 12:36,6/21/2020 7:17,Why do I get positive amplitudes when I create a qiskit StateVectorCircuit from only negative amplitudes?,,2,0,,,,CC BY-SA 4.0 +12535,2,,12534,6/18/2020 11:28,,1,,"

Your target state and the state that you get only differ by a total factor of $-1$. +In other words, if $|\psi\rangle$ is the state that you get and $|\psi_{t}\rangle$ is the target state, we have:

+

$$ +|\psi\rangle = (-1)\times|\psi_{t}\rangle = -|\psi_{t}\rangle. +$$ +Such a overall factor is known as a global phase. People think of it as a phase, because we can write $-1 = e^{i\phi}$ for $\phi=\pi$. Note that we're not only considering global phases when $\phi$ is equal to $\pi$, but $\phi$ can be anything between $0$ and $2\pi$.

+

We don't care about global phases, because whenever we try to retrieve information (i.e. a measurement) from a state the global phase cannot play a role. Therefore, we normally just disregard the global phase, and we set the first entry in our statevector to a real, positive value.

+

The sign difference between elements in your statevector, however, does play a vital role. We call this the relative phase, as it is a phase of one element of the statevector relative to the other. Also note that if you limit yourself to only real elements (thereby setting any relative phase $\phi_{rel}$ to $0$ or $\pi$), you severely limit the quantum advantage that you can attain.

+",8141,,,,,6/18/2020 11:28,,,,5,,,,CC BY-SA 4.0 +12536,1,,,6/18/2020 13:08,,3,147,"

Just read this paper from Xanadu on Quantum Transfer Learning and a couple of things are unclear to me regarding the optimisation step.

+
    +
  1. How is back-propagation done through the classical weights feeding into the quantum unitaries?
  2. +
  3. How do they even calculate cross-entropy loss without adding some sort of squashing function to the final output to give outputs in $[0,1]$ (my best guess is that the squashing function is implicit in the fact that you have to measure multiple times to get an expectation value).
  4. +
+

PS: I know this might be overly-specific for SE but I suppose this is the best avenue short of writing the authors.

+",10485,,,,,6/19/2020 6:42,"How is back-propagation done in ""Transfer learning in hybrid classical-quantum neural networks""",,1,0,,,,CC BY-SA 4.0 +12537,1,,,6/18/2020 13:31,,4,161,"

Classically, if the mutual information between the input and output of some channel or circuit $= 0$, it means the output is independent of the input, and the circuit is in a way 'useless'.

+

For the quantum case, defining the mutual information between an input $\rho_A$ and the output $\rho_B$, where $\rho_B = \mathcal{E}_{B|A}(\rho_A)$ is not so straightforward. +Let the Choi state be $\rho_{A'B}=\mathbb{I}_{A'}\otimes \mathcal{E}_{B|A}(\Omega_{A'A})$, where $\Omega_{A'A}$ is a maximally entangled state. If $I(A';B)=0$, can one make a similar conclusion about 'independence' of input and output or 'usefulness' of the circuit in the classical case? Or what can one conclude here?

+

Thanks in advance!

+",12047,,55,,10/27/2021 16:58,8/24/2022 6:23,What does vanishishing mutual information of the Choi imply about the channel?,,1,0,,,,CC BY-SA 4.0 +12538,1,16385,,6/18/2020 15:56,,3,355,"

Is it possible to express gate $U_1(\lambda)$ through the gates $R_x, R_y, R_z$ while maintaining the phase? Both in principle and in practice (in Qiskit for example)?

+

The single gate $R_z(\lambda)$ is not suitable, because it loses phase. In qiskit the transpile function throws an error:

+
+

Cannot unroll the circuit to the given basis, ['rx', 'ry', 'rz']. No rule to expand instruction u1.

+
+",12280,,10480,,3/12/2021 19:14,3/12/2021 19:28,"Is it possible to express $U_1(\lambda)$ through the gates $R_x, R_y, R_z$ while maintaining the phase? In Qiskit for example",,1,3,,,,CC BY-SA 4.0 +12539,2,,9855,6/18/2020 16:22,,7,,"

I don't know if that's still useful but I've been asking this to myself recently and I've found a simple answer.
+If you want to prepare the mixed state +$$\rho = \frac{1}{d}\sum_{i}^{d} |i\rangle\langle i|$$ +you can start by preparing the maximally entangled pure state +$$|\varphi\rangle = \frac{1}{\sqrt{d}}\sum_{i}^{d} |i\rangle|i\rangle$$
+The density matrix of $|\varphi\rangle$ would be $$|\varphi\rangle\langle \varphi| = \frac{1}{d}\sum_{i}^{d} \sum_{j}^{d}|i\rangle|i\rangle\langle{j}|\langle{j}| = \sum_{i}^{d} \sum_{j}^{d}|i\rangle\langle{j}|\otimes|i\rangle\langle{j}|$$. +Tracing out the second qubit would result in: +$$Tr_2[\frac{1}{d}\sum_{i}^{d} \sum_{j}^{d}|i\rangle\langle{j}|\otimes|i\rangle\langle{j}|] =$$ +$$\frac{1}{d}\sum_{i}^{d} \sum_{j}^{d}|i\rangle\langle{j}|\cdot Tr[|i\rangle\langle{j}|] = $$ +$$\frac{1}{d}\sum_{i}^{d} \sum_{j}^{d}|i\rangle\langle{j}|\delta_{ij} = \frac{1}{d}\sum_{i}^{d} |i\rangle\langle i|=\rho$$

+

Moreover, instead of using +$|\varphi\rangle = \frac{1}{\sqrt{d}}\sum_{i}^{d} |i\rangle|i\rangle$ +you could start with any state of the form +$$|\varphi\rangle = \frac{1}{\sqrt{d}}\sum_{i}^{d} |u_i\rangle|u_i\rangle$$
+where {$u_i$} is an orthonormal basis for $H^{\otimes d}$ and you would still have +$$Tr_2[|\varphi\rangle\langle \varphi|] = Tr_1 [|\varphi\rangle\langle \varphi|] = \frac{\mathbb{I}}{d} = \frac{1}{d}\sum_{i}^{d} |i\rangle\langle i|$$

+",10259,,,,,6/18/2020 16:22,,,,0,,,,CC BY-SA 4.0 +12540,1,,,6/18/2020 18:36,,2,1171,"

I know that to prepare a Bell state say $|\phi^+\rangle$, we need to initial state $|0\rangle,|0\rangle$ and then perform a Hadamard on the first and then use it as control to do a NOT gate on the second to obtain $$\dfrac{|00\rangle+|11\rangle}{\sqrt{2}}.$$ But what if wanted to create the state $$\alpha|00\rangle+\beta|01\rangle+\gamma|10\rangle+\eta|10\rangle.$$ How does one create this state?

+",6070,,55,,6/21/2020 9:42,6/21/2020 9:42,How to prepare an arbitrary two-qubit state?,,3,0,,,,CC BY-SA 4.0 +12541,2,,12540,6/18/2020 19:37,,2,,"

First of all, I'm assuming you mean the state : $\alpha \left|00\right> + \beta \left|01\right> + \gamma\left|10\right> + \eta \left|11\right>$.

+

What you actually want to do is to act with a gate $U$ on the initial state $\left|00\right>$ so that $U\left|00\right> = \alpha \left|00\right> + \beta \left|01\right> + \gamma\left|10\right> + \eta \left|11\right>$.

+

So you will need a matrix $U$:

+

\begin{bmatrix} +\alpha & 0 & 0 & 0\\ +\beta & 0 & 0 & 0 \\ +\gamma & 0 & 0 & 0\\ +\eta & 0 & 0 & 0 +\end{bmatrix}

+

so that when in acts on +\begin{equation} +\left|00\right> = +\begin{bmatrix} +1\\ +0\\ +0\\ +0 +\end{bmatrix} +\end{equation}

+

it produces the desired state. So how can someone build such a matrix?

+

You just have to find a decomposition, or an approximation to some extent, to a familiar set of single and 2-qubit quantum gates.

+",12408,,23,,6/18/2020 23:10,6/18/2020 23:10,,,,2,,,,CC BY-SA 4.0 +12542,1,12555,,6/18/2020 20:33,,2,62,"

I am checking Q# - Graph coloring

+
                for (C in 0 .. (1 <<< N) - 1) {
+                InitializeColor(C, register);
+
+

Can you help me explain this part of the code?

+

Thnx

+
        for (N in 1 .. 4) {
+            using (register = Qubit[N]) {
+                for (C in 0 .. (1 <<< N) - 1) {
+                    InitializeColor(C, register);
+                    let measurementResults = MultiM(register);
+                    Fact(ResultArrayAsInt(measurementResults) == C, 
+                        $"Unexpected initialization result for N = {N}, C = {C} : {measurementResults}");
+                    ResetAll(register);
+                }
+            }
+        }
+    }
+
+
+
+",11913,,,,,6/19/2020 15:39,Graph coloring - Q# -,,1,2,,,,CC BY-SA 4.0 +12544,2,,12528,6/18/2020 22:03,,4,,"

Here's a concrete example for a single qubit.

+

We can always change the basis to have $|\psi\rangle=|0\rangle$. +Let us further suppose that $\langle0|\rho|0\rangle=0$, so that +$$\rho=\begin{pmatrix}0&0\\0&1\end{pmatrix}.$$ +The requirement $\operatorname{Tr}[(\sigma-\rho)|\psi\rangle\!\langle\psi|]=\langle\psi|\sigma-\rho|\psi\rangle=\epsilon$ then becomes +$$\sigma=\begin{pmatrix}\epsilon & a^* \\ a & 1-\epsilon\end{pmatrix}$$ +for some $a\in\mathbb C$. To have $\sigma\ge0$, the coefficient $a$ must satisfy $|a|^2\le \epsilon(1-\epsilon)$ (as follows from imposing its eigenvalues to be non-negative). +We then have +$\langle0|\sigma-\rho|0\rangle= \epsilon$.

+

To quantify the distance between these states, we notice that the eigenvalues of $\sigma-\rho$ are $\lambda_\pm=\pm\sqrt{\epsilon^2+|a|^2}$, and therefore +$$\|\rho-\sigma\|_1=|\lambda_+|=\sqrt{\epsilon^2+|a|^2}.$$ +We then have the following bound on the trace distance: +$$\epsilon\le\|\rho-\sigma\|_1\le\sqrt{\epsilon}$$

+
+

In the general case, suppose $\langle0|\rho|0\rangle=p$. Then +$$\rho=\begin{pmatrix}p & b^* \\ b & 1-p\end{pmatrix}, +\qquad +\sigma=\begin{pmatrix}p+\epsilon & a^* \\ a & 1-(p+\epsilon)\end{pmatrix}, +$$ +where $a,b\in\mathbb C$ are arbitrary complex vectors such that +$$|a|^2\le p(1-p)\equiv r_{p}^2,\qquad |b|^2\le (p+\epsilon)(1-(p+\epsilon))\equiv r_{p+\epsilon}^2.$$ +The trace distance then reads +$$\|\sigma-\rho\|_1=\sqrt{\epsilon^2+|a-b|^2}.$$ +To get maximum and minimum values of this quantity we notice that +$$(r_p-r_{p+\epsilon})^2 \le |a-b|^2\le (r_p+r_{p+\epsilon})^2,$$ +which immediately translates into a bound for the trace distance.

+",55,,,,,6/18/2020 22:03,,,,0,,,,CC BY-SA 4.0 +12545,2,,12537,6/19/2020 1:03,,1,,"

Here's a guess: they might be related to entanglement-breaking channels (also known as measure-and-prepare channels, quantum-classical channels, etc.). Any channel of the form, +$$ \Phi(\rho) = \sum\limits_{k} \operatorname{Tr}\left( M_{k} \rho \right) \sigma_{k} , \text{ where } M_{k}\geq0,\sum\limits_{k}^{} M_{k} = \mathbb{I}, $$ +are POVM elements and $\{ \sigma_{k} \}$ are quantum states is called EB. One can show that the Choi states of such channels are always seperable (in fact, $\mathcal{I}^{A} \otimes \Phi^{B} (\Gamma^{AB})$ is seperable for any entangled input density matrix -- hence the name, entanglement-breaking.)

+

As an example, consider a (simplified) EB channel of the form, $\Phi(\rho) = \operatorname{Tr}\left( \rho \right) \sigma$. Then, note that its Choi state is, +$$ \mathcal{I} \otimes \Phi \left( | \Omega \rangle \langle \Omega| \right) = \frac{1}{d} \sum\limits_{j,k}^{} | j \rangle \langle k | \otimes \Phi (| j \rangle \langle k | ) = \frac{1}{d} \sum\limits_{j,k}^{} | j \rangle \langle k | \otimes \delta_{jk} \sigma = \frac{\mathbb{I}}{d} \otimes \sigma. $$ +Since the quantum mutual information of the input state $I(A:B) = S_{\mathrm{rel}}(\rho^{AB} || \rho^{A} \otimes \rho^{B})$, where $S_{\mathrm{rel}}(\cdot || \cdot)$ is the quantum relative entropy (see for ex. Nielsen and Chuang); we have, that for a "simple" measure-and-prepare channel, the quantum mutual information of the input-output states in the Choi representation is zero.

+

Note #1: The Choi states of other EB channels are seperable too, but it may not be product, in which case the QMI is not zero -- I'm not sure how to classify such channels in general. Of course, the convex combinations of two (or more) channels of the form $\Phi_{j}(\rho) = \operatorname{Tr}\left( \rho \right) \sigma_{j}$ will also satisfy this property, but I'm not sure how far this can generalize.

+

Note #2: To remark on the broader question, yes, convex combinations of channels of the form $\Phi_{j}(\rho) = \operatorname{Tr}\left( \rho \right) \sigma_{j}$ are, in fact, useless since their input-output states are independent (note that this is a convex subset of EB channels, and this is not true for all EB channels). Unfortunately, this set is simply a sufficient condition for the QMI of the Choi state to be zero (and not a necessary condition). And so the question remains unanswered.

+",1108,,1108,,6/20/2020 0:07,6/20/2020 0:07,,,,8,,,,CC BY-SA 4.0 +12546,2,,12536,6/19/2020 6:42,,2,,"
+

How is back-propagation done through the classical weights feeding into the quantum unitaries?

+
+

In this particular case, the gradient of the quantum variational circuit is computed using the parameter-shift rule. The parameter-shift rule allows us to compute the gradient by simply evaluating linear combinations of the variational circuit under study, so works with both quantum simulators and hardware.

+

For example, given a variational quantum circuit $U(\boldsymbol \theta)$ +and some measured observable $\hat{B}$, the derivative of the expectation value

+

$$\langle \hat{B} \rangle (\boldsymbol\theta) = + \langle 0 \mid U(\boldsymbol\theta)^\dagger \hat{B} U(\boldsymbol\theta) \mid 0\rangle$$

+

with respect to the input circuit parameters $\boldsymbol{\theta}$ is given by

+

$$\nabla_{\theta_i}\langle \hat{B} \rangle(\boldsymbol\theta) + = \frac{1}{2} + \left[ + \langle \hat{B} \rangle\left(\boldsymbol\theta + \frac{\pi}{2}\hat{\mathbf{e}}_i\right) + - \langle \hat{B} \rangle\left(\boldsymbol\theta - \frac{\pi}{2}\hat{\mathbf{e}}_i\right) + \right].$$

+

Thus, the gradient of the expectation value can be calculated by evaluating the same variational +quantum circuit, but with shifted parameter values.

+

To 'integrate' the quantum circuit into the larger classical ML model, we use PennyLane; which allows you to create an arbitrary hybrid classical-quantum ML model that supports backpropagation using either TensorFlow, PyTorch, or Autograd.

+

In this particular case, two good resources are:

+
    +
  • Quantum transfer learning tutorial. This is a self contained tutorial that follows the general structure of the PyTorch transfer learning tutorial, with difference of using a quantum circuit to perform the final classification task.

    +
  • +
  • The XanaduAI/quantum-transfer-learning GitHub repo, which contains the code for the numerical experiments in the paper.

    +
  • +
+
+

How do they even calculate cross-entropy loss

+
+

In this case, since PennyLane lets us use PyTorch to drive the overall model, we simply use nn.CrossEntropyLoss() class provided by PyTorch.

+

References

+ +",371,,,,,6/19/2020 6:42,,,,0,,,,CC BY-SA 4.0 +12547,1,,,6/19/2020 7:01,,1,284,"

Is there a way to use a ParamResolver or Sweep to assign values to the symbols in a parameterized Cirq circuit without running it?

+

For example, something like:

+
#set up parameterized circuit
+simulator = cirq.Simulator()
+circuit = cirq.Circuit()
+alpha = sympy.Symbol('alpha')
+beta = sympy.Symbol('beta')
+circuit.append(one_step(alpha, beta))
+circuit.append(cirq.measure(*qubits, key='x'))
+sweep = (cirq.Linspace(key='alpha', start=0.1, stop=0.9, length=5)
+         * cirq.Linspace(key='beta', start=0.1, stop=0.9, length=5))
+for param_resolver in study.to_resolvers(sweep):
+     #resolve parameters
+     *line that resolves the symbolic parameters in circuit using param_resolver*
+     #run measurement simulations 
+     measurements = simulator.run(circuit=circuit, repetitions=100)
+
+

Instead of:

+
#set up parametrized circuit
+simulator = cirq.Simulator()
+circuit = cirq.Circuit()
+alpha = sympy.Symbol('alpha')
+beta = sympy.Symbol('beta')
+circuit.append(one_step(alpha, beta))
+circuit.append(cirq.measure(*qubits, key='x'))
+sweep = (cirq.Linspace(key='alpha', start=0.1, stop=0.9, length=5)
+         * cirq.Linspace(key='beta', start=0.1, stop=0.9, length=5))
+for param_resolver in study.to_resolvers(sweep):
+     #resolve parameters and run measurement simulations in one step
+     measurements = simulator.run(circuit=circuit, param_resolver=param_resolver, repetitions=100)
+
+",12417,,55,,6/21/2020 9:43,6/21/2020 21:29,How to assign values to the symbols in a parametrized Cirq circuit without running it?,,1,0,,,,CC BY-SA 4.0 +12548,2,,12540,6/19/2020 7:03,,2,,"

GiannisKol is correct in an abstract sense -- you simply want to specify any unitary matrix with the first column containing elements $(\alpha,\beta,\gamma,\eta)$. You then complete the other columns using any valid assignment (columns must be orthonormal, so you might use the Gram Schmidt procedure). However, there are obviously many options, and you are probably more interested in which of those options gives you a nice gate decomposition.

+

You have a couple of options for ways to proceed. One option is to rewrite the state as +$$ +\sqrt{|\alpha|^2+|\beta|^2}|0\rangle\frac{\alpha|0\rangle+\beta|1\rangle}{\sqrt{|\alpha|^2+|\beta|^2}}+\sqrt{|\gamma|^2+|\eta|^2}|1\rangle\frac{\gamma|0\rangle+\eta|1\rangle}{\sqrt{|\gamma|^2+|\eta|^2}}. +$$ +To me, this instantly suggests one circuit. Start with a single-qubit rotation that rotates the first qubit as +$$ +|0\rangle\rightarrow\sqrt{|\alpha|^2+|\beta|^2}|0\rangle+\sqrt{|\gamma|^2+|\eta|^2}|1\rangle +$$ +Now apply a single qubit rotation on the second qubit that rotates +$$ +|0\rangle\rightarrow\frac{\alpha|0\rangle+\beta|1\rangle}{\sqrt{|\alpha|^2+|\beta|^2}} +$$ +Now, all you need is a controlled-$U$, controlled off the first qubit, targeting the second, where $U$ rotates +$$ +\frac{\alpha|0\rangle+\beta|1\rangle}{\sqrt{|\alpha|^2+|\beta|^2}}\rightarrow \frac{\gamma|0\rangle+\eta|1\rangle}{\sqrt{|\gamma|^2+|\eta|^2}}. +$$

+

A second method is to make use of the Schmidt decomposition. Using that, you can find that your initial state $|\psi\rangle$ may be written in the form +$$ +|\psi\rangle=U_1\otimes U_2(\delta_0|00\rangle+\delta_1|11\rangle). +$$ +So, if we can produce $\delta_0|00\rangle+\delta_1|11\rangle$, then we just apply $U_1$ on the first quit and $U_2$ on the second, and we'll have made $|\psi\rangle$. How do we do this? Apply a single qubit unitary that rotates +$$ +|0\rangle\rightarrow \delta_0|0\rangle+\delta_1|1\rangle +$$ +on, say, the first qubit. Then apply controlled-not controlled off the first qubit and targeting the second qubit. If you're decomposing your circuit in terms of controlled-not + single-qubit unitaries, this method does that for you automatically, and is clearly optimal in terms of the number of controlled-nots required.

+

You may also be interested in the content of Nielsen's majorization theorem. Part of this is a constructive way to deterministically and locally go from a maximally entangled state to the state you want. Again, it's related to the Schmidt decomposition. So, say you've already produced +$$ +(|00\rangle+|11\rangle)/\sqrt{2}. +$$ +If you perform a generalised measurement with elements +$$ +M_0=\delta_0|0\rangle\langle 0|+\delta_1|1\rangle\langle 1|,\qquad M_1=\delta_1|0\rangle\langle 0|+\delta_0|1\rangle\langle 1| +$$ +on one qubit, then if you get the 0 answer, you've produced the state you want. If you get the 1 answer, both qubits need $X$ applying. Then, finally, you apply $U_1\otimes U_2$.

+",1837,,1837,,6/19/2020 7:18,6/19/2020 7:18,,,,0,,,,CC BY-SA 4.0 +12549,2,,12540,6/19/2020 8:24,,0,,"

You can prepare any arbitrary state with method described in Transformation of quantum states using uniformly controlled rotations.

+

The method is based on application of $Ry$ rotation for setting amplitudes and $Rz$ rotations for setting phases.

+

The method is able to transform any state $|\psi_0\rangle$ to another one $|\psi_1\rangle$ with intermediate step of transforming $|\psi_0\rangle$ to $|0\rangle^{\otimes n}$. So in practise, only part transforming $|0\rangle^{\otimes n}$ to $|\psi_1\rangle$ is probably relevant as state $|0\rangle^{\otimes n}$ is usually initial state of quatum registers.

+",9006,,,,,6/19/2020 8:24,,,,0,,,,CC BY-SA 4.0 +12550,1,12551,,6/19/2020 8:32,,1,1814,"

I think it is a bug but I'm not really sure. Basically, what I'm trying to do is the following: I have an Oracle Instruction which I want to append to my QuantumCircuit, looks as follows:

+
# initialising registers for readability
+[control, train_register] = circ.qregs
+
+circ.h(control)
+
+# create and append oracle
+oracle = create_oracle(train_register, control)  # returns an Instruction
+circ.append(oracle, [train_register, control])
+
+

If my train_register and control are both QuantumRegisters with length 1, this works perfectly fine. But I want to make this work for variable length of these registers, I get the error qiskit.circuit.exceptions.CircuitError: 'The amount of qubit arguments does not match the instruction expectation.'.

+

This is logical, since this error occurs because qiskit checks the length of my provided qargs in QuantumCircuit.append(), and I provided two registers in a list with both one qubit, so the length of the list happens to be the same as the number of qubits.

+

However, I want this to work for variable length. If I know what the length of my QuantumRegisters are, say len(train_register) is 3 and len(control) is 1 I can use

+
circ.append(oracle, [0, 1, 2, 3])
+
+

Or to make it work for unspecified lengths, I can write something like:

+
indices_to_append_to = list(np.arange(len(train_register) + len(control)))
+circ.append(oracle, indices_to_append_to)
+
+

But I just really like the idea of just plugging in the names of the qregs as qargs. Is there something to make this work like that?

+",12194,,55,,6/21/2020 9:44,6/21/2020 9:44,How to append an Instruction to a QuantumCircuit with variable length of QuantumRegisters as qargs?,,1,0,,,,CC BY-SA 4.0 +12551,2,,12550,6/19/2020 8:49,,4,,"

If you pass a list of qubits instead of a list of register this works. For this do

+
circ.append(oracle, train_register[:] + control[:])
+
+

where train_register and control are QuantumRegisters.

+",9800,,,,,6/19/2020 8:49,,,,1,,,,CC BY-SA 4.0 +12552,1,12558,,6/19/2020 10:53,,1,331,"

I have a circuit that generates a 4 qubit linear cluster.

+

The steps i understand are

+
    +
  1. Initialize the 4 qubits to $|0000\rangle$.

    +
  2. +
  3. Apply Hadamard $H$ on all.

    +
  4. +
  5. Then apply a controlled $Z$ gate .

    +
  6. +
+

All this is clear, but what is not clear to me is

+
    +
  1. What are the two Hadamards doing on wire 1 and 4? what does this mean?
  2. +
+

At the end of the circuit we get the state as $$|a\rangle=\frac{1}{2}(|0000\rangle+|0011\rangle+|1100\rangle-|1111\rangle)$$ +Can somebody explain the two hadamards to me?

+",6070,,55,,7/14/2020 16:55,7/14/2020 16:55,Quantum Circuit explaination,,2,1,,,,CC BY-SA 4.0 +12554,1,,,6/19/2020 12:00,,2,52,"

Assuming I have a state +$$|x\rangle = \frac{1}{\sqrt{n}}\sum_n |x_n\rangle$$ +where $|x_n\rangle$ are quantum state vectors +$$|x_n\rangle = \frac{1}{\|x_n\|}\sum_i x_{in}|i\rangle$$ +and that I have a unitary $U:|x_n\rangle \mapsto e^{2\pi i\theta_n}|x_n\rangle$ such that I can use the phase estimation procedure to get the state +$$|x\rangle = \frac{1}{\sqrt{n}}\sum_n |x_n\rangle|\theta_n\rangle$$

+

Question: +I am wondering whether there is a way to compute the state +$$|x\rangle = \frac{1}{\sqrt{n}}\sum_n |x_n\rangle|n\rangle$$ +I was thinking to modify the Phase Estimation Algorithm, but I still find it difficult to understand if I can prepare a unitary $U = \sum_n e^{2\pi in}|x_n\rangle\langle x_n|$ for instance.
+I am not insterested in ordering the vectors $|x_n\rangle$ in any way, I just wonder if there is a way to index them easily. +I don't know if this problem has been raised before in literature and I don't know where to look at. I'd be glad if someone had some insights.

+",10259,,55,,6/21/2020 9:47,7/22/2020 9:00,"Indexing an ""unknown"" quantum state",,1,2,,,,CC BY-SA 4.0 +12555,2,,12542,6/19/2020 13:00,,3,,"

This is part of the Graph Coloring Kata. The InitializeColor is an operation that you must implement. The code above is part of the checker code to confirm the working of the implementation.

+

The code is used to check if the InitializeColor operation is implemented correctly. It is supposed to take an input C denoting the color as an non-negative integer. It is supposed to apply a unitary to convert the state $|000...0\rangle$ to state denoted by LittleEndian encoding of $|C\rangle$.

+

The InitializeColor operation is supposed to take a register which is in the state $|0..0\rangle$ and applies a Unitary which transforms it into a register in the state $|C\rangle$. The nextline measures the register using the MultiM operation. +The Fact function essentially confirms if the measured result in the state $|C\rangle$ and if not it print the error statement. The last line resets the register and brings it back to the state $|000..0\rangle$.

+

An example can be with $C=2$ and $N=4$. Then InitializeColor should apply a Unitary Operation which transform $|0000\rangle$ into $|0100\rangle$ assuming LittleEndian encoding or $|0010\rangle$ assuming BigEndian encoding.

+",8757,,8757,,6/19/2020 13:05,6/19/2020 13:05,,,,0,,,,CC BY-SA 4.0 +12556,2,,9408,6/19/2020 13:22,,0,,"

I think that sending in advance entangled qubits does not solve the issue: actually, the problem is produced by the fact that in telecommunication systems it would be necessary to share (and store) in advance an “infinite” number of entangled qubits! Which is practically without sense.

+",12357,,,,,6/19/2020 13:22,,,,0,,,,CC BY-SA 4.0 +12557,1,12559,,6/19/2020 13:57,,4,157,"

Define $|\psi^{00}\rangle = \frac{1}{\sqrt2}(|00\rangle + |11\rangle)$ and $|\psi^{01}\rangle = \frac{1}{\sqrt2}(|00\rangle - |11\rangle)$, and consider the state +$$ |0\rangle\langle 0|^C\otimes |\psi^{00}\rangle\langle\psi^{00}|^{AB} + |1\rangle\langle 1|^C\otimes |\psi^{01}\rangle\langle\psi^{01}|^{AB}, $$ +where the subsystems are distributed among three parties Alice, Bob and Charlie. Is it possible for Alice and Bob to extract Charlies bit through LOCC?

+

Essentially, I am asking if Bell states are locally distinguishable. If we consider $|\psi^{00}\rangle$ and $|\psi^{10}\rangle = \frac{1}{\sqrt2}(|01\rangle + |10\rangle)$, it is easy to see they are indeed locally distinguishable, but I have not been able to come up with a measurement that reveals the phase.

+

Any help is appreciated.

+",12421,,55,,10/8/2020 17:54,10/8/2020 17:54,Are Bell states distinguishable through LOCC?,,2,1,,,,CC BY-SA 4.0 +12558,2,,12552,6/19/2020 14:16,,2,,"

We need to go throught the gates one by one to understand what's happening. +We have to keep a few things in mind.

+
    +
  1. $H|0\rangle=\frac{1}{\sqrt2}(|0\rangle + |1\rangle) = |+\rangle$ and $H|1\rangle=\frac{1}{\sqrt2}(|0\rangle - |1\rangle) = |-\rangle$.
  2. +
  3. In the Hadamard basis the $Z$ gate acts like the $X$ gate. Namely $Z|+\rangle=|-\rangle$ and $Z|-\rangle=|+\rangle$.
  4. +
  5. The controlled Z gate $cZ$ does the following here $cZ|0\rangle \otimes |\pm\rangle = |0\rangle \otimes |\pm\rangle$ and $cZ|1\rangle \otimes |\pm\rangle = |1\rangle \otimes |\mp\rangle$.
  6. +
+

Now we start in the state $|0000\rangle$ and this gets converted to $|++++\rangle$ by the first column of Hadamard. Lets focus on the first 2 qubits. The $cZ$ gate takes the state +$|++\rangle = \frac{1}{\sqrt2}(|0\rangle + |1\rangle)|+\rangle$ and transforms it into

+

$$cZ\frac{1}{\sqrt2}(|0\rangle + |1\rangle)|+\rangle = \frac{1}{\sqrt2}(|0\rangle \otimes |+\rangle + |1\rangle \otimes |-\rangle) = \frac{1}{\sqrt2}(|+\rangle \otimes |0\rangle + |-\rangle \otimes |1\rangle)$$

+

The last expression can be derived using a expanding and rearranging of the terms.

+

We now move onto the 2nd $cZ$ gate which is applied on the 2nd and 3rd qubit. Remember the 3rd and 4th qubit both are still in $|+\rangle$ state. Application of the next $cZ$ state can be written as follows.

+

$$I \otimes cZ\frac{1}{\sqrt2}(|+\rangle \otimes |0\rangle + |-\rangle \otimes |1\rangle)|+\rangle \\ += \frac{1}{\sqrt2}(I|+\rangle \otimes cZ|0\rangle|+\rangle + I|-\rangle \otimes cZ|1\rangle|+\rangle) \\ += \frac{1}{\sqrt2}(|+\rangle|0\rangle|+\rangle + |-\rangle|1\rangle|-\rangle) \\ += \frac{1}{2}(|+\rangle|0\rangle|0\rangle + |+\rangle|0\rangle|1\rangle + +|-\rangle|1\rangle|0\rangle - |-\rangle|1\rangle|1\rangle) \\ += \frac{1}{2}\big((|+\rangle|0\rangle + |-\rangle|1\rangle) \otimes |0\rangle ++ (|+\rangle|0\rangle - |-\rangle|1\rangle) \otimes |1\rangle)\big)$$

+

We now apply the final $cZ$ gate on the 3rd and 4th qubits. Remember the 4th qubit is still in $|+\rangle$ state. +$$I \otimes I \otimes cZ \frac{1}{2}\big((|+\rangle|0\rangle + |-\rangle|1\rangle) \otimes |0\rangle + (|+\rangle|0\rangle - |-\rangle|1\rangle) \otimes |1\rangle)\big) \otimes |0\rangle \\ += \frac{1}{2}\big((|+\rangle|0\rangle + |-\rangle|1\rangle) \otimes cZ|0\rangle|+\rangle + (|+\rangle|0\rangle - |-\rangle|1\rangle) \otimes cZ|1\rangle|+\rangle)\big) \\ += \frac{1}{2}\big((|+\rangle|0\rangle + |-\rangle|1\rangle) \otimes |0\rangle|+\rangle + (|+\rangle|0\rangle - |-\rangle|1\rangle) \otimes |1\rangle|-\rangle)\big) \\ += \frac{1}{2}\big(|+\rangle|0\rangle|0\rangle|+\rangle + |-\rangle|1\rangle|0\rangle|+\rangle ++ |+\rangle|0\rangle|1\rangle|-\rangle - |-\rangle|1\rangle|1\rangle|-\rangle\big)$$

+

Now the final step is the application of the 2 $H$ gates on 1st and 4th qubit. From the final expression above, we can clearly see that only the 1st and 4th qubit are in Hadamard basis. Hence to convert them back to computational basis we apply $H$ again.

+

Finally after applying $H$ on these qubits we get +$$\frac{1}{2}H\otimes I \otimes I \otimes H\big(|+\rangle|0\rangle|0\rangle|+\rangle + |-\rangle|1\rangle|0\rangle|+\rangle ++ |+\rangle|0\rangle|1\rangle|-\rangle - |-\rangle|1\rangle|1\rangle|-\rangle\big) \\ += \frac{1}{2}\big(|0\rangle|0\rangle|0\rangle|0\rangle + |1\rangle|1\rangle|0\rangle|0\rangle ++ |0\rangle|0\rangle|1\rangle|1\rangle - |1\rangle|1\rangle|1\rangle|1\rangle\big) \\ += \frac{1}{2}\big(|0000\rangle + |1100\rangle + |0011\rangle - |1111\rangle\big)$$

+

This is the exact answer as you said the circuit would give. Hence I suppose the purpose of the $H$ is to convert the 1st and 4th qubits back into computational basis.

+

I hope this answer's your question.

+",8757,,,,,6/19/2020 14:16,,,,1,,,,CC BY-SA 4.0 +12559,2,,12557,6/19/2020 14:33,,2,,"

If you look at these states in the $X$ basis, they are +$$ +|++\rangle+|--\rangle,\qquad |+-\rangle+|-+\rangle. +$$ +Thus, by both measuring in the $X$ basis and computing the parity of the answers, you can tell $C$'s bit value.

+",1837,,,,,6/19/2020 14:33,,,,0,,,,CC BY-SA 4.0 +12560,2,,12557,6/19/2020 14:49,,1,,"

We can distinguish these states using SingleQubit Unitaries and Measurements.

+

Lets the 2 states be $|\psi^{00}\rangle = \frac{1}{\sqrt2}(|00\rangle + |11\rangle)$ and $|\psi^{01}\rangle = \frac{1}{\sqrt2}(|00\rangle - |11\rangle)$. Let Alice be in possession of the 1st qubit and Bob be in possession of the 2nd qubit.

+

Bob applies a $H$ gate on his qubit. This would result in the following states +$$I \otimes H|\psi^{00}\rangle = \frac{1}{\sqrt2}(|0\rangle \otimes |+\rangle + |1\rangle \otimes |-\rangle) += \frac{1}{\sqrt2}(|0\rangle|+\rangle + |1\rangle|-\rangle) += \frac{1}{\sqrt2}(|+\rangle|0\rangle + |-\rangle|1\rangle)$$

+

$$I \otimes H|\psi^{01}\rangle = \frac{1}{\sqrt2}(|0\rangle \otimes |+\rangle - |1\rangle \otimes |-\rangle) += \frac{1}{\sqrt2}(|0\rangle|+\rangle - |1\rangle|-\rangle) += \frac{1}{\sqrt2}(|-\rangle|0\rangle + |+\rangle|1\rangle)$$

+

Now Bob performs a measurement on his qubit. +If the initial state was $|\psi^{00}\rangle$ then the result of the measurement could be $|0\rangle$ or $|1\rangle$ and Alice's qubit would be $|+\rangle$ or $|-\rangle$ respectively.

+

Similarly, if the initial state was $|\psi^{01}\rangle$ then the result of the measurement could be $|0\rangle$ or $|1\rangle$ and Alice's qubit would be $|-\rangle$ or $|+\rangle$ state respectively.

+

Now Alice can apply the $H$ gate on her qubit and then perform a Measurement on it. +If Bob's and Alice's results were $(0,0)$ or $(1,1)$ then the initial state was $|\psi^{00}\rangle$. On the other hand if Bob's and Alice's results were $(0,1)$ or $(1,0)$ then the initial state was $|\psi^{01}\rangle$.

+

Hence we can now formulate an Algorithm for distinguishing the phase.

+
    +
  1. Bob applies $H$ gate on his qubit.
  2. +
  3. Bob performs a measurement and sends the result of the measurement to Alice.
  4. +
  5. Alice applies $H$ gate on her qubit.
  6. +
  7. Alice performs a measurement and sends the result of the measurement to Bob.
  8. +
  9. Now if their results were the same then the state was $|\psi^{00}\rangle$ else it was $|\psi^{01}\rangle$
  10. +
+",8757,,,,,6/19/2020 14:49,,,,0,,,,CC BY-SA 4.0 +12563,1,12577,,6/19/2020 16:26,,1,67,"

On page 560, it states that

+

$$C^{(1)} \geq S(\frac{\varepsilon(|{\psi}\rangle\langle{\psi}|) +\varepsilon(|{\varphi}\rangle\langle{\varphi}|)}{2} - \frac{1}{2}\varepsilon(|{\psi}\rangle\langle{\psi}|)-\frac{1}{2}\varepsilon(|{\varphi}\rangle\langle{\varphi}|)).$$

+

However, shouldn't this be

+

$$C^{(1)} \geq S(\frac{\varepsilon(|{\psi}\rangle\langle{\psi}|) +\varepsilon(|{\varphi}\rangle\langle{\varphi}|)}{2} - \frac{1}{2}S(\varepsilon(|{\psi}\rangle\langle{\psi}|))-\frac{1}{2}S(\varepsilon(|{\varphi}\rangle\langle{\varphi}|)).$$

+

as on the same page it states that if $\varepsilon(|{\psi_{j}}\rangle\langle{\psi_{j}}|) = p|{\psi_{j}}\rangle\langle{\psi_{j}}|+(1-p)\frac{I}{2}$ then $S(\varepsilon(|{\psi_{j}}\rangle\langle{\psi_{j}}|)) = H(\frac{1+p}{2})$, so $C(\varepsilon)=1-H(\frac{1-p}{2})$, which can't come about unless it's the entropy of the two states, not just the channel acting on them, or am I misreading this completely?

+",4991,,55,,10/8/2020 17:54,10/8/2020 17:54,Confusion over HSW theorem depicted in Nielsen and Chuang,,1,1,,,,CC BY-SA 4.0 +12564,1,,,6/19/2020 16:56,,4,242,"

How do I optimize HHL algorithm in Qiskit?

+

I tried to follow this tutorial on HHL in Qiskit. My project requires solving a very specific type of linear equations $Ax=b$ like the one below.

+
b = np.array( [ 0.   ,  0.   ,  2.25 ,  0.   ,  0.   ,  0.   , -4.285,  0.   ])
+A = np.array([[ 1.   ,  0.333,  0.   ,  0.   ,  0.   ,  0.   ,  0.   ,  0.   ],
+              [ 0.   ,  1.   ,  0.   ,  0.   ,  0.   ,  0.   ,  0.   ,  0.   ],
+              [ 0.   ,  0.   ,  1.   ,  0.   ,  0.   ,  0.   ,  0.   ,  0.   ],
+              [ 0.   ,  0.   ,  0.143,  1.   ,  0.   ,  0.   ,  0.   ,  0.   ],
+              [-0.333, -1.   ,  0.   ,  0.   ,  1.   ,  0.333,  0.   ,  0.   ],
+              [-0.25 , -1.5  , -0.25 ,  0.   ,  0.   ,  1.   ,  0.   ,  0.   ],
+              [ 0.   , -0.562, -0.875, -0.562,  0.   ,  0.   ,  1.   ,  0.   ],
+              [ 0.   ,  0.   , -1.   , -0.143,  0.   ,  0.   ,  0.143,  1.   ]])
+
+

However, I only obtain a fidelity of around 0.7 - 0.8, which is not good enough for what I would like to do.

+

I notice the tutorial has a function called create_eigs with input parameters num_ancillae, num_time_slices, negative_evals.

+
def create_eigs(matrix, num_ancillae, num_time_slices, negative_evals):
+    ...
+
+

What are they really? And what are their appropriate values?

+",9903,,55,,6/21/2020 9:49,9/22/2020 17:55,How do I optimize HHL algorithm in Qiskit?,,1,0,,,,CC BY-SA 4.0 +12566,2,,12552,6/19/2020 19:11,,2,,"

Because $CNOT = I\otimes H \cdot CZ \cdot I\otimes H$ as was mentioned here, and because $CZ(q_1, q_2) = CZ(q_2, q_1)$, we can rewrite the circuit in this way (by adding Hadamards as needed):

+ +

The link to the circuit created with Quirk. As one can see from the circuit above, after the first Hadamard gate and two $CNOT$ gates, we will have a GHZ state for the first three qubits:

+

$$|\psi_1 \rangle = \frac{1}{\sqrt{2}} \left( |000\rangle + |111\rangle\right) |0\rangle$$

+

After the Hadamard gate:

+

$$|\psi_2 \rangle = \frac{1}{2} \big( | 000 \rangle + | 001 \rangle + | 110 \rangle - | 111 \rangle \big) |0\rangle$$

+

And after the final $CNOT$ gate:

+

$$|\psi_3 \rangle = \frac{1}{2} \big( | 0000 \rangle + | 0011 \rangle + | 1100 \rangle - | 1111 \rangle \big)$$

+",9459,,,,,6/19/2020 19:11,,,,3,,,,CC BY-SA 4.0 +12567,1,,,6/19/2020 19:48,,-1,362,"

You are given an operation that implements a single-qubit unitary transformation: either the Rz gate or the R1 gate. The operation will have Adjoint and Controlled variants defined.

+

Your task is to perform necessary operations and measurements to figure out which unitary it was and to return 0 if it was the Rz gate or 1 if it was the R1 gate.

+",12425,,9006,,6/24/2020 7:46,6/24/2020 7:46,Difference between $Rz$ and $R1$ gate,,1,3,,6/24/2020 15:40,,CC BY-SA 4.0 +12568,1,,,6/19/2020 21:36,,1,60,"

I am trying to design a model using Q#'s machine learning library that takes in two features (real numbers from 0 to 1) and classifies as 0 or 1.

+

So how do I decide which Rotations and what seeds to use?

+
ControlledRotation((0, new Int[0]), PauliY, 0)
+
+

I tried using this as the rotation gate but it gave an inaccurate model for many different seed values.

+

I also tried combining gates:

+
ControlledRotation((0, new Int[0]), PauliY, 0),
+ControlledRotation((0, new Int[0]), PauliX, 1)
+
+

but this also gave an inaccurate model.

+

There must surely be a way to analyse what kind of gates to use and not just trial and error. +What kind of analysis would be appropriate?

+",12355,,55,,6/21/2020 9:50,6/21/2020 9:50,How do you decide which rotations to use in a Quantum Machine Learning model?,,0,2,,,,CC BY-SA 4.0 +12569,1,12570,,6/20/2020 3:38,,2,822,"

In two dimensions, for a density operator $\rho$ and probability $\lambda$, a depolarizing channel can be written as:

+

$$\mathcal{E}(\rho) = (1-\lambda) \frac{\mathbb{I}}{2} + \lambda\rho$$

+

In wikipedia page about Quantum depolarizing channel, it is mentioned that this channel can be viewed as a completely positive trace preserving (CPTP) map. But there is no reference about how to prove this statement? It only says that the range of $\lambda$ should be: +$$ +-\frac{1}{d^2 - 1} \le \lambda \le 1 +$$ +Any pointers about how to prove that a depolarizing channel is CPTP?

+",2403,,491,,7/17/2020 23:22,7/17/2020 23:22,Prove that the depolarizing channel is completely positive,,2,0,,,,CC BY-SA 4.0 +12570,2,,12569,6/20/2020 4:03,,2,,"

Ok, so starting with Trace Preserving, since it's easier:

+

$$Tr(I/2) = 1$$ +$$Tr(\rho) = 1$$ +$$Tr((1-\lambda)I/2 + \lambda\rho) = (1-\lambda)Tr(I/2) + \lambda Tr(\rho) = 1$$

+

Now for a map to be completely positive, it must take positive elements to positive elements. So since depolarizing noise is essentially just adding in a bit of the identity operator (who's eigenvalues are all 1, which is positive), and all vectors are eigenvectors of the identity operator, any vector which previously had some eigenvalue $\Lambda_0$ now has eigenvalue $\lambda\Lambda_0 + \frac{(1-\lambda)}{2}$ which will also be positive.

+

So since it preserves positivity and trace, its CPTP.

+",3056,,,,,6/20/2020 4:03,,,,2,,,,CC BY-SA 4.0 +12571,1,,,6/20/2020 4:08,,4,445,"

After reading about using quantum gates instead of ancillas, it asserts that every quantum circuit has a square root. Theoretically, they do, but is there a practical method to generate the quantum circuit of the square root of arbitrary gates? Specifically, I'm interested in knowing if +$$\sqrt[2^k]{QFT}$$ +Has a concise, practical representation as a quantum circuit. Besides from diagonalizing the matrix by hand and then using the sledgehammer of quantum circuits for arbitrary isometries, i see no other possible method.

+

Wikipedia says: "Squared root-gates can be constructed for all other gates by finding a unitary matrix that, multiplied by itself, yields the gate one wishes to construct the squared root gate of. All rational exponents of all gates can be found similarly" but provides no proof or associated reference to that claim.

+

Help and insights are greatly appreciated.

+",12430,,55,,6/21/2020 9:54,6/22/2020 17:53,How to find a circuit for the roots of QFT?,,2,0,,,,CC BY-SA 4.0 +12572,1,12818,,6/20/2020 4:16,,2,58,"

When observing the Hadamard gate it is simply a transformation matrix. I am wondering if there is functionality to hard code an arbitrary transformation matrix and its family members up till $m \times n$ size depending on the limitations of the simulation. From here I would like the hard coded gate to transform my register of qubits.

+",12239,,55,,6/21/2020 9:54,7/7/2020 21:24,Is it possible to create a gate in Q# that is dictated by a matrix?,,1,0,,,,CC BY-SA 4.0 +12573,2,,12520,6/20/2020 4:21,,1,,"

In VS code, you have to manually add the package in the .csproj file under Item Group:

+
<PackageReference Include="Microsoft.Quantum.MachineLearning" Version="0.11.2006.403" />
+
+

or alternatively, you can also add it in the terminal:

+
dotnet add [project_name].csproj package Microsoft.Quantum.MachineLearning
+
+",9906,,,,,6/20/2020 4:21,,,,0,,,,CC BY-SA 4.0 +12574,1,12612,,6/20/2020 5:07,,1,95,"

I would like to create a set of basis qubits. For example if I have $n=2$ I should get 4 states being 01 10 11 00. Generalized for $2^n$. Is there a way to do this in Q#?

+",12239,,55,,6/21/2020 9:55,6/22/2020 19:49,How can I create a basis state of $n$ qubits in Q#?,,2,1,,,,CC BY-SA 4.0 +12577,2,,12563,6/20/2020 8:36,,2,,"

Adding my comment as an answer: I think this is a typo. The equation contains a scalar, namely $S(\cdot)$ and an operator, the output of the channel $\mathcal{E}(\cdot)$ in linear combination (their dimensions do not match). Therefore, this has to be a typo (there are no hidden Identity operators in the scalar terms as is easy to check).

+",1108,,,,,6/20/2020 8:36,,,,1,,,,CC BY-SA 4.0 +12578,2,,12569,6/20/2020 8:58,,2,,"

Here's an alternative proof: first note that any quantum map, $\Phi(\rho) \mapsto \sigma$ that can be written in the Kraus form, that is, as $\Phi(\cdot) = \sum_{j} K_j (\cdot) K_j^\dagger$, with, $K_j^\dagger K_j \geq 0, \sum_j K_j^\dagger K_j = \mathbb{I}$ is a CP map (see for example, Nielsen and Chuang, or Page 26 of https://arxiv.org/abs/1902.00967). This is also the "usual" way to prove CP-ness: find a set of Kraus operators for the map $\Phi$ that satisfy the above condition. Also, note that the TP part is straightforward since you can just take the trace of $\mathcal{E}(\rho)$ and show that is it $1$.

+

Now, note that $\rho+X \rho X+Y \rho Y+Z \rho Z=2 I$, therefore, +$$ \Phi(\rho) = \left( 1- \lambda \right) \frac{1}{4} \left( \rho+X \rho X+Y \rho Y+Z \rho Z \right) + \lambda \rho = \frac{1}{4} \left(1 + 3\lambda \right) \rho + \frac{(1- \lambda)}{4} \left(X \rho X+Y \rho Y+Z \rho Z \right). $$ +Then, we can see that the Kraus operators are $K_{0} = \frac{1}{2} \sqrt{1 + 3 \lambda} \mathbb{I}$ and $K_{i} = \frac{1}{2} \sqrt{(1- \lambda)} \sigma_{i}$, $i=1,2,3$, where $\{ \sigma_{i} \}$ are the sigma matrices. Hence this map is CP because it has a Kraus representation.

+

Note: The Kraus operator form also reveals why in $d=2$, the limit for CP is $-1/3 \leq \lambda \leq 1$ (note the square roots in the Kraus representation). This can be generalized to $d$-dimensions.

+",1108,,1108,,6/21/2020 20:02,6/21/2020 20:02,,,,0,,,,CC BY-SA 4.0 +12580,1,12595,,6/20/2020 9:45,,1,46,"

I am searching for articles/books about the measurement energy of Hamiltonians in adiabatic quantum computing. Do you know of any good resources?

+",9842,,55,,6/21/2020 10:08,6/22/2020 0:10,Books about the measurement for Hamiltonian Energy,,1,0,,,,CC BY-SA 4.0 +12581,2,,12574,6/20/2020 11:56,,1,,"

To get a superposition of all the possible states, each qubit has an equal probability of being a 0/1. +So you apply a Hadamard gate to each qubit.

+

In Q# :

+
using(qubits = Qubit[N])
+{
+    for(q in qubits)
+    {
+        H(q);
+    }
+    // Now the qubits are in a superposition of all possible states.
+}
+
+",12355,,,,,6/20/2020 11:56,,,,0,,,,CC BY-SA 4.0 +12583,2,,1577,6/20/2020 20:42,,3,,"

All three of the bulleted or numbered claims in your OP are correct. But the flaw in your logic in combining them together is that D-Wave is not a "universal" quantum annealer, in the sense that it can't operate perfectly at all "temperatures"/levels of adiabaticity. In other words, it can (allegedly) perform some types of quantum annealing, but not all of them.

+

In particular, it can't perform the most useful form of quantum annealing of all - the perfectly adiabatic case ("zero temperature"/no quantum fluctuations out of the ground state). If it could, then it would indeed be (equivalent to) a universal quantum computer.

+",551,,,,,6/20/2020 20:42,,,,0,,,,CC BY-SA 4.0 +12584,1,,,6/20/2020 21:08,,4,64,"

Quantum annealing can be considered either in the perfectly adiabatic "slow" limit (in which case it's usually referred as "adiabatic quantum computing" (AQC) instead of "quantum annealing"), or in the diabatic regime of diabatic quantum annealing (DQA).

+

If you ignore all experimental practicalities and consider a theoretical perfect quantum annealer that can operate at any speed without decohering, then my intuition is that the perfectly adiabatic version would be the most theoretically powerful, in the sense that it can solve any problem faster than the diabatic version.

+

On the other hand, I could also imaging telling a heuristic story in which in some cases the diabatic effects can help, by either (a) simply allowing you to tune your transverse field qualitatively faster than possible if you need to maintain adiabaticity, or (b) taking advantage of quantum fluctuations out of the ground state to tunnel through some intermediate excited states that end up taking you to the final ground state faster than if you stayed in the ground state the whole time.

+

Are either of these two intuitions known to be correct? That is, is it known or suspected which of these three claims is correct from the perspective of theoretical computational complexity?

+
    +
  1. For all problems, AQC is at least as powerful as DQA.
  2. +
  3. For all problems, DQA is at least as powerful as AQC.
  4. +
  5. For some problems, AQC gives a qualitative speedup over DQA, and for other problems, DQA gives a qualitative speedup over AQC.
  6. +
+",551,,,,,6/20/2020 21:08,Is either the adiabatic or the diabatic version of quantum annealing known to be theoretically more powerful than the other?,,0,3,,,,CC BY-SA 4.0 +12585,1,12591,,6/20/2020 23:14,,5,369,"

I was wondering in how to interpret and represent the operator $e^{-i\theta(I-Z_1\otimes Z_2 \otimes Z_3)}$ for a 3 qubit system in a circuit using qiskit.

+

I was thinking I could just perform an individual $\theta$ degree rotation about each qubit Z axis but what about the identity? $e^{-i\theta I} = \begin{bmatrix} +e^{-i \theta } & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ +0 & e^{-i\theta}& 0 & 0 & 0 & 0 & 0 & 0\\ + 0 & 0 & e^{-i\theta} & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & e^{-i\theta} & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & e^{-i\theta} & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 &e^{-i\theta} & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 &e^{-i\theta} & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & e^{-i\theta} +\end{bmatrix} $

+

I can construct this operator with the identity operator in 2 qubits and one identity with a global phase $e^{-i\theta}$. Isn't this just an identity with a global phase factor?

+",12302,,9459,,6/21/2020 13:43,7/9/2020 22:37,Representation of rotation operators $e^{-i\theta(I-Z_1\otimes Z_2 \otimes Z_3)}$ about arbitrary axis for $3$ qubits,,2,1,,,,CC BY-SA 4.0 +12587,2,,12585,6/21/2020 1:07,,3,,"

You're right, that this factor can be separated as an operation that applies a global phase factor. Matrix exponentiation is distributive over an additive argument if and and only if the additive terms commute. The identity operator and the scalar $-i\theta$, which can incidentally be though of as a constant of the gate design, commute with all unitary gates. Hence, we can think of this as the application of two gates, $e^{-i\theta I}$ and $e^{i\theta Z_1 Z_2 Z_3}$, to the quantum register in either order of application, applied by successive left multiplication on the initial quantum register "ket" in this case, from rightmost term.

+

Further, a global phase factor does not change the expectation values of Hermitian observables. Hence, I can think of no physically measurable reason this factor need not be dropped entirely from the circuit, (except classical simulator bookkeeping).

+

However, if this operator is controlled by any number of control qubits, disjoint from the set enumerated by your $Z_n$ operators, then the application of the phase factor is logically conditioned on these control bits being "true." Since the phase factor wouldn't be applied to basis states where the control bits are "false," the phase factor would no longer be "global" in that case, (i.e. equal down the diagonal of the operator matrix,) and the phase factor then affects Hermitian expectation values, and it must be included. The phase factor still commutes with your $Z_n$ operators, though, so your matrix exponentiation still distributes.

+",7595,,7595,,7/9/2020 22:37,7/9/2020 22:37,,,,5,,,,CC BY-SA 4.0 +12589,2,,12534,6/21/2020 7:17,,0,,"

If your circuit is a component of a larger circuit then global phase may matter. See relevant discussions in https://github.com/Qiskit/qiskit-aer/issues/353 and https://github.com/Qiskit/qiskit-terra/issues/3083.

+",7659,,,,,6/21/2020 7:17,,,,1,,,,CC BY-SA 4.0 +12590,2,,9428,6/21/2020 8:05,,2,,"

While the URL of the API actually changed, it looks like all methods have remained the same. You can find a list of such methods in Practical Quantum Computing for Developers by Vladimir Silva, starting at page 101. Here are some examples of these methods:

+

You have to log to your account:

+
curl -d 'apiToken=API_TOKEN' 'https://api.quantum-computing.ibm.com/api/users/loginWithToken'
+
+

where the API_TOKEN can be copied from your account information.

+

The answer to this request will give you four fields id, ttl, created and userId. The id field will be referred to below as ACCESS_TOKEN while userId will be referred to as USER_ID.

+

Thus:

+
    +
  • list of all backends:

    +
    curl 'https://api.quantum-computing.ibm.com/api/Backends?access_token=ACCESS_TOKEN'
    +
    +
  • +
  • personal infos:

    +
    curl 'https://api.quantum-computing.ibm.com/api/users/USER_ID?access_token=ACCESS_TOKEN'
    +
    +
  • +
  • latest experiences:

    +
    curl 'https://api.quantum-computing.ibm.com/api/users/USER_ID/codes/latest?access_token=ACCESS_TOKEN&includeExecutions=true'
    +
    +
  • +
+

etc.

+

You may have a look at my current project ibmq-shell which contains shell aliases for interacting with the API with common tools (curl and jq).

+",12446,,12446,,6/21/2020 9:26,6/21/2020 9:26,,,,0,,,,CC BY-SA 4.0 +12591,2,,12585,6/21/2020 9:41,,5,,"

We can't implement $e^{iZ_1 \otimes Z_2 \otimes Z_3 \theta}$ with three separate rotations. In other words:

+

$$e^{iZ_1 \otimes Z_2 \otimes Z_3 \theta} \ne e^{i Z_1 \theta} \otimes e^{i Z_2 \theta} \otimes e^{i Z_3 \theta}$$

+

The implementation of this gate can be found in this answer. The $e^{-iI \otimes I \otimes I\theta} = e^{-i\theta} I \otimes I \otimes I$ term is a global phase gate and can be ignored for the case described in the question.

+
+

An implementation with Qiskit:

+
from qiskit import *
+from qiskit.aqua.operators import WeightedPauliOperator
+
+theta = 1.7
+pauli_dict = {'paulis': [{"coeff": {"imag": 0.0, "real": theta}, "label": "ZZZ"},
+                         {"coeff": {"imag": 0.0, "real": -theta}, "label": "III"}
+                         ]
+              }
+operator = WeightedPauliOperator.from_dict(pauli_dict)
+circuit = operator.evolve(evo_time=1).decompose()
+print(circuit)
+
+

The output:

+
q3_0: ──■─────────────────────────■──
+      ┌─┴─┐                     ┌─┴─┐
+q3_1: ┤ X ├──■───────────────■──┤ X ├
+      └───┘┌─┴─┐┌─────────┐┌─┴─┐└───┘
+q3_2: ─────┤ X ├┤ U1(3.4) ├┤ X ├─────
+           └───┘└─────────┘└───┘     
+
+

That coincides with the ideas discussed in this answer ($u1$ and $R_z$ gates are different just by a global phase). Note, that here $e^{-iI\theta}$ is a global phase and can be neglected (as was done in the circuit). However, as was discussed in this answer the controlled-$e^{-i I \theta}$ should be implemented if one needs to construct controlled-$e^{-i H \theta}$, where $H$ is a sum of tensor product terms of Pauli matrices with real coefficients (like $H = I - Z\otimes Z\otimes Z$ in the question's example) and one of the terms is $I$. Also, note that the code presented above works only for such $H$ whose terms commute. For more general cases one should also specify the rest of the arguments of the evolve method in order to implement for example first-order Trotter decomposition.

+",9459,,9459,,6/21/2020 11:58,6/21/2020 11:58,,,,2,,,,CC BY-SA 4.0 +12592,1,12641,,6/21/2020 9:42,,2,50,"

I'm training a model in Q# which has more than 2 features.
+I have trouble understanding the following things:

+
    +
  • How is the data classified based on the qubit states?
  • +
+

For example: If I have only 2 features (and want to classify our input as class A and class B) then only a single qubit would be used.
After measuring if the qubit turns out to be in the 0 state then its class A and in case of 1 its class B (or vice-versa). +

+But now if I have say 4 features then 2 qubits would be used and i could have 4 possible outcomes:

+

$$ +|00\rangle,\quad |01\rangle,\quad |10\rangle,\quad |11\rangle. +$$

+

So how would the data be classified based on these states?

+
    +
  • Also am I correct in thinking that all the qubits are measured or is only 1 qubit measured and classified as class A/B?
  • +
+",12355,,55,,6/25/2020 8:16,6/25/2020 8:16,What's the relationship between output of qubit measurements and classification of data in Quantum Machine Learning?,,1,0,,,,CC BY-SA 4.0 +12593,1,12596,,6/21/2020 11:26,,6,108,"

Disclaimer: I don't understand quantum computing.

+

Given a CNF boolean formula $\phi$ in $n$ variables +and quantum computer with $q$ qubits, what is the +complexity of solving $\phi$ as a function of $n,q$?

+

I am mainly interested when $q$ is polynomial in $n$.

+

Can we get $2^{o(n)}$ (small Oh, Exponential time hypothesis)?

+

I believe on a traditional computer the complexity is $C^n$ +for a constant $C < 2$.

+",12448,,12448,,6/22/2020 16:06,6/23/2020 6:18,State of the art of SAT on a quantum computer,,2,1,,,,CC BY-SA 4.0 +12594,2,,12547,6/21/2020 21:29,,2,,"

You're looking for cirq.resolve_parameters(object, resolver), which returns the object after the parameters have been resolved. For example:

+
import cirq
+import sympy
+
+q = cirq.LineQubit(0)
+s = sympy.Symbol('s')
+
+symbol_op = cirq.X(q)**s
+resolved_op = cirq.resolve_parameters(symbol_op, {s: 0.25})
+print(resolved_op)
+# X**0.25(0)
+
+symbol_circuit = cirq.Circuit(symbol_op, cirq.measure(q))
+resolved_circuit = cirq.resolve_parameters(symbol_circuit, {s: 0.5})
+print(resolved_circuit)
+# 0: ───X^0.5───M───
+
+",119,,,,,6/21/2020 21:29,,,,0,,,,CC BY-SA 4.0 +12595,2,,12580,6/22/2020 0:10,,1,,"

We can find a number of good articles on Hamiltonians in Adiabatic Quantum Computing. Please let me share a few prominent articles here.

+ +",4501,,,,,6/22/2020 0:10,,,,0,,,,CC BY-SA 4.0 +12596,2,,12593,6/22/2020 1:31,,4,,"

This is an open question. People who try to prove $\text{BQP} = \text{NP}$ usually use the SAT formulation, in my experience. But we don't know of any algorithm that addresses the structure of the SAT problem.

+

The best you can do is a naive implementation of a Grover-like amplitude dispersion, which will give you a square-root speedup. (You can read that in the linked discussion on CS stack exchange.)

+",1867,,9006,,6/22/2020 10:07,6/22/2020 10:07,,,,0,,,,CC BY-SA 4.0 +12597,1,,,6/22/2020 1:56,,1,21,"

In the context of superconducting quantum computing measuments, consider the dispersive shift Hamiltonian:

+

$$ H/\hbar = \omega_R a^\dagger a + \frac{1}{2} (\omega_Q + \frac{2g^2}{\Delta} a^\dagger a)\sigma^z $$

+

where we interpret the dispersive shift as a change in the qubit frequency. What happens when we just keep adding photons into the resonator?

+

The first thing I would guess is that the qubit's frequency gets higher and higher, but it doesn't seem to me that it can just get higher indefinitely. So what's the limiting behavior? I once had a quantum computing guy say that the qubit stops affecting the dynamics of the system, and if you were there measuring, you would only notice a resonator.

+

I'm looking to connect that statement to the math. Is it that some assumption we've made to get here breaks down, RWA for example? Why can we just ignore the high-frequency qubit?

+",1867,,9006,,6/22/2020 10:07,6/22/2020 10:07,Many-photon limit of dispersive shift Hamiltionian,,0,0,,,,CC BY-SA 4.0 +12598,1,12599,,6/22/2020 5:10,,1,102,"

Given a single-qubit unitary matrix, can we find the shortest sequence of Clifford + T gates that correspond to that unitary?

+

According to Fast and efficient exact synthesis of single qubit unitaries generated by Clifford and T gates , which is Solovay-Kitaev decomposition, I learned single-qubit decomposition may need $O(\log^{3.97} (1/\delta))$ clifford+T gates with the accuracy $\delta$.

+

And later many optimization is worked on it. +For example: +Synthesis of unitaries with Clifford+T circuits

+

So I want to know if there exists a shortest sequence of Clifford + T gates that correspond to decompose any single-qubit unitary into Clifford+T? +If it existed, what is commonly used in current compiler?

+",11765,,55,,10/5/2020 13:42,10/5/2020 13:42,What is the shortest sequence of decomposition a given single-qubit unitary gate,,1,1,,,,CC BY-SA 4.0 +12599,2,,12598,6/22/2020 7:17,,4,,"

In the abstract of the first paper you cite (which, incidentally, is not Solovay-Kitaev, it's an improvement), they say

+
+

We report an efficient synthesis algorithm, with an exact optimality guarantee on the number of Hadamard and T gates used

+
+

In other words, this is the best that can be done. It yields the shortest possible sequence. This best is $O(\log\frac{1}{\delta})$ Hadamard + T.

+",1837,,,,,6/22/2020 7:17,,,,0,,,,CC BY-SA 4.0 +12600,2,,12571,6/22/2020 7:41,,1,,"

Existence (as mentioned on Wikipedia, for example), is easy, although not necessarily unique. Any unitary can be written as +$$ +U=\sum_ie^{i\theta_i}P_i +$$ +where $P_i$ are projectors such that $\sum_iP_i=1$, and $\theta_i$ is in the range 0 to $2\pi$. Then we have that +$$ +\sqrt{U}=\sum_ie^{i\theta_i/2}P_i. +$$

+

Giving a circuit construction of the gate is an entirely non-trivial matter. There is no simply conversion that you can run on a circuit for a given $U$ to create a circuit for $\sqrt{U}$.

+

One method (even if you don't know anything about the $U$) is that if you can implement $U$ then you can implement controlled-$U$ (just replace all gates with their controlled versions. It's probably overkill, but is guaranteed to work). Then you can use those as part of a phase estimation. Apply a phase on the ancilla system corresponding to half the phase of the original unitary, and then apply the inverse of phase estimation. The details can be found here.

+

One simplification that you can make is that if +$$ +U=VWV^\dagger, +$$ +then +$$ +\sqrt{U}=V\sqrt{W}V^\dagger, +$$ +so if you have your circuit and can find a big section corresponding to $V$, you can remove it and just worry about implementing the square root of the remaining component $W$.

+

You'll notice that I'm not giving a proof that square roots are hard to come up with. It'll vary on a case by case basis. But think about the opposite task of creating integer powers of a unitary. Usually, we cannot do any better than repeated application of the original unitary. Just look at what you get in one of the very few special cases where you can compute higher powers more efficiently: you get Shor's factoring algorithm! (The point being that phase estimation becomes vastly more efficient.) If you could generically do better, you could apply phase estimation to Grover's search and you'd have a faster search algorithm.

+",1837,,,,,6/22/2020 7:41,,,,0,,,,CC BY-SA 4.0 +12601,2,,12554,6/22/2020 8:17,,1,,"

The root of the issue here is how do you map between the values $\theta_n$ and $n$. A priori there is no way of doing this because the values $n$ are a completely abstract labelling. It wouldn't make any difference if I rearranged all the labels $n$.

+

So, you have defined the $n$s to be a particular order that you want. Presumably as part of that, you know how to identify, given a $\theta_n$, what the value of $n$ is. Whatever mental process that you go through to identify it, you need to translate that into a circuit which you would apply on the ancilla register.

+

Incidentally, are the coefficients $x_{in}$ known? If so, you should be able to construct a transformation directly rather than having to use phase estimation.

+",1837,,,,,6/22/2020 8:17,,,,0,,,,CC BY-SA 4.0 +12602,1,12768,,6/22/2020 9:43,,3,256,"

I've trying to measure the phase angle from X axis of a qubit, but unable to find any function in Q# documentation, can anyone help me with this?

+",12454,,9459,,6/22/2020 9:45,7/3/2020 15:47,Finding phase angle in Q#,,1,0,,,,CC BY-SA 4.0 +12603,1,,,6/22/2020 10:14,,1,109,"

I'm trying to install the qiskit_textbook repository (https://github.com/qiskit-community/qiskit-textbook) and I keep getting this error

+
ERROR: Command errored out with exit status 1:
+     command: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/mb/sbqp79dx7zj7jpd6mfc1vdbh0000gn/T/pip-req-build-gqjhv69q/setup.py'"'"'; __file__='"'"'/private/var/folders/mb/sbqp79dx7zj7jpd6mfc1vdbh0000gn/T/pip-req-build-gqjhv69q/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/mb/sbqp79dx7zj7jpd6mfc1vdbh0000gn/T/pip-pip-egg-info-wn16yzlv
+         cwd: /private/var/folders/mb/sbqp79dx7zj7jpd6mfc1vdbh0000gn/T/pip-req-build-gqjhv69q/
+    Complete output (5 lines):
+    Traceback (most recent call last):
+      File "<string>", line 1, in <module>
+      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tokenize.py", line 452, in open
+        buffer = _builtin_open(filename, 'rb')
+    FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/mb/sbqp79dx7zj7jpd6mfc1vdbh0000gn/T/pip-req-build-gqjhv69q/setup.py'
+    ----------------------------------------
+ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
+
+",,user12457,9006,,6/23/2020 6:58,6/23/2020 6:59,Qiskit textbook install error,,1,0,,,,CC BY-SA 4.0 +12604,1,12608,,6/22/2020 10:54,,0,172,"

Program.qs

+
namespace Quantum.Kata.SingleQubitGates {
+    open Microsoft.Quantum.Intrinsic;
+    open Microsoft.Quantum.Math;
+    
+    
+     operation GlobalPhaseI (q : Qubit) : Unit is Adj+Ctl {
+        X(q);
+        Z(q);
+        Y(q);
+
+    }
+}
+
+

Reference.qs

+
namespace Quantum.Kata.SingleQubitGates {
+    open Microsoft.Quantum.Intrinsic;
+    open Microsoft.Quantum.Math;
+    
+
+    
+    operation GlobalPhaseI_Reference (q : Qubit) : Unit is Adj+Ctl {
+        X(q);
+        Z(q);
+        Y(q);
+    }
+}
+
+

Test.qs

+
    open Microsoft.Quantum.Intrinsic;
+    open Microsoft.Quantum.Canon;
+    open Microsoft.Quantum.Diagnostics;
+    open Microsoft.Quantum.Math;
+    open Microsoft.Quantum.Convert;
+    
+
+    operation ControlledArrayWrapperOperation (op : (Qubit => Unit is Adj+Ctl), qs : Qubit[]) : Unit is Adj+Ctl {
+        Controlled op([qs[0]], qs[1]);
+    }
+
+    operation AssertEqualOnZeroState (testImpl : (Qubit => Unit is Ctl), refImpl : (Qubit => Unit is Adj+Ctl)) : Unit {
+        using (qs = Qubit[2]) {
+            within {
+                H(qs[0]);
+            }
+            apply {
+               
+                Controlled testImpl([qs[0]], qs[1]);
+
+              
+                Adjoint Controlled refImpl([qs[0]], qs[1]);
+            }
+
+          
+            AssertAllZero(qs);
+        }
+    }
+
+    operation T2_GlobalPhaseI_Test () : Unit {
+        AssertOperationsEqualReferenced(2, ControlledArrayWrapperOperation(GlobalPhaseI, _), ControlledArrayWrapperOperation(GlobalPhaseI_Reference, _));
+    }
+
+
+

Driver.cs

+

+using Microsoft.Quantum.Simulation.XUnit;
+using Microsoft.Quantum.Simulation.Simulators;
+
+using Xunit.Abstractions;
+
+namespace Quantum.Kata.SingleQubitGates
+{
+    public class TestSuiteRunner
+    {
+        private readonly ITestOutputHelper output;
+
+        public TestSuiteRunner(ITestOutputHelper output)
+        {
+            this.output = output;
+        }
+
+        /// <summary>
+   
+        /// </summary>
+        [OperationDriver(TestNamespace = "Quantum.Kata.SingleQubitGates")]
+        public void TestTarget(TestOperation op)
+        {
+            using (var sim = new QuantumSimulator())
+            {
+    
+                sim.OnLog += (msg) => { output.WriteLine(msg); };
+                sim.OnLog += (msg) => { Debug.WriteLine(msg); };
+                op.TestOperationRunner(sim);
+            }
+        }
+    }
+}
+
+
+",11913,,11913,,6/23/2020 6:55,6/26/2020 10:09,Quantum Katas - Tutorials - SingleQubitGates - Exercise 2 - GlobalPhaseI,,3,0,,,,CC BY-SA 4.0 +12605,2,,12603,6/22/2020 10:56,,1,,"

Why are you trying to install the qiskit_textbook repository? You should install Qiskit (https://qiskit.org/documentation/install.html) and Jupyter notebook, unless you have installed them already. Then you will be able open the ipynb files in the textbook repository.

+",9201,,9006,,6/23/2020 6:59,6/23/2020 6:59,,,,3,,,,CC BY-SA 4.0 +12606,2,,12571,6/22/2020 11:04,,1,,"

There is a known circuit construction https://arxiv.org/abs/quant-ph/0208130

+

Also check this post https://algassert.com/post/1710
+It uses phase estimation ideas to derive the resulting circuit

+",5870,,5870,,6/22/2020 17:53,6/22/2020 17:53,,,,0,,,,CC BY-SA 4.0 +12607,1,,,6/22/2020 16:32,,1,96,"

Over the past month, I have been learning about the HHL algorithm and am interested in extending the Cirq implementation to include the quantum state tomography step to extract the amplitudes or solutions of $|x\rangle$. How would I do this in Cirq?

+

Thanks!

+",12399,,13991,,4/28/2021 15:22,4/28/2021 15:22,Adding Quantum State Tomography Step to HHL Algorithm (Cirq),,0,1,,,,CC BY-SA 4.0 +12608,2,,12604,6/22/2020 17:59,,2,,"

Yes, this sequence of gates will work to apply the global phase of $i$. You can check it using matrix multiplication - a product of matrices $Y \cdot Z \cdot X$ will give you a matrix $\begin{bmatrix} i & 0 \\ 0 & i \end{bmatrix}$, which corresponds to applying a global phase.

+

Alternatively, you can implement it using R gate with the phase $-\pi$: R(PauliI, -PI(), q);

+

As a side note, performing measurements this way is not going to detect a global phase introduced by the gate; you need to work with a controlled version of the gate to detect it.

+",2879,,,,,6/22/2020 17:59,,,,4,,,,CC BY-SA 4.0 +12610,1,12613,,6/22/2020 19:11,,0,289,"

I came across somewhere about the circuit diagram that depicts the teleportation of a 4-qubit cluster state. Here it is

+

Let me tell what i understood.

+
    +
  1. The qubits on the first two wires give the state $\dfrac{1}{\sqrt{2}}(|0\rangle|0\rangle+|1\rangle|1\rangle)$, which is a bell stae. This state i guess is teleported with the help of the 4 qubits cluster state, anyways ( i am not sure).

    +
  2. +
  3. The qubits on wires 3,4,5,6 after Hadamards and controlled phase give the cluster state +$$|a\rangle=\frac{1}{2}(|0000\rangle+|0011\rangle+|1100\rangle-|1111\rangle)$$

    +
  4. +
+

Now after this i am not able to understand the circuit, apart from the measurement. For example why is Hadamard on the 3rd wire?

+

Is there any specific way to make this circuit, any sequential procedure? +Can somebody explain?

+",6070,,,,,6/21/2022 0:12,Cluster/Graph state teleportation,,3,2,,,,CC BY-SA 4.0 +12611,1,,,6/22/2020 19:29,,4,202,"

Can someone please explain why STO-3G is considered to be a good basis set for quantum computing, while it does not help in classical computing? +I would also be very grateful for any references to read about as I could not find the needed information.

+",12460,,,,,12/31/2020 1:05,STO-3G Basis Set,,1,1,,,,CC BY-SA 4.0 +12612,2,,12574,6/22/2020 19:49,,1,,"

https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.preparation.prepareuniformsuperposition +Provides a nice operation to set register as LE and create the above script but a bit more efficiently without use of for loop.

+",12239,,,,,6/22/2020 19:49,,,,1,,,,CC BY-SA 4.0 +12613,2,,12610,6/22/2020 21:08,,2,,"

The calculation of the resulting state of the described circuit:

+

After applying the same circuit identities described in this answer (and here) to the connected question we will obtain a "simplified" circuit:

+

+

Here are the links to the initial, first intermediate, second intermediate and final circuits presented in the Quirk. Whenever it was possible (by commuting relations of the gates) and convenient the places of the gates were changed. For example adjacent CNOTs on different pairs of qubits can change their positions. In the first part discussed here combined with the Bell state we will have the following state:

+

$$| \psi_1 \rangle = \frac{1}{2\sqrt{2}} \big(|00\rangle + |11\rangle\big)\big(| 0000 \rangle + | 0011 \rangle + | 1100 \rangle - | 1111 \rangle \big)$$

+

After the following "cascade-like" sequence consisted of $4$ CNOTs:

+

$$| \psi_2 \rangle = \frac{1}{2\sqrt{2}} \Big(| 000000 \rangle + | 000011 \rangle + | 001111 \rangle - | 001100 \rangle + +\\ + | 111111 \rangle + | 111100 \rangle + | 110000 \rangle - | 110011 \rangle \Big)$$

+

After the final two CNOTs:

+

$$| \psi_3 \rangle = \frac{1}{2\sqrt{2}} \Big(| 000000 \rangle + | 110011 \rangle + | 111111 \rangle - | 001100 \rangle + +\\ + | 001111 \rangle + | 111100 \rangle + | 110000 \rangle - | 000011 \rangle \Big)$$

+

After the final two Hadamard gates:

+

$$| \psi_4 \rangle = \frac{1}{2\sqrt{2}} \Big(| ++0000 \rangle + | --0011 \rangle + | --1111 \rangle - | ++1100 \rangle + +\\ + | ++1111 \rangle + | --1100 \rangle + | --0000 \rangle - | ++0011 \rangle \Big)$$

+

We can simplify this state:

+

$$| \psi_4 \rangle = \frac{1}{2\sqrt{2}} \Big(| 000000 \rangle + | 110000 \rangle - | 010011 \rangle - | 100011 \rangle + +\\ ++ | 001111 \rangle + | 111111 \rangle - | 011100 \rangle - | 101100 \rangle \Big)$$

+

Regrouping the terms:

+

$$| \psi_4 \rangle = \frac{1}{2\sqrt{2}} \Big(\big(| 0000 \rangle + | 1100 \rangle - | 0111 \rangle - | 1011 \rangle \big) |00\rangle + +\\ ++ \big(| 0011 \rangle + | 1111 \rangle - | 0100 \rangle - | 1000\rangle \big) |11\rangle \Big)$$

+

This is the final state that should be measured (only the last two qubits). This final result can be checked from Quirk's output that can be found from the initial version of the circuit (the order of the qubits in the ket notation is reversed there).

+",9459,,9459,,6/23/2020 11:22,6/23/2020 11:22,,,,6,,,,CC BY-SA 4.0 +12615,1,12617,,6/23/2020 0:20,,1,642,"

Is there any quantum algorithm that can improve a calculation time for determining the Hamming weight of an arbitrary bit string? The Deutsch-Jozsa algorithm seems like it would be useful for this algorithm. I could not find any papers on this though.

+",12462,,55,,10/5/2020 13:41,11/20/2020 13:23,Hamming Weight algorithm,,2,1,0,,,CC BY-SA 4.0 +12616,2,,12593,6/23/2020 6:18,,3,,"

Adding to psitae's answer, in 2 recent papers by Aaronson, Chia, Lin, Wang and Zhang (arXiv:1911.01973) and Buhrman, Patro and Speelman (arXiv:1911.05686) the Quantum Strong Exponential Time Hypothesis (QSETH) was formulated. This hypothesis in fact claims that there is no $2^{o(n)}$ quantum algorithm for solving $k-\mathrm{SAT}$.

+",282,,,,,6/23/2020 6:18,,,,0,,,,CC BY-SA 4.0 +12617,2,,12615,6/23/2020 6:29,,1,,"

This corresponds to the problem of counting the number of 1's in some $n$-bit input string. It is well known that for exact counting there can be no significant speedup. This follows from the $\Omega(n)$ lower bound on the quantum query complexity of parity (see here). For approximate counting you can get a quantum speedup, as is described here.

+",282,,,,,6/23/2020 6:29,,,,0,,,,CC BY-SA 4.0 +12618,2,,12604,6/23/2020 7:29,,1,,"

On IBM Q, you can also use $U3$ gate to prepare a global phase operator. +$U3$ gate is defined as +$$ +U3(\theta, \varphi, \lambda) = +\begin{pmatrix} +\cos (\theta/2) & -\mathrm{e}^{i\lambda}\sin(\theta/2) \\ +\mathrm{e}^{i\varphi}\sin(\theta/2) & \mathrm{e}^{i(\varphi + \lambda)}\cos(\theta/2)\\ +\end{pmatrix}. +$$ +Setting $\theta = \pi$ we get +$$ +U3(\pi, \varphi, \lambda) = +\begin{pmatrix} +0 & -\mathrm{e}^{i\lambda} \\ +\mathrm{e}^{i\varphi} & 0\\ +\end{pmatrix}. +$$ +Let's denote our global phase $\alpha$ and set $\varphi = \alpha$ and $\lambda = \alpha + \pi$. Since $-\mathrm{e}^{i\pi}=1$ we have +$$ +U3(\pi, \alpha, \alpha+\pi) = +\begin{pmatrix} +0 & \mathrm{e}^{i\alpha} \\ +\mathrm{e}^{i\alpha} & 0\\ +\end{pmatrix}, +$$ +which is $\mathrm{e^{i\alpha}}X$. To get $\mathrm{e^{i\alpha}}I$, we apply another $X$ gate.

+

So, global phase gate is implemented as $X\,\,U3(\pi,\alpha,\alpha+\pi)$, where $\alpha$ is global phase.

+
+

EDIT (solution in Q#)

+

A $R1$ gate is defined as +$$ +R1(\theta) = +\begin{pmatrix} +1 & 0 \\ +0 & \mathrm{e}^{i\theta} +\end{pmatrix} +$$

+

An operation $X\,R1(\theta)$ is described by matrix +$$ +\begin{pmatrix} +0 & \mathrm{e}^{i\theta} \\ +1 & 0 +\end{pmatrix} +$$

+

If we apply this operation twice (i.e. $[X\,R1(\theta)]^2$ ), we get

+

$$ +\begin{pmatrix} +\mathrm{e}^{i\theta} & 0 \\ +0 & \mathrm{e}^{i\theta} +\end{pmatrix}, +$$

+

which is a global phase gate with arbitrary phase $\theta$.

+

So, global phase gate in Q# can be realized as $[X\,R1(\theta)]^2$.

+",9006,,12280,,6/25/2020 8:31,6/25/2020 8:31,,,,2,,,,CC BY-SA 4.0 +12619,1,12623,,6/23/2020 8:53,,1,308,"

I ran my qsvm code on the quantum computer and I'm facing the following error:

+
FAILURE: Can not get job id, Resubmit the qobj to get job id. Terra job error: "Error submitting job: '400 Client Error: Bad Request for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs. Reached maximum number (5) of concurrent jobs, **Error code: 3458.**'" 
+Job limit reached, waiting for job 5ef1bc3ecd20b1001387fa06 to finish before submitting the next one.
+FAILURE: Job id: 5ef1bc4edab6ee0013416233 is cancelled. Re-submit the Qobj.
+FAILURE: Job id: 5ef1bc546daf510014814cd8 is cancelled. Re-submit the Qobj.
+FAILURE: Job id: 5ef1bc5a13b5f900139e97c5 is cancelled. Re-submit the Qobj.
+FAILURE: Job id: 5ef1bc62c7453600138726d0 is cancelled. Re-submit the Qobj.
+
+

The last line is repeating every few minutes. The url does not exist. I did run my code on the simulator and it worked. +It uses 5 features and hence 5 qubits. Could anyone please help me out? +The code:

+
data = np.genfromtxt('diabetes.csv', delimiter=',', names=True, case_sensitive=True)
+data = np.array(data.tolist()) # was an array of arrays earlier
+data = np.delete(data, 7, axis = 1)
+data = np.delete(data, 3, axis = 1)
+data = np.delete(data, 2, axis = 1)
+print(data.shape)
+x = np.copy(data[:,0:5]) #features
+y = np.copy(data[:,5]) #targets
+features = 5
+from sklearn.model_selection import train_test_split
+import qiskit
+from qiskit import BasicAer
+from qiskit.aqua import QuantumInstance
+from qiskit.aqua.algorithms import QSVM
+  
+from qiskit.aqua.components.multiclass_extensions import one_against_rest, all_pairs
+from qiskit.aqua.components.feature_maps import SecondOrderExpansion
+provider = qiskit.IBMQ.load_account()
+backend = provider.get_backend('ibmq_16_melbourne')
+train_x, test_x, train_y, test_y = train_test_split(x[0:101], y[0:101], test_size=0.2)
+
+training_data = {'A':train_x[train_y==0],'B':train_x[train_y==1]}
+testing_data = {'A':test_x[test_y==0],'B':test_x[test_y==1]}
+feature_map = SecondOrderExpansion(feature_dimension=features,depth=2,entanglement='full')
+svm = QSVM(feature_map,training_data,testing_data)
+shots = 1 
+quantum_instance = QuantumInstance(backend,shots=shots,skip_qobj_validation=False)
+%%time
+result = svm.run(quantum_instance) 
+
+",12468,,5955,,6/23/2020 9:32,6/23/2020 13:17,Error code: 3458,,1,0,,,,CC BY-SA 4.0 +12620,2,,12610,6/23/2020 9:39,,1,,"

I think it is worth trying to understand the circuit that the authors really want to implement: +

+

Here they produce the Bell state they want to teleport onto the final two qubits, and cluster state (personally, I wouldn't call it a cluster state after they've added the two extra hadamards). Then they do two single-qubit teleportation protocols to make the state arrive where they want them to. Hopefully my circuit has made this structure fairly clear.

+

So, now you need to understand how they've converted this into the circuit they've implemented. Firstly, instead of operations controlled off classical measurement results, they've just implemented quantumly controlled $X$ and $Z$ gates, and dropped the measurements on the four qubits. So, the output will still be Bell state on the last two qubits even without measuring the other four. Then, they add measurements on the last two qubits in an attempt to verify what they have produced is what they wanted. So, the important output is the output of the last two qubits, not the first four!

+",1837,,,,,6/23/2020 9:39,,,,4,,,,CC BY-SA 4.0 +12621,1,,,6/23/2020 9:59,,7,920,"

I'm reading "Quantum Computing Expained" of David McMahon, and encountered a confusing concept.

+

In the beginning of Chapter 4, author described the tensor product as below:

+
+

To construct a basis for the larger Hilbert space, we simply form the +tensor products of basis vectors from the spaces $H_1$ and $H_2$. Let +us denote the basis of $H_1$ by $|u_i\rangle$ and the basis of $H_2$ by +$|v_i\rangle$. Then it follows that we can construct a basis $|w_i\rangle$ for $H=H_1\otimes H_2$ using $|w_i\rangle = |u_i\rangle \otimes |v_i\rangle$ (4.6)

+

Note that the order of the tensor product is not relevant, meaning +$|\phi\rangle\otimes |\chi\rangle = |\phi\rangle \otimes |\chi\rangle$.

+
+

In last equation, I think it implies that tensor product of two state vector is commutative. However, with simple computation to prove this sentence, I could hardly understand why this holds.

+

Can anyone help me to understand what author want to explain?

+",12469,,2927,,2/26/2021 16:55,2/26/2021 16:55,Is the tensor product of two states commutative?,,3,6,,,,CC BY-SA 4.0 +12622,2,,12621,6/23/2020 10:36,,4,,"

The idea of a tensor product is to link two Hilbert spaces together in a nice mathematical fashion so that we can work with the combined system. Normally, these two Hilbert spaces each consist of at least one qubit, and sometimes more.

+

Let's say we have a qubit, which we label $a$, and a qubit which we label $b$. These qubits 'live' in the Hilbert spaces of $\mathcal{H}_{a}$ and $\mathcal{H}_{b}$, respectively; we might call their respective states $|\psi_{a}\rangle$ and $|\psi_{b}\rangle$. The idea of the tensor product is that we can write the state of the two system together as: +$$|\psi_{ab}\rangle = |\psi_{a}\rangle \otimes |\psi_{b}\rangle.$$ We have 'linked' the Hilbert spaces $\mathcal{H}_{a}$ and $\mathcal{H}_{b}$ together into one big composite Hilbert space $\mathcal{H}_{ab}$:

+

$$ +\mathcal{H_{ab}} = \mathcal{H}_{a} \otimes \mathcal{H}_{b}. +$$

+

Of course, there is no reason that qubit $a$ should come before qubit $b$. We thus also could link their Hilbert spaces together in reversed order:

+

$$ +\mathcal{H_{ba}} = \mathcal{H}_{b} \otimes \mathcal{H}_{a}. +$$ +We need to respect our new ordering, and therefore the state of the two systems together is now:

+

$$ +|\psi_{ba}\rangle = |\psi_{b}\rangle \otimes |\psi_{a}\rangle. +$$

+

Mathematically speaking, this is a different vector than $|\psi_{ab}\rangle$. This is exactly because we have rearranged the order of qubits in how we linked them together.

+

Explicit example

+

Let's say that we have a qubit $a$ in the Hilbert space $\mathcal{H}_{a}$ with the state $$|\psi_{a}\rangle = \alpha |0_{a}\rangle + \beta|1_{a}\rangle,$$ and a qubit $b$ in the Hilbert space $\mathcal{H}_{b}$ with the state $$|\psi_{b}\rangle = \gamma |0_{b}\rangle + \delta|1_{b}\rangle.$$

+

We can link these two qubits together with $a$ first: +$$ +|\psi_{ab}\rangle = \alpha\gamma |0_{a}0_{b}\rangle + \alpha\delta |0_{a}1_{b}\rangle + \beta\gamma |1_{a}0_{b}\rangle + \beta\delta|1_{a}1_{b}\rangle, +$$ +where I now have specifically labeled the basis states for qubit $a$ and $b$.

+

Or with $b$ first: +$$ +|\psi_{ba}\rangle = \alpha\gamma |0_{b}0_{a}\rangle + \beta\gamma|0_{b}1_{a}\rangle + \alpha\delta |1_{b}0_{a}\rangle + \beta\delta|1_{b}1_{a}\rangle. +$$

+

These state are not the same. We see that the coefficients for $|01\rangle$ and $|10\rangle$ have been interchanged, but why this happened becomes very obvious if we look at the labels $a$ and $b$ of the basis states. All we have done is writing $a$ or $b$ first.

+

As an added argument, you could have the SWAP operation act on either of these states, and arrive at the other one. Note that, if we are very scrupulous, strictly speaking, by applying the SWAP gate we have not (re)reversed the order, but we have just 'given' the state of qubit $a$ to qubit $b$ and vice versa. If you may, it is kind of like a 'double fault', that cancels itself out.

+

So in general a tensor product does not commute, but rearranging the terms is just reordering the systems that you link. We just stick with one particular ordering, and it is always evident which one this is.

+",8141,,8141,,6/23/2020 10:42,6/23/2020 10:42,,,,3,,,,CC BY-SA 4.0 +12623,2,,12619,6/23/2020 13:17,,1,,"

tldr: this is caused by a change in behavior of the IQX server that needs to be fixed.

+

Aqua may submit multiple jobs for an experiment under the cover. However, with a public account, you can only have 5 jobs running in parallel at the same time. That's what caused the first error:

+
FAILURE: Can not get job id, Resubmit the qobj to get job id. Terra job error: "Error submitting job: '400 Client Error: Bad Request for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs. Reached maximum number (5) of concurrent jobs, **Error code: 3458.**'" 
+
+

Aqua then tried to wait for the oldest job to finish before submitting the next one, as indicated by this message:

+
Job limit reached, waiting for job 5ef1bc3ecd20b1001387fa06 to finish before submitting the next one.
+
+

Instead of waiting indefinitely for the oldest, the code retries the submit every 5 minutes, in case a spot frees up for some reason. It looks like there is a behavior change so that instead of getting another 3458 error, the retried submit went through but the job was immediately cancelled, giving the rest of the error messages. Without the 3458 error, Aqua just kept re-submitting the jobs which kept getting cancelled.

+",12195,,,,,6/23/2020 13:17,,,,0,,,,CC BY-SA 4.0 +12624,1,,,6/23/2020 17:10,,2,21,"

In the classical case, if Y is the output of a classical channel whose input is X, it makes sense to speak of a joint distribution $P_{XY}$. In the quantum case, if a state $\rho_A$ is input to a channel $\mathcal{E}_{B|A}$ producing $\rho_B$, speaking of a quantum state $\rho_{AB}$ is not consistent. However, if A and B are spatially correlated systems, and it makes sense in that case to speak of $\rho_{AB}$. Why is that?

+",12047,,,,,6/23/2020 17:10,"Density matrix of spatially (i.e., at the same time instant) vs. causally ( i.e., one evolves into the other) correlated quantum systems",,0,2,,,,CC BY-SA 4.0 +12625,1,,,6/23/2020 19:14,,1,135,"

Running the same quantum circuit (example picture below, I've tried similar circuits too), both on a simulator and real backend, I've found than the simulator is always faster (sometimes by order of 100 times). I expected real backends to be faster than the simulators (at least on relatively complex circuits), please tell me why are they slower?

+

+

PS: I tried on ibmq_london and ibmq_burlington and ibmq_qasm_simulator was always faster with the run time (given by result.time_taken()) to be 7s, 7s and 0.03s respectively

+",12229,,9006,,6/24/2020 7:49,6/24/2020 7:49,Time taken on IBM Q qasm_simulator vs real backend,,1,0,,,,CC BY-SA 4.0 +12626,2,,12625,6/23/2020 19:38,,1,,"

The circuit above is nothing but a bunch of matrix vector calculations of at most 32x32 elements. This is not hard for a classical computer to do. The quantum computer also has additional overhead, namely if your stuck in the queue, the circuit needs to be converted to waveforms, etc..

+",332,,,,,6/23/2020 19:38,,,,0,,,,CC BY-SA 4.0 +12627,1,12629,,6/23/2020 20:59,,1,171,"

Suppose we have a $3$-qubit system at time $t_0$ in the state +$$\vert{\psi(t_0)}\rangle= \vert{q_0}\rangle \otimes \vert{q_1} \rangle \otimes \vert{q_2}\rangle. +$$ + +We want to check if, for instance, the first qubit at time $t_1$ is equals to itself at time $t_0$:

+

$$\vert{\psi(t_1)} \rangle = \vert{q_0} \rangle \otimes \vert{\phi} \rangle, +$$ +where $\vert{\phi} \rangle$ is the state of the qubits $q_1, q_2$ after the operations.

+

My first attempt is to calculate the reduced density matrix using the partial trace over the two other qubits, to get the reduced density matrix at $t_0$ and $t_1$:

+

$$\rho^0(t_0) = \operatorname{Tr}_{12}(\rho(t_0)),\\ +\rho^0(t_1) = \operatorname{Tr}_{12}(\rho(t_1)).$$ +So my question is: +is there an equivalence relation between the equality of the reduced matrices and the two subsystems being in the same state?

+

$$\rho^0(t_0) = \rho^0(t_1) \Leftrightarrow \vert{q_0}\rangle = \text{the state of the subsystem at }t_1 $$

+",2752,,2752,,6/25/2020 19:45,6/25/2020 19:45,"If two reduced density matrices are equal, does that mean that the two subsystems are the same?",,2,0,,,,CC BY-SA 4.0 +12629,2,,12627,6/24/2020 4:53,,2,,"

Density matrix completely describes the state of a system (or a subsystem). So if two density matrices are equal then the two states are equal (and vice versa).

+

But you should not forget that

+
    +
  1. The state of a subsystem can be mixed (e.g. look at the Bell state $\frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)$). Density matrices uniquely describe mixed states as well, so calculating the partial trace is the most general method for checking the equality.
  2. +
  3. In general, the state of the whole system isn't completely determined by the states of subsystems. So, we can't deduce the equality of the whole states if states of subsystems are equal.
  4. +
+",5870,,,,,6/24/2020 4:53,,,,2,,,,CC BY-SA 4.0 +12630,1,,,6/24/2020 7:18,,2,221,"

Suppose we start from 2 wires (q0 and q1) and through some quantum gates, suppose we measure q1 wire only.

+

As we measure the q1 wire, the state vector of this quantum state would be determined immediately. How can I print out this state vector?

+

In addition, I would like to print out the state vector of q0 wire only. Does anyone know how to do this task via qiskit or cirq or pyquil? (Any other package language is also fine!)

+",,user12457,55,,10/5/2020 13:41,12/29/2021 22:43,How can I print out a state vector of a specific wire?,,4,1,,,,CC BY-SA 4.0 +12631,2,,12567,6/24/2020 7:45,,1,,"

Disclaimer: I am answering this question because the competition the question come from ended. Otherwise, I would consider to answer the question unfair.

+

A $R1$ gate is given by matrix +$$ +R1(\theta) = +\begin{pmatrix} +1 & 0 \\ +0 & \mathrm{e}^{i\theta} +\end{pmatrix}, +$$ +while $Rz$ gate by matrix +$$ +Rz(\theta)= +\begin{pmatrix} +\mathrm{e}^{-i\theta/2} & 0 \\ +0 & \mathrm{e}^{i\theta/2} +\end{pmatrix} +$$

+

Easily you can see that $R1(\theta) = \mathrm{e^{i\theta/2}}Rz(\theta)$. So, the gates differ only by global phase $\theta/2$. If you use these gates as single qubit only, there is no difference between them as resulting quantum states differ again only in global phase. Such states are physically undistinguishable.

+

However, controlled versions of these gates are different. For $R1(\theta)$, its controlled version is described by matrix

+

$$ +C-R1(\theta) = +\begin{pmatrix} +1 & 0 & 0 & 0\\ +0 & 1 & 0 & 0\\ +0 & 0 & 1 & 0 \\ +0 & 0 & 0 & \mathrm{e}^{i\theta} +\end{pmatrix}, +$$ +while controled version of $Rz$ is given by matrix

+

$$ +C-RZ(\theta) = +\begin{pmatrix} +1 & 0 & 0 & 0\\ +0 & 1 & 0 & 0\\ +0 & 0 & \mathrm{e}^{-i\theta/2} & 0 \\ +0 & 0 & 0 & \mathrm{e}^{i\theta/2} +\end{pmatrix}. +$$ +Clearly, these gates do not differ by the phase.

+",9006,,,,,6/24/2020 7:45,,,,1,,,,CC BY-SA 4.0 +12632,2,,12627,6/24/2020 7:59,,2,,"

It depends what you mean in wanting to say that the states "are the same". You probably mean

+
+

all observable consequences on just that subsystem (i.e. measurements in +arbitrary bases etc, without using the other qubits) are identical.

+
+

In which case, it is sufficient that the reduced density matrices are the same - the whole point of the density matrix is to encapsulate all observables of that particular subsystem.

+

Incidentally, the whole point of needing to use the reduced density matrix is that, in general, states are not separable, and hence you cannot write the state of the first qubit as $|q_0\rangle$. The $\rho$ is the best description that you can give.

+",1837,,,,,6/24/2020 7:59,,,,0,,,,CC BY-SA 4.0 +12633,1,,,6/24/2020 8:18,,2,954,"

Does anyone know how to encode a classical vector into a quantum state? For instance, I would like to encoder a classical vector $(0, 0.1, 0.4, 0.9)$ into 2 qubits by adding some quantum gates on 2 $|0\rangle$ starting states. Any program package including Qiskit, pyquil, cirq... is fine.

+",,user12457,55,,6/27/2020 15:42,6/27/2020 15:42,How do I encode a classical vector into the input qubits?,,2,1,,,,CC BY-SA 4.0 +12634,1,,,6/24/2020 8:40,,1,137,"

Given a set of four qubits, say $q_{0},q_{1},q_{2},q_{3}$ which represent a $4$-bit binary number with $q_{0}$ as the MSB. After applying QFT on these qubits the phase of $q_{0}$using the concept of binary fractions ($e^{\frac{a}{2^{n}}} = e^{0..an...a1}$) becomes:

+
+

$Q(q_0) = \frac{1}{\sqrt{2}}\big(|0\rangle + e^{(0.q_{0}q_{1}q_{2}q_{3})}|1\rangle\big)$

+
+

My question is: Is there a quantum operation to change the phase of $Q(q_0)$ from $e^{(0.q_{0}q_{1}q_{2}q_{3})}$ to $e^{(0.q_{1}q_{2}q_{3})}$?

+",6297,,55,,6/26/2020 20:26,6/27/2020 5:08,Is there a quantum operation to change a phase $e^{(0.q_0 q_1 q_2 q_3)}$ into $e^{(0.q_1 q_2 q_3)}$?,,2,6,,,,CC BY-SA 4.0 +12635,1,,,6/24/2020 11:08,,2,232,"

This question is just my effort that I made by understanding the previous answers to my questions . I have a GHZ state $|000\rangle+|111\rangle$ (please ignore the normalizing constant). For teleportaion of these three qubits (GHZ state) I make use of a 8 qubit cluster channel. I do this in the following way

+

Can this be the extension of the case when we teleport a Bell state (two-qubit) using 4 qubits cluster state?

+

Can somebody just check on this circuit? What should be the outcome? Can anybody suggest a possible reference to read?

+",6070,,2927,,12/11/2022 14:22,12/11/2022 14:22,Transferring GHZ state onto some qubits,,1,0,,,,CC BY-SA 4.0 +12636,2,,12633,6/24/2020 11:29,,2,,"

I think you should look for quantum amplitude encoding strategies. A nice and practical tutorial (with reference to Qiskit) is the following one by Maria Schuld:

+

https://medium.com/qiskit/building-the-worlds-smallest-quantum-classifier-7da7cd845b84

+

Interesting (but more advanced) articles are also:

+

https://www.nature.com/articles/s41598-019-40439-3

+

https://arxiv.org/abs/1907.02085

+",5551,,5551,,6/24/2020 12:55,6/24/2020 12:55,,,,0,,,,CC BY-SA 4.0 +12637,2,,12634,6/24/2020 13:49,,2,,"

First you need to undo the QFT applied to $|q_3\rangle$, so you would apply a $H$ gate to $Q(|q_3\rangle)$.

+

$HQ(|q_3\rangle) = |q_3\rangle$

+

or more generally for an $n$-qbit system

+

$HQ(|q_n\rangle) = |q_n\rangle$

+

If you then apply the conditional rotation (on $Q(|q_0\rangle)$ conditioned by $|q_3\rangle$) of angle $R_4^{\dagger}$:

+

$ +\begin{pmatrix} +1 & 0 \\ +0 & e^{-\pi i / 8} +\end{pmatrix} +$

+

to $q_0$ this will undo the $q_3$ rotation applied by QFT. You would then want to fix up the $|q_3\rangle$ state to put it back into QFT by applying a $H$ gate again.

+

--

+

I don't think you need to correct $|q_3\rangle$ for any phase-kickback after applying the conditional rotation to $Q(|q_0\rangle)$ as we're not applying the rotation to an eigenstate, but anyone feel free to correct me!

+",6139,,6139,,6/26/2020 3:43,6/26/2020 3:43,,,,1,,,,CC BY-SA 4.0 +12638,2,,12604,6/24/2020 16:18,,1,,"

I apologize, but I can not comment on @Martin Vesely answer above. +I am glad that my amendments have already been adopted, I’ll leave only a short note, in case someone is interested in this: +In Qiskit programs (e.g. see) I use X before U3 in my variants of phase shift circuits, +in an attempt to avoid "distortion" during further processing of Qiskit (for example, by transpiler):

+
qc.x(qubit)
+qc.u3(np.pi, gamma, np.pi + gamma, qubit)
+
+

If not for similar considerations, then the order here would not be important (as in other similar cases, e.g. $[X\,R1(\theta)]^2 = [R1(\theta)\,X]^2$)

+",12280,,12280,,6/26/2020 10:09,6/26/2020 10:09,,,,0,,,,CC BY-SA 4.0 +12639,1,12640,,6/24/2020 17:19,,-1,234,"

I have a system that generates a random 7 qubit state and I need a method to always find the orthogonal state.

+

I'm currently using python and qutip for this, representing this 7 qubit state by a 128-dimensional vector.

+",5065,,,,,6/24/2020 17:47,Find orthogonal state for random 7 qubit state,,1,1,,,,CC BY-SA 4.0 +12640,2,,12639,6/24/2020 17:42,,2,,"

Basically, you divide the entire $7$-qubit Hilbert space into two subspaces: the one spanned by your state (let's call the state $|\psi\rangle$), let's call that subspace $W$, and it's orthogonal complement $V = W^{\perp}$. You want any vector from $V$, because this will by definition be orthogonal.

+

We know that $P_{V}$ + $P_{W} = I$, with $P_{V}$ and $P_{W}$ being the projectors upon the $V$ and $W$ subspaces. Since $P_{W} = |\psi\rangle\langle\psi|$, we can easily calculate $P_{V}$:

+

$$ +P_{V} = I - |\psi\rangle\langle\psi|. +$$ +We can let this projection matrix act on virtually any state to obtain a state orthogonal on $|\psi\rangle$, lets use the $0$ vector $|00....0\rangle$. An orthogonal state $|\psi^{\perp}\rangle$ to $|\psi\rangle$ is thus:

+

$$ +|\psi^{\perp}\rangle = P_{V}|00...0\rangle = (I - |\psi\rangle\langle\psi|)|00...0\rangle = |00...0\rangle - \langle\psi|00...0\rangle|\psi\rangle +$$

+

which is more or less the Gram-Schmidt process.

+

Note that you can use (almost) any state instead of $|00...0\rangle$; the only state that you cannot use is $|\psi\rangle$ itself.

+

In python, this becomes something like:

+

from numpy import zeros_like, inner

+

zeros_vect = zeros_like(psi_orig)

+

psi_orth = zeros_vect - inner(zeros_vect,psi_orig).conj()*psi_orig

+",8141,,8141,,6/24/2020 17:47,6/24/2020 17:47,,,,0,,,,CC BY-SA 4.0 +12641,2,,12592,6/24/2020 18:30,,2,,"

Only one qubit is measured; the frequency of getting 0/1 result in this measurement (rather than a single measurement result) is used together with the bias to assign the class.

+

If you dig into the source code of the QML library, the measurement is performed in EstimateClassificationProbability operation, which measures the last qubit of the register.

+",2879,,,,,6/24/2020 18:30,,,,0,,,,CC BY-SA 4.0 +12642,1,,,6/24/2020 18:39,,3,86,"

Is there a working rule to compute the capacity of a quantum channel described by a set of Kraus operators $\{K_i\}$?

+",8290,,55,,12/30/2021 8:07,12/30/2021 8:07,How to compute the capacity of a quantum channel from its Kraus operators?,,0,3,,,,CC BY-SA 4.0 +12644,1,12647,,6/24/2020 18:58,,3,223,"

Consider two states $\sigma_0,\sigma_1\in\text{L}(\mathcal{H}_{AB})$, and suppose $\sigma_0,\sigma_1$ are separable and orthogonal. Is it possible to distinguish between $\sigma_0,\sigma_1$ through LOCC?

+

My approach so far har been to write out +$$ \sigma_0 = \sum_{i=1}^n p_i |a_ib_i\rangle\langle a_ib_i| \quad\text{and}\quad + \sigma_1 = \sum_{j=1}^n q_j |a_jb_j\rangle\langle a_jb_j|, \quad + \text{where } p_i,q_j\geq 0, $$ +and since +$$ 0 = \text{Tr}(\sigma_0^\dagger\sigma_1) + = \sum_{i,j}^n p_iq_j \lvert\langle a_ib_i | a_jb_j\rangle\rvert^2, $$ +it follows that all terms in the decomposition of $\sigma_0$ are orthogonal to all terms in the decomposition of $\sigma_1$. My idea was now to measure using projections onto the two subspaces spanned by the terms in each decomposition, and these are separable projections. I am stuck at implementing this as an LOCC protocol, so any help with this or giving an alternative approach is appreciated!

+",12421,,55,,7/27/2020 12:28,7/27/2020 12:28,"Are separable, orthogonal states LOCC distinguishable?",,1,3,,,,CC BY-SA 4.0 +12645,1,,,6/24/2020 21:42,,1,1010,"

I want to replicate the depolarizing noise channel

+

+

for a 4 qubit circuit system, where p is the probability for an error. + +I tried doing this: +

+

But I get the error WARNING: all-qubit error already exists for instruction "measure", composing with additional error.

+

I have looked at Qiskits documentation on the depolarizing_error function but it is not clear, or I don't understand the maths.

+

Could anyone please shed more light on this?

+

Edit: +I might have found a solution, but I'm not sure if my logic is right.

+

For my 4 qubit system, I want to apply the depolarizing channel noise to the measurement of the qubits $q_{0}$ and $q_{2}$ in the z-direction:

+

+

Edit: +I realized that the single-qubit depolarizing channel above acts separately on the two qubits: +

+",9396,,55,,10/5/2020 13:41,10/5/2020 13:41,I want to create a depolarizing channel on IBM qiskit,,1,0,,,,CC BY-SA 4.0 +12646,2,,12621,6/24/2020 22:43,,5,,"

Annoyingly, the answer is "it depends on what you mean by $|\psi\rangle \otimes |\phi\rangle$."

+

A tensor product of vectors from a collection of Hilbert spaces over the same field is simply a choice of one vector from each Hilbert space, with some equivalence relations modded out. (A tensor product of Hilbert spaces is more complicated.) Let $\mathcal{H}_A$ and $\mathcal{H}_B$ be the Hilbert spaces for two distinct physical systems $A$ and $B$ (e.g. qubits), and let $|\psi\rangle \in \mathcal{H}_A$ and $|\phi\rangle \in \mathcal{H}_B$. Then $|\psi\rangle_A \otimes |\phi\rangle_B$ and $|\phi\rangle_B \otimes |\psi\rangle_A$ are indeed identical vectors; clearly the choice itself doesn't depend on the order in which you write down its pieces.

+

But if there is a natural isomorphism between $\mathcal{H}_A$ and $\mathcal{H}_B$ (which is the case by definition if the two systems are "physically equivalent" at the level of our quantum description), with $(|\psi\rangle \in \mathcal{H}_A) \equiv (|\psi'\rangle \in \mathcal{H}_B)$ and $(|\phi\rangle \in \mathcal{H}_B) \equiv (|\phi'\rangle \in \mathcal{H}_A)$, then $|\psi\rangle_A \otimes |\phi\rangle_B$ is definitely not necessarily equal to $|\phi'\rangle_A \otimes |\psi'\rangle_B$. The tensor product doesn't even "know about" our isomorphism between the factor spaces, so there's no way that this relationship could hold. These two vectors correspond to the two (equivalent but distinct - a subtle concept!) systems being assigned the same two physical states, but swapped.

+

Without Hilbert space subscripts, the notations $|\psi\rangle \otimes |\phi\rangle$ and $|\phi\rangle \otimes |\psi\rangle$ are somewhat ambiguous, so the notation is underspecified for determining whether or not they're identical. Your author is interpreting the Hilbert space label as being "pinned" to the particular vector, so it swaps along with the symbols $|\psi\rangle$ and $|\phi\rangle$. In this case, indeed $|\psi\rangle \otimes |\phi\rangle \equiv|\phi\rangle \otimes |\psi\rangle$.

+

However, physicists often use the following notational convention:

+
    +
  1. If there exists a natural physical isomorphism between Hilbert spaces $\mathcal{H}_A \equiv \mathcal{H}_B$, then use the same notation for isomorphic vectors between the Hilbert spaces, with possibly only a subscript distinguishing them. That is, if $(|\psi\rangle \in \mathcal{H}_A) \equiv (|\psi'\rangle \in \mathcal{H}_B)$, then simply use the notations $|\psi\rangle_A$ and $|\psi\rangle_B$ to describe them.
  2. +
  3. Fix the order of factor Hilbert spaces in a tensor product once at the beginning of the discussion, and then use that order consistently throughout the entire discussion. This allows you to drop Hilbert space subscript labels and save writing.
  4. +
+

Under this second convention (which is more common with physicists), we have $|\psi\rangle \otimes |\phi\rangle \not\equiv|\phi\rangle \otimes |\psi\rangle$, as explained in the third paragraph.

+",551,,551,,6/24/2020 23:02,6/24/2020 23:02,,,,0,,,,CC BY-SA 4.0 +12647,2,,12644,6/25/2020 6:12,,2,,"

Consider these two states +$$ +\sigma_0 = \frac{1}{2}(|11\rangle\langle 11| + |++\rangle\langle ++|) +$$ +$$ +\sigma_1 = \frac{1}{2}(|0-\rangle\langle 0-| + |-0\rangle\langle -0|) +$$

+

I believe they are indistinguishable (with certainty), though to be sure it's better to find the exact proof.

+

Also check this paper https://arxiv.org/abs/quant-ph/9804053.
+It's impossible to distinguish a set of product states in general, though this is not directly answers your question.

+

Update
+As John Watrous explained in the comments, $\sigma_0$,$\sigma_1$ are indeed indistinguishable. They have orthogonal images that span the whole space. So, the only way to distinguish them with certainty is to use the two-outcome projective measurement where projections correspond to the images. But these projections are not separable, we can use PPT criterion to check this. For example, the projection on $\text{Im}(\sigma_0)$ is +$$ +P_0 = \frac{1}{3}\begin{pmatrix} +1 & 1 & 1 & 0 \\ +1 & 1 & 1 & 0 \\ +1 & 1 & 1 & 0 \\ +0 & 0 & 0 & 3 \\ +\end{pmatrix} +$$ +and you can check that the partial transpose +$$ +P_0^{T_2} = \frac{1}{3}\begin{pmatrix} +1 & 1 & 1 & 1 \\ +1 & 1 & 0 & 0 \\ +1 & 0 & 1 & 0 \\ +1 & 0 & 0 & 3 \\ +\end{pmatrix} +$$ +has a negative eigenvalue.

+",5870,,5870,,6/30/2020 7:57,6/30/2020 7:57,,,,6,,,,CC BY-SA 4.0 +12648,2,,11405,6/25/2020 7:40,,1,,"

You might also want to check out Quaec, documentation here, which is:

+
+

QuaEC is a library for working with quantum error correction, including support for efficiently maniuplating Pauli and Clifford operators.

+
+

The use of this would pretty much be as-is, since it is not actively (or even passively I believe) developed anymore.

+",8141,,,,,6/25/2020 7:40,,,,0,,,,CC BY-SA 4.0 +12649,2,,12633,6/25/2020 8:40,,1,,"

Firstly, you have to normalize your vector $x$ to have an Euclidian norm equal one, i.e.

+

$$ +||x||=||(0,0.1,0.4,0.9)|| = \sqrt{0^2 + 0.1^2 +0.4^2+0.9^2} = \sqrt{0.98} +$$

+

So, your vector representing a quantum state is +$$ +\frac{1}{\sqrt{0.98}}(0,0.1,0.4,0.9). +$$

+

Now, you can apply methods described in this thread.

+",9006,,,,,6/25/2020 8:40,,,,0,,,,CC BY-SA 4.0 +12650,1,,,6/25/2020 10:16,,0,49,"

Searching the web for '"quantum computer" nilpotent' +returns many results, so maybe the question is ontopic +for this site.

+
+

Can a quantum computer solve the following mathematical +problem:

+
+

This is related to an open problem, so likely the answer is negative.

+

The problem is Cycle Enumeration using Nilpotent Adjacency +Matrices with Algorithm Runtime Comparisons pp 2-3 about zeon algebra.

+

Is there commutative ring or commutative algebra $R$ with the following properties:

+
    +
  1. There are $n$ nilpotent elements $a_i$ satisfying $a_i^2=0$
  2. +
  3. $a_1 a_2 \cdots a_n \ne 0$.
  4. +
  5. Computation in $R$ is efficient: for an $n$ by $n$ matrix $M$ +with entries zero and $a_i$, for natural $m$ we can compute +$M^m$ in time polynomial in $nm$.
  6. +
+

If we omit the efficiency constraint, the answer is easy:

+

Take $R=K[a_1,a_2,...a_n]/(a_1^2,a_2^2,...a_n^2)$ for any ring $K$.

+",12448,,12448,,6/26/2020 8:25,6/26/2020 8:25,Rings or algebras with many nilpotent elements and efficient computation,,0,5,,,,CC BY-SA 4.0 +12651,1,,,6/25/2020 11:37,,1,45,"

I am wondering which are the top universities or research groups through the world that are doing research in the topic of quantum error correction or quantum channels (decoherence noise models). I think this is interesting in order to know which are the main tendencies that the quantum community is following concerning those fields.

+",2371,,,,,6/25/2020 11:37,Quantum channels and error correction research groups,,0,1,,,,CC BY-SA 4.0 +12652,1,12661,,6/25/2020 13:29,,1,124,"

I am trying to implement a three-qubit gate in an eight-qubit circuit. The method I use is the same by which I create my two-qubit gates with no issues. I produce the unitary of the gate and then introduce it to the _unitary_(self) method. I did the same for the three-qubit gate:

+
import cirq
+import numpy as np
+
+class CsAgate(cirq.ThreeQubitGate):
+    def __init__(self, theta):
+        self.theta = theta
+
+    def _unitary_(self):
+        st = np.sin(self.theta)
+        ct = np.cos(self.theta)
+
+        return np.array([
+        [1., 0, 0, 0,   0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],
+        [0, ct, st,0,   0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],
+        [0, st,-ct,0,   0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],
+        [0, 0, 0, 1.,   0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],
+
+        [0, 0, 0, 0,    1., 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0],
+        [0, 0, 0, 0,    0, ct,st, 0,    0, 0, 0, 0,     0, 0, 0, 0],
+        [0, 0, 0, 0,    0, st,-ct,0,    0, 0, 0, 0,     0, 0, 0, 0],
+        [0, 0, 0, 0,    0, 0, 0, 1.,    0, 0, 0, 0,     0, 0, 0, 0],
+
+        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],
+        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],
+        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],
+        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],
+
+        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],
+        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],
+        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],
+        [0, 0, 0, 0,    0, 0, 0, 0,     0, 0, 0, 0,     0, 0, 0, 0],
+        ]
+        )
+
+
+    def _circuit_diagram_info_(self, args):
+        return 'o','theta({})'.format(round(self.theta, 2)), '0'
+
+    def __str__(self):
+        return 'test'
+
+n_qubits = 8
+qubits = cirq.LineQubit.range(n_qubits)
+my_circuit=cirq.Circuit([CsAgate(2.)(qubits[0], qubits[1], qubits[2])])
+print(my_circuit)
+print(my_circuit.unitary())
+
+

The circuit is generated successfully but Cirq throws an error when calculating the circuit unitary. Any idea how to solve this issue?

+
Traceback (most recent call last):
+  File "/Users/mjahanpo/Desktop/opt_api/test.py", line 46, in <module>
+    print(my_circuit.unitary())
+  File "/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/circuits/circuit.py", line 1418, in unitary
+    result = _apply_unitary_circuit(self, state, qs, dtype)
+  File "/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/circuits/circuit.py", line 1960, in _apply_unitary_circuit
+    return protocols.apply_unitaries(
+  File "/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/protocols/apply_unitary_protocol.py", line 492, in apply_unitaries
+    result = apply_unitary(unitary_value=op,
+  File "/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/protocols/apply_unitary_protocol.py", line 347, in apply_unitary
+    result = strat(unitary_value, args)
+  File "/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/protocols/apply_unitary_protocol.py", line 384, in _strat_apply_unitary_from_apply_unitary
+    sub_result = func(sub_args)
+  File "/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/ops/gate_operation.py", line 113, in _apply_unitary_
+    return protocols.apply_unitary(self.gate, args, default=None)
+  File "/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/protocols/apply_unitary_protocol.py", line 347, in apply_unitary
+    result = strat(unitary_value, args)
+  File "/Users/mjahanpo/opt/anaconda3/envs/opt_api/lib/python3.8/site-packages/cirq/protocols/apply_unitary_protocol.py", line 419, in _strat_apply_unitary_from_unitary
+    matrix.reshape(val_qid_shape * 2),
+ValueError: cannot reshape array of size 256 into shape (2,2,2,2,2,2)
+
+",12489,,,,,6/25/2020 19:01,Can not build circuit unitary for a three-qubit gate in Cirq,,1,0,,,,CC BY-SA 4.0 +12653,1,,,6/25/2020 13:47,,1,209,"

I'm following the Qiskit textbook for Quantum Counting. We have assumed $M$ as the number of states containing solutions throughout the algorithm but at last, $N-M$ has been taken as the solution. What am I missing?

+

+

Here $|w\rangle$ corresponds to the number of states that contain solutions and $|𝑠'\rangle$ corresponds to the number of states that don't contain solutions.

+

$\langle s'|s\rangle = \cos \frac{\theta}{2}$

+

$\langle s'|s\rangle = \sqrt \frac{N-M}{N}$

+

We combine these equations to obtain:

+

$N \sin^2 \frac{\eta}{2} = M$

+

The theory part is understandable, and it clearly shows that $M$ is the number of states containing solutions, yet, the answer is given as $N-M$.

+

Can anyone help me with it?

+",12488,,8343,,6/27/2020 22:36,6/30/2020 12:32,Why is the number of solutions given in Qiskit textbook(Quantum Counting Algorithm) as N-M instead of M?,,2,0,,,,CC BY-SA 4.0 +12654,1,12659,,6/25/2020 14:25,,0,122,"

I have a two-qubit gate with below unitary:

+

+    def _unitary_(self):
+        st = np.sin(self.theta)
+        ct = np.cos(self.theta)
+        ei = np.exp(1j*self.phi)
+        emi = np.exp(-1j*self.phi)
+
+        return np.array([
+            [1.,        0,          0,  0],
+            [0,         ct,     ei*st,  0],
+            [0,         emi*st,   -ct,  0],
+            [0,         0,          0,  1.]
+        ]
+        )
+
+

I want to build a three-qubit gate in which one qubit serves as the control qubit on the above two-qubit gate while the gate is applied on the other two qubits.

+

Here is an example of such gate: Say the gate is applied on q0, q1, and q2 where q0 is the control qubit. The above 4*4 unitary should be applied to q1 and q2 if and only if q0 is 0.

+

How would the unitary of such three-qubit gate look like? (I'm doing this in Cirq)

+",12489,,,,,6/25/2020 18:34,How to build a controlled two-qubit gate?,,1,0,,,,CC BY-SA 4.0 +12655,2,,12481,6/25/2020 16:11,,1,,"

Well, I would say you can consider each possible outcome as a Bernoulli in the very same way!
+You can consider a state of $n$ qubits +$$|\varphi\rangle = \sum_{i}^k\alpha_i|x_i\rangle$$ +Where $|x_i\rangle$ is a vector of the computational basis (i.e. $|x_i\rangle \in \{|0\rangle, |1\rangle\}^{\otimes n}$) and each $|x_i\rangle$ has probability $|\alpha_i|^2$ of being measured.
+After creating and sampling such state $S$ times, you could consider $k$ Bernoulli trials - one for each $|x_i\rangle$ - where for each $i^{th}$ trial you consider a success if you measure the state $|x_i\rangle$ and failure if you measure any other state.

+

In that way you could just reuse the Wald/Wilson intervals for each $|x_i\rangle$.
+For instance, using the Wald interval, you could compute for each $|x_i\rangle$ +$$\hat{p}_i = \frac{\text{ number of times } |x_i\rangle\text{ appears}}{S}$$ +and say with confidence $z$ that +$$|\alpha_i|^2 \in [\hat{p}_i - \epsilon, \hat{p}_i + \epsilon]$$ +where +$$\epsilon = z\sqrt{\frac{\hat{p}_i(1 - \hat{p}_i)}{S}}$$

+",10259,,55,,6/25/2020 16:17,6/25/2020 16:17,,,,0,,,,CC BY-SA 4.0 +12656,1,,,6/25/2020 17:12,,4,532,"

It is well-known that one side of the Fuchs-van de Graaf inequality is saturated for pure states, i.e. $F(\rho,\sigma)^2 = 1-d(\rho,\sigma)^2$ when $\rho$ and $\sigma$ are pure (here we are using the definition $F(\rho, \sigma) := \|\sqrt{\rho}\sqrt{\sigma}\|_1$ for fidelity). However, are there other situations where it is known that this equality holds? How far has this been characterized?

+

As a starting point, I am aware that when the states are qubits, it can be shown that $F(\rho,\sigma)^2 = 1-d(\rho,\sigma)^2$ holds if and only if the states have the same eigenvalues. (This is not too difficult to prove using specialized qubit expressions for the fidelity, but as far as I am aware, it does not seem to be well-known.) The "have the same eigenvalues" condition does not generalize even to qutrits, however, and hence it may perhaps not be the best approach to characterizing the conditions.

+",12482,,,,,5/24/2021 11:43,Saturating the Fuchs-van de Graaf inequality,,1,1,,,,CC BY-SA 4.0 +12657,1,,,6/25/2020 18:03,,0,283,"

If We perform some unitary operations on a Quantum State $|A\rangle$ after which it becomes$|A'\rangle$. Then if we perform the inverse of all those unitary operations on the state $|A'\rangle$ in reverse order, can we roll back to the state $|A\rangle$?

+",8330,,55,,10/5/2020 13:41,10/5/2020 13:41,Are quantum operations reversible?,,1,1,,,,CC BY-SA 4.0 +12659,2,,12654,6/25/2020 18:34,,1,,"

MyTwoQubitGate().on(q1, q2).controlled_by(c)

+

or

+

MyTwoQubitGate().controlled().on(c, q1, q2)

+",119,,,,,6/25/2020 18:34,,,,2,,,,CC BY-SA 4.0 +12660,1,,,6/25/2020 18:47,,2,94,"

The protocol is: +We start with a supply +of identically prepared bipartite non-Gaussian states. The overall protocol then amounts to an iteration of the following +basic steps.

+
    +
  1. The states will be mixed pairwise locally at 50:50 +beam splitters.
  2. +
  3. On one of the outputs of each beam splitter, a photon +detector distinguishes between the absence and presence of +photons. It should be noted that we do not require photon +counters that can discriminate between different photon +numbers.
  4. +
  5. In case of absence of photons at both detectors for a +particular pair, one keeps the remaining modes as an input +for the next iteration, otherwise the state is discarded. +This is one iteration of the protocol which we will continue +until we finally end up with a small number of states +that closely resemble Gaussian states. +
  6. +
+

This protocol is presented in the paper: https://journals.aps.org/pra/abstract/10.1103/PhysRevA.67.062320

+

Specifically, what I am trying to understand is: why does vacuum detection at both outputs lead to distillation? What is the motivation for this step?

+",11668,,55,,6/28/2020 14:31,9/22/2020 16:00,What is the intuition behind the following entanglement distillation protocol for continuous variable systems?,,1,2,,,,CC BY-SA 4.0 +12661,2,,12652,6/25/2020 19:01,,1,,"

You specified a matrix whose size is consistent with a four qubit gate, not a three qubit gate. Also, the matrix isn't unitary (it has columns containing nothing but zeros). The matrix' size must be consistent with the number of qubits that the gate applies to.

+

Do this:

+
    def _unitary_(self):
+        st = np.sin(self.theta)
+        ct = np.cos(self.theta)
+
+        return np.array([
+            [1., 0, 0, 0,   0, 0, 0, 0],
+            [0, ct, st,0,   0, 0, 0, 0],
+            [0, st,-ct,0,   0, 0, 0, 0],
+            [0, 0, 0, 1.,   0, 0, 0, 0],
+
+            [0, 0, 0, 0,    1., 0, 0, 0],
+            [0, 0, 0, 0,    0, ct,st, 0],
+            [0, 0, 0, 0,    0, st,-ct,0],
+            [0, 0, 0, 0,    0, 0, 0, 1.],
+        ])
+
+

Also, based on that matrix, it looks like this is actually a two qubit gate tensored with an identity gate on a third qubit.

+",119,,,,,6/25/2020 19:01,,,,0,,,,CC BY-SA 4.0 +12662,1,12664,,6/26/2020 1:06,,1,306,"

I would like to create a n-dimensional Hadamard transform in Q# with n in set of even integers.

+",12239,,,,,6/26/2020 6:58,How can I create an n-dimensional Hadamard transform in Q#?,,2,0,,,,CC BY-SA 4.0 +12663,2,,12662,6/26/2020 1:28,,1,,"

The higher order analog of Hadamard Transform is the Quantum Fourier Transform. +You can learn more about it on Wikipedia.

+",8757,,9006,,6/26/2020 6:58,6/26/2020 6:58,,,,1,,,,CC BY-SA 4.0 +12664,2,,12662,6/26/2020 1:45,,3,,"

If you're looking to implement $H^\otimes$ (i.e., applying the Hadamard transform to each of the $n$ qubits), you can use library operation ApplyToEach:

+
using (register = Qubit[n]) {
+    ApplyToEach(H, register);
+}
+
+
+

If you are indeed looking for quantum Fourier transform, as the other answer suggests, the Q# library operation that implements it is ApplyQuantumFourierTransform.

+",2879,,,,,6/26/2020 1:45,,,,2,,,,CC BY-SA 4.0 +12665,2,,12657,6/26/2020 7:06,,3,,"

Any operation on quantum computer (with measurement being exception) are described by unitary matrix. A feature of the unitary matrix is $AA^\dagger=I$, which means that transpose conjugate to matrix $A$ is inverse to $A$ too. It can be easily proven that if $A$ is unitary then $A^\dagger$ is also unitary hence it is also quantum gate.

+

If you came from state $|\psi_0\rangle$ to $|\psi_1\rangle$ by transformation $A|\psi_0\rangle = |\psi_1\rangle$, then it is possible to reverse the transformation in this way: $A^{\dagger}|\psi_1\rangle = |\psi_0\rangle$.

+

In practise, this means that you put all gates in original circuit in reverse order and replace each gate $A$ with its transpose conjugate operator $A^{\dagger}$.

+",9006,,,,,6/26/2020 7:06,,,,6,,,,CC BY-SA 4.0 +12668,1,12738,,6/26/2020 15:52,,0,445,"

First, I apologize if something is poorly written but English is not my first language.

+

I know that these exercises have been solved in this question. But I do not agree. Inner product and concrete vectors are used and I think that this question has to be solved only with information we have from the beginning of chapter 2 until the exercise.

+

So I think we only have to use eq. 2.12 in this way:

+

if we write $\left|0\right>=\left|v_{0}\right>$ and $\left|1\right>=\left|v_{1}\right>$ and we use them as input and output basis, we can write (2.12) as $A\left|v_{j}\right> = \sum_{i} A_{ij} \left|v_{i}\right>$; so,

+

$A\left|v_{0}\right> = A_{00}\left|v_{0}\right> + A_{10}\left|v_{1}\right> = \left|v_{1}\right> \Rightarrow A_{00}=0; A_{10}=1$

+

$A\left|v_{1}\right> = A_{01}\left|v_{0}\right> + A_{11}\left|v_{1}\right> = \left|v_{0}\right> \Rightarrow A_{01}=1; A_{11}=0$

+

$$ +A = \begin{bmatrix} +0 & 1\\ +1 & 0 +\end{bmatrix} +$$

+

As we can see I don't use concrete basis vectors and this works for basis $\begin{pmatrix}0 \\1 \end{pmatrix}$ and $\begin{pmatrix}1 \\0 \end{pmatrix}$.

+

But not with basis like $\frac{1}{\sqrt{2}}\begin{pmatrix}1 \\1 \end{pmatrix}$ and $\frac{1}{\sqrt{2}}\begin{pmatrix}1 \\-1 \end{pmatrix}$.

+

My feeling was that this solution doesn't depend on the basis but it does. So why?

+",,user12503,55,,6/26/2020 20:26,7/1/2020 16:21,How to find the matrix representation of an operator from its action on a basis?,,2,16,,,,CC BY-SA 4.0 +12670,1,12671,,6/26/2020 22:18,,0,77,"

The entanglement negativity, introduced in (Vidal and Werner 2002), is defined as +$$\mathcal N(\rho) \equiv \frac{\|\rho^{T_B}\|_1-1}{2}.$$ +It is mentioned there that this equals the sum of the absolute values of the negative values of the eigenvalues of the partial transpose $\rho^{T_B}$: +$\mathcal N(\rho)=\sum_{\lambda<0} \lvert\lambda\rvert$.

+

How does one show the equivalence of these two quantities?

+",55,,10480,,3/9/2021 18:49,3/9/2021 18:49,Why does the entanglement negativity equal (in magnitude) the sum of the negative eigenvalues?,,1,0,,,,CC BY-SA 4.0 +12671,2,,12670,6/26/2020 22:18,,1,,"

This is also discussed in the paper linked above. The trace norm of $X$ is defined as the sum of the absolute values of the eigenvalues of $X$: $\|X\|_1=\sum_i \lvert\lambda_i\rvert$. +$\newcommand{\tr}{\operatorname{tr}}$Given a state $\rho$, the normalisation condition amounts to +$$\tr(\rho) = \sum_i \lambda_i = \sum_{\lambda\in\sigma_+}\lambda + \sum_{\lambda\in\sigma_-}\lambda = 1,$$ +where $\sigma_\pm$ is the set of positive (negative) eigenvalues. +Given $\rho=\rho_{ij,k\ell}|ij\rangle\!\langle k\ell|$, +the partial transpose $\rho^{T_B}$ reads +$\rho^{T_B}=\sum_{ijk\ell}\rho_{ij,k\ell}|i\ell\rangle\!\langle kj|$, which means that +$$\tr(\rho^{T_B})=\sum_{ij} \rho_{ij,ij} = \tr(\rho) = 1.$$

+

It follows that +$$\|\rho^{T_B}\|_1 = \sum_i \lvert\lambda_i\rvert = \sum_{\lambda\in\sigma_+}\lambda - \sum_{\lambda\in\sigma_-}\lambda += 1 - 2 \sum_{\lambda\in\sigma_-}\lambda. +$$ +And therefore +$$\mathcal N(\rho) = \frac{\|\rho^{T_B}\|_1-1}{2} = -\sum_{\lambda\in\sigma_-}\lambda = \sum_{\lambda\in\sigma_-}\lvert\lambda\rvert.$$

+",55,,55,,6/26/2020 22:25,6/26/2020 22:25,,,,0,,,,CC BY-SA 4.0 +12672,2,,12507,6/26/2020 23:35,,0,,"

Yes, here it is: this project (https://github.com/softwareQinc/staq) attempts to synthesize Verilog code to OpenQASM.

+

As you may know, the Verilog is used to build very complex/large classical circuits, which can implement any functions.

+

The project has limitations because it supports only a small subset of the Verilog. Though it is hard to prove mathematically what is the minimum subset of the Verilog required to implement all the functions, the project is useful enough to implement a lot of non-trivial functions.

+

There is another practical drawback: that project has a few critical bugs that prevent it from doing what is supposed to do. When they are fixed by the project owner, it should give you what you want.

+",9768,,,,,6/26/2020 23:35,,,,5,,,,CC BY-SA 4.0 +12673,1,12674,,6/27/2020 0:13,,0,118,"

The entanglement negativity $\mathcal N(\rho)$ of a (bipartite) state $\rho$ is defined as the absolute value of the sum of the negative eigenvalues of the partial transpose of a state, or equivalently, $2\mathcal N(\rho)=\|\rho^{T_B}\|_1-1$.

+

Consider a maximally entangled pure state: $|\psi\rangle \simeq \sum_{k=1}^N |k,k\rangle$. What is the entanglement negativity of such states? What are good ways to derive this quantity?

+",55,,10480,,3/9/2021 18:49,3/9/2021 18:49,Compute the negativity of maximally entangled bipartite states,,1,0,,,,CC BY-SA 4.0 +12674,2,,12673,6/27/2020 0:34,,0,,"

Let $\sqrt N|\psi\rangle=\sum_{k=1}^N|k,k\rangle$ be a maximally entangled state of dimension $N$, and $\rho\equiv|\psi\rangle\!\langle\psi|$. +More generally, we don't need to stick to maximally entangled states: any state with this (or equivalent) Schmidt decomposition will behave identically.

+

The partial transpose reads +$\rho^{T_B}=\frac{1}{N}\sum_{ij}\lvert ij\rangle\!\langle ji\rvert. $ +Separating this into terms that are symmetric and terms that are not we get +$$N\rho^{T_B} = \sum_i \lvert ii\rangle\!\langle ii| + \underbrace{\sum_{i\neq j}\lvert ij\rangle\!\langle ji\rvert}_{A},$$ +where here $A^\dagger =A$, $\operatorname{tr}(A)=0$, and $A^2=I$. +It follows that $A$ has an equal number of eigenvalues equal to $+1$ and $-1$. +Moreover, the rank of $A$ is $N(N-1)$, so the multiplicity of both eigenvalues is $N(N-1)/2$.

+

The eigenvalues of $\rho^{T_B}$ are therefore $\frac1 N$ with multiplicity $N+\frac{N(N-1)}2=\frac{N(N+1)}{2}$, and $-\frac1 N$ with multiplicity $\frac{N(N-1)}2$.

+

We conclude that the negativity equals $\frac{N(N-1)}{2}\frac{1}{N}=\frac{N-1}{2}$.

+",55,,55,,6/27/2020 0:39,6/27/2020 0:39,,,,0,,,,CC BY-SA 4.0 +12675,2,,12668,6/27/2020 1:52,,0,,"

A simple explanation is if we look geometrically at what $A$ is doing, which is a reflection. For orthogonal basis $|v_1\rangle, |v_2\rangle$ we want to find unitary transform $A$, where

+

$A|v_1\rangle = |v_2\rangle$,

+

and

+

$A|v_2\rangle = |v_1\rangle$,

+

i.e. we want to find a reflection matrix. We want to find the vector, $r$, that reflects $|v_1\rangle$ to $|v_2\rangle$, and this is dependant on the choice of $|v_1\rangle$ to $|v_2\rangle$. The axis of reflection is the vector inbetween so

+

$r = \frac{1}{2}\left( |v_1\rangle - |v_2\rangle \right)$.

+

Using the Householder identity for the reflection matrix $R = I - 2rr^T = A$, gives us $A$ which is dependent on the basis vectors.

+

As an example for the computational basis we get:

+

$r = 0.5\begin{pmatrix} 1 \\ 0 \end{pmatrix} - \begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 0.5 \\ -0.5 \end{pmatrix}$

+

plugging this into the Householder identity:

+

$A = I - 2\begin{pmatrix} 0.5 \\ -0.5 \end{pmatrix}\begin{pmatrix} 0.5 & -0.5 \end{pmatrix} = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$.

+

Repeating this for your second basis vectors we can find that we are reflecting about the x-axis, if you can't immediately see this try plotting the two basis vectors. We then get,

+

$A = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$

+",6139,,6139,,6/27/2020 3:08,6/27/2020 3:08,,,,3,,,,CC BY-SA 4.0 +12676,1,12681,,6/27/2020 3:19,,1,89,"

All quantum computers now are working with qubit which is zero or one.

+

Can we have quantum computer with multiple-state unit? Such as trit (trinary, 3 states), digit (10 states) instead of qubit (2 states)?

+",12506,,9006,,6/27/2020 6:29,6/27/2020 6:29,Can we have multiple-state unit for quantum computer?,,1,0,,,,CC BY-SA 4.0 +12677,1,12682,,6/27/2020 3:45,,5,574,"

I work with stabilizer codes using the real version of Pauli matrices:

+

$X=((0,1),(1,0))$, $Z=((1,0),(0,-1))$, $Y=XZ$ (not $\imath XZ$).

+

I know the encoders for these codes lie in the Clifford group which is generated by the matrices (P,H,CX) described here:

+

Presentation of the Clifford group by generators and relations

+

Are H and CX enough to generate a real version of the Clifford group? Or is there an additional gate to replace the "P" gate? (This would be the group of real $2^n \times 2^n$ orthogonal matrices that normalize the group generated by the real Pauli matrices.)

+",12265,,734,,6/27/2020 19:13,6/27/2020 19:13,"What are generators for a ""real"" Clifford group?",,2,0,,,,CC BY-SA 4.0 +12678,2,,12634,6/27/2020 5:08,,3,,"

It seems that such a transformation would not be unitary. Since it drops the information about bit $q_0$ altogether, it would have basis states that differ in that bit transformed into the same state, and that would not be possible to invert.

+",2879,,,,,6/27/2020 5:08,,,,4,,,,CC BY-SA 4.0 +12679,1,12684,,6/27/2020 5:34,,4,136,"

Disclaimer: I had posted this question previously on the physics StackExchange, but received no response there.

+

My question is two-part. First, imagine a bipartite quantum state $|\Phi \rangle_{AB}$, made of $2n$-qubits, shared between Alice and Bob (with $n$-qubits each). Alice performs some unitary operation $U$ on her part of the state and then performs $Z$-basis measurements. As a result, Bob's state collapses to a mixed superposition of states. Now, if Alice measures her state to be $|0\rangle^{\otimes n}$, how do I write the state that Bob's share has collapsed to, in bra-ket notation? At first, I thought it would be $\langle 0 |^{\otimes n} (U \otimes I_n) | \Phi \rangle_{AB}$ but that is, of course, incorrect (dimensional mismatch tells me that). I should probably be using some projection operators instead of simply $\langle 0 |^{\otimes n}$ but I can't figure out exactly what.

+

Second, assume that $| \Phi \rangle_{AB} = \left ( \frac{|00\rangle_{AB} + |11 \rangle_{AB}}{\sqrt{2}} \right )^{\otimes n}$ so that Alice owns the first qubit from every term and Bob owns the second (essentially, they share $n$ copies of the $|\Phi^+\rangle$ Bell state between them). Now what I want to prove is $$U^{\dagger} | 0 \rangle^{\otimes n} = \color{red}{\langle 0 |^{\otimes n} (U \otimes I_n) | \Phi \rangle_{AB}} $$ +where I've colored the RHS red to emphasize that I know it is wrong, but it should be replaced by the properly notated answer to my first question. How do I go about proving this? I'm only asking for a hint, not a full proof. Thanks.

+

(This is by no means homework; my QM skills have grown somewhat rusty but I need to use this proof in a paper that I'm working on)

+",6113,,55,,9/30/2020 3:54,9/30/2020 3:54,Bra-Ket Notation and Proof of a Ket Equation in Two-Party Shared-Entanglement Setting,,1,3,,,,CC BY-SA 4.0 +12680,2,,12635,6/27/2020 6:19,,1,,"

About checking. +I do not quite understand why you can't check how the GHZ-state was teleported in the most ordinary ways: in addition to measuring the state immediately after teleportation, as well as by YYX, YXY, XYY, XXX measurements, you can inverse your GHZ-state and make sure that all 0 are obtained, e.g. like as for this with the most usual GHZ-state teleportation scheme: + +I think that all listed checking methods (slightly customized) will work with other GHZ-state teleportation schemes, and in addition, +the checking method by inversion will work with other desired states (of course, if you can comparing that was before creating state and that became after inversing of state).

+

About teleportation schemes of arbitrary qubit states via clusters states can see e.g. here.

+",12280,,12280,,6/28/2020 16:35,6/28/2020 16:35,,,,7,,,,CC BY-SA 4.0 +12681,2,,12676,6/27/2020 6:28,,1,,"

Generally, you can have quantum computer with so-called qudits, i.e. qubits with two possible states are replaced by an entity having $d$ distinguished states. Example is so-called qutrit having three possible values ($|0\rangle$, $|1\rangle$ and $|2\rangle$).

+

Application of qutrit was devised for example in quantum RAM. See this paper Quantum random access memory for more information.

+

Although in theory you can have as many states as you want, in practise it can be problematic to build suchs device because of noise. Increasing the number of possible values ($d$), the noise also increases. See how much the noise "destroy" computation in quantum computers based on qubits.

+",9006,,,,,6/27/2020 6:28,,,,0,,,,CC BY-SA 4.0 +12682,2,,12677,6/27/2020 6:47,,2,,"

This paper uses $H$, $Z$ and $C_Z$ to generate the real Clifford group. You can replace $C_Z$ by $C_X$, but you will need the same number of generators.

+",104,,,,,6/27/2020 6:47,,,,1,,,,CC BY-SA 4.0 +12683,1,12691,,6/27/2020 10:45,,1,83,"

One difference of course is the syntax. But I'm guessing the idea is eventually quantum computers will be able run Q#, whereas now it uses simulations. Will code written in Python with the qSharp library also be able to do this?

+",12510,,2879,,6/27/2020 18:51,6/27/2020 18:51,What would be the difference between using qsharp library on python vs learning the Q# langauge?,,1,0,,,,CC BY-SA 4.0 +12684,2,,12679,6/27/2020 10:58,,2,,"

Let's consider the following $4$ qubit state (taking $n=2$ from the quesion):

+

$$|\psi_{in} \rangle = \frac{1}{2} \big( |0 0\rangle \otimes |00\rangle + |1 1\rangle \otimes |1 1\rangle + |01\rangle \otimes |01\rangle + |10\rangle \otimes |10\rangle\big)$$

+

The first two qubits are Alice's qubits and the last two qubits are Bob's qubits. We can describe this operation by projective measurements (for definition: M. Nielsen and I. Chuang textbook's page 87) for observable $M$:

+

$$M = m_{00} P_{00} + m_{01} P_{01} + m_{10} P_{10} + m_{11} P_{11}$$

+

where $P$s are the corresponding projectors onto eigenspaces of $M$ with their eigenvalues $m$:

+

$$ +P_{00} = |0 0\rangle \langle 0 0| \otimes II \qquad m_{00} = 1 +\\ +P_{01} = |0 1\rangle \langle 0 1| \otimes II \qquad m_{01} = 2 +\\ +P_{10} = |1 0\rangle \langle 1 0| \otimes II \qquad m_{10} = 3 +\\ +P_{11} = |1 1\rangle \langle 1 1| \otimes II \qquad m_{11} = 4 +$$

+

Here it can be proved that $M$ is a Hermitian operator. The one projector whose action is described in the question (obtaining the $|00\rangle$ state after the measurement) is the $P_{00}$ projector. The resulting state after applying $P_{00}$ projector (the formula can be found from the same textbook's page 88):

+

$$|\psi_{out}\rangle = +\frac{P_{00} |\psi_{in}\rangle}{\sqrt{\langle \psi_{in}| P_{00} |\psi_{in} \rangle}} += |0 0\rangle \otimes |00\rangle +$$

+

If we apply some $U$ to Alice's qubit's before the measurement, then:

+

$$|\psi_{out}\rangle = +\frac{P_{00} \big( U \otimes I \big)|\psi_{in}\rangle}{\sqrt{\langle \psi_{in}| \big( U^\dagger \otimes I \big) P_{00} \big( U \otimes I \big)|\psi_{in} \rangle}} +$$

+

If we disregard Alice's qubits, then Bob's state will be as follows:

+

$$|\psi_{B}\rangle = +\frac{\big( \langle 0 0| \otimes I \big) \big( U \otimes I \big)|\psi_{in}\rangle}{\sqrt{\langle \psi_{in}| \big( U^\dagger \otimes I \big) P_{00} \big( U \otimes I \big)|\psi_{in} \rangle}} +$$

+

Here $I$ operators are 4x4 identity matrices.

+",9459,,9459,,6/28/2020 14:18,6/28/2020 14:18,,,,3,,,,CC BY-SA 4.0 +12685,1,,,6/27/2020 11:36,,1,65,"

My goal is to think of a creative way to clone quantum data, specifically, forensically examine a quantum hard drive or memory of the future.

+

No, I don't think I can violate the No Cloning Theorem or bypass the Measurement issue. But I was wondering if a creative addition, such as using quantum teleportation or something like that could be used?

+

For example, what if with every qubit of data (X) on a quantum hard drive, we also required a separate, "assigned" Bell pair (A=B). So every time we create X we also entangle it with A (A=X=B). Could B, outside the hard drive be used to read X? Or am I begging the question...because it would be impossible to entangle X without changing X from it's original state or something like that? Could some mechanism like redundant probability "reads" be used...like something borrowed from quantum error correction ideas?

+",8193,,55,,6/27/2020 11:53,6/27/2020 12:29,Creative way to clone quantum data?,,1,0,,,,CC BY-SA 4.0 +12686,2,,12685,6/27/2020 12:29,,1,,"

So the no cloning theorem doesn't preclude you from creating the state +$$\alpha|0\rangle + \beta|1\rangle \rightarrow \alpha|00\rangle + \beta|11\rangle,$$ +it just says you cant create +$$\alpha|0\rangle + \beta|1\rangle \rightarrow (\alpha|0\rangle + \beta|1\rangle)(\alpha|0\rangle + \beta|1\rangle).$$

+

So yeah, you could do something like create a state like the first state, and then you would have "cloned" the measurement statistics in one basis. That is, if you were only interested in the Z basis measurement statistics of the qubit, and you apply a CNOT to it to create the state $\alpha|00\rangle + \beta|11\rangle$, you would have two qubits which you could measure and sample from that distribution. But only one of them could be measured before the wavefunction collapses, and only the Z basis distribution would be preserved. This is because in the X basis, the state would not be of the form $\gamma|++\rangle + \delta|--\rangle$.

+

That's the closest I can think of.

+",3056,,,,,6/27/2020 12:29,,,,9,,,,CC BY-SA 4.0 +12687,2,,12677,6/27/2020 14:49,,2,,"

Note that if you don't keep track of the phase $i$ in $Y = iXZ$, so letting $\hat{Y} = XZ$, then something 'weird' happens:

+

$$ +\hat{Y}\hat{Y} = XZXZ = X(-XZ)Z = -XXZZ = -I. +$$ +This is not just an oddity. Any stabilizer code with a generator $G_{1}$ containing an (odd number of) $Y$ will now not be possible, because: +$$ +G_{1}G_{1} = -I \in \mathcal{S}. +$$ +But this is of course a contradiction, because $-I$ has no $+1$ eigenstates, and therefore cannot be part of the stabilizer.

+

By getting rid of that $i$ explicitly you thus destroy the structure of the code.

+

This is not to say that you explicitly need to keep track of the phase; many people use the binary formalism (see section 'Relation between Pauli group and binary vectors'). Here you also don't track the phase.

+

You are looking for the normalizer of the real Pauli group in the real Unitary group, which is the Orthogonal group. Because the commutation relations of the Paulis need to be preserved under conjugation of any element of the normalizer, all that such an operations can do is permute the elements $\{\pm 1\}\otimes\{X,\hat{Y},Z\}$. Table $1$ on page $20$ of this paper lists all such permutations (there are $24$, so that's why there are $24$ elements in the single-qubit Clifford group). The authors also decompose the permutations into different generators for the Clifford group, namely two half-rotations along either the $X-,Y-$ or $Z$-axes. I really think those generators are the most intuitive; you can also relatively easily adapt them to 'take out' the imaginary parts by distilling a global phase.

+

As noted in the other answer, another set of generators that you can use is $\{H,Z\}$, and equally $\{H,X\}$.

+

However, I would personally use the elementary permutations $\{1,2,3\} \rightarrow \{1,-3,2\}$ and $\{1,2,3\} \rightarrow \{-2,1,3\}$ (with $\{1,2,3\}$ indicating $\{X,Y,Z\}$), which you can use to create any permutation. These permutations are equivalent to a $e^{i\frac{\pi}{2}X}$ and $e^{i\frac{\pi}{2}Z}$ rotation, respectively. These are not real matrices, but do indicate much more structure.

+",8141,,,,,6/27/2020 14:49,,,,3,,,,CC BY-SA 4.0 +12688,2,,12653,6/27/2020 15:53,,1,,"

(I'm unsure if you were asking for a derivation of the inner product, but hopefully this is insightful). Let's call the set of target states $T$. Recognize that, because $|\omega\rangle$ is the equal superposition of $ M$ states, each of the marked bitstrings will have a coefficient of $ \frac{1}{\sqrt{M}} $. For clarity, we can write:

+

$$ | \omega \rangle = \frac{1}{\sqrt{M}} \sum_{k \in T} | k \rangle $$

+

In contrast, $| s' \rangle $ is the orthogonal state, so it has $N - M $ states that are in a uniform superposition. Thus,

+

$$ |s' \rangle = \frac{1}{\sqrt{N - M}} \sum_{k \not \in T} | k \rangle $$

+

Finally, we note the initial state is a uniform superposition over all potential states. Thus, there are $N$ potential states, so we can write:

+

$$ |s \rangle = \frac{1}{\sqrt{N}} \sum_{k} | k \rangle = \frac{1}{\sqrt{N}} \Big( \sum_{k \in T} | k \rangle + \sum_{k \not \in T} |k \rangle \Big)$$

+

Thus, we take the inner product:

+

$$ \langle s' | s \rangle = \Big(\frac{1}{\sqrt{N - M}} \sum_{k \not \in T} \langle k | \Big) \Big( \frac{1}{\sqrt{N}} \sum_{j} |j \rangle \Big) $$

+

Note that unless $k = j $, $ \langle k | j \rangle $ vanishes as two distinct basis vectors are orthogonal. Thus, we can rearrange the summation:

+

$$ \sum_{k \not \in T} \frac{1}{\sqrt{N - M}} \frac{1}{\sqrt{N}} \langle k | k \rangle = \sum_{k \not \in T} \frac{1}{\sqrt{N- M }} \frac{1}{\sqrt{N}} $$

+

Recall that we have $M$ target states, so there are $N - M$ nontarget states (or $N - M$ times where $k \not \in T$), so:

+

$$ \frac{N - M}{\sqrt{N - M}} \frac{1}{\sqrt{N}} = \sqrt{\frac{N - M}{N}} $$.

+

As desired.

+",8343,,,,,6/27/2020 15:53,,,,0,,,,CC BY-SA 4.0 +12690,2,,12621,6/27/2020 18:36,,4,,"

What the author is trying to say is that it does not matter in which order you write down the two subsystems, it is still the same state. It becomes much clearer if you add subscripts for the subsystems $1$ and $2$. +Let's say $H_1$ and $H_2$ are finite dimensional with bases $|u_i\rangle_1$ and $|v_j\rangle_2$. The Hilbertspace $H_1\otimes H_2$ has a basis $|w_{ij}\rangle = |u_i\rangle_1 \otimes |v_j\rangle_2$, but the order does not matter: $|w_{ij}\rangle=|u_i\rangle_1 \otimes |v_j\rangle_2 = |v_j\rangle_2 \otimes |u_i\rangle_1$. The same applies to the states $|\phi\rangle$ and $|\chi\rangle$: +$$ +\begin{aligned} +|\phi\rangle_1 \otimes |\chi\rangle_2 +=& \sum_{ij} \phi_i \chi_j |v_i\rangle_1\otimes |u_j\rangle_2 \\ +=& \sum_{ij} \phi_i \chi_j |w_{ij}\rangle \\ +=& \sum_{ij} \phi_i \chi_j |u_j\rangle_2\otimes |v_i\rangle_1 \\ +=& |\chi\rangle_2 \otimes |\phi\rangle_1 +\end{aligned} +$$ +Your confusion probably comes from the fact that the coefficients in a vector representation change when you change the basis. This is because in general the tensor product is not commutative. For example: +$$\left( +\begin{array}{c} +1\\ 0 \end{array}\right) \otimes \left( +\begin{array}{c} +0\\ 1 \end{array}\right) = \left( +\begin{array}{c} +0\\1 \\ 0 \\ 0 \end{array}\right)$$ +but +$$\left( +\begin{array}{c} +0\\ 1 \end{array}\right) \otimes \left( +\begin{array}{c} +1\\ 0 \end{array}\right) = \left( +\begin{array}{c} +0\\0 \\ 1 \\ 0 \end{array}\right).$$

+",104,,104,,7/5/2020 8:02,7/5/2020 8:02,,,,0,,,,CC BY-SA 4.0 +12691,2,,12683,6/27/2020 18:51,,1,,"

There are several separate questions entangled here.

+

Using Q# with Python as the host language is similar to using Q# with C# or another classical host language: it allows you to run Q# code and do necessary classical processing (for example, preparing the data or analyze the results). The Q# code invoked from the classical host language has to be written somewhere - it will be either the library code or the code you wrote yourself.

+

Learning Q# language itself allows you to implement any algorithm you want; without doing that, you'll be limited to using algorithms implemented by somebody else. That's certainly possible.

+

Running the program on quantum hardware vs in simulation is completely independent from the way you run it (from Python, C# or in standalone mode) - it's a matter of configuring the right target machine.

+",2879,,,,,6/27/2020 18:51,,,,0,,,,CC BY-SA 4.0 +12692,1,12697,,6/27/2020 19:36,,2,183,"

Using classical error correction (or channel coding) as a reference, I'd like to be able to compare QECC's from different constructions. Distance is a reasonable measure and you can argue that an $[[n_1,k_1,d_1]]$ is a better code than an $[[n_2,k_2,d_2]]$ if for example $k_1/n_1 = k_2/n_2$ and $d_1>d_2$ (same rate, larger distance); or maybe $d_1 = d_2$ and $k_1/n_1 \gt k_2/n_2$, (same distance, higher rate),or $n_1/k_1=n_2/k_2, d_1=d_2$ and $n_1 \lt n_2$, (same rate and distance, smaller number of physical qubits). However, just like the classical case, I'm sure that distance doesn't tell the whole story. The "channel" (or error model) has to enter the picture as well as the decoding algorithm. Distance can also be difficult to calculate for large $n$. In classical ECC, a plot of BER vs SNR in AWGN channel can quickly tell you if a code/decoder combination gives better performance than another. What would be possible equivalents for QECC? (to simplify things you can ignore decoder complexity as a parameter; you can also limit QECC's to stabilizer codes)

+",12265,,55,,9/30/2020 3:54,9/30/2020 3:54,"Other than distance, what other metrics can be used to compare quantum error correcting codes?",,2,0,,,,CC BY-SA 4.0 +12693,1,,,6/27/2020 19:41,,5,274,"

I have a state $$\dfrac{1}{2}(|00000\rangle+|00111\rangle+|11101\rangle+|11010\rangle).$$ How does one create this state? In general, how does one create for instance an $n$-bit cluster state, is there any particular rule? And by looking at a particular cluster state, how can one construct the quantum circuit that created the state?

+",6070,,10480,,1/22/2021 21:10,1/22/2021 21:10,Creating a specific cluster state,,1,1,,,,CC BY-SA 4.0 +12694,2,,12656,6/28/2020 1:22,,1,,"

This is not a saturation of the the Fuchs-van de Graaf upper bound, $F(\rho,\sigma)^2 = 1-d(\rho,\sigma)^2$, but rather the lower bound, $1 - \sqrt{F(\rho,\sigma)} \leq d(\rho,\sigma)$ (see, for example, here).

+

Consider, $\rho = | \psi \rangle \langle \psi |$, a pure state and $\sigma = \frac{\mathbb{I}}{d}$ is the maximally mixed state (for a $d$-dimensional Hilbert space). Then, the fidelity reduces to $F(| \psi \rangle \langle \psi | , \frac{\mathbb{I}}{d}) = \langle \psi | \frac{\mathbb{I}}{d} | \psi \rangle = \frac{1}{d}$ (see, for example, Wikipedia).

+

And the trace norm distance is $\left\Vert | \psi \rangle \langle \psi | - \frac{\mathbb{I}}{d} \right\Vert_{1} = \left( 1-\frac{1}{d} \right) + \frac{d-1}{d} = 2(1-\frac{1}{d})$. Therefore, using the normalized trace norm, $d(\rho, \sigma) \equiv \frac{1}{2} \left\Vert \rho - \sigma \right\Vert_{1}$, we have, $1 - F(\rho,\sigma) = d(\rho,\sigma)$

+",1108,,1108,,6/28/2020 4:36,6/28/2020 4:36,,,,1,,,,CC BY-SA 4.0 +12695,2,,12693,6/28/2020 10:15,,4,,"

You can think of a cluster state as a graph state, where the graph's vertices are on some $d$-dimensional lattice (normally just $2$-dimensional). Each vertex represents a qubit in the $|+\rangle$ state, and two vertices that are next to each other on the lattice may be connected, which means that a $CZ$ or controlled-$Z$ gate has been applied to them.

+

Within this picture, it's relatively straightforward to prepare a cluster state. For a cluster state that is equivalent to some graph with vertices $V = (1,2,3...n)$ and edges +$\{a,b\} \in E$, where $E$ is the set of all connected edges and obvsiouly $E$ is a subset of $V^{2}$. +Starting from $n$ qubits in the $|0\rangle$ state:

+
    +
  • Apply a Hadamard operation $H$ to all $n$ qubits

    +
  • +
  • Apply a controlled-$Z$ operation to all pairs $\{a,b\}$ of qubits if $\{a,b\} \in E$

    +
  • +
+

This results in that particular cluster state. Note that there can be multiple different cluster states for a particular number of qubits.

+

Concerning the particular state that you wrote down; I am not sure if this is a cluster state. The operators $ZZIII$ and $IIZIZ$ are in the stabilizer of this state, meaning that the state is a $+1$ eigenstate of both these operators. However, the stabilizer of a graph state can easily be calculated from the graph, and all the operators in the stabilizer need to have at least one $X$ or $Y$ Pauli in them, which does not hold for the above two operators.

+

If you're up for it, this paper contains a very detailed and thorough introduction to graph states, of which cluster states are a strict subset. It is a tough read though, so be prepared:)

+",8141,,,,,6/28/2020 10:15,,,,2,,,,CC BY-SA 4.0 +12696,2,,12692,6/28/2020 11:02,,2,,"

If you focus solely on stabilizer/additive codes, I believe that the weight of the Paulis in the stabilizer is highly important. The weight of a $n$-qubit Pauli is the number of non-trivial factors in it.

+

The weight of the correctable errors has a close correspondence with the distance of a code, but the weight of the elements of the stabilizer is also important for the error correction process. In standard error syndrome measurement, a stabilizer generator is measured using an ancilla that is entangled through a 'controlled-generator' gate. The higher the weight of the generator, the harder it is to implement this gate. In current quantum computing architectures, the connectivity between qubits is severely limited (and I think this will always be the case), so measuring a weight-$10$ generator is easier said then done.

+

For instance, the $5$-qubit 'perfect' code is by no means perfect because the generators are of weight $4$. If you use just $1$ ancilla, that means that this ancilla needs to be connected to all the data qubits.

+

You can check out the concept of LDPC-codes (Low Density Parity Check) that tries to acknowledge this problem.

+

Now, by no means this is the only or necessarily most important measure for a code, but I think it is easy to forget about it during theoretical analysis.

+",8141,,,,,6/28/2020 11:02,,,,2,,,,CC BY-SA 4.0 +12697,2,,12692,6/28/2020 18:26,,2,,"

So the biggest number used when comparing families of QECCs is the threshold, which is the error rate (generally depolarizing noise or XZ noise, depends on the paper) for which increasing the size (and distance) of the code actually increases performance.

+

Look at figure 4 in this paper. On the top plot, you can see that above a certain error rate, the extra machinery needed to correct errors is actually not worth it, and smaller codes perform better. However below this threshold, increasing your distance is worthwhile.

+

Code families (meaning sets of codes that have the same structure, such as surface codes or triangular color codes) are often compared with their threshold. Some, like the Bacon-Shor codes, don't have one at all, and instead have a sweet-spot distance for any given error rate.

+

Another metric, as mentioned in @JSdj's comment, is the size of the stabilizers. This essentially ends up corresponding to the connectivity required in the quantum hardware to effectively run the code. Codes which require a lot of connectivity often suffer from error propagation issues, since a single component having an error will quickly spread it.

+

Lastly, when it comes to error models there are a lot of different things to consider. In this paper, we talked about a few ion trap error models, and discussed how their structure interacts with different codes. This paper discusses how important it will be to optimize fault-tolerant protocols to different error models, and shows the sensitivity a codes performance can have to those models.

+",3056,,,,,6/28/2020 18:26,,,,2,,,,CC BY-SA 4.0 +12699,1,12701,,6/28/2020 22:34,,2,526,"

I recently came across these 2 videos on Coursera which show how to build a simple quantum computer that can implement the simplest case of the Deutsch-Jozsa algorithm (which uses only 2 qubits).

+

https://www.coursera.org/lecture/quantum-computing-algorithms/quantum-computer-prototype-diy-dCKRO

+

https://www.coursera.org/lecture/quantum-computing-algorithms/quantum-computer-prototype-solving-the-deutschs-problem-7EuD2

+

Since my only knowledge of quantum computing comes from this online textbook: https://qiskit.org/textbook/ch-states/introduction.html, which doesn't focus on the underlying physics), I was having trouble understanding the underlying physics used in those 2 videos.

+

I will try to explain the device's function in my own words. Please critique any incorrect statements I make.

+
+

+

2 qubits are encoded using a single photon.

+

Qubit 1's state is described by the path the photon is on and Qubit 2's state is described by the polarization of the photon.

+

Once the photon has passed from the laser past the 1st polarizing filter and beam splitter, it is equivalent to a Hadamard gate being applied to both Qubit 1 and Qubit 2.

+

After the photon passes through the waveplates, it is equivalent to the quantum oracle being applied to both Qubit 1 and Qubit 2.

+

Lastly, the photon passes through one final beam splitter, which is equivalent to a Hadamard gate being applied to both Qubit 1 and Qubit 2.

+

The difference in the interference pattern on the wall shows whether the quantum oracle was balanced or constant.

+
+

Am I interpreting this experiment correctly and can someone explain the physics underlying this system? I found the two videos to be very confusing, although very fascinating.

+

Thank you very much for your time and I apologize for the long question.

+

Cross posted on Physics.SE

+",12347,,9006,,6/29/2020 7:15,6/29/2020 7:33,Question about DIY Quantum Computer Prototype,,2,1,,,,CC BY-SA 4.0 +12700,2,,12699,6/29/2020 0:14,,2,,"

Not exactly.

+

You are correct, there is a single photon; qubit 1 is its path, qubit 2 is its polarization.

+

The waveplates implement an oracle (one from 4 possible).

+

You are wrong about the beam splitters; beam splitters do not affect polarization, so they act on the qubit 1 only as Hadamard gates.

+

The $|-\rangle$ state of qubit 2 is created by the polarization filter. We actually don't know which was the state of qubit 2 before the polarization filter, but there is nothing wrong in thinking that it was the state $|1\rangle$ and the polarization filter acted as Hadamard gate.

+",2105,,,,,6/29/2020 0:14,,,,6,,,,CC BY-SA 4.0 +12701,2,,12699,6/29/2020 7:33,,2,,"

You start with a polarisation filter. This does nothing to the path of your photon and, effectively, measures the polarisation of the photon, meaning that you prepare the "second" qubit in the fixed state determined by what polarisation the filter is detecting. So, at this point, you have +$$ +|0\rangle|-\rangle +$$

+

Then, you input to a beamsplitter. I would expect that you are using non-polarising, 50:50 beam splitters? In which case, these have no effect on the polarisation of the photon, only on the path. However, the matrix that describes their action is not Hadamard. Instead, it is a beamsplitter, action, +$$ +B=\frac{1}{\sqrt{2}}\left(\begin{array}{cc} 1 & i \\ i & 1 \end{array}\right) +$$ +The difference is important because it means you will get the opposite outcome in your experiment from what you would have expected with the Hadamard!

+

Your state at this point is +$$ +\frac{1}{\sqrt{2}}(|0\rangle+i|1\rangle)|-\rangle +$$

+

It is possible to understand the physics of why it looks like this if you know a little bit of electromagnetism. Strictly, this is all derived from Maxwell's equations, but I won't go back that far (also, I'm a little rusty myself, so this may not be perfect). Imagine you have a beamsplitter at position $x=0$. You have an incident photon (travelling along $y=0$) that you might describe by $Ie^{i(kx-\omega t)}$. This will give you a transmitted component $Te^{i(kx-\omega t)}$ and a reflected one $Re^{i(ky+\omega t)}$ (note the different sin on the $\omega t$ component). By assumption, the beamsplitter is 50:50 meaning $|R|^2=|T|^2=|I|^2/2$. We require continuity on the first derivative of the wavefunction at the boundary ($x=y=0$). This gives +$$ +|I|^2=|T-R|^2. +$$ +Since we don't care about global phase, we can assume $T=I/\sqrt{2}$ is real. From this, you derive that $R=iI/\sqrt{2}$. The $T$ coefficient is top-left (and bottom-right) of the $B$ matrix, while $R$ is the two off-diagonal elements.

+

Now you go through the function evaluation. You talk about waveplates. Usually, to me, a waveplate means a think that adds a phase (or not) if the photon is travelling along a particular path. So, for example, if you had a waveplate on the "1" path but not the "0" path, this would be like applying the gate +$$ +\left(\begin{array}{cc} 1 & 0 \\ 0 & -1 \end{array}\right) +$$ +on the first qubit. Because it's not using polarisation, it's not doing anything to the second qubit. This will eventually create the net result that you want, but it's not doing Deutsch's algorithm. What you actually want is an optical element that flips the polarisiation $|H\rangle\leftrightarrow |V\rangle$ (or not). The net effect on the calculation is the same, but there is a slight conceptual difference.

+

At this point (however you've made them), if the two waveplates are the same, you're in the state +$$ +\frac{1}{\sqrt{2}}(|0\rangle+i|1\rangle)|-\rangle +$$ +whereas if they're different, you've got +$$ +\frac{1}{\sqrt{2}}(|0\rangle-i|1\rangle)|-\rangle +$$

+

Finally, you use the second beamsplitter. The two results are $|1\rangle|-\rangle$ or $|0\rangle|-\rangle$.

+",1837,,,,,6/29/2020 7:33,,,,7,,,,CC BY-SA 4.0 +12702,1,12716,,6/29/2020 7:53,,3,190,"

I have been learning about the concept of entanglement swapping and found an equation mentioned in the textbook, Mathematics Of Quantum Computing: An Introduction written by Wolfgang Scherer.
+At section 4.13, equation (4.13), +\begin{equation} +\begin{split} +{|\Phi\rangle}^{ABCD} & = |\Psi^{-}\rangle^{AB} \otimes |\Psi^{-}\rangle^{CD} \\ + & = \frac{1}{2} \left( |0101\rangle - |0110\rangle -|1001\rangle + |1010\rangle \right)\\ + & = \frac{1}{2} \left( |\Psi^{+}\rangle^{AD} \otimes |\Psi^{+}\rangle^{BC} + - |\Psi^{-}\rangle^{AD} \otimes |\Psi^{-}\rangle^{BC}\\ + \quad - |\Phi^{+}\rangle^{AD} \otimes |\Phi^{+}\rangle^{BC} + + |\Phi^{-}\rangle^{AD} \otimes |\Phi^{-}\rangle^{BC} + \right)\\ +\end{split} +\end{equation} +where
+\begin{equation} +\begin{split} +|\Phi^{+}\rangle = \frac{1}{\sqrt{2}} \left( |00\rangle + |11\rangle \right)\\ +|\Phi^{-}\rangle = \frac{1}{\sqrt{2}} \left( |00\rangle - |11\rangle \right)\\ +|\Psi^{+}\rangle = \frac{1}{\sqrt{2}} \left( |01\rangle + |10\rangle \right)\\ +|\Psi^{-}\rangle = \frac{1}{\sqrt{2}} \left( |01\rangle - |10\rangle \right) +\end{split} +\end{equation} +and the supernotes $\{ A,B,C,D \}$ outside the ket indicate the qubits forming the bell state. Therefore, by doing bell measurement on qubits $(B,C)$, qubits $(A,D)$ are in bell state. This result is also mentioned in Multiparticle generalization of entanglement swapping by S. Bose et al (PhysRevA.57.822), but without derivation.

+

So my question is that how to derive other similar equations efficiently instead of expand the bell states back into computational basis $| x \rangle^{\otimes n}$ where $x \in \{0,1\}$ and go through the tedious algebras step by step? For example, how to do the entanglement swapping of ${|\Phi\rangle}^{ABCD} = |\Psi^{-}\rangle^{AB} \otimes |\Phi^{+}\rangle^{CD}$ from $(A,B)$ and $(C,D)$ to $(A,D)$ and $(B,C)$ or even $(A,C)$ and $(B,D)$?

+",10132,,55,,6/30/2020 16:51,6/30/2020 16:51,Problem about entanglement swapping,,1,0,,,,CC BY-SA 4.0 +12703,1,,,6/29/2020 11:42,,2,26,"

Considering the current state of research into quantum memristors, and the advantages/disadvantages of quantum and memristor driven computing architectures:

+

Quantum Memristors

+

Quantum Memristor Circuits

+

Quantum Computing vs. Memory focused computation of Memristors

+

From a practical implementation point of view, what are current the limits of 'boosting' or 'complementing' quantum computations with memristors?

+",12524,,9006,,6/30/2020 8:00,6/30/2020 8:00,What are the practical limitations of complementing quantum computations with memristors?,,0,0,,,,CC BY-SA 4.0 +12706,1,,,6/29/2020 14:01,,2,288,"

What are examples of quantum operators or evolutions of quantum states that can be modeled as sparse matrices?

+",8707,,,,,7/3/2020 16:03,Quantum operations as sparse matrices,,2,2,,7/22/2020 8:20,,CC BY-SA 4.0 +12708,1,,,6/29/2020 15:02,,3,47,"

Given two states $\rho_a$ and $\rho_b$, and knowing that the SWAP gate swaps two qubits, how can one prove that visibilities

+

$v_1=Tr[\rho_a^2 \rho_b^2] = Tr[S_{AB} S_{BC} S_{CD} \rho_a \otimes \rho_a \otimes \rho_b \otimes \rho_b ]$

+

$v_2=Tr[(\rho_a \rho_b)^2] = Tr[S_{BC} S_{CD} S_{AB} S_{BC} S_{AB} \rho_a \otimes \rho_a \otimes \rho_b \otimes \rho_b]$

+

Reference: https://arxiv.org/pdf/1501.03099.pdf

+",8290,,55,,6/30/2020 16:43,6/30/2020 16:43,"Prove expressions for visibilities $\operatorname{Tr}(\rho_a^2\rho_b^2), \operatorname{Tr}[(\rho_a \rho_b)^2]$ in terms of SWAP operations",,1,0,,,,CC BY-SA 4.0 +12709,2,,12708,6/29/2020 15:56,,1,,"

Explicitly write out what the trace is supposed to be: +$$ +\text{Tr}(S_{AB}S_{BC}S_{CD}\rho_a\otimes\rho_a\otimes\rho_b\otimes\rho_b)=\sum_{i,j,k,l}\langle ijkl|S_{AB}S_{BC}S_{CD}\rho_a\otimes\rho_a\otimes\rho_b\otimes\rho_b|ijkl\rangle. +$$ +Now you can apply the swaps to the basis elements +$$ +=\sum_{i,j,k,l}\langle jikl|S_{BC}S_{CD}\rho_a\otimes\rho_a\otimes\rho_b\otimes\rho_b|ijkl\rangle +$$ +and keep going... +$$ +=\sum_{i,j,k,l}\langle jkli|\rho_a\otimes\rho_a\otimes\rho_b\otimes\rho_b|ijkl\rangle +$$ +So, this is the same thing as +$$ +\sum_{ijkl}\langle j|\rho_a|i\rangle\langle i|\rho_b|l\rangle\langle l|\rho_b|k\rangle\langle k|\rho_a|j\rangle. +$$ +It's worth a comment about how I chose the ordering of those terms. I just started with the first index ($j$). Because it's closing index was $i$, the next term I wrote down started with $i$, and so on. Now, knowing the result I want, I'll use the commutativity of multiplication to choose a slightly different order: +$$ +\sum_{ijkl}\langle k|\rho_a|j\rangle\langle j|\rho_a|i\rangle\langle i|\rho_b|l\rangle\langle l|\rho_b|k\rangle. +$$ +Next, notice that there's lots of completeness relations appearing here: $\sum_j|j\rangle\langle j|=I$. Thus, this is the same as +$$ +\sum_k\langle k|\rho_aI\rho_aI\rho_bI\rho_B|k\rangle=\text{Tr}(\rho_a^2\rho_b^2). +$$

+

The other one will work just the same.

+",1837,,,,,6/29/2020 15:56,,,,0,,,,CC BY-SA 4.0 +12710,1,12711,,6/29/2020 18:13,,0,55,"

I was explaining to a colleague that you can't use EPR pairs to communicate information, as it violates the no-communication theorem. This lead me to thinking... If I have let's say 1,000,000 EPR pairs shared with someone far away. We agree ahead of time that if I perform a rotation $\theta$ on my qubit, then I mean to communicate the bit $0$, and when I perform the rotation $\phi$, then I mean to communicate the bit 1.

+

We agree that at some time in the future (assume we have synchronized clocks), that I will perform the same rotation on all 1,000,000 of my EPR pair halves. After some agreed upon time, the holder of the other 1,000,000 pair halves measures his qubits to predict which rotation I made on my qubits. Then with high probability they can guess the message I wanted to send.

+

I know there is something wrong in this configuration, but I can't point it down. If this would be possible, then I could communicate faster than light...

+

Can anyone point out the error in my reasoning?

+

Thanks.

+",509,,2879,,6/29/2020 18:32,6/29/2020 18:40,Predicting rotations with many EPR pairs,,2,1,,,,CC BY-SA 4.0 +12711,2,,12710,6/29/2020 18:31,,1,,"

Well, the thing that is wrong in this configuration is that the holder of the other halves of the EPR pairs will not get any information about the rotation you did.

+

Let's simplify this protocol to be more specific: let's say you'll apply X gate to communicate 1 and I gate (i.e., do nothing) to communicate 0. These two actions are Ry rotations around by $0$ and by $\pi$, so they are a lot easier to distinguish than arbitrary rotations by $\theta$ and $\phi$.

+

You start with the EPR state $\frac{1}{\sqrt2}(|00\rangle + |11\rangle)$. If you apply an X gate to the first qubit, you'll get state $\frac{1}{\sqrt2}(|10\rangle + |01\rangle)$. Now you have to distinguish these two states by doing an experiment on the second qubit (and you can repeat that experiment 1kk times).

+

Since you only have access to 1 qubit, your experiment is limited to performing some rotations and a single-qubit measurement. Regardless of the rotation you perform, the measurement probabilities are going to be the same for those two states, so you won't be able to distinguish them.

+",2879,,,,,6/29/2020 18:31,,,,1,,,,CC BY-SA 4.0 +12712,2,,12710,6/29/2020 18:40,,1,,"

Whatever rotation you do on one half of the state does not affect the reduced state on the other half,

+

\begin{align*} +\mathrm{Tr}_A[(U \otimes \mathbb{I}) |\psi \rangle\langle \psi | ( U^* \otimes \mathbb{I}) ] &= \mathrm{Tr}_A[(U^* U \otimes \mathbb{I}) |\psi \rangle\langle \psi | ] \\ &= \mathrm{Tr}_A[(\mathbb{I} \otimes \mathbb{I}) |\psi \rangle\langle \psi | ] \\ &= \mathrm{Tr}_A[ |\psi \rangle\langle \psi | ] . +\end{align*}

+

So the other party will never be able to distinguish between the two rotations you do and hence no communication.

+",9854,,,,,6/29/2020 18:40,,,,1,,,,CC BY-SA 4.0 +12713,2,,12301,6/30/2020 1:35,,0,,"
operation ApplyConditionalPhase_0(register: LittleEndian) : Unit is Adj + Ctl
+{
+    using (aux = Qubit()) 
+    {
+        (ControlledOnInt(0,X))(register!,aux);
+    }
+}
+operation ApplyConditionalPhase(register : LittleEndian) : Unit is Adj + Ctl 
+{
+    using (aux = Qubit()) 
+    {
+        (ControlledOnInt(1,X))(register!,aux);
+    }
+}
+
+

I realized this paper treats A as all positive integers, that means not including zero. I am understanding this gate to simply flip the qubit when it is 0 for the first. Since 0 is not in the set of positive integers, we flip all qubits that are 1 to satisfy i = a.

+",12239,,12239,,6/30/2020 19:24,6/30/2020 19:24,,,,0,,,,CC BY-SA 4.0 +12714,2,,5730,6/30/2020 4:26,,0,,"

One potential method, albeit clunky, is with traditional Hamiltonian simulation techniques like Trotterization. It's conceivable that you could argue:

+

$$ e^{-iHt} = \prod_{j = 0}^M e^{-i |V_j|/\sqrt{M} |j \rangle \langle j | t \otimes X} + O(*)$$

+

For some error amount. Then, the simulation of $e^{-i \gamma |j \rangle \langle j| t \otimes X}$ for some $\gamma$ should not be difficult, as it is the application of a phase of $-i\gamma t$ on $|j \rangle \langle j|$ while leaving all other states intact (also, the ancilla should have the $e^{-i\gamma Xt}$ applied.)

+

Also, I admit there may be some error to these methods, and I'm unsure if the paper intended the Hamiltonian to be simulated through this mechanism.

+",8343,,,,,6/30/2020 4:26,,,,0,,,,CC BY-SA 4.0 +12715,2,,12706,6/30/2020 7:06,,2,,"

Pretty much everything!

+

Any Hamiltonian that you want to simulate from e.g. condensed matter physics, is highly likely to be sparse by virtue of the fact that interactions are local.

+

Equally, any tensor product of Paulis is sparse.

+

In terms of quantum computing, most gates that you choose to use tend to be sparse, the notable exception being something like a Hadamard transform. (Of course, there's a trivial statement that when viewed from the correct basis, any matrix can be considered sparse!)

+",1837,,,,,6/30/2020 7:06,,,,0,,,,CC BY-SA 4.0 +12716,2,,12702,6/30/2020 7:33,,2,,"

I guess the way that I'd start (aside from just getting a computer to do it!) is to remember that the Bell states form an orthonormal basis. So, you can ask, for example, about what the $|\Phi^+\rangle^{AD}$ component is: +$$ +\langle\Phi^+|^{AD}|\Phi\rangle^{ABCD}=-\frac12|\Phi^+\rangle^{BC}. +$$ +You do this for each of the four states, and you can use that to reconstruct the overall description that you've given.

+

Now, for simplifying the above calculation without expanding out the state in the computational basis. Remember that all Bell states can be converted into $|\Phi^+\rangle$ by Pauli operations on either qubit. So, reduce the calculation to +$$ +\langle\Phi^+|^{AD}|\Psi^-\rangle^{AB}|\Psi^-\rangle^{CD}=Y_BY_C\langle\Phi^+|^{AD}|\Phi^+\rangle^{AB}|\Phi^+\rangle^{CD}. +$$ +How does this help? Well, you could just explicitly calculate this once, or believe me, that +$$ +\langle\Phi^+|^{AD}|\Phi^+\rangle^{AB}|\Phi^+\rangle^{CD}=\frac12|\Phi^+\rangle^{BC}, +$$ +(the idea being that you can use this one result again and again) so the outcome is +$$ +\frac12 Y_BY_C|\Phi^+\rangle^{BC}=-\frac12|\Phi^+\rangle^{BC}. +$$

+

Possibly you'll tell me that expanding out to the basis states was easier! With practice, I can do most of this calculation in my head (I only struggle with the sign of each term), which is good enough for some of the intuition of figuring out if something will work.

+",1837,,,,,6/30/2020 7:33,,,,2,,,,CC BY-SA 4.0 +12717,1,,,6/30/2020 8:17,,2,102,"

In some quantum algorithms (for example HHL or quantum machine learning algorithms) an ancilla qubit(s) is measured firstly and based on result of the measurement other qubit(s) are measured or not. For example, in this case, qubit $|c\rangle$ is measured if the ancilla is in state $|0\rangle$:

+

+

So far, I did post-selection manually. This means that I took all results with ancilla being in a particular state ($|0\rangle$ in the example above), removed others and finally normalized remained distribution to have sum of probabilities equal to 1.

+

My question is whether is it possible to do so in more elegant way in QASM on IBM Q Experience. +This means to define which qubit is the ancilla, set which values of the ancilla has to be measured in order to measure other qubit(s) and get a conditional distribution of measured qubits under condition that ancilla is in some predfined state.

+",9006,,,,,6/30/2020 8:17,Post-selection in QASM,,0,0,,,,CC BY-SA 4.0 +12718,1,12719,,6/30/2020 8:34,,1,51,"

+
 operation Algorithm() : Unit
+ {
+    using (register = Qubit[4])
+    {
+        within
+            {
+                PrepareUniformSuperposition(4,LittleEndian(register));
+                ApplyToEach(register[2],register);
+            }
+    
+
+

I am having trouble with the ApplyToEach line. I am wondering if there is a way to entangle all the qubits in my register with another qubit, more broadly the 2(a) line 1. To my understanding I am satisfying the j term with uniform superposition. I am under the impression that when I apply the y-th qubit to my register I will entangle them. Maybe I am using the term entanglement wrong.

+",12239,,12239,,6/30/2020 18:34,6/30/2020 18:34,Entangling a register with another register using phase flips,,1,0,,,,CC BY-SA 4.0 +12719,2,,12718,6/30/2020 8:42,,1,,"

ApplyToEach operation applies an operation to each element of the array, you can't apply a qubit to each element of the array.

+

It sounds like you're trying to prepare a state in which all qubits will be entangled (the definition of entanglement is that you can't represent a state of the system as a tensor product of states of subsystems, so entangling each qubit with one of them will mean the whole system will be entangled). There are lots of ways to do this (since there are a lot of entangled states); if you don't care which state it is, the first thing that comes to mind is applying a Controlled Z gate to change the phase of the $|1...1\rangle$ state to $-1$:

+
Controlled Z(register[0..2], register[3]);
+
+

If you're looking to prepare a specific state, you might want to clarify this in the question.

+
+

To address the updated question:

+
    +
  • You need to allocate two registers, one to hold the values $|j\rangle$ and another to hold the values $|y\rangle$.
  • +
  • The first line of 2(a) is almost satisfied with PrepareUniformSuperposition: after this the first register will hold $\sum_j\frac{1}{\sqrt{N}}|j\rangle$ and the second one $|0\rangle$.
  • +
  • To finish preparing the state described in the first line of 2(a) you need to prepare the state $|y\rangle$ on the second register. That can be done by converting $y$ to binary and applying X gate to each qubit that corresponds to 1 bit.
  • +
  • To implement the second line of 2(a), you need to write some extra code that compares $j$ with $y$ and "marks" the state (I'm assuming flips the phase? It's not clear from the screenshot) - this step will indeed entangle the qubits of the two registers. You might want to read more about reversible computing and quantum oracles to do this.
  • +
+",2879,,2879,,6/30/2020 9:53,6/30/2020 9:53,,,,5,,,,CC BY-SA 4.0 +12720,2,,12653,6/30/2020 12:32,,0,,"

yes you are correct there is some missing information! This is known in the textbook and should be added in this PR.

+

The reason is that the easiest way (I know of at least) to create a diffuser circuit is to actually create a circuit that inverts $|s\rangle$, instead of every state orthogonal to $|s\rangle$ as is required by the diffuser. I.e. we implement:

+

$$-U_s = -2|s\rangle\langle s| + I_n$$

+

instead of:

+

$$ U_s = 2|s\rangle\langle s| - I_n $$

+

These two operations are equivalent up to a phase of -1. As this phase is global in Grover's algorithm and doesn't introduce any effects and we can use the two circuits interchangeably, but when the iterator is controlled, we see this phase become relative and affect our results.

+

This iterator with negative phase is equivalent to an iterator that searches for 'not-solutions' (of which there are $N-M$), hence an easy fix to do $N - $ our result at the end.

+

tl; dr: The iterator in that example implements $-U_s$ instead of $U_s$.

+",10415,,,,,6/30/2020 12:32,,,,0,,,,CC BY-SA 4.0 +12721,1,,,6/30/2020 15:43,,2,136,"

Some papers use the "destabilizer group" for more efficient simulations; see for example (page 3):

+

https://www.scottaaronson.com/showcase2/report/ted-yoder.pdf

+

"In addition to stabilizers, we also make use of destabilizers, introduced by Aaronson and Gottesman [10]. While the +stabilizer generators can be thought of as virtual Z operators, the destabilizers can be thought of as their conjugate, +virtual X operators."

+

Given the stabilizers $S_i$ of an $[n,k,d]$ code I know of algorithms to put them in standard form +and calculate the encoded $\bar X$'s and $\bar Z$'s (also in standard forms). This gives me $m+k+k$ operators. The destabilizers are an additional $m$ operators on top of these; how are these calculated? Are there standard forms possibly related to the other generators'? Also, the $[2d^2,2,d]$ toric code is usually +described with $2d^2$ stabilizers (2 of them redundant); how is the redundancy handled?

+",12265,,,,,6/30/2020 15:43,How to calculate destabilizer group of toric and other codes,,0,0,,,,CC BY-SA 4.0 +12722,1,,,6/30/2020 17:41,,2,477,"

I'm working on a project in which I have to find stabilizer states based on a few criteria, the main one being that it has to have a certain amount of coherence, I'm using the following equation to calculate my coherence based on the density matrix of the state. +$$ +C_r(\rho) = S_{VN}(\rho_{diag}) - S_{VN}(\rho) +$$

+

Where S is the Von Neumann entropy and rho diag is the matrix with the main diagonal equal the density matrix's main diagonal, and every other term is zero. +I'm also defining this to be a 5-qubit stabilizer state.

+

I'm using python and qutip to do these calculations.

+

Is there a better-than-brute-force algorithm to generate stabilizer states? Is there a way to generate stabilizer states at random based on some criteria?

+",5065,,,,,7/2/2020 11:12,Algorithm to find stabilizer states,,2,4,,,,CC BY-SA 4.0 +12724,2,,2343,6/30/2020 19:24,,0,,"

There is one big difference between quantum cryptography and quantum computing. Yes, both belong together but when talking about quantum computing and cryptography most people mean implementing a quantum algorithm to attack currently used cryptographic schemes (RSA, ECC, AES) using factoring, calculating discrete logarithms or implementing a fast search algorithm which searches in O(sqrt(N)). Quantum cryptography uses entanglement to create correlations in a state and uses this as a resource for 1) detecting whether there is an attacker on the channel (QKD), 2) secret sharing, anonymous transmission etc in quantum networks and 3) verifying that the network state distributed is really the state (or sufficiently close to the state) which is desired and necessary to implement a certain protocol. Yes, the results can also be used for theoretical foundations in quantum information/computation but still both are different. I think there is one quantum key exchange protocol which does not rely on entanglement and only uses the No-cloning theorem for its security proof but I am not entirely sure about that. The security of QKD relies on detecting when the key is intercepted and throwing out that part of a potential key. The security after the key exchange relies on the one time pad which is mathematically secure when using a truly random key and using it only once. The randomness is again guaranteed by creating entropy for a quantum source in the first place. Using it once is upon the user.

+",5705,,,,,6/30/2020 19:24,,,,0,,,,CC BY-SA 4.0 +12725,2,,12722,6/30/2020 20:34,,2,,"

Let's make a few observations first:

+
    +
  1. Since an $N$-qubit stabilizer state can be generated starting from $| 0 \rangle^{\otimes N}$ and applying H, CNOT, and S gates, we make the following observations. By simply applying the Hadamard on all qubits, one can generate the state $ | + \rangle^{\otimes N}$ which is maximally coherent (under the free operations given by IO; see for example this review paper on quantum coherence). On the other hand, the initial state $| 0 \rangle^{\otimes N}$ has zero coherence (and entanglement). So, clearly, one needs to apply a few H, S gates to generate coherence (note that CNOT is an incoherent operation on multipartite coherence).

    +
  2. +
  3. The number of stabilizer states for $N$-qubits is exponential (see this answer), a brute-force search would not be wise. Even for your $5$-qubit case, the number of states is $\approx 2^{20}$. However, since you want to use the relative entropy of coherence (and we're working in the pure state formalism), note that $S(| \psi \rangle \langle \psi | ) = 0$, so you only need to compute the first term, i.e., $S(\mathcal{D}(| \psi \rangle \langle \psi | ))$, where $\mathcal{D}(\cdot)$ is the dephasing superoperator (or the operator that dephases your state and makes it diagonal in the incoherent basis).

    +
  4. +
  5. Moreover, the entries of $\rho_{\mathrm{diag}}$ are simply the inner products $|\langle k | \psi \rangle|^2$, where $k$ are the computational basis elements (which are also stabilizer states) and you can just compute these inner products efficiently (see #4), and then compute the von Neumann entropy of this probability distribution. In this case, the coherence essentially reduces to the spread of the state $|\psi\rangle$ in the computational basis.

    +
  6. +
  7. Using Scott Aaronson's code (hopefully, you can find something more updated), one can efficiently compute inner products between two stabilizer states.

    +
  8. +
+

I would also recommend understanding the interplay between multipartite coherence and entanglement, for example, as initiated in this (now famous) paper.

+

Update: I would also recommend using QETLAB's function to compute relative entropy of coherence (or other measures) in case you don't have an efficient code.

+",1108,,1108,,6/30/2020 20:45,6/30/2020 20:45,,,,0,,,,CC BY-SA 4.0 +12727,2,,12645,6/30/2020 21:26,,2,,"

The aim is to use Qiskits built in depolarizing quantum error channel function +$\texttt{depolarizing}$$\_$$\texttt{error(param, num_qubits, standard_gates=True)}$ to create the desired depolarizing channel. It takes the depolarization parameter $\lambda$ and number of qubits $n$ to create the depolarizing channel +$$ +\begin{equation} + \label{eqn:depo-chan-qiskit} + \varepsilon(\rho) = (1-\lambda)\rho + \lambda Tr\left[\rho\right]\frac{I}{2^{n}} + \text{.} +\end{equation}$$

+

It can then be manipulated to create the single qubit depolarizing channel +$$ +\begin{equation} + \label{eqn:depo-chan-1qubit} + \varepsilon(\rho_{single-qubit}) = + (1-P)\rho + \frac{P}{3}\left(X\rho X + Y\rho Y + Z\rho Z\right) + \text{.} +\end{equation}$$ +This is shown by the following derivation. +For a single qubit $n=1$ +$$ \frac{I}{2^{1}} = \frac{1}{4} \left(I\rho I + X\rho X + Y\rho Y + Z\rho Z\right),$$ +and $Tr[\rho] = 1.$

+

If we then chose +$$\lambda=\frac{4^{n}P}{4^{n}-1},$$ +where $P$ is the probability. At $n=1$ the depolarization paramater +$$\lambda = \frac{4P}{3}$$ and by substituting these results into $\varepsilon(\rho)$ we get that

+

$$ +\begin{align} + \varepsilon(\rho) &= (1-\frac{4P}{3})\rho + + \frac{4P}{3} \left(I\rho I + X\rho X + Y\rho Y + Z\rho Z\right) + \frac{1}{4} \\ + &= \left( 1 - \frac{4P}{3} + \frac{P}{3} \right)\rho + + \frac{P}{3} \left(X\rho X + Y\rho Y + Z\rho Z\right) \\ + &= (1-P)\rho + \frac{P}{3}\left(X\rho X + Y\rho Y + Z\rho Z\right) + \text{.} +\end{align} +$$ +

+

Here is a link to my notebook explaining how it works https://github.com/MIGUEL-LO/Qiskit_depolarazation_channel/blob/master/depo_channel_using_depolarizing_error.ipynb

+",9396,,,,,6/30/2020 21:26,,,,0,,,,CC BY-SA 4.0 +12728,1,12731,,7/1/2020 2:57,,1,97,"

I have found the procedure of simulation process as this picture : +

+

Image reference. So in the low-level compilers, all single-qubit gates are approximated by the universal gate set (CNOT, H, T, S).

+

When implementing arbitrary gates, I want to know if all simulators (like Qiskit) will do the low-level compilers job in this picture with a fixed accuracy. If so, what is the algorithm during this process? Are they using the Solovay-Kitaev Decomposition strategy (or some improved algorithm)?

+",11765,,8343,,7/1/2020 6:59,7/1/2020 7:11,A question about how does the single qubit gate simulated in simulator?,,1,0,,,,CC BY-SA 4.0 +12729,1,13170,,7/1/2020 5:34,,2,386,"

I'm trying to make a calibration matrix using CompleteMeasFitter as in here on IBMQ Melbourne, but I need to use all 15 qubits, which mean it has to run 32768 calibration circuit, far exceeding the 75 limit of the deivce (It returns The number of experiments in the Qobj (32768) is higher than the number of experiments supported by the device (75) [1102].)

+

Is there any way for me to retrieve the mitigation matrix in this case? Maybe something IBM generates every time they calibrate the machine? Thank you!

+",7598,,2293,,8/17/2020 2:53,9/11/2020 8:23,How to do error mitigation on the ibmq_16_melbourne?,,1,0,,,,CC BY-SA 4.0 +12730,1,,,7/1/2020 7:11,,2,172,"

Intention - To learn and apply QFT on time-series data and compare the result with classical FFT.

+

Data Used - Small timeseries data of 16 points -

+
array([ 
+    669., 589.95, 659.9, 998.85, 690.8, 390.75, 633.7, 457.65, 581.6,
+    662.55, 1105.5, 1237.45, 537.4, 464.35, 685.3, 499.25
+])
+
+

Detrended the linear component and used the residual data for my experiment. +Encoded the values as amplitudes of the 16 basis states -

+
def get_quantum_amplitude(signal):
+    sum_squared_signal =  sum(signal**2)
+    divider = np.sqrt(sum_squared_signal)
+    amplitude_values = signal/divider
+    no_of_qubit = np.log2(signal.size),
+    return int(no_of_qubit[0]), amplitude_values, divider
+
+no_of_qubit, amplitude_values, divider = get_quantum_amplitude(x_notrend)
+amplitude_values,no_of_qubit, divider
+
+qc = QuantumCircuit(no_of_qubit)
+qft_circuit = QFT(no_of_qubit)
+print(qft_circuit.qregs)
+qc.initialize( amplitude_values, [i for i in reversed(qc.qubits)])
+qc = qc.compose(qft_circuit, [0,1,2,3])
+qc.draw()
+
+

Now if I consider - the resultant state-vectors multiplied by the divider (mentioned above used for converting to normalized amplitudes) of the above circuit as the quantum Fourier transform values and compare it with the classical FFT output values(fft_vals = fft.fft(sample)) of the same signal, I see there is a mismatch.

+

But, if I multiply the Quantum FFT output value with the number of qubits (4 in this case) it is matching with the classical FFT values. +Can anybody explain this behaviour?

+",12099,,12099,,7/24/2020 11:27,7/24/2020 11:27,QFT on timeseries Data and compare results with classical FFT,,0,0,,,,CC BY-SA 4.0 +12731,2,,12728,7/1/2020 7:11,,1,,"

Generally, a simulator does not have to do any decomposition of gates to hardware-level specifics. Simulators only follow a mathematical model of a gate (described by matrix). Since each algorithm can be described by a matrix, whole simulation can be expressed as $|\psi_1\rangle = U |\psi_0\rangle$, where $|\psi_0\rangle$ is initial state of a quantum computer, $|\psi_1\rangle$ is its final state and $U$ is a matrix describing algorithm. Hence, a simulation is reduced to matrix multiplication.

+

Some simulators artifically introduce noise present on real quantum hardware. This can be done by perturbation of matrices describing gates by a random variable.

+

Of course, it is possible to constrain a gate set on a simulator to have it more similar to real quantum processors. However, as I mentioned above, in the end you can have any gate you want, you are not constrained by quantum hardware specifics (unless you want to be) and any decomposition is not necessary.

+

Note: My answer is concerning gate-based computers. Adiabatic quantum computers case may be different.

+",9006,,,,,7/1/2020 7:11,,,,5,,,,CC BY-SA 4.0 +12732,1,,,7/1/2020 10:14,,1,61,"

Given a pure state $|\psi\rangle_{AB}$ on a joint system $AB$, we can consider the reduced density operator $\sigma_A = Tr_B(|\psi \rangle \langle \psi|)$ on $A$ and subsequently purify this state into $|\phi\rangle_{RA}$ using a new register $R$ (ie $\sigma_A = Tr_R(|\phi \rangle \langle \phi|)$. My question is: what is the joint system on $RAB$? Is it the product state $|\phi \rangle \langle \phi|_{RA} \otimes \sigma_{B}$ where $\sigma_B = Tr_A(|\psi \rangle \langle \psi|)$.

+",12540,,55,,9/30/2020 3:54,9/30/2020 3:54,Joint system of RAB after purification of A into R,,2,1,,,,CC BY-SA 4.0 +12733,1,,,7/1/2020 10:18,,1,45,"

The qubit relaxation time $T_1$ is an important parameter in order to describe the coherence time that a qubit presents, that is, the time in which its coherence quantum state is not compromised by decoherence. Such parameter is important in order to see the needed actuation of a quantum error correction code so that the information can be corrected properly.

+

Literature often presents this parameter for different qubit technologies as average, max and min times. However, I am wondering if this parameter is dependent to some other parameters such as temperature fluctuations, magnetic fields etc. If so it would be interesting to provide references to research about such effects.

+",2371,,,,,7/1/2020 10:18,Qubit relaxation time dependencies,,0,0,,,,CC BY-SA 4.0 +12734,2,,12732,7/1/2020 10:30,,2,,"

Let's write the state in terms of its Schmidt decomposition. +$$ +|\psi\rangle_{AB}=\sum_i\alpha_i|u_i\rangle_A|v_i\rangle_B, +$$ +($|u_i\rangle,|v_i\rangle$ are orthonormal bases). Then +$$ +\rho_A=\sum|\alpha_i|^2|u_i\rangle\langle u_i| +$$ +and the purification that you would attempt would map $|u_i\rangle\mapsto |u_i\rangle_A|w_i\rangle_R$ (state $\sum_i\alpha_i|u_i\rangle|w_i\rangle$). Hence, you can see that the overall state would become +$$ +\sum_i\alpha_i|u_i\rangle_A|v_i\rangle_B|w_i\rangle_R, +$$ +which is GHZ-like, and certainly not separable unless $|\psi_{AB}\rangle$ was separable.

+",1837,,,,,7/1/2020 10:30,,,,8,,,,CC BY-SA 4.0 +12735,2,,12316,7/1/2020 10:52,,3,,"

The remark that you state is absolutely critical. Let's try and introduce a notation that takes the spaces into account better. So, we're going to have a set of $a$ qubits denoted $C$, a set of $b$ qubits denoted $D$ and a set of $s$ qubits denoted $S$. Now I can use $U_{CS}$ to mean apply $U$ on qubits in sets $C$ (the ancillas) and $S$, and act as identity on the qubits in set $D$.

+

The calculation that they are doing is +$$ +\left\|AB-\alpha\beta(\langle 0|^{\otimes(a+b)}_{C,D}\otimes I_S) U_{CS}\cdot V_{DS}(|0\rangle^{\otimes(a+b)}_{C,D}\otimes I_S)\right\|. +$$ +Now, because you know that $U$ acts as $I$ on qubits $D$, the $\langle 0|^{\otimes b}_D$ just moves past that operator. +$$ +=\left\|AB-\alpha\beta(\langle 0|^{\otimes a}_{C}\otimes I_S) U)\cdot(\langle 0|^{\otimes b}_D\otimes I_{C,S}))\cdot V_{DS}(|0\rangle^{\otimes(a+b)}_{C,D}\otimes I_S)\right\|. +$$ +You'll note that now $U$ is only acting on qubits from sets $C$ and $S$ so I don't need the subscripts any more. We can do a similar thing with the $|0\rangle^{\otimes a}_C$ as $V_{DS}$ only acts as $I$ on the $C$ qubits. Thus, +$$ +=\left\|AB-\alpha\beta(\langle 0|^{\otimes a}_{C}\otimes I_S) U\cdot(\langle 0|^{\otimes b}_D\otimes I_{C,S}))\cdot(|0\rangle^{\otimes a}_C\otimes I_{D,S}) V(|0\rangle^{\otimes b}_{D}\otimes I_S)\right\|. +$$ +This rearranges to give the result that you want, +\begin{align*} +&=\left\|AB-\alpha\beta(\langle 0|^{\otimes a}_{C}\otimes I_S) U\cdot(|0\rangle^{\otimes a}_C\otimes I_{S})\cdot(\langle 0|^{\otimes b}_D\otimes I_{S}))\cdot V(|0\rangle^{\otimes b}_{D}\otimes I_S)\right\|. \\ +&=\left\|AB-\alpha\beta(\langle 0|^{\otimes a}\otimes I) U(|0\rangle^{\otimes a}\otimes I)\cdot(\langle 0|^{\otimes b}\otimes I)) V(|0\rangle^{\otimes b}\otimes I)\right\|. +\end{align*}

+",1837,,,,,7/1/2020 10:52,,,,0,,,,CC BY-SA 4.0 +12736,2,,9536,7/1/2020 12:26,,3,,"

Yes, there are. I just wrote a paper about it, actually.

+

You need to define carefully what you mean by obtaining a Bell violation or ruling out local hidden variables. You can't demand to have a result which is impossible to explain with local hidden variables: the local bound of a Bell inequality is inherently probabilistic, so it is possible to obtain any statistic you observe merely by chance. What you can do is demand it to be unlikely, with $p$-value smaller than some threshold, or Bayes factor above some threshold. For example, in one of the loophole-free Bell tests they reported that the $p$-value of their data under the local hidden variables hypothesis was below $10^{-30}$.

+

In a single-shot scenario, the $p$-value of winning a single round of a nonlocal game is simple its local bound, the maximal probability of winning it with local hidden variables. If you can make the local bound smaller than this threshold, while keeping the quantum probability of victory close to 1, then you'll have a single-shot violation.

+

It turns out that it is possible to construct (families of) nonlocal games such that the local bound becomes arbitrarily close to 0, while the Tsirelson bound becomes arbitrarily close to 1, so yes, a single-shot violation is possible for any threshold you want.

+

The simplest way of constructing such a game is by doing parallel repetition of a pseudo-telepathy game, that is, playing $n$ times in parallel a nonlocal game with Tsirelson bound 1. The local bound goes down to zero exponentially in $n$ (this is highly nontrivial to prove), while the Tsirelson bound stays equal to 1, so there you have it.

+

This construction is physically meaningless though, because the local bound here is the probability of winning all parallel instances simultaneously, which you'll never be able to do in reality, so the fact that it is exponentially unlikely with local hidden variables doesn't help you. There are more sophisticated constructions that solve this problem: instead of considering the probability of winning all instances, you can also consider the probability of winning a fraction of instances higher than what you'd expect from the local bound: it turns out that this still goes down to zero exponentially with $n$ under the local hidden variables hypothesis, as proven by Rao's concentration bound, and goes up to one exponentially with $n$ under quantum mechanics. Now this is robust to experimental errors, so it is the way to do it in reality.

+

You might find unsatisfactory the use of parallel repetition; well there also exists a nonlocal game, the Khot-Vishnoi game, such that the local bound is arbitrarily close to zero and the Tsirelson bound arbitrarily close to one, and it is not based on parallel repetition. This game is very hard to implement experimentally, though.

+",12541,,,,,7/1/2020 12:26,,,,0,,,,CC BY-SA 4.0 +12737,1,12750,,7/1/2020 13:22,,1,58,"

I'd like to develop an intuition about interference in QC programs and was hopeful that some visualization vehicle (like the bloch sphere) would be available to assist in developing an intuition of that (in phase kickback for example). I've searched but didn't find anything suitable.

+

Is there any vehicles or frameworks, (or math techniques) that could be helpful?

+",4963,,,,,7/2/2020 9:03,"Visualizing ""interference"" in Quantum Programs",,1,1,,,,CC BY-SA 4.0 +12738,2,,12668,7/1/2020 14:35,,1,,"

Ok I think I've got it. The first part of my question is correct; the second one no. The big mistake is that I've tried to use eq 2.12 with the elements of vectors and not with the vectors themselves.

+

As I've done before, taking any basis, say $|v_{0}\rangle$ and $|v_{1}\rangle$, I'm looking for the matrix representation of the lineal operator $A$ such that $A |v_{0}\rangle = |v_{1}\rangle$ and $A |v_{1}\rangle = |v_{0}\rangle$. Applying eq. 2.12 we obtain:

+

$A |v_{0}\rangle = A_{00} |v_{0}\rangle + A_{10} |v_{1}\rangle = |v_{1}\rangle \Rightarrow A_{00} = 0; A_{10} = 1$

+

$A |v_{1}\rangle = A_{01} |v_{0}\rangle + A_{11} |v_{1}\rangle = |v_{0}\rangle \Rightarrow A_{01} = 0; A_{11} = 1$

+

$$A = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} $$

+

And now my mistake:

+

I said this works for computational basis $\begin{pmatrix} 0 \\ 1 \end{pmatrix}$ and $\begin{pmatrix} 1 \\ 0 \end{pmatrix}$ but not for $\frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix}$ and $\frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix}$ basis.

+

And I said that because I did these wrong calculations:

+
    +
  • With computational basis:
  • +
+

$ A |v_{0}\rangle = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 0 \times 0 + 1 \times 1 \\ 1 \times 0 + 0 \times 1 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \end{pmatrix} = |v_{1}\rangle $

+
    +
  • With the other basis:
  • +
+

$ A |v_{0}\rangle = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 0 \times 1 + 1 \times 1 \\ 1 \times 1 + 0 \times 1 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} \ne |v_{1}\rangle $

+

I used elements of the vectors and not vectors, so all these calculations are wrong.

+

Let's see how is the correct way:

+
    +
  • With computational basis:
  • +
+

$A |v_{0}\rangle = 0 \times |v_{0}\rangle + 1 \times |v_{1}\rangle = 0 \times \begin{pmatrix} 0 \\ 1 \end{pmatrix} + 1 \times \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \end{pmatrix} = |v_{1}\rangle $

+

$A |v_{1}\rangle = 1 \times |v_{0}\rangle + 0 \times |v_{1}\rangle = 1 \times \begin{pmatrix} 0 \\ 1 \end{pmatrix} + 0 \times \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \end{pmatrix} = |v_{0}\rangle $

+
    +
  • With the other basis:
  • +
+

$A |v_{0}\rangle = 0 \times |v_{0}\rangle + 1 \times |v_{1}\rangle = 0 \times \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} + 1 \times \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix} = |v_{1}\rangle $

+

$A |v_{1}\rangle = 1 \times |v_{0}\rangle + 0 \times |v_{1}\rangle = 1 \times \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} + 0 \times \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} = |v_{0}\rangle $

+

I hope all become clear now. I couldn't explain my problem correctly before. I'm really sorry.

+

I have to thanks a lot to teclado from another forum web page.

+",,user12503,,user12503,7/1/2020 16:21,7/1/2020 16:21,,,,0,,,,CC BY-SA 4.0 +12739,1,12747,,7/1/2020 17:06,,7,725,"

How can a while loop be implemented in a quantum computer?

+

If quantum computing consists of :

+
    +
  1. preparing a state
  2. +
  3. applying a unitary operator
  4. +
  5. measuring,
  6. +
+

then it seems like it's not possible to wait for an indefinite amount of time before measuring. +How can one know that the while loop ended and that it's time to mesure ?

+",12547,,491,,7/17/2020 23:26,7/17/2020 23:26,How to implement a while loop in a quantum computer?,,3,0,,,,CC BY-SA 4.0 +12740,2,,12739,7/1/2020 17:15,,6,,"

I think the closest thing to a "while loop" in a quantum algorithm is something like the Variational Quantum Eigensolver (VQE) or other classical-quantum hybrid algorithms. In these, a certain cutoff is defined for when the variational circuit is "close enough" to approximating the desired quantum state, so you can think of it as a while loop.

+

Generally, however. quantum algorithms (as they currently stand) are more closely related to classical programs which do computations, instead of ones that exhibit lots of higher level logic. Some work has begun to be done on stuff like quantum assertions, which might begin to allow us to start growing in that direction, but seeing as quantum gates are still applied by classical machines, bridging that quantum-classical gap requires a measurement.

+",3056,,,,,7/1/2020 17:15,,,,0,,,,CC BY-SA 4.0 +12742,1,12744,,7/1/2020 20:42,,1,255,"

To distinguish between a coherent and de-cohered stage of the same system +what experiments can provide the answer? The term Experiment is used here in the Bohr-Einstein-debate sense, a realizable physically sensible procedure, not necessarily practical in current labs.

+

Assumptions: Suppose the system initially is in a true superposition state |ψ⟩ = 1/√2(|0⟩+|1⟩), thus its density matrix initially has coherences (off diagonal) terms.

+

Also assume that If we decide to switch-on an external auxiliary apparatus, and bring it into interaction with our system then, due to the interaction with that auxiliary apparatus its density matrix becomes +\begin{bmatrix}0.5 & 0 \\ 0 & 0.5\end{bmatrix} We'll call that new stage 'the system has decohered'.

+

The question is - what experimental test can determine whether the system has decohered or not.

+

(*As the model-system any convenient physical 2- state model can be used i.e. spins, energy levels etc.)

+",12551,,55,,7/21/2022 13:15,7/21/2022 13:15,What experiments can distinguish between mixed and pure states?,,1,0,,,,CC BY-SA 4.0 +12743,1,12751,,7/1/2020 21:19,,1,53,"

When a azimuthal phase $\mathrm{e}^{il\phi}$ is applied to gaussian beams having plane wavefront, they develop a corkscrew sort of structure and therefore possess an orbital angular momentum in addition to the spin angular momentum. Due to the continuity of the function, it should have the same value after a $2\pi$ rotation hence $l$ can only take integer values. One can create these states by passing Gaussian beams into spiral wave plates. +I want to know if we want to perform say a QKD protocol using let's say qutrits how do we restrict ourselves to just 3 dimensions?

+",11668,,55,,7/3/2020 9:41,7/3/2020 9:41,"How do we restrict to a limited number of dimensions, say 3 for qutrits, while using OAM states of light?",,1,0,,,,CC BY-SA 4.0 +12744,2,,12742,7/1/2020 21:20,,3,,"

So basically you want to distinguish the state $| + \rangle \langle + | $ from the dephased state $\frac{1}{2}(| 0 \rangle \langle 0 | + | 1 \rangle \langle 1 | ) = \frac{\mathbb{I}}{2}$.

+

Here's a simple experiment: apply a Hadamard to both states and then measure in the $\sigma_{z}$ basis. For the ``true superposition'', this transforms it into the state $| 0 \rangle \langle 0 | $ and so we get the output $0$ with probability 1 (when measured in the $\sigma_{z}$ basis). The mixed state on the other hand is unitarily invariant and therefore yields probabilities $(\frac{1}{2}, \frac{1}{2})$ in any basis (inclusing the $\sigma_{z}$ basis).

+

Update: This process can be generalized to other states and bases -- the idea is to transform to a basis where the coherence in the pure state manifests itself (while the incoherent state transforms into something else; allowing them to be distinguished).

+",1108,,,,,7/1/2020 21:20,,,,12,,,,CC BY-SA 4.0 +12745,1,12752,,7/1/2020 23:24,,2,571,"

I have looked at other questions that ask pretty much the same thing such as this and from what I gathered the significant difference in simulation and actual results is due to decoherence and compounding quantum noise effects especially due to the depth/complexity of the quantum circuit, however in my case the circuit is relatively simple and has only 3 Qubits.

+

The circuit that I am running is exactly the same as the Coding with Qiskit Episode 6 Tutorial, however I decreased the length of the secret number string from 6 to 3 to decrease circuit complexity as I had even worse results with length 6. My understanding is that the qasm_simulator produces the expected theoretical results of an ideal quantum computer, however when I ran the 6 length string on the IBM QE backend ibmq_16_melbourne I didn't even get a single count for the ONLY theoretically expected result, for example if the secret number is num='101010' then the qasm_simulator correctly returned num with a single shot whereas the IBM QE backend returned everything but num even with a few dozen shots. When I lowered the string length to 3, I at least got num returned in the results but it wasn't significant and had a probability similar to the rest of the counts.

+

I would imagine that the issue is not with the quantum computer due to the simplicity of the quantum circuit, meaning that I must be doing something wrong.

+",12248,,,,,7/2/2020 10:39,Why are IBM QE backend results different from the qasm simulator for a simple quantum circuit?,,2,0,,,,CC BY-SA 4.0 +12746,1,12748,,7/2/2020 4:13,,4,228,"

The conditional min-entropy is defined as (wiki):

+

$$ +H_{\min}(A|B)_{\rho} \equiv -\inf_{\sigma_B}\inf_{\lambda}\{\lambda \in \mathbb{R}:\rho_{AB} \leq 2^{\lambda} \mathbb{I} \otimes \sigma_B\} +$$

+

And the smooth min-entropy is defined as:

+

$$ +H_{\min}^{\epsilon}(A|B)_{\rho} \equiv \sup_{\rho'} H_{\min}(A|B)_{\rho'} +$$

+

Which just means that $\rho'_{AB}$ is some $\epsilon$-bounded distance away from $\rho_{AB}$. I know how to write a semi-definite program of the conditional min-entropy, which is:

+

$$ +\text{min } \text{tr}(X) \\ +\text{such that:} \\ +\mathbb{I} \otimes X \ge \rho_{AB}\\ +X \in \text{Herm}(\mathcal{H_B}) +$$ +I can implement this program in cvx(matlab). But the trouble is, in order to calculate the smooth min-entropy, I have to take a maximization over all $\rho'_{AB}$ who are $\epsilon$-distance away from $\rho_{AB}$. This means I need to write a double objective function in the semidefinite program. Something like:

+

$$ +\text{max } \rho'_{AB} \\ +\text{min } \text{tr}(X) \\ +\text{such that:} \\ +\mathbb{I} \otimes X \ge \rho'_{AB}\\ +X \in \text{Herm}(\mathcal{H_B}) \\ +\rho'_{AB} \in \mathcal{B}^\epsilon(\rho_{AB}) +$$

+

What is the correct form of this double objective function? Is there any hope of writing it in cvx (matlab)?

+",2403,,55,,9/30/2020 3:54,9/30/2020 3:54,Semi-definite program for smooth min-entropy,,1,0,,,,CC BY-SA 4.0 +12747,2,,12739,7/2/2020 7:22,,7,,"

The way that many algorithms would deal with such a desire is to incorporate the measurement at a more fundamental level, essentially making it part of the 'while' condition. i.e. you have an output qubit that is 0/1 for computation complete or not, you measure it, and decide whether to continue or not. Because that's a bit of classical processing, it doesn't have to be reversible, and you avoid the need for infinite space.

+

For example, many quantum algorithms only have a finite probability of success. For example, search or Factoring. In both of these cases, you know if you succeeded, and so there's an additional bit of classical logical that says "repeat until successful" i.e. a while loop.

+",1837,,,,,7/2/2020 7:22,,,,0,,,,CC BY-SA 4.0 +12748,2,,12746,7/2/2020 8:03,,6,,"

You do not need a double objective function to solve this. Given $\rho_{AB}$ let $\rho_{ABC}$ be any purification of $\rho_{AB}$. Then we can write the smooth min-entropy as the following SDP +\begin{align*} +2^{-H_{\min}^{\epsilon}(A|B)} = \min& \quad\mathrm{Tr}(\sigma_B) \\ +\text{s.t.}& \quad I_A \otimes \sigma_B \geq \mathrm{Tr}_C(\widetilde{\rho}_{ABC}) \\ +& \quad \mathrm{Tr}(\widetilde{\rho}_{ABC}) \leq 1 \\ +& \quad \mathrm{Tr}(\widetilde{\rho}_{ABC} \rho_{ABC}) \geq 1 - \epsilon^2 \\ +& \quad \widetilde{\rho}_{ABC} \geq 0 \\ +& \quad \sigma_B \geq 0 +\end{align*} +For more details on this I would suggest reading Quantum Information Processing with Finite Resources. The SDP above is equation 6.37 in the linked book. From this you should be able to write the smooth min-entropy in CVX.

+",9854,,9854,,7/2/2020 19:58,7/2/2020 19:58,,,,0,,,,CC BY-SA 4.0 +12749,2,,12739,7/2/2020 8:16,,6,,"

One option would be to identify an upper bound for the number of iterations of the while loop and implement a traditional and conditional loop:

+

Consider you have three registers

+
    +
  • a control $|\text{cntl}\rangle$ bit
  • +
  • some state $|\psi\rangle$
  • +
  • some condition for the while loop $|\text{cond}\rangle$
  • +
+

Assume the maximal number of iterations is bounded to $B$, then you perform the following $B$ times:

+
    +
  1. Check if condition $|\text{cond}\rangle$ is fulfilled for register $|\psi\rangle$. Save the output in $|cntl\rangle$ (note that $|\text{ctl}\rangle$ will represent a superposition of $\{0,1\}$, s.t. its $1$ for those substates that require additional iteration)
  2. +
  3. Perform the unitary operation on register $|\psi\rangle$ conditioned on $|\text{ctl}\rangle$
  4. +
  5. (Uncompute $|cntl\rangle$)
  6. +
  7. Repeat.
  8. +
+

(If someone can tell me how to use Tikz code or insert a picture, I can provide you a circuit representation)

+",7824,,7824,,7/13/2020 12:15,7/13/2020 12:15,,,,0,,,,CC BY-SA 4.0 +12750,2,,12737,7/2/2020 9:03,,1,,"

The awesome drag-and-drop quantum circuit visualization Quirk offers some kind of visualiztion, i.e., one can display the probabilities (amplitudes) and density matrices for every step.

+

E.g. in the implementation of Simon's algorithm below for the function $f(x) = f(x \oplus s), s=11$ one can see the interference after the application of the 2nd Hadamard gate. First, all basis states are equally likely, then inteference kicks in with the Hadamard and you end up with only $|00>$ or $|11>$.

+

https://algassert.com/quirk#circuit={%22cols%22:[[%22H%22,%22H%22],[%22%E2%80%A2%22,1,%22X%22],[%22%E2%80%A2%22,1,1,%22X%22],[1,%22%E2%80%A2%22,%22X%22],[1,%22%E2%80%A2%22,1,%22X%22],[1,1,%22Measure%22,%22Measure%22],[%22Chance2%22],[%22H%22,%22H%22],[%22Chance2%22],[%22Measure%22,%22Measure%22]]}

+",7824,,,,,7/2/2020 9:03,,,,1,,,,CC BY-SA 4.0 +12751,2,,12743,7/2/2020 9:34,,2,,"

As for any platform, one has to choose a suitable $d$-dimensional "computational" subspace. Suitability depends on your application, but generally it means that one should be able to perform operations on that subspace and couple it to other qudits. In practice, these operations will couple the qudit to degrees of freedom outside of the subspace which will effectively lead to noise. Additionally, one often want the subspace to be "robust" against e.g. thermal noise. In practise, this could mean that one chooses the lowest energy eigenstates of a system which are hopefully separated by a large energy gap from the rest.

+

As far as I know from conversations with friends working on OAM & entanglement, the qubit case is often realised in a $\pm l$ subspace since it is particularly easy to generate a maximally entangled state using e.g. parametric down conversion. As far as I know, higher-dimensional implementations are less common, but there are a few groups working on this. Here's a recent paper (open access) by Vienna, Tampere and Ottawa groups showing how to it for $d \leq 5$: https://www.osapublishing.org/optica/abstract.cfm?uri=optica-7-2-98 and this paper from the Viennise groups demonstrate higher-dimensional entanglement using OAM https://www.nature.com/articles/nphoton.2016.12

+

QKD was demonstrated by e.g. the Vienna groups via free-space links and there are people working on free-space OAM communication. In this setting, OAM subspaces tend to be not too robust due to the presence of atmospheric turbulence (in contrast to e.g. polarisation dof), see e.g. this series of papers: https://journals.aps.org/pra/abstract/10.1103/PhysRevA.97.012321 and https://iopscience.iop.org/article/10.1088/1367-2630/ab006e (arxiv versions available).

+",2305,,,,,7/2/2020 9:34,,,,0,,,,CC BY-SA 4.0 +12752,2,,12745,7/2/2020 9:47,,4,,"

Indeed your understanding is correct about the simulator and the idea of the ideal quantum computer, when you run a circuit on the simulator, you don't have any noise involved by default, but you will if you run on real backends, that is why you have better results on the simulator. One way to try and reduce the noise of real backends is to try error mitigation techniques, you can find the qiskit tuto here: https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html
+I also tried to run the code you pointed out in your question on other IBM devices, specifically I tried '1011' on ibmq_vigo and it gives better results than ibmq_16_melbourne, so don't hesitate to change the backend you're working on! Also, to get more precise results, you can try to increase the number of shots on real backends. I hope this helps :)

+",12396,,,,,7/2/2020 9:47,,,,0,,,,CC BY-SA 4.0 +12753,2,,7215,7/2/2020 10:13,,5,,"

This question was solved in 2014 by Vértesi and Brunner: they found a quantum state with positive partial transposition that violated a Bell inequality. The conjecture that all states with positive partial transposition do not violate any Bell inequality was known as the Peres conjecture, so they disproved it.

+

As for your parenthetical question, whether all states with positive partial transposition do violate a Bell inequality, the answer is negative. It has been known since 1989 that there exists entangled states that do not violate any Bell inequality; more recently it was shown that there exists states that still do not violate any Bell inequality even after local filtering. Curiously, both these examples are states with negative partial transposition, but it should be easy enough to construct one with positive partial transposition.

+

EDIT: It turns out that it is not easy, but it has been done. In this paper they showed a PPT entangled state that is local for all projective measurements, and in this paper a tripartite PPT entangled state that is local for all POVMs.

+",12541,,12541,,7/17/2020 12:11,7/17/2020 12:11,,,,0,,,,CC BY-SA 4.0 +12754,2,,12745,7/2/2020 10:39,,2,,"

For running on melbourne, try increasing the optimization_level parameter to 3 (the maximum level). Between creating your circuit and running on a device, the circuit needs to be 'transpiled' into the set of gates and operations available on the device, and extra gates added to get around connectivity issues. We can see the difference in circuits using:

+
melb = provider.get_backend('ibmq_16_melbourne')
+tcircuit_melb = transpile(circuit, melb, optimization_level=1) #change this
+tcircuit_melb.draw()
+
+

(note that transpiled circuits can vary). Secondly, the barriers are used a visual aid, but they also stop the transpiler collapsing gates (a further optimisation). If you remove the barriers and re-transpile, the difference in results is quite dramatic. Here are my results for the string 110 on melbourne:

+
{'000': 50, '010': 11, '101': 5, '100': 824, '110': 134}
+
+

These results are innaccurate but do not seem like random errors, which makes me think there could be some other problem with melbourne at this moment in time. The results from Vigo are as expected though:

+
{'111': 9, '000': 4, '011': 2, '010': 27, '101': 1, '100': 18, '110': 963}
+
+",10415,,,,,7/2/2020 10:39,,,,0,,,,CC BY-SA 4.0 +12755,2,,12722,7/2/2020 11:12,,1,,"

As a supplement to the previous answer:

+

No need to compute inner products ... It is well known that any $n$-qubit stabiliser state is of the form $|\psi\rangle = |K|^{-1/2} \sum_{x\in K} i^{d\cdot x} (-1)^{q(x)+b\cdot x} |x\rangle$ where $K\subset \mathbb{F}_2^{n}$ is an affine subspace, $b,d\in \mathbb{F}_2^{n}$ are vectors and $q$ is a quadratic form (Dehaene and de Moor 2003). In particular, $|\langle x | \psi \rangle|^2$ is $1/|K|$ if $x\in K$ and 0 else. Thus, the von Neumann entropy is $S(\rho_\mathrm{diag}) = \log |K| = \log 2^k = k \log 2$ (where $k=\dim K$).

+",2305,,,,,7/2/2020 11:12,,,,0,,,,CC BY-SA 4.0 +12756,2,,9635,7/2/2020 13:32,,3,,"

I'll try to address the problem from the Riemannian geometry point of view. In this approach, the distances are identified as length of geodesics of Riemannian metrics on spaces of quantum states. The advantage of this approach lies in the fact that the Riemannian distances automatically satisfy the metric axioms of positivity, symmetry and the triangle inequality and sometimes additional properties of interest in quantum information theory such as monotonicity.

+

The distance $d_1$ is the geodesic distance of the Fubini-Study metric on the pure state space $\mathbb{C}P^{N-1}$ connecting the rays $\psi$ and $\phi$. It is the only distance on $\mathbb{C}P^{N-1}$ invariant under unitary evolution.

+

The elements of the pure state space are rank $1$ projectors onto rays of a projective Hilbert space. This space is a subspace of the following spaces:

+
    +
  1. The cone $\mathcal{P}^N$ of positive definite $N$ dimensional complex matrices.
  2. +
  3. The quantum state space of density matrices $\mathcal{M}^N$ consisting of the intersection of $\mathcal{P}^N$ with the space of unit trace matrices. +(Using the notation of Bengtsson and Życzkowski , pages 192 and 200). +The spaces $\mathcal{P}^N$ and $\mathcal{M}^N$ can be equipped with a metric called the Bures metric (Or the Bures-Wasserstein metric). +$$ds_B^2 = \text{tr}(GdX)$$ +Where, in the first case, $X=R$, a positive definite complex matrix, and in the second case $X=\rho$, a density matrix +The matrix valued one form $G$ is given implicitly in: +$$dX = XG+GX$$ +The geodesic distance function associated to this metric on $\mathcal{P}^N$ is given by ( Bengtsson and Życzkowski equation 9.31): +$$D^{\mathcal{P}^N }_{\text{Bures}}(R_1, R_2) = \text{tr}(R_1)+ \text{tr}(R_2)-2 \sqrt{F}( R_1, R_2)$$ +Where $\sqrt{F}$ is the Uhlmann fidelity: +$$\sqrt{F}( R_1, R_2) = \text{tr}\left(\sqrt{\sqrt{R_1}R_2\sqrt{R_1})}\right)$$ +While on the space $\mathcal{M}^N$ of density matrices, the same metric gives rise to the geodesic distance function (equation 9.32): +$$D^{\mathcal{M}^N }_{\text{Bures}}(\rho_1, \rho_2) = \arccos(\sqrt{F}( \rho_1, \rho_2))$$ +As can be easily seen, when the initial and final points are pure states, the first formula reduces to $d_2$ (multiplied by a factor of $2$), while the second formula reduces to $d_1$.
  4. +
+

Thus, if the projectors representing the initial and final pure states are regarded as merely positive matrices and we don't mind that the intermediate points on the geodesic are only positive matrices with not necessarily a unit trace, then we get the second distance $d_2$. On the other hand, if we insist that the intermediate points are also quantum states we get the first distance $d_1$.

+

The equality of the Bure's distance for density matrices when restricted to pure states and the Fubini-Study distance proves that at the metric level, the restriction of the Bures metric to pure states is the Fubini-Study metric. Another metric possessing this property is the Wigner-Yanase metric. Both Bures and Wigner-Yanase metrics are known to be monotone.

+

The Fubini-Study metric has a very well known expressions in coordinates and otherwise, for example in Bengtsson and Życzkowski equation 4.51. The Bures metric in the other hand can be given in general only implicitly. It is not easy to write an explicit formula except when $N=2$ (Bengtsson and Życzkowski equation 9.50). The distance function of Bures was known long ago, but it was only much later when Uhlmann proved that the distance function originates from a Riemannian metric.

+

Uhlmann's proof is indirect due to the implicitness of the Bures metric, but the simpler case of the Fubini-Study metric the computation of the distance function from the metric is rather simple, which I'll include in this answer: +On a Riemannian manifold $(M, g)$, a geodesic is a curve: $[0, 1] \rightarrow M$ starting at $x(0) = x_i$ and ending at $x(1) = x_f$ minimizing the functional (arc length): +$$I[x]= \int_0^1 g\left(\frac{dx}{dt}, \frac{dx}{dt}\right) dt$$ +When a unique solution $x_c(t)$ exists, then the arc length (regarded as a function of the initial and final points): +$$S(x_i, x_f) = I[x_c],$$ +satisfies the Hamilton-Jacobi equation: +$$ g(\nabla_{x_i}S, \nabla_{x_i}S) = 1$$ +The Hamilton-Jacobi equation has exact solutions in rare cases when the system is integrable , such as in the case of the harmonic oscillator and the Kepler problem; in many multidimensional cases the solution is obtained by means of separation of variables. +The Fubini-Study geodesic motion on $\mathbb{C}P^{N-1}$, is integrable and the Hamilton-Jacobi equation is exactly solvable. Substituting $|\phi\rangle =|\psi\rangle + |d\psi\rangle $ in $d_1$, we get: +$$ds_{FS} = \arccos(1+|\langle \psi| d\psi\rangle|) = \sqrt{\langle d\psi|d\psi\rangle-\langle d\psi|\psi\rangle\langle \psi|d\psi\rangle }$$ +One way to accomplish that is to exploit the homogeneity of $\mathbb{C}P^{N-1} = SU(N)/S(U(N-1) \times U(1))$. In calculating the geodesic distance between two rays $\psi_i$ and $\psi_f$, we can perform a special unitary transformation to bring $\psi_i$ to: +$$|\psi_i\rangle = [1, 0, …, 0]^t$$ +We still have an $S(U(N-1) \times U(1))$, freedom which can be used to bring any other unit vector to the form: +$$|\psi\rangle = [\cos(\theta), \sin(\theta), 0, …, 0]^t$$ +Substituting, the last expression in the Fubini-Study metric we obtain: +$$ds^2_{FS} =d\theta^2$$ +Thus, the Hamilton-Jacobi equation takes the form: +$$\left(\frac{dS_{FS}}{d\theta}\right)^2 = 1$$ +Whose, solution is: +$$S_{FS} = \theta + \text{Const.}$$ +Fixing the constant by requiring the distance to be from the initial point ($\theta = 0$) to vanish: +Thus: +$$ S_{FS} = \theta = \arccos|\langle \psi|\psi_i\rangle|$$

+

$\mathbb{C}P^{N-1}$ as a Riemannian symmetric space. In this respect, the angle $\theta$ on $\mathbb{C}P^{N-1}$ is called a radial coordinate ( a generalization of the radial coordinate in spherical coordinates of the Euclidean space). The number of radial coordinates is called the rank of the symmetric space. (This means that $\mathbb{C}P^{N-1}$ is symmetric space of rank one). The space of density matrices $\mathcal{M}^N$ possesses subspaces which are symmetric spaces of higher rank. Thus, these spaces have multiple radial coordinates and other distance functions.

+

The Hamilton-Jacobi equation on $\mathbb{C}P^{N-1}$ can also be directly solved using the local Kählerian coordinates given in in Bengtsson and Życzkowski equation 4.51.

+",4263,,9118,,10/29/2020 8:01,10/29/2020 8:01,,,,0,,,,CC BY-SA 4.0 +12757,1,12758,,7/2/2020 15:27,,4,1249,"

I was researching how to submit multiple pulse schedules/circuits in the same job and came across 2 methods:

+
    +
  1. Executing Experiments with qiskit.execute
  2. +
  3. and IBMQJobManager.run
  4. +
+

What are the advantages and disadvantages of using either over the other?

+",12248,,55,,8/2/2020 12:19,9/1/2020 14:03,What is the difference between Qiskit execute and the IBMQJobManager?,,1,0,,,,CC BY-SA 4.0 +12758,2,,12757,7/2/2020 15:56,,3,,"

qiskit.execute is a convenience function that does both transpile and assemble under the cover.

+

IBMQJobManager.run does not do transpile, but it does assemble. IBMQJobManager will, however, split your schedules/circuits into multiple jobs, submit them, and consolidate the results if the number of schedules/circuits exceed the maximum allowed for a backend per job. qiskit.execute doesn't do this and the job will just fail the limit is reached.

+",12195,,,,,7/2/2020 15:56,,,,0,,,,CC BY-SA 4.0 +12759,2,,8570,7/2/2020 16:48,,2,,"

It is equivalent to saying that Alice and Bob share a state of the form +$$\rho^{AB} = \int \mathrm{d}\lambda \mu(\lambda) |\lambda\rangle\langle \lambda| \otimes \rho_\lambda, $$ +without any restriction whatsoever on Alice's measurements (you forgot the normalisation, without which it is not a valid quantum state). The expression "classical message" only implies that there's no restriction on how the probability distribution $p(a|x,\lambda)$ depends on $\lambda$. Allowing the different $\lambda$ to be associated to orthogonal quantum states is enough to attain full generality. The formulation with the "classical message" is the most usual one, because it's more convenient for making calculations with a computer.

+

Perhaps it's more enlightening to consider which assumptions go into a quantum steering scenario: nothing is assumed about Alice's measurements, so the only information about her is that she obtains outcome $a$ for input $x$ with probability $p(a|x)$. On the other hand, it is assumed that everything is known about Bob's measurements, so he can use them to perform quantum state tomography on his part of the share quantum state, and recover the conditional states $\rho_{a|x}$. All the information available can then be encoded in the assemblage $\sigma_{a|x} := p(a|x)\rho_{a|x}$. Now one can ask whether this assemblage allows for a Local Hidden State model, or it certifies that Alice and Bob shared entanglement.

+",12541,,,,,7/2/2020 16:48,,,,0,,,,CC BY-SA 4.0 +12760,1,12761,,7/2/2020 19:37,,0,89,"

Very general question so I'm not looking for an exact answer.

+

I just want a basic description of certain ways it can be done and then if possible the names of those ways, so that I can look them up further.

+

But I want to know, if I was to run some code in a quantum computing language, how would a classical computer interface with the quantum one to instruct it?

+

Contact the machinery that directly builds a full circuit and then run it? +Does it go line by line and apply the gate at each stage? +Can it just directly communicate with the qubits?

+

Note: I am looking for answers for both gate based and continous computing

+",12510,,,,,7/3/2020 1:49,What are some general concepts of how a classical computer would interface with a quantum computer?,,1,0,,,,CC BY-SA 4.0 +12761,2,,12760,7/3/2020 1:49,,2,,"

It would be really platform specific - for example, suppose you have a quantum program ready using some gate set. But, the quantum hardware you have implements a different set. Well, you'd need to convert from your original gates into a new set of gates (and potentially perform some optimizations). Overall, this can probably be broken into a few steps:

+
    +
  1. Prepare a quantum program (Q#, Qiskit, etc.)
  2. +
  3. Compile into the device's gate set (RZ, X, etc.)
  4. +
  5. Convert gates into hardware instruction (Laser pulse of XYZ with frequency ABC, for example)
  6. +
  7. Report results mechanically (e.g. measure qubit) and return to operating machine
  8. +
+

Here's an example of how Q# thinks of the classical/quantum interaction. What we discussed occurs between "Q# operation" and "Target machine." +

+",8343,,,,,7/3/2020 1:49,,,,4,,,,CC BY-SA 4.0 +12762,1,12781,,7/3/2020 2:06,,1,182,"

The motivation for this question comes from trace distance. For any two states $\rho, \sigma$, the trace distance $T(\rho, \sigma)$ is given by

+

$$T(\rho, \sigma) = |\rho - \sigma|_1,$$

+

where $|\cdot|_1$ is the 1-norm and given by $|X|_1 = \text{Tr}(\sqrt{X^\dagger X})$. The point here is that I do not need to know $\rho$ or $\sigma$ to compute the trace distance between them. All I need to know is $\rho - \sigma$.

+

Can one also compute $F(\rho,\sigma)$ where $F$ is the fidelity if one is only given $\rho - \sigma$? I am aware of bounds that can be placed using the trace distance on $F(\rho,\sigma)$ but was wondering if it could be exactly computed.

+",4831,,55,,7/3/2020 9:20,7/4/2020 13:09,"Can the fidelity $F(\rho,\sigma)$ be computed knowing only $\rho - \sigma$?",,1,1,,,,CC BY-SA 4.0 +12764,1,12765,,7/3/2020 3:19,,2,121,"

Can you please recommend some good papers on quantum cryptography? I really need to learn more about this topic (any tips will be very helpful). +Thanks!

+",12568,,9006,,7/3/2020 6:14,7/3/2020 12:46,Tips on quantum cryptography?,,1,0,,,,CC BY-SA 4.0 +12765,2,,12764,7/3/2020 3:34,,3,,"

I would start from this excellent intro course by Thomas Vidick and Stephanie Wehner, available in Edx. Then take a look at some classic papers:

+
    +
  1. The one that started it all: https://core.ac.uk/reader/82447194.
  2. +
  3. The one that brought a whole new approach: https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.67.661
  4. +
  5. The one that simplified it somewhat: https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.68.3121
  6. +
+

Also, assuming you are at the beginning, as Quantum Cryptography is an application of quantum information theory in general, read the bible for it too. Which is otherwise known as the Nielsen and Chuang book.

+",2403,,2403,,7/3/2020 12:46,7/3/2020 12:46,,,,0,,,,CC BY-SA 4.0 +12767,2,,12706,7/3/2020 14:49,,1,,"

Quantum Operations are visualized as Unitary matrices. This puts a limit to their sparseness. A Quantum Operation acting on $n$ qubits can be represented by Unitary Matrix of size $2^n \times 2^n$. However since these are unitary operations, every column of the Unitary must have $L2$ norm as $1$ and hence have atleast 1 non-zero value. This implies that out of the $2^n \times 2^n = 2^{2n}$ elements of the Unitary atleast $2^n$ must be non-zero.

+

Hence for a Quantum Operation acting on a given $n$ qubits. We can define a most sparse matrix criteria. Unitaries which have the minimum i.e. $2^n$ non-zero elements can be said to satisfy this criteria.
+The most common/canonical Quantum Operations which satisfy the most sparse matrix criteria are:

+
    +
  1. Single Qubit Pauli Gates $X,Y,Z,I$ .
  2. +
  3. Single Qubit Phase Gates $S,T,R_1(\theta),R_Z(\theta)$ .
  4. +
  5. Multi-Qubit $CNOT$, $SWAP$ gate.
  6. +
  7. The most sparse matrix criteria can be said to be closed under the Tensor product operator as $\otimes$. Most Sparse matrix $\otimes$ Most Sparse matrix is also a Most Sparse matrix.
  8. +
  9. Other common examples of these gates can be the $Increment, Decrement$ and $Shift$ Unitaries.
  10. +
+

We can also define a least sparse criteria which can be said to include Unitaries which have the maximum i.e. $2^{2n}$ non-zero elements. +The most common/canonical Quantum Operations which satisfy the most sparse matrix criteria are:

+
    +
  1. Hadamard Operator $H$ for Single Qubit Operations.
  2. +
  3. Single Qubit Rotation Gates $R_x(\theta),R_y(\theta)$ for non-trivial $\theta$
  4. +
  5. Quantum Fourier Transform $QFT$ for Multi Qubit Operations is another operations whose matrix representation can be said to be least sparse.
  6. +
+",8757,,8757,,7/3/2020 16:03,7/3/2020 16:03,,,,0,,,,CC BY-SA 4.0 +12768,2,,12602,7/3/2020 15:47,,3,,"

If this is part of a debugging effort then you can use the DumpRegister function. +If you have a qubit q which is in the general state $\alpha|0\rangle + \beta|1\rangle$ where $\alpha$ and $\beta$ are complex numbers such that $|\alpha|^2+|\beta|^2=1$.

+
DumpRegister([q])
+
+

will give an output like this (Having Different Numbers)

+
# wave function for qubits with ids (least to most significant): 1
+∣0❭:     0.707107 +  0.000000 i  ==     ***********          [ 0.500000 ]     --- [  0.00000 rad ]
+∣1❭:    -0.500000 + -0.500000 i  ==     ***********          [ 0.500000 ]  /      [ -2.35619 rad ]
+
+

However if the qubit is entangled with some other qubit the result would be

+
Qubits provided (0;) are entangled with some other qubit.
+
+

Each row of the output tells the Amplitude of the Qubit along the Particular Computational Basis. The left hand values are in the Regular Complex Notation (Real and Imaginary Parts) and right hand values are in [Probability] [Phase].
+The phase angle with $X$ axis is simply the $\arctan$ of the ratio of the absolute values of the amplitudes.

+

Proof:

+

Let us say the results give the amplitudes of basis states $|0\rangle$ and $|1\rangle$ as $\alpha = \alpha_R + i\alpha_I = |\alpha|e^{i\theta_1}$ and $ \beta = \beta_R + i\beta_I =|\beta|e^{i\theta_2} $ respectively.
+Then q is in the state $\alpha|0\rangle + \beta|1\rangle = |\alpha|e^{i\theta_1}|0\rangle + |\beta|e^{i\theta_2}|1\rangle$.
+We can remove the global phase and thus the relative phase will be $e^{i\theta_1-i\theta_2} = e^{i\theta}$ and let $\phi = 2\arctan\frac{|\beta|}{|\alpha|}$.
+Thus q is in the state $\cos\frac{\theta}{2}|0\rangle + e^{i\theta}\sin\frac{\theta}{2}|1\rangle$. +This state can be represented on the Bloch Sphere by the coordinates $(\sin\theta\cos\phi, \sin\theta\sin\phi, \cos\theta)$. Consequently the phase angle with X axis is given by $\arctan$ of the $x$ and $y$ coordinates. Thus the phase angle is $\phi=2\arctan\frac{|\beta|}{|\alpha|}$

+",8757,,,,,7/3/2020 15:47,,,,0,,,,CC BY-SA 4.0 +12769,1,,,7/3/2020 18:47,,1,156,"

I'm just getting started in the space of quantum computing, I've built a 5 qubit program for Bernstein-Vazirani, but am trying to figure out how to go about building an N bit version of Bernstein-Vazirani, and/ or Grover's algorithm given only 5 qubits to work with. I'm currently working in the Bioinformatics field, and for my work I thought it would be a good idea to use Bernstein Vazirani or Grover's to guess/ brute force genomes. If not any suggestions with source code is much appreciated.

+",12571,,9006,,7/4/2020 6:21,7/16/2020 13:23,Does anyone know of Qiskit source code for a Bernstein Vazirani grover's algorithm for N bits? If so please share,,2,0,,,,CC BY-SA 4.0 +12770,1,,,7/3/2020 19:44,,1,318,"

+

I am having challenges with Microsoft Q#. I wrote this short code and it says it can only occur at a global scope.

+

How do I fix this error? Any ideas? Thank you

+",11600,,2879,,7/4/2020 17:53,7/4/2020 17:53,"Microsoft Q#: ""Namespace declarations can only occur at a global scope"" error",,1,1,,,,CC BY-SA 4.0 +12771,2,,12770,7/3/2020 20:24,,1,,"

This error is about the “global scope” of the namespace declaration, which is unrelated to the “global phase” mentioned in your Q# code.

+

In Q# Jupyter notebooks, code is automatically wrapped in a namespace - there is no need to declare one in your code. If you remove the namespace Quantum.Kata.SingleQubitGates declaration from your code, it should work.

+",10473,,,,,7/3/2020 20:24,,,,0,,,,CC BY-SA 4.0 +12772,1,12773,,7/3/2020 22:46,,3,709,"

I know this it's perhaps, a little "stupid" question, but... What's the purpose of phase in Quantum?

+

Per example, in quantum Computing, the phase don't seems to be very important in the amplitudes and probability of the outcomes, before a qubit be measured. But I know that phase it's important for something, I just don't know exactly for what (quantum entanglement, perhaps?)

+",9013,,55,,7/4/2020 10:28,7/11/2020 8:37,What's the purpose of phases in quantum mechanics?,,3,4,,,,CC BY-SA 4.0 +12773,2,,12772,7/3/2020 23:08,,8,,"

This is simply not true. It is the global phase that is not physically relevant -- which can be immediately seen from the linearity of the Schrodinger equation: two states $| \psi \rangle, e^{i \phi} | \psi \rangle$ are both solutions to the same equation.

+

However, consider a qubit state, $| \psi \rangle \in \mathbb{C}^{2}$, with two different choices of local (a.k.a. relative) phases: $| + \rangle \equiv \frac{1}{\sqrt{2}}(| 0 \rangle + | 1 \rangle) \text{ and } | - \rangle \equiv \frac{1}{\sqrt{2}}(| 0 \rangle - | 1 \rangle)$, which are orthogonal to each other and hence completely distinguishable (for example, see this answer). For an explanation of the difference(s) between global and local phases, see this answer.

+

One way to deal with the ambiguity of global phases is to work in a complex projective space (or with density matrices) -- which is what one does, for example in quantum computing, where we represent qubit states on the Bloch sphere.

+

Also, phases are relevant for both amplitudes and probabilities of outcomes (again, it is the global phase that is not physically relevant). For example, see this answer, where two states that have same probability of outcomes when measured in the $\sigma_z$ basis yield different probabilities when measured in a different basis (say $\sigma_x$). Apart from this, phases are clearly very important for several quantum computing protocols like quantum phase estimation, in cyclic evolutions i.e., Berry phase, etc.

+",1108,,1108,,7/11/2020 8:37,7/11/2020 8:37,,,,0,,,,CC BY-SA 4.0 +12774,2,,12772,7/3/2020 23:12,,3,,"

Phase is really one of the things that makes quantum computing what it is! In fact, I think there is a quote by Aaronson like how quantum is "probability theory with negative numbers."

+

The place it comes in is when looking at the interference of different amplitudes. We don't see the phase directly when measuring states like $|+\rangle = |0\rangle + |1\rangle$ and $|-\rangle = |0\rangle - |1\rangle$ in the Z basis. Both states will give a 50/50 distribution. But if you apply a Hadamard transform to them, $$H|+\rangle = H|0\rangle + H|1\rangle = (|0\rangle + |1\rangle) + (|0\rangle - |1\rangle) = |0\rangle,$$ +$$H|-\rangle = H|0\rangle - H|1\rangle = (|0\rangle + |1\rangle) - (|0\rangle - |1\rangle) = |1\rangle.$$

+

The minus signs cause different terms to cancel out. So when changing basis or combining different states, the phase controls which amplitudes constructively and destructively interfere.

+",3056,,,,,7/3/2020 23:12,,,,0,,,,CC BY-SA 4.0 +12776,2,,12769,7/4/2020 5:44,,2,,"

Qiskit Aqua includes both algorithms:

+

https://qiskit.org/documentation/apidoc/qiskit.aqua.algorithms.html

+",5551,,5551,,7/4/2020 9:45,7/4/2020 9:45,,,,0,,,,CC BY-SA 4.0 +12777,2,,12772,7/4/2020 6:27,,1,,"

To give one example. A phase is very important in Grover algorithm used for searching in an unordered database. A record you are looking for (i.e. having specific features) is "marked" by negative amplitude (i.e. phase is $\pi$). Based on different phase in comparison with other records in the database the one you are searching for is picked and its probability is amplified, or in other words the record is found.

+",9006,,,,,7/4/2020 6:27,,,,0,,,,CC BY-SA 4.0 +12779,1,,,7/4/2020 11:10,,3,137,"

I am trying to calculate the expectation value of a customized operator on two similar but differently constructed states $\phi = \phi_2 =\frac{1}{\sqrt{2}}\left( |001⟩ + |011⟩\right)$ which consist of more qubits than the operator. (via Qiskit)

+
import numpy as np
+from qiskit import QuantumCircuit
+from qiskit.aqua.operators import CircuitOp, state_fns, Zero, One
+
+circuit = QuantumCircuit(2)
+circuit.z(0)
+circuit.z(1)
+
+op = CircuitOp(circuit)
+
+psi = QuantumCircuit(3)
+psi.h(1)
+psi.x(2)
+psi = state_fns.CircuitStateFn(circuit)
+psi2 = 1 / np.sqrt(2) * ((Zero ^ Zero ^ One) + (Zero ^ One ^ One))
+
+
+print('Expectation for phi:', psi.adjoint().compose(op).compose(psi).eval().real)  # Expectation for phi: 1.0
+print('Expectation for phi2:', psi2.adjoint().compose(op).compose(psi2).eval().real) # Error
+
+
+

The second expectation raises an error: +ValueError: Composition is not defined over Operators of different dimensions, 3 and 2, respectively.

+

Why is this happening? Why the first expectation is executed fine but not the second one?

+",12572,,55,,7/7/2020 13:08,7/7/2020 13:08,"Expectation value of an operator error: Composition is not defined over operators of different dimensions,",,1,0,,,,CC BY-SA 4.0 +12780,2,,5532,7/4/2020 12:46,,1,,"

James Thanks... your suggestion worked, with only exception that now, over the period, commands are updated, like IBMQ.delete_accounts() changed to IBMQ.delete.account() and so on...

+

See Account Management section in the below link for version "<0.3/v1" vs ">=0.3/v2" credentials:

+

https://github.com/Qiskit/qiskit-ibmq-provider/#updating-your-ibm-q-experience-credentials

+",12574,,,,,7/4/2020 12:46,,,,0,,,,CC BY-SA 4.0 +12781,2,,12762,7/4/2020 13:09,,5,,"

The answer is no, as the following counter-example reveals. Let $\varepsilon\in(0,1)$ and define +$$ +\rho_0 = +\begin{pmatrix} +\frac{1+\varepsilon}{2} & 0 & 0\\ +0 & 0 & 0\\ +0 & 0 & \frac{1-\varepsilon}{2} +\end{pmatrix},\quad +\rho_1 = +\begin{pmatrix} +\frac{1-\varepsilon}{2} & 0 & 0\\ +0 & 0 & 0\\ +0 & 0 & \frac{1+\varepsilon}{2} +\end{pmatrix} +$$ +as well as +$$ +\sigma_0 = +\begin{pmatrix} +\varepsilon & 0 & 0\\ +0 & 1-\varepsilon & 0\\ +0 & 0 & 0 +\end{pmatrix},\quad +\sigma_1 = +\begin{pmatrix} +0 & 0 & 0\\ +0 & 1-\varepsilon & 0\\ +0 & 0 & \varepsilon +\end{pmatrix}. +$$ +The differences agree, +$$ +\rho_0 - \rho_1 = +\begin{pmatrix} +\varepsilon & 0 & 0\\ +0 & 0 & 0\\ +0 & 0 & -\varepsilon +\end{pmatrix} = \sigma_0 - \sigma_1, +$$ +but the fidelities are not equal: +$$ +\mathrm{F}(\rho_0,\rho_1) = \sqrt{(1 + \varepsilon)(1-\varepsilon)} +\quad\text{and}\quad +\mathrm{F}(\sigma_0,\sigma_1) = 1-\varepsilon. +$$

+",1764,,,,,7/4/2020 13:09,,,,0,,,,CC BY-SA 4.0 +12782,2,,12732,7/4/2020 14:09,,1,,"

One way to paraphrase this question is to say that it hypothesizes a state that will not exist in general and then asks what that state is. There is no state of RAB in general that is consistent with both RA and AB being pure; this can only happen when RAB is in a pure product state $|\psi_R\rangle|\psi_A\rangle|\psi_B\rangle$.

+

For example, it could be that R, A, and B are all qubits, and we start with AB maximally entangled. This means that A is completely mixed, and purifying A to RA is again maximally entangled. However, there is no state of RAB that is consistent with both RA and AB being maximally entangled, which is a phenomenon commonly known as the monogamy of entanglement.

+

So what specifically is going wrong in the question? Well, we can certainly consider the state of A in isolation, and consider a purification of this state in RA, but there is no way to do this that is consistent with the existence of B and the state of AB being pure. Purification is not a physical process, for instance, where some quantum channel takes as input the system A and outputs RA that purifies A.

+",1764,,,,,7/4/2020 14:09,,,,0,,,,CC BY-SA 4.0 +12783,1,,,7/4/2020 16:27,,3,120,"

The book by John Watrous, "The Theory of Quantum Information" is an exciting read for anyone wanting to research quantum information theory. The following question presumes some background covered in the book, which I will do my best to explain.

+

Question: +If $\mathcal{X}_0, \mathcal{X}_1, \mathcal{Y}_0, \mathcal{Y}_1$ are complex Euclidean spaces (Finite dimensional Hilbert spaces on complex field) and $\Phi_0 \in C(\mathcal{X}_0,\mathcal{Y}_0)$ $\Phi_1 \in C(\mathcal{X}_1,\mathcal{Y}_1)$ are two quantum channels, with $\Phi_0$ being entanglement breaking, then show that +\begin{equation} +I_C(\Phi_0\otimes\Phi_1) = I_C(\Phi_1). +\end{equation}

+

Background: +Here, the space of channels $C(\mathcal{X}_0, \mathcal{Y}_0)$ consists of linear, completely positive trace-preserving (CPTP) maps on $L(\mathcal{X}_0)$ (linear operators on $\mathcal{X}_0$) returning operators in $L(\mathcal{Y}_0)$. For any channel $\Phi$ and state $S$ (states are non-negative operators with unit trace), the coherent information $I_C(\Phi;S) = H(\Phi(S)) - H((\Phi\otimes I)(vec(\sqrt{S})vec(\sqrt{S})^\dagger))$ and $I_C(\Phi) = \max_S I_C(\Phi;S)$, where the maximum is taken with respect to all states. For any operator $A = \sum_{i,j}a_{ij}|e_i\rangle\langle f_j|$, $vec(A) = \sum_{i,j}a_{ij}|e_i\rangle \otimes |f_j\rangle$.

+

A separable state is a state of the form $\sum_i p_i P_i\otimes Q_i$, where $P_i$ and $Q_i$ are states with $\sum_i p_i = 1$ with $p_i\ge 0$. States that do not have this kind of representation are called entangled. An entanglement breaking channel is one whose output state is always separable even if the input is entangled.

+

There is a theorem that may prove useful: The following are equivalent.

+
    +
  1. $\Phi$ is entanglement breaking (EB).
  2. +
  3. For any finite-dimensional Hilbert space $\mathcal{Z}$, $\Phi\otimes I_\mathcal{Z}$ is separable where $I_\mathcal{Z}$ is the identity map in $\mathcal{Z}$.
  4. +
  5. There exist states $\rho_i$ and non-negative operators $M_i$ such that $\sum_{i}M_i = I$ (called a POVM) such that $\Phi(S) = \sum_i \rho_i Tr(SM_i)$.
  6. +
+

I was able to show $I_C(\Phi_0 \otimes\Phi_1) \ge I_C(\Phi_0) + I_C(\Phi_1)$ for any two channels $\Phi_0$ and $\Phi_1$. The book does prove that $I_C(\Phi) \le 0$ for $\Phi$ EB. But I've been unable to make any progress beyond that.

+

I will be happy to offer any clarification if required. This problem has been bugging me for quite some time now and I cannot see a way through. This problem would interest students and professors working in Quantum Information Theory.

+
+

Cross-posted on math.SE

+",12577,,55,,9/30/2020 3:53,9/30/2020 3:53,Coherent Information and Entanglement Breaking channels,,0,3,,,,CC BY-SA 4.0 +12785,1,12817,,7/4/2020 22:21,,5,159,"

Is it possible (in theory) to convert any problem that can be solved on a quantum computer into an arrangement of slits carved into a piece of metal foil, and then to run the program by shining light on the foil and observing the pattern of light that it produces?

+

It seems to me that this should be possible, just as any program on a conventional computer can be transformed into a boolean circuit (in theory).

+",9482,,,,,7/13/2020 7:10,Can you transform a quantum program into an arrangement of slits?,,3,3,,,,CC BY-SA 4.0 +12786,1,,,7/4/2020 23:42,,1,280,"

I recently was watching these 2 videos on Coursera which show how to build a simple quantum computer that can implement the simplest case of the Deutsch-Jozsa algorithm (which uses only 2 qubits).

+

https://www.coursera.org/lecture/quantum-computing-algorithms/quantum-computer-prototype-diy-dCKRO

+

https://www.coursera.org/lecture/quantum-computing-algorithms/quantum-computer-prototype-solving-the-deutschs-problem-7EuD2

+

In it, the professor mentioned that the photon represented 2 qubits: one was the polarization qubit and one was the path/position qubit. Later, the professor stated that a half-wave plate affected the path/position qubit (not the polarization qubit). I found this really strange as I thought half waveplates only affected polarization.

+

How can a half-wave plate affect the position qubit and not the polarization qubit?

+",12347,,55,,7/7/2020 13:11,8/7/2020 9:40,How can a half-wave plate affect the position qubit and not the polarization qubit of a photon?,,1,1,0,,,CC BY-SA 4.0 +12788,1,,,7/5/2020 3:09,,3,318,"

In the paper of HHL algorithm (Quantum algorithm for linear systems of equations), the time complexity of simulating $e^{i A t}$ for a hermitian matrix A is $\tilde{O}\left(\log (N) s^{2} t_0\right)$. Let $T$ be the time required for the phase estimation subroutine. Then, the total-time of simulation should be $T \cdot \tilde{O}\left(\log (N) s^{2} t_0\right)$.

+

Why, then, is the time complexity $\tilde{O}\left(\log (N) s^{2} \kappa^{2} / \epsilon\right)$?

+

In the subsection of error and run-time, they said that the run-time is $\tilde{O}\left(\kappa \left(T_B + t_0 s^2 \log (N) \right) \right)$; why is it not $T \cdot \log (N) s^{2} t_0$ in the run-time, just $\log (N) s^{2} t_0$? Does that mean they just simulate $e^{i A t}$ one time?

+

Why does this paper needs T times simulation?

+",12581,,12581,,7/7/2020 10:00,12/19/2022 20:30,Confusion regarding time complexity in the HHL algorithm,,2,2,,,,CC BY-SA 4.0 +12789,1,12798,,7/5/2020 8:09,,3,244,"

In QuantumKatas Measurement Task 2.3 - Peres-Wooter's Game, we are given 3 states A,B and C. +We construct a POVM of these states. But how do we convert that POVM into a Unitary that we can apply.

+

Basically what I am asking is How do we get from

+

$M = \frac{1}{\sqrt{2}}\left(\begin{array}{rrr}1 & 1 & 1 \\\ 1 & \omega & \omega^2 \end{array}\right)$ +to +$M' = \frac{1}{\sqrt{3}}\left(\begin{array}{cccc}1 & -1 & 1 & 0 \\\ 1 & -\omega^2 & \omega & 0 \\\ 1 & -\omega & \omega^2 & 0 \\\ 0 & 0 & 0 & -i\sqrt3\end{array}\right)$

+",8757,,55,,8/22/2020 5:55,8/22/2020 5:55,How do you embed a POVM matrix in a Unitary?,,1,1,,,,CC BY-SA 4.0 +12790,1,12795,,7/5/2020 12:40,,3,232,"

The Setup for Grover's Algorithm is the following:
+Given an oracle $f_O^{\pm}$ representing a Query on a Database with total $N$ entries $N$ of which $k$ are matching. Grover's Algorithm is used to find with high probability a matching entry $x^*$.

+

In most papers researching Grover's Algorithm, the underlying assumption is that $k\lt\lt N$. Under the above assumption the optimal number of iterations is estimated to be $\frac{\pi}{4}\sqrt{\frac{N}{k}}$.

+

My questions is the following - What happens when Grover's Algorithm is applied to a database where this assumption is seriously violated? What's the optimal number of iterations in these cases? What happens in cases where $\frac{k}{N} \ge 0.5$?

+",8757,,9006,,7/6/2020 6:24,7/6/2020 6:24,Grover's Algorithm on a Database with more than 50% matching entries,,1,0,,,,CC BY-SA 4.0 +12791,1,12792,,7/5/2020 13:42,,0,38,"

I just want to clear what seems to be a bit confusing to me with quantum gates and their corresponding output. below are 3 scenarios implementing two hadamard gates

+
    +
  1. two hadamard gates on one qubit

    +
  2. +
  3. Hadamard gates on two qubits

    +
  4. +
  5. Interconnected Hadamard gates on two qubits

    +
  6. +
+

with the first scenario, I am sure the case is +$$ H \cdot H = H^2 = \begin{pmatrix} +\frac{\sqrt{2}}{2}&\frac{\sqrt{2}}{2} \\ +\frac{\sqrt{2}}{2}&\frac{-\sqrt{2}}{2} \\ +\end{pmatrix}. \begin{pmatrix} +\frac{\sqrt{2}}{2}&\frac{\sqrt{2}}{2} \\ +\frac{\sqrt{2}}{2}&\frac{-\sqrt{2}}{2} \\ +\end{pmatrix} = \begin{pmatrix} +1&0 \\ +0&1 \\ +\end{pmatrix} = I $$

+


with the second scenario, I am sure the case is +$$H \otimes H = H_2 = \begin{pmatrix} +\frac{\sqrt{2}}{2}&\frac{\sqrt{2}}{2} \\ +\frac{\sqrt{2}}{2}&\frac{-\sqrt{2}}{2} \\ +\end{pmatrix} \otimes \begin{pmatrix} +\frac{\sqrt{2}}{2}&\frac{\sqrt{2}}{2} \\ +\frac{\sqrt{2}}{2}&\frac{-\sqrt{2}}{2} \\ +\end{pmatrix} = \begin{pmatrix} +\frac{1}{2}&\frac{1}{2}&\frac{1}{2}&\frac{1}{2} \\ +\frac{1}{2}&\frac{-1}{2}&\frac{1}{2}&\frac{-1}{2} \\ +\frac{1}{2}&\frac{1}{2}&\frac{-1}{2}&\frac{-1}{2} \\ +\frac{1}{2}&\frac{-1}{2}&\frac{-1}{2}&\frac{1}{2} \\ +\end{pmatrix}$$

+

What seems to be the case with scenario 3 or what does the interconnection do to the qubits?

+
+

P.S I haven't noticed Hadamard gates in a circuit as in scenario 3 but have seen Pauli-X and Pauli-Z gates used in this manner, for example the magic-state-distillation on Quirk

+
+",8605,,8605,,7/5/2020 14:50,7/5/2020 14:50,Interconnection clarification?,,1,0,,,,CC BY-SA 4.0 +12792,2,,12791,7/5/2020 14:25,,2,,"

Scenario 3 does not make sense to me. You should provide a reference, if any.

+

I think you have been confused by controlled gates like CNOT, which is a Pauli-X gate applied to a target qubit, provided that the state of the control qubit is $|1\rangle$.

+",5551,,,,,7/5/2020 14:25,,,,7,,,,CC BY-SA 4.0 +12793,1,12799,,7/5/2020 15:47,,1,141,"

Couple of weeks ago I asked this question on theory CS but I didn't get an answer. So trying it here.

+

I was reading combinatorial approach towards quantum correction. A lot of work in this is on finding diagonal distance of a graph. Let me add definition of diagonal distance so that this remains self-contained.

+

Given a labeling $L$ (a map where each vertex is is assigned 1 or 0) we define two operations on this:

+
    +
  1. $X(v,L)$: you flip labeling of vertex v that is if it was zero make it 1 if it was 1 make it 0.

    +
  2. +
  3. $Z(v,L)$: you flip labeling of every neighbor of vertex v

    +
  4. +
+

Then diagonal distance is defined as length of minimal non-trivial sequence of operation so that $L$ is taken back to itself.

+

How is this exactly related to the quantum error correction property?

+",8132,,8132,,7/5/2020 15:52,8/5/2020 9:05,Quantum Error Correcting Codes and Graphs,,1,1,,,,CC BY-SA 4.0 +12795,2,,12790,7/5/2020 17:51,,5,,"

A (wonderful) discussion of this problem can be found in Nielsen and Chuang (Sec. 6.1.4 Performance). The number of marked elements is labelled $M$ below (instead of $k$ in your case) and the emphasis is mine.

+

tl;dr if you know $M \geq N/2$ then just randomly pick an item: this has a success probability at least one-half and only requires one call to the oracle. If it is not known whether $M \geq N/2$, then, double the search space (which can be done by adding a single qubit since $N = 2^n$, where $n$ is the number of qubits) with the new $N$ elements such that none of them are solutions to the search -- as a consequence, the number of marked elements is now less than $N/2$.

+

Here's the quoted section:

+
+

If $M$ is known in advance: What happens when more than half the items are solutions to the search problem, that is, $M \geq N/2$? +[...] the number of iterations needed by the search algorithm +increases with $M$, for $M \geq N/2$. Intuitively, this is a silly +property for a search algorithm to have: we expect that it should +become easier to find a solution to the problem as the number of +solutions increases. There are at least two ways around this problem. +If $M$ is known in advance to be larger than $N/2$ then we can just +randomly pick an item from the search space, and then check that it is +a solution using the oracle. This approach has a success probability +at least one-half, and only requires one consultation with the oracle. +It has the disadvantage that we may not know the number of solutions +$M$ in advance.

+

In the case where it isn’t known whether $M \geq N/2$, another approach can be used. [...] The idea is to double the number of +elements in the search space by adding $N$ extra items to the search +space, none of which are solutions. As a consequence, less than half +the items in the new search space are solutions. This is effected by +adding a single qubit $|q \rangle$ to the search index, doubling the +number of items to be searched to $2N$.

+
+",1108,,,,,7/5/2020 17:51,,,,2,,,,CC BY-SA 4.0 +12796,1,,,7/5/2020 20:20,,2,239,"

Next year, I will be a senior Computer Engineering student. Saying that, I have studied computer organization, electrical circuits, electronics and data structures.

+

Our university provides an opportunity to get a concentration on quantum computing.

+

So, my question is: +Are the subjects I mentioned helpful in learning about quantum computing? +Are there other prerequisites that may also be helpful?

+",12589,,55,,9/30/2020 3:53,9/30/2020 3:53,Are the skills learned for a degree in Computer Engineering helpful in learning Quantum Computing?,,1,4,,7/6/2020 11:56,,CC BY-SA 4.0 +12797,1,12801,,7/6/2020 5:17,,5,1172,"

I'm currently reading the paper Classification with Quantum Neural Networks on Near Term Processors

+

It shows a method to determine the following quantity:

+

+

Where U is a unitary operator acting on $|z,1\rangle$. The paper states the following: + +

+

I am wondering if there is a way to calculate any general inner product like $\langle z_2, 1|U|z, 1\rangle$ or just $\langle a | b \rangle $ in general? How could I modify the circuit to do so? (or is there a different methodology to calculate the inner product with different vectors?)

+",11644,,9006,,7/6/2020 6:28,7/6/2020 9:29,Quantum Circuit To Compute Any Inner Product,,1,1,,,,CC BY-SA 4.0 +12798,2,,12789,7/6/2020 8:01,,4,,"

I'm not sure that I agree with what is presented as the solution (although the final answer seems OK). Let me explain what I would do.

+

That task gives you 3 states $|A\rangle$, $|B\rangle$ and $|C\rangle$. You want a POVM that, for example, cannot give the answer "0" is the state was in $|A\rangle$, cannot give the answer "1" if the state was in $|B\rangle$ etc. So, the POVM elements are orthogonal to those states. So, let me write $|A^\perp\rangle$ where $\langle A|A^\perp\rangle=0$.

+

So, we will be defining POVM elements +$$ +E_0=\alpha_0|A^\perp\rangle\langle A^\perp|,\quad E_1=\alpha_1|B^\perp\rangle\langle B^\perp|,\quad E_2=\alpha_2|C^\perp\rangle\langle C^\perp|. +$$ +It might help to also have $E_3=I-E_0-E_1-E_2$. All these operators must be non-negative, and we want the $\alpha_i$ to be as large as possible. There's actually a certain symmetry here. If you set $\alpha_0=\alpha_1=\alpha_2$ then +$$ +E_3=I-\alpha\frac32 I, +$$ +so $E_3$ is non-negative if $\alpha\leq\frac23$, so we set $\alpha=\frac23$.

+

Now, how do we implement such a measurement. There need to be at least 3 measurement results, and since we're using qubits, the space needs to be $2^k\geq3$ dimensional, i.e. we'll pick $k=2$. This means we'll introduce one ancila, which we'll be able to assume is in a known, fixed state. For simplicity, let that be $|0\rangle$.

+

Now, remember that we want to find a unitary that's going to help us make the measurement. Indeed, each measurement result will have to correspond to an orthogonal state, such as $|00\rangle$, $|01\rangle $ and $|10\rangle$, and the unitary will need to map us to these states. But unitaries map orthogonal states to orthogonal states and our states $|A^\perp\rangle|0\rangle$, $|B^\perp\rangle|0\rangle$ and $|C^\perp\rangle|0\rangle$ are not orthogonal to each other. What we need to do is find components such as $|\tilde A\rangle$ below: +$$ +|\psi_0\rangle=\sqrt\alpha_0|A^\perp\rangle|0\rangle+\sqrt{1-\alpha_0}|\tilde A\rangle|1\rangle +$$ +such that all three states are orthogonal.

+

With this in mind, we can start to specify $U$: +$$ +U=|00\rangle\langle\psi_0|+|01\rangle\langle\psi_1|+|10\rangle\langle\psi_2|+|11\rangle\langle\psi_3|, +$$ +and so we already know some of the elements: +$$ +U=\frac{1}{\sqrt{3}}\left(\begin{array}{cc} +1 & -1 & ? & ? \\ +1 & -\omega^2 & ? &?\\ +1 & -\omega & ? &?\\ +0 & 0 & ? & ? +\end{array}\right) +$$ +You then just have to complete this matrix, however you like, subject to the orthogonality and normalisation conditions of the rows. I'd start by completing the top row with 1,0, at which point everything else falls into place: +$$ +U=\frac{1}{\sqrt{3}}\left(\begin{array}{cc} +1 & -1 & 1 & 0 \\ +1 & -\omega^2 & \omega &0\\ +1 & -\omega & \omega^2 &0\\ +0 & 0 & 0 & \sqrt3 +\end{array}\right) +$$ +You can put any phase you like on the bottom-right element, such as $-i$. Which one you want will basically be determined by whatever is easiest to implement with a circuit.

+",1837,,8757,,7/6/2020 8:39,7/6/2020 8:39,,,,1,,,,CC BY-SA 4.0 +12799,2,,12793,7/6/2020 8:16,,1,,"

The distance of an error correcting code is the smallest number of single-qubit rotations that you have to apply to map one logical codeword into an orthogonal one. If I express it in terms of the stabilizers of the code, it's the smallest tensor product of single-qubit unitaries (usually Paulis) that commutes with all the generators.

+

Let's see how this connects to a graph state description. Usually a graph state has stabilizers defined as $X$ on a vertex, and $Z$ on all the neighbouring vertices. So, imagine that I store as a 0 or 1 on a give vertex whether the current tensor product of Pauli errors commutes with that stabilizer or not. If I apply an $X$ on that vertex, or a $Z$ on any of the neighbouring vertices, it flips whether the tensor product commutes or anti-commutes, so I simply flip the 0/1 value on the vertex. When all stabilizers commute, we've implemented a logical error or something that is a product of the stabilizers. So long as you eliminate the possibility that it is a product of stabilizers (probably what is meant by 'non-trivial'), you've found a logical error. Then you're just after the shortest such sequence.

+",1837,,,,,7/6/2020 8:16,,,,0,,,,CC BY-SA 4.0 +12800,2,,12779,7/6/2020 8:23,,5,,"

First of all, I think there is a little mistake in the way you define psi. Indeed, you first create it as a 3-qubits circuit and then "erase" this by doing psi = state_fns.CircuitStateFn(circuit), meaning it will be exactly the same as the operator you defined right before, op. You can check the circuit you create via an operator using for example psi.primitive.draw() if you want to see! This is why your code worked for psi but not for psi2.

+

Then, Qiskit won't do the composition of operators that don't have the same size because it is not mathematically possible with matrices. May I suggest adding a third qubit on op without adding any gates on it, this way op will have the same size as psi and psi2 and your code will run without errors since all the operators will have the same size!
+I hope this will help you :)

+",12396,,,,,7/6/2020 8:23,,,,0,,,,CC BY-SA 4.0 +12801,2,,12797,7/6/2020 9:29,,8,,"

We can use the SWAP test to determine the inner product of 2 states $|\phi\rangle$ and $|\psi\rangle$. The circuit is shown below

+

The state of the system at the beginning of the protocol is $|0\rangle \otimes |\phi \rangle \otimes |\psi \rangle$. After the Hadamard gate, the state of the system is $|+\rangle \otimes |\phi \rangle \otimes |\psi \rangle$.

+

The controlled SWAP gate transforms the state into $\frac{1}{\sqrt {2}}|0\rangle \otimes |\phi \rangle \otimes |\psi \rangle + |1\rangle \otimes |\psi \rangle \otimes |\phi \rangle$.

+

The second Hadamard gate results in +$$\frac {1}{2}(|0\rangle|\phi\rangle|\psi\rangle +|1\rangle|\phi\rangle|\psi\rangle +|0\rangle|\psi\rangle|\phi\rangle -|1\rangle|\psi\rangle|\phi\rangle ) \\ +=\frac {1}{2}|0\rangle (|\phi\rangle|\psi\rangle +|\psi\rangle|\phi\rangle)+ \frac{1}{2}|1\rangle(|\phi\rangle|\psi\rangle -|\psi\rangle|\phi \rangle)$$

+

The Measurement gate on the first qubit ensures that it's 0 with a probability of +$P(\text{First qubit}=0)=\frac {1}{2}\Big(\langle\phi|\langle\psi| + \langle\psi|\langle\phi|\Big ) \frac {1}{2}\Big (|\phi\rangle|\psi\rangle + |\psi\rangle |\phi\rangle \Big )=\frac {1}{2}+\frac {1}{2}|\langle\psi|\phi\rangle|^{2}$ when measured.

+

The downside of this test is that the qubits cannot be recovered to the same state as before. Hence $|\psi\rangle,|\phi\rangle|$ must be prepared multiple times independently in order to get a good probability estimate and hence the value of inner product.

+",8757,,,,,7/6/2020 9:29,,,,0,,,,CC BY-SA 4.0 +12802,2,,12796,7/6/2020 9:51,,3,,"

For quantum computing you will need some bases in linear algebra and probability theory. This book has pretty much everything you need to know about quantum information, and it covers the bases you need to understand the field, i.e. chapter 2 Introduction to quantum mechanics is about Linear Algebra and there is also a little bit of proba theory on the appendix 1. The Qiskit textbook also gives you a good view of the background you need by doing examples at the same time.

+

If you need something else feel free to ask! :)

+",12396,,8623,,7/6/2020 17:33,7/6/2020 17:33,,,,0,,,,CC BY-SA 4.0 +12803,1,,,7/6/2020 16:40,,4,439,"

I have a quantum state on $ n $ qubits ($ 2^n $ amplitudes) for which I know the amplitudes are real numbers. I want to take the state out as a vector. I can estimate the magnitude of the amplitudes by doing some measurements and taking the square root of the probabilities, but I loose the sign information.

+

What kind of measurements do I need to make to recover the sign information? I read a little about state tomography, but it looks really unpractical for $n>2$ (my scale is $n > 10$). Is there an easier way?

+",7759,,55,,9/30/2020 3:53,9/30/2020 3:53,How to measure the sign of quantum amplitudes,,2,0,,,,CC BY-SA 4.0 +12804,2,,12803,7/6/2020 20:48,,5,,"

An empirical solution could be to use the Grover's Diffusion Operator $D$.

+

Lets say the qubits are in an initial state $|\psi\rangle = \sum_{0}^{2^n-1}\alpha_i|i\rangle$. Since global phase/sign is irrelevant. We can assume that phase/sign of $\alpha_0$ is + for the sake of convenience (If $\alpha_0=0$ choose the lowest index with non-zero amplitude).
+We can find the constants $|\alpha_i|\forall i$ by taking square roots of probabilities and hence we can assume their knowledge.

+

Grover's Diffusion Operator maps $|\psi\rangle = \sum_{0}^{2^n-1}\alpha_i|i\rangle$ to $D|\psi\rangle = \sum_{0}^{2^n-1}(2\mu-\alpha_i)|i\rangle$ where $\mu = \sum_{0}^{2^n-1}\alpha_i$. We can find the probability distribution of this state and let us say we now also have knowledge of $|2\mu-\alpha_i| \forall i$

+

Using values of $|\alpha_i|$ and $|2\mu-\alpha_i|$ we get 4 possible values of +$\mu = \frac{\pm|\alpha_i| \pm|2\mu-\alpha_i|}{2}$.

+

Remember we have $2^n$ values of $i$ each which can give us a group of $4$ possible values of $\mu$. We find the common value of $\mu$ across all these $2^n$ groups of $4$.

+

Since we assumed $\alpha_0>0$ we only get 2 possible values of $\mu = \frac{|\alpha_i| \pm|2\mu-\alpha_i|}{2}$ So at max there can only be $2$ values of $\mu$. +Hopefully we have narrowed down to a single value of $\mu\ne0$. If we have then we can use it to easily calculated $\alpha_i$ from $|\alpha_i|$ and $|2\mu-\alpha_i|$ thus giving us the sign information for all $i$.

+

If $\mu=0$ or there are $2$ possible $\mu$ then we must modify the original state. A possible solution is too selectively flip the sign (using $Controlled$ $Z$ gates) if and only if the state is $|j\rangle$ for some $j$ which has an amplitude $\alpha_j\ne0$.
+This will result in a new $\mu'$ which cannot be zero if $\mu=0$. Applying same procedure on this state will yield 1/2 value(s) which can be used to deduce original $\mu$. Since $Z$ gate only changes sign but not magnitude of amplitude the probability distributions will remain same.

+

I know this isn't a complete formal solution but hopefully it helps.

+",8757,,8757,,7/7/2020 0:06,7/7/2020 0:06,,,,2,,,,CC BY-SA 4.0 +12805,1,,,7/6/2020 22:44,,1,48,"

I would like to better understand some passages in a paper (Appendix A):

+

Properties of Tensor Product

+
    +
  • Bilinearity: $A\otimes(B+ C) = A \otimes B + A \otimes C $
  • +
  • Mixed-product property: $(A\otimes B)(C \otimes D) = AC \otimes BD$
  • +
  • $ (|a\rangle \otimes|b\rangle) (\langle c| \otimes \langle d|) = |a\rangle \langle c| \otimes |b\rangle \langle d| $
  • +
+

For a unitary $U_p |0\rangle |0\rangle \mapsto \sum_{j=1}^{n}\sqrt{p_{j}}|\phi_{j}\rangle|j\rangle $, we have a matrix $A$ defined as such:

+

$$A = \Pi U\widetilde{\Pi}=\Pi\left(U_p\otimes I\right)\widetilde{\Pi}=\Big(\sum_{i=1}^{n}I\otimes|i\rangle\langle i|\otimes |i\rangle\langle i| \Big)(U_{p}\otimes I)\big(|0\rangle\langle 0|\otimes |0 \rangle\langle 0|\otimes I\big) $$

+

We used the mixed-product property

+

$$=\sum_{i=1}^{n}\Big((I\otimes |i \rangle \langle i|)U_{p}(|0 \rangle \langle 0|\otimes |0 \rangle \langle 0|)\Big)\otimes |i \rangle \langle i| $$

+

Here we applied the definition of $U_p$.

+

$$=\sum_{i=1}^{n}\Big((I\otimes |i \rangle \langle i|)\sum_{j=1}^{n}\sqrt{p_{j}}|\phi_{j}\rangle|j\rangle\langle 0| \langle 0|\Big)\otimes |i \rangle \langle i| $$

+

My steps are: +$$=\sum_{i=1}^{n}\Big((I\otimes |i \rangle \langle i|)\sum_{j=1}^{n}\sqrt{p_{j}}|\phi_{j}\rangle \langle 0| \otimes |j\rangle\langle 0|\Big)\otimes |i \rangle \langle i| $$

+

Because of the third property (name?)

+

$$=\sum_{i=1}^{n}\left((I\otimes |i \rangle \langle i|) \left( \sum_{j=1}^{n}\sqrt{p_{j}}|\phi_{j}\rangle \langle 0| \otimes |j\rangle\langle 0|\right)\right)\otimes |i \rangle \langle i| $$

+

Because of associativity property of matrix product

+

$$=\sum_{i=1}^{n}\left((I\otimes |i \rangle \langle i|) \left( \sum_{j=1}^{n}\sqrt{p_{j}}|\phi_{j}\rangle \langle 0| \otimes |j\rangle\langle 0|\right)\right)\otimes |i \rangle \langle i| $$

+

$$=\sum_{i=1}^{n}\left((\sum_{j=1}^{n}\sqrt{p_{j}}|\phi_{j}\rangle \langle 0| \otimes |i \rangle \langle i| |j\rangle\langle 0|)\right)\otimes |i \rangle \langle i| $$

+

As $\langle i | j \rangle = \delta_{ij}$, the final result is:

+

$$=\sum_{i=1}^{n}\sqrt{p_i}|\phi_i \rangle \langle 0|\otimes |i \rangle \langle 0|\otimes |i \rangle \langle i|.$$

+

Can you check that my answer is indeed correct and I have made explicit all the properties of the operations that are used in these passages? I think passages are correct, and there are no other properties that I have used.

+

Thanks!

+",10062,,55,,7/7/2020 12:50,7/7/2020 12:50,Step-by-step passages in calculation,,0,1,,,,CC BY-SA 4.0 +12806,2,,12788,7/6/2020 22:56,,2,,"

It is incorrect to say that the time of simulation is $T O(\log N s^2t)$ +(it's also better written as $O(T\log N s^2t)$). +Conceptually, the simulation time ends at $O(\log N s^2t)$. If you want to consider the phase estimation, that's another (more complex) unitary, which includes hamiltonian simulation. If you were to think this in terms of function composition, +let $U=g(H,t,initial\_state,)$ be the function that performs hamiltonian simulation, and $f(U, args*)$ be the phase estimation subroutine, which takes as input a unitary (and the input to create the unitary, which in this case are the input of $g$, an hypotetical function (which you can imagine written in a quantum programming language) that builds the unitary for hamiltonian simulation U.

+

The reason there is no time dependence in the runtime is because they implicitely set $t=1$ and perform a time-indepentent Hamiltonian simulation. The other paper performs a time dependent simulation.

+",1644,,,,,7/6/2020 22:56,,,,4,,,,CC BY-SA 4.0 +12807,1,,,7/7/2020 6:35,,2,328,"

How do I prepare a quantum circuit for $\frac{1}{\sqrt{3}}(|00\rangle+|01\rangle+|10\rangle)$ state starting from the $|00\rangle$ state?

+

I have no clue how to do it. I tried with controlled Hadamard gate but of no use here. Can someone help? +Furthermore, can it be constructed with only one CNOT and any number of single-qubit gates?

+",12599,,55,,7/14/2020 6:54,7/14/2020 6:54,How to prepare a quantum circuit for $\frac{1}{\sqrt{3}}(|00\rangle+|01\rangle+|10\rangle)$ starting from $|00\rangle$,,1,1,,,,CC BY-SA 4.0 +12808,2,,12807,7/7/2020 7:00,,6,,"

Step 1: Find the Schmidt decomposition $|\psi\rangle=\sum_i\alpha_i|u_i\rangle|v_i\rangle$. I won't do this completely here, but +$$ +\alpha_0=\sqrt{\frac{3+\sqrt{5}}{6}},\qquad |u_0\rangle=|v_0\rangle=\frac{1}{\sqrt{10-2\sqrt{5}}}(2|0\rangle+(\sqrt{5}-1)|1\rangle) +$$ +should be enough to confirm you're going in the right direction.

+

Step 2: Express this as $(U_A\otimes U_B)(\alpha_0|00\rangle+\alpha_1|11\rangle)$.

+

Step 3: Write down the circuit. First apply $U|0\rangle\rightarrow \alpha_0|0\rangle+\alpha_1|1\rangle$ on the first qubit. Then apply $CNOT$ gate with first qubit as control and second qubit as target. Then apply $U_A\otimes U_B$.

+",1837,,8757,,7/7/2020 23:02,7/7/2020 23:02,,,,0,,,,CC BY-SA 4.0 +12809,2,,12803,7/7/2020 12:33,,2,,"

Being restricted to real amplitudes means that you don't need to go for full on tomography. If you were looking at a single qubit, for example, to do full tomography with projective measurements, you'd need to make $X$, $Y$ and $Z$ measurements, while for the real-only version, you'd only need to make $X$ and $Z$ measurements.

+

The question, then, is what's a good tactic? It's not something I've thought/read about previously. Here's a couple of options depending on how complex you want to make your experiment:

+
    +
  • Hadamard every qubit and repeat your amplitude determination step. The results should be sufficient to reverse engineer the signs, it's "just" a classical computation (I make no promises that it's an easy computation).

    +
  • +
  • Assume the weights are $\alpha_i^2$, and that these are ordered. Apply a measurement with projectors onto states $(|2n\rangle\pm|2n+1\rangle)/\sqrt{2}$. Since $\alpha_{2n}^2\approx\alpha_{2n+1}$, it shouldn't take many measurements (relatively!) to determine the relative signs of the amplitudes $\alpha_{2n},\alpha_{2n+1}$. Repeat using projectors onto states $(|2n\rangle\pm|2n-1\rangle)/\sqrt{2}$ and that's enough to globally reconstruct the phases.

    +
  • +
  • I wonder if there's a smarter method, similar to the previous one, but incorporating a "divide and conquer" strategy where you group the amplitudes into two sets with total weights as close to 1/2 as possible. But I don't immediately see it...

    +
  • +
  • the answer of user1294287 looks plausible (aside from some normalisation issues), although I wonder what accuracy one has to achieve.

    +
  • +
+",1837,,,,,7/7/2020 12:33,,,,0,,,,CC BY-SA 4.0 +12811,2,,12786,7/7/2020 13:26,,1,,"

The waveplates can be understood in terms of polarisation, but the change that they implement is independent of what polarisation the photon is in. It is simply "if the photon passes through this waveplate, x happens to it" where x might be "apply phase $e^{i\pi}$".

+

Because there are two different paths, and you put a waveplate on a single path, the net effect is "if the photon traveled down that path, do x to it". Hence, it affects the position component.

+",1837,,91,,8/7/2020 9:40,8/7/2020 9:40,,,,0,,,,CC BY-SA 4.0 +12812,1,,,7/7/2020 14:24,,0,76,"

In classical cryptography, security proofs are often based on the (assumed) computational hardness of some mathematical problem. Using the principles of quantum mechanics might provide means to design cryptographic protocols for which it is impossible to realise them classically (information-theoretically) securely. But is there also a notion of computational security in quantum cryptography (assuming a polynomial-time quantum adversary) where fully quantum information is being processed to begin with? Why does or doesn't this notion of security make sense?

+",11977,,11977,,7/8/2020 9:22,7/8/2020 9:22,Is there a notion of “computational security” in quantum cryptography?,,2,0,,,,CC BY-SA 4.0 +12813,2,,12812,7/7/2020 14:58,,1,,"

There absolutely is. In fact, even in classical, there is the notion of computational security against polynomial time quantum adversaries. This is the whole point of post-quantum cryptography. This would let us keep using existing, classical, technology, but hopefully be secure against quantum-powered eavesdropping.

+",1837,,,,,7/7/2020 14:58,,,,3,,,,CC BY-SA 4.0 +12814,2,,12812,7/7/2020 15:01,,0,,"

You are confusing two different things:

+
    +
  • Quantum cryptography protocols that cannot be implemented classically, and having nothing to do with computational security;

    +
  • +
  • Mathematical problems that can be solved both quantumly and classically, and here you can consider the computational security of algorithms.

    +
  • +
+",2105,,,,,7/7/2020 15:01,,,,1,,,,CC BY-SA 4.0 +12815,1,,,7/7/2020 19:08,,4,293,"

A quantum computer can be modeled as a single unitary transition of a (large) effective quantum state to another. In order to get errors under control, quantum error correction is assumed. A logical qbit lives in a "logical heat bath" which must have an effective entropy and temperature far below that of the ambient world in order for the error rate of the computation to be below unity.

+

Thus it should be possible to compute the energy cost of any quantum computation as the entropy difference between the required effective "logical heat bath" and the ambient environment. As entropy scales as $$dS = \frac{dQ}{T_A} - \frac{dQ}{T_B},$$ this would imply that an arbitrarily long/large calculation requires zero temperature and an infinite amount of energy, in apparent contradiction with the quantum threshold theorem. Such an energy cost would apply to classical calculations as well.

+

Is there an error in my reasoning? If not, has anyone published actual calculations of the required energy to perform a computation of a given size or have a formula for the entropy of the needed heat bath that satisfies the threshold theorem? This would seem to imply that cryptographically relevant computations like Shor's algorithm will never be practical on energy grounds. The required precision on the logical state is exponential in the number of bits, and the corresponding requirement on the heat bath should be also.

+",12609,,,,,7/8/2020 7:43,Energy cost of quantum computation,,1,4,,,,CC BY-SA 4.0 +12817,2,,12785,7/7/2020 21:20,,7,,"

If it were as easy as cutting slits into metal foil, or even doing photolithography at the sub-10nm regime, then it would have been done by now, but that might not be a satisfactory answer. It's a good question and should not be dismissed.

+

The question is similar to "what is stopping us from achieving a computational speedup by running Shor's algorithm by merely cutting a bunch of slits into a metal foil, and looking at the interference patterns when light is shown through?" .

+

Indeed, Shor has referred to Shor's algorithm as a "computational interferometer." For example, one thing that quantum computers can do, and that diffraction gratings can do, is perform Fourier transforms on large data sets.

+

But diffraction gratings don't have much in the way of adaptive control, and you have to spend exponential resources before-hand in order to leverage the constructive and destructive interference of the photons.

+

For example, you could cut slits in your foil in a manner where the spacing is $a^x\bmod N$. Shining light through such a diffraction grating, even a single photon of light, will perform the quantum Fourier transform.

+

However, in this case you had to cut your diffraction grating a-priori into $a^x\bmod N$; that is, you had to perform an exponential number of cuts in the first place.

+

It's not clear how such non-adaptivity is still powerful enough to solve Shor's algorithm, or whether you would always need to pre-cut your grating with an exponential number of cuts in the first place.

+",2927,,2927,,7/7/2020 22:31,7/7/2020 22:31,,,,1,,,,CC BY-SA 4.0 +12818,2,,12572,7/7/2020 21:24,,0,,"

There is currently an Issue (#291) raised on the Microsoft QuantumLibraries GitHub regarding an operation called ApplyUnitaryOperation(unitary: Complex[][], qubits : LittleEndian) which aims to do what you are asking. This functionality doesn't exist right now but it was also discussed on the Q# Community Gitter a while ago. Hopefully it will be added as a feature in the future.

+",8757,,,,,7/7/2020 21:24,,,,0,,,,CC BY-SA 4.0 +12819,2,,12630,7/7/2020 21:43,,0,,"

This task can be done using Microsoft Q#

+

If you have two qubits which after quantum operations are in the state $|\psi\rangle$, +and you wish to find the state of the qubit q0 before/without measurement, You can use +Q#'s DumpRegister function which will print to the console the state of your qubits.

+

The output would look something like this

+
# wave function for qubits with ids (least to most significant): 0
+∣0❭:     1.000000 +  0.000000 i  ==     ******************** [ 1.000000 ]     --- [  0.00000 rad ]
+∣1❭:     0.000000 +  0.000000 i  ==                          [ 0.000000 ]    
+
+

If you choose to Measure the qubit q0 then its state collapses to the result of your measurement.

+",8757,,2879,,3/4/2021 17:13,3/4/2021 17:13,,,,0,,,,CC BY-SA 4.0 +12821,1,,,7/8/2020 1:11,,1,93,"

If a quantum system is described to be only in Quantum states $s_1$ and $s_2$ (described by computational basis $\vert {0} \rangle$ and $\vert {1}\rangle$) or a combination of both (for a qubit system for example), should not all the operators, which we interpret as representations of measurable properties of the system, be only diagonal matrices? What happens if we have an operator whose basis is not the computational basis?

+

If we measure a property of the quantum system (operator O) and measure an eigenvalue for an eigenvector which is not associated to $s_1$ nor $s_2$, but an eigenvector which is a linear combination of both, does this mean the quantum state collapsed to such eigenstate? Would not that be contradictory to the fact that the only observed states from the Quantum System are $s_1$ and $s_2$?

+",12302,,8623,,7/8/2020 2:45,7/8/2020 9:49,Correct interpretation of a Quantum State,,1,6,,,,CC BY-SA 4.0 +12822,1,12823,,7/8/2020 4:04,,4,1074,"

I am trying to understand how the reset gate in Qiskit affects qubits its entangled with. Consider the following circuit with qubits $q_0$ and $q_1$:

+

+

Where circuit240 takes $|0\rangle$ to $a|0\rangle + b|1\rangle$ and circuit 244 takes $|0\rangle$ to $c|0\rangle + d|1\rangle$. Right before the reset gate on qubit $q_1$ the state of this circuit is $$\frac{1}{\sqrt{2}}(c|1\rangle + d|0\rangle)|0\rangle + \frac{1}{\sqrt{2}}(a|1\rangle + b|0\rangle)|1\rangle \tag{1}$$

+

I'm not quite sure how to mathematically represent what this quantum reset gate does to the quantum entangled state. For example, I tried a few tests with this circuit where I played with the values $a$ and $c$ and tested how the quantum reset gate affects the measurement of the qubit $q_0$. It seems that whether or not the quantum reset gate is added, it doesn't affect the measurements of the other entangled qubit. Does this generally hold?

+

Furthermore, when I take the qubit expression above and just reset qubit $q_1$to $|0\rangle$ I get the following:

+

$$\frac{1}{\sqrt{2}}(c|1\rangle + d|0\rangle)|0\rangle + \frac{1}{\sqrt{2}}(a|1\rangle + b|0\rangle)|0\rangle \tag{2}$$

+

$$= \frac{1}{\sqrt{2}}((a + c)|1\rangle + (b + d)|0\rangle)|0\rangle \tag{3}$$

+

But, mathematically, the probability of measuring $q_0$ as $|0\rangle$ in $(3)$ is not the same as the probability in qubit expression $(1)$(even though the tests show that removing the reset gate did not change the probability of measuring a $|0\rangle$ in the qubit $q_0$. What is the correct way to represent what the qubit reset gate does to an entangled qubit?

+",11644,,55,,7/14/2020 16:54,4/27/2022 12:34,Question About How Qiskit Reset Gate Affects Other Entangled Qubits,,2,0,,,,CC BY-SA 4.0 +12823,2,,12822,7/8/2020 4:24,,3,,"

A reset gate is equivalent to a swap gate between the target qubit and a new ancilla qubit in the $|0\rangle$ state. So you can replace your question with "how does swapping a qubit Q with an fresh ancilla qubit affect the qubits Q is entangled with?" or "how does discarding Q affect the qubits Q is entangled with". And the answer is that, for all intents and purposes, it doesn't affect them at all.

+

There is no test you can do on the qubits entangled with Q that can determined whether or not Q was discarded, or whether or not Q was swapped for a fresh ancilla qubit. Therefore there is no test you can do on the qubits entangled with Q (that don't involve measuring Q's value) whose outcome depends on whether or not Q was reset.

+",119,,,,,7/8/2020 4:24,,,,6,,,,CC BY-SA 4.0 +12825,1,12830,,7/8/2020 6:50,,0,63,"

I have a mixed state with a density matrices corresponding to $\rho=\sum_0^{2^n-1}p_i|i\rangle\langle i|$. How would i represent this in Q#? How would I go about applying Unitary Operations $U$ on this mixed state in Q#?

+",8757,,55,,7/14/2020 16:52,7/14/2020 16:52,How can I represent mixed states in Q#?,,1,0,,,,CC BY-SA 4.0 +12826,2,,12815,7/8/2020 7:06,,2,,"

Quantum computation is a (reversible) unitary transformation and theoretically it does not require energy to perform, at all. In other words, the theoretical energy cost of quantum computation is zero.

+

Theoretically, the energy is needed to erase information (see Landauer's principle), but unitary transformations do not erase information.

+",2105,,2105,,7/8/2020 7:43,7/8/2020 7:43,,,,2,,,,CC BY-SA 4.0 +12827,2,,12821,7/8/2020 7:49,,1,,"

You seem to be referring specifically to measurement operators ("operator" without qualification also refers to unitary operators, which evolve the system). In the case of projective measurements, the measurement operator decomposes into a set of projection operators, say $M = \sum m \, P_m$, where $m$ is an eigenvalue of $M$ and $P_m$ is a projection operator (POVM is slightly more complicated, but conceptually similar).

+

The projection operator $P_m$ projects every vector in the relevant vector space into the eigenspace associated with $m$. So if the state vector, say $\vert \psi \rangle$, is an eigenvector of $M$ associated with the eigenvalue $k$, then the probabilities of the measurement will be $p(m=k)=1$ and $p(m \ne k)=0$.

+

For the general case when $\vert \psi \rangle$ is not necessarily an eigenvector of $M$, then +$$p(m)=\langle \psi \vert P_m \vert \psi \rangle = \sum P_{m,ij} \, \psi_i^\ast \psi_j.$$ +So each $P_m$ is playing the role of an Hermitian form (the complex version of a quadratic form) that gives the probability of the measurement observing $\vert \psi \rangle$ in the $P_m$ eigenspace.

+

The $P_m$ are always complete, $\sum P_m = I$, positive semi-definite, and, in this case (projective measurements), also orthogonal, $P_i \, P_j = \delta_{ij} P_i$. Two $M$'s with distinct eigenspaces are simply measuring $\vert \psi \rangle$ over distinct bases that are related by some coordinate transform.

+

If $M$ is diagonal, the $P_m$ are permutations of $\text{diag}(1,0,...,0)$. This makes the calculations easy, but it's certainly not necessary for a valid measurement operator.

+",8623,,8623,,7/8/2020 9:49,7/8/2020 9:49,,,,0,,,,CC BY-SA 4.0 +12828,1,12829,,7/8/2020 11:44,,2,88,"

I've been trying to figure out the extra functionality available to IBM Q Network members that are not available to normal IBM Q Experience users.

+

I couldn't find anything that says that Network members have access to better quantum processors or perhaps access to functionality within the Qiskit library that isn't available to Experience users.

+

Could someone please list all the benefits of having Network membership?

+",12248,,55,,7/14/2020 16:52,7/14/2020 16:52,What extra functionality is available to an IBM Q Network member over a regular IBM Q Experience user,,1,0,,,,CC BY-SA 4.0 +12829,2,,12828,7/8/2020 12:58,,5,,"

Basically being IBM Q Network member give you the possibility to access IBM’s most-powerful quantum computing systems through the cloud (currently 20Q, 27Q, 28Q, 53Q devices with Quantum Volume between 8 and 32 depending the device). Some of the premium devices are visible in this post: https://www.ibm.com/blogs/research/2020/07/qv32-performance/ +Depending on your engagement you also have access to different levels of collaboration from simple support to joint development. +No special qiskit library for IBM Q Network but special content/documentation and education materials. +Note that between the common user and the IBM Q Network member there is also a new way to engage for academic researchers: https://www.ibm.com/blogs/research/2020/07/quantum-researcher-program/

+",7853,,8757,,7/8/2020 13:51,7/8/2020 13:51,,,,0,,,,CC BY-SA 4.0 +12830,2,,12825,7/8/2020 15:05,,4,,"

It can be helpful to step back and look at what a density matrix describes: a probability distribution over projectors onto pure states. In your example, for instance, $\rho$ represents a distribution in which $|\psi\rangle = |i\rangle$ with probability $p_i$. That is, a density operator describes a probability over an ensemble of state vectors.

+

From that perspective, we easily write pseudocode for a quantum program that prepares $\rho = \sum_i p_i |\psi_i\rangle\langle\psi_i|$:

+
    +
  • Draw a random $i$ with probability $p_i$.
  • +
  • Prepare the pure state $|\psi_i\rangle$.
  • +
+

Thinking of state vectors like $|\psi_i\rangle$ as quantum programs that prepare those states, this is already a complete description of how to prepare $\rho$. You can, for instance, use the PrepareArbitraryState operation to prepare each $|\psi_i\rangle$ on a freshly allocated register of qubits.

+

In practice, however, you'll often have a much more efficient implementation of the state preparation programs for each $|\psi_i\rangle$. For example, there's no need to use PrepareArbitraryState operation to prepare $|+\rangle$, as the H operation does just fine.

+

This is, for instance, how the PrepareSingleQubitIdentity operation prepares the particular mixed state $\rho = 𝟙 / 2$ on a single qubit.

+",1978,,,,,7/8/2020 15:05,,,,0,,,,CC BY-SA 4.0 +12831,1,12832,,7/8/2020 15:58,,3,280,"

I have a few questions about measurement in Bell-state basis. In particular, if $Z = \begin{bmatrix} +1 & 0\\ +0 & -1 +\end{bmatrix}$ +is for a measurement on the computational basis, then what is the representative matrix for a measurement in Bell-state basis.

+

I know that such a matrix can be constructed using spectral decomposition, but my Professor says the eigenvalues corresponding to 4 Bell-states remain unknown, so basically there is currently no physical quantity that helps on this kind of measurement.

+

However, Nielsen and Chuang (p.27) give a circuit for teleportation (basically Bell-basis measurement)

+

+

I wondered if $U^\dagger (Z\otimes Z)U$, where $U = (H\otimes I)CNOT$, is the needed matrix. It turns out that its eigenvectors are not Bell states. Can someone explain where I'm wrong here?

+",7648,,491,,7/17/2020 23:23,7/17/2020 23:23,What is the representative matrix for a measurement in the Bell-state basis?,,1,0,,,,CC BY-SA 4.0 +12832,2,,12831,7/8/2020 16:41,,3,,"

I think your reasoning is just fine and I checked that the Bell states are indeed eigenvectors of $$M=U^\dagger(Z\otimes Z)U,$$ as +$$\begin{align} +M|\phi^+\rangle =& \phantom{{}-{}}|\phi^+\rangle,\\ +M|\phi^-\rangle =& -|\phi^-\rangle,\\ +M|\psi^+\rangle =& -|\psi^+\rangle,\\ +\text{and } M|\psi^-\rangle =& \phantom{{}-{}}|\psi^-\rangle +\end{align}.$$ +I like to see it this way: +The matrix that you assign to a measurement depends on what measurement results you assign to a certain outcome state. +For the measurement in the computational basis $\{|0\rangle, |1\rangle\}$ you are assigning $1$ to the $|0\rangle$ outcome +and $-1$ to the $|1\rangle$ outcome. That's why you say that, using the spectral decomposition, $$1 |0\rangle \langle 0| + (-1) |1\rangle \langle 1| = Z$$ is the corresponding matrix.

+

Now you can do the same with the Bell basis, e.g. $$1 |\phi^+\rangle\langle\phi^+| + 1 |\psi^+\rangle\langle\psi^+| + (-1) |\phi^-\rangle\langle\phi^-| + (-1) |\psi^-\rangle\langle\psi^-|.$$ +This is quite arbitrary, of course. You are free to choose the values that you assign to each outcome. Typically they would be $\pm 1$, but really you can assign any number (in the broadest sense) to it.

+",104,,104,,7/8/2020 16:52,7/8/2020 16:52,,,,3,,,,CC BY-SA 4.0 +12833,1,12834,,7/8/2020 17:34,,0,60,"

Part three (going by N&C page 544) states that +$$tr(S(n)\rho^{\otimes n})=tr(S(n)\rho^{\otimes n}P(n,\epsilon))+tr(S(n)\rho^{\otimes n}(I-P(n,\epsilon))).$$ +Now I understand how the term on the left of + goes to 0 as n $\to \infty$. However, I am confused how the term on the right does. N&I states that you can set +$$0 \le tr(S(n)\rho^{\otimes n}(I-P(n,\epsilon))) \le tr(\rho^{\otimes n}(I-P(n,\epsilon))) \rightarrow 0\,\,\text{ as } n\to \infty.$$

+

I don't quite understand why this is the case. My only assumption is that the eigenvalues of $\rho^{\otimes n}(I-P(n,\epsilon))$ are bounded in such a way that as $n \to \infty$ it will go to zero. However, I am unsure how to go about calculating this bound, though I assume it is of a similar form to the eigenvalues of $\rho^{\otimes n}P(n,\epsilon)), 2^{-n(S(\rho)-\epsilon)}$

+",4991,,55,,9/30/2020 3:53,9/30/2020 3:53,Question regarding part of the proof for the typical subspace theorem,,1,0,,,,CC BY-SA 4.0 +12834,2,,12833,7/8/2020 18:23,,2,,"

By part 1, we have that for any $\delta > 0$, then for sufficiently large $n$, $tr( \rho ^ {\otimes n} P(n, \epsilon)) \geq 1 - \delta$.

+

This means that $tr( \rho ^ {\otimes n} P(n, \epsilon)) \rightarrow 1$ as $n \rightarrow \infty$, since it is at most 1.

+",9626,,,,,7/8/2020 18:23,,,,1,,,,CC BY-SA 4.0 +12835,1,,,7/8/2020 18:39,,0,61,"

For example, some introductory resource I was reading years ago (forget which one) brought up such an attempt: imagine if a qbit wasn't a complex state vector which collapses probabilistically on measurement, but rather functioned as a tiny "coin" as follows (forgive the crude drawing):

+

+

As far as I can recall, whenever the qbit goes through a quantum gate the coin is rotated some amount, then when "measuring" the qbit you basically just look from the perspective of the basis you're measuring (say the |0>/|1> basis) and the result you see is whichever side of the coin is facing that basis (in the diagram, heads). Honestly I think I got half the details wrong on this, but it was something like that.

+

This was entertaining to learn about, so does anyone know of a good collection of such half-baked (or full-baked) attempts at de-probability-izing quantum mechanics? Bonus if it actually includes this coin example.

+",4153,,,,,7/9/2020 4:33,"Are there any resources of lists of attempts at non-probabilistic models of quantum mechanics, with debunking?",,2,2,,,,CC BY-SA 4.0 +12836,1,12837,,7/8/2020 18:43,,2,57,"

We are considering Grover's algorithm with a search space of size $2^n$ for an arbitrary integer $n$ for arbitrary $n$, and a unique marked element $x_0$.

+

Question: Calculate $\langle x | D | y \rangle$ for arbitrary $x,y \in \{0,1\}^n$

+

Answer: Using the expression $D = -(I-2|+^n\rangle\langle+^n|)$, we have

+

$$\langle x | D | y \rangle = + \begin{cases} + \frac{2}{N}-1 &\quad\text{if x=y}\\ + \frac{2}{N} &\quad\text{if x $\neq$ y} + \end{cases} +$$

+

How has the equality $D = -(I-2|+\rangle\langle+|)$ been derived? Its from these notes https://people.maths.bris.ac.uk/~csxam/teaching/qc2020/lecturenotes.pdf

+

How do derive the split function? I cannot see the route to start to evaluate this.

+",4336,,491,,7/17/2020 23:42,7/17/2020 23:42,"Calcuate $\langle x | D | y \rangle$ for arbitrary $x,y \in \{0,1\}^n$",,1,0,,,,CC BY-SA 4.0 +12837,2,,12836,7/8/2020 19:18,,3,,"

Grover's Diffusion Operator $D$ can be written as $H^{\otimes n}U_0H^{\otimes n}$ where $U_0$ is the following matrix $$\begin{bmatrix}-1 & 0 & 0 &... & 0 \\ 0 & 1 & 0 & ... &0 +\\.& . & 1 & ... & . +\\.& . & . & ... & . +\\0& 0 & 0 & ... & 1 +\end{bmatrix}$$ +The unitary $U_0$ has the property that $U_0|0^n\rangle = -|0^n\rangle$ and $U_0|\psi\rangle = -|\psi\rangle$.
+Thus unitary $U_0$ can also be written as $2|0^n\rangle\langle0^n|-I$ as its matrix form can be expressed as: +$$ +\begin{bmatrix}1 & 0 & 0 &... & 0 +\\ 0 & -1 & 0 & ... &0 +\\.& . & -1 & ... & . +\\.& . & . & ... & . +\\0& 0 & 0 & ... & -1 +\end{bmatrix} = 2 +\begin{bmatrix}1 & 0 & 0 &... & 0 +\\ 0 & 0 & 0 & ... &0 +\\.& . & 0 & ... & . +\\.& . & . & ... & . +\\0& 0 & 0 & ... & 0 +\end{bmatrix} - +\begin{bmatrix}1 & 0 & 0 &... & 0 +\\ 0 & 1 & 0 & ... &0 +\\.& . & 1 & ... & . +\\.& . & . & ... & . +\\0& 0 & 0 & ... & 1 +\end{bmatrix} +$$ +Now $D$ can be expressed as +$$D=H^{\otimes n}U_0H^{\otimes n}=H^{\otimes n}(2|0^n\rangle\langle0^n|-I)H^{\otimes n}\\ += 2H^{\otimes n}|0^n\rangle\langle0^n|H^{\otimes n}-H^{\otimes n}IH^{\otimes n} \\ += 2(H|0\rangle\langle0|H)^{\otimes n} - I \\ += 2(|+\rangle\langle+|)^{\otimes n} -I \\ += 2|+^n\rangle\langle+^n| -I \\ += -(I - 2|+^n\rangle\langle+^n|)$$

+

I hope this derivation helps.

+",8757,,8757,,7/8/2020 19:45,7/8/2020 19:45,,,,0,,,,CC BY-SA 4.0 +12838,1,12839,,7/8/2020 19:26,,1,227,"

I'm trying to visualize a custom gate in Cirq. I have through this page, which briefly mentions how to create custom gates in Cirq. However, I'm getting errors when trying to visualize it.

+

My current code defines a class CustomGate, which inherits from cirq.Gate class.

+
import numpy as np
+import cirq 
+class CustomGate(cirq.Gate):
+    def __init__(self, unitary):
+        self.unitary = unitary
+        self.numQubits = int(np.log2(unitary.shape[0]))
+
+    def _num_qubits_(self):
+        return self.numQubits
+
+    def _unitary_(self):
+        return self.unitary
+
+    def _circuit_diagram_info_(self, args='cirq.CircuitDiagramInfoArgs') -> 'cirq.CircuitDiagramInfo':
+        return cirq.CircuitDiagramInfo(wire_symbols=("CG",), exponent=1.0, connected=True)
+
+

The usage is as follows:

+
# Define custom gate
+customUnitary = np.eye(4)    # The custom unitary matrix would go here
+CG = CustomGate(customUnitary)
+
+# Setup circuit
+q = cirq.LineQubit.range(2)
+circuit=cirq.Circuit()
+circuit.append(CG(q[0], q[1]))
+
+# Visualize circuit
+print(circuit)
+
+

I'm getting the following error:

+
Traceback (most recent call last):
+  File "test.py", line 42, in <module>
+    print(circuit)
+  File "/Users/pgu/opt/anaconda3/lib/python3.7/site-packages/cirq/circuits/circuit.py", line 338, in __str__
+    return self.to_text_diagram()
+  File "/Users/pgu/opt/anaconda3/lib/python3.7/site-packages/cirq/circuits/circuit.py", line 1609, in to_text_diagram
+    transpose=transpose)
+  File "/Users/pgu/opt/anaconda3/lib/python3.7/site-packages/cirq/circuits/circuit.py", line 1668, in to_text_diagram_drawer
+    get_circuit_diagram_info, include_tags)
+  File "/Users/pgu/opt/anaconda3/lib/python3.7/site-packages/cirq/circuits/circuit.py", line 1924, in _draw_moment_in_diagram
+    info = get_circuit_diagram_info(op, args)
+  File "/Users/pgu/opt/anaconda3/lib/python3.7/site-packages/cirq/circuits/circuit.py", line 1818, in _get_operation_circuit_diagram_info_with_fallback
+    info))
+ValueError: Wanted diagram info from <__main__.CustomGate object at 0x10379bb90>.on(cirq.LineQubit(0), cirq.LineQubit(1)) for 2 qubits but got cirq.CircuitDiagramInfo(wire_symbols=('CG',), exponent=1.0, connected=True, exponent_qubit_index=None, auto_exponent_parens=True)
+
+
+",12614,,55,,7/14/2020 16:50,7/14/2020 16:50,Visualizing custom gates in Cirq,,1,0,,,,CC BY-SA 4.0 +12839,2,,12838,7/8/2020 20:00,,2,,"

You're making a two qubit gate but the circuit diagram info only has one wire label. Change wire_symbols=("CG",) to wire_symbols=("CG", "#2").

+

Note that, since you're using default values for the diagram info you can just return the tuple return "CG", "#2" instead of bothering to wrap it in the more complicated data type.

+

Note that cirq does include cirq.MatrixGate, which takes an arbitrary unitary similar to what your custom gate is doing.

+",119,,,,,7/8/2020 20:00,,,,0,,,,CC BY-SA 4.0 +12840,2,,12835,7/8/2020 21:11,,2,,"

Einstein, Podolsky and Rosen's (local) Hidden Variable theory is the most famous deterministic attempt to explain Quantum Mechanics. You can take a look at the wiki on the explanation: https://en.wikipedia.org/wiki/Hidden-variable_theory. As proved later on by Bell, this theory was not "possible" given the theory could not account for experimental behavior when observing correlations between entangled states.

+

Within the wiki there's a second hidden-variable theory which is supposed to mathematically describe Quantum Phenomena in a deterministic way (Bohm-Debroglie Theory), but it is not considered a possible theory given the necessary assumptions to be made for it to work (multidimensional physical space, among others)

+

You could start from there :)

+",12302,,,,,7/8/2020 21:11,,,,0,,,,CC BY-SA 4.0 +12841,1,12842,,7/8/2020 22:18,,1,186,"

Say we have a custom gate CG, defined by a unitary matrix U, and line qubits qubits in Cirq. Something like this:

+
import numpy
+import cirq
+
+U = np.eye(8)    # The custom unitary matrix goes here
+CG = cirq.MatrixGate(U)
+qubits = cirq.LineQubit.range(3)
+
+

We build the circuit as follows:

+
circuit = cirq.Circuit()
+circuit.append(CG(qubits[0], qubits[1], qubits[2]))
+
+

Is it possible to build the circuit without explicitly specifying all the qubits? Something like circuit.append(CG(qubits)), which would apply the CG gate to all the qubits?

+",12614,,55,,7/14/2020 16:50,7/14/2020 16:50,Applying a gate to all line qubits without explicitly listing them in Cirq,,1,0,,,,CC BY-SA 4.0 +12842,2,,12841,7/8/2020 23:34,,2,,"

In Python you can say callable(*args) instead of callable(args[0], args[1], args[2]).

+",119,,,,,7/8/2020 23:34,,,,1,,,,CC BY-SA 4.0 +12843,2,,12835,7/9/2020 4:33,,1,,"

The coin example is incorrect (that is, different from QM) if you consider correlations of measurements of entangled qubits in different bases.

+

If you want a more advanced attempt of building a deterministic theory underlying QM, have a look at Gerard 't Hooft book The Cellular Automaton Interpretation of Quantum Mechanics which is free now.

+",2105,,,,,7/9/2020 4:33,,,,0,,,,CC BY-SA 4.0 +12844,1,12852,,7/9/2020 6:21,,0,208,"

Recently I focused on how to simulate in classical computer, and I found Qiskit offers qasmsimulator and statevector simulator. And others such as project Q also can simulate on classical computer. So is there a general way to simulate on classical computer? And what are differences among simulators? I mean actually it seems like we just need to multiply gate operation as matrixes.

+",11765,,55,,7/13/2020 16:03,7/13/2020 16:03,How the simulator work?,,1,0,,,,CC BY-SA 4.0 +12845,1,12848,,7/9/2020 13:30,,0,149,"

In Learning Quantum Computation using Qiskit chapter 3.4 I encountered the Deutsch-Josza Algorithm. +At the end of the chapter I was presented with a homework problem where the code:

+
from qiskit_textbook.problems import dj_problem_oracle
+oracle = dj_problem_oracle(1)
+
+

gives me a gate called 'oracle' and I was supposed to do find out whether it was balanced or constant. +I encountered a problem when appending 'oracle' into my circuit, it kept telling me that 'The amount of qubit/clbit arguments does not match the gate expectation.'

+

After alot of headscratching and try and error I found out that the gate was stuck at a size of 5 (or n=4 if you've done the problem). +Because the entire chapter was taught from the view of n qbits, I tried to solve the problem by writing an algorithm for n qbits(so that I can choose how many qbits my circuit contains).

+

I think that some more detail should be added into the text of that chapter so that things like this don't confuse newcomers like me, or just make it an n sized gate. I'd be grateful if someone could pass this message on to the good men and women managing the site.

+",12233,,12233,,7/9/2020 14:11,7/9/2020 15:41,Feedback on Deutsch-Josza alg. homework prob. in Learning Quantum computation using Qiskit,,1,6,,7/10/2020 11:28,,CC BY-SA 4.0 +12846,1,,,7/9/2020 15:01,,3,736,"

I am trying to obtain the correct circuit transpiled for the ibmq_london device, as I want to know what the real gates applied in the quantum computer are. I am implementing the QFT circuit for 5 qubits. My code is the following one (DAQC and qnoise are modules that I have created but they do not affect the transpilation, they are used to show the pictures or to create initial states):

+

+    import numpy as np
+    from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister, IBMQ, execute
+    from qiskit.providers.aer import QasmSimulator
+    from qiskit.visualization import plot_histogram
+    from qiskit.compiler import transpile
+    import DAQC
+
+    provider = IBMQ.load_account() 
+    # Get properties and coupling map of the desired device
+    device = provider.get_backend('ibmq_london')
+    properties = device.properties()
+    coupling_map = device.configuration().coupling_map
+    basis_gates=device.configuration().basis_gates  
+ 
+    # Circuit
+    n=5
+    beta=0
+    state=DAQC.initial_state_QFT(n,beta)
+    qr=QuantumRegister(n)
+    cr=ClassicalRegister(n)
+    qc=QuantumCircuit(qr,cr)
+        
+    qc.initialize(state,qr)
+    qft(qc,n)
+    qc.measure(qr,cr)
+    backend = QasmSimulator()
+    job = execute(qc, backend=backend,shots=100000)
+    result_ideal = job.result()
+    qiskit_counts=result_ideal.get_counts()
+    qnoise.show_figure(plot_histogram(qiskit_counts, title='Results for qiskit ideal simulator'))
+    
+    # Transpiled circuit
+    qr2=QuantumRegister(n)
+    cr2=ClassicalRegister(n)
+    qc2=QuantumCircuit(qr2,cr2)
+        
+    qc2.initialize(state,qr2)
+    qft(qc2,n)
+    qc2=transpile(qc2,basis_gates=basis_gates,coupling_map=coupling_map)
+    qc2.measure(0,0)
+    qc2.measure(1,1)
+    qc2.measure(2,2)
+    qc2.measure(3,3)
+    qc2.measure(4,4)  
+    job = execute(qc2, backend=backend,shots=100000)
+    result_ideal = job.result()
+    qiskit_counts=result_ideal.get_counts()
+    qnoise.show_figure(plot_histogram(qiskit_counts, title='Results for qiskit ideal simulator (transpiled)'))
+    
+
+

The problem is that when I obtain the results, although they should be the same because the circuit is just transpiled, I obtain completely different outcomes:

+

+

+

I think that the problem is with the initialize command, as when I remove it I obtain the same result for both cases. Is it possible to use the initialize command with the transpile one? Is there any other option to obtain the transpiled circuit when it is initialized in a concrete state?

+

Thank you

+",9887,,55,,7/13/2020 16:04,7/13/2020 18:02,Why after transpiling a Qiskit circuit we obtain a different result?,,1,7,,,,CC BY-SA 4.0 +12847,2,,9798,7/9/2020 15:40,,2,,"

The linked question gives most of the relevant information but I want to focus on a few aspects of :

+
+

My understanding is that, since we only need to iterate between all possible combinations of the nonce, which is 32 bits, wouldn't it require only sqrt(2^32)=2^16 (16 qubits) to instantly find a valid block header hash if we use Grover's algorithm?

+
+
    +
  1. Grover's algorithm needs a number of iterations which is the square root of the number you would need classically, not the square root of the number of bits. In this case, an "iteration" is one computation of the hash function SHA-256.

    +

    Grover's algorithm will need to compute the hash function in superposition, and it needs to compute the entire hash function, whatever the nonce is. This means we need at least 512 qubits (256 for the input, 256 for the input) and in practice the number would be more like 5000 qubits.

    +
  2. +
  3. Quantum computers need error correction, so each of the qubits from the first point (what we call "logical qubits") will need many thousands of "physical" qubits (e.g., the kind that IBM and Google have right now, but better). The same paper estimates 14 million physical qubits to run Grover's algorithm on SHA-256. They are considering a full pre-image search, which is harder, so maybe bitcoin mining would "only" need a few hundred thousand qubits.

    +
  4. +
  5. Grover's algorithm won't instantly find a valid block header. If the current challenge is to find a header whose hash has $b$ zero bits, Grover's algorithm needs to compute the hash function roughly $2^{b/2}$ times. Right now $b=62$ so Grover's algorithm would still need to compute SHA-256 $2^{31}$ times.

    +
  6. +
  7. Right now, the bitcoin network is massively parallel. The network as a whole computes something like $2^{60}$ hashes/second so that it can find a preimage in 10 minutes, but each individual mining processor on the network computes much less (looks like around $2^{20}$ hashes/second for a single processor). Classical preimage search parallelizes very well: if you use twice as many computers you find the preimage (on average) twice as fast. For Grover's search, to find the preimage twice as fast you need 4 times as many quantum computers. If a quantum computer could compute hashes as fast as today's classical computer, then it can only compute $2^{29}$ hashes in 10 minutes, so it would need $(2^{31}/2^{29})^2=2^{4}=16$ quantum computers to have any mining advantage.

    +
  8. +
+

So: if you had 16 quantum computers, each with several hundred thousand qubits, you might have a slight bitcoin mining advantage.

+",4517,,,,,7/9/2020 15:40,,,,0,,,,CC BY-SA 4.0 +12848,2,,12845,7/9/2020 15:41,,2,,"

I think you misunderstood the problem here.

+

First notice that in each example of the notebook, when you are dealing with a length n you actually get in the end n+1 qubits to deal with in your circuit. Plus each of the function creates a circuit with n+1 qubits when dealing with length n. Therefore with n=4 the fact that the gate has a number of qubits equal to 5 is normal in this case.

+

Now, since the oracle that is created is a gate, you can access its number of qubits by doing oracle.num_qubits, here corresponding to n+1, and then to answer the question you run the same functions used in the examples (creating the algo from the oracle with the right number of qubits n, and executing the algo).
+I tried this and it worked, let me know if you still need help! :)

+",12396,,,,,7/9/2020 15:41,,,,1,,,,CC BY-SA 4.0 +12849,1,12861,,7/9/2020 16:02,,2,416,"

The following links provides circuts for $a\in\{2,7,8,11,13\}$ and $N=15$: https://qiskit.org/textbook/ch-algorithms/shor.html#3.-Qiskit-Implementation +https://arxiv.org/abs/1202.6614v3.

+

I am interested in implementing circuts for the case when $a=2$, $N=21$ and $a=3$, $N=14$ or a generic way to generate them.

+

I've tried to generate the unitary matrix by classical computation classically, but I don't know how to fill remaining space and when input state 0 is treat it as state 15 output.

+",12626,,55,,7/13/2020 16:04,7/13/2020 16:04,How to implement Cx mod N unitary,,1,2,,,,CC BY-SA 4.0 +12850,1,,,7/9/2020 18:04,,-1,158,"

Reproduced from Nielsen & Chuang's Quantum Computation and Quantum Information (10th Anniversary Edition) in page 64:

+
+

We've seen that matrices can be regarded as linear operators. [...] Suppose $A: V \rightarrow W$ is a linear operator between vector spaces $V$ and $W$. Suppose $|v_{1}\rangle,...,|v_{m}\rangle$ is a basis for $V$ and $|w_{1}\rangle,...,|w_{m}\rangle$ is a basis for $W$. Then for each j in the range 1,...,m, there exist complex numbers $A_{1j}$ through $A_{nj}$ such that +$$A|v_{j}\rangle = \sum_{i} A_{ij} |w_{i}\rangle \tag{2.12} $$

+
+

Looking for information about this equation, I was not able to find any demonstration. I saw in other websites and books that they use this equation, but not where it comes from.

+

I'm presenting this question because I made a mistake with equation (2.12) in this other question.

+

But I'm still not understanding why, once I've got members of the matrix of the operator, I can't use it directly with vector components. And I believe the problem comes from equation (2.12).

+

Thanks for all information or advice you can give to me.

+",,user12503,23,,7/18/2020 23:32,7/18/2020 23:32,Nielsen and Chuang: Demonstration of equation 2.12,,2,3,,2/22/2021 12:16,,CC BY-SA 4.0 +12851,2,,12850,7/9/2020 18:54,,0,,"

Suppose that you have an basis vector $|v_i\rangle $ in 3-dimensions and you act A on it then in other 3-dimensions space you want to find an operator B that act on basis $|w_j\rangle $ and because two space are in the rotation position of each other you need some B that act on different basis of it. That we name it $A_{ij}$

+",11971,,,,,7/9/2020 18:54,,,,1,,,,CC BY-SA 4.0 +12852,2,,12844,7/9/2020 19:03,,4,,"

There are three major levels of simulation difficulty (broadly, there are a bunch of others, but these are the main levels.)

+

Clifford simulators can simulate circuits composed of only Clifford elements on stabilizer states. This is classically efficient, since it is classically efficient to calculate the propagation of a Pauli operator through a Clifford gate. As a result, the simulator takes the stabilizers of the input state, propagates them through the circuit, and the resulting stabilizer group represents the final state. The idea that a quantum algorithm needs non-Clifford gates to be better than a classical one comes from the fact that a fully Clifford quantum algorithm could be simulated classically in polynomial time.

+

The second level of simulation is State Vector simulation. In this case, we are basically doing what you mentioned in your question. We take an input state (of size $2^n$, where n is the number of qubits) and then apply gates to it through matrix multiplication. Due to the exponential size of the state, this requires resources exponential in the system size to be simulated, and as a result is not considered classically efficient. The only restriction on these simulations is that the gates must all be unitary and all states must be pure.

+

The last level is Density Matrix simulation. Here, we store the full $2^n \times 2^n$ density matrix of the state. As a result we can simulate any quantum channel, and mixed states are permissible. However we now have an even bigger object to work with. These simulations are often necessary for doing work on simulating physical noise or other non-unitary processes, but are extremely limited in size due to their exponential resource requirements.

+",3056,,,,,7/9/2020 19:03,,,,3,,,,CC BY-SA 4.0 +12854,2,,8300,7/10/2020 3:28,,2,,"

Since the NOT gate from the question is the X gate in IBMQ/Qiskit, hereinafter we will call it only the X gate and, accordingly, the square root of the X gate or SqrtX.

+

How to construct SqrtX using the minimum number of gates, it depends on your purposes.

+

If the phase is not important for your purposes (e.g. you just looking for how to split the X gate into 2 equal gates assuming that their squares may differ from X by the global phase), then it may be constructed e.g. as:

+
 ┌──────────┐
+ ┤ RX(pi/2) ├
+ └──────────┘
+
+

in Qiskit:

+
qc.rx(np.pi/2, reg)
+
+

If the phase is important for your purposes (e.g. in cases as adding control to an unitary gate), then it may be constructed from the previous one by phase shift:

+
 ┌──────────┐┌───┐��───────────────────┐
+ ┤ RX(pi/2) ├┤ X ├┤ U3(pi,pi/4,5pi/4) ├
+ └──────────┘└───┘└───────────────────┘
+
+

in Qiskit:

+
qc.rx(np.pi/2, reg)
+qc.x(reg)
+qc.u3(np.pi, np.pi/4, 5*np.pi/4, reg)
+
+

or like this (without RX):

+
 ┌────────────────┐┌───┐┌────────────────┐
+ ┤ U2(-pi/4,pi/2) ├┤ X ├┤ U3(pi,0,5pi/4) ├
+ └────────────────┘└───┘└────────────────┘
+
+

in Qiskit:

+
qc.u2(-np.pi / 4, np.pi / 2, reg)
+qc.x(reg)
+qc.u3(np.pi, 0, 5 * np.pi / 4, reg)
+
+

or as in my edition of the answer. As you see, this circuit is almost same as in the original of the answer but in my edition it uses u1 instead of rz.

+
+

The fact is that in many cases, but not all, in IBMQ/Qiskit it is assumed that rz is implemented as u1, although actually rz(ϕ) is different to u1(ϕ) by a global phase exp(-iϕ/2) and this can be significant in cases like adding control to an unitary gate (in the answer you can see an example of the controlled version of this circuit, which would be incorrect if the crz gate were not replaced by the cu1 gate).

+
+

Also SqrtX may be constucted by using the Qiskit's power method:

+
qc.append(XGate().power(1/2), reg)
+
+

or by using one of unitary matrices corresponding to the square roots of the X gate:

+
qc.unitary([[0.5 + 0.5j, 0.5 - 0.5j], [0.5 - 0.5j, 0.5 + 0.5j]], reg)
+
+

or by using Operator:

+
qc.append(Operator([[0.5 - 0.5j, 0.5 + 0.5j], [0.5 + 0.5j, 0.5 - 0.5j]]), reg)
+
+

or similarly, using UnitaryGate, squ/iso methods, qasm, etc (but be careful, Qiskit does not always accurately process the phase!).

+

PS. I already mentioned in another answer about my Qiskit program for small investigating of the various cases of the roots of X and Y, look if you are interested.

+

UPD: In new version of Qiskit 0.20.0 there are new gates, such as: SXGate, SXdgGate and CSXGate (i.e. SqrtX, SqrtX$^\dagger$ and Controlled-SqrtX gates, respectively). Similar gates have also been added to qelib1.inc. The following decompositions of these gates is applied there (unlike the csx gate, these decomposition of the sx and sxdg gates are completely equivalent to the rx(π/2) and rx(-π/2) gates respectively, and if the global phase is important for your purposes, then these decompositions require adding it as $\pm\pi/4$ respectively!):

+
// sqrt(X)
+gate sx a { sdg a; h a; sdg a; }
+// inverse sqrt(X)
+gate sxdg a { s a; h a; s a; }
+...
+// controlled-sqrt(X)
+gate csx a,b { h b; cu1(pi/2) a,b; h b; }
+
+

UPD2: The new IBM Q system has a native implementation of the SqrtX gate along with other innovations: "The ibmq_montreal device has the following native gate set forachieving universal quantum computation: Ctrl-X (CX), Sqrt-X (SX) and Phase(θ)", for details see here

+",12280,,12280,,8/25/2020 6:46,8/25/2020 6:46,,,,2,,,,CC BY-SA 4.0 +12857,1,12870,,7/10/2020 10:17,,2,601,"

I am going through the paper Surface code with decoherence: An analysis of three superconducting architectures and I have a doubt about how the authors get what they refer to as the combined channel of amplitude and phase damping. In the section IIA, the authors discuss amplitude damping and dephasing channels with their Kraus operators in order to describe decoherence first, and afterwards they combine their effects. They state that the combined channel is represented by 3 Krauss operators depending on the amplitude damping and dephasing parameters.

+

I am wondering how such Kraus operators are obtained from the Kraus operators describing the individual channels, as the authors do not explain nor give any reference to such statement. My initial approach has been to consider a sequential combination of the channels, but my results are not successful (probably because the simultaneous action of the channels is not equivalent to their sequential actions on the quantum information).

+",2371,,491,,7/17/2020 23:25,7/17/2020 23:25,Find the Kraus operators of a combined amplitude and phase damping channel,,2,1,,,,CC BY-SA 4.0 +12858,2,,12850,7/10/2020 10:23,,2,,"

I'll try to explain the whole process here, I hope this will clear the equation for you!

+

So, what we are trying to do here is to find a matrix that represents the linear operator $A : V \rightarrow W$.
+$V$ and $W$ are both vector spaces so we know we can find one basis for each set, here $|v_1\rangle, ..., |v_m\rangle$ and $|w_1\rangle, ..., |w_n\rangle$. Now, we want to study how $A$ acts on the set $V$, so we will look at how it affects the basis of the set (a result of linear algebra actually tells us that looking at the results of one basis suffices to completely describe the operator). Let's note $|y_i\rangle = A(|v_i\rangle)$. So since $A : V \rightarrow W$, we have $|y_i\rangle \in W$, so the direct result we have is that we can write this vector as a linear combination of the $|w_1\rangle, ..., |w_n\rangle$ since this is a basis of $W$. This is the definition of a basis, that every vector of the set can be written as a linear combination of the vectors of the basis.

+

This is the information $(2.12)$ is representing, and it is with this information that we will build the matrix associated to the linear operator. The equation is telling us that $A(|v_i\rangle)$ is written as a linear combination of the basis $|w_1\rangle, ..., |w_n\rangle$.

+

Please let me know if you need clarification on something :)

+",12396,,8757,,7/10/2020 11:12,7/10/2020 11:12,,,,2,,,,CC BY-SA 4.0 +12859,1,,,7/10/2020 10:34,,2,185,"

I'm a college student with a slight interest in quantum mechanics. I think I have a decent understanding of the Copenhagen and Many Worlds interpretations of quantum mechanics, and was considering how this could be used to improve machine learning efficiency. I want to check my understanding of quantum mechanics/computing using a design I came up with for a neural network training algorithm.

+

The following is a graphical representation of my algorithm. To read the diagram, follow the colored circles. The arrows show the direction in which data flows, not sequential steps in the program. The sequential steps are represented by the colored circles. Note that all state in this system would be finite.

+

+
    +
  1. The user pre-configures their training data into the system. This consists of network input and expected network output pairs.
  2. +
  3. The user pre-configures the cost threshold, a guess for the lowest accumulated cost value.
  4. +
  5. The algorithm starts the iteration over training data pairs. The network input is fed into the neural network, along with the weights which are represented in qbits. This produces a network output, which is also represented in qbits. (Each superposition of the network output should be entangled with a particular superposition of the weights.) A cost function then computes a cost (represented in qbits) based on the expected network output and the network output. An accumulator accumulates these costs over each iteration.
  6. +
  7. Once the iteration is finished, we compare the accumulated cost with the cost threshold. If it is less than the cost threshold, we display the weights that are entangled with the accumulated cost to the outside world. There may be multiple branches that pass the threshold, but it doesn't matter which one we output. From the outside world's perspective, the machine should have collapsed to a single set of weights that produce an accumulated cost that is less than the cost threshold. If nothing is displayed, it means no branch passed the cost threshold, so the user should start from step 2 with a higher cost threshold.
  8. +
  9. Repeat steps 2, 3, 4 until satisfied with the displayed weights and cost threshold.
  10. +
+

My idea is that by setting up the system in this way, you could reduce the problem of finding weights to a linear guess and see process (gradually increment the cost threshold one unit at a time until the machine stops displaying an output, at that point you should have found the optimal configuration of weights according to your cost function). Would this work in practice, and are there any glaring flaws with my design or understanding of quantum mechanics?

+",12631,,,,,7/20/2021 7:47,Quantum-Assisted Neural Network Training (Is my design reasonable?),,2,12,,,,CC BY-SA 4.0 +12861,2,,12849,7/10/2020 16:08,,1,,"

Firstly, these circuits only need to work for states $C^k \pmod{N}$ since these are the only states used in Shor's algorithm. I do not think you could have a circuit that works for the states 0 and $N \bmod N$ without outputting to a different register since this would not be reversible.

+

Below is how I came to an answer for your specific question (not a general method):

+

For the specific cases you stated, you can find a circuit analytically. I'll create $2x \bmod 21$.

+

Start with a working circuit, for example the $2x \bmod 15$ circuit from the paper you linked. I have added one qubit since we'll need it later to create $2x \bmod 21$. I have also included a function that cycles through the states and checks everything works correctly.

+
from qiskit import QuantumCircuit
+from qiskit.quantum_info import Statevector
+
+def test_cycles(circuit, cycles):
+    i = 1
+    for application in range(cycles):
+        print("Apply %s, %i times: %i" % (circuit.name, application, i))
+        sv = Statevector.from_int(i, 32)  # 32 is no. of elements in vector (dimension)
+        sv = sv.evolve(circuit)
+        output = sv.sample_memory(1)[0]  # simulate one shot (circuit is deterministic)
+        i = int(output, 2)  # convert binary output to int
+
+tm15 = QuantumCircuit(5)  # 2x mod 15
+tm15.name = "2x (mod 15)"
+tm15.swap(0,3)
+tm15.swap(3,2)
+tm15.swap(2,1)
+        
+test_cycles(tm15, 6)
+tm15.draw()
+
+

Output:

+
Apply 2x (mod 15), 0 times: 1
+Apply 2x (mod 15), 1 times: 2
+Apply 2x (mod 15), 2 times: 4
+Apply 2x (mod 15), 3 times: 8
+Apply 2x (mod 15), 4 times: 1
+Apply 2x (mod 15), 5 times: 2
+
+

+

We can see the state of the state of the register follows the sequence 1, 2, 4, 8, 1... with successvie applications of the circuit. To make $2x \bmod 21$ we want the sequence to be:

+
1, 2, 4, 8, 16, 11, 1... 
+
+

Next, we want the state 8 to be transformed to the state 16 upon running the circuit, we can accomplish this with a single swap gate to get $2x \bmod 31$:

+
tm31 = QuantumCircuit(5)
+tm31.name = "2x mod 31"
+tm31.swap(3,4)
+tm31 += tm15
+test_cycles(tm31, 6)
+tm31.draw()
+
+

Output:

+
Apply 2x mod 31, 0 times: 1
+Apply 2x mod 31, 1 times: 2
+Apply 2x mod 31, 2 times: 4
+Apply 2x mod 31, 3 times: 8
+Apply 2x mod 31, 4 times: 16
+Apply 2x mod 31, 5 times: 1
+
+

+

We need to modify our circuit to do the transformation: 16 -> 11. In binary, this is the transformation:

+
10000 -> 01011
+
+

and leave the states 1, 2, 4 and 8 unchanged. Since the most significant qubit will only be on when our register is in the state 16, we can use this to recognise the special case:

+
tm21 = QuantumCircuit(5)
+tm21.name = "2x mod 21"
+tm21.cx(4, 2)
+tm21.cx(4, 0)
+tm21 += tm32
+test_cycles(tm21, 16)
+tm21.draw()
+
+

Output:

+
Apply 2x mod 21, 0 times: 1
+Apply 2x mod 21, 1 times: 2
+Apply 2x mod 21, 2 times: 4
+Apply 2x mod 21, 3 times: 8
+Apply 2x mod 21, 4 times: 16
+Apply 2x mod 21, 5 times: 11
+Apply 2x mod 21, 6 times: 22
+Apply 2x mod 21, 7 times: 7
+Apply 2x mod 21, 8 times: 14
+Apply 2x mod 21, 9 times: 28
+Apply 2x mod 21, 10 times: 19
+Apply 2x mod 21, 11 times: 13
+Apply 2x mod 21, 12 times: 26
+Apply 2x mod 21, 13 times: 31
+Apply 2x mod 21, 14 times: 21
+Apply 2x mod 21, 15 times: 1
+
+

+

Here I have used the fact that the $2x\bmod 31$ circuit is simply a bit-shift along the register to work out which qubits to conditionally flip. Notice though that this circuit is incomplete as it does not do the transformation: 11 -> 1. It does however do: 21 -> 1. To complete our circuit, we must prepend a circuit that does the transformation: 11 -> 21, or in binary:

+
01011 -> 10101
+
+

and must leave the states 1, 2, 4, 8 and 16 unchanged. We can use controlled swap gates to do this. Since 11 is the only state in our cycle that has multiple qubits in the state $|1\rangle$, we know this will not adversely affect any of the other states in the cycle:

+
tm21 = QuantumCircuit(5)
+tm21.name = "2x mod 21"
+tm21.cswap(0,3,4)
+tm21.cswap(0,1,2)
+tm21.cx(4, 2)
+tm21.cx(4, 0)
+tm21 += tm31
+test_cycles(tm21, 8)
+tm21.draw()
+
+

Output:

+
Apply 2x mod 21, 0 times: 1
+Apply 2x mod 21, 1 times: 2
+Apply 2x mod 21, 2 times: 4
+Apply 2x mod 21, 3 times: 8
+Apply 2x mod 21, 4 times: 16
+Apply 2x mod 21, 5 times: 11
+Apply 2x mod 21, 6 times: 1
+Apply 2x mod 21, 7 times: 2
+
+

+

Above is a complete circuit for $2x \bmod 21$ that uses no extra qubits. It is probably not the most efficient circuit that accomplishes this, but it does work. This method is not generalisable, and will become unmanageable for larger circuits. For general circuits I believe you must take the extra qubit 'hit' and turn to this paper.

+",10415,,10415,,7/10/2020 16:15,7/10/2020 16:15,,,,0,,,,CC BY-SA 4.0 +12862,1,,,7/10/2020 18:21,,2,64,"

Question is about techniques from this paper. Essentially the paper provides a way to record what queries were asked to a quantum-accessible oracle. We have the oracles: \begin{aligned} +&\text { Standard oracle }(\mathrm{StO}):|x\rangle_{X}|y\rangle_{Y} \mapsto|x\rangle_{X}|y \oplus f(x)\rangle_{Y}\\ +&\text { Phase oracle (PhO): } \quad|x\rangle_{X}|\eta\rangle_{Y} \mapsto(-1)^{\eta \cdot f(x)}|x\rangle_{X}|\eta\rangle_{Y} +\end{aligned}

+

The fourier oracle is defined as:

+

$\text { Fourier Oracle }(\mathrm{FO}): F O:=H^{F} \circ P h O \circ H^{F}$ (where $H^F$ stands for $QFT$)

+

The problem is decoding what happens in the last step here:

+

\begin{array}{l} +|x\rangle|\eta\rangle\left|0^{n} \cdots 0^{n}\right\rangle \stackrel{H^{F}}{\rightarrow} \sum_{f}|x\rangle|\eta\rangle|f\rangle \stackrel{P h O}{\longrightarrow} \sum_{f}(-1)^{\eta \cdot f(x)}|x\rangle|\eta\rangle|f\rangle \\ +\stackrel{H^{F}}{\rightarrow} \sum_{f, \phi}(-1)^{\phi \cdot f}(-1)^{\eta \cdot f(x)}|x\rangle|\eta\rangle|\phi\rangle=\ldots \\ +=|x\rangle|\eta\rangle\left|0^{n} \cdots 0^{n} \eta 0^{n} \cdots 0^{n}\right\rangle +\end{array}

+

$|f\rangle$ is the superposition of all possible $f$ in the corresponding domain and range. The claim is that after the last step at the $x$'th position you get $\eta$. Which indicates at which point the oracle was queried. How does the register containing $f$ transform to the register with $\eta$ in the $x$'th position?

+",12634,,55,,9/30/2020 3:53,9/30/2020 3:53,Recording Quantum Queries,,0,5,,,,CC BY-SA 4.0 +12863,2,,12785,7/10/2020 22:39,,4,,"

As far as I understand your scheme, it is equivalent/can be modelled as a multiport interferometer. Think a generalisation of a (not necessarily balanced) beamsplitter to many modes.

+

If the input is classical (i.e. coherent light) then the output of an interferometer can be simulated efficiently classically, meaning that this is not useful for quantum computation. +The same goes when the input is a single photon.

+

Things get more interesting when using as input multiple single photons on different inputs modes. Then we know that this setup cannot be simulated efficiently with a classical device. However, as far as I know, it is not known whether it is possible to implement "useful" quantum algorithms with this type of device.

+",55,,,,,7/10/2020 22:39,,,,0,,,,CC BY-SA 4.0 +12864,1,12865,,7/11/2020 3:23,,0,156,"

I had an interesting talk with someone who said that we can use a single qubit to encode two different values. We encode the first value in its orientation (up/down) of particle/wave (electron, photon, etc.) and we encode the second value in the phase of that particle/wave. What do you think about that?

+",8491,,1108,,7/11/2020 23:28,7/13/2020 2:24,"Can you encode two values in a single qubit state, say its phase and orientation?",,3,1,,,,CC BY-SA 4.0 +12865,2,,12864,7/11/2020 6:21,,1,,"

Each qubit can be described as +$$ +|\psi\rangle = \alpha|0\rangle+\mathrm{e}^{i\varphi}\beta|1\rangle, +$$ +where $\alpha^2+\beta^2=1$. Both $\alpha$ and $\beta$ are real numbers. These values are so-called amplitudes and it holds that $P(|0\rangle) = \alpha^2$ and $P(|1\rangle) = \beta^2$. So, amplitudes describe probability that you find your qubit in either state after measurement (up or down in your question or $|0\rangle$ or $|1\rangle$ in example above). An angle $\varphi$ is the phase, the person you mentioned talked about. It is another purely quantum parameter of qubit (i.e. there is no analog in classical world). The existence of phase is one of reasons why quantum computer can be superior to classical one in some tasks.

+

Appendix:

+

You can also write the qubit as +$$ +|\psi\rangle = \alpha|0\rangle+\beta|1\rangle, +$$ +where $|\alpha|^2+|\beta|^2=1$. Both $\alpha$ and $\beta$ are complex numbers. These numbers are again called amplitudes and it holds that $P(|0\rangle) = |\alpha|^2$ and $P(|1\rangle) = |\beta|^2$. The phase is hidden in amplitudes in this case.

+

Both above mentioned forms can be transformed to each other (write complex numbers $\alpha$ and $\beta$ in expontential form).

+",9006,,,,,7/11/2020 6:21,,,,0,,,,CC BY-SA 4.0 +12866,2,,12864,7/11/2020 7:09,,4,,"

No. Even though you can encode information in both the amplitude and phase degrees of freedom independently, it is important that the two ``values'' be encoded in a way that they can be successfully distinguished. This nuance is captured by the so-called Holevo's theorem which essentially states that a qubit can contain at most one bit of information.

+

This is a fairly counterintuitive result since a single qubit state can take infinitely many values, corresponding to various choices of the amplitudes and phases. But since there are only two orthogonal states (for the pure state case), one can retrieve only a single bit of information from a qubit.

+",1108,,,,,7/11/2020 7:09,,,,0,,,,CC BY-SA 4.0 +12868,1,,,7/11/2020 18:49,,2,136,"

I am learning how to draw quantum circuits. I was checking the options available and I could see that Tikz and Quantikz are suitable for making circuits diagrams but I want to know if there are some tasks that Quantikz can do but Tikz cannot. Thanks.

+
+

Cross-posted on Tex.SE

+",10455,,23,,7/18/2020 23:44,7/18/2020 23:44,Is there anything Quantikz can do that Tikz cannot do?,,2,7,,7/18/2020 23:40,,CC BY-SA 4.0 +12869,2,,12868,7/12/2020 9:34,,1,,"

As explained in this tutorial, Quantikz is a Tikz package that is specific for drawing quantum circuits. So they are not alternative solutions.

+",5551,,,,,7/12/2020 9:34,,,,0,,,,CC BY-SA 4.0 +12870,2,,12857,7/12/2020 11:27,,5,,"

You can obtain the Kraus operators of the combined channel by taking products of the Kraus operators of the individual channels (using the notation from the paper you linked):

+

Amplitude damping:

+

$E^{AD}_1 = \begin{bmatrix} 1 & 0 \\ 0 & \sqrt{1-p_{AD}} \end{bmatrix}$, +$E^{AD}_2 = \begin{bmatrix} 0 & \sqrt{p_{AD}} \\ 0 & 0 \end{bmatrix}$

+

Phase damping:

+

$E^{PD}_1 = \begin{bmatrix} 1 & 0 \\ 0 & \sqrt{1-p_{PD}} \end{bmatrix}$, +$E^{PD}_2 = \begin{bmatrix} 0 & 0 \\ 0 & \sqrt{p_{PD}} \end{bmatrix}$

+

Combined:

+

$E^{D}_1 = E^{PD}_1 E^{AD}_1 = \begin{bmatrix} 1 & 0 \\ 0 & \sqrt{1-p_{AD}}\sqrt{1-p_{PD}} \end{bmatrix} $

+

$E^{D}_2 = E^{PD}_1 E^{AD}_2 = \begin{bmatrix} 0 & \sqrt{p_{AD}} \\ 0 & 0 \end{bmatrix} $

+

$E^{D}_3 = E^{PD}_2 E^{AD}_1 = \begin{bmatrix} 0 & 0 \\ 0 & \sqrt{1-p_{AD}}\sqrt{p_{PD}} \end{bmatrix} $

+

This is the Kraus set given in the paper you linked. There is a fourth possible combination, which is

+

$E^{D}_4 = E^{PD}_2 E^{AD}_2 = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix} $

+

which is the null channel. Since we first destroy any $|1\rangle$ states, the phase damping channel only has $|0\rangle$ states to act on, which are sent to 0.

+

The order in which you apply amplitude and phase damping does not actually matter, that is

+

$\mathcal{E}_{AD} \circ \mathcal{E}_{PD} (\rho) = \mathcal{E}_{PD} \circ \mathcal{E}_{AD} (\rho)$.

+

Thus, you could swap the products in the Kraus terms defined above, which would result in a different Kraus set (now with four non-null elements), which would also describe the channel (the Kraus representation is not unique).

+",4622,,,,,7/12/2020 11:27,,,,1,,,,CC BY-SA 4.0 +12872,1,,,7/12/2020 18:56,,3,105,"

The multifacted evidence is very compelling--although not yet presented in a formal proof--that the Hilbert-Schmidt probability that a generic (full rank/rank-4) two-qubit density matrix is separable is $\frac{8}{33}$ +(MasterLovas-AndaiFormula)

+

Assuming this proposition, it follows from the interesting 2005 analysis of Szarek, Bengtsson and Zyczkowski structure of the body of states with positive partial transpose that +the Hilbert-Schmidt probability that a generic boundary (rank-3) two-qubit density matrix is separable/PPT is simply one-half, that is $\frac{4}{33}$.

+

So, what can be said in such regards for generic rank-2 two-qubit density matrices? (I suspect the associated separability probability is zero--as some current numerical analyses of mine appear to indicate--but also surmise that there is a manner in which to demonstrate such a proposition formally. Perhaps there is some literature to this effect that I would appreciate having indicated.)

+

Of course, one can pose parallel questions--which I am also investigating--for higher-dimensional qubit-qutrit, two-qutrit,...states (for which the Szarek, Bengtsson, Zyczkowski boundary-state PPT result still holds). The Hilbert-Schmidt separability/PPT probability for generic (full rank) qubit-qutrit states has been conjectured to be $\frac{27}{1000}$. +NumericalExact (It was also speculated there that the Hilbert-Schmidt PPT-probability for generic two-qutrit states might be $\frac{323}{3161088}=\frac{17 \cdot 19}{2^{10} \cdot 3^2 \cdot 7^3} \approx 0.000102180009$ or $\frac{11}{107653} = \frac{11}{7^2 \cdot 13^3} \approx 0.000102180153$.)

+

Rank-2 two-qubit states have been studied in considerable depth by Horia Scutaru +in "On the pseudo-pure states of two qubits." Proceedings of the Romanian Academy. Series A. Mathematics, Physics, Technical Sciences, Information Science 5.2 (2004): 136-140. pseudo-pure state article (I considered sending him this question, but found that he is deceased.)

+

Let us also point out that in our 2005 paper qubit-qutrit ratios a value (33.9982) of close to 34 was reported for the ratio of the Hilbert-Schmidt separability probability of rank-6 to rank-4 qubit-qutrit states. This would appear to be a further topic for updated analyses.

+

Theorem 1 of the 2001 paper LowRankSeparable, +"Low Rank Separable States Are A Set Of Measure Zero Within The Set of Low Rank States" of R. B. Lockhart deals with general cases of the type raised here, but appears to apply only to rank-1 (pure) two-qubit states and not to rank-2 such states, so leaving the question put forth here still not apparently answered.

+",3089,,55,,9/30/2020 3:52,9/30/2020 3:52,"Is the Hilbert-Schmidt probability simply zero that a generic rank-2 two-qubit (""pseudo-pure"") density matrix is separable?",,1,0,,,,CC BY-SA 4.0 +12874,2,,12864,7/13/2020 2:24,,1,,"

What is "a single qubit state" in your question?

+

If it is really a single qubit in a unique unknown state and there are no other qubits in the same state (for example, prepared in the same way), +then in the answer it is already quite explained for this case.

+

If it is a single qubit in a quantum program (circuit) designed to be executed on a NISQ computer (or on its simulator), +then usually such a circuit is run several times (or shots) up to obtain stable results. +Thus, although one speaks of measuring a single qubit state, each shot a "new" state of the qubit is measured. +Accordingly, using multiple runs, you can get the orientation (e.g. up/down) in different proportions, which can "encode" various values. +Also two "encoded" values can be "decoded" from a single qubit, measuring the orientation (up/down) in half the cases, the phase in the other half. +And more than two values, if measuring this qubit in more then two various basises, for details see e.g. here.

+",12280,,,,,7/13/2020 2:24,,,,0,,,,CC BY-SA 4.0 +12875,1,12876,,7/13/2020 5:50,,1,70,"

Given a qubit state $|\psi\rangle \in \mathcal{H}$, and two bipartite general mixed states $\rho$ and $\sigma$, such that, +$$\langle \psi|\otimes \langle \psi|\rho - \sigma |\psi\rangle \otimes |\psi \rangle \ \leqslant \epsilon$$ +Now suppose the reduced state of $\rho, \sigma$ be such that, +$$ \rho_r = Tr_1(\rho) = Tr_2(\rho), \hspace{5mm} \sigma_r = Tr_1(\sigma) = Tr_2(\sigma)$$ +Then can we say something about the closeness of the reduced state in terms of epsilon? In other words, +$$\langle \psi| \rho_r - \sigma_r|\psi\rangle \leqslant ? $$

+",8748,,55,,9/30/2020 3:52,9/30/2020 3:52,What can be inferred about the closeness of reduced qubit states from the closeness of the bipartite quantum state?,,1,3,,,,CC BY-SA 4.0 +12876,2,,12875,7/13/2020 6:57,,2,,"

No, there's not a lot you can say. Consider these two cases, both with $\epsilon=0$.

+

First, the obvious one, $\rho=\sigma=|\psi\rangle\langle\psi|\otimes |\psi\rangle\langle\psi|$. Clearly $\rho_r-\sigma_r=0$.

+

Second, let $|\psi^\perp\rangle$ be orthogonal to $|\psi\rangle$. You can have +$$\rho=(|\psi\rangle\langle\psi|\otimes |\psi^\perp\rangle\langle\psi^\perp|+|\psi^\perp\rangle\langle\psi^\perp|\otimes |\psi\rangle\langle\psi|)/2$$ +and +$$\sigma=|\psi^\perp\rangle\langle\psi^\perp|\otimes |\psi^\perp\rangle\langle\psi^\perp|.$$ +Now you have +$$ +\langle\psi|\rho_r-\sigma_r|\psi\rangle=\frac12, +$$ +which is more or less as far away as you can get.

+",1837,,1837,,7/13/2020 7:16,7/13/2020 7:16,,,,4,,,,CC BY-SA 4.0 +12877,2,,12868,7/13/2020 7:03,,5,,"

As Michele Amoretti correctly says, Quantikz is built on top of Tikz. It cannot do anything that Tikz cannot. It is simply intended to provide a wrapper that makes it more convenient for doing the specific tasks associated with drawing quantum circuits.

+

More specifically, it's done in a way that I find most convenient (as the package author!). Mostly it came about because I'm writing a text book which contains hundreds of circuit diagrams, and I needed that convenience, but knowing that Tikz does a beautiful job of graphics in LaTeX.

+",1837,,2293,,7/13/2020 14:20,7/13/2020 14:20,,,,0,,,,CC BY-SA 4.0 +12878,2,,12785,7/13/2020 7:10,,3,,"

I think the simplest way to think about this (inspired by Mark S's answer) is simply to acknowledge that with a series of slits, you'd get the correct interference pattern with a single photon. But to do an $n$-qubit computation, you need a Hilbert space of dimension $2^n$, which you're encoding in a path. In other words, you need $2^n$ possible paths. So, immediately, you need exponentially scaling resources, meaning that you cannot get a speed-up over classical.

+",1837,,,,,7/13/2020 7:10,,,,0,,,,CC BY-SA 4.0 +12879,1,12881,,7/13/2020 12:30,,1,59,"

On page 547 of N&C, for $|\psi_{0}\rangle=|0\rangle$ and $|\psi_{1}\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$ and for $|\tilde{0}\rangle=\cos(\pi/8)|0\rangle+\sin(\pi/8)|1\rangle$ and $|\tilde{1}\rangle=-\sin(\pi/8)|0\rangle + \cos(\pi/8)|1\rangle$, that $|\langle\tilde{0}|\psi_{k}\rangle| = \cos(\pi/8)$ and $|\langle\tilde{1}|\psi_{k}\rangle| = \sin(\pi/8)$ for k = $\{0,1\}$. I just don't see how this can be the case for either of them.

+

I get $\cos(\pi/8)$ and $\cos(\pi/8)/\sqrt{2}+\sin(\pi/8)\sqrt{2}$ for $|\langle\tilde{0}|\psi_{k}\rangle|$ and for $|\langle\tilde{1}|\psi_{k}\rangle|$ I get $-\sin(\pi/8)$ and $-\sin(\pi/8)/\sqrt{2}+\cos(\pi/8)/\sqrt{2}$.

+

The inner product only produce these for $|\psi_{0}\rangle$. Is this a typo, and what they mean to say is that the inner product $|\langle\tilde{0}|\psi_{k}\rangle|$ is much larger than $|\langle\tilde{1}|\psi_{k}\rangle|$. But even in this case, that isn't completely true, as it's only just larger in the case of $|\langle\tilde{1}|\psi_{k}\rangle|$

+

For context, $|\tilde{0}\rangle$ and $|\tilde{1}\rangle$ come from the spectral decomposition of the density operator representing the source that generates $|\psi_{0}\rangle$ and $|\psi_{1}\rangle$ with probability a half for each.

+

What am I missing here? It seems like a simple inner product should be used but I can't get their results.

+",4991,,55,,9/30/2020 3:52,9/30/2020 3:52,Confused regarding explanation of Schumachers compression in N&C,,1,0,,,,CC BY-SA 4.0 +12881,2,,12879,7/13/2020 15:27,,2,,"

You're missing a bit of algebraic trickery. Remember that $\frac{1}{\sqrt{2}}=\sin(\pi/4)=\cos(\pi/4)$. Thus, +$$ +\cos(\pi/8)/\sqrt{2}+\sin(\pi/8)/\sqrt{2}=\cos(\pi/8)\cos(\pi/4)+\sin(\pi/8)\sin(\pi/4)=\cos(\pi/4-\pi/8)=\cos(\pi/8) +$$ +by the double angle formula.

+

Also, be careful of signs. It might be an amplitude is $\pm\sin(\pi/8)$, but when you take the modulus, that becomes $\sin(\pi/8)$.

+",1837,,,,,7/13/2020 15:27,,,,1,,,,CC BY-SA 4.0 +12882,2,,12857,7/13/2020 15:41,,2,,"

The other answer already uses this, but just to make the general fact more explicit: if $\mathcal E=\mathcal E_A\circ\mathcal E_B$, that is, $\mathcal E(\rho)=\mathcal E_A(\mathcal E_B(\rho))$, and the Kraus decompositions of the single channels read +$$\mathcal E_A(\rho)=\sum_a A_a\rho A_a^\dagger, +\qquad \mathcal E_B(\rho)=\sum_b B_b\rho B_b^\dagger,$$ +then +$\mathcal E(\rho)=\sum_{a,b} C_{ab}\rho C_{ab}^\dagger$, +where $C_{ab}\equiv A_a B_b$ are the Kraus operators of the combined channel.

+",55,,,,,7/13/2020 15:41,,,,0,,,,CC BY-SA 4.0 +12883,2,,12872,7/13/2020 17:19,,2,,"

Apparently, the specific question posed here has been answered in the affirmative--at least (first, we point out) through numerical means--by +Arsen Khvedelidze and Ilya Rogojin in Table 2 of their 2018 paper, +"On the Generation of Random Ensembles of Qubits and Qutrits: Computing Separability Probabilities for Fixed Rank States" ArsenIlya

+

They report a Hilbert-Schmidt separability probability of zero for the rank-2 two-qubit states--based on the complex Ginibre-ensemble randomization procedures they detail in the paper. Also, in Table 1, they give a full-rank two-qubit HS separability probability of 0.2424, agreeing to the given number of places with the well-supported, presumed +exact value of $\frac{8}{33} \approx 0.24242424...$.

+

In Table 2, however, they give for the rank-3 two-qubit states, a HS separability probability of 0.1652, which seems in rather substantial disagreement with a value of $\frac{4}{33} \approx 0.121212...$, based on the application of the noted theorem of Szarek, Bengtsson and Zyczkowski to the $\frac{8}{33}$ assertion.

+
+

A formalized theorem regarding this rank-2 two-qubit question would still seem of significant interest. Khvedelidze and Rogojin state that their result is consistent with the assertions in RuskaiWerner. Upon the first submission of this answer, I had not perceived that the specific question posed here was fully addressed there.

+

However, I now see that their

+

$\bf{Corollary}$ ${4}$. If a state $\gamma_{AB}$ on $\bf{C}_2 \otimes \bf{C}_2$ has rank 2, then $γ_{AB}$ is almost surely entangled

+

leads to an affirmative answer to the question put.

+

Also, to similar effect, their

+

$\bf{Theorem}$ $\bf{9}$. Assume $d_A \geq 􏰅d_B \geq 􏰅2$. If a state $\gamma_{AB}$ on $M_{d_A} \otimes M_{d_B}$ has rank $\gamma_{AB} 􏰄\leq d_{A}$, then +$\gamma_{AB}$ is almost surely entangled.

+",3089,,3089,,7/14/2020 15:11,7/14/2020 15:11,,,,2,,,,CC BY-SA 4.0 +12884,1,,,7/13/2020 17:39,,4,522,"

Can someone explain what is the threshold and the pseudo threshold of a Quantum Error Correction Code , for instance the 9-qubit code, and how to calculate it using the stabilizer formalism simulation .

+

I'm familiar with quantum information and quantum circuit and beginners to quantum error correction codes, when i studied the Shor's 9-qubit code and my supervisor asked me to calculate the pseudo-threshold of the 9-qubit code using stabilizer formalism, I didn't found any simple explanation to initiate my research, all I found is related with fault tolerance

+",2752,,55,,9/30/2020 3:52,9/30/2020 3:52,What is the pseudo threshold of a QECC using stabilizer formalism,,2,2,,,,CC BY-SA 4.0 +12885,2,,12846,7/13/2020 18:02,,4,,"

I have found the solution! The problem is that each time you use the transpile function, it generates a different transpiled circuit and the order of the outcome is not necessary the same as the order of the input, so you have to use swap gates to obtain the correct one. In order to always obtain the same circuit you have to fit the seed_transpiler (as with any random seed).

+",9887,,,,,7/13/2020 18:02,,,,0,,,,CC BY-SA 4.0 +12886,1,,,7/13/2020 19:04,,2,153,"

I lost a private key for an ethereum wallet. While seeking for information I found out that only quantum computers can decrypt a public key. Is this really a possibility? Thanks in advance.

+",12656,,,,,7/13/2020 22:26,Can quantum computing help to recover a lost private key?,,1,0,,,,CC BY-SA 4.0 +12887,2,,12859,7/13/2020 19:19,,0,,"

On paper I think this a cool idea. Though the terms you are using like cost threshold, cost function, and weights will all have to be transformed. Classically this a well thought out idea and then to ask "If done on classical can I just tweak a few things and make them quantum?" is an awesome idea. The terms you used must be extended to the quantum system you are using. Lets say your neural network outputs unique binary strings which represent each of the qubits state. Ok, from here now we must figure out which sort of quantum algorithm to use on our qubits to find a 'quantum' cost, then we keep this information and for every box that takes in qubits you must find a quantum algorithm to emulate the problem solving done classically. Luckily, quantum optimization is a blossoming field and there have been very cool papers recently, I suggest a google on search on quantum optimization and quantum machine learning. One last thought: will this system be more efficient than the classical system and produce better results?

+

Word of advice that was once passed on to me on the subject of quantum computing: The quantum computer breaks all intuition that classical computers have given us, it is best to leave this classical intuition at the door and observe these quantum algorithms like a baby.

+

Essentially it will be easier to start with a quantum system and translate it's power over to classical computing. It is much harder to start with a classical idea and translate it over to quantum, not that it cannot be done, but rather in terms of optimizing your own time and resources to go from classical to quantum is like finding a needle in a haystack.

+",12239,,12239,,7/13/2020 19:45,7/13/2020 19:45,,,,0,,,,CC BY-SA 4.0 +12888,1,12889,,7/13/2020 19:51,,3,211,"

Curious to understand if I run for loop within a quantum algorithm, and lets say I want the quantum algorithm to run in classical run time of O(1). Can this be done?

+",12239,,491,,7/17/2020 23:27,9/17/2020 23:10,Is running a for loop faster on a quantum computer than a classical computer?,,1,0,,,,CC BY-SA 4.0 +12889,2,,12888,7/13/2020 21:00,,5,,"

No, quantum computers can't run for-loops faster in general.

+

There are certain specific tasks that can be done using a for-loop that can instead be done in a different way on a quantum computer, with fewer total operations. For example, Grover search can replace the loop for x in range(N): if predicate(x): y = x with something that uses $O(\sqrt{N})$ calls to predicate instead of the $N$ that the for loop is using.

+",119,,,,,7/13/2020 21:00,,,,0,,,,CC BY-SA 4.0 +12890,2,,12886,7/13/2020 22:26,,4,,"

Welcome to QCSE! Sorry, but it's not possible. Quantum computers are not yet powerful enough to assist in any meaningful decryption. Currently available quantum chips, which are generally less than 100 qubits, are many orders of magnitude to small for this task.

+

There are several other more technical reasons that this is impossible with the current state of technology as well. If it were possible, any system relying on ECDSA would be vulnerable fraudulent signatures.

+

However, most wallets have a backup phrase to allow an owner to recover lost private keys. That would be a much more productive route to pursue than trying to break ECDSA with today's quantum computers.

+",8623,,,,,7/13/2020 22:26,,,,0,,,,CC BY-SA 4.0 +12891,2,,9320,7/14/2020 0:33,,3,,"

Ancilla-free solution: replace the two controlled-SWAPs in the "summary update" of Craig Gidney's solution with controlled-$Z$s between the second and fourth qubits in the diagram, and remove the third qubit.

+

(That is, instead of swapping $|-\rangle$ with a $|+\rangle$ state stored in the second register, conditioned on $|q\rangle$ being set to 1, conditionally change $|-\rangle$ to $|+\rangle$ directly using controlled-$Z$.)

+",11984,,,,,7/14/2020 0:33,,,,0,,,,CC BY-SA 4.0 +12892,1,,,7/14/2020 0:45,,5,93,"

One of the main steps in Hybrid Quantum algorithms for solving Combinatorial Optimization problems is the calculation of the expected value of a hermitian operator $H = \sum{H_i}$ (where $H_i$ are products of Pauli Matrices on a subset of the qubits) constructed from the structure of the optimization function $C(z)$ with respect to some parametrized state $\newcommand{\ket}[1]{\lvert#1\rangle}\ket{\theta}$.

+

As far as I've read, in practice one of the main procedures in calculating this expectation value is through sampling, where you basically measure $\ket{\theta}$ on the computational basis and use the proportions of observed outcomes as the probability of each solution and then evaluating $C(z)$ on each outcome (https://qiskit.org/textbook/ch-applications/qaoa.html).

+

Wouldn't this procedure be infeasible when $n$ grows too big? If anyone knows of other alternatives it would be greatly appreciated

+",12302,,55,,7/14/2020 8:49,7/14/2020 8:49,Computing the expectation values of a Hamiltonian constructed from a cost functions in combinatorial optimization,,0,2,,,,CC BY-SA 4.0 +12895,1,12896,,7/14/2020 9:46,,1,134,"

+$\qquad$ +$\qquad$

+

What is the difference between solid and hollow? How to express the corresponding matrix of these figures? In addition, if they are not adjacent, what should be done in the middle of several qubits (such as in more than 3 qubits)

+",12658,,491,,7/17/2020 23:24,7/17/2020 23:24,How does the graphical notation used to denote doubly-controlled gates work?,,1,0,,,,CC BY-SA 4.0 +12896,2,,12895,7/14/2020 10:45,,4,,"

The black (white) dot means a condition that the corresponding qubit should be in $|1\rangle$ state ($|0\rangle$ state) in order to apply the gate. The first circuit implements the Hadamard gate only if the first qubit is in $|1\rangle$ state and the second qubit is in $|0 \rangle$ state (similar discussions can be found here). In other words, if the combined state of the first two qubits is $|10\rangle$ the $H$ gate is applied, otherwise, we apply $I$ (nothing). Mathematically it looks like this:

+

$$\begin{align}C_{B}C_{W}\_H =& |00\rangle\langle 00| \otimes I + |01\rangle\langle 01| \otimes I + |10\rangle\langle 10| \otimes H + |11\rangle\langle 11| \otimes I\\ =& |10\rangle\langle 10| \otimes H + (I-|10\rangle\langle 10|)\otimes I,\end{align}$$

+

where $C_{B}$ is denoted here as the control with a black dot and $C_{W}$ is the control with a white dot. By taking this into account the corresponding matrix will look like this:

+

$$C_{B}C_{W}\_H = +\begin{pmatrix} +1&0&0&0&0&0&0&0 \\ +0&1&0&0&0&0&0&0 \\ +0&0&1&0&0&0&0&0 \\ +0&0&0&1&0&0&0&0 \\ +0&0&0&0&1/\sqrt{2}&1/\sqrt{2}&0&0 \\ +0&0&0&0&1/\sqrt{2}&-1/\sqrt{2}&0&0 \\ +0&0&0&0&0&0&1&0 \\ +0&0&0&0&0&0&0&1 \\ +\end{pmatrix} +$$

+

The matrixes for the other two gates can be constructed in a similar way. Here is an answer about not adjacent controlled gates. Note that for $n$ qubit gate we will need $2^n \times 2^n$ matrices, so it is not always convenient to use matrices.

+",9459,,104,,7/14/2020 19:17,7/14/2020 19:17,,,,4,,,,CC BY-SA 4.0 +12898,1,12907,,7/14/2020 15:27,,1,402,"

Suppose we have a 3-qubit input; each bit is either 0 or 1. How to decide if there are more 1's than 0's? Only 1 extra qubit may be used for the output. (Yes I know this can be achieved using 3 Toffoli gates, but can it be done without Toffoli gates?)

+

Now suppose we have an answer to the above question, then, how to extend the above circuit to deal with a 5-qubit input?

+",12662,,491,,7/17/2020 23:32,7/17/2020 23:32,How to construct quantum circuit to count number of 0-qubits and 1-qubits,,1,3,,,,CC BY-SA 4.0 +12899,1,12900,,7/14/2020 17:55,,2,65,"

I've recently tried to build a Random generator using 5 hadamard gates (shown as U2 below) measured to 5 classical bits in parallel as shown in the circuit image. +

+

I've executed this circuit for 8192 shots (and repeated this many times) hoping to get somehow flat histogram of every of 32 possible states. Yet, instead i've found that probability decreases in almost linear fassion from |00000> -> |11111> which is bizare. I'm very new to quantum computing - could someone explain me why there is visible such strong linear dependence? +Or maybe this is expected, but why?

+

What I tried up til now:

+
    +
  • I've tried to change measurment order and using/not using barrier before measurements. Everything was calculated on ibmq_burlington mashine.
  • +
  • I've also tried error mitigation (CompleteMeasFitter prepared and applied to results, with no luck - as before I can see a strong linear relation).
  • +
+

+

Can anybody help me to understand this behaviour?

+

Regards +Konrad

+",12664,,2293,,8/17/2020 2:54,8/17/2020 2:54,Randomness using simple parallel Hadamard circuit,,1,6,,,,CC BY-SA 4.0 +12900,2,,12899,7/14/2020 19:04,,5,,"

The issue is that you are using noisy hardware with imperfect operations and measurements. In particular, the most likely problem here is that after you prepare a qubit it immediately begins decaying towards the ground state $|0\rangle$ via interactions with the environment. Each qubit will be slightly more likely to be measured as 0 instead of 1 than you'd expect from a noiseless machine. Try grouping by the number of 1s in the result and the effect will stand out even more.

+

It's difficult to say for sure exactly what is going wrong. For example, given only this circuit you can't really tell if the errors are occurring during state preparation, measurement, or intermediate operations. Also, my understanding is that IBM may be modifying your circuits before executing them (e.g. inserting random bitflips to depolarize errors, or purposefully adding a bit of noise to see which results go up and then extrapolating backwards) which makes it particularly hard to assign blame to any one part of the circuit.

+",119,,,,,7/14/2020 19:04,,,,1,,,,CC BY-SA 4.0 +12901,1,12909,,7/14/2020 19:21,,3,427,"

In the textbook “Quantum Computation and Quantum Information” by Nielsen and Chuang, it is stated that there exists a set of unitaries $U_i$ and a probability distribution $p_i$ for any matrix A,

+

$$\sum_i p_i U_i A U_i^\dagger =tr(A) I/d,$$

+

where $d$ is the dimension of the Hilbert space. (This is on page 517; Exercise 11.19; equation (11.85)) The left-hand side is a Kraus representation given A.

+

But is this possible for a general non-diagonalizable (i.e. non-normal) matrix A? For a normal matrix A, I found it is indeed the case.

+",12665,,55,,9/30/2020 3:52,9/9/2022 19:29,Can a Kraus representation act as the identity on any operator?,,4,5,,,,CC BY-SA 4.0 +12902,1,,,7/14/2020 20:26,,4,278,"

I am trying to use the method of calculating the expectation values of Pauli operators in Qiskit which I found here.

+

However, the results obtained via IBMQ sampling differ significantly from the exact value, even though I perform measurement error mitigation.

+

The state, in which I am trying to calculate the expectation values, is prepared using a simple circuit

+
          ┌─────────────┐                   ┌───┐                     
+q_0: ─────┤ RY(-1.8018) ├──■────────■───────┤ X ├────────────────────
+     ┌───┐└──────┬──────┘┌─┴─┐      │       └─┬─┘                    
+q_1: ┤ X ├───────■───────┤ X ├──────┼─────────┼──────────────────────
+     └───┘               └───┘┌─────┴──────┐  │                 ┌───┐
+q_2: ─────────────────────────┤ RY(2.2489) ├──■─────────■───────┤ X ├
+                              └────────────┘     ┌──────┴──────┐└─┬─┘
+q_3: ────────────────────────────────────────────┤ RY(0.99778) ├──■──
+                                                 └─────────────┘     
+
+

which after transpiling looks as follows: +

+

For reference, for each Pauli operator I print the exact expectation value and also calculate it a few times using the QASM simulator.

+

Here's the code:

+
circuit = QuantumCircuit(4)
+circuit.x(1)
+circuit.cry(-1.80184863, 1, 0)
+circuit.cx(0,1)
+circuit.cry(2.24892942,0,2)
+circuit.cx(2,0)
+circuit.cry(0.9977846,2,3)
+circuit.cx(3,2)
+psi = CircuitStateFn( circuit )
+    
+paulis = [ Pauli([1,1,0,0],[1,1,0,0]),  Pauli([1,1,1,1],[1,0,0,1]) ]
+shots = 8000
+reps = 3   
+
+backend_qasm = qiskit.Aer.get_backend( 'qasm_simulator' )
+q_instance_qasm = QuantumInstance( backend_qasm, shots = shots )
+    
+load_account()
+provider = get_provider( hub='ibm-q' )
+backend_ibmq = least_busy( provider.backends(filters=lambda x: x.configuration().n_qubits >= 4 and not x.configuration().simulator) )
+q_instance_ibmq = QuantumInstance( backend = backend_ibmq,
+                                   shots = shots,
+                                   measurement_error_mitigation_cls = CompleteMeasFitter,
+                                   measurement_error_mitigation_shots = shots )
+print(f'IBMQ backend: {backend_ibmq}.\n')     
+
+for pauli in paulis:
+    print(f'Pauli operator: {pauli}.')
+    pauli = WeightedPauliOperator([[1., pauli]]).to_opflow()
+
+    measurable_expression = StateFn( pauli, is_measurement = True ).compose( psi )
+    expectation = PauliExpectation().convert( measurable_expression )
+
+    expect_exact = psi.adjoint().compose( pauli ).compose( psi ).eval().real
+
+    print( f'Exact expectation value: {expect_exact}.' )
+    for r in range(reps):
+        sampler_qasm = CircuitSampler( q_instance_qasm ).convert( expectation )
+        expect_sampling_qasm = sampler_qasm.eval().real
+        print( f'Exact expectation, QASM sampling: {expect_sampling_qasm}.' )
+    for r in range( reps ):
+        sampler_ibmq = CircuitSampler( q_instance_ibmq ).convert( expectation )
+        expect_sampling_ibmq = sampler_ibmq.eval().real
+        print( f'Exact expectation, IBMQ sampling: {expect_sampling_ibmq}.' )
+
+    print()
+
+

And here's the output:

+
IBMQ backend: ibmq_ourense.
+
+Pauli operator: IIYY.
+WARNING - The skip Qobj validation does not work for IBMQ provider. Disable it.
+Exact expectation value: -0.4201884924852.
+Exact expectation, QASM sampling: -0.42275.
+Exact expectation, QASM sampling: -0.4175.
+Exact expectation, QASM sampling: -0.4165.
+Exact expectation, IBMQ sampling: -0.19053720838213.
+Exact expectation, IBMQ sampling: -0.33771371840093.
+Exact expectation, IBMQ sampling: 0.14870401826006.
+
+Pauli operator: YZZY.
+Exact expectation value: 0.22895884311365.
+Exact expectation, QASM sampling: 0.237.
+Exact expectation, QASM sampling: 0.2385.
+Exact expectation, QASM sampling: 0.2345.
+Exact expectation, IBMQ sampling: 0.06862734682344.
+Exact expectation, IBMQ sampling: 0.10246703115813.
+Exact expectation, IBMQ sampling: 0.13078427261863.
+
+

Am I doing something conceptually wrong?

+

Is there an obvious way to improve the results? (except for doing more shots) Or is it what I should expect to get, given the device's gate fidelities?

+

Any thoughts/suggestions/corrections greatly appreciated.

+",8008,,2293,,8/17/2020 2:54,8/17/2020 2:54,Am I doing anything wrong when trying to calculate the expectation value in Qiskit on the real hardware?,,1,2,,,,CC BY-SA 4.0 +12903,1,,,7/15/2020 1:27,,1,36,"

In the Qiskit textbook, at step 4, Bob who has received the classical bits from Alice then needs to apply a X and/or Z gate depending on what the classical bits received are, why is that?

+",8405,,491,,7/17/2020 23:24,7/17/2020 23:24,In quantum teleportation what is the need for the extra X/Z gate after classical information is sent from Alice to Bob?,,1,0,,,,CC BY-SA 4.0 +12904,2,,12901,7/15/2020 3:06,,2,,"

This problem can be approached without regards to Kraus representations (even if the motivation is to prove the convexity of entropy) or whether A is a normal matrix or not. Rather, this is a feature of the choice of $\{ U_{j} \}$. In particular, there exists a choice such that their action is to ``coarse-grain'' all the information in a state.

+

Here's a single qubit example to illustrate my point: consider the set $p_{j} = \frac{1}{4}, U_{j} = \sigma_{j}$ for $j \in \{ 1,2,3,4 \}$, where, $\sigma_{j}$ are the Pauli matrices (with $\sigma_{0} = \mathbb{I}$). Then, its action on a single qubit is, +$$ \sum\limits_{j} p_{j} U_{j} \rho U^{\dagger}_{j} = \frac{1}{4} \left( \mathbb{I} \rho \mathbb{I} + \sigma_{x} \rho \sigma_{x} + \sigma_{y} \rho \sigma_{y} + \sigma_{z} \rho \sigma_{z} \right) = \cdots = \operatorname{Tr}\left( \rho \right) \frac{\mathbb{I}}{2},$$ +where the $\cdots$ can be evaluated using the anticommutativity of the Pauli matrices (Hint: use the relation $\sigma_{j} \sigma_{k} \sigma_{j} = - \sigma_{k}$ for $j \neq k$).

+

Now, since any matrix $A$ can be written as $A = H + iK$ for hermitian matrices $H,K$; and any hermitian matrix $H$ can be written as $H = H_{1} - H_{2}$ for positive semidefinite matrices, you can write $A = H_{1} - H_{2} + i(K_{1} - K_{2})$. Rewriting each of the matrices as $H_{1} = \operatorname{Tr}\left( H_{1} \right) (\frac{1}{\operatorname{Tr}\left( H_{1} \right)} H_{1})$, we have that $\frac{1}{\operatorname{Tr}\left( H_{1} \right)} H_{1}$ is a density matrix and so the above result applies. Continuing this, you'll find, using the linearity of trace, that for the $2 \times 2$ case, the above unitaries give you $\mathrm{Tr}(A) \frac{\mathbb{I}}{d}$.

+

The generalization to $n \times n$ matrices is left as an exercise to the OP (where you need to find a set of unitaries analogous to the Pauli matrices).

+

Edit: One way to obtain the result in $d$ dimensions is to use the $d^2$ Heisenberg-Weyl operators (or the finite dimensional representation of the Heisenberg-Weyl algebra). If $X(i)Z(j)$ is the $(i,j)$th operator then, we have, $\frac{1}{d^{2}} \sum_{i, j=0}^{d-1} X(i) Z(j) \rho Z^{\dagger}(j) X^{\dagger}(i)=\frac{\mathbb{I}}{d}$. See, for example, Page 176 of this book.

+",1108,,1108,,7/18/2020 0:53,7/18/2020 0:53,,,,2,,,,CC BY-SA 4.0 +12905,2,,12903,7/15/2020 3:49,,2,,"

Without that fixup, the state of Bob's qubit can be in any one of the states $\alpha |0\rangle + \beta |1\rangle$ (the state we actually wanted to teleport) or $\alpha |0\rangle - \beta |1\rangle$, $\beta |0\rangle + \alpha |1\rangle$ or $\beta |0\rangle - \alpha |1\rangle$ (the states we don't want to end up with). X and Z gates are applied to fix the resulting state so that it ends up in $\alpha |0\rangle + \beta |1\rangle$ - otherwise we can't count our teleportation a a success.

+",2879,,,,,7/15/2020 3:49,,,,0,,,,CC BY-SA 4.0 +12906,1,12908,,7/15/2020 6:40,,2,100,"

If I know a sparse matrix, is there any tool that allows me to get the corresponding quantum circuit directly?

+

If not what should I do?

+

For example,I want to try hamilton simulation and I have the sparse matrix. How can I get the corresponding quantum circuit? By code or by some software? Or get enough training?

+

I'm new in this field.

+

Need your help

+",12658,,491,,7/17/2020 23:31,7/17/2020 23:31,Is there a tool to get the quantum circuit corresponding to a sparse matrix?,,1,0,,,,CC BY-SA 4.0 +12907,2,,12898,7/15/2020 7:32,,3,,"

Here's a general strategy that doesn't quite fulfil the brief: for an $n$-qubit input where $n+1=2^k$, $k$ an integer (e.g. $n=3,k=2$), it uses $k$ ancilla qubits but no Toffolis. (You can do something similar if $n+1$ is not a powe of 2, but you'd need some classical post-processing and I'd have thought you might as well just measure the input qubits!)

+

The idea is to define a Hamiltonian +$$ +H=\left(\sum_{j=1}^nZ_j+nI\right)/2. +$$ +Note that this has eigenvalues $0,1,2,3,\ldots,n$ corresponding to the number of 1s in the string it's acting on. So, let $U=e^{2i\pi H/2^k}$. This is a unitary with the eigenvectors that we need. If you run a phase estimation procedure using $k$ ancilla qubits, it will exactly read out the number of 1s for you. This requires controlled-$U$, which is just a bunch of controlled-phase gates (i.e. all two-qubit gates) and the Fourier transform which, again, is two-qubit gates. Actually you only need the semi-classical Fourier transform, so it's just one-qubit gates with feed-forward of measurement results.

+

So, once you know who many 1s there are, you can classically process that to decide if it's greater than $n/2$. In the case of $n+1$ being a power of 2, this is particularly simple. You just look at the bit representation of the output, and the most significant bit will give you the answer. So, this would be the only qubit you would need to measure. (Note that this is the last bit output by the Fourier transform, not the first).

+",1837,,,,,7/15/2020 7:32,,,,6,,,,CC BY-SA 4.0 +12908,2,,12906,7/15/2020 8:22,,2,,"

Concerning Hamiltonian simulation, you can find very useful guide in this question.

+

General approach to quantum circuit construction is explained in paper Elementary gates for quantum computation.

+

Also paper Optimal Quantum Circuits for General Two-Qubit Gates can be helpful.

+",9006,,,,,7/15/2020 8:22,,,,0,,,,CC BY-SA 4.0 +12909,2,,12901,7/15/2020 9:05,,2,,"
    +
  1. (Orthonormal operatorial bases and their completeness) The main thing to keep in mind is that this is a result about a type of channel, not about specific states. Suppose $\operatorname{tr}(U_i U_j^\dagger)=\delta_{ij}$ for some set of matrices $U_i$. +This is equivalent to $\sum_{k\ell}(U_i)_{k\ell} (U_j^*)_{k\ell}=\delta_{ij}$. +If $U_i$ form a basis (i.e. there are $n^2$ of them), then we must also have +$\sum_i (U_i)_{k\ell} (U_i^*)_{mn}=\delta_{km}\delta_{\ell n}$.

    +

    For such choice of matrices we have, for any matrix $\rho$, +$$\sum_i U_i \rho U_i^\dagger += \sum_{ijk \ell m} \lvert j\rangle\!\langle k\rvert\,\, (U_i)_{j\ell}(U_i^*)_{km} \rho_{\ell m} += \sum_{jk\ell m} \lvert j\rangle\!\langle k\rvert\,\, \delta_{jk} \delta_{\ell m}\rho_{\ell m} +\\= \sum_{j\ell} \lvert j\rangle\!\langle j\rvert \,\, \rho_{\ell\ell} = \operatorname{tr}(\rho) I. $$

    +

    Notice how the identity does not depend on what $\rho$ is. It can be an arbitrary operator. You can test it yourself with a nondiagonalisable matrix such as $\rho=\begin{pmatrix}0&1\\0&0\end{pmatrix}$. It is a statement about the mapping $\rho\mapsto \sum_i U_i \rho U_i^\dagger$, not about $\rho$.

    +

    Notice also that I did not use any assumption on the $U_i$. They need not be unitaries (indeed, they cannot be unitaries in my choice of normalisation). To get the same factor on the RHS, you need only modify the normalisation of the matrices to have $\operatorname{tr}(U_i U_j^\dagger)=\delta_{ij}/d$, and the rest follows.

    +
  2. +
  3. (Choi representation of completely depolarising channel) +Consider the linear map $\Phi(X)=\operatorname{tr}(X) I/d$. You can verify that it is a CPTP map and thus admits a Kraus decomposition.

    +

    Its natural representation reads $K(\Phi)=|m\rangle\!\langle m|$, or in components, $K(\Phi)_{ij,k\ell}=\delta_{k\ell}\delta_{ij}/d$, with $|m\rangle$ the maximally entangled state. +The Kraus decomposition is then obtained as the spectral decomposition of the operator mapping $j\ell$ to $ik$. We thus want the spectral decomposition of the Choi operator $$J(\Phi)\equiv (\Phi\otimes I) (d\lvert m\rangle\!\langle m\rvert)=\frac1 d I\otimes I\equiv I/d.$$

    +
  4. +
  5. (Eigendecomposition of Choi representation) The eigendecomposition of this operator is trivial: its eigenvalues are all equal to $1/d$, thus any orthonormal set of vectors will be a suitable set of eigenvectors. Write these as $\newcommand{\bs}[1]{\boldsymbol{#1}} \{\bs v_a\}_a$, so that $J(\Phi)\bs v_a=\frac1 d \bs v_a$ for all $a=1,...,d^2$. +In terms of the natural representation, these satisfy +$$\sum_{j\ell} K(\Phi)_{ij,k\ell}(\bs v_a)_{j\ell} = \frac1 d(\bs v_a)_{ik} +\Longleftrightarrow K(\Phi) = \frac1 d \sum_a \bs v_a \otimes \bs v_a^\dagger.$$ +$$K(\Phi)_{ij,k\ell}=\frac1 d\sum_a (\bs v_a)_{ik}(\bs v_a^*)_{j\ell}.$$ +Defining the operators $A_a$ as $(A_a)_{ij}\equiv (\bs v_a)_{ij}$, or equivalently, $\operatorname{vec}(A_a)=\bs v_a$, we get the Kraus decomposition +$$\Phi(X) = +\operatorname{unvec}\Big(\underbrace{\frac{1}{d}\sum_a (A_a \otimes \bar A_a)}_{\equiv K(\Phi)}\operatorname{vec}(X)\Big) = +\frac{1}{d}\sum_a A_a X A_a^\dagger. $$ +Note that the orthogonality of the vectors $\bs v_a$, $\langle \bs v_a,\bs v_b\rangle=\delta_{ab}$, translates into the orthogonality of the matrices $A_a$ in the $L_2$ norm: $\langle A_a, A_b\rangle\equiv\operatorname{tr}(A_a^\dagger A_b)=\delta_{ab}$. +Note also that here $\{A_a\}_a$ are not the Kraus operators of the channel: in the standard notation, the Kraus operators are the renormalised operators $\{\frac{1}{\sqrt d}A_a\}_a$.

    +
  6. +
+

(Finding Kraus decompositions made up of unitaries) In the above, $A_a$ are not unitaries. However, the freedom in the choice of vectors $\bs v_a$, or equivalently the freedom in the choice of $A_a$, can be used to find a decomposition in terms of Kraus operators that are (proportional to) unitaries. +A basis of unitaries can be constructed e.g. using clock and shift matrices. Have a look at (Durt 2010), around page 10, and these nice notes by Wheeler (pdf alert), around page 12.

+",55,,55,,9/9/2022 19:29,9/9/2022 19:29,,,,2,,,,CC BY-SA 4.0 +12910,2,,12901,7/15/2020 9:38,,2,,"

If it holds for hermitian matrices, it holds for all matrices due to linearity: Over $\mathbb C$, the hermitian matrices span the full matrix space.

+",491,,,,,7/15/2020 9:38,,,,0,,,,CC BY-SA 4.0 +12912,2,,12902,7/15/2020 14:10,,3,,"

I tried to run your code with the same backend as you, ibmq_ourense, and also got the same kind of bad results. Although, I also tried on other backends, first the ibmq_qasm_simulator and I got the exact expectation value, so I assume there is no bug on your code since it is right with the ideal machine. I also tried with ibmq_vigo, which has a better quantum volume than ibmq_ourense(16 vs 8), and I got much better results, closer to the exact expected value.

+

You could try the "obvious ways" to get better results as you mentioned in your question, maybe looking at the different levels of optimization in the transpile function might help, see the documentation and a tutorial from Qiskit to check how you can play with this!
+Finally running your code on a device with a higher quantum volume leading to less noise thus better results might be another way around the errors!

+

Hope this will help you, feel free to ask any other thing :)

+",12396,,,,,7/15/2020 14:10,,,,1,,,,CC BY-SA 4.0 +12913,1,,,7/15/2020 14:43,,2,100,"

Given the state of a system as $\rho_s$ and that of the ancilla (pointer) as $\rho_a$, the Von-Neumann measurement involves entangling a system with ancilla and then performing a projective measurement on the ancilla. This is often represented as +$$[\mathcal{I} \otimes P_i] U(\rho_s \otimes \rho_a)U^{-1} [\mathcal{I} \otimes P_i],$$ +where $\mathcal{I}$ is the identity on system space, $P_i$ is the projector corresponding to $i$-th outcome, and $U$ is the combined unitary.

+

My question: How to choose the form of $U$?

+",8290,,55,,4/27/2022 7:52,4/27/2022 7:52,"Representing a von Neumann measurement as $[\mathcal{I} \otimes P_i] U(\rho_s \otimes \rho_a)U^{-1} [\mathcal{I} \otimes P_i]$, how do we choose $U$?",,0,5,,,,CC BY-SA 4.0 +12914,1,12915,,7/15/2020 18:47,,3,80,"

Is there any relation between the Wigner quasi-probability distribution function $W$ and the statistical second-moment (also known as covariance matrix) of a density matrix of a continuous variable state, such as Gaussian state?

+",10371,,16606,,5/23/2022 8:51,5/23/2022 8:51,Relation between Wigner quasi-probability distribution and statistical second-moment,,1,0,,,,CC BY-SA 4.0 +12915,2,,12914,7/15/2020 19:36,,3,,"

You mean something like +$$W_{G}(\mathbf{r}) =\frac{2^{n}}{\pi^{n} \sqrt{\operatorname{Det} \sigma}} \mathrm{e}^{-(\mathbf{r}-\overline{\mathbf{r}})^{\top} \boldsymbol{\sigma}^{-1}(\mathbf{r}-\overline{\mathbf{r}})},$$ +where $W_{G}(\mathbf{r})$ is the Wigner function corresponding to a Gaussian state, $\mathbf{\sigma}$ its covariance matrix, and $\overline{r}$ the vector of first moments?

+

If yes, then, see, for example, Eqn. (4.50) of Quantum Continuous Variables.

+",1108,,,,,7/15/2020 19:36,,,,2,,,,CC BY-SA 4.0 +12916,1,16296,,7/15/2020 22:50,,8,424,"

In all the cold quantum computer designs (superconducting qubits, spin qubits) attenuators are put on the driving lines. Their role is to kill the noise spectral density that comes from higher temperature stages, such as the Johnson-Nyquist noise. Indeed the pulses are generated at high temperature and may contain a lot of noise that is required to be killed.

+

My question is simple: Why do people put attenuators which dissipate a lot of heat, and not simply filters? Indeed the goal is to kill the noise at qubit frequencies. Filter that do not let pass this frequency would be enough and can not be dissipative.

+

[edit2]: Actually to be safe we should reflect signal at all frequencies to mimic an attenuator. A two port device would be problematic as it would I think reflect signal coming from the lab to the qubit (left port), but also signal coming from qubit (which is a problem if we want to drive). In this case I guess a 3-port device would work.

+",5008,,5008,,3/2/2021 9:28,4/16/2021 21:05,Why attenuator and not filters for QC driving line,,2,0,,,,CC BY-SA 4.0 +12917,1,12927,,7/15/2020 23:29,,6,619,"

Given a quantum channel (CPTP map) $\Phi:\mathcal X\to\mathcal Y$, its adjoint is the CPTP map $\Phi^\dagger:\mathcal Y\to\mathcal X$ such that, for all $X\in\mathcal X$ and $Y\in\mathcal Y$, +$$\langle Y,\Phi(X)\rangle= \langle \Phi^\dagger(Y),X\rangle,$$ +where $\newcommand{\tr}{\operatorname{tr}}\langle X,Y\rangle\equiv \tr(X^\dagger Y)$.

+

For example, if $\Phi$ is the trace map, $\Phi(X)=\tr(X)$, then $\Phi^\dagger(\alpha)=\alpha I$ for $\alpha\in\mathbb C$, as follows from +$\langle \alpha,\Phi(Y)\rangle = \tr(Y) \alpha^* = \langle \Phi^\dagger(\alpha),Y\rangle$.

+

Another example is the partial trace map. If $\Phi(X)\equiv\tr_2(X)$, then $\Phi^\dagger(Y)=Y\otimes I$.

+

Is there any general physical interpretation for the adjoint channel?

+",55,,55,,7/16/2020 15:37,7/16/2020 23:39,What does the adjoint of a channel represent physically?,,3,0,,,,CC BY-SA 4.0 +12918,1,12920,,7/16/2020 5:57,,2,144,"

I found an answer that shows how to detect the phase in cases like $0$, $\pi/8$, $\pi/2$, $\pi/4$ or $\pi$ for circuit to prepare state as H P, where P is a phase gate like $I$, $U1(\pi/8)$, $S$, $T$ or $Z$.

+

But in my case the circuit to prepare state is $X H P$, where $P$ is $X$ gate (conditionally phase $\pi$) or $ID$ (conditionally phase 0).

+

This circuit in Qasm with conditionally phase equal to $\pi$:

+
x q[0];
+h q[0];
+x q[0];
+
+

with conditionally phase equal to $0$:

+
x q[0];
+h q[0];
+id q[0];
+
+

Appending $H$ gate (as in the above answer) don't detect a difference for conditionally phase $\pi$ and phase $0$ (but does detect for phases $\pi/2$, $\pi/4$, $\pi/8$ if $P$ is $S$, $T$, $U1(\pi/8)$, respectively).

+

Is it possible to detect the conditionally phase $P$ $\pi$ or 0 for this circuit to prepare state?

+",12416,,491,,7/17/2020 23:40,12/2/2022 11:32,Is it possible to detect the phase $\pi$ or 0 for the single qubit circuit X H P?,,1,1,,,,CC BY-SA 4.0 +12919,1,,,7/16/2020 6:47,,1,211,"

I am learning how to make Grover's algorithm but the last cx gate needs to be the opposite way around. It always makes the top qubit the control, so how do you turn it around?

+",12676,,55,,7/20/2020 12:36,7/20/2020 12:36,How do you turn the CX gate upside down on ibm-q-experience?,,2,0,,,,CC BY-SA 4.0 +12920,2,,12918,7/16/2020 6:58,,1,,"

I think unlike the relative phase in the answer you reference, it is a global phase in your case:

+

Your XHP-circuit where P=ID, prepares the state: [0.707+0j,-0.707+0j], where P=X, prepares the state: [-0.707+0j, 0.707+0j]. +These states are differ by a global phase ${e}^{i\pi}=-1$.

+

But the global phase is undetectable $|ψ⟩:={e}^{iδ}|ψ⟩$, also see the answer.

+",12280,,12280,,7/16/2020 15:41,7/16/2020 15:41,,,,3,,,,CC BY-SA 4.0 +12921,2,,12919,7/16/2020 6:59,,5,,"

If you click the CX gate itself, it will be surrounded by a dashed box with a pen symbol in the top right corner.

+

+

If you click this pen you can choose which qubit is the target and which is the control by drag-and-drop.

+

+",9800,,,,,7/16/2020 6:59,,,,0,,,,CC BY-SA 4.0 +12922,1,,,7/16/2020 8:08,,5,77,"

Suppose you are given two circuit descriptions $A$ and $B$ where by a circuit description I mean a sequence of gates (in the order they are applied) and the qubits they are applied on. (For the sake of simplicity lets have the number of qubits fixed to $n$ and the circuit is measured in the computational basis).

+

Are there techniques to check from the circuit descriptions $A,B$ that the sampled output probability distributions induced by the computational basis measurements are

+
    +
  • a) equal

    +
  • +
  • b) more interesting to me: $\epsilon$-close in total variation distance

    +
  • +
+

Even more ambitious, are there results about the complexity of this task? Are there such results for classical boolean circuits?

+

To clarify, if the circuit descriptions would only differ in the sequence of gates and not otherwise, i.e. each gate is replaced by a different gate but the positions of the gates in the circuit (the architecture) are the same in $A,B$, then it is known that operator norm errors $||U_j-V_j||=\epsilon_j$ of the individual gates just add up.

+

A "brute-force" way to solve this question is of course to classically simulate the output states of both circuits (by say a tensor network contraction) and compare those but this is certainly exponential time, so I am looking for smarter approaches.

+",5322,,5322,,7/16/2020 9:07,12/2/2022 9:05,Equivalence checking of quantum circuits up to error,,1,2,,,,CC BY-SA 4.0 +12923,1,,,7/16/2020 10:49,,2,144,"

I am trying to implement a Grassmann algebra in Python and was wondering if anyone could recommend any packages or suggest how to do so?

+

I want to define the following multiplication rules over $\Bbb{C}^{2n}$ with standard basis vectors $e_j$ via $$e_j^2=0 \text{ and the anti-commutation rule } e_ie_j+e_je_i=0$$ +I then plan on defining an exponential function of quadratic terms in these basis vectors in a way that respects the relations above, ie $\exp{(ie_ae_b)}$, via the power series definition.

+

I would be very grateful for any suggestions on how to program this!

+",12678,,,,,7/16/2020 10:49,Defining a Grassmann Algebra in Python,,0,3,,,,CC BY-SA 4.0 +12924,2,,12769,7/16/2020 13:23,,3,,"

As mentionned by Michele, with qiskit Aqua algorithms you can easily implement Grover or BV. Here below an example of BV algorithm. Note that the number of qubits is directly related to the size of the hidden number (and so the size of the Oracle). +You can easily create Oracle from a thruthtable or logical expression.

+
 from qiskit import *
+ import matplotlib.pyplot as plt
+ from qiskit.aqua import QuantumInstance
+ from qiskit.aqua.algorithms import BernsteinVazirani
+ from qiskit.aqua.components.oracles import TruthTableOracle, LogicalExpressionOracle
+
+ # Set the secret number 
+ s='110111' # The secret number
+ # Create the thruthTable. 
+ truth_table_str=''
+ print('The Truthtable corresponding to the oracle is:','\n')
+ for i in range(2**len(s)):
+    var=sum(list(map(int, list(bin(int(s,2) & i)[2:])))) % 2
+    print('s.',format(i, '0{}b'.format(len(s))) ,var)
+    truth_table_str += str(var)
+
+ # Pass the bistring of the oracle in the TruthTable oracle function with optimization=True to generate the oracle circuit
+ oracle = TruthTableOracle(truth_table_str, optimization=True, mct_mode='advanced')
+
+ # Set the backend to qasm_simulator
+ backend = Aer.get_backend('qasm_simulator')
+
+ # Create the BernsteinVazirani circuit
+ bv = BernsteinVazirani(oracle, backend)
+
+ # you can draw the overall circuit 
+ full_circuit = bv.construct_circuit(measurement=True)
+ full_circuit.draw()
+
+

+",9934,,,,,7/16/2020 13:23,,,,0,,,,CC BY-SA 4.0 +12925,1,,,7/16/2020 16:39,,2,218,"

I have a very basic question. I have found qubits are represented as complex vectors. I get it totally. I understand bracket notation and vector\matrix algebra. However, I cannot move further from here. It is often referred like the equation below.

+

$$ +|+\rangle=\frac{1}{\sqrt{2}} ( |0\rangle+ |1\rangle) +$$

+

$$ +|-\rangle=\frac{1}{\sqrt{2}} ( |0\rangle- |1\rangle) +$$

+

My questions are:

+
    +
  1. Why is divided by $\frac{1}{\sqrt{2}} $ ?
  2. +
  3. What does this symbol mean $|+\rangle$, $|-\rangle$? I understand what $|0\rangle$ and $|1\rangle$ means.
  4. +
+",12682,,491,,7/17/2020 23:21,7/18/2020 7:02,Why do we divide by $\sqrt2$ in the qubit states $\lvert\pm\rangle=\frac{1}{\sqrt2}(\lvert0\rangle\pm\lvert1\rangle)$?,,2,0,,,,CC BY-SA 4.0 +12926,2,,12925,7/16/2020 17:03,,4,,"

#1: the $1/\sqrt{2}$ is a normalization which ensures that the ``length'' of the vector is one.

+

#2: The notation $|\pm\rangle$ is just a label for the two states defined above. Since the states $|0\rangle, |1\rangle$ are elements of a vector space, you can take linear combinations and therefore construct the states $|\pm\rangle$

+",1108,,,,,7/16/2020 17:03,,,,2,,,,CC BY-SA 4.0 +12927,2,,12917,7/16/2020 21:35,,9,,"

The adjoint of a channel $\Phi$ represents how observables transform (in the Heisenburg picture), under the physical process for which $\Phi$ is the description of how states transform (in the Schrödinger picture). So, in particular, the expected value of a measurement of the observable $E$ on a state $\Phi(\rho)$ is equivalent to the expected value of the observable $\Phi^\dagger(E)$ on the state $\rho$.

+",124,,,,,7/16/2020 21:35,,,,0,,,,CC BY-SA 4.0 +12928,1,,,7/16/2020 21:58,,7,275,"

From what I gather, communication is not possible with quantum mechanics. With the experiment on teleportation, entanglement is referred to as coordination and not communication. However, my belief is that communication is taking place. For example, given if a qubit has more information than a bit, this will mean that after Alice entangles/sends the qubit and prior to Bob measuring it, information is communicated. Am I missing something?

+
+

Yes. I have studied superdense coding. I also understand about the 2 classical bits. Let me add clarity to my question. Alice has a qubit which is sent to Bob. The qubit is not a regular bit and it contains more information than a bit. So, at the end of the day, Bob ends up receiving a qubit. And what I was saying in my original question, let's assume Bob does not read it but rather uses this qubit in a circuit. Hence, Bob is able to harness the information of a qubit which contains more information than regular classical bits. Hence, I see that communication of information is taking place. Is there something I am missing and/or can I clarify further my question. Thank you!

+",8214,,55,,6/5/2022 10:44,6/5/2022 10:44,Does entanglement allow enhanced communication efficiency?,,3,2,,,,CC BY-SA 4.0 +12929,1,12934,,7/16/2020 22:00,,1,101,"

In "SEPARABILITY CRITERION FOR MULTIPARTITE QUANTUM STATES BASED ON THE BLOCH REPRESENTATION OF DENSITY MATRICES" by Hassan and Joag, I found this remarkable thing about entanglement of mixed GHZ states, saying:

+
+

We consider [a] $N$-qubit state +$$\rho_{noisy}^{N} = \frac{1-p}{2^N}I + p|\psi\rangle\langle\psi|, 0\le p\le1 $$ +where $|\psi\rangle$ is a $N$-qubit ... GHZ state.

+
+

$\hskip2.0in$

+

Does anyone know how these value would evolve when $N$ grows?

+

Their entanglement/separability criterion is given as Theorem 1.

+

If a $N$-partite quantum state of dimension $d_1d_2...d_N$ with Bloch representation $(8)$ is fully separable, then +$$ +||\mathcal{T}^{(N)}||_{KF}\le \sqrt{\frac1{2^N}\prod_{k=1}^N d_k(d_k-1)} +$$

+

$\mathcal{T}^{(N)}$ is given as last term in $(8)$: +

+

$||\mathcal T||_{KF} = max\{||T_{(n)}^N||_{KF}\}, n=1,...,N;$ is a Ky-Fan norm, which is the sum of the $k$ largest singular values of the matrix unfoldings of $\mathcal T$.

+

I'm not interested in $|W\rangle$ states...

+",5280,,5280,,7/17/2020 7:43,7/17/2020 7:43,Separability Criterion for Multipartite GHZ Quantum States,,1,4,,,,CC BY-SA 4.0 +12930,2,,12917,7/16/2020 23:01,,2,,"

This may be broader than what you're looking for, but it's clear from your question that you've read up on the QIT materials on the subject already. So I'll try to give a different perspective (more GR-ish) that I think is much more intuitive. The concepts are very portable, so hopefully it's helpful.

+

I usually think of adjoint operations in terms of pullbacks and their adjoint pushforwards. For a simple example, assume we have smooth maps $f: \mathcal{Y} \rightarrow \mathbb{R}$ and $g: \mathcal{X} \rightarrow \mathcal{Y}$, as shown below. In this case, the pullback of $f$ to $\mathcal{X}$ is simply the composition $\Phi = f \circ g$.

+

+

While it's straightforward to pull functions on $\mathcal{Y}$ back to $\mathcal{X}$, even if we had a function mapping $\mathcal{X} \rightarrow \mathbb{R}$ there would be no way to push that function forward to $\mathcal{Y}$. The maps we have available aren't sufficient to define that kind of transfer.

+

However we can define the pushforward of a vector from $\mathcal{X}$ to $\mathcal{Y}$, which is the adjoint to the pullback described above. This is possible because we can treat vectors as derivative operators that map functions to $\mathbb{R}$.

+

For a vector at point $x$ on $\mathcal{X}$, say $V(x)$, the pushforward vector $\Phi^\dagger V$ at point $g(x)$ on $\mathcal{Y}$ can be defined in terms of its action on functions of $\mathcal{Y}$: +$$(\Phi^\dagger V)(f) = V(\Phi f).$$ +So the action of $\Phi^\dagger V$ on a function is the action of $V$ on the pullback of that function.

+

+

From a practical standpoint, we can take a basis for vectors on $\mathcal{X}$ as ${\partial {}_\mu} = {\partial }/{\partial x^\mu}$ and the same for $\mathcal{Y}$, ${\partial {}_\nu} = {\partial }/{\partial y^\nu}$. To relate $V = V^\mu \partial {}_\mu$ to $(\Phi^\dagger V)=(\Phi^\dagger V)^\nu \partial {}_\nu$ we only need the chain rule: +$$(\Phi^\dagger V)^\nu \partial {}_\nu f = V^\mu \partial {}_\mu(\Phi f) = V^\mu \partial {}_\mu(f \circ g) = V^\mu(\partial y^\nu / \partial x^\mu) \partial {}_\nu f.$$ +This leads directly to the matrix $$(\Phi^\dagger)^\nu{}_\mu = \partial y^\nu / \partial x^\mu.$$ +You can see after all this that the adjoint of the pullback, a vector pushforward, is essentially a generalization of a coordinate transformation.

+

This was a bit long winded, but still doesn't do the subject justice. If you think this approach to building intuition might be helpful, Sean Carroll has a phenomenal exposition on the subject in Appendix A, Maps between Manifolds, in Spacetime And Geometry.

+",8623,,8623,,7/16/2020 23:39,7/16/2020 23:39,,,,5,,,,CC BY-SA 4.0 +12931,1,,,7/16/2020 23:07,,5,136,"

In John Watrous' lectures, he defines the quantum min-relative entropy as

+

$$D_{\min}(\rho\|\sigma) = -\log(F(\rho, \sigma)^2),$$

+

where $F(\rho,\sigma) = tr(\sqrt{\rho\sigma})$. Here, I use this question and answer to make the definition simpler although one should note that the linked question uses a different definition of fidelity (squared vs not squared).

+

On the other hand, one of the early papers introducing this quantity (see Definition 2 of this paper) defines it as

+

$$D_{\min}(\rho\|\sigma) = -\log(tr(\Pi_\rho\sigma)),$$

+

where $\Pi_\rho$ is the projector onto the support of $\rho$. It's not clear if these definitions are equivalent since I can change $\rho$ without altering its support.

+

How are the two definitions related to each other, if at all?

+",12686,,55,,6/30/2022 11:22,6/30/2022 11:22,"Is the quantum min-relative entropy $D_{\min}(\rho\|\sigma)=-\log(F(\rho, \sigma)^2)$ or $D_{\min}(\rho\|\sigma)=-\log(tr(\Pi_\rho\sigma))$?",,1,1,,,,CC BY-SA 4.0 +12932,2,,12917,7/16/2020 23:08,,3,,"

The key is to utilize the Kraus decomposition along with the Hilbert-Schmidt inner product: Given a quantum channel, $\mathcal{N}$ with Kraus operators $\left\{V_{l}\right\}$, we have, +$$ \begin{align}\langle Y, \mathcal{N}(X)\rangle &=\operatorname{Tr}\left\{Y^{\dagger} \sum_{l} V_{l} X V_{l}^{\dagger}\right\}=\operatorname{Tr}\left\{\sum_{l} V_{l}^{\dagger} Y^{\dagger} V_{l} X\right\} \\ &=\operatorname{Tr}\left\{\left(\sum_{l} V_{l}^{\dagger} Y V_{l}\right)^{\dagger} X\right\}=\left\langle\sum_{l} V_{l}^{\dagger} Y V_{l}, X\right\rangle \end{align} $$

+

Therefore, the adjoint of a quantum channel $\mathcal{N}$ is given by +$$ +\mathcal{N}^{\dagger}(Y)=\sum_{l} V_{l}^{\dagger} Y V_{l} +$$

+

Notice that the adjoint channel is CP (since it admits a Kraus decomposition) and unital (from the trace-preserving property of the original channel). Now, here's a way to interpret the adjoint channel: Let $\{ \Lambda^{j} \}$ be a POVM, then the probability of getting outcome $j$ from a measurement on state $\rho$ is +$$ +p_{J}(j)=\operatorname{Tr}\left\{\Lambda^{j} \mathcal{N}\left(\rho\right)\right\}=\operatorname{Tr}\left\{\mathcal{N}^{\dagger}\left(\Lambda^{j}\right) \rho\right\} +$$

+

The latter expression can be interpreted as the Heisenberg picture, where we evolve the ``observables'' instead of the state $\rho$ under the action of the channel $\mathcal{N}$.

+

You can find more details in these lecture notes by Mark Wilde.

+",1108,,,,,7/16/2020 23:08,,,,0,,,,CC BY-SA 4.0 +12933,2,,12919,7/17/2020 6:31,,1,,"

Just to add. If you do not have a possibility to switch control and target qubits, you can implement "upside down" CNOT with this circuit:

+

$$ +(H \otimes H) CNOT (H \otimes H), +$$

+

where $H$ is Hadamard gate and $CNOT$ is controlled NOT with control qubit upside and target qubit downside.

+",9006,,,,,7/17/2020 6:31,,,,0,,,,CC BY-SA 4.0 +12934,2,,12929,7/17/2020 7:42,,2,,"

I don't know the details of this paper, although there are much better things that you can say about the GHZ case (in general, properties of GHZ states are much easier to analyse than W states). I'll summarise the key result in this context below, but further details are available in my paper, here.

+

There are some very simple entanglement criteria that one can apply. In particular, pick any bipartition of the system. If that bipartition contains entanglement (which might be found using the partial transpose criterion), then the state is certainly not fully separable, because it is not separable across that bipartition. For the GHZ state, this threshold occurs at +$$ +p=\frac{1}{2^{N-1}+1}. +$$ +These values are lower than those stated in the table, and so give a stronger claim. It actually turns out that one can prove this is the threshold for the state becoming fully separable, so it's an exact result.

+",1837,,,,,7/17/2020 7:42,,,,10,,,,CC BY-SA 4.0 +12936,1,12937,,7/17/2020 10:11,,1,59,"

I got confused when reading an article about linear combination of unitary method. It shows its process as the following:

+ +

I can't figure out how the effect of $B^{\dagger}$ is calculated with the limited information of $B$.

+

Here +is the article mentioned.

+

Thanks to you all!

+",12690,,55,,7/17/2020 11:28,7/17/2020 11:28,How to compute the inverse of a unitary B when it's defined only by B|0⟩=XXXX?,,1,0,,,,CC BY-SA 4.0 +12937,2,,12936,7/17/2020 11:25,,2,,"

The trick is that you don't need to calculate the inverse of $B$. What you really want to evaluate is +$$ +(\langle 0|\otimes I)(B^\dagger \otimes I)(\text{select}(V))(B\otimes I). +$$ +So, the point is that you only need $\langle 0|B^\dagger$ which is the Hermitian conjugate of $B|0\rangle$, which you know.

+",1837,,,,,7/17/2020 11:25,,,,3,,,,CC BY-SA 4.0 +12938,1,12939,,7/17/2020 12:42,,0,106,"

As discussed in Watrous' book, quantum-to-classical channels are CPTP maps whose output is always fully depolarised. These can always be written as +$$\Phi_\mu(X) = \sum_a \langle X,\mu(a)\rangle E_{a,a}$$ +for some set of positive operators $\mu(a)\ge0$ satisfying $\sum_a \mu(a)=I$.

+

What is the (a) Kraus representation of these maps?

+",55,,55,,7/18/2020 14:51,7/18/2020 18:05,What is the Kraus representation of quantum-to-classical channels?,,1,0,,,,CC BY-SA 4.0 +12939,2,,12938,7/17/2020 12:42,,1,,"

We start from the defining form of the channel as $\Phi_\mu(X)=\sum_a \operatorname{tr}(\mu(a)X)E_{a,a}$.$\newcommand{\PP}{\mathbb{P}}\newcommand{\tr}{\operatorname{tr}}\newcommand{\calX}{\mathcal X}\newcommand{\calY}{\mathcal Y}\newcommand{\calZ}{\mathcal Z}\newcommand{\ket}[1]{\lvert #1\rangle}\newcommand{\bs}[1]{\boldsymbol{#1}}$

+

(Natural representations) +To derive the natural representation of the map, note that +$$\Phi_\mu(E_{k,\ell})=\sum_a\mu(a)_{\ell,k} E_{a,a}.$$ +It follows that +$$K(\Phi_\mu)_{ij,k\ell} = \langle i\rvert \Phi_\mu(E_{k,\ell})\lvert j\rangle += \sum_a \mu(a)_{\ell,k} \langle i\rvert E_{a,a}\lvert j\rangle=\delta_{ij} \mu(i)_{\ell,k},$$ +where $E_{a,b}\equiv\lvert a\rangle\!\langle b\rvert$ and $K(\Phi)$ denotes the natural representation of $\Phi$. +As an operator, this reads +$$K(\Phi_\mu) +%= \sum_a \lvert a,a\rangle \langle \mu(a)^T\rvert +\equiv \sum_a \ket{a,a}\!\operatorname{vec}(\mu(a)^*)^T.$$

+

(Choi representation) +Consider now the Choi operator, defined as +$J(\Phi)\equiv \sum_{i,j}\Phi(E_{i,j})\otimes E_{i,j}$. +From this we get +$$J(\Phi_\mu) = \sum_{a,i,j} \mu(a)_{j,i} E_{a,a}\otimes E_{i,j} += \sum_a E_{a,a}\otimes \mu(a)^T.$$ +We can also get this from $K(\Phi)$, using the relation +$\langle i,j\rvert J(\Phi)\lvert k,\ell\rangle = \langle i,k\rvert K(\Phi)\lvert j,\ell\rangle$.

+

(Kraus representation from Choi) +One way to get the Kraus representation is via the spectral decomposition of the Choi. +From the relations above, we see that the spectral decomposition of the Choi is in this case quite easy: define $\ket{v_{a,j}}\equiv \ket a\otimes \ket{p_{a,j}^*}$ with $\ket{p_{a,j}}$ the eigenvector of $\mu(a)$ with eigenvalue $p_{a,j}$, and using $\ket{p_{a,j}^*}$ to denote the complex conjugate of $\ket{p_{a,j}}$.

+

From this we get the Kraus operators as the maps $A_{a,j}$ of the form: +$$ +A_{a,j} = \sqrt{p_{a,j}} \lvert a\rangle\!\langle p_{a,j}\rvert +\Longleftrightarrow +(A_{a,j})_{ik} = \sqrt{p_{a,j}}\langle i,k\ket{v_{a,j}} = \sqrt{p_{a,j}} \delta_{a,i}\langle k\rvert p_{a,j}^*\rangle. \tag1 +$$ +With these operators, we can write +$$\Phi_\mu(X) = \sum_{a,j} A_{a,j} X A_{a,j}^\dagger.$$

+

(Direct derivation) For a direct route that doesn't require passing through the Choi representation, let us write down the explicit form of $\Phi_\mu(X)$: +$$\Phi_\mu(X) = \sum_{a,\ell k} \mu(a)_{k,\ell}X_{\ell,k} E_{a,a}.$$ +Because, by hypothesis, $\mu(a)\ge0$, we can find some operator $M_a$ such that $\mu(a)=M_a^\dagger M_a$. Componentwise, this reads +$\mu(a)_{k,\ell} = \sum_j(M_a^*)_{j,k}(M_a)_{j,\ell}.$ Using this in the expression above we get +$$\Phi_\mu(X) = \sum_{a,jk\ell} E_{a,a}(M_a^*)_{j,k} X_{\ell,k} (M_a)_{j,\ell} E_{a,a}.$$ +The corresponding Kraus operators thus have the form +$$A_{a,j}= \lvert a\rangle\!\langle j\rvert M_a.\tag2$$ +Of course, this now begs the question: are the Kraus operators in (2) compatible with those previously derived in (1)? The answer is: not necessarily. Equation (2) is more general, due to the freedom in the choice of $M_a$, and in particular doesn't necessarily lead to orthogonal Kraus operators, like (1) does. To see this, notice that we can generally express $M_a$ in terms of the eigendecomposition of $\mu(a)$ as +$$M_a = \sum_\ell \sqrt{p_{a,\ell}} \lvert u_{a,\ell}\rangle\!\langle p_{a,\ell}\rvert,$$ +for any choice of orthonormal vectors $\lvert u_{a,\ell}\rangle$. +In particular, we can choose $\lvert u_{a,\ell}\rangle=\lvert \ell\rangle$ to retrieve (1).

+",55,,55,,7/18/2020 18:05,7/18/2020 18:05,,,,2,,,,CC BY-SA 4.0 +12940,2,,12925,7/17/2020 14:23,,2,,"

The $\frac{1}{\sqrt{2}}$ is due to the normalization condition which says that sum of the squares of the amplitudes of the must be equal to one while the square of the amplitude refers to the probability of getting that particular state when the qubits are measured

+

The vectors $|+⟩$ and $|-⟩$ are known as the eigenvectors for the Hadamard gate. When we apply the $H$ gate on the $|0⟩$ and $|1⟩$, we get $|+⟩$ and $|-⟩$ respectively.

+

That is, $$H|0⟩=|+⟩$$ and +$$H|1⟩=|-⟩$$

+",11868,,8787,,7/18/2020 7:02,7/18/2020 7:02,,,,1,,,,CC BY-SA 4.0 +12941,1,12942,,7/17/2020 16:27,,2,108,"

Whenever we calculate entropy we make use, for example, $\log(P)$ for $P$ a projection defined for some arbitrary finite dimensional Hilbert space.

+

But for projection operators this is not well-defined by means of the functional calculus. My question is: although we are more interested in the terms $P \log(P)$ what is really happening is that we use this only for a symbol whenever we have projections and write $0\log(0)=0$ as the eigenvalue description using the functional calculus for the operator $P\log(P)$?

+
+

Is there a way to make $\log(P)$ a valid, well-defined, mathematical description?

+
+",8787,,8787,,7/17/2020 23:27,7/17/2020 23:27,How well defined is $\log(P)$ for $P$ projection?,,1,6,,,,CC BY-SA 4.0 +12942,2,,12941,7/17/2020 17:56,,2,,"

$P$ is a projection operator in the limiting case where $P$ represents a state that is completely known, i.e. a pure state, so the entropy is zero. As a limiting case, the valid and well-defined mathematical description is +$$\lim_{P \rightarrow 0^+} P \log(P)=0.$$ +This is still a bit sloppy. Since $P$ is a matrix, we're actually taking the trace and $P \rightarrow 0^+$ means as P goes to a representation of a pure state. It's a bit more clear to consider entropy in terms of the eigenvalues of $P$, +$$S=\sum \lambda_i \log \lambda_i,$$ +so that there is no ambiguity in interpreting +$$\lim_{\lambda \rightarrow 0^+} \lambda \log(\lambda)=0,$$ +for any given term in the sum.

+

In response to your comment, when $P$ is a projection operator, the expression $\log(P)$ is inherently undefined. You can see this by noting that projection operators are idempotent by definition, so $P^2=P$.

+

Consider the proposition that we can express $P$ in exponential form $P=e^x$ for some unknown $x$. The idempotentcy of $P$ requires $e^x=e^{2x}$, which tells us that $x$ is imaginary with magnitude $2 \pi n, \, n \in \mathbb{Z}$, over some $d$-dimensional basis.

+

Whatever appropriately normalized basis we pick, say $b_d$, the inevitable result is $e^{i2\pi n b_d}=I_d$. So we get back the identity instead of our projection operator, contradicting the proposition.

+

The is one of several ways to see that we can't define $P$ as an exponential, and that $\log(P)$ is hopelessly undefined.

+",8623,,8623,,7/17/2020 19:28,7/17/2020 19:28,,,,3,,,,CC BY-SA 4.0 +12944,1,12946,,7/18/2020 2:49,,4,440,"

I have two states $|{\psi}\rangle = \begin{pmatrix} a_1\\a_2 \end{pmatrix}$ and $|{\phi}\rangle = \begin{pmatrix} b_1 \\ b_2 \end{pmatrix} $ that I want to "add" together. By "add," I of course mean perform the xor operation $|{\psi} \oplus {\phi}\rangle$.

+

I have an intuitive understanding of what this means since I'm familiar with bitwise operations, but I'm struggling to understand what the resulting state would look like.

+

My initial thought was to split the states into the logical basis and sum the components.

+

$a_1|{0}\rangle + a_2|{1}\rangle + b_1|{0}\rangle + b_2|{1}\rangle$

+

But this doesn't seem right. If my assumption that $|{0}\rangle + |{\psi}\rangle = |{\psi}\rangle$ is correct, then $a_1|{0}\rangle + b_1|{0}\rangle = a_1(|{0}\rangle + \frac{b_1}{a_1}|{0}\rangle) = a_1(\frac{b_1}{a_1}|{0}\rangle) = b_1|{0}\rangle$ which misses the point of the sum altogether.

+

What is my misunderstanding, and what is $|{\psi} \oplus {\phi}\rangle$ is in terms of $a_1, b_1, a_2, b_2$?

+",11628,,55,,7/26/2020 17:48,7/26/2020 17:48,"How do I ""add"" two qubit states?",,1,2,,,,CC BY-SA 4.0 +12945,1,12954,,7/18/2020 4:37,,4,124,"

Suppose I have an unknown state $|\psi\rangle = \sum_i \alpha_i|{\lambda_i}\rangle$, is it possible that I can transform it into $|\psi\rangle = \frac{1}{\sqrt{\sum_i|\alpha_i|^{2r}}} \sum_i \alpha_i^r|{\lambda_i}\rangle$?

+

I have an idea for one qubit with a measurement, which would be better without measurements.

+

Suppose the input state is $|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$ and can be prepared with two copies. An ancilla qubit is provided with state $|0\rangle$, such that

+

$ +(\alpha|0\rangle+\beta|1\rangle)(\alpha|0\rangle+\beta|1\rangle)|0\rangle= +\alpha^2|000\rangle + \alpha\beta|010\rangle+\beta\alpha|100\rangle+\beta^2|110\rangle. +$

+

With two CNOT gates in a row, the ancilla qubit is the target qubit, such that

+

$ +\alpha^2|000\rangle+\alpha\beta|011\rangle+\beta\alpha|101\rangle+\beta^2|110\rangle. +$

+

This is followed by a measurement on ancilla qubit if we happen to measure 0, which the state on the first two qubits will be +$ +\frac{\alpha^2}{\sqrt{|\alpha|^4+|\beta|^4}}|000\rangle+\frac{\beta^2}{\sqrt{|\alpha|^4+|\beta|^4}}|110\rangle. +$

+

With an CNOT gate on the second qubit, using the first qubit as control, such that

+

$ +\frac{\alpha^2}{\sqrt{|\alpha|^4+|\beta|^4}}|00\rangle+\frac{\beta^2}{\sqrt{|\alpha|^4+|\beta|^4}}|10\rangle= +(\frac{\alpha^2}{\sqrt{|\alpha|^4+|\beta|^4}}|0\rangle+\frac{\beta^2}{\sqrt{|\alpha|^4+|\beta|^4}}|1\rangle)|0\rangle +$

+

The state in the first qubit will be

+

$ +\frac{\alpha^2}{\sqrt{|\alpha|^4+|\beta|^4}} |0\rangle+\frac{\beta^2}{\sqrt{|\alpha|^4+|\beta|^4}} |1\rangle +$

+

+

However, the measurement on ancilla qubit is a nuisance. Can I obtain the powered amplitude state without measurement on arbitrary number of qubits?

+",12693,,55,,7/26/2020 18:03,7/26/2020 18:03,How to transform a state with amplitude squared or to any power?,,1,2,,,,CC BY-SA 4.0 +12946,2,,12944,7/18/2020 6:04,,2,,"

The XOR operation is not a well defined action in quantum computing since it is non-reversible. (For example: $|0 \oplus 0\rangle = |1 \oplus 1\rangle = |0\rangle $) However, XOR is implicit in the CNOT operation, as CNOT$(|a,b\rangle) = |a, a \oplus b\rangle$ Hence to answer my own question:

+

CNOT$(|\psi \otimes \phi\rangle) = \begin{pmatrix} a_1b_1 \\ a_1b_2 \\ a_2b_2 \\ a_2b_1\end{pmatrix}$

+

If I'm not mistaken, the state of the target qubit is then given by:

+

$(a_1b_1 +a_2b_2)|0\rangle + (a_1b_2 + a_2b_1)|1\rangle$

+

Under some normalization

+",11628,,11628,,7/23/2020 4:43,7/23/2020 4:43,,,,3,,,,CC BY-SA 4.0 +12948,1,12950,,7/18/2020 13:33,,0,126,"

I am an undergraduate student and I wrote a paper for my research program on quantum information. To be more specific, it is about using a novel quantum algorithm to do signal/image processing. It won me a distinction in the research program so I thought I might want to try to publish it somewhere. However, I found it quite hard to find a suitable journal/conference to publish this paper on such a interdisciplinary topic. Anyone could give some suggestions as to where I can try to submit it to? Thanks.

+",7739,,55,,9/25/2020 11:40,9/25/2020 11:40,Where to publish quantum algorithm related paper,,2,0,,,,CC BY-SA 4.0 +12949,2,,12948,7/18/2020 14:37,,3,,"

This is a good list made by Prof. Rod Van Meter.

+

Maybe you could look at the papers you based your work off of and see where they were published? That should give you a sense of which journals are interested in the sort of work you've done.

+",3056,,,,,7/18/2020 14:37,,,,4,,,,CC BY-SA 4.0 +12950,2,,12948,7/18/2020 17:07,,3,,"

To be more specific and as an addendum to Drito's answer which provides a good starting point for your search, I would like to narrow it down for you, by recommending Quantum Information Processing. Since this journal is good, and moreover it has papers regarding Image Processing related topics like its Representation, security.

+",6070,,,,,7/18/2020 17:07,,,,0,,,,CC BY-SA 4.0 +12951,1,12952,,7/18/2020 21:16,,3,181,"

We know that every CPTP map $\Phi:\mathcal X\to\mathcal Y$ can be represented via an isometry $U:\mathcal X\otimes\mathcal Z\to\mathcal Y\otimes\mathcal Z$, as +$$\Phi(X) = \operatorname{Tr}_{\mathcal Z}[U(X\otimes E_{0,0})U^\dagger],\quad\text{where}\quad E_{a,b}\equiv \lvert a\rangle\!\langle b\rvert.\tag1$$ +Showing this is quite easy e.g. from the Kraus representation. +If $A_a:\mathcal X\to\mathcal Y$ are Kraus operators for $\Phi$, then +$$U_{\alpha a,i0} \equiv \langle \alpha,a\rvert U\lvert i,0\rangle = \langle \alpha\rvert A_a\lvert i \rangle \equiv (A_a)_{\alpha,0}.\tag2$$ +We can, of course, replace $E_{0,0}$ with any pure state in (1) without affecting the result.

+

This shows that, given any channel $\Phi$ and any pure state $\lvert\psi\rangle\in\mathcal Z$, we can represent $\Phi$ as in (1) (with $E_{0,0}\to\lvert\psi\rangle$). +However, what about the more general case of $E_{0,0}\to\sigma$ with $\sigma$ not pure?

+

To analyse this case, consider a channel written as +$$\Phi(X)=\operatorname{Tr}_{\mathcal Z}[U(X\otimes \sigma)U^\dagger]\tag3$$ +for some state $\sigma=\sum_k p_k E_{k,k}\in\mathrm{Lin}(\mathcal Z)$ (appropriately choosing the computational basis for $\mathcal Z$). +The relation with the Kraus operators reads in this case +$$\Phi(X)_{\alpha,\beta} = \sum_{\ell k ij} p_\ell U_{\alpha \ell,i k} X_{ij} U^*_{\beta\ell,jk} += \sum_{\ell,k} (A_{\ell,k}XA_{\ell,k}^\dagger)_{\alpha\beta}\tag4$$ +with +$$(A_{\ell,k})_{\alpha,i} \equiv \sqrt{p_\ell} U_{\alpha\ell,ik}, +\qquad A_{\ell,k} = \sqrt{p_\ell} (I\otimes \langle \ell\rvert)U(I\otimes \lvert k\rangle).\tag5$$

+

There is now a difference: the number of Kraus operators must be larger than the rank of $\sigma$ (which determines the number elements spanned by the index $k$ in $A_{\ell,k}$). +Indeed, a different way to state this same fact is to notice that the $\Phi$ in (3) is a convex combination of several channels: +$$\Phi(X) = \sum_k p_k \Phi_k(X), \qquad \Phi_k(X)\equiv \operatorname{Tr}_{\mathcal Z}[U(X\otimes E_{k,k})U^\dagger]. \tag 6$$

+
+

This leads me to the question: can any $\Phi$ be written as in (3) for any $\sigma$? More precisely, given $\Phi$ and $\sigma$, can I always find an isometry $U$ such that (3) holds?

+

The question arises from the fact that, because when $\sigma$ is not pure (3) leads to $\Phi$ be a convex combination of other maps as shown in (6), I would think that there should be maps that are "extremal", in the sense that they cannot be written as convex combinations of other maps, and that such maps shouldn't be writable as (3) for $\sigma$ not pure.

+",55,,,,,7/19/2020 1:14,Can any channel be written as $\Phi(X)=\operatorname{Tr}_{\mathcal Z}[U(X\otimes \sigma)U^\dagger]$ for any state $\sigma$?,,1,0,,,,CC BY-SA 4.0 +12952,2,,12951,7/18/2020 21:37,,7,,"

No, this is not always possible.

+

A counterexample is given by $\sigma=I/d'$ and $\Phi(X)=\mathrm{tr}(X)|0\rangle\langle0|$.

+

To see this, note that for $X=I/d$, +\begin{align} +2(1-1/d) & = +\|\,|0\rangle\langle0|-I/d\|_1 +\\ +&= \|\Phi(X)-I/d\|_1 +\\ +&\le \left\|U\left(X\otimes \frac{I}{d'}\right)U^\dagger-U\left(\frac{I}{d}\otimes\frac{I}{d'}\right)U^\dagger\right\|_1 +\\ +&\le \left\|X\otimes \frac{I}{d'}-\frac{I}{d}\otimes\frac{I}{d'}\right\|_1 +\\ +& +=\left\|X-\frac{I}{d}\right\|_1 +\\ +&=0 +\end{align} +where in the 2nd step, I have used that the partial trace is contractive with respect to the trace norm (as it is a CP map), and in the fourth that $\|A\otimes I/d'\|_1 = \|A\|_1$.

+

This is clearly a contradiction and thus shows that such a representation for the chosen channel $\Phi$ cannot exist.

+
+

As always, let me take the opportunity to advertise my list of canonical (counter)examples for quantum channels.

+",491,,491,,7/19/2020 1:14,7/19/2020 1:14,,,,4,,,,CC BY-SA 4.0 +12953,2,,12931,7/18/2020 21:40,,3,,"

As @rnva points out these are not the same quantities. To give some clarity as to why they are both referred to as $D_{\min}$ it is best to look at the as limiting cases of $\alpha$-R'enyi divergences.

+

First, we have the sandwiched divergences which for $\alpha \in (0, 1) \cup (1, \infty)$ are defined as +$$ +\widetilde{D}_{\alpha}(\rho\|\sigma) = \frac{1}{\alpha - 1} \log \mathrm{Tr}\left[ (\sigma^{\frac{1-\alpha}{2\alpha}} \rho \sigma^{\frac{1-\alpha}{2\alpha}} )^\alpha \right]. +$$ +These divergences are monotonically increasing in $\alpha$ and satisfy the data processing inequality (DPI) for all $\alpha \geq 1/2$. Thus the smallest divergence in this family satisfying the DPI is +$$ +\widetilde{D}_{\min}(\rho \| \sigma) = \widetilde{D}_{1/2}(\rho \|\sigma) = - \log \mathrm{Tr}[\sqrt{\rho} \sqrt{\sigma}]^2. +$$

+

Another well studied family of divergences are the so-called Petz divergences defined for $\alpha \in (0,1) \cup (1, \infty)$ to be +$$ +\overline{D}_{\alpha}(\rho \| \sigma) = \frac{1}{\alpha - 1} \log \mathrm{Tr}[\rho^{\alpha} \sigma^{1-\alpha}]. +$$ +This family satisfies the DPI for $\alpha \in (0,1) \cup(1,2]$ and they are also monotonically increasing in $\alpha$. Thus, the smallest divergence satisfying the DPI in this family is +$$ +\overline{D}_{\min}(\rho \| \sigma) = \lim_{\alpha \to 0^+} \overline{D}_{\alpha}(\rho \|\sigma) = -\log \mathrm{Tr}[\Pi_\rho \sigma ]. +$$

+",9854,,,,,7/18/2020 21:40,,,,0,,,,CC BY-SA 4.0 +12954,2,,12945,7/19/2020 0:01,,3,,"

As noted by Mateus in the comments, the transformation you are looking for is non-linear. This cannot be done with any matrix transformation. Thus, you will need more qubits, and your solution shows two (+1 scratch qubit) is sufficient. I guess you might wonder if a two-qubit unitary can do it, though?

+

The problem is that the transformation you want to implement depends on the input state. You can't do this (unitarily) even with extra qubits. I believe the most general result forbidding such requirements is the No-Programming Theorem.

+

Also note at, as $r\to\infty$, the transformation becomes a projection onto the subspace spanned by the states with highest modulus. You do are doing something like a weak measurement when $r$ is finite.

+

Nearly final observation: you mention you want $|\psi\rangle$ to be "unknown". You should be cautious taking your solution (as you generalise requiring more copies of $|\psi\rangle$) farther without thinking about no-cloning or more subtle resource counting.

+

Last thing. A coherent version of something like what you might be looking for is Amplitude Amplification.

+",4407,,,,,7/19/2020 0:01,,,,2,,,,CC BY-SA 4.0 +12955,1,,,7/19/2020 0:09,,1,294,"

I have a circuit with 2 ancilla bits. I have only asked that the circuit measure the 4 other qubits, but the results keep including the ancilla bits. How to remove the ancilla bits from the results?

+",12676,,,,,7/19/2020 6:33,How to remove ancilla bits from results?,,1,0,0,,,CC BY-SA 4.0 +12956,1,12957,,7/19/2020 0:26,,1,345,"

In David Deutsch's classic paper Quantum theory, the Church-Turing principle and the universal quantum computer (1985), Deutsch writes on p. 99:

+
+

+
+

(I thought that this might be in typo in the original publication, but it is also present in the version that was retypeset in 1999 which is easily findable on the Internet.)

+

Since ℤ=ℤ, what is "the set of all functions from ℤ to ℤ?"

+",9482,,5957,,7/20/2020 11:23,7/20/2020 11:23,What is the set of all functions from ℤ to ℤ?,,2,1,,,,CC BY-SA 4.0 +12957,2,,12956,7/19/2020 1:49,,3,,"

Recall that a function between two sets (say $A,B$) is simply a binary relation that associates to every element of the first set $A$ exactly one element of the second set $B$. Therefore, a function can be represented as a set $G$ of ordered pairs $(x,y), x \in A, y \in B$, satisfying the following: each element of $A$ appears exactly once in this set (to make sure there are no repetitions and that a single element cannot be mapped to two different outputs, i.e., this map is a function).

+

Now, to count the total number of functions between two sets we need to count the number of unique sets (of the form $G$ above) that can be constructed. One can show that the number of functions from a set $A$ to a set $B$ is $|B|^{|A|}$ (see, for example, this intuitive answer).

+

Do the same for $A = \mathbb{Z} = B$ but beware of their cardinalities (and realize that this set is uncountable, see for example, here).

+

Update (from the comments): The notation ``set of all functions from $\mathbb{Z}$ to $\mathbb{Z}$'' is shorthand for $\{f | f: \mathbb{Z} \rightarrow \mathbb{Z}\}$, i.e., all functions whose domain and range is $\mathbb{Z}$ (or subsets of $\mathbb{Z}$).

+",1108,,1108,,7/19/2020 19:52,7/19/2020 19:52,,,,4,,,,CC BY-SA 4.0 +12958,2,,12884,7/19/2020 2:47,,4,,"

So the general definition of pseudothreshold is when the logical qubit outperforms a physical qubit.

+

If your error model is idling error, for example, you want to find the physical value of T1 and T2 for which the physical qubits lifetime is lower than the logical qubit's lifetime.

+

The easiest way to calculate this would be to write a simulation of the circuits for Shor's code, and then measure it's performance at different values and find the intersection point between the logical error curve and physical error curve.

+

If you want to calculate it on pencil and paper, write out the error channel you want to work with, and see what error patterns lead to logical errors vs not, and then see.

+

A simple example would be a channel: +$$E(\rho) = (1-p)I\rho I + p Z\rho Z$$

+

To have a logical error in Shor's 9 qubit code, you need two Z errors on a single GHZ state. So you can apply this error to all qubits, knowing the physical qubit experiences a Z error with probability p, and find the probability of a logical Z error on the encoded qubit as a function of p. The value of p where the logical error rate exceeds p is the pseudothreshold.

+",3056,,,,,7/19/2020 2:47,,,,2,,,,CC BY-SA 4.0 +12959,1,12961,,7/19/2020 4:03,,1,288,"

Why we should use density matrices to simulate quantum systems with noise?

+

I found that the any QEC circuit is included by some quantum gates just like normal cases, which means the state vector can also be used to simulate it, but all of the simulator only can realize noise model with density matrix, can someone help me with that?

+",11765,,55,,9/25/2020 11:42,9/25/2020 11:42,Why should we use density matrices to simulate quantum systems with noise?,,2,0,,,,CC BY-SA 4.0 +12960,2,,12956,7/19/2020 4:41,,1,,"

Just consider the set of all functions from $\mathbb{Z}$ to a two point set $\{0,1\}$. The cardinality of the set of all functions between these two sets is $2^{|\mathbb{Z}|}$.

+

Now ask yourself is the power set of $ \mathbb{Z}$ countable. If the answer is NO then the answer to your question is also a NO.

+",6070,,,,,7/19/2020 4:41,,,,0,,,,CC BY-SA 4.0 +12961,2,,12959,7/19/2020 5:29,,5,,"

Noise effects introduce classical uncertainty in what the underlying state is. A mixed state is a statistical ensemble of several quantum states $|\psi_i\rangle$ (not necessarily orthogonal), with respective probabilities $p_i$.

+

With the state vector you can represent pure states, not mixed ones. Instead, with the density operator you can represent both pure and mixed states.

+

Noise models are always defined in terms of density operators.

+",5551,,5551,,7/19/2020 9:40,7/19/2020 9:40,,,,1,,,,CC BY-SA 4.0 +12962,2,,12955,7/19/2020 6:33,,1,,"

You can (and you should) always uncomputer ancilla qubits. This can be done by application of inverse gates in inverse order to original ones which prepared states of ancilla qubits.

+

Here is an example:

+

+

The purpose of the circuit is to calculate $q_0 \,\text{AND}\, q_1 \,\text{AND} q_2$. To do so, firstly $q_0 \,\text{AND}\, q_1$ is calculated and result is stored to ancilla $q_3$. After that final result is obtained by $q_2 \,\text{AND}\, q_3$ and stored to $q_4$. Finnaly, inverse operation (note that inverse gate to Toffoli is again Toffoli) is applied. As a result, state of ancilla $q_3$ is returned back to $|0\rangle$. This value is returned during measurement. If you do not want to include ancilla to measurement, simply do not put the measurement on qubit $q_3$.

+",9006,,,,,7/19/2020 6:33,,,,2,,,,CC BY-SA 4.0 +12963,2,,12884,7/19/2020 14:06,,4,,"

The first answer discusses what the pseudothreshold is and how to find it, but I will try to give a few details on the difference between thresholds and pseudothresholds, since your first question does ask for both definitions.

+

In quantum error correction (QEC), a logical qubit is encoded in many physical qubits. Given some underlying physical error rate $p$, there will be a corresponding logical error rate $\bar{p}$. If we are smart with our encoding and can make hardware that is "good enough", then ideally $\bar{p} < p$ below some $p_{th}$ for the physical error rate.

+

When simulating QEC codes, if one type of circuit component (like a single qubit gate) is assumed to fail with some rate $p$, we might obtain a plot like the one below (left). The parameter $L$ refers to the code concatenation; $L=0$ means no QEC, $L=1$ means each logical qubit is encoded with a set of physical qubits, $L=2$ means each of the $L=1$ physical qubits itself is encoded, etc. Notice that there is clean crossover (i.e. all curves intersect the $L=0$ curve at the same point, the threshold), below which using higher levels of concatenation improves the logical error rate of the code with respect to the physical error rate ($\gamma$ is used as the rate symbol here).

+

But in more complicated models we might allow different circuit components (1-qubit vs. 2-qubit gates, ancilla vs. data wires, etc.) to fail with different error rates, which leads to a more complicated set of curves (right image). Each concatenation curve intersects the $L=0$ curve at a different point, so you cannot just find the threshold of, say, the $L=1$ code and then scale up to higher $L$--you will actually make the code worse, because you only found a pseudothreshold. Instead, you need to simulate many values of $L$ and infer some kind of asymptotic behavior in the curves to get a rough estimate of where it is truly safe to scale up.

+

In summary, the left image represents the situation where all pseudothresholds are the same and are equal to the true threshold, and the right image represents a more realistic situation where the use of a more complex error model requires us to study the limiting behavior of a family of pseudothresholds.

+

+

I took these details and image from this paper.

+",4622,,,,,7/19/2020 14:06,,,,3,,,,CC BY-SA 4.0 +12964,1,,,7/19/2020 14:10,,3,115,"

Suppose I am solving the TSP formulated as a QUBO problem using QAOA. I understand from the original paper that there is a parameter $p$ which sets the number of steps used in the alternating ansatz. Also, $p$ represents the locality of the terms in the ansatz.

+

So what does this "locality" mean for our real world TSP problem? Does it mean that we can only find optimal paths that are locally optimised up to $p$ edges radius?

+",10485,,10485,,12/30/2020 9:47,12/31/2020 21:08,What is the implication of locality in QAOA?,,1,0,,,,CC BY-SA 4.0 +12965,1,,,7/19/2020 14:59,,1,76,"

In Quantum Information processing, we can extract entanglement from $n$-copies of a weakly entangled state to produce a fully or highly entangled states in $d$-dimensions, using the known distillation protocols.

+

However, there are states from which no entanglement can be extracted out using the known distillation protocols for no value of $n$. Such states contain bound entanglement.

+

For qubits, PPT is a necessary and sufficient criterion for separability. In higher dimensions, i.e qudits, there are states which satisfy PPT but are entangled and such states contain bound i.e non-distillable entanglement. I am not sure but I guess there are states which are NPT but bound entangled.

+

What is the deep physical reason behind the existence of bound entanglement?

+",11668,,55,,9/25/2020 11:42,9/25/2020 11:42,What is the deep physical reason behind the existence of bound entanglement?,,0,4,0,7/26/2020 11:50,,CC BY-SA 4.0 +12966,1,12967,,7/19/2020 15:55,,2,45,"

Fix a finite number of states $\sigma_k$, and consider a channel of the form +$$\Phi(X)=\sum_k c_{k}(X)\sigma_k.$$

+

For $\Phi$ to be linear and trace-preserving we must have: +$$c_k(X+X') = c_k(X) + c_k(X'), \qquad \sum_k c_k(X)=1.$$ +In other words, the coefficients must be linear functionals $c_k\in\mathrm{Lin}(\mathcal X)^*$ for all $k$.

+

Does this imply that there must be some positive operators $F_k\ge0$ such that $c_k(X)=\operatorname{Tr}(F_k X)$ for all $k$ (which in turn would imply $\sum_k F_k=I$ and thus that $\{F_k\}_k$ is a POVM)? What's a good way to show this?

+",55,,55,,7/19/2020 16:26,7/19/2020 16:26,"Given a channel $\Phi(X)=\sum_k c_k(X)\sigma_k$, are there always $F_k\ge0$ such that $\Phi(X)=\sum_k \operatorname{tr}(F_k X)\sigma_k$?",,1,0,,,,CC BY-SA 4.0 +12967,2,,12966,7/19/2020 16:17,,2,,"

The answer is no.

+

To this end, pick a linearly independent set $\{\sigma_k\}$ which spans the full matrix space (over $\mathbb C)$, that is, a basis. (This is always possible, as the positive operators span the hermitian ones over $\mathbb R$.)

+

Then pick a dual basis $\sigma'_\ell$ such that +$$ +\mathrm{tr}[\sigma'_\ell \sigma_k]=\delta_{k\ell}\ . +$$

+

Then, +$$ +\Phi(X) = \sum_k \mathrm{tr}[\sigma'_k X]\,\sigma_k +$$ +is the identity channel, which cannot be written as a POVM $F_k\ge0$ followed by a preparation of $\sigma_k$ (as that channel would be entanglement breaking).

+

(Note that this shows that the dual basis $\sigma'_\ell$ has non-positive elements. This is not surprising, since otherwise the scalar product $\mathrm{tr}[\sigma'_\ell\sigma_k]\ge0$ for all $k,\ell$.)

+",491,,,,,7/19/2020 16:17,,,,3,,,,CC BY-SA 4.0 +12968,2,,12959,7/19/2020 17:47,,3,,"

You do not need to use the density matrix approach. However, as the most general representation of a quantum state, doing so has several advantages. You can simulate noise using just statevectors using probabilistic approaches, eg wavefunction monte-carlo, that converge to the density matrix results in the limit of many repetitions. Along this same thread of thought, it is important to note that the density matrix approach is not what the system is actually doing. Rather, it is the average of what the system does if the experiment is repeated many (formally infinitely many) times. In contrast, the statevector based methods should well approximate a single realization of the experiment.

+",332,,,,,7/19/2020 17:47,,,,0,,,,CC BY-SA 4.0 +12969,1,,,7/19/2020 20:20,,2,37,"

As the number of qubit increasing, the frequency of qubit will be crowded and there will become the frequency collision. I was wondering that is there any relation between frequency collision and crosstalk error? Does frequency collision lead to crosstalk error? If not, what's the difference between them?

+",9105,,55,,7/27/2020 12:25,7/27/2020 12:25,Frequency collision and crosstalk error,,0,0,,,,CC BY-SA 4.0 +12970,1,,,7/19/2020 21:11,,4,90,"

"Quantum theory, the Church-Turing principle and the universal quantum computer" (Deutsch 1985b) appears to introduce the term of "quantum parallelism" (the term is not in "Quantum Theory as a Universal Physical Theory" (Deutsch 1985a)). He makes two obvious (to me) claims:

+
    +
  1. "Quantum parallelism cannot be used to improve the mean running time of parallelizable algorithms." (p. 112, top)

    +
  2. +
  3. Quantum parallelism could be used to prove the many-worlds interpretation of quantum mechanics, specifically:

    +
  4. +
+
+

Interpretational implications

+

I have described elsewhere (Deutsch 1985; cf. also Albert 1983) how it would be possible to make a crucial experimental test of the Everett (‘many-universes’) interpretation of quantum theory by using a quantum computer (thus contradicting the widely held belief that it is not experimentally distinguish- able from other interpretations). However, the performance of such experiments must await both the construction of quantum computers and the development of true artificial intelligence programs. In explaining the operation of quantum computers I have, where necessary, assumed Everett’s ontology. Of course the explanations could always be ‘translated’ into the conventional interpretation, but not without entirely losing their explanatory power. Suppose, for example, a quantum computer were programmed as in the Stock Exchange problem described. Each day it is given different data. The Everett interpretation explains well how the computer’s behaviour follows from its having delegated subtasks to copies of itself in other universes. On the days when the computer succeeds in performing two processor-days of computation, how would the conventional interpretations explain the presence of the correct answer? Where was it computed?

+
+

My reading of the paper is the Deutsch, in 1985, thinks that quantum turing machines are fundamentally more powerful than classical turing machines, because QTMs can simulate a CTM but CTMs cannot simulate a QTM.

+

My reason for asking the question is that Deutsch seems to be implying that quantum parallelism is real, and that it can be used for significant speedup, but my understanding is that quantum parallelism, in this sense, does not exist.

+

So is this early article wrong and, if so, how can it be wrong? Are the proofs wrong? Or is the quantum parallelism something that is conjectured and not proven?

+

And what about the many worlds?

+",9482,,,,,7/20/2020 7:21,Is Deutsch 1985b wrong about and Quantum Parallelism?,,1,1,,,,CC BY-SA 4.0 +12971,1,,,7/20/2020 5:32,,2,36,"

I am trying to compute cross-correlation on a quantum computer, and I have found a research paper describing the cross-correlation algorithm.

+

The terms used in the algorithm are not clear, and it would be great if someone can help me with it. The algorithm has many formating and special characters that I cannot copy and paste in the browser from the PDF.

+

The link to access the research paper is Cross-Correlations computation through quantum computing. On page number 4 the cross-correlation algorithm is mentioned.

+

I am not able to understand that in the second step of the algorithm, what is the j^ register, and what does it consist of?

+",12709,,55,,7/20/2020 11:11,7/20/2020 11:11,Computing cross-correlations on a quantum computer,,1,0,,,,CC BY-SA 4.0 +12972,1,,,7/20/2020 5:43,,5,80,"

Consider an entangled bipartite quantum state $\rho \in \mathcal{M}_d(\mathbb{C}) \otimes \mathcal{M}_{d'}(\mathbb{C})$ which is positive under partial transposition, i.e., $\rho^\Gamma \geq 0$. As separability of $\rho$ is equivalent to separability of its partial transpose $\rho^\Gamma$, we know that $\rho^\Gamma$ is entangled. What are the conditions on $\rho$ which will guarantee that the sum $\rho + \rho^\Gamma$ (ignoring trace normalization) is also entangled?

+

It turns out that the above proposition does not hold for arbitrary PPT entangled states. Easiest counterexamples can be found in $\mathcal{M}_2(\mathbb{C}) \otimes \mathcal{M}_{d}(\mathbb{C})$, where $\rho + \rho^\Gamma$ is separable for all quantum states $\rho \in \mathcal{M}_2(\mathbb{C}) \otimes \mathcal{M}_d(\mathbb{C})$ (see separability in 2xN systems).

+

In the language of entanglement witnesses, the problem reduces to finding a common witness that detects both $\rho$ and $\rho^\Gamma$. Let $W$ be the entanglement witness detecting $\rho$, i.e., $\text{Tr} (W\rho) < 0$. Then $W$ is non-decomposable (as $\rho$ is PPT) and is of the canonical form $P+Q^\Gamma - \epsilon \mathbb{I}$, where $P, Q \geq 0$ are such that $\text{range}(P) \subseteq\text{ker}(\delta)$ and $\text{range}(Q) \subseteq \text{ker}(\delta^\Gamma)$ for some bipartite edge state $\delta$ (these are special states that violate the range criterion for separability in an extreme manner, see edge states) and $0 < \epsilon \leq \text{inf}_{|e,f\rangle} \langle e,f | P+Q^\Gamma | e,f \rangle$. If $\delta$ is such that $\text{ker}(\delta) \cap \text{ker}(\delta^\Gamma)$ is not empty, then we can choose $P=Q$ to be the orthogonal projector on $\text{ker}(\delta) \cap \text{ker}(\delta^\Gamma)$, in which case $W=W^\Gamma$ is the common witness. Can we find a class of PPT entangled states for which the previous statement holds? Can optimization of entanglement witnesses be somehow used to ensure this condition?

+
+

Cross-posted on math.SE

+

Cross-posted on physics.SE

+",12710,,55,,3/9/2021 21:59,3/9/2021 21:59,Finding a class $C$ of bipartite PPT states such that entanglement of $\rho \in C$ implies entanglement of $\rho + \rho^{\Gamma}$,,0,3,,,,CC BY-SA 4.0 +12973,2,,12971,7/20/2020 7:11,,3,,"

It is referring the the "function variable" register of figure 1. It consists of $\log_2N$ qubits, all prepared in the $|0\rangle$ state.

+",1837,,,,,7/20/2020 7:11,,,,1,,,,CC BY-SA 4.0 +12974,2,,12970,7/20/2020 7:21,,3,,"
+

My reason for asking the question is that Deutsch seems to be implying +that quantum parallelism is real, and that it can be used for +significant speedup, but my understanding is that quantum parallelism, +in this sense, does not exist.

+
+

This is an interpretational issue. If you are an Everettian, then quantum parallelism is real and this is the source of the speedup. If you're not, then it's not real and this sense of quantum parallelism does not exist. I believe that, for Deutsch, the only way that he understands some of this is if the many worlds theory is true. For him, running these experiments and seeing the speedup is a form of proof of many worlds. Although it is not in the form of making falsifiable predictions.

+

This does not make any actual experiment or theory in his papers wrong. It's just this interpretational issue that is unresolved.

+",1837,,,,,7/20/2020 7:21,,,,4,,,,CC BY-SA 4.0 +12975,2,,6499,7/20/2020 7:50,,3,,"

Remember that the partial transpose condition is generally good for detecting entanglement, i.e. a bipartite state $\rho$ is certainly entangled if the partial transpose is not non-negative. In other words, if there exists a state $|\psi\rangle$ such that +$$ +\langle\psi|I\otimes\text{T}(\rho)|\psi\rangle<0, +$$ +then the state is certainly entangled.

+

If you want to be able to distil some entanglement from $k$ copies then, crudely, you'd like to look at $k$ copies of the partially transposed state, and if that has a negative eigenvalue, you would be able to extract some entanglement.

+

With that level of explanation, you'd ask why looking at more than one copy is any use -- the eigenvalues of many copies of $\sigma$ are easily related to the eigenvalues of a single copy. However, this is because of the extra condition that $|\psi\rangle$ must be Schmidt rank 1 or less. I presume that this is because you can give an explicit distillation protocol based on the properties of $|\psi\rangle$. Essentially, this is due to the fact that you're trying to project onto a Bell pair which, of course, is Schmidt rank 2.

+

For a better understanding that the very hand-wavy suggestions I've just given, you'd want to work through page 2 of https://arxiv.org/abs/quant-ph/9801069

+",1837,,1837,,1/3/2021 9:17,1/3/2021 9:17,,,,5,,,,CC BY-SA 4.0 +12976,1,,,7/20/2020 9:30,,5,257,"

Often when reading about QC algorithms the Authors assume the existence of an Oracle. I understand this is so that they can focus on the overall structure of the algorithm, and an Oracle can be seen as a subroutine that depends on the application. (One famous example is Grover's algorithm)

+

However, I imagine that if you were to try to implement one algorithm yourself for some applications, it would be necessary to assemble the oracle yourself for the algorithm to work. Thus, how do you do it? To make the question more specific I will refer to a particular one I am trying to implement: it's equation 41, 42 of Quantum algorithms for systems of linear equations inspired by adiabatic quantum computing.

+

The idea is the following, Imagine you have an s-sparse matrix of which you know the entries, then they assume there exist an oracle that given the row $|j\rangle$, and column indices $|i\rangle$ returns the matrix entry:

+

\begin{equation} +|j\rangle|i\rangle |z\rangle \rightarrow |j\rangle|i\rangle |z \oplus A_{ji}\rangle +\end{equation}

+

where (I guess) the column and row indices are in binary notation. Moreover, imagine that I would like to implement a sparse matrix with the following shape (1 on two diagonals)

+

\begin{equation} +A=\left[ \begin{array}{cccccc} +0 & 1 & 0 & 0 & \ldots & 0 \\ +1 & 0 & 1 & 0 & \ldots & 0 \\ +. & & & & & . \\ +. & & & & & 1 \\ +0 & 0 & 0 & \ldots & 1 & 0 +\end{array} \right] +\end{equation}

+

Thus, how do I build this oracle? I thought I could try to manually compute cases until I get a matrix, that is to say: I would take a few vectors that encode $|j\rangle$, $|i\rangle$ and try to manually assign values to a matrix that multiplied to those vectors would return either 1 or 0 depending on the indices I have chosen. For instance you if you pick $i,j=3,4$ then $A_{j,i}=1$, whereas it's 0 for $i,j=3,3$ and so on.

+

After trying different indices and matrix multiplication by hand I might be able to identify the shape of this matrix and successively try to guess the gates that would implement that operation. However, this seems time-consuming and I am not sure I can easily generalize it to an arbitrary sized matrix, and probably guessing the necessary gates from the matrix wouldn't be easy either.

+

Is there a smart way to proceed in this case, and is there a general strategy one uses to implement Oracles?

+",11551,,,,,10/8/2021 16:24,How to implement an Oracle,,2,0,,,,CC BY-SA 4.0 +12977,2,,12976,7/20/2020 9:54,,6,,"

In general, you want to understand the process by which you compute the matrix elements if you were doing it by hand. In the example you give, for instance, you're effectively computing $|i-j|==1$. This has a classical algorithm which you can figure out, and there's your oracle.

+

In this specific instance there are probably some smarter things you can do. For instance, introduce the shift operator $T$ which does $T|i\rangle=|i+1\text{ mod N}\rangle$ on an $N$-dimensional system. By applying this to one system, you can then compare if the two systems are equal (basically, a Toffoli, but generalised to the $N$ dimensions). This gives one of the two off-diagonals. Then applying ${T^\dagger}^2$ to the same system undoes the effect and goes in the opposite direction so that comparing the systems again gives you the other off-diagonal. Then you probably just need to implement some special logic to take care of the periodic boundaries.

+",1837,,,,,7/20/2020 9:54,,,,2,,,,CC BY-SA 4.0 +12978,2,,12928,7/20/2020 12:42,,11,,"

First, about teleportation, you say that you think quantum communication takes place in the protocol, but it doesn't. They only share an EPR pair they created together, hence the coordination and after, what Alice sends to Bob when communication takes place are classical bits, she sends the measured bits of the 2 qubits she has, so the only communication we have here is classical.

+

Next, even if Bob has a qubit sent by Alice, even though he technically has more information than with a classical bit, he cannot access it, because the only way to do so is to measure the qubit and by doing that you collapse the qubit over one state and you lose all the other information that were previously in the qubit. Doing operations over the qubit will not change this fact, because you won't know what qubit you were working with.

+

Is this clear enough? Does this answer your question or do you have more?

+",12396,,,,,7/20/2020 12:42,,,,0,,,,CC BY-SA 4.0 +12979,1,,,7/20/2020 12:51,,3,269,"

I am trying to calculate the ground state energy of some simple molecules using 'MolecularGroundStateEnergy' tools in qiskit. When I run the calculations for very small molecules (e.g. H2, HeH+) the jobs appear in the queue very quickly and the calculations work independent of which backend I select. However, running the same code with slightly larger molecules (e.g. LiH, BeH2 and water) the jupyter notebook runs indefinitely and the jobs do not show in the IMBQ queue.

+

Note: I have run successful calculations for all these molecules using the state-vector simulator with no issues.

+

Here is the function i use to calculate energy via VQE given a molecule (created from PySCF driver):

+
def calc_vqe_energy(molecule):
+  driver = molecule
+
+  energy = MolecularGroundStateEnergy(driver = driver, 
+                                      transformation=TransformationType('full'), 
+                                      qubit_mapping=QubitMappingType('parity'), 
+                                      two_qubit_reduction=True, 
+                                      freeze_core=False, 
+                                      z2symmetry_reduction='auto')
+    
+  solver = energy.get_default_solver(quantum_instance)
+    
+  #calculate energy using the above solver 
+  calc = energy.compute_energy(solver)
+  return calc
+
+

this is set up to run using the quantum instance:

+
IBMQ.save_account(token)
+IBMQ.load_account()
+provider = IBMQ.get_provider(hub='ibm-q')
+backend = provider.get_backend("ibmq_qasm_simulator")
+coupling_map = backend.configuration().coupling_map
+quantum_instance = QuantumInstance(backend=backend, shots=1000,
+                                   coupling_map=coupling_map,
+                                   measurement_error_mitigation_cls=CompleteMeasFitter,
+                                   cals_matrix_refresh_period=30, skip_qobj_validation=False)
+
+

Thanks for the help!

+",12714,,55,,7/26/2020 20:07,12/14/2022 1:06,VQE jobs do not appear in queue,,1,3,,,,CC BY-SA 4.0 +12980,2,,12979,7/20/2020 13:22,,0,,"

As it is said in the comment of your question, a good reason for this may be that for larger molecules it will have to take more time to solve the problem.
+If you want to see your job status or monitor it, you can try to use the method job.status() (see details here) or try the job monitor, you can see if it fails or if it runs with those.

+",12396,,,,,7/20/2020 13:22,,,,3,,,,CC BY-SA 4.0 +12981,1,,,7/20/2020 14:50,,2,287,"

If +$$P_{+} = |+\rangle\langle+|=\frac{1}{2}(|0\rangle\langle0|+|0\rangle\langle1|+|1\rangle\langle0| +|1\rangle\langle1|)$$ +and +$$P_{-} = |-\rangle\langle-|=\frac{1}{2}(|0\rangle\langle0|-|0\rangle\langle1|-|1\rangle\langle0| +|1\rangle\langle1|),$$ +then we can choose $\lambda_{+}=1$ and $\lambda_{-}=-1$, so that $\begin {bmatrix}0&1\\ 1&0\end{bmatrix}$ is a hermitian operator for single qubit measurement in the hadamard basis.

+

My confusion is about what this even means? Surely measurement in the hadamard basis simply involves the application of the associated projectors $P_{+}$ and $P_{-}$ to whatever state you possess, with $\frac{P_{i}|\psi\rangle}{\sqrt{tr(P_{i}|\psi\rangle\langle\psi|P_{i})}}$ giving the new state and $\langle\psi|P_{i}|\psi\rangle$ giving the associated probability of obtaining said state. What does the above operator even do? How is it even applied in the role of measurement.

+

I just don't see what use the above operator has, beyond maybe making it clear that $|+\rangle\to|+\rangle$ and $|-\rangle\to-|-\rangle$

+",4991,,55,,9/25/2020 11:42,9/25/2020 11:42,Meaning behind obtaining a hermitian operator for measurement in another basis?,,2,2,,,,CC BY-SA 4.0 +12982,2,,12981,7/20/2020 16:43,,2,,"

The reason for this viewpoint on measurement is primarily historical. Physicists often think of measurements in terms of observables (aka hermitian operators). The way this is related to the more mathematical notion of projective measurements (a type of POVM measurement) is by thinking about the spectral decomposition of a hermitian operator $$M=\sum_i \lambda_i P_i,$$ where the $\lambda_i$'s are the real eigenvalues of $M$ (historically the eigenvalues were relevant measurable quantities in some physical experiment, which is the reason why this viewpoint exists) and each $P_i$ is the orthogonal projection onto the corresponding eigenspace.

+

Now, measuring the observable and obtaining the eigenvalue $\lambda_i$ is analogous to measuring the $i$th outcome of the projective measurement (this projective measurement is exactly the one defined by $\sum_i P_i=I$). Another common viewpoint is to define the expected value of an observable acting on a state by the formula $$E(\lambda_i)=tr(M|\psi\rangle \langle \psi|),$$ where $E(\lambda_i)$ is called the expected value of obtaining the eigenvalue $\lambda_i$.

+",11793,,11793,,8/2/2020 18:06,8/2/2020 18:06,,,,0,,,,CC BY-SA 4.0 +12983,2,,12981,7/20/2020 16:54,,1,,"

You can think of an observable as giving you a more coarse-grained type of information than a projective measurement.

+

A projective measurement $\{P_i\}$ amounts to asking in which of these states am I going to find the system? The answer to this question is of course probabilistic in general, and thus in practice you would find sometimes the state corresponding to $P_1$, sometimes the state corresponding to $P_2$, etc.

+

Suppose now you have an observable written as $A=\sum_k \lambda_k P_k$. Compute the expectation value of this observable amounts to doing the above projective measurement $\{P_i\}$, then attaching the value $\lambda_i$ to the $i$-th outcome, and then calculating the average of the values thus obtained. You can easily tell from this that the amount of information you get from $A$ is smaller than that you get from $\{P_i\}$. Indeed, if you know the probabilities of finding the system in some basis, you can calculate the expectation value of any observable diagonal in that basis.

+

In other words, observables and projective measurements answer different questions. If you want to know the probability of finding some state, you use a projective measurement. But you might only be interested in some average quantity (say, the average position of some particle), in which case it is convenient to describe things in terms of observables.

+",55,,,,,7/20/2020 16:54,,,,6,,,,CC BY-SA 4.0 +12984,1,12987,,7/20/2020 21:48,,2,342,"

I'm a complete beginner and one of the first things I was taught was the teleportation protocol. In the protocol, the party sending its state (which we call say $|\phi\rangle$) makes a Bell measurement on a Bell state it has from before along with $|\phi\rangle$. From this, it finds the indices of its Bell state which it sends to the receiver. But my question is why does the fact that it is measuring $|\phi\rangle$ together with its Bell state have any bearing on the indices of the Bell state, considering $|\phi\rangle$ is not involved in the Bell measurement?

+",12718,,491,,7/21/2020 10:39,7/22/2020 6:54,How does Bell measurement work in the teleportation?,,2,2,,,,CC BY-SA 4.0 +12985,1,12993,,7/21/2020 5:18,,1,110,"

If I create a QuantumCircuit, I can save all the information necessary to reconstruct the circuit using the qasm method. In addition, these qasm strings can be sent directly to the IBM quantum computers (and some others). This makes it convenient for storing these circuits locally and passing them around to collaborators when I want them to test the same circuit unambiguously. In addition, it's faster to load in and send qasms than it is to create circuits every time I want to create the same (large) circuit to run over different calibration cycles.

+

Is there an analogous method for OpenPulse Schedules?

+

The closest I could find was the .instructions method, but this creates an unwieldy tuple which cannot be sent directly to the QCs. This means I cannot just call the instructions method, save the string to a text file, and pass this to a collaborator. While I could write a file parser which reads these strings, this would take a long time and would break if the API is changed. Furthermore, even if I did do this, these tuples saved as a string to a .txt file take up an enormous amount of disk space, so it's actually not faster to manipulate the instructions, and I'm better of re-creating the pulses from scratch every time (which is also slow).

+

If not, has anyone come up with a "schedule qasm" workaround/hack for the time being?

+",2895,,55,,7/26/2020 20:08,7/26/2020 20:08,Is there a standard way to save pulse schedules akin to a qasm for a circuit?,,1,0,,,,CC BY-SA 4.0 +12986,2,,12984,7/21/2020 7:00,,4,,"

Perhaps the following diagram helps to show what acts where. I think you've got a little muddled. +

+",1837,,,,,7/21/2020 7:00,,,,0,,,,CC BY-SA 4.0 +12987,2,,12984,7/21/2020 10:10,,3,,"

In the teleportation protocol, the two parties share the entangled Bell State and it is implemented via a CNOT gate between the state to be sent (suppose Alice is sending the state) and the part of entangled Bell state Alice has. The CNOT gate creates another entangled state whose measurement Alice will send to the second party, say it's Bob, to perform the measurements accordingly. So if you assume the state to be sent is 1 qubit state after CNOT you will have a 3 qubit state (as Bell sate is 2 qubit state). Now Alice will measure the middle qubit which will be the part of classical information she will communicate to Bob.

+

So, you see the controlled-NOT acts as an entangling operator without affecting the first qubit (here $|\phi\rangle$) and changing the entangled Bell state and hence its measurement outcome.

+",12624,,9006,,7/22/2020 6:54,7/22/2020 6:54,,,,0,,,,CC BY-SA 4.0 +12988,1,,,7/21/2020 11:02,,0,676,"

It appears the Slack links to IBMQ slack pages are broken (The link is no longer active). This is case for links on both Qiskit and IBMQ support pages.

+

What is the best way to gain access to the Slack group?

+

Thank you.

+

Link to IBMQ support page: https://quantum-computing.ibm.com/support

+",12714,,,,,7/26/2020 3:37,IBMQ / Qiskit slack links are broken,,2,2,,7/26/2020 11:49,,CC BY-SA 4.0 +12991,1,12992,,7/21/2020 13:27,,1,68,"

Given a mixed state with a $n$ qubit density matrix of the following structure: +$$ +\rho=\pmatrix{\lambda_1&&&&\nu\\&\lambda_2\\ &&\lambda_{\dots}\\ &&&\lambda_2\\ \nu&&&&\lambda_1}, +$$ +so a mixture of a GHZ state and a sum of diagonal contributions of the form: $\prod Z_k^{x_k}$, where $x_k$ is the $k$th bit of the binary number $x\in\{0,1\}^n$, which is restricted to contain an even number of $1$s. The latter restriction ensures that the matrix is symmetric w.r.t. the anti-diagonal.

+

If all $\lambda_k$ are equal, there is a way to measure exponentially small amounts of the GHZ state, as proposed here. It looks to me, that my states don't respect the graph diagonal state requirement given in the comments.

+

What is the best lower bound for $\nu$, that is efficiently measurable (involving polynomially many measurements)?

+",5280,,5280,,7/21/2020 13:35,7/21/2020 13:57,Lower Bound to Measure Entanglement in Mixed States,,1,0,,,,CC BY-SA 4.0 +12992,2,,12991,7/21/2020 13:57,,2,,"

As soon as you impose that $\lambda_x=\lambda_{\bar x}$, your state is of the form that my previous results apply to. This is because you can write +$$ +|x\rangle\langle x|+|\bar x\rangle\langle\bar x|=\frac{1}{2}(|x\rangle+|\bar x\rangle)(\langle x|+\langle\bar x|)+\frac{1}{2}(|x\rangle-|\bar x\rangle)(\langle x|-\langle\bar x|), +$$ +and so this state is diagonal in the GHZ-state basis. This is easily rotated into the graph state basis of a star graph using Hadamards.

+

Let $y\in\{0,1\}^n$ be the choice that gives the largest value of $\lambda_y$ ($y\neq 000\ldots 0$ or $111\ldots 1$). Choose $y$ to specify your bipartition of the qubits. This is entangled when $\lambda_y<\nu$.

+",1837,,,,,7/21/2020 13:57,,,,3,,,,CC BY-SA 4.0 +12993,2,,12985,7/21/2020 14:18,,1,,"

I believe there are several developments about this on Qiskit to make the use of Pulse easier. Try to check the PR or the issues regarding Pulse, maybe you'll find what you are looking for.
+I also found an issue about a QASM 3.0, I think this will interest you! :)

+",12396,,,,,7/21/2020 14:18,,,,1,,,,CC BY-SA 4.0 +12994,2,,12928,7/21/2020 15:21,,3,,"

It sounds like the source of your misunderstanding is the following

+
+

Bob is able to harness the information of a qubit which contains more information than regular classical bits

+
+

This statement is not true. There is a theorem known as Holevo's theorem which states that the maximum information that can be obtained from a single qubit is one bit.

+",5669,,,,,7/21/2020 15:21,,,,0,,,,CC BY-SA 4.0 +12995,1,,,7/21/2020 20:09,,0,183,"

I have 2 qubits which are in an unknown pure state i.e. their density matrix $\rho$ can be expressed as $|\psi\rangle\langle\psi|$.

+

Let the initial state be $|\psi\rangle = c_{00}|00\rangle + c_{01}|01\rangle + c_{10}|10\rangle + c_{11}|11\rangle$. These coefficients $c_{i}$ are unknown.

+

I wish to find out if they are entangled or seperable? Can this be done by constructing a Quantum Oracle or some other circuit?

+

The Rules are:

+
    +
  • We do not have access to the circuit which created this state $|\psi\rangle$.
  • +
  • The initial state of the qubits can be destroyed at the end of the measurement.
  • +
  • Any method which has $>0.5$ chance of success is acceptable.
  • +
  • Free to use ancillary qubits.
  • +
+

Edit: I have tried to rewrite the question in order to clarify it as per suggestions in the comments.

+",8757,,8757,,7/23/2020 4:04,7/23/2020 4:04,Is there a way to construct a quantum circuit/oracle to check if 2 qubits in an unknown pure state are entangled?,,2,3,,,,CC BY-SA 4.0 +12996,2,,12995,7/21/2020 20:20,,2,,"

No.

+

For instance, if I either give you $|00\rangle$ or $|11\rangle$ with 50% probability each, or $|00\rangle\pm|11\rangle$ with 50% probability each, there is no way to distinguish these two cases - not even with any whatsoever small probability. The mathematical reason is that those are described by the same density matrix - but you always get some pure state!

+

However, one of those sets consists of entangled states, while the other one doesn't.

+

The situation is different if you get the same state several times and can do a number of tests on each of those copies.

+",491,,491,,7/21/2020 21:27,7/21/2020 21:27,,,,2,,,,CC BY-SA 4.0 +12997,2,,12988,7/21/2020 20:22,,2,,"

This link was shared in the Qiskit Global Summer School Discord channel.

+

https://join.slack.com/t/qiskit/shared_invite/zt-fybmq791-hYRopcSH6YetxycNPXgv~A

+

I hope this works for you!

+",12728,,,,,7/21/2020 20:22,,,,0,,,,CC BY-SA 4.0 +12998,1,13002,,7/21/2020 23:34,,2,212,"

Both Simon's algorithm and the algorithm for period finding begin by placing qubits in the equal superposition state, but Simon's algorithm uses the n-qubit Hadamard $H^{\otimes n}$ while the period finding algorithm uses the quantum Fourier transform. My understanding is both QFT and the n-qubit Hadamard perform the same operation on the $|00...0\rangle$ state, creating the $\frac{1}{\sqrt{2^n}} \sum_{x\in\{0,1\}^n}|x\rangle$ state. I'm reading this from the Qiskit textbook.

+

When the result is the same, why do the two algorithms use different ways to achieve the equal superposition? More generally, when would one use the n-qubit Hadamard, and when would one use the QFT?

+",10388,,,,,7/23/2020 8:21,N-Qubit Hadamard vs Quantum Fourier Transform,,1,0,,,,CC BY-SA 4.0 +12999,1,13000,,7/22/2020 0:53,,3,201,"

I have an extension to the following question: How to get the relative phase of a qubit? +How do I get the relative phase of a pair of entangled qubits such as $$\frac{1}{\sqrt{2}}(|00\rangle+e^{i\theta}|11\rangle)$$

+

in which I want to find theta. I tried to use a similar methodology as the answer in the linked question above, but with no success.

+",11644,,,,,7/22/2020 9:20,How to get the relative phase of an entangled pair of qubits,,1,1,,,,CC BY-SA 4.0 +13000,2,,12999,7/22/2020 3:56,,5,,"
    +
  1. Apply a CNOT gate with one of the qubits as control and the other as target. You'll get
  2. +
+

$$\frac{1}{\sqrt{2}}(|0\rangle+e^{i\theta}|1\rangle) \otimes |0\rangle$$

+
    +
  1. Use the methodology from How to get the relative phase of a qubit? for the first qubit :-)
  2. +
+",2879,,2879,,7/22/2020 9:20,7/22/2020 9:20,,,,3,,,,CC BY-SA 4.0 +13001,1,,,7/22/2020 6:05,,1,100,"

I have noticed that the csv files exported for results don’t have the resolution to correctly describe the output states for larger sets of qubits. It looks like it only exports numbers up to 15 digits long without cutting them. For example, if I try to get results on 17 qubits, it doesn’t carry the information about the last two numbers, so when I change the format to “custom”, in Excel, with 17 0’s, and I have done a circuit with qubits 0, 1, 15 and 16 in superposition and the rest left as 0, there will be, for example, 4 results at the end listed as “11000000000000000”.

+

Has this been addressed before? Am I doing something wrong? Is there a solution?

+",12676,,9006,,7/22/2020 6:43,7/22/2020 10:26,CSV files cut results short in ibm-q-experience?,,1,0,,,,CC BY-SA 4.0 +13002,2,,12998,7/22/2020 6:40,,3,,"

As you pointed out correctly, both $H^{\otimes n}$ and QFT applied on input state $|0\rangle^{\otimes n}$ return state

+

$$ +|\psi\rangle = \frac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n}|i\rangle. +$$

+

There is no special reason why $n$ qubit Hadamard gate cannot replace QFT for $|0\rangle^{\otimes n}$ input. Maybe, an author of article about Simon's algorithm wanted to be more precise.

+

Overall, it does not matter which approach you use. Both return same result for $|0\rangle^{\otimes n}$ input.

+

EDIT (based on DaftWullie comment): However, in practice $n$ qubits Hadamard is prefered as it is very simple circuit in comparison with QFT.

+",9006,,9006,,7/23/2020 8:21,7/23/2020 8:21,,,,4,,,,CC BY-SA 4.0 +13003,2,,13001,7/22/2020 8:13,,2,,"

I think the problem you are experiencing comes from Excel and not IBM Quantum Experience. Check this explanation, it explains why the bug you have happens, and ways to work around it.
+Hope this will help :)

+

Edit : I think I found another workaround to your problem. Try this and tell me if this works for you:

+
    +
  1. Download the CSV file but don't touch it yet.
  2. +
  3. Open a new Excel file.
  4. +
  5. Click the "Data" tab, then click on "Get data" on the upper left, then "From file", then "From text/CSV".
  6. +
  7. Choose your CSV file you want to download.
  8. +
  9. Normally, at this point you should have a window popping to your screen, and at the bottom of it 3 buttons, "Load", "Transform data", and "Cancel". Click on "Transform data".
  10. +
  11. Select the first column (the one with all the states) then click on the "Transform" tag at the top of the window, you should have an option right below "Data type : Decimal number". Click on this and select "Text". Click on "File" and select "Close and load".
  12. +
+

When I do this, the sheet downloads well and I have the full state written without the bug you mentioned. Does this work for you?

+",12396,,12396,,7/22/2020 10:26,7/22/2020 10:26,,,,2,,,,CC BY-SA 4.0 +13004,2,,12928,7/22/2020 8:19,,1,,"

In your argument, you are missing the relativistic causality. Bob and Alice simply cannot decide who did the measurement first because their space-time measurement events are connected by the space-like curve. (because they do the measurements targeting the faster than light communication.) Depending on the inertial reference frame, Bob can be first or Alice can be first.

+",12191,,12191,,7/22/2020 8:45,7/22/2020 8:45,,,,0,,,,CC BY-SA 4.0 +13005,1,,,7/22/2020 8:36,,1,224,"

Let us suppose that I have the state +\begin{equation} +\frac{1}{\sqrt2}(\alpha|0\rangle|+\rangle+\beta|1\rangle|-\rangle) +\end{equation} +and I choose to measure the first qubit in the basis $\{(1/\sqrt{2})(|0\rangle\pm e^{i\phi}|1\rangle)\}$. +How can I perform this measurement and how can I find the related outcomes (i.e. the eigenvalues) provided only the basis in which I have to measure the system? Being kinda new to quantum mechanics I am really confused about the algebraic aspects of this problem, but I have an intuitive idea of what performing a measurement is.

+",12731,,55,,7/22/2020 16:21,7/22/2020 16:21,How do I measure a single qubit in a two-qubit state?,,1,0,,,,CC BY-SA 4.0 +13006,2,,13005,7/22/2020 9:01,,1,,"

Let $P_{\pm}$ be the projectors onto the two orthonormal basis states of the measurement. So, +$$ +P_+=\frac{1}{2}(|0\rangle\langle 0|+|1\rangle\langle 1|+e^{-i\phi}|0\rangle\langle 1|+e^{i\phi}|1\rangle\langle 0|). +$$ +Also, let $|\psi\rangle$ be the state that you're measuring (note that this must be normalised. Yours might be depending on your constraints on $\alpha$ and $\beta$, but we wouldn't usually have a factor of $1/\sqrt{2}$ present).

+

Since you are measuring the first qubit of two, the actual projectors should be written as $P_\pm\otimes I$. Now, we get the + result with probability +$$ +p_+=\langle\psi |P_+\otimes I|\psi\rangle, +$$ +and if the result is $+$, the state after measurement is +$$ +(P_+\otimes I)|\psi\rangle/\sqrt{p_+}. +$$ +In this case, $p_+=p_-=\frac12$.

+",1837,,,,,7/22/2020 9:01,,,,4,,,,CC BY-SA 4.0 +13007,1,,,7/22/2020 9:36,,1,107,"

Now, I try to understand some concept of Quantum Noise Model and Quantum Channel. The Quantum Noise can be represented as a quantum operator with their own probability. As far as I concerned,(I dont know if it is right), it totally included Bit Flip, Phase Flip, Bit-phase Flip, Amplitude damping and Phase damping. and all the five noise can happen with their own probability so that the quantum status can be represented as a mixed state.

+

However, there is a question, The five error below is happened because of systematic gate error and environmental decoherence. So systematic gate error and environmental decoherence can both cause the five error or each of them match some of the error?

+

And the five noise or error from above can happen independently or not, in other word, can the five error happen in the same time with their own probability?

+",11765,,55,,9/25/2020 11:41,9/25/2020 11:41,A question about quantum noise model,,0,0,,,,CC BY-SA 4.0 +13008,1,,,7/22/2020 11:44,,5,371,"

Why do quantum operations need to be reversible?

+

Is it because of the physical implementation of the qubits or operators neesd to be unitary so that the resultant states fit in the Bloch sphere?

+",12099,,55,,7/22/2020 16:06,4/5/2022 18:55,Why do quantum operations need to be reversible?,,2,1,,,,CC BY-SA 4.0 +13009,2,,13008,7/22/2020 11:58,,5,,"

"Why" is quite a nebulous concept that, ultimately, comes back to your understanding of quantum mechanics. For me, the way that I set up QM is with a set of postulates. The first postulate is that quantum states are represented by vectors in a Hilbert space of length 1.

+

A second postulate is essentially that operations are linear. (This is not how I would phrase it if I were teaching the whole subject, but has the essential content for the argument.)

+

If you then assert that an operation must map valid quantum states to valid quantum states (what else makes sense?) then you can prove that the only valid linear operation is a unitary. Unitaries are reversible.

+

It's not really about the Bloch Sphere directly because the Bloch Sphere only really works for qubits, and this is a more general result. There is, however, a visualisation of the above discussion that, in the case of qubits, maps to the Bloch Sphere.

+

(I have measurement as an extra postulate. This contains non-linear, and also irreversible operations. Although some might assert that these are indeed unitary, and hence reversible, in a larger space. In the context of quantum computing, it is worth pointing out that entire computations can be done just with irreversible measurements, e.g. measurement-based computation, entirely doing away with unitary operations!)

+",1837,,1837,,7/23/2020 7:31,7/23/2020 7:31,,,,0,,,,CC BY-SA 4.0 +13011,2,,13008,7/22/2020 16:17,,1,,"

Not all quantum operations are reversible. Consider for example the quantum channel $\Phi$ defined as $\Phi(\rho)=\operatorname{tr}(\rho)\sigma$. This is a channel that gives as output the same state regardless of the input. This is not a reversible operation, as there is no information in the output that allows you to infer what the input was (you can imagine this describing the act of completely ignoring whatever state you were given and always produce as output a specific state $\sigma$).

+

The operations that are reversible are the ones described by unitary operators (or in the density matrix formalism, by maps of the form $\rho\mapsto U\rho U^\dagger$ with $U$ unitary). Any operation mapping pure states to pure states is going to be unitary. +These are the operations describing the evolution of a quantum state without loss of information.

+

On a more general level, I would say that requiring the time evolution in a physical theory to be reversible is akin to assuming that the state at a given time is fully determined by the state of the system at previous times, and that different initial conditions lead to different final states.

+",55,,,,,7/22/2020 16:17,,,,0,,,,CC BY-SA 4.0 +13012,1,13084,,7/22/2020 17:08,,1,163,"

In general, an entangled state is one which cannot be decomposed as $\sum_{i}p_{i} \bigl(\rho_{i}^A\otimes\rho_{i}^B\bigr)$. But such an entangled state could still be mixed in principle.

+

How would one create a mixed entangled state? For instance, can one create such a state by tracing out one qubit or a subsystem of a pure state?

+",4991,,124,,7/29/2020 10:35,7/29/2020 10:35,How does one go about constructing a mixed entangled state?,,2,8,,,,CC BY-SA 4.0 +13013,1,13020,,7/22/2020 17:56,,4,193,"

Define $\newcommand{\PP}{\mathbb{P}}\newcommand{\ket}[1]{\lvert #1\rangle}\newcommand{\tr}{\operatorname{tr}}\newcommand{\ketbra}[1]{\lvert #1\rangle\!\langle #1\rvert}\PP_\psi\equiv\ketbra\psi$, and let $\ket\psi,\ket\phi$ be two bipartite states such that $\tr_2(\PP_\psi)\prec\tr_2(\PP_\phi)$. +Here, $A\prec B$ with $A,B$ positive operators means that the vector of eigenvalues of $A$ is majorised by that of $B$: $A\preceq B\Longleftrightarrow\lambda(A)\preceq\lambda(B)$.

+

A step to prove Nielsen's theorem, used in the proof of the theorem given here (pdf alert) is that $\tr_2(\PP_\psi)\prec\tr_2(\PP_\phi)$ implies $\tr_2(\PP_\psi)=\Psi(\tr_2(\PP_\phi))$ for some mixed unitary channel $\Psi$. +More precisely, it implies that $\tr_2(\PP_\psi)=\Psi( W\tr_2(\PP_\phi)W^\dagger)$ for some mixed unitary channel $\Psi$ and isometry $W$ (though these two statements seem pretty much equivalent to me).

+

To show this, an important observation seems to be the fact that, introducing the operators $X,Y$ with components $X_{ij}=\psi_{ij}, Y_{ij}=\phi_{ij}$ (that is, $\ket\psi= \operatorname{vec}(X)$ and $\ket\phi= \operatorname{vec}(Y)$), we have +$$\tr_2(\PP_\psi) = XX^\dagger,\qquad \tr_2(\PP_\phi) = YY^\dagger.$$ +Suitably defining the underlying vector spaces, we can always assume $XX^\dagger ,YY^\dagger >0$. Moreover, $XX^\dagger\prec YY^\dagger$ implies $\operatorname{rank}(XX^\dagger)\ge\operatorname{rank}(YY^\dagger)$.

+

Why does this imply that the existence of a mixed unitary channel $\Phi$ and isometry $W$ such that $XX^\dagger = \Psi(WYY^\dagger W^\dagger)$? The reason is probably trivial but I'm not seeing it right now.

+",55,,55,,10/21/2021 10:40,10/21/2021 10:40,Prove that $A\preceq B$ implies $A=\Psi(B)$ for some channel $\Psi$,,1,5,,,,CC BY-SA 4.0 +13016,2,,12916,7/22/2020 18:00,,2,,"

The filters help in reducing the out-of-band radiations in the system, but quantum measurements are not only susceptible to thermal radiation or external noises. For fast computation using transmon qubits, a DRAG (Derivative Removal by Adiabatic Gate) in which a fine-tuned out-of-phase pulse is applied, proportional to the derivative of the original pulse which will increase the fidelity to about 99% and hence, we minimize leakage of information. So, we do not want to filter out this pulse.

+

Similarly, for a larger number of qubits, we'd have to tune in and out of resonance to control the transition frequency which is done by applying current to the flux bias line. In QED you have resonators for carrying out coupling and readout and the flux is generated in the circuit which detunes the qubit from its operating frequency and adds a significant phase to it, and this is handled by applying pulse-shaping techniques like fast adiabatic pulses and controlling the energy state of the qubit. So, you can definitely not use only filters at every stage of the quantum process and hence attenuators are used instead but at further steps, you can add filters for example when you are dealing with distortions of electrical components where you can desert the extra frequencies.

+

Though this still is quite a challenge as we can still not correct distortion with precision, maybe if the approach is changed we can do that, but the effective one right now as I discussed in the case of superconducting qubits, will require attenuators in the cables for experimenting with charge qubits that are as you specified driver lines that as I have read are used for controlling the quantum states of qubits with a microwave tone realizing single-qubit gates, and for probing the frequency shift of readout resonators, the flux lines, and the output lines.

+",12624,,2293,,4/16/2021 21:05,4/16/2021 21:05,,,,8,,,,CC BY-SA 4.0 +13017,2,,12995,7/22/2020 18:33,,0,,"

$\newcommand{\calU}{\mathcal{U}}\newcommand{\ket}[1]{\lvert#1\rangle}$Suppose such a circuit existed, and denote with $\calU$ the unitary describing its overall action. +For this to be a "circuit detecting entanglement", there should be two types of output states, one corresponding to the answer "yes, the input was entangled" and the other corresponding to the answer "no, the input was not entangled".

+

In other words, there should be two orthogonal subspaces $\mathcal V_e$ and $\mathcal V_{ne}$ such that $\calU\lvert\psi\rangle\in\mathcal V_e$ for all entangled states $\lvert\psi\rangle$, and $\calU\lvert\phi\rangle\in\mathcal V_{ne}$ for all separable $\lvert\phi\rangle$.

+

Let $\ket{\psi_1},\ket{\psi_2}$ be two orthogonal separable states, so that $\calU\ket{\psi_i}\in\mathcal V_{ne}$. Then, by linearity, we must also have $\calU(\alpha\ket{\psi_1}+\beta\ket{\psi_2})\in\mathcal V_{ne}$ for any pair of complex coefficients with $|\alpha|^2+|\beta|^2=1$.

+

But all entangled states can be written as superpositions of separable states, thus this circuit is bound to incorrectly classify all entangled states as separable as well.

+",55,,,,,7/22/2020 18:33,,,,5,,,,CC BY-SA 4.0 +13018,1,,,7/22/2020 19:24,,3,259,"

I'm learning about Quantum Key Distribution, and just learned about the BB84 exchange. I learned that it can be used to exchange a key for a one-time pad, which would allow for information-theoretically secure communication. As I understand the algorithm:

+
    +
  1. Bob and Alice decide on 2 different bases to encode quantum states
  2. +
  3. Alice chooses a basis and a random bit to prepare a qubit and transmits the prepared qubit to Bob.
  4. +
  5. Bob randomly chooses a basis to measure the received qubit in
  6. +
  7. Alice and Bob communicate over a classical channel and figure out which bits they measured with the same basis
  8. +
+

Eve can try to intercept the qubit Alice sends, but Eve has to randomly guess which basis to measure in because she has no information about which basis Alice prepared the qubit in. This means Eve has a 50% chance of choosing the right basis for any given transmitted qubit and a 75% chance of not introducing a disagreement between Alice and Bob by collapsing the state of the qubit.

+

Let $n$ be the number of qubits Alice and Bob measure in the same basis. This means that Eve has $0.75^n$ chance of getting lucky and getting the key while going unnoticed. She could then check if Alice and Bob continue to communicate to see if she went unnoticed. Eve can also eavesdrop over the classical channel Alice and Bob use to communicate the bases they used to throw out measurements she made that were not included in the key. Now Eve has constructed the key and knows it's the correct key.

+

While the probability of Eve measuring the key correctly scales exponentially with respect to $n$, it seems like this algorithm is not safe unless roughly $n > 1000$.

+

Is there something I'm misunderstanding, or is the above argument valid? Is there any way to guarantee Eve has no chance of guessing the correct key?

+

This is an answer to a similar question but does not answer my final question.

+",12736,,,,,7/23/2020 7:26,Can Eve randomly guess the correct bases in the BB84 exchange of a one-time pad?,,1,7,,,,CC BY-SA 4.0 +13020,2,,13013,7/22/2020 22:55,,4,,"

Let $\rho_{d}, \sigma_{d}$ be the (simultaneously diagonal) density matrices whose eigenvalues are $\{ p_{j} \}, \{ q_{j} \}$, respectively (represented as probability vectors below). Then, if $\vec{p} \succ \vec{q}$, the following sequence of arguments can be observed:

+
    +
  1. There exists a bistochastic matrix $M$ such that $M \vec{p} = \vec{q}$ (basic result of majorization theory, see Marshall and Olkin, for example.)
  2. +
  3. Using Birkhoff's theorem, the bistochastic can be written as a convex combination of permutations: $M = \sum\limits_{j} r_{j} P_{j}$.
  4. +
  5. $M$ can be ``quantized'' into a (mixed unitary) CPTP map, $M \mapsto \mathcal{M} = \sum\limits_{j} r_{j} \mathcal{U}_{P_{j}}$, where $\mathcal{U}_{P_{j}}$ is the unitary superoperator, defined as $\mathcal{U}_{P_{j}}(\cdot) = P_{j} (\cdot) P_{j}^{\dagger}$. Recall that permutations have a unitary representation.
  6. +
  7. The action of $\mathcal{M}$ is to transform $\rho_{d} \mapsto \sigma_{d}$.
  8. +
+

Why can we start from simultaneously diagonal states $\rho_{d}, \sigma_{d}$? Hint: the partial trace.

+

In several quantum resource theories the state transformation reduces to ``classical majorization'', i.e., majorization of vectors (as opposed to say matrix majorization), for example, resource theory of coherence, non-uniformity, etc.

+",1108,,1108,,7/23/2020 20:22,7/23/2020 20:22,,,,3,,,,CC BY-SA 4.0 +13024,1,,,7/23/2020 3:33,,1,391,"

I was reading about the Steane's code for QEC. However I could not find any implementation or circuit describing its creation. Can anyone share/explain how the Steane's code could be implemented.

+

The answer can be Circuit Diagram or Implementation in any Quantum Programming Language (Q#, Qiskit etc)

+",8757,,,,,7/24/2020 8:29,Circuit for implementing Steane's code for Quantum Error Correction,,1,0,,,,CC BY-SA 4.0 +13025,2,,13024,7/23/2020 7:10,,1,,"

One way of defining the Steane code is via its stabilizers. There's a set of operators $\{K_n\}_{n=1}^6$ which all commute, such that a state in the code space is defined by being the $+1$ eigenstate of all these operators.

+

So, you can perform syndrome extraction simply by measuring the value of each stabilizer. This is a standard circuit, + +(the $\sigma_1\otimes\ldots\otimes\sigma_n$ corresponds to a single $K_i$ term in this setting).

+

One very simple way that you can produce a codeword in the code space is simply to start with $|\psi\rangle$ as any state you want. Perform syndrome extraction and error correction on it, and the result must be a word in the space.

+

In fact, if you set $|\psi\rangle=|0000000\rangle$, you'll get the logical 0 state because this is a $+1$ eigenstate of $Z^{\otimes 7}$. Moreover, this state is already the $+1$ eigenstate of all the $Z$-type stabilizers so you don't have to measure any of those.

+

There do exist unitary encoding methods, but from the conceptual point of view, this is a very simple method that generalises to any stabilizer code.

+",1837,,1837,,7/24/2020 8:29,7/24/2020 8:29,,,,0,,,,CC BY-SA 4.0 +13026,2,,13018,7/23/2020 7:26,,3,,"

I like Norbert's comment about the chance of Eve guessing the message without any eavesdropping (it points out that the probability of Eve succeeding can never be made 0), but thought I should also point out a very different perspective - that of the context in which you would use quantum key distribution.

+

In the context of today's communication, 1000 bits is a very small message. For something that small which needs high security, the two parties would probably meet up in person in advance and exchange a secret key. No key distribution protocol required (OK, I know there will always be people who cannot meet up, especially in these crazy times). The setting where key distribution becomes more relevant is when there are unpredictable quantities of data to be sent, e.g. large volumes, or even continuously generated data. Just think what value $n$ has for a gigabyte of data (even ignoring the fact that some proportion of the data needs to be sacrificed for security checks, error correction, privacy amplification etc). $n=8\times (1024)^3\approx 9\times 10^9$. Put that in your exponential!

+",1837,,,,,7/23/2020 7:26,,,,0,,,,CC BY-SA 4.0 +13027,2,,13012,7/23/2020 9:58,,1,,"

A mixed separable state is written in the form +$$ +\rho=\sum_ip_i\sigma^A_i\otimes\sigma^B_i +$$ +where the $\sigma_i$ are valid density matrices on a single site.

+

The example you give, say $\rho=\frac12|00\rangle\langle00|+\frac12|11\rangle\langle 11|$ is exactly of this form. Specifically, +$$ +p_0=p_1=\frac12,\qquad \sigma^A_0=\sigma^B_0=|0\rangle\langle 0|,\qquad \sigma^A_1=\sigma^B_1=|1\rangle\langle 1|. +$$

+

In general, it can be tricky to definitively prove that such a decomposition does not exist. However, in the case of two-qubits, there's an if and only if condition: the state is entangled if and only if its partial transpose is not non-negative (i.e. contains a negative eigenvalue).

+

The classic example is the Werner state, +$$ +\rho=\frac{1-p}{4}I+p|\psi\rangle\langle\psi| +$$ +where $|\psi\rangle$ is a two-qubit Bell state. This can be written out as a matrix +$$ +\rho=\left(\begin{array}{cccc} +\frac{1-p}{4} & 0 & 0 & 0 \\ +0 & \frac{1+p}{4} & -\frac{p}{2} & 0 \\ +0 & -\frac{p}{2} & \frac{1+p}{4} & 0 \\ +0 & 0 & 0 & \frac{1-p}{4} +\end{array}\right) +$$ +If we take the partial transpose of this, we get +$$ +\rho^T=\left(\begin{array}{cccc} +\frac{1-p}{4} & 0 & 0 & -\frac{p}{2} \\ +0 & \frac{1+p}{4} & 0 & 0 \\ +0 & 0 & \frac{1+p}{4} & 0 \\ +-\frac{p}{2} & 0 & 0 & \frac{1-p}{4} +\end{array}\right) +$$ +This has a negative eigenvalue if $p/2>(1-p)/4$.

+",1837,,,,,7/23/2020 9:58,,,,9,,,,CC BY-SA 4.0 +13028,2,,12660,7/23/2020 11:00,,1,,"

To see intuitively why this protocol increases the entanglement after each iteration, we can work out an example where our initial state is say $\lvert 00\rangle+\lvert 11\rangle$. Upon passing through a 50:50 Beam Splitter, we get: +$$|00\rangle+|11\rangle = |00\rangle+ a_{0}^{\dagger}a_{1}^{\dagger}|00\rangle \hspace{3mm} \text{transforms} \hspace{3mm}|00\rangle + \frac{1}{2}(a_{2}^{\dagger} + ia_{3}^{\dagger})(ia_{2}^{\dagger} + a_{3}^{\dagger})|00\rangle \\ +=|00\rangle + \frac{i}{\sqrt2}(|20\rangle+|02\rangle)$$ +(Ignore normalisation in the above equations) +Now, upon detecting vacuum in this state and another copy of this state, we clearly see that the remaining modes now occur in a form of superposition very similar to the two mode squeezed sates which are entangled. +And since the recurrence happens by the action of the same beam splitter on similar kind of states, we can intuitively see that we get closer and closer to the superposition +$$|\psi\rangle=\frac{1}{\cosh{r}}\sum^{\infty}_{n=0} (-1)^{n}e^{in\phi}\tanh^{n}r |n,n\rangle$$

+",11668,,4622,,8/23/2020 15:12,8/23/2020 15:12,,,,0,,,,CC BY-SA 4.0 +13029,1,13030,,7/23/2020 11:32,,2,113,"

I have heard this is the case but can not find a source even discussing this.

+

Can any problem that can be solved by a Quantum Computer, also be solved by the quantum circuit model?

+

I realise that even if this is true, it won't always be the best option, I mean theoretically.

+

And I have heard that CNOT gate combined with arbitrary rotations allow to implement any gate. But nothing that makes it clear that the circuit can do anything.

+",12510,,9006,,7/24/2020 6:24,7/24/2020 6:33,Is the gate-based model of QC universal?,,2,0,,,,CC BY-SA 4.0 +13030,2,,13029,7/23/2020 11:50,,5,,"

The quantum circuit model is one of the possible models for quantum computation. It is the most studied, because it is quite practical.

+

Back to the origins, you can look at papers by David Deutsch, like:

+

Quantum computational networks +Proc. R. Soc. Lond. A 425, 73-90 (1989)

+

For a slow start, I suggest to read Nielsen and Chuang's book and maybe Scott Aaronson's lecture notes (Section 16.2.2).

+",5551,,,,,7/23/2020 11:50,,,,3,,,,CC BY-SA 4.0 +13031,1,13038,,7/23/2020 15:11,,4,262,"

As shown e.g. in Watrous' book (Proposition 6.6, page 314), a separable state $\rho$ can always be written as a convex combination of at most $\mathrm{rank}(\rho)^2$ pure, separable states.

+

More precisely, using the notation in the book, any separable state $\xi\in\mathcal X\otimes\mathcal Y$ can be decomposed as +$$\xi = \sum_{a\in\Sigma} p(a) \, x_a x_a^*\otimes y_a y_a^*,\tag1$$ +for some probability distribution $p$, sets of pure states $\{x_a: a\in\Sigma\}\subset\mathcal X$ and $\{y_a: a\in\Sigma\}\subset\mathcal Y$, and alphabet $\Sigma$ with $\lvert\Sigma\rvert\le \mathrm{rank}(\xi)^2$. +This is shown by observing that $\xi$ is an element of the real affine space of hermitian operators $H\in\mathrm{Herm}(\mathcal X\otimes\mathcal Y)$ such that $\mathrm{im}(H)\subseteq\mathrm{im}(\xi)$ and $\mathrm{Tr}(H)=1$. This space has dimension $\mathrm{rank}(\xi)^2-1$, and thus from Carathéodory we get the conclusion.

+

Consider the case of the totally mixed state in a space $\mathcal X\otimes\mathcal Y$ with $\mathrm{dim}(\mathcal X)=d, \mathrm{dim}(\mathcal Y)=d'$. For this state, $\xi\equiv \frac{1}{dd'}I = \frac{I}{d}\otimes\frac{I}{d'}$, we have $\mathrm{rank}(\xi)=\lvert\Sigma\rvert=dd'$ for the standard choice of decomposition. +Generating random convex combinations of product states I also always find $\lvert\Sigma\rvert=\mathrm{rank}(\xi)$ (albeit, clearly, the numerics doesn't check for the existence of an alternative decomposition with less than ${\rm rank}(\xi)$ components). In the case $\lvert\Sigma\rvert=1$, it is trivial to see that we must also always have $\lvert\Sigma\rvert=\mathrm{rank}(\rho)$.

+

What are examples in which this is not the case? +More precisely, what are examples of states for which there is no alphabet $\Sigma$ with $\lvert\Sigma\rvert\le\mathrm{rank}(\xi)$, such that $\xi=\sum_{a\in\Sigma}p(a)x_a x_a^*\otimes y_a y_a^*$?

+
+

The following is the Mathematica snippet I used to generate random convex combinations of product states:

+
RandomUnitary[m_] := Orthogonalize[
+  Map[#[[1]] + I #[[2]]&, #, {2}]& @ RandomReal[
+    NormalDistribution[0, 1], {m, m, 2}
+  ]
+];
+randomPureDM[dim_] := First@RandomUnitary@dim // KroneckerProduct[#, Conjugate@#] &;
+With[{numComponents = 4, bigDim = 10},
+  With[{
+      mats = Table[KroneckerProduct[randomPureDM@bigDim, randomPureDM@bigDim], numComponents],
+      probs = RandomReal[{0, 1}, numComponents] // #/Total@# &
+    },
+    Total[probs*mats] // Eigenvalues // Chop
+  ]
+]
+
+
+

A related question on physics.SE is What is the minimum number of separable pure states needed to decompose arbitrary separable states?.

+",55,,55,,7/13/2021 12:05,7/13/2021 12:05,What separable $\rho$ only admit separable pure decompositions with more than $\mathrm{rank}(\rho)$ terms?,,1,3,,,,CC BY-SA 4.0 +13033,1,13037,,7/23/2020 20:20,,5,452,"

I don't know how to prepare using Qiskit the following state in order to implement a Steane's 7-qubit code circuit (I omit the normalization factor): +\begin{align*} |0_L\rangle =&|0000000\rangle+|1010101\rangle+|0110011\rangle+|1100110\rangle+ +\\ ++&|0001111\rangle+|1011010\rangle+|0111100\rangle+|1101001\rangle +\end{align*} +Furthermore, I was wondering if it exists a general procedure in order to prepare an arbitrary multipartite state like $|0_L\rangle$.

+",12731,,9459,,7/25/2020 9:46,12/20/2021 10:31,How to create the logical $|0_L\rangle$ state for the Steane's 7-qubit code?,,3,6,,,,CC BY-SA 4.0 +13035,2,,13029,7/24/2020 6:33,,1,,"

A Toffoli gate is in fact NAND gate (when target qubit is in state $|1\rangle$, othwerwise it implements AND gate). Since NAND gate allows to implement any classical logical function and hence any classical algorithm, any gate based quantum computer is universal from classical point of view.

+

Note that Toffoli gate can be realized with CNOT, H, S and T gates. This combination of gates also enable to implement any unitary gate on quantum computer.

+

To have a universal quantum computer, we need a gate preparing superposition. This can be done with Hadamard gate.

+

There are other gate sets which are universal, for example CNOT, H, S and z-rotation, or CNOT and x,y and z rotations etc.

+",9006,,,,,7/24/2020 6:33,,,,0,,,,CC BY-SA 4.0 +13036,2,,13033,7/24/2020 7:09,,-1,,"

Qubits are initialized at 0 so would you be wanting to flip certain qubits to 1?

+

I’m tempted to just apply x gates to obtain the necessary bits.

+

For example: |ψ⟩=...+|1010101⟩+...

+

from qiskit import QuantumCircuit +qc = QuantumCircuit(7) +qc.x([0, 2, 4, 6])

+

I hope I understood your question :)

+",12728,,,,,7/24/2020 7:09,,,,2,,,,CC BY-SA 4.0 +13037,2,,13033,7/24/2020 11:12,,4,,"

Here is a circuit that can create the desired state (similar ideas were discussed in this answer), if all mentioned measurements yield $|0\rangle$ state:

+ +

or in a more compact form (the circuits are constructed via quirk). The first three qubits are ancillary qubits and the rest are the qubits where $|0_L\rangle$ will be created if after the measurements all ancillary qubits are in the $|000\rangle$ state, otherwise one should repeat the procedure until the desired measurement result will be archived.

+
+

Let's go step by step. The circuit has three parts and in each step, we assume that the measured state of the ancillary is $|0\rangle$. The normalization factors are omitted.

+
    +
  1. The state after measuring the first ancillary qubit in the $|0\rangle$ state: (measuring $XIXIXIX$ stabilizer)
  2. +
+

$$|000\rangle \big( |0000000\rangle + |1010101\rangle \big)$$

+
    +
  1. The state after measuring the second ancillary qubit in the $|0\rangle$ state: +(measuring $IXXIIXX$ stabilizer)
  2. +
+

$$|000\rangle \big( |0000000\rangle + |1010101\rangle + +|0110011\rangle + |1100110\rangle\big)$$

+
    +
  1. The state after measuring the third ancillary qubit in the $|0\rangle$ state: +(measuring $IIIXXXX$ stabilizer)
  2. +
+

$$|000\rangle |0_L\rangle = |000\rangle \big( |0000000\rangle + |1010101\rangle + +|0110011\rangle + |1100110\rangle \\ +|0001111\rangle + |1011010\rangle +|0111100\rangle + |1101001\rangle \big)$$

+

After disregarding the ancillary qubits that are in the $|000\rangle$ state we will have the desired $|0_L\rangle$ state. The probability that each measurement outcome will be $|0\rangle$ is $0.5$, thus the probability of creating the $|0_L\rangle$ state with this circuit is $0.125$. For Qiskit, one can implement the circuit mentioned above, then apply any algorithm or gate that is needed on the $|0_L\rangle$ state, and after the computation disregard all the results where ancillary qubits are not in the $|000\rangle$ state.

+",9459,,9459,,7/25/2020 9:46,7/25/2020 9:46,,,,8,,,,CC BY-SA 4.0 +13038,2,,13031,7/24/2020 13:48,,6,,"

Symmetric Werner states in any dimension $n\geq 2$ provide examples.

+

Let's take $n=2$ as an example for simplicity. Define $\rho\in\mathrm{D}(\mathbb{C}^2\otimes\mathbb{C}^2)$ as +$$ +\rho = \frac{1}{6}\, +\begin{pmatrix} +2 & 0 & 0 & 0\\ +0 & 1 & 1 & 0\\ +0 & 1 & 1 & 0\\ +0 & 0 & 0 & 2 +\end{pmatrix}, +$$ +which is proportional to the projection onto the symmetric subspace of $\mathbb{C}^2\otimes\mathbb{C}^2$. The projection onto the symmetric subspace is always separable, but here you can see it easily by applying the PPT test. +The rank of $\rho$ is 3.

+

It is possible to write $\rho$ as +$$ +\rho = \frac{1}{4}\sum_{k = 1}^4 u_k u_k^{\ast} \otimes u_k u_k^{\ast} +$$ +by taking $u_1,\ldots,u_4$ to be the four tetrahedral states, or any other four states that form a SIC (symmetric information-complete measurement) in $\mathbb{C}^2$. It is, however, not possible to express $\rho$ as +$$ +\rho = \sum_{k = 1}^3 p_k x_k x_k^{\ast} \otimes y_k y_k^{\ast} +$$ +for any choice of unit vectors $x_1,x_2,x_3,y_1,y_2,y_3\in\mathbb{C}^2$ and probabilities $p_1, p_2, p_3$. To see why, let us assume toward contradiction that such an expression does exist.

+

Observe first that because the image of $\rho$ is the symmetric subspace, the vectors $x_k$ and $y_k$ must be scalar multiples of one another for each $k$, so there is no loss of generality in assuming $y_k = x_k$. Next we will use the fact that if $\Pi$ is any rank $r$ projection operator and $z_1,\ldots,z_r$ are vectors satisfying +$$ +\Pi = z_1 z_1^{\ast} + \cdots + z_r z_r^{\ast}, +$$ +then it must be that $z_1,\ldots,z_r$ are orthogonal unit vectors. Using the fact that $3\rho$ is a projection operator, we conclude that $p_1 = p_2 = p_3 = 1/3$ and $x_1\otimes x_1$, $x_2\otimes x_2$, $x_3\otimes x_3$ are orthogonal. This implies that $x_1$, $x_2$, $x_3$ are orthogonal. This, however, contradicts the fact that these vectors are drawn from a space of dimension 2, so we have a contradiction and we're done.

+

More generally, the symmetric Werner state $\rho\in\mathrm{D}(\mathbb{C}^n\otimes\mathbb{C}^n)$ is always separable and has rank $\binom{n+1}{2}$ but cannot be written as a convex combination of fewer than $n^2$ rank one separable states (and that is only possible when there exists a SIC in dimension $n$). This fact is proved in a paper by Andrew Scott [arXiv:quant-ph/0604049].

+",1764,,1764,,7/24/2020 14:29,7/24/2020 14:29,,,,3,,,,CC BY-SA 4.0 +13039,1,,,7/24/2020 19:03,,4,61,"

When we write a QASM code or build quantum circuit on Qiskit GUI, it converts it into QObj/QASMQObj (refering paper Qiskit Backend Specifications for OpenQASM and OpenPulse Experiments) or its transpiled version, before executing. However this is assembly language, how it is converted into opcode/bytecode before executing on the hardware?

+",12752,,55,,7/26/2020 10:10,9/10/2020 16:05,"What is the executable opcode for Qiskit quantum hardware, as the quantum circuits or the transpiled/compiled QObj/ QASMQObj are assembly languages?",,0,1,,10/4/2020 13:17,,CC BY-SA 4.0 +13040,1,13045,,7/24/2020 20:39,,0,125,"

Is it possible to perform an operation on two qubits with initial states as follows:

+

$$q_1: 1/\sqrt(2)(|0\rangle + exp(0.a_1a_2a_3)|1\rangle)$$ +$$q_2: 1/\sqrt(2)(|0\rangle + |1\rangle)$$

+

To resultant state:-

+

$$q_1: 1/\sqrt(2)(|0\rangle + exp(0.a_1a_2)|1\rangle)$$ +$$q_2: 1/\sqrt(2)(|0\rangle + exp(0.a_3)|1\rangle)$$

+

Without knowing the value of $a_3$. Where $a_1,a_2,a_3 ∈ [0, 1].$

+

The idea is to shift the phase of $q_1$ by $exp(-0.00a_3)$ and $q_2$ by $exp(0.a_3)$ with the unitary operation not being aware of the value of $a_3$.

+",6297,,6297,,7/25/2020 7:34,7/25/2020 21:55,SWAP specific phase components of two qubits,,1,4,,,,CC BY-SA 4.0 +13043,1,,,7/25/2020 12:53,,4,87,"

I want to apply QFT to some common applications like on wave equations. I haven't found any applications of QFT except Shor's algorithm and I am yet to build an intuition for its use cases. I am a beginner in QC. It would be great if someone can help!

+",11704,,45,,7/26/2020 6:24,7/28/2020 6:47,Are there any common applications where one can replace FFT with Quantum Fourier Transform?,,1,0,,,,CC BY-SA 4.0 +13044,1,,,7/25/2020 16:49,,0,234,"

I am trying to implement a quantum scheme of sharing a secret via EPR states. Here is my initial state of 6 qubits \begin{equation} |\psi\rangle=\left(\dfrac{|0\rangle_1|0\rangle_2+ |1\rangle_1|1\rangle_2}{\sqrt{2}}\right) \left(\dfrac{|0\rangle_3|0\rangle_4+ |1\rangle_3|1\rangle_4}{\sqrt{2}}\right)\left(\dfrac{|0\rangle_5|0\rangle_6+ |1\rangle_5|1\rangle_6}{\sqrt{2}}\right)\end{equation},

+
    +
  1. The qubits $(1,4)$ belong to $P_1$, $(2,6)$ to $P_2$, $(3,5)$ to $P_3$.
  2. +
  3. An operator is applied to qubit $1$ say the Pauli $Z$ gate, to get \begin{equation}|\psi\rangle \left(\dfrac{|0\rangle_1|0\rangle_2-|1\rangle_1|1\rangle_2}{\sqrt{2}}\right) \left(\dfrac{|0\rangle_3|0\rangle_4+ |1\rangle_3|1\rangle_4}{\sqrt{2}}\right)\left(\dfrac{|0\rangle_5|0\rangle_6+ |1\rangle_5|1\rangle_6}{\sqrt{2}}\right)\end{equation}. Now after each party measures his qubits the operator is revealed. +For instance say if $P_1$ measures $|\alpha^+\rangle_{14}$, and $P_2$ and $P_3$ measure $|\beta^-\rangle_{26}$ and $|\beta^+\rangle_{35}$ respectively, they write their state as after swapping as +\begin{equation} + |\alpha^-\rangle_{12}|\alpha^+\rangle_{34} |\alpha^+\rangle_{56} + \end{equation}, now they know the initial state of the qubits $(1,2)$, hence they deduce the operator as $Z$.
  4. +
+

I have tried hard, but how to make the circuit for this scheme on an IBM-QE or for that matter any hardware. +

+

The circuit provided is my try.

+
    +
  1. The part before the first barrier is where the initial state is prepared with the operator $\mathbb{Z}$, (this the operator that the parties have to find out by combing their measurements).

    +
  2. +
  3. $(2,6)$ undergoes a Bell Basis measurement with the C-NOT and hadamard.

    +
  4. +
  5. This makes $(1,5)$ entangled, represented by the C-NOT between (1,5) (a kind of reverse C-NOT- I don't know why i did this reverse, just out of intuition).

    +
  6. +
  7. $(3,5)$ undergoes a Bell Basis measurement with the C-NOT and Hadamard.

    +
  8. +
  9. This makes $(1,4)$ entangled, represented by the reverse C-NOT between (1,4) (again intuition).

    +
  10. +
  11. Then the Bell basis measurement on $(1,4)$ with the C-NOT and Hadamard.

    +
  12. +
+

But, i am still not knowing how to proceed, the theoretical calculations say that the final state should be +\begin{equation} + |\alpha^-\rangle_{12}|\alpha^+\rangle_{34}|\alpha^+\rangle_{56} + \end{equation} so that they apply the $Z$ on the first qubit to get +\begin{equation}|\psi\rangle=\left(\dfrac{|0\rangle_1|0\rangle_2+ |1\rangle_1|1\rangle_2}{\sqrt{2}}\right) \left(\dfrac{|0\rangle_3|0\rangle_4+ |1\rangle_3|1\rangle_4}{\sqrt{2}}\right)\left(\dfrac{|0\rangle_5|0\rangle_6+ |1\rangle_5|1\rangle_6}{\sqrt{2}}\right)\end{equation} +Can't somebody atleast hint at where to start from? +Do i have to use conditional statements , because that is what the theory says, but how does one use these statements? I know for instance that the state 0000 on the 2,6 ,3,5 qubits will correspond to an identity operator on the 1st qubit and similarly we do these for others but does one code this on a simulator

+",6070,,6070,,7/27/2020 21:59,7/27/2020 21:59,The analogous IBM circuit representation for the quantum scheme,,0,2,,,,CC BY-SA 4.0 +13045,2,,13040,7/25/2020 21:55,,3,,"

No, it's not possible to extract digits of the phase like that. It would violate the Holevo bound. In general there's no way to "amplify" single small phase differences into big phase differences, because of linearity.

+",119,,,,,7/25/2020 21:55,,,,3,,,,CC BY-SA 4.0 +13046,1,,,7/25/2020 23:10,,1,56,"

I have been trying to create a C# host program for a Q# program in Visual Studio Community 2019 by following these instructions: https://docs.microsoft.com/en-us/quantum/quickstarts/install-cs?tabs=tabid-vs2019%2Ctabid-csharp.

+

But when I click "Create", I cannot complete the process, and this message pops up:

+

+

I have followed the instructions from the message, have restarted my computer, and have reopened Visual Studio. However, that same message still pops up, and I still cannot create the C# host program.

+

Any idea?

+

Thanks.

+",12766,,55,,7/27/2020 12:25,7/27/2020 12:25,How to create a C# host program for a Q# program in Visual Studio Community 2019?,,0,3,,,,CC BY-SA 4.0 +13047,2,,12988,7/26/2020 3:37,,1,,"

Consider https://ibm.co/joinqiskitslack the Slack link, it's always updated to a working invitation link.

+",1859,,,,,7/26/2020 3:37,,,,1,,,,CC BY-SA 4.0 +13048,1,13052,,7/26/2020 5:14,,2,173,"

Let's say I have a particle in the quantum state $|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$, represented as a density operator (1st matrix) that went through a depolarizing chanel (2nd matrix). Let's call the depolarized matrix $D_p$.

+

$$ +\begin{bmatrix} +.5 & .5 \\ +.5 & .5 +\end{bmatrix} +\rightarrow +\begin{bmatrix} +.5 & .43 \\ +.43 & .5 +\end{bmatrix} +$$ +Now, I have two of these $D_p$, and their resulting product state is: +$$ +D_p^{\otimes 2} = \begin{bmatrix} +.5 & .43 \\ +.43 & .5 +\end{bmatrix} +\otimes +\begin{bmatrix} +.5 & .43 \\ +.43 & .5 +\end{bmatrix}. +$$ +Now, if I want want to calculate the probability of finding some state $|\psi\rangle = |0\rangle \otimes |0\rangle$ in the above mentioned product system, then this is what I do: +$$ +p(|\psi\rangle | D_p^{\otimes 2}) = trace(\psi\rangle\langle \psi | D_p^{\otimes 2}). +$$ +As you can see, calculating this trace is a $O(N^3)$ complexity operation and becomes very slow for even a small number of particles, i.e. for $D_p^{\otimes 10}$ or higher. Is there a principled way to calculate these probabilities? Without using any matrix multiplication?

+
+

Cross-posted on Physics.SE

+",2403,,491,,8/29/2020 19:06,8/29/2020 19:06,Calculate probability of a state after depolarization,,2,0,,,,CC BY-SA 4.0 +13049,1,,,7/26/2020 7:35,,4,207,"

I have been trying to implement methods from paper Creating superpositions that correspond to efficiently integrable probability distributions by Grover and Rudolph.

+

It is stated that there exists an efficient (polynomial) process for the preparation of certain probability density functions (e.g. log-concave distributions).

+

Specifically, in equation 5. It is stated that

+

$$\sqrt{p_i^{(m)}}|i\rangle |0...0\rangle \rightarrow \sqrt{p_i^{(m)}}|i\rangle |\theta_i\rangle$$

+

Can be done efficiently under these assumptions.

+

I have not found any details on how this can actully be done, either with and example or with the details of how such an efficient circuit could be composed.

+

Would highly appreciate any insights on this.

+",12769,,9006,,7/27/2020 7:11,11/2/2022 7:04,Preparation of states that correspond to efficiently integrable probability distributions,,1,7,,,,CC BY-SA 4.0 +13050,1,,,7/26/2020 9:13,,2,112,"

This is a question that I asked on Qiskit ignis section of slack, with a very interesting answer by A Kapila, but I also need to get a short answer in nanoseconds.

+

I want to evaluate decoherence in function of a waiting time introduced by adding identity gates before the measurement phase (using barriers before and after the series of id gates) + +For instance for the Essex device, I can obtain the id gate length value using the following code:

+

device = provider.get_backend('ibmq_essex')

+

properties = device.properties()

+

from qiskit.providers.aer.noise.device.parameters import gate_length_values

+

gate_times_out = gate_length_values(properties)

+

print(gate_times_out[0])

+

  +('id', [0], 64.0)

+

Note that this method of creating a delay was used in a published paper about decoherence.

+

https://arxiv.org/pdf/1712.07080.pdf

+

In the methods section the authors give the following description:

+

« A delay τ is realized via the application of multiple identity operations. Each identity operation has the same duration as a single-qubit rotation gate (80 ns) and is followed by a 10-ns buffer time, which corresponds to a total delay of 90 ns per identity operation. »

+

For the circuit presented here, the waiting time is 4 * 64 ns = 256 ns plus four times the additional buffer time between gate for the device.

+

I can find the buffer times in older descriptions of some devices, like the Yorktown (see: https://github.com/Qiskit/ibmq-device-information/blob/master/backends/yorktown/V1/version_log.md). +But I cannot find it for the Essex device.What is it? Or where can I find it? +Or maybe the waiting time is already included in the gate length values?

+

Thanks by advance for helping.

+",4600,,,,,7/26/2020 9:13,What is the buffer time between gates of the ibmq_essex in nanoseconds?,,0,0,,,,CC BY-SA 4.0 +13051,1,13055,,7/26/2020 9:52,,3,410,"

Let's say that the qubit is in the state $\psi = \alpha|0\rangle+\beta|1\rangle$. We want to find out the values $\alpha$ and $\beta$.

+

If we measure it in, say, the standard basis, then the outcome we get is either $|0\rangle$ or $|1\rangle$. So, how do we find out the given values?

+

I recently came across the problem that asked to compare the probabilities of finding out the $\alpha$ and $\beta$ if we measured the qubit in two different bases and I'm not sure how to calculate them.

+",2559,,55,,7/26/2020 18:57,7/30/2020 9:57,How is it possible to guess what state the qubit was in by measuring it?,,3,1,,,,CC BY-SA 4.0 +13052,2,,13048,7/26/2020 12:11,,3,,"

As long as your final state is a product state, everything is a product, and the probabilities for the individual qubits will just multiply. So compute the probabilities for each qubit to be in the respective state and just multiply them.

+

But even if this is not the case, you can compute $\langle \psi\vert D_p^{\otimes k}\vert\psi\rangle$ rather than the trace, then it only scales as $O(N^2)$, $N=2^k$.

+

Finally, you could use that $D_p^{\otimes k}$ is a tensor product and multiply $\vert\psi\rangle$ with one $D_p$ at a time. Then, it is easy to see that each of these operations only sums over one index with $2$ settings, which takes $2N$ operations, so the total number of operations is $2kN = O(kN) = O(N\log(N))$.

+",491,,491,,7/26/2020 14:00,7/26/2020 14:00,,,,0,,,,CC BY-SA 4.0 +13053,2,,13051,7/26/2020 18:55,,3,,"

You measure many times and collect statistics. E.g. you do $1000$ measurements and find $600$ times the first outcome. You can then deduce that $|\alpha|^2\simeq 0.6$ and $|\beta|^2\sim0.4$ (using appropriate statistical methods to compute the associated estimation errors).

+

Note that this does not fully characterise the state, but only gives you the amplitudes $|\alpha|,|\beta|$. You do not have access to any other information, unless you also do measurements on a different basis.

+

If you measure for example in the $|\pm\rangle$ basis, you will find that this gives you information about the relative phase (more specifically, it gives you the value of $2\operatorname{Re}(\alpha^*\beta)$). To definitively pinpoint the state, you will then also need the probabilities in a third measurement basis, e.g. the basis $|0\rangle\pm i\lvert0\rangle$, which allow you to compute $2\operatorname{Im}(\alpha^* \beta)$.

+",55,,55,,7/26/2020 20:49,7/26/2020 20:49,,,,2,,,,CC BY-SA 4.0 +13054,2,,13051,7/26/2020 19:46,,0,,"

Usually, the calculation of amplitudes can be accomplished by either of the following properties:

+
    +
  1. Complex amplitudes are always normalized (as they form the probabilities) so $|\alpha|^2+|\beta|^2$=1

    +
  2. +
  3. Using the geometric interpretation of quantum bit (if you know the angle $\theta$) which realized the two-dimensional vector in your case on a unit circle in a 2D complex vector space (or Hilbert space), so you can write the state as $\psi$ = $\cos$ $\theta$$|0\rangle$ + $\sin$ $\theta$$|1\rangle$ where $\theta$ will be the angle between $|0\rangle$ and the superposition state $\psi$ (and the states $|0\rangle$ and $|1\rangle$ are orthonormal). It will satisfy 1 as $\sin^2$$\theta$+$\cos^2$$\theta$=1

    +
  4. +
  5. Using the above, you can perform the measurement in the sign basis or any arbitrary basis, keeping in mind the angle and the amplitudes of that basis in accordance with the standard basis of $|0\rangle$ and $|1\rangle$ (example, for sign basis you will have amplitutes as 1/$\sqrt2$ and the basis will be rotated by 45 degree clockwise so $|+\rangle$ will be at $+$$\pi/4$ and $|-\rangle$ will be at $-$$\pi/4$ angle with horizontal $|0\rangle$)

    +
  6. +
  7. Alternatively, you can change your state's notation from ket to vector and solve using matrices if you find that convenient (but it won't be of much help for large number of qubits).

    +
  8. +
+",12624,,9006,,7/27/2020 7:15,7/27/2020 7:15,,,,0,,,,CC BY-SA 4.0 +13055,2,,13051,7/26/2020 20:33,,5,,"

Let's describe the one qubit pure stat in Bloch sphere notation (in order to avoid the global phase ambiguity):

+

$$|\psi \rangle = \cos\big(\frac{\theta}{2}\big) |0\rangle + e^{i\varphi} \sin\big(\frac{\theta}{2}\big)$$

+

The problem can be solved with the quantum state tomography, but in this answer, I want to consider a slightly different approach for dealing with the pure states. This answer is a generalized version of this answer. Here we assume that the described state can be prepared as many times as we want.

+

We are going to execute three different experiments to estimate the $\alpha = \cos\big(\frac{\theta}{2}\big)$ and $\beta = e^{i\varphi} \sin\big(\frac{\theta}{2}\big)$, where $\theta$ is in $[0, \pi]$ range, $\varphi$ is in $[-\pi, \pi)$ range (in the Bloch sphere formalism $\varphi$ is in $[0, 2\pi)$, but we can, without any problems, take $[-\pi, \pi)$ range for our convenience). The first experiment will give us $\theta$ and the last two experiments will give us $\varphi$ from which it will be straightforward to calculate $\alpha$, $\beta$, and thus the $|\psi \rangle$ pure state.

+

The first experiment: determining $\theta$.

+

Execute $N$ times (bigger $N$ will give a better answer) $Z$ basis measurements. Note that the probabilities of measuring $|0\rangle$ $\left( P(0) \right)$ and $|1\rangle$ $\left(P(1)\right)$ states have these relations with the outcomes of the experiment:

+

$$ +P(0) = \lim_{N \rightarrow \infty} \frac{N_{0}}{N} = |\alpha|^2 = \cos^2 \big(\frac{\theta}{2}\big) +\\ +P(1) = \lim_{N \rightarrow \infty} \frac{N_{1}}{N} = |\beta|^2 = \sin^2\big(\frac{\theta}{2}\big) +$$

+

So:

+

$$\theta = 2 \arccos \big(\sqrt{(P(0))}\big) = 2 \arcsin \big(\sqrt{(P(1))}\big)$$

+

because values of $\frac{\theta}{2}$ is in the $[0, \frac{\pi}{2}]$ range.

+

The second experiment: the absolute value of the relative phase.

+

We have defined the relative phase $\varphi$ in the range $[-\pi, \pi)$ and here we are going to find the $|\varphi|$. For that, we apply a Hadamard gate:

+

$$H \left( \cos\big(\frac{\theta}{2}\big) |0\rangle + e^{i\varphi} \sin \big(\frac{\theta}{2} \big) \right) = +\\ += \frac{1}{\sqrt{2}} \left( \cos\big(\frac{\theta}{2}\big) + e^{i\varphi} \sin \big(\frac{\theta}{2} \big) \right) |0\rangle + \frac{1}{\sqrt{2}} \left( \cos\big(\frac{\theta}{2}\big) - e^{i\varphi} \sin \big(\frac{\theta}{2} \big) \right) |1\rangle$$

+

If we calculate the probabilities of measuring $|0\rangle$ ($P'(0)$) and $|1\rangle$ $P'(1)$ we will obtain that:

+

$$P'(0) = \frac{1}{2} \left| \cos\big(\frac{\theta}{2}\big) + e^{i\varphi} \sin \big(\frac{\theta}{2} \big) \right|^2 = \frac{1 + \cos(\varphi) \sin(\theta)}{2} +\\ +P'(1) = \frac{1}{2} \left| \cos\big(\frac{\theta}{2}\big) - e^{i\varphi} \sin \big(\frac{\theta}{2} \big) \right|^2 = \frac{1 - \cos(\varphi) \sin(\theta)}{2} +$$

+

That is why:

+

$$\varphi = \pm \arccos \left( \frac{P'(0) - P'(1)}{\sin(\theta)} \right)$$

+

because the range of usual principal value arccosine function is equal to $[0, \pi]$. We know $\theta$, we know how to calculate $P'(0)$ and $P'(1)$ from the new experiment with Hadamard gate, so we will be able to find $|\varphi|$. If $\sin(\theta) = 0$, then we can just skip the second and the third experiments, because in that case we have either $|\psi\rangle = |1\rangle$ ($\theta = \pi$) or $|\psi\rangle = |0\rangle$ ($\theta = 0$).

+

Also, note that:

+

$$\langle X \rangle = \langle \psi | X | \psi \rangle = \langle \psi |H Z H| \psi \rangle = P(0) - P(1)$$

+

So, the formula can be written in this way:

+

$$\theta = \pm \arccos \left( \frac{\langle X \rangle}{\sin(\theta)} \right)$$

+

The third experiment: determining the sign of the relative phase.

+

For this we will need to apply $S^{\dagger}$ then $H$ gates to the initial state before $N$ measurements:

+

$$H S^{\dagger} \left( \cos\big(\frac{\theta}{2}\big) |0\rangle + e^{i\varphi} \sin \big(\frac{\theta}{2} \big) \right) = +\\ += \frac{1}{\sqrt{2}} \left( \cos\big(\frac{\theta}{2}\big) - i e^{i\varphi} \sin \big(\frac{\theta}{2} \big) \right) |0\rangle + \frac{1}{\sqrt{2}} \left( \cos\big(\frac{\theta}{2}\big) + i e^{i\varphi} \sin \big(\frac{\theta}{2} \big) \right) |1\rangle +$$

+

The probabilities:

+

$$P''(0) = \frac{1}{2} \left| \cos\big(\frac{\theta}{2}\big) - ie^{i\varphi} \sin \big(\frac{\theta}{2} \big) \right|^2 = \frac{1 + \sin(\varphi) \sin(\theta)}{2} +\\ +P''(1) = \frac{1}{2} \left| \cos\big(\frac{\theta}{2}\big) + ie^{i\varphi} \sin \big(\frac{\theta}{2} \big) \right|^2 = \frac{1 - \sin(\varphi) \sin(\theta)}{2} +$$

+

For the sign of the relative phase we have:

+

$$sign(\varphi) = sign \left( \arcsin \left(\frac{P''(0) - P''(1)}{\sin(\theta)} \right) \right) = sign \left( P''(0) - P''(1) \right)$$

+

because the range of usual principal value of arcsine function is $[-\frac{\pi}{2}, \frac{\pi}{2}]$ and $\sin(\theta) > 0$ $\left( \theta \in [0, \pi] \right)$.

+

Also, note that for the expectation value of the $Y$ operator (as can be seen from this answer) we have this relation:

+

$$\langle Y \rangle = \langle \psi| Y | \psi\rangle = \langle \psi| S H Z H S^{\dagger} | \psi\rangle = P''(0) - P''(1)$$

+

By taking this into account and combining the last two experiments we can obtain the relative phase:

+

$$\varphi = sign \big( \langle Y \rangle \big) \arccos \left( \frac{\langle X \rangle}{\sin(\theta)} \right)$$

+",9459,,9459,,7/30/2020 9:57,7/30/2020 9:57,,,,0,,,,CC BY-SA 4.0 +13056,1,13078,,7/27/2020 2:43,,2,253,"

In QAOA algorithm, for $p=1$ layer of gates and at most degree $d=3$, the expectation value can be calculated by hand. I think I can convince myself the idea of commutability. In this qiskit example, the author evaluated

+

$$f_A(\gamma,\beta) = \frac{1}{2}\left(1 - \langle +^3|U_{21}(\gamma)U_{02}(\gamma)U_{01}(\gamma)X_{0}(\beta)X_{1}(\beta)\;Z_0Z_1\; X^\dagger_{1}(\beta)X^\dagger_{0}(\beta)U^\dagger_{01}(\gamma)U^\dagger_{02}(\gamma)U^\dagger_{12}(\gamma) | +^3 \rangle \right)$$

+

as

+

$$f_A(\gamma,\beta) = \frac{1}{2}\left(sin(4\gamma)sin(4\beta) + sin^2(2\beta)sin^2(2\gamma)\right).$$

+

I believe I can write these unitaries explicitly as tensor product of $U1$ and $U3$ gate. However, when we evaluate this by hand, the states $|+^3\rangle$ or $|+^5\rangle$ what I can imagine is an 8-dimensional vector or 32-dimensional vector. For the 8-dimension case, these gates are two-qubit gates. All I can think of is that I need to expand these two-qubit gates into a three-qubit gate by tensor product with an identity operator. Even though, I still don't know how to handle these gates like $U_{02}$. How can I sandwich an identity operator into a two-qubit operator?

+

My question is how to evaluate this explicitly by hand.

+

I found a paper Quantum Algorithms for Fixed Qubit Architectures and it provided some operator identity which I think can help understand how this evaluation worked.

+

But I still have no idea how these identities hold.

+

+

I copied the original text here:

+

5.2 Optimal trial state parameters

+

In this example we consider the case for $p = 1$, i.e. only layer of gates. The expectation value $F_1(\gamma,\beta) = \langle \psi_1(\beta,\gamma)|H|\psi_1(\beta,\gamma) \rangle$ can be calculated analytically for this simple setting. Let us discuss the steps explicitly for the Hamiltonian $H = \sum_{(j,k) \in E} \frac{1}{2}\left(1 - Z_i Z_k\right)$. Due to the linearity of the expectation value we can compute the expectation value for the edges individually

+

$$f_{(i,k)}(\beta,\alpha) = \langle \psi_1(\gamma,\beta)|\;\frac{1}{2}\left(1 - Z_i Z_k\right)\;|\psi_1(\gamma,\beta)\rangle. $$ +For the butterfly graph as plotted above, we observe that there are only two kinds of edges $A = \{(0,1),(3,4)\}$ and $B = \{(0,2),(1,2),(2,3),(2,4)\}$. The edges in $A$ only have two neighboring edges, while the edges in $B$ have four. You can convince yourself that we only need to compute the expectation of a single edge in each set since the other expectation values will be the same. This means that we can compute $F_1(\gamma,\beta) = 2 f_A(\gamma,\beta) + 4f_B(\gamma,\beta)$ by evaluating only computing two expectation values. Note, that following the argument as outlined in section 4.2.2, all the gates that do not intersect with the Pauli opertor $Z_0Z_1$ or $Z_0Z_2$ commute and cancel out so that we only need to compute

+

$$f_A(\gamma,\beta) = \frac{1}{2}\left(1 - \langle +^3|U_{21}(\gamma)U_{02}(\gamma)U_{01}(\gamma)X_{0}(\beta)X_{1}(\beta)\;Z_0Z_1\; X^\dagger_{1}(\beta)X^\dagger_{0}(\beta)U^\dagger_{01}(\gamma)U^\dagger_{02}(\gamma)U^\dagger_{12}(\gamma) | +^3 \rangle \right)$$ +and

+

$$f_B(\gamma,\beta) = \frac{1}{2}\left(1 - \langle +^5|U_{21}(\gamma)U_{24}(\gamma)U_{23}(\gamma)U_{01}(\gamma)U_{02}(\gamma)X_{0}(\beta)X_{2}(\beta)\;Z_0Z_2\; X^\dagger_{0}(\beta)X^\dagger_{2}(\beta)U^\dagger_{02}(\gamma)U^\dagger_{01}(\gamma)U^\dagger_{12}(\gamma)U^\dagger_{23}(\gamma)U^\dagger_{24}(\gamma) | +^5 \rangle \right)$$ +How complex these expectation values become in general depend only on the degree of the graph we are considering and is independent of the size of the full graph if the degree is bounded. A direct evaluation of this expression with $U_{k,l}(\gamma) = \exp\frac{i\gamma}{2}\left(1 - Z_kZ_l\right)$ and +$X_k(\beta) = \exp(i\beta X_k)$ yields

+

$$f_A(\gamma,\beta) = \frac{1}{2}\left(sin(4\gamma)sin(4\beta) + sin^2(2\beta)sin^2(2\gamma)\right)$$ +and

+

$$f_B(\gamma,\beta) = \frac{1}{2}\left(1 - sin^2(2\beta)sin^2(2\gamma)cos^2(4\gamma) - \frac{1}{4}sin(4\beta)sin(4\gamma)(1+cos^2(4\gamma))\right) $$ +These results can now be combined as described above, and the expectation value is therefore given by

+

$$ F_1(\gamma,\beta) = 3 - \left(sin^2(2\beta)sin^2(2\gamma)- \frac{1}{2}sin(4\beta)sin(4\gamma)\right)\left(1 + cos^2(4\gamma)\right),$$ +We plot the function $F_1(\gamma,\beta)$ and use a simple grid search to find the parameters $(\gamma^*,\beta^*)$ that maximize the expectation value.

+",12693,,12693,,7/27/2020 10:05,5/20/2021 16:29,How to do the direct evaluation by hand in QAOA algorithm,,1,1,,,,CC BY-SA 4.0 +13057,2,,13048,7/27/2020 6:38,,2,,"

Norbert's answer is correct, but just for the sake of being explicit: +$$ +\langle 0|^{\otimes N} D_P^{\otimes N}|0\rangle^{\otimes N}=\left(\langle 0|D_p|0\rangle\right)^{\otimes N}=\langle 0|D_p|0\rangle^{N}=\frac{1}{2^N}. +$$

+",1837,,,,,7/27/2020 6:38,,,,0,,,,CC BY-SA 4.0 +13058,1,13059,,7/27/2020 19:16,,1,68,"

I have already visited this What does it mean to get 403 error when running a code on Qiskit? which did not help me fix my problem. +I want to test the quantum circuit that I have designed using the following code, (the histogram of the circuit is being plotted perfectly so I don't believe that there is any problem with it)

+
IBMQ.load_account()
+provider = IBMQ.get_provider('ibm-q')
+qcomp = provider.get_backend('ibmq_16_melbourne')
+job = execute(circuit, backend=qcomp)
+
+

I do not understand the problem with the above code. The last line is not executing in the Jupiter notebook cell. Is it a location problem of Melbourne, because me residence is India? What would I do?

+",7706,,55,,7/28/2020 13:28,8/27/2020 14:02,Queue disabled and HTTP 403 error,,1,0,,,,CC BY-SA 4.0 +13059,2,,13058,7/27/2020 19:43,,0,,"

You're getting the 403 because ibmq_16_melbourne is currently offline for maintenance. You can checkout the status of each backend on the IBM Quantum Experience website, or do backend.status().operational. Furthermore, you can get the least busy operational backend with something like

+
from qiskit.providers.ibmq import least_busy
+backend = least_busy(provider.backends(simulator=False, filters=lambda b: 
+    b.configuration().n_qubits >= 5))
+
+",12195,,,,,7/27/2020 19:43,,,,0,,,,CC BY-SA 4.0 +13060,2,,8431,7/27/2020 21:06,,3,,"

This Qiskit tutorial does what I think you're looking for; with the cnx() function. It uses this paper to decompose the CNOT gate without ancilla qubits.

+

Let me know, if this helps you.

+",12778,,27,,7/28/2020 0:53,7/28/2020 0:53,,,,1,,,,CC BY-SA 4.0 +13061,1,,,7/27/2020 22:17,,1,120,"

I'm trying to grok more of the adiabatic model. I also really enjoyed O'Donnell's lecture on the Elitzur-Vaidman bomb tester.

+

The familiar setup involves a test for the presence (or absence) of a bomb. The bomb goes off if a qubit passes through in the $\vert 1\rangle$ state, and does nothing if going through in the $\vert 0\rangle$ state.

+

Conventionally a qubit is prepared in the $\vert +\rangle$ state to go through the bomb tester, and if it doesn't trigger the bomb, it is measured in the $\{\vert +\rangle,\vert -\rangle\}$ basis. If the bomb is present, there's a 50% it will go off, a 25% chance that it might be inconclusive but a 25% chance that the qubit will be measured as $\vert -\rangle$, proving the presence of the bomb.

+

In O'Donnell's description of the improved test, a qubit without a bomb present is slowly rotated by $\epsilon$ degrees, from $\vert 0\rangle$ to $\vert 1\rangle$. However if a bomb is present, the qubit will remain in $\vert 0\rangle$ with high probability.

+

This slow rotation of the qubit feels, to me, a bit like a slowroll of a changing Hamiltonian used in the adiabatic model. But that's where my intuition hits a road-block of not understanding the adiabatic theorem well enough.

+
+

Is my intuition close to correct? How would one frame the Elitzur-Vaidman bomb tester in terms of the adiabatic theorem? For example what would be the initial and final Hamiltonians?

+
+",2927,,,,,7/27/2020 22:17,Is the Elitzur-Vaidman bomb tester an example of adiabatic evolution?,,0,8,,,,CC BY-SA 4.0 +13062,1,,,7/28/2020 1:29,,4,1035,"

The P versus NP problem is a major unsolved problem in computer science. It asks whether every problem whose solution can be quickly verified can also be solved quickly. It is one of the seven Millennium Prize Problems selected by the Clay Mathematics Institute, each of which carries a US$1,000,000 prize for the first correct solution. My question is, can a quantum computer be used to solve P = NP?

+",5426,,,,,1/8/2022 2:13,Can quantum computers be used to solve P = NP,,2,2,,,,CC BY-SA 4.0 +13063,1,13065,,7/28/2020 5:47,,3,556,"

I am new in this field and I am considering to do research for my engineering degree.

+

First, I would like to have an opinion from more experienced people. Do you think it is possible to convert classic algorithms to quantum algorithms? Having in mind that the conversion will take in consideration the particularities of quantum algorithms.

+

If so, can you explain your point of view and if it is possible, an example?

+",12786,,55,,7/28/2020 6:54,8/7/2020 22:53,Is it possible to convert classical algorithms to quantum ones?,,2,0,,,,CC BY-SA 4.0 +13064,2,,13043,7/28/2020 6:47,,2,,"

One example where the QFT comes up is in simulating quantum particles' position and momenta. A typical use of the discrete Fourier Transform is classical applications is to convert time-domain signals into frequency-domain spectra, and an analogous relationship between the position and momentum domains allows you to convert a wavefunction that represents the (probability) distribution of a particle in space into a wavefunction that represents that same particle's momentum spectrum.

+

To study the dynamics of particles using a scheme like this, you have to specify a way to discretize position space so that you'll be able to represent a continuum of position/momentum values on a system with finite-dimensional wavefunctions (this involves defining the minimum/maximum position you will represent, the grid spacing in position/momentum space, and so on). An example of such a discretization or "digitization" formalism is given in [1], or for a more thorough review see [2].

+
+

[1] Ronaldo D Somma. "Quantum simulations of one dimensional quantum systems". arXiv preprint: https://arxiv.org/abs/1503.06319

+

[2] Natalie Klco and Martin J. Savage. “Digitization of Scalar Fields for Quantum Computing.” Physical Review A 99.5 (2019): https://arxiv.org/abs/1808.10378

+",1939,,,,,7/28/2020 6:47,,,,0,,,,CC BY-SA 4.0 +13065,2,,13063,7/28/2020 7:34,,1,,"

It depends on what you mean by converting classical algorithm to quantum one.

+

One angle of view can be: Is it possible to run any classical algorithm on quantum computer? If this is a case then answer is yes. Since so-called Toffoli gate is effectivelly NAND gate (in case the controlled qubit is set to state $|1\rangle$ before) and such gate enables to implement any logical function. Hence, you can use universal gate-based quantum computer for implementation of any classical algorithm.

+

Seconde angle of view could be: Is there a qunatum counterpart to any classical algorithm? In this case the answer is difficult and I am not sure whether it has been resolved already. However, there are some examples of quantum algorithms solving problems we have classical ones for. For instance: Shor's algorithm is used for integers factoring, Grover's algorithm for searching in unordered databases, HHL algorithm for solving systems of linear equations, there are Monte Carlo algorithms useful in finance, Hamiltonian simulations algorithms useful in simulation of quantum systems (the original purpose the quantum computers have been developed for) etc. Moreover, there is a family of so-called quantum annealers. These are single purpose quantum computers implementing quantum annealing algorithm on hardware level.

+",9006,,,,,7/28/2020 7:34,,,,0,,,,CC BY-SA 4.0 +13066,1,,,7/28/2020 8:00,,2,75,"

For example, a computer represent a variable named "A" as 01000001. How does a quantum computer represent "A"?

+

I am a newbie having difficulty understanding quantum computers. I watched a lot of videos but unable to understand the basics. Please recommend some resources which can clear my basic concepts.

+",12788,,55,,8/27/2020 12:54,8/27/2020 12:54,How is a bit field represented in Quantum Computing?,,2,1,,,,CC BY-SA 4.0 +13067,2,,13066,7/28/2020 8:52,,3,,"

You can represent the "A" as a series of qubits in the $\vert 01000001\rangle$-state. Any other representation would work as well, as long as there is consensus on the notation.

+

Regarding usefulness, most envisioned applications of quantum computers are as subpart of classical algorithms, where computationally hard problems are solved. Hence, 'typing' an "A" might not be necessary, though the development of quantum computers might prove otherwise.

+",2005,,,,,7/28/2020 8:52,,,,0,,,,CC BY-SA 4.0 +13068,1,13120,,7/28/2020 9:23,,1,53,"

This paper shows the impossibility of perfect error correction for strictly contractive quantum channels, i.e., for channels such that $||\mathcal{E}(\rho)-\mathcal{E}(\sigma) ||\leq k ||\rho-\sigma||$, for $0\leq k <1$.

+

The requirement for perfect error correction of a subspace $K$ is that there exists a channel $S$ such that $S$ is the inverse of the restriction of $\mathcal{E}$ to the subspace $K$.

+

The proof of impossibility uses the fact that this would require $||S\mathcal{E}(|u\rangle\langle u|)-S\mathcal{E}(|v\rangle\langle v|)|| = |||u\rangle\langle u|-|v\rangle\langle v|||$, for some basis vectors $u,v$, which would contradict strict contractivity.

+

My confusion is concerning how this contradiction argument doesn't seem take into consideration the fact that we should restrict to the subspace $K$. In other words, if $P$ is the projector onto the subspace $K$, is it generally true that if $\mathcal{E}$ is strictly contractive, then +$||P(\mathcal{E}(\rho))-P(\mathcal{E}(\sigma)) ||<||P(\rho)-P(\sigma)||$?

+

Thank you in advance.

+",12047,,55,,8/7/2020 18:56,8/7/2020 18:56,Is the restriction of a strictly contractive channel (SCC) to a subspace necessarily still SCC? (impossibility of perfect QEC for SCCs),,1,4,,,,CC BY-SA 4.0 +13071,1,,,7/28/2020 13:17,,5,3461,"

I have been trying to make a gate in qiskit in terms of the basic gates, but I keep on getting an error when I apply it to a circuit.

+

This is my gate:

+
class LGate(Gate):
+ 
+    def __init__(self, label=None):
+    
+        super().__init__('l', 1, [], label=label)
+
+    def _define(self):
+
+  
+        from qiskit.circuit.quantumcircuit import QuantumCircuit
+        from qiskit.circuit.library import U3Gate
+        q = QuantumRegister(1, 'q')
+        qc = QuantumCircuit(q, name=self.name)
+        rules = [
+            (U3Gate(pi, 0, pi), [q[0]], [])
+        ]
+        qc._data = rules
+        self.definition = qc
+
+

Of course this is just an X gate, but I was just trying a basic example.

+

Running the program:

+
circ = QuantumCircuit(2)
+circ.l(0)
+print(circ)
+
+

Error:

+
AttributeError: 'QuantumCircuit' object has no attribute 'l'
+
+",12790,,55,,7/28/2020 13:29,8/4/2020 6:48,Making custom gate in Qiskit?,,2,0,,,,CC BY-SA 4.0 +13072,2,,13071,7/28/2020 13:27,,1,,"

You only defined the gate, but not you haven't added the according method to the circuit. Add the following to the QuantumCircuit class:

+
    def l(self, qubit): 
+        # adjust this import to the location of your gate
+        from .library.standard_gates.l import LGate
+        return self.append(LGate(), [qubit], [])
+
+

See for instance here how it works for the SwapGate.

+

Just as a note: It's best practice to not use the letter l because that can be difficult to distinguish from an I in some fonts.

+",9800,,,,,7/28/2020 13:27,,,,0,,,,CC BY-SA 4.0 +13073,2,,12212,7/28/2020 15:24,,2,,"

I know this is an old question, but I feel like giving, imo, the simplest answer following the question specified in N&C.

+

Firstly as specified in the question define:

+

$ \mathcal{E}(A) = \frac{A + XAX + YAY + ZAZ}{4}$ .

+

It it is easy to see that

+

$ \mathcal{E}(I) = \frac{I + XIX + YIY + ZIZ}{4} = \frac{I + XX + YY + ZZ}{4} = I$

+

For the other three quantities $\mathcal{E}(X),\mathcal{E}(Y),\mathcal{E}(Z)$ we can make use of the elementary identities:

+

$\sigma_i\sigma_i\sigma_i = \sigma_i$

+

$\sigma_i\sigma_j\sigma_i = -\sigma_j$

+

Plugging in these identities we can see $\mathcal{E}(X),\mathcal{E}(Y),\mathcal{E}(Z) = 0$. More generally, (after grouping the terms), we can see that:

+

$ \mathcal{E}(\sigma_i) = \frac{2\sigma_i - 2\sigma_i}{4} = 0$

+

Finally we know from e.q 2.175 that

+

$\rho = \frac{I + \vec{r} \cdot\vec{\sigma}}{2} = \frac{I + r_x\sigma_x + r_y\sigma_y + r_z\sigma_z}{2}$,

+

and plugging this into

+

$\mathcal{E}(\rho) = \frac{\mathcal{E}(I) + \mathcal{E}(r_x\sigma_x) + \mathcal{E}(r_y\sigma_y) + \mathcal{E}(r_z\sigma_z)}{2}$,

+

using the results from above we see all the $\mathcal{E}(r_i\sigma_i)=0$, leaving us just with

+

$\mathcal{E}(\rho) = \frac{\mathcal{E}\left({I}\right)}{2} = \frac{I}{2}$,

+

finally to complete the proof

+

$2\mathcal{E}(\rho) = I$

+",6139,,6139,,7/28/2020 15:33,7/28/2020 15:33,,,,0,,,,CC BY-SA 4.0 +13074,1,,,7/28/2020 22:25,,1,35,"

I need to compute $(A+B^{-1})^{-1}|x\rangle$, where A and B is hermitian for simplicity.

+

I read out about matrix inversion algorithms (HHL, QSVE,...), and algorithms of summing up of matrices(LCU, Lie–Trotter product formula,...) but I don't understand how to glue this two parts together.

+",12794,,,,,7/28/2020 22:25,Using matrix inversion and summation together. How to compute $(A+B^{-1})^{-1}|x\rangle$,,0,1,,,,CC BY-SA 4.0 +13075,2,,13062,7/29/2020 0:28,,8,,"

I see maybe four (4) ways to interpret the question.

+
    +
  1. The first asks whether we can use a quantum computer to efficiently solve $\mathsf{NP}$ problems. The class of problems efficiently solvable by a quantum computer is called $\mathsf{BQP}$, and so the question would ask whether $\mathsf{NP}\subseteq\mathsf{BQP}$. As is indicted in the comments, quantum computers are not known to efficiently solve arbitrary $\mathsf{NP}$ problems, and are suspected not to be able to.

    +
  2. +
  3. The second asks whether a proof that $\mathsf{NP}\subseteq\mathsf{BQP}$ would suffice as a proof that $\mathsf{P}=\mathsf{NP}$. Although $\mathsf{P}\subseteq\mathsf{BQP}$, such a containment does not necessarily follow. For example, there may be problems in $\mathsf{BQP}$ that are not in $\mathsf{P}$ or even in $\mathsf{NP}$ - a famous candidate being related to knot theory. I don't think you'd win the Clay \$1M for such a containment. (You might get other riches, but that's a different story).

    +
  4. +
  5. The third asks whether a proof that $\mathsf{NP}\not\subseteq\mathsf{BQP}$ would suffice as a proof that $\mathsf{P}\ne\mathsf{NP}$. However, even this does not follow.

    +
  6. +
  7. The fourth interpretation asks whether a quantum computer could provide any leverage in answering the question of if the classical complexity class $\mathsf{P}$ is equal to $\mathsf{NP}$. That is, could one pose the $\mathsf{P}$ vs. $\mathsf{NP}$ problem as a a problem to be fed through a quantum computer? Although this may be interesting, I doubt one could envision a way to ask such a finite question.

    +
  8. +
+

The "standard model" that many people believe is that $\mathsf{P}\subsetneq\mathsf{NP}$, and further both $\mathsf{BQP}\not\subseteq\mathsf{NP}$ and $\mathsf{NP}\not\subseteq\mathsf{BQP}$ - that is, $\mathsf{NP}$ and $\mathsf{BQP}$ are incomparable. However, we are likely far away from proving any.

+",2927,,2927,,7/29/2020 1:22,7/29/2020 1:22,,,,0,,,,CC BY-SA 4.0 +13076,1,13082,,7/29/2020 0:40,,2,102,"

I know that $QFT_n|0\rangle$ is equivalent to $H_n|0\rangle$ +(mathematical proof).

+

And it is also easy to prove that $QFT_1$ is equivalent to $H_1$ (applied to one QuBit).

+

From looking at the circuit below it seems clear to me that the gates should also be equivalent if $|x_1\rangle$ is in any state and all other QuBits are $|0\rangle$. +This should be true because none of the controlled $R$ gates are applied to $|x_1\rangle$.

+

I do not know how to prove this mathematically. Can anyone provide an elegant proof?

+

+",12796,,55,,8/1/2020 11:40,8/1/2020 11:40,Prove that QFT and Walsh-Hadamard gates give the same output when acting on $\lvert x\rangle\lvert 0\rangle$,,1,2,,8/3/2020 21:17,,CC BY-SA 4.0 +13077,1,,,7/29/2020 1:02,,1,132,"

Although this question deals with the construction of a W-state, I was looking for a general way to find all the orthogonal W-states, given a number of qubits. For example, for three qubits, the first W-state I find is:

+

$$ +W_3^1 = \frac{1}{\sqrt{3}}(|001\rangle + |010\rangle + |100\rangle). +$$ +An orthogonal state to this state would be (from this paper, page 4): +$$ +W_3^2 = \frac{1}{\sqrt{3}}(|001\rangle - |010\rangle + |111\rangle). +$$ +But I am not sure whether this state qualifies as a W-state or not. I want to find all the other 6 orthogonal basis states like this. Also, I would like to be able to generate such orthogonal basis states in any dimension. Of course, I can use Gram–Schmidt process to find a set of orthogonal vectors. But I'm not sure whether they would be W-states or not. What is the proper way to generate such W-basis states given a number of qubits? TIA.

+",2403,,55,,8/27/2020 12:54,8/27/2020 12:54,Generalized construction of W basis,,0,8,,,,CC BY-SA 4.0 +13078,2,,13056,7/29/2020 3:25,,1,,"

After several days of thinking and researching, I decided to answer my own question.

+

N.B. The tensor product symbol $\otimes$ are omitted when there is no risk in confusion, especially when the index is different. In symbol,

+

$$ +A_iB_j = A_i \otimes B_j (i \neq j). +$$

+

Firstly, for case

+

$$e^{i \beta B} Z_i Z_j e^{-i \beta B},$$

+

we only consider qubit $j$, in which $B_e=\sum_{k \in e}{X_k}$. As $X_i$ and $X_j$ act on different qubits,

+

$$ +e^{i{(X_i+X_j)}}=e^{i((X_i\otimes I_j)+(I_i \otimes X_j))}=e^{iX_i}e^{iX_j}. +$$

+

Now, +$$ +\begin{align} +e^{-i \beta X} +& = e^{-i \beta \begin{bmatrix}0 & 1\\ 1 & 0\end{bmatrix}} \\ +& = e^{-i \beta \begin{bmatrix}\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}}\end{bmatrix} + \begin{bmatrix}1 & 0\\ 0 & 1\end{bmatrix} + \begin{bmatrix}\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}\end{bmatrix}} \\ +& = \begin{bmatrix}\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}}\end{bmatrix} + \begin{bmatrix}e^{-i \beta} & 0\\ 0 & e^{-i \beta}\end{bmatrix} + \begin{bmatrix}\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}\end{bmatrix} \\ +& = \begin{bmatrix}\cos(\beta) & -i\sin(\beta)\\ -i\sin(\beta) & \cos(\beta)\end{bmatrix} \\ +& = I\cos(\beta)-iX\sin(\beta). +\end{align} +$$

+

Thus,

+

$$ +\begin{align} +e^{i \beta X} +& = I\cos(\beta)+iX\sin(\beta). +\end{align} +$$

+

Hence,

+

$$ +\begin{align} +e^{i \beta X} Z e^{-i \beta X} & = (I\cos(\beta)+iX\sin(\beta))Z(I\cos(\beta)-iX\sin(\beta)) \\ +& = Z \cos(2\beta) + Y\sin(2\beta). +\end{align} +$$

+

For the Ising traverse field Hamiltonian, we only consider $$G_{e=(i,k)}=Z_iZ_k.$$

+

For $e^{i \gamma Z_iZ_k}$, it can be evaluated as

+

$$ +\begin{align} +e^{i \gamma Z_iZ_k} &= e^{i \gamma \begin{bmatrix}1&&&\\&-1&&\\&&-1&\\&&&1\end{bmatrix}} \\ +& = \begin{bmatrix}e^{i\gamma}&&&\\&e^{-i\gamma}&&\\&&e^{-i\gamma}&\\&&&e^{i\gamma}\end{bmatrix} \\ +& = \begin{bmatrix}\cos\gamma+i\sin\gamma &&&\\&\cos\gamma-i\sin\gamma&&\\&&\cos\gamma-i\sin\gamma&\\&&&\cos\gamma+i\sin\gamma\end{bmatrix} \\ +& = \cos\gamma\begin{bmatrix}1&&&\\&1&&\\&&1&\\&&&1\end{bmatrix}+i\sin\gamma\begin{bmatrix}1&&&\\&-1&&\\&&-1&\\&&&1\end{bmatrix} \\ +& = I_i I_k \cos\gamma + i Z_1Z_2 \sin\gamma. +\end{align} +$$ +We can calculate two-qubit operations independently, such that

+

$$ +Y_i (Z_i Z_k) = (Y_i \otimes I_k)(Z_i \otimes Z_k)=(Y_i Z_i) \otimes (I_kZ_k) = i X_i \otimes Z_k = i X_i Z_k. +$$

+

Numerically, if you cannot convince yourself,

+

$$ +Y_i \otimes I_k = \begin{bmatrix} &&-i&\\&&&-i\\i&&&\\&i&& \end{bmatrix} +$$

+

and

+

$$ +Z_i \otimes Z_k = \begin{bmatrix} 1&&&\\&-1&&\\&&-1&\\&&& 1\end{bmatrix} +$$

+

and

+

$$ +(Y_i \otimes I_k)(Z_i \otimes Z_k) = \begin{bmatrix} &&i&\\&&&-i\\i&&&\\&-i&&\end{bmatrix} = i(X_i \otimes Z_k). +$$

+

Now, for a more specific example, +$$ +\begin{align} +e^{-i \gamma Z_iZ_k} Y_i e^{i \gamma Z_iZ_k} & = (I_i I_k \cos\gamma - i Z_1Z_2 \sin\gamma) (Y_i \otimes I_k) (I_i I_k \cos\gamma + i Z_1Z_2 \sin\gamma) \\ +& = Y_i \cos^2\gamma - Y_i\sin^2\gamma - X_i Z_k\sin\gamma\cos\gamma - X_i Z_k \sin\gamma\cos\gamma \\ +& = Y_i \cos 2\gamma - X_iZ_k\sin 2\gamma. +\end{align} +$$

+

Q.E.D.

+",12693,,12693,,7/30/2020 2:32,7/30/2020 2:32,,,,0,,,,CC BY-SA 4.0 +13080,1,13087,,7/29/2020 7:43,,0,188,"

I am not able to undo an operation. For example, I want a single Hadamard gate on a single qubit but by mistake two Hadamard gate added. Now I want to remove one of them without interrupting kernel. Is there any easy way. Please help me. Thank you.

+",12803,,55,,7/29/2020 18:12,7/29/2020 18:12,How to undo an operation in qiskit on jupyter notebook?,,1,2,,,,CC BY-SA 4.0 +13082,2,,13076,7/29/2020 8:19,,3,,"

I think your explanation based on the circuit is perfectly adequate.

+

For a more rigorous "proof", why not simply take the output of the circuit? Substitute in $x_i=0$ for all $i$ and see that all the outputs are $(|0\rangle+|1\rangle)/\sqrt{2}$ for $i\neq 1$ and $(|0\rangle+(-1)^{x_1}|1\rangle)/\sqrt{2}$ for $i=1$, exactly as it would be for the Hadamard transform.

+

Alternatively, simply repeat the proof in the answer you cite for two inputs: $|0\rangle^{\otimes n}$ and $|1\rangle|0\rangle^{\otimes(n-1)}$. If it works for those two, by linearity it must work for any input on the first qubit.

+",1837,,,,,7/29/2020 8:19,,,,0,,,,CC BY-SA 4.0 +13083,1,,,7/29/2020 10:04,,1,170,"

Considering a $\chi$-matrix of a circuit with, say, 4 qubits, is it possible to trace out 3 of them from $\chi$ - for example qubits $q_0$, $q_2$ and $q_3$ - thus gaining the process matrix describing what happens to $q_1$? +If yes, since it seems to me different from partial trace for a density matrix, could you please give me the definition?

+

The $\chi$-matrix of an $n$-qubit quantum channel $\mathcal{E}$ is a matrix $\chi$ such that the evolution of a density matrix $\rho$ is given by +\begin{gather} +\mathcal{E}(\rho) = \sum_{i,j}\chi_{i,j}P_i \rho P_j +\end{gather}

+

where $\{P_0, P_1,\dots ,P_{d^{2}−1}\}$ is the $n$-qubit Pauli basis containing $d^{2} = 4^{n}$ elements.

+

An estimation method to compute the $\chi$-matrix is available at 8.4.2 of Nielsen & Chuang's Quantum Computation and Quantum Information.

+",8954,,55,,11/25/2020 10:04,11/25/2020 10:04,"Is it possible to partial trace the $\chi$-matrix of $4$ qubits $q_0,q_1,q_2,q_3$ to obtain a description of what happens to $q_1$?",,0,2,,,,CC BY-SA 4.0 +13084,2,,13012,7/29/2020 10:27,,2,,"

An example of a state which yeilds an entangled state when you trace one qubit out, is the 3-qubit "W" state: +$$ +\lvert W_3 \rangle = \tfrac{1}{\sqrt3} \Bigl( \lvert 100 \rangle + \lvert 010 \rangle + \lvert 001 \rangle \Bigr) +$$ +Taking the outer product with itself, we obtain +$$ +\lvert W_3 \rangle\!\langle W_3 \rvert = \tfrac{1}{3} \Bigl( +\!\begin{aligned}[t]& + \lvert 100 \rangle\!\langle 100 \rvert + \lvert 100 \rangle\!\langle 010 \rvert + + \lvert 100 \rangle\!\langle 001 \rvert \phantom{\Big)} + \\&+ + \lvert 010 \rangle\!\langle 100 \rvert + \lvert 010 \rangle\!\langle 010 \rvert + + \lvert 010 \rangle\!\langle 001 \rvert + \\&+ + \lvert 001 \rangle\!\langle 100 \rvert + \lvert 001 \rangle\!\langle 010 \rvert + + \lvert 001 \rangle\!\langle 001 \rvert +\Bigr) \end{aligned} +$$ +If we trace out the third qubit, we then obtain the state +$$ +\begin{align} +\rho = \mathrm{tr}_3\Bigl(\lvert W_3 \rangle\!\langle W_3 \rvert\Bigr) +&= \tfrac{1}{3} \Bigl( + \lvert 10 \rangle\!\langle 10 \rvert + \lvert 10 \rangle\!\langle 01 \rvert + + \lvert 01 \rangle\!\langle 10 \rvert + \lvert 01 \rangle\!\langle 01 \rvert + + \lvert 00 \rangle\!\langle 00 \rvert +\Bigr) +\\&= \tfrac{1}{3} \lvert 00 \rangle\!\langle 00 \rvert + \tfrac{2}{3} \lvert \Psi^+ \rangle\!\langle \Psi^+ \rvert, +\end{align} +$$ +where in particular $\lvert \Psi^+ \rangle = \tfrac{1}{\sqrt 2}\bigl( \lvert 01 \rangle + \lvert 10 \rangle \bigr)$ is a Bell state.

+

Note that $\rho$ is a rank-2 operator with different eigenvalues: any decomposition of $\rho$ as a convex combination of other density operators, can only involve terms whose eigenvectors are supported on $\mathrm{span}\,\{ \lvert 00 \rangle, \lvert \Psi^+ \rangle \}$. Any mixed tensor product density operator $\rho_A \otimes \rho_B$ has an eigenbasis consisting of two or more product states; but the only product state contained in $\mathrm{span}\,\{ \lvert 00 \rangle, \lvert \Psi^+ \rangle \}$ is the state $\lvert 00 \rangle$ itself. It follows that $\rho$ cannot be decomposed as a convex combination of products of possibly-mixed states, and is entangled.

+

More generally, if for $n > 1$ we define $\lvert W_n \rangle$ as the analogous $n$-term uniform superposition of standard basis states with a single 1, we may describe it as +$$ \lvert W_n \rangle = \tfrac{\sqrt{n{-}1}}{\sqrt n} \lvert W_{n{-}1}\rangle\lvert0\rangle + \tfrac{1}{\sqrt n} \lvert00\cdots0\rangle\lvert1\rangle +$$ +so that +$$ \mathrm{tr}_n\Bigl(\lvert W_n \rangle\!\langle W_n \rvert\Bigr) = \tfrac{n{-}1}{n} \lvert W_{n-1} \rangle\!\langle W_{n-1} \rvert + \tfrac{1}{n} \lvert 00\cdots0\rangle\!\langle 00\cdots 0\rvert +$$ +which for larger values of $n$ is closer and closer to being a pure entangled state, while still being mixed for any finite $n$.

+",124,,,,,7/29/2020 10:27,,,,2,,,,CC BY-SA 4.0 +13085,1,13098,,7/29/2020 12:58,,1,1481,"

I know that when a qubit is described in a superposition state as $\alpha|0⟩ + \beta|1⟩$, then the probability of measuring $|0⟩$ is $\alpha^2$ and probability of measuring $|1⟩$ is $\beta^2$ and $\alpha$ and $\beta$ belong to the complex number set, $C$.

+

So let's say that, the amplitude of state, say, $|0⟩$ is $\alpha=i$, which means that the probabilty of measuring the $|0⟩$ state will be $\alpha^2=i^2=-1$.

+

So, my question is, does the mean that the probability here can also be negative? Since, as far as I knew, negative probability does not exist? Or is my understanding wrong?

+",11868,,,,,7/30/2020 12:30,Can quantum states have negative probability?,,3,1,,,,CC BY-SA 4.0 +13086,2,,13085,7/29/2020 13:01,,16,,"

The probability is $|\alpha|^2$, not $\alpha^2$, and thus always non-negative.

+",491,,9006,,7/30/2020 7:03,7/30/2020 7:03,,,,0,,,,CC BY-SA 4.0 +13087,2,,13080,7/29/2020 13:41,,2,,"

To remove the last gate you can do qc.data.pop().

+

Example:

+
qc = QuantumCircuit(1)
+qc.h(0)
+qc.draw('text')
+
+

output:

+
     ┌───┐
+q_0: ┤ H ├
+     └───┘
+
+

Then:

+
qc.data.pop()
+qc.draw('text')
+
+

output:

+
q_0: 
+
+",10415,,,,,7/29/2020 13:41,,,,1,,,,CC BY-SA 4.0 +13088,1,,,7/29/2020 14:55,,1,65,"

I might be asking something quite obvious but why is it stated that only one evaluation of $f$ is needed in the Deutsch-Jozsa algorithm?

+

If we have a quantum oracle for $f:\{0,1\}^n\rightarrow\{0,1\}$ and we apply the oracle to the $(n+1)$-qubit state, we get the quantum state $\frac{1}{\sqrt{2^{n+1}}}\sum_{n=0}^{2^n-1}|x\rangle (|f(x)\rangle-|1\oplus f(x)\rangle)$.

+

Why does the algorithm involve only a single evaluation of $f$? In order to apply the quantum oracle, doesn't the application of the quantum oracle involve full knowledge of the function $f$? Don't we have to calculate $f$ for $x=0,1,2,...,2^n-1$?

+",12480,,55,,7/29/2020 15:11,7/29/2020 15:11,Deutsch-Jozsa: why is only one evaluation of $f$ needed?,,0,0,,7/29/2020 19:30,,CC BY-SA 4.0 +13090,1,,,7/29/2020 17:33,,2,67,"

I am doing some research for an undergrad project and have hit a conceptual stumbling block. I have recently been looking at some of the achievements in practical QKD using trusted node quantum networks. The achieved secret key rates are usually measured in kbps (SECOQC, DARPA, Tokyo QKD etc.)

+

I know that there is an upper-bound for the secret key rate based for any repeaterless QKD protocol, the PLOB limit. In the paper (Pirandola et al., 2017), they plot the secret key rate against distance. But here the secret key rate is measured in bits per channel use and it is several orders of magnitude lower than the secret key rate mentioned in the practical papers mentioned above.

+

Sadly, I don't have time to delve into this, but would like to understand how I can compare these numbers. In a practical QKD protocol between two parties, as far as I know, there is usually a single channel (a fibre cable perhaps). So, would I be right in thinking that, depending on the protocol, the channel will be used many times a second in order to share information, hence, the secret key rate (in kbps) when looked at per channel use would actually be a much lower value?

+

All I need is enough information, perhaps a paper which I could look at, which would help me understand the PLOB limits use of secret key rate (as measured in bits per channel use) versus the practical QKD usage which measures the secret key rate in kbps.

+

Thanks in advance to anyone who can help

+",12806,,55,,8/27/2020 12:53,8/27/2020 12:53,How do I compare the secret key rate (kbps) with the secret key rate per channel use?,,1,0,,,,CC BY-SA 4.0 +13092,1,13094,,7/29/2020 17:36,,1,142,"

I am trying to simulate an experiment on IBM's melbourne quantum computer and here are the results

+
    +
  1. Qasm simulator :

    +
  2. +
  3. ibmq_16_melbourne: +

    +
  4. +
  5. error

    +
  6. +
+

why is there such high probability of unwanted states i.e 01 and 10. Also when the circuit is transpiled on the melbourne computer the circuit operates between $q[4]$ and $q[10]$, is these usual.

+",6070,,55,,7/29/2020 18:11,7/30/2020 2:13,IBMQ_Melbourne Readout error,,1,0,,,,CC BY-SA 4.0 +13094,2,,13092,7/29/2020 18:53,,1,,"

Every rotation or controlled operation you perform on each individual qubit has an error associated to it, you can check it here by selecting a computer and hovering over each Qubit, through the error range bar or through Python as you seem to have done.

+

What I've found in my experiments is that what usually ruins an experiment is the error associated with the CNOT operation, you can keep track of their count by using something along these lines qc.count_ops().get('cx'). Another thing that may help is setting the layout method to "noise adaptive", by including layout_method='noise_adaptive' into the transpiler parameters. You should check the transpiler documentation and play around with the different parameters in order to best optimize your gate count. Ultimately the transpiler can only do so much and your circuit might just not be able to run on a real device.

+

I'm currently working on some circuits that require a decent amount of SWAP operations that are decomposed into 3 CNOTs each, at the very minimum. I was thinking that running them on Melbourne computer would yield better results, since it has the best suited connectivity for my specific needs. What i found was that the results were very, very bad when compared to a computer that has less connectivity but also less error associated with the CNOT operation.

+",12778,,12778,,7/30/2020 2:13,7/30/2020 2:13,,,,7,,,,CC BY-SA 4.0 +13095,2,,13090,7/29/2020 21:50,,2,,"

Indeed, the PLOB bound is an ultimate upper bound for repeaterless quantum communications, and is thus derived by averaging over $n\rightarrow \infty$ uses of the communications channel - Hence why the capacity is given as bits per channel use.

+

If you wish to more closely compare the PLOB bound to other well known protocols, look at Supplementary Note 6 in the original paper which provides key rates of these other well known CV and DV protocols. If you want a closer look at the derivation of the upper bound see this paper also .

+",9839,,,,,7/29/2020 21:50,,,,0,,,,CC BY-SA 4.0 +13096,1,13099,,7/30/2020 1:17,,3,379,"

I know there are various quantum noise channels, which include the depolarizing channel, the dephasing channel and the bit-flip channel; We can apply them in simulators easily.

+

However, is there any standard to choose the model we apply?

+

I mean, why we should (for instance) choose a flip channel over a depolarizing channel and when should we choose a specific channel? Why is the depolarizing channel commonly used?

+",11765,,55,,8/27/2020 12:53,8/27/2020 12:53,What is the standard noise channel that is applied in simulations?,,1,8,,,,CC BY-SA 4.0 +13097,1,,,7/30/2020 7:04,,6,258,"

I'm trying to construct a general circuit for Shor's algorithm in Qiskit. I understood the later parts of the circuit (inverse QFT and QPE), but can't really understand the order finding. +For example, if we consider $N=15$, we have all the $\text{gcd}$ of 15 to be 2, 7, 8, 11, 13 (although I suspect that 4 is not considered as it is $2^2$). For $a=2$ or $13$, we swap qubits 0 and 1, 1 and 2, 2 and 3. If $a=7$ or $8$, we swap 2 and 3, 1 and 2, 0 and 1. If $a=11$, we swap 1 and 3, 0 and 2. Also, if $a=7, 11$ or $13$, we add an $X$ gate on all the 4 added qubits.

+

I want to know how we chose which qubits to swap for a particular number, and how we can generalize it, if possible.

+",12811,,16092,,6/15/2021 1:36,6/15/2021 1:36,Is there a general order finding quantum algorithm for a given a and N?,,2,0,,,,CC BY-SA 4.0 +13098,2,,13085,7/30/2020 7:10,,5,,"

Just to add, I sometime come accros notion of negative probability in quantum mechanics. However, this misunderstanding. As you mentioned, each qubit can be writen as +$$ +|q\rangle = \alpha|0\rangle + \beta|1\rangle, +$$ +where $\alpha, \beta \in \mathbb{C}$.

+

So, we can have for example a qubit +$$ +|q\rangle = \frac{1}{\sqrt{2}}(|0\rangle - \beta|1\rangle). +$$

+

It may seem that probability of measuring state $|1\rangle$ is negative, but the coefficient $-\frac{1}{\sqrt{2}}$ is a complex amplitude, not the probability itself.

+

The probabilities are, as already mentioned by Norbert Schuch, calculated as +$$ +P(|0\rangle) = |\alpha|^2 +$$ +$$ +P(|1\rangle) = |\beta|^2 +$$ +Hence they are non-negative.

+

The negative sign in my example is caused by non-zero phase of the qubit which is $\pi$ in this case (note that $\mathrm{e}^{i \pi} = -1$).

+",9006,,,,,7/30/2020 7:10,,,,0,,,,CC BY-SA 4.0 +13099,2,,13096,7/30/2020 8:23,,3,,"

Some thoughts:

+

A theoretical perspective

+

From a theoretical perspective, the depolarizing channel is the 'standard' (if there is such a thing) or by some means the most applicable.

+

Because the Paulis (together with the identity operator) form a basis for $SU(2)$, if a code can correct the $X, Y$ and $Z$ flips on a certain qubit (and it it is able to correctly identify no error (i.e. '$I$-flip') having happened), it can correct all errors on that qubit. A theoretical analysis of a code cares a little less about the relative probabilities of these three flips happening, so we just as well can set them all to $\frac{p}{3}$, thereby obtaining the depolarizing channel.

+

The depolarizing channel $\Lambda_{\mathrm{depo}}$ can be written as:

+

$$ +\Lambda_{\mathrm{deph}}\left(\begin{bmatrix}a & b \\ b^{*} & d\end{bmatrix}\right) = \begin{bmatrix} (1-\frac{2p}{3})a + \frac{2p}{3}d & (1-\frac{4p}{3}) b \\ (1-\frac{4p}{3})b^{*} & (1-\frac{2p}{3})d + \frac{2p}{3}a\end{bmatrix}. +$$ +Since $d = 1-a$, we can rewrite this to:

+

$$ +\Lambda_{\mathrm{deph}}\left(\rho_{\mathrm{in}}\right) = (1-\frac{4p}{3})\rho_{\mathrm{in}} + \frac{4p}{3} \frac{I}{2}, +$$ +which is a convex combination of the input $\rho_{\mathrm{in}}$ and the maximally mixed state $\frac{I}{2}$. +Furthermore, if you would equate $p$ to the elapsed time, $p$ would asymptotically go to $\frac{3}{4}$, thereby obtaining the maximally mixed state; therefore the depolarizing channel is in some way the 'worst' noise channel: it destroys both all quantum- (i.e. coherent superpositions) and classical information (there's literally only noise left) in the qubit.

+

A physical perspective

+

If you want your simulation to be more true to the physical world, the depolarizing channel is not a very good model, as much as theorists might like it to be. +A good first model for noise in qubits is the combination of two channels, the dephasing channel $\Lambda_{\mathrm{deph}}$ and the amplitude damping channel $\Lambda_{\mathrm{amp}}$.

+

Loosely speaking, the dephasing channel map destroys the coherent phase between the $|0\rangle$ and $|1\rangle$ state:

+

$$ +\Lambda_{\mathrm{deph}}\left(\begin{bmatrix}a & b \\ b^{*} & 1-a\end{bmatrix}\right) = \begin{bmatrix}a & e^{-\frac{t}{T_{2}}} b \\ e^{-\frac{t}{T_{2}}}b^{*} & 1-a\end{bmatrix}, +$$

+

where $T_{2}$ is known as the characteristic qubit dephasing time.

+

The Kraus operators of $\Lambda_{\mathrm{deph}}$ are $A_{1} = \sqrt{1-p}I$ and $A_{2} = \sqrt{p}Z$, so it is still a Pauli channel, which can help in the analysis or simulation.

+

$\Lambda_{\mathrm{amp}}$ is a little bit trickier: it simulates the relaxation of the excited (by convention $|1\rangle$) state, and maps it to the $|0\rangle$ state:

+

$$ +\Lambda_{\mathrm{amp}}\left(\begin{bmatrix}a & b \\ b^{*} & 1-a\end{bmatrix}\right) = \begin{bmatrix}a & e^{-\frac{t}{2T_{1}}} b \\ e^{-\frac{t}{2T_{1}}} b^{*} & e^{-\frac{t}{T_{1}}}(1-a)\end{bmatrix}, +$$ +where $T_{1}$ is known as the qubit relaxation time.

+

The Kraus operators are also a little trickier: $B_{1} = \begin{bmatrix}1 & 0 \\ 0 & \sqrt{1-p}\end{bmatrix}$ and $B_{2} = \begin{bmatrix}0 & \sqrt{p} \\ 0 & 0\end{bmatrix}$. This means that amplitude damping channel is not a Pauli channel (allthough its Kraus operators can of course be written as linear combinations of the Paulis).

+

A simulation of a system undergoing both an amplitude damping and dephasing is a good start. There is one big caveat, however: this does not take leakage errors into account whatsoever. Depending on the physical system you are trying to simulate, this might range from either not a very large issue (e.g. for quantum dots) to a gross oversimplification (e.g. for transmon qubits).

+",8141,,8141,,7/30/2020 12:11,7/30/2020 12:11,,,,0,,,,CC BY-SA 4.0 +13100,1,13114,,7/30/2020 9:45,,2,143,"

Given density operator of a composite system, say $\rho_{AB}$, we can always calculate reduced density operators of individual system i.e. $\rho_{A}=Tr_{B}(\rho_{AB})$ and $\rho_{B}=Tr_{A}(\rho_{AB})$.

+

Can we calculate density matrix of a composite system, $\rho_{AB}$, given reduced density operators $\rho_{A}$ and $\rho_{B}$ and also knowing that $\rho_{A}$ and $\rho_{B}$ are mixed state density operators? If yes, then how?

+",10368,,55,,8/1/2020 11:48,8/1/2020 11:48,Can we compute a full density operator $\rho_{AB}$ from its reduced density operators $\rho_A$ and $\rho_B$?,,2,0,,,,CC BY-SA 4.0 +13101,2,,13100,7/30/2020 9:53,,3,,"

No. For example, +$$ +\rho_{AB}=\frac{I}{4},\qquad \rho_{AB}=\frac{1}{2}(|00\rangle+|11\rangle)(\langle00|+\langle 11|) +$$ +both have the same reduced density matrices $\rho_A=\rho_B=I/2$.

+",1837,,,,,7/30/2020 9:53,,,,2,,,,CC BY-SA 4.0 +13102,1,,,7/30/2020 10:34,,3,298,"

Can someone suggest me a way to load a distribution (for example a discretized Gaussian distribution) into a quantum computer using a quantum circuit?

+

I tried to implement the code using Qiskit.

+",12747,,9006,,7/31/2020 7:01,7/31/2020 7:01,How can I load a probability distribution using a quantum circuit in Qiskit?,,2,0,,,,CC BY-SA 4.0 +13103,2,,13102,7/30/2020 12:03,,1,,"

Several quantum circuit representations for common distributions are given in uncertainty models. +For generic probability distributions, you can train a quantum circuit representation using quantum generative adversarial networks. For a respective tutorial, please see here.

+",12815,,,,,7/30/2020 12:03,,,,0,,,,CC BY-SA 4.0 +13104,2,,13085,7/30/2020 12:30,,2,,"

Though we don't come across negative probabilities in a quantum computation problem in the general sense, there is a historic context on the discussion and debate around negative probabilities in quantum mechanics.

+

In 1942, Paul Dirac wrote a paper "The Physical Interpretation of Quantum Mechanics" where he introduced the concept of negative energies and negative probabilities. The idea of negative probabilities later received increased attention in physics and particularly in quantum mechanics. Richard Feynman introduced ghosts as "negative probability" in perturbative gauge theories. The main purpose of the ghosts is to cancel the contributions from unphysical polarisations of gauge fields in loops.

+

Another example is known as the Wigner distribution in phase space, introduced by Eugene Wigner in 1932 to study quantum corrections, often leads to negative probabilities. For this reason, it has later been better known as the Wigner quasiprobability distribution. The Wigner distribution function is routinely used in physics nowadays and provides the cornerstone of phase-space quantization. Its negative features are an asset to the formalism and often indicate quantum interference.

+

However, one never obtains "negative probability" densities when one discusses single observables. One obtains "negative probability" densities only when one discusses joint distributions of incompatible observables.

+

There are two works of Feynman about negative probabilities.

+

R. P. Feynman, Negative probability in Quantum implications: Essays in Honor of David Bohm, edited by B. J. Hiley and F. D. Peat (Routledge and Kegan Paul, London, 1987), Chap. 13, pp 235 – 248.

+

R. P. Feynman, Simulating physics with computers (Chapter 6), Int. J. Theor. Phys., 21, 467 – 488 (1982).

+",4501,,,,,7/30/2020 12:30,,,,0,,,,CC BY-SA 4.0 +13105,2,,13102,7/30/2020 12:57,,0,,"

There are practical examples in Qiskit on how to use common probability distributions with uncertainty models. Let us refer to the following example from Qiskit-AQUA (Algorithms for QUantum computing Applications) on using amplitude estimation algorithm to evaluate a fixed income asset with uncertain interest rates.

+
import numpy as np
+from qiskit import BasicAer
+from qiskit.aqua.algorithms import AmplitudeEstimation
+from qiskit.aqua.components.uncertainty_models import MultivariateNormalDistribution
+from qiskit.finance.components.uncertainty_problems import FixedIncomeExpectedValue
+
+# Create a suitable multivariate distribution
+mvnd = MultivariateNormalDistribution(num_qubits=[2, 2],
+                                      low=[0, 0], high=[0.12, 0.24],
+                                      mu=[0.12, 0.24], sigma=0.01 * np.eye(2))
+
+# Create fixed income component
+fixed_income = FixedIncomeExpectedValue(mvnd, np.eye(2), np.zeros(2),
+                                        cash_flow=[1.0, 2.0], c_approx=0.125)
+
+# Set number of evaluation qubits (samples)
+num_eval_qubits = 5
+
+# Construct and run amplitude estimation
+algo = AmplitudeEstimation(num_eval_qubits, fixed_income)
+result = algo.run(BasicAer.get_backend('statevector_simulator'))
+
+print('Estimated value:\t%.4f' % result['estimation'])
+print('Probability:    \t%.4f' % result['max_probability'])
+
+",4501,,,,,7/30/2020 12:57,,,,0,,,,CC BY-SA 4.0 +13106,1,,,7/30/2020 13:08,,4,116,"

I want to understand the form of the intrinsic Hamiltonian of the IBM machines, such as ibmq_16_melbourne, and how this affects the data I get out when waiting using identity gates.

+

From the ZZ-characterisation tutorial in the documentation, it seems like the general form of the intrinsic Hamiltonian is +$$ +\mathcal{H} = \sum_i^N \frac{2\pi\nu_i}{2} (1-\sigma_i^z)+\sum_{ij}^N\frac{\xi_{ij}}{4}\left(1-\sigma_i^z\right)\left(1-\sigma_j^z\right),$$ +with sums in theory over all $N$ qubits. Here $\nu_i\approx 5\,\text{GHz}$ and $\xi_{ij}$ seem to take values up to $\sim 100\,\text{kHz}$, but only significantly above $0$ for nearest neighbours. Is this correctly understood?

+

Now, if I prepare an initial state $\frac{1}{\sqrt2}\left(|0\rangle +|1\rangle\right)\otimes|0\rangle^{N-1}$ I do not see oscillations with a frequency anywhere near $5\,\text{GHz}$, but rather something closer to $100\,\text{kHz}$. Does this mean that the measurements are being taken in the co-moving frame with frequencies for each qubit being $\nu_i$? If so, why do I have these residual oscillations?

+",12810,,12810,,8/3/2020 9:41,8/3/2020 9:41,Form and effect of the intrinsic Hamiltonian on the IBM machines,,0,0,,,,CC BY-SA 4.0 +13108,1,13113,,7/30/2020 16:38,,4,399,"

I somewhat understand its practical use in phase estimation and algorithms like Shor's algorithm but is there some more intuitive way of understanding what it does?

+

More concretely, I'd like to know if there is there some way of thinking about how it effects the probability of the base states and similarly, is there a way of considering how it effects the probability of the outcome of measurement of each input qubit?

+",12723,,55,,8/1/2020 10:35,8/1/2020 10:35,"Intuitively, what does the quantum Fourier transform do?",,1,5,,,,CC BY-SA 4.0 +13109,1,,,7/30/2020 17:13,,2,208,"

The first time I create a two qubits, two bits circuit and draw it the output is:

+
q0_0 
+q0_1 
+c0_0 
+c0_1 
+
+

Each subsequent time I run my script (even after clearing all the variables) I get the following:

+
q1_0
+q1_1 
+c1_0 
+c1_1 
+. 
+. 
+. 
+qn_0 
+qn_1 
+cn_0 
+cn_1 
+
+

The number next to the qubit or classical bit increases every time. Is this a bug, is there a way to avoid this?

+

I am using Qiskit 0.19.6.

+

+

+",12820,,9800,,8/6/2020 5:27,8/6/2020 5:27,qiskit.QuantumCircuit and qiskit.QuantumCircuit.draw(),,1,0,,,,CC BY-SA 4.0 +13110,2,,13109,7/30/2020 17:27,,5,,"

It's not a bug, if you don't give concrete names to the registers then Qiskit will number them increasingly. If you want them to have the same name, you can do that like

+
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
+
+qr = QuantumRegister(2, 'q')
+cr = ClassicalRegister(2, 'c')
+circuit = QuantumCircuit(qr, cr)
+circuit.draw()
+
+",9800,,,,,7/30/2020 17:27,,,,0,,,,CC BY-SA 4.0 +13111,1,13127,,7/30/2020 19:14,,0,79,"

Let say we have a product state $$|\phi^+\rangle_{12}|\phi^+\rangle_{34}$$ with particles (1,4) belong to $A$ and (2,3) belong to $B$. Where $A$ and $B$ are say at distance of $L$ from each other. When particle $A$ measures his qubits $(1,4)$ in the BSM (Bell state measurement), there is correlation to the BSM of the $(2,3)$ qubits of $B$. Suppose this was part of some secret sharing scheme, what cost does it incur, starting from the initial creation of the state, to the transmission of data (quantum) which includes communication the classical information.

+

Does the distance between these two parties $A$ and $B$ have some role to play? My feeling is that it should have a role since the quantum data when transmitted over the channel may be exposed to noise or any other errors, so the longer the distance the higher is the probability of the error in transmission.

+

Is this cost some function of $L$ and the number of qubits (in this case $4$). And if there is some transmission cost how does one reduce this?

+

Can somebody atleast give some references?

+",6070,,6070,,7/31/2020 19:00,7/31/2020 22:46,Entanglement and teleportation transmission costs,,1,0,,,,CC BY-SA 4.0 +13113,2,,13108,7/30/2020 21:55,,5,,"

Let's see what QFT does on two qubit (and then on three qubit) computational basis states and try to gain some insights. The QFT action on $|j\rangle$ basis state:

+

$$QFT |j\rangle = \frac{1}{2^{\frac{n}{2}}} \sum_{k=0}^{2^n -1} e^{2 \pi i \frac{jk}{2^n}} |k\rangle$$

+

where $n$ is the qubit number. Now suppose $n=2$, then:

+

\begin{align*} +QFT |00\rangle &= QFT |0\rangle = \frac{1}{2} \sum_{k=0}^{3} e^{2 \pi i \frac{0 \cdot k}{4}} |k\rangle = \frac{1}{2}\big( |0\rangle + |1\rangle + |2\rangle + |3\rangle \big) +\\ +QFT |01\rangle &= QFT |1\rangle = \frac{1}{2} \sum_{k=0}^{3} e^{2 \pi i \frac{1 \cdot k}{4}} |k\rangle = \frac{1}{2}\big( |0\rangle + i |1\rangle - |2\rangle - i|3\rangle \big) +\\ +QFT |10\rangle &= QFT |2\rangle = \frac{1}{2} \sum_{k=0}^{3} e^{2 \pi i \frac{2 \cdot k}{4}} |k\rangle = \frac{1}{2}\big( |0\rangle - |1\rangle + |2\rangle - |3\rangle \big) +\\ +QFT |11\rangle &= QFT |3\rangle = \frac{1}{2} \sum_{k=0}^{3} e^{2 \pi i \frac{3 \cdot k}{4}} |k\rangle = \frac{1}{2}\big( |0\rangle - i|1\rangle - |2\rangle + i|3\rangle \big) +\end{align*}

+

From here one can see that each $|j \rangle$ after QFT becomes a superposition state of all basis states with equal probabilities (in this case the probability is equal to $\frac{1}{4}$). And because QFT is a unitary operator, if $\langle j | j'\rangle= 0$ (when $j \ne j'$), then $\langle j |QFT^{\dagger} QFT | j'\rangle= 0$, so the states generated by $QFT | j\rangle$ are different superposition states with equal probabilities that are orthogonal to each other.

+

Now three qubit case. I will write down only for three cases:

+

\begin{align*} +QFT &|000\rangle = QFT |0\rangle = \frac{1}{2^{\frac{3}{2}}} \sum_{k=0}^{7} e^{2 \pi i \frac{0 \cdot k}{2^n}} |k\rangle = +\\ +&=\frac{1}{2^{\frac{3}{2}}}\big( |0\rangle + |1\rangle + |2\rangle + |3\rangle + |4\rangle + |5\rangle + |6\rangle + |7\rangle\big) +\\ +QFT &|001\rangle = QFT |1\rangle = \frac{1}{2^{\frac{3}{2}}} \sum_{k=0}^{7} e^{2 \pi i \frac{1 \cdot k}{8}} |k\rangle = +\\ +&=\frac{1}{2^{\frac{3}{2}}}\big( |0\rangle + e^{i \frac{\pi}{4}}|1\rangle + e^{i \frac{\pi}{2}}|2\rangle +e^{i \frac{3 \pi}{4}} |3\rangle + e^{i \pi}|4\rangle +e^{i \frac{5\pi}{4}} |5\rangle + e^{i \frac{3\pi}{2}}|6\rangle + e^{i \frac{7 \pi}{4}}|7\rangle\big) +\\ +QFT &|111\rangle = QFT |7\rangle = \frac{1}{2^{\frac{3}{2}}} \sum_{k=0}^{7} e^{2 \pi i \frac{7 \cdot k}{8}} |k\rangle = +\\ + &=\frac{1}{2^{\frac{3}{2}}}\big( |0\rangle + e^{i \frac{7 \pi}{4}}|1\rangle + e^{i \frac{3\pi}{2}}|2\rangle +e^{i \frac{5 \pi}{4}} |3\rangle + e^{i \pi}|4\rangle +e^{i \frac{3\pi}{4}} |5\rangle + e^{i \frac{\pi}{2}}|6\rangle + e^{i \frac{ \pi}{4}}|7\rangle\big) +\end{align*}

+

This time also $QFT |j\rangle$ generates superposition states with equal probabilities (note that $| \frac{e^{i\varphi}}{2^{\frac{3}{2}}}|^2 = \frac{1}{8}$ for any given $\varphi$ ) that are orthogonal to each other. The same logic works for arbitrary number of qubits $n$. $H$ can be regarded as one qubit QFT and note that $H |j \rangle$ ($j = 0,1$), in the same manner, also produces superposition states with equal probabilities that are orthogonal to each other.

+
+

If instead of computational basis $|j \rangle$ we apply QFT on an arbitrary superposition state $\sum_{j = 0}^{2^n -1} a_j |j\rangle$ things get slightly complicated:

+

$$QFT \sum_j a_j |j\rangle = \frac{1}{2^{\frac{n}{2}}} \sum_{l,k=0}^{2^n -1} e^{2 \pi i \frac{lk}{2^n}} | k \rangle \langle l | \sum_{j = 0}^{2^n -1} a_j |j\rangle = \frac{1}{2^{\frac{n}{2}}} \sum_{j,k=0}^{2^n -1} a_j e^{2 \pi i \frac{jk}{2^n}} | k \rangle $$

+

And the probability of measuring $|k \rangle$ is equal to:

+

$$p_k = \frac{1}{2^n} \left|\sum_{j = 0}^{2^n - 1} a_j e^{2 \pi i \frac{jk}{2^n}} \right|^2$$

+

As an example let's apply QFT on this Bell state $| \Phi^+ \rangle = \frac{1}{\sqrt{2}} \big(|00\rangle + |11\rangle \big) = \frac{1}{\sqrt{2}} \big(|0\rangle + |3\rangle \big)$:

+

$$QFT \frac{1}{\sqrt{2}} \big(|0\rangle + |3\rangle \big) = \frac{1}{2 \sqrt{2}} \big(2|0\rangle + (1 - i)|1\rangle + (1 + i)|3\rangle \big)$$

+

The probability of measuring $|0\rangle$ state is equal to $\frac{1}{2}$, but the probability of measuring $|1\rangle$ or $|3\rangle$ states are equal $\frac{1}{4}$. Also, note that the probability of measuring $|2\rangle$ state is zero in this case.

+",9459,,9459,,7/31/2020 4:49,7/31/2020 4:49,,,,0,,,,CC BY-SA 4.0 +13114,2,,13100,7/31/2020 3:22,,2,,"

In general, given only the reduced states, you cannot find a unique state for the composite system. But you can certainly find states $\rho_{AB}$ such that their reduced states are $\rho_{A}, \rho_{B}$. As a trivial example, consider the state $\rho_{AB}=\rho_{A} \otimes \rho_{B}$, it is easy to check that it's reduced states give you $\rho_{A}, \rho_{B}$.

+

The real question is, why can't you find a unique composite state? Also, are there instances where you can find unique extensions?

+

The answer, like many things in quantum information theory, lies in entanglement. If the state $\rho_{AB}$ is a product state (that is, it is unentangled) then it's marginals (the reduced states) will uniquely define the composite state. For entangled states, this breaks down -- the intuitive reasoning is that the reduced states cannot account for the nonlocal correlations in the system. As an example, consider the four Bell states, all of them have the same marginals (the maximally mixed state $\frac{\mathbb{I}}{2}$) but the four Bell states are orthogonal to each other and hence completely distinguishable.

+",1108,,,,,7/31/2020 3:22,,,,0,,,,CC BY-SA 4.0 +13115,1,13116,,7/31/2020 5:49,,3,273,"

We can calculate single qubit state by measuring it in pauli observables {$\sigma_{x},\sigma_{y},\sigma_{z}$} and then looking at its probability distribution. How to do this when we are having joint probability distribution for multiqubit state? Specifically, I want to know the procedure for calculating 2-qubit state when it's measured in $\sigma_{x}\otimes\sigma_{x}$, $\sigma_{y}\otimes\sigma_{y}$ and $\sigma_{z}\otimes\sigma_{z}$ observables?

+",10368,,8141,,7/31/2020 8:26,7/31/2020 21:02,Calculating bipartite state from joint probability distribution,,2,0,,,,CC BY-SA 4.0 +13116,2,,13115,7/31/2020 8:25,,4,,"

This would not be enough information to reconstruct the bi-partite state.

+

Single-qubit case

+

For the one-qubit case, reconstruction of the state (which we describe as $\rho$) works, because the single-qubit Pauli observables $\{\sigma_{x},\sigma_{y},\sigma_{z}\}$ together with the $\sigma_{I}$-operator creates a basis for the space of single-qubit density matrices. If our probabilities are $\{p_{I}=1,p_{x},p_{y}.p_{z}\}$, we reconstruct as: +$$ +\rho = \sum_{i \in \{I,x,y,z\}} p_{i}\sigma_{i}. +$$

+

Bi-partite case

+

In principle we can do this also for a bi-partite state, but the operators over which we sum still need to form a basis for the space of (now bi-partite) density matrices. A simple count of the dimensions involved tells us that there should be $16$ elements in this basis, and not the four in $\{I, \sigma_{x}\otimes \sigma_{x},\sigma_{y}\otimes \sigma_{y},\sigma_{z}\otimes \sigma_{z}\}$.

+

The most obvious (and used) choice is to also include the cross products of all the Paulis. We then get a set of $4^{2} = 16$ elements, which is called the two-qubit Pauli group $\mathcal{P}^{2}$:

+

$$ +\mathcal{P}^{2} = \{\sigma_{I},\sigma_{x},\sigma_{y},\sigma_{z}\} \otimes \{\sigma_{I},\sigma_{x},\sigma_{y},\sigma_{z}\}. +$$ +If we would have all $16$ $p_{i}$'s, the reconstruction is as straightforward for the one-qubit case: +$$ +\rho_{2} = \sum_{i \in \{I,x,y,z\}\times \{I,x,y,z\}} p_{i}\sigma_{i}. +$$

+

You said you already have $p_{x,x}, p_{y,y}$ and $p_{z,z}$. $p_{I,I}$ is a freebie because it needs to be $1$; so you still need the $12$ other probabilities.

+

Some intuition

+

Basically, the above analysis tells us that to completely characterize our system of two qubits, knowing only what they do in this symmetric-coupling sense is not enough information. Basically, we are missing two sets of information:

+
    +
  • We need to know how these two qubits act under aymmetric coupling. That is to say, we need the probabilities for measurements of e.g. $\sigma_{x} \otimes \sigma_{y}$, or $\sigma_{z} \otimes \sigma_{x}$. Of course, there are $|\{x,y,z\}\times \{x,y,z\}|=9$ different elements here, but we already counted the three symmetric ones.
  • +
  • We also need to know what they do individually: if we measure 'nothing' on the first qubit but we measure the second qubit in any of the Pauli bases, we still learn something about the second qubit. These are the operators $\sigma_{I}\otimes \{\sigma_{x},\sigma_{y},\sigma_{z}\}$ and vice-versa: there are $6$ of them.
  • +
+

This gives a total of $1$ (for $\sigma_{I}\otimes \sigma_{I}$) + $3$ (for our original $3$ operators) + $9-3 = 6$ (for the asymmetric coupling operators) + $6$ (for the individual operators). This sums up to $16$, so we now have accounted for all of the operators.

+

Then how to actually get these other probabilities?

+

This question deals with the same problem, and there I also explain how to obtain these $12$ other probabilities from experimental outcomes. Note that these $3$ measurements really are not enough, and that you will need at least $9$ different measurement results: you need all symmetric and asymmetric operators.

+

Final note + further reading

+

As a last remark, the techniques of reconstructing density matrices from probability distributions (or a finite number of measurement outcomes) are collectively known as quantum state tomography or QST (It even has a Wikipedia page, hurray!). There are many more advanced techniques, but I won't go into them here - if you ever want to learn more googling the term QST is a good start, but of course you should also feel free to ask any questions on the stack exchange.

+",8141,,8141,,7/31/2020 21:02,7/31/2020 21:02,,,,0,,,,CC BY-SA 4.0 +13117,2,,13115,7/31/2020 9:25,,0,,"

1. Calculating $\langle \sigma_z \otimes \sigma_z \rangle$

+

$$\langle \sigma_z \otimes \sigma_z \rangle = Tr\big(\sigma_z \otimes \sigma_z \rho\big) = \rho_{11} - \rho_{22} - \rho_{33} + \rho_{44}$$

+

As can be seen from this answer $\rho_{11}$, $\rho_{22}$, $\rho_{33}$ and $\rho_{44}$ are the probabilities of measuring $|00\rangle$, $|01\rangle$, $|10\rangle$ and $|11\rangle$ correspondingly. This can be seen for example by calculating $Tr(P_{01} \rho) = \rho_{22}$, where $P_{01} = |01\rangle \langle 01|$ is the projector for the $|01\rangle$. Note, that $\rho_{11}$, $\rho_{22}$, $\rho_{33}$ and $\rho_{44}$ can be calculated from repeated experiments by applying $\sigma_z$ basis measurements (also it is described in this answer).

+

2. Calculating $\langle \sigma_x \otimes \sigma_x \rangle$

+

$$\langle \sigma_x \otimes \sigma_x \rangle = Tr\big(\sigma_x \otimes \sigma_x \rho\big) = Tr\big((H \otimes H) \; \sigma_z \otimes \sigma_z \; (H \otimes H) \; \rho\big) = +\\ += Tr\big( \sigma_z \otimes \sigma_z \; (H \otimes H) \; \rho \; (H \otimes H) \big) = Tr\big( \sigma_z \otimes \sigma_z \; \rho'\big) = \rho'_{11} - \rho'_{22} - \rho'_{33} + \rho'_{44}$$

+

Because $H\sigma_z H = \sigma_x$ and the cyclic property of the trace. Here $\rho' = H \otimes H \; \rho \; H \otimes H$. So, after applying $H\otimes H$ the the initial $\rho$ we just need to calculate $Tr\big( \sigma_z \otimes \sigma_z \; \rho'\big)$ that we already know how to do.

+

3. Calculating $\langle \sigma_y \otimes \sigma_y \rangle$

+

The same works, but instead of $H$, we take $H S^{\dagger}$:

+

$$ +\langle \sigma_y \otimes \sigma_y \rangle = Tr\big( \sigma_z \otimes \sigma_z \; \rho''\big) = \rho''_{11} - \rho''_{22} - \rho''_{33} + \rho''_{44} +$$

+

where $\rho'' = \big(HS^{\dagger} \otimes HS^{\dagger} \big) \; \rho \; \big(SH \otimes SH \big)$, because $SH\sigma_z HS^\dagger = \sigma_y$ as can be seen from this answer.

+
+

In a slightly different way, the same logic works for the other Pauli terms (we just need to apply such gates, after which we will have either $\sigma_z$ or $I$ in the trace). But of course, if we can measure also in $\sigma_x$ and $\sigma_y$ basis directly the gates before the measurements will be unnecessary. As was pointed out in this answer we should calculate all $16$ Pauli terms in order to estimate the density matrix (the mentioned three are not enough).

+
+

It is possible to combine measurements for $\langle \sigma_y \otimes \sigma_y \rangle$ and $\langle \sigma_x \otimes \sigma_x \rangle$, by measuring in Bell basis as was discussed in this question.

+",9459,,9459,,7/31/2020 9:47,7/31/2020 9:47,,,,6,,,,CC BY-SA 4.0 +13119,1,,,7/31/2020 12:28,,1,116,"

Consider the following unitary defined for a system $A$ interacting with a bipartite system $BB^\prime$

+

$$U_{AB} = \Big[|0\rangle \langle 0|_{A} \otimes \mathbf{I}_{B} + |1\rangle \langle 1|_{A} \otimes \big(|1\rangle \langle 0|_{B} + |0\rangle \langle 1|_{B} \big) \Big] \otimes \mathbf{I}_{B^\prime},$$ with +$\mathbf{I}_i$ being the identity.

+

My question:

+
    +
  1. What is the physical meaning of operation $U_{AB}$?

    +
  2. +
  3. Can one represent $U_{AB}$ in terms of quantum logic gates ( a circuit diagram)?

    +
  4. +
+",8290,,55,,8/1/2020 18:36,8/1/2020 18:36,What does the unitary $[|0\rangle\langle 0|\otimes I+|1\rangle\langle1|\otimes(|1\rangle\langle 0|+|0\rangle\langle1|)]\otimes I$ represent?,,1,2,,,,CC BY-SA 4.0 +13120,2,,13068,7/31/2020 12:40,,1,,"

I am no longer confused about this, since now I see in this equation we are already restricting to a subspace $||S\mathcal{E}(|u\rangle\langle u|)-S\mathcal{E}(|v\rangle\langle v|)|| = |||u\rangle\langle u|-|v\rangle\langle v|||$, and the contracting map has to contract every subspace.

+",12047,,,,,7/31/2020 12:40,,,,0,,,,CC BY-SA 4.0 +13121,1,13125,,7/31/2020 14:19,,0,101,"

I'm looking for a way to test graph state verification protocols on the IBM Q. Has anyone yet written code to generate a graph state on IBM Q and also generate its stabilizer generators given the adjacency matrix of the graph as input?

+",5705,,55,,8/1/2020 10:45,8/1/2020 10:45,Does Qiskit offer a stack of functions to generate and manipulate graph states?,,1,0,,,,CC BY-SA 4.0 +13123,1,13149,,7/31/2020 16:35,,2,114,"

Given a composite system with $N$ qubits represented by some $2^N$-dimensional vector, how would I get the quantum state of an individual qubit?

+

Note that I understand some states are not separable given quantum entanglement. My question is whether there is a set of steps, an algorithm, for generally determining whether a qubit's state is separable, and then getting the state itself if it is separable.

+

The wikipedia entry provides a somewhat brief answer to this question but doesn't expand on the general case for separating quantum states.

+",12723,,55,,8/3/2020 10:18,8/3/2020 10:18,How to get the state of an individual qubit in a composite system?,,1,3,,,,CC BY-SA 4.0 +13124,1,13128,,7/31/2020 17:32,,2,249,"

Let's imagine we have an arbitrary 1-qubit quantum system $\alpha \vert 0 \rangle + \beta \vert 1 \rangle$ Making a measurement in the +/- basis is equivalent to performing a Hadamard gate and then making a measurement in the standard computational basis.

+

Can we extend this notion generally for measurement of an arbitrary 1-qubit state in any arbitrary orientation? So, if we want to make a measurement of an arbitrary 1-qubit quantum state in some arbitrary orientation in the 2-dimensional Bloch sphere, can we perform some unitary transformation $U$ (supposing such $U$ can be composed theoretically) that transforms the basis state into orthonormal states of that orientation and then perform a measurement in the computational basis?

+

Let's say we have unitary transformation $U$ that maps $\vert 0 \rangle$ to $\vert a \rangle$ and $\vert 1 \rangle $ to $\vert b \rangle$ with $\langle a \vert b \rangle = 0$ (where $\vert a \rangle$ and $\vert b \rangle$ have certain orientation with respect to the standard basis states) the same way $H$ transforms $\vert 0 \rangle$ to $\vert + \rangle$ +and $\vert 1 \rangle $ to $\vert - \rangle$ state. One difference could be that $H$ is Hermitian too while $U$ may not be. +Another sub question is whether $U$ needs to be Hermitian also to make this generalization.

+",12826,,12826,,8/1/2020 5:01,8/1/2020 5:46,How do we perform a measurement of an arbitrary 1-qubit quantum state in any arbitrary orientation?,,1,4,,,,CC BY-SA 4.0 +13125,2,,13121,7/31/2020 18:33,,0,,"

There is a Graph State circuit available on IBM Qiskit. Graph state preparation circuits are Clifford circuits, and thus easy to simulate classically. However, by adding a layer of measurements in a product basis at the end, there is evidence that the circuit becomes hard to simulate. The circuit prepares a graph state with the given adjacency matrix. Given a graph G = (V, E), with the set of vertices V and the set of edges E, the corresponding graph state is defined as the following

+
|𝐺⟩ = ∏(𝑎,𝑏)∈𝐸𝐶𝑍(𝑎,𝑏)|+⟩⊗𝑉
+
+

Such a state can be prepared by first preparing all qubits in the + state, then applying a 𝐶𝑍 gate for each corresponding graph edge. The reference circuit is depicted in the IBM Qiskit library as below. Please find all the details of the Graph State circuit attributes and functions in the following link in the IBM Qiskit library.

+

+",4501,,,,,7/31/2020 18:33,,,,0,,,,CC BY-SA 4.0 +13126,1,,,7/31/2020 19:08,,3,185,"

The principle of the three-qubit Bit Flip Code is straight forward at first sight. Using CNOT you basically encode

+

$$a|0\rangle + b|1\rangle $$

+

to

+

$$ a|000\rangle + b|111\rangle$$

+

using entanglement. Now we assume that noise flips one of the qubits so that the state becomes

+

$$ a|100\rangle + b|011\rangle.$$

+

Since the three bits are entangled, I was wondering why the first bit can flip by noise without any impact on the other two bits (assuming a higher probability for one bit to flip than two or three). +In the case of decoherence, I would assume that the first bit would not be entangled to the other two bits anymore due to noise.

+",12828,,55,,8/3/2020 12:11,8/3/2020 12:33,"In the three-qubit bit flip code, why can the first bit flip without impacting the entanglement with the other qubits?",,3,1,,,,CC BY-SA 4.0 +13127,2,,13111,7/31/2020 22:46,,3,,"

I'm unsure of this exact protocol you're referring to, but if you're interested in the "cost" or reliability of teleportation , then I have some information pertaining to the original setup.

+

Teleportation is a protocol that uses local operations and classical communications to teleport a state $\rho_{\text{in}}$ from Alice (A) to Bob (B) who share an entangled resource state $\sigma_{AB}$ (typically a Bell state $|{\Phi}\rangle$). +Alice performs a Bell measurement on her input state $\rho_{\text{in}}$ and her half of the resource state, the result of which is classically communicated to Bob. They then exploit their shared correlations to deduce a corrective unitary in order to transform Bob's half of the resource into $\rho_{\text{out}} \approx \rho_{\text{in}}$.

+

During this protocol, quantum data is not transmitted - only classical information about Alice's Bell measurement. Therefore the distance between parties only impacts the quality of the classical communication between the two parties, which we can typically assume is ideal (see here for the interesting impact of imperfect classical communications on teleportation).

+

What crucially impacts the performance of teleportation is the quality of the entanglement between Alice and Bob. The ideal resource state is maximally entangled in order to optimise the accuracy of Bob's corrective unitary. In this +ideal scenario one can think of teleportation as a simulation of transmission of an input state through an identity channel $ +\rho_{\text{out}} = \mathcal{I}(\rho_{\text{in}}) = \rho_{\text{in}}. +$ +But if the resource state entanglement is sub-maximal, it introduces error on this operation. Instead, we simulate some non-identity, decohering channel +$ +\rho_{\text{out}} = \mathcal{E}(\rho_{\text{in}}) \neq \rho_{\text{in}}. +$ +Therefore one can quantify the performance of a teleportation protocol based on the entanglement properties of the resource state.

+

Similar theory could be derived for multi-qudit teleportation schemes, since these are based on the original two qudit scheme. Then indeed, in a multi-qudit scenario, one can imagine that it is indeed harder to guarantee a high degree of entanglement across larger entangled resource states, subsequently reducing the protocol's reliability.

+

These ideas have some really cool applications in quantum channel capacities, metrology and channel discrimination, and see this paper for some better insight.

+",9839,,,,,7/31/2020 22:46,,,,0,,,,CC BY-SA 4.0 +13128,2,,13124,8/1/2020 1:36,,4,,"

Yes, this observation can be generalized. To start with, let's notice why is Hadamard the transformation required to measure a state $| \psi \rangle$ in the $\sigma_{x}$ basis. This is because it is the ``unitary intertwiner'' connecting the $\sigma_{x}$ basis to the $\sigma_{z}$ basis (a.k.a. computational basis). Recall that the $\sigma_{x}$ eigenvectors are $\{ | + \rangle, | - \rangle \}$ and the $\sigma_{z}$ eigenvectors are $\{ | 0 \rangle, | 1 \rangle \}$. The unitary operator connecting these basis is: +$$ \mathcal{U}_{\sigma_{x} \rightarrow \sigma_{z}} = | 0 \rangle \langle + | + | 1 \rangle \langle - | = H. $$

+

Let's take a moment to interpret the action of this intertwiner: when it acts on the $| + \rangle$ state, it sends it to the $| 0 \rangle$ state and when it acts on the $| - \rangle$ state, it sends it to the $| 1 \rangle$ state, thereby connecting the basis elements (and by linearity, any other vector expressed in these bases). Therefore, measuring $| \psi \rangle$ in the $\sigma_{z}$ basis is the same as applying $\mathcal{U}_{\sigma_{x} \rightarrow \sigma_{z}}$ and then measuring in the $\sigma_{z}$ basis.

+

For connecting to an arbitrary basis, we simply replace $\{ | \pm \rangle \}$ with the new basis vectors, say $ \mathbb{B} = \{ | \phi_{+} \rangle, | \phi_{-} \rangle \}$, giving us, +$$ \mathcal{U}_{\mathbb{B} \rightarrow \sigma_{z}} = | 0 \rangle \langle \phi_{+} | + | 1 \rangle \langle \phi_{-} | $$

+

In the most general case, where you want to connect a basis $\mathbb{B}_{0} = \{ \phi_{j} \}$ with $\mathbb{B}_{1} = \{ \chi_{j} \}$, the intertwiner is defined as, +$$ \mathcal{U}_{\mathbb{B}_{0} \rightarrow \mathbb{B}_{1}} = \sum\limits_{j=1}^{d} | \chi_{j} \rangle \langle \phi_{j} | . $$

+

Update: No, the unitary doesn't need to be hermitian as well, it just so happens in the specific case because we're dealing with Pauli matrices, which are both unitary and hermitian. Given any two bases, there always exists a unitary connecting them (that is essentially what I construct above).

+",1108,,1108,,8/1/2020 5:46,8/1/2020 5:46,,,,2,,,,CC BY-SA 4.0 +13129,2,,13126,8/1/2020 1:55,,1,,"

We're trying to build a code to protect against single bit flips. That is, we are assuming the noise model. By assumption, it has the form $\sigma_x \otimes \mathbb{I} \otimes \mathbb{I}$, therefore, it only flips one of them. Of course, in general, the noise does whatever it wants, and therefore, we need to build codes that can protect against more general kinds of noise -- which we know how to (for example ones that protect against phase flips, combining which with bit flip code, we can protect against any single-qubit noise).

+

Once the noise model is assumed, its action on a single qubit is simply from the linearity and the tensor-product structure of the noise.

+",1108,,,,,8/1/2020 1:55,,,,0,,,,CC BY-SA 4.0 +13130,1,,,8/1/2020 2:07,,2,111,"

I'm running some simulator circuit on my computer, and I see that (using 3 qubits, and thousands of classical registers), the max cap seems to be about qc.depth() slightly less than 150000 before the kernel crash into oblivion (with or without optimization_level = 3, so I don't think that helps). I have plenty of RAM left and I don't see them filling up, and the circuits always only take a few seconds to run since I only do 1 shot so I doubt if it's a CPU problem. What is the cause of this, and is there any way to be able to run at higher depth? Thanks!

+",7598,,55,,8/18/2020 8:42,8/18/2020 8:42,What is the maximum circuit depth for Qiskit Aer Simulator?,,0,0,,,,CC BY-SA 4.0 +13131,1,13243,,8/1/2020 3:40,,3,790,"

Could anyone please explain how do I do state tomography when using sampling (on real device or QASM) in Qiskit? I know there's a special method for this, but I could not find a working example.

+

More precisely, I would be interested in two cases: when the full state tomography is performed (all the $2^n$ amplitudes are measured) and when it's known apriori that the wave function has support in a certain subspace (say, only $|10\rangle$ and $|01\rangle$ for a two-qubit system).

+

BTW, is $3^n$ a lower bound on the number of operators which have to be measured in order to perform the state tomography? ($X$, $Y$, $Z$ for each qubit.)

+",6313,,55,,8/3/2020 12:14,8/10/2020 20:58,How to do state tomography when using sampling in Qiskit?,,1,2,,,,CC BY-SA 4.0 +13132,1,13135,,8/1/2020 4:42,,6,1552,"

In general, is there any way to implement a controlled version of an arbitrary gate U if we are given only CNOT and U gate?

+",12826,,55,,8/3/2020 12:17,8/3/2020 12:17,"How can we implement controlled-T gate using CNOT and H, S and T gates?",,3,1,,,,CC BY-SA 4.0 +13133,2,,13132,8/1/2020 7:35,,3,,"

We can implement $CT$ using the following circuit:

+

+

This solutions uses an extra gate which isn't available above $R_I(\pi/8) = \sqrt{T}$

+

Explanation:

+

We know that $T = \sqrt{S} = Z^{\frac{1}{4}}$. +Since $S,T,Z$ are all diagonal matrices hence their controlled versions will also be diagonal matrices $CZ,CS,CT$. Thus $CT=CZ^{\frac{1}{4}}$.

+

If we can implement the fourth root of $CZ$ using the above gates we will have a $Controlled-T$ gate.

+

We can implement a Controlled $Z$ gate using $CNOT$ and $H$ gates +$$CZ = |0\rangle\langle 0|\otimes I + |1\rangle\langle 1|\otimes Z \\ += |0\rangle\langle 0|\otimes HIH + |1\rangle\langle 1|\otimes HXH \\ += (I\otimes H)(|0\rangle\langle 0|\otimes I + |1\rangle\langle 1|\otimes X)(I\otimes H)\\ += (I\otimes H)CNOT(I\otimes H)$$

+

We can implement $CNOT^{2t}$ gates using the circuit show in Craig Gidney's Answer +

+

We need $CNOT^{1/4}$ hence $t=\frac{1}{8}$. This requires $Z^{\frac{1}{8}}$ i.e $R_{I}(\pi/8)$ and its Adjoint gate.

+

Let $U = (I\otimes H)CNOT^{\frac{1}{4}}(I\otimes H)$, then +$$U^4= UUUU \\ += (I\otimes H)CNOT^{\frac{1}{4}}(I\otimes H) \times (I\otimes H)CNOT^{\frac{1}{4}}(I\otimes H) \times (I\otimes H)CNOT^{\frac{1}{4}}(I\otimes H) \times (I\otimes H)CNOT^{\frac{1}{4}}(I\otimes H) \\ += (I\otimes H)CNOT^{\frac{1}{4}}CNOT^{\frac{1}{4}}CNOT^{\frac{1}{4}}CNOT^{\frac{1}{4}}(I\otimes H) \\ += (I\otimes H)CNOT(I\otimes H) \\ += CZ$$ +Thus $U = CZ^{\frac{1}{4}} = CT$

+

In general for implementing $Controlled-Z^{\frac{1}{2^n}}$ gate we would need $H$, $CNOT$ and $Z^{\frac{1}{2^{n+1}}}$(along with its adjoint version) gate.

+",8757,,8757,,8/1/2020 7:59,8/1/2020 7:59,,,,0,,,,CC BY-SA 4.0 +13134,2,,13132,8/1/2020 7:50,,2,,"

In general you need more than $U$ and CNOT to implement a controlled-$U$. One approach to constructing a controlled-$U$ gate, for arbitrary $U \in \mathbf{U}(2)$, from single qubit and CNOT gates begins by parameterizing $U$ in terms of $U(\alpha,\beta,\gamma,\delta)$ according to +$$U = e^{i\alpha}\begin{bmatrix} \exp\left({-i\frac{\beta+\delta}{2}}\right)\cos \frac{\gamma}{2} & -\exp\left({-i\frac{\beta-\delta}{2}}\right)\sin \frac{\gamma}{2} \\ \exp\left({i \frac{\beta-\delta}{2}}\right)\sin \frac{\gamma}{2} & \exp\left({i\frac{\beta+\delta}{2}}\right)\cos \frac{\gamma}{2} \end{bmatrix}.$$

+

With this parameterization, $U$ can be decomposed in terms of the Pauli matrices $\sigma_x, \, \sigma_y, \, \sigma_z$ as

+

$$U=e^{i\alpha}A \, \sigma_x B \, \sigma_x C, \;\;\; A \equiv e^{-\frac{i}{2}\beta \sigma_z}e^{-\frac{i}{4}\gamma \sigma_y}$$ +$$B \equiv e^{\frac{i}{4}\gamma \sigma_y}e^{\frac{i}{4}(\beta+\delta) \sigma_z}, \;\;\; C\equiv e^{\frac{i}{4}(\beta-\delta) \sigma_z}.$$

+

The usefulness of this decomposition is that $U$ can be expressed as above, while $ABC=I$. Defining one additional gate $$D=\begin{bmatrix} 1 & 0 \\ 0 & e^{i \alpha} \end{bmatrix}$$ allows circuit implementation of an arbitrary controlled-$U$ using four single qubit gates and two CNOT gates as +

+

In the specific case noted in the title, $U=T$, the parameterization is $\alpha=\beta=\delta=\frac{\pi}{8}$, and $\gamma=0$. This gives $A=e^{-\frac{i \pi}{16} \sigma_z} \cong \sqrt{T} $, $B=e^{\frac{i \pi}{16} \sigma_z} \cong \sqrt{T^\dagger}$, $C=I$, $D=\sqrt{T}$ (where $\cong$ indicates equivalence up to global phase). It seems that you need access to $\sqrt{T}$ gates to implement the desired controlled-$T$.

+",8623,,8623,,8/1/2020 8:57,8/1/2020 8:57,,,,0,,,,CC BY-SA 4.0 +13135,2,,13132,8/1/2020 10:29,,2,,"

You can use Toffolis and an ancilla to remove the need for the control on the T, then decompose the Toffolis into T+H+CNOT. Since the second Toffoli is uncomputing the ancilla, it can be replaced by a measurement based uncomputation.

+

+",119,,,,,8/1/2020 10:29,,,,0,,,,CC BY-SA 4.0 +13138,2,,13119,8/1/2020 16:56,,1,,"

The gate/operator in the brackets is the non-local CNOT gate, frequently used to create bipartite entanglement. Given it itself is a 2 qubit gate, then the tensor of this with the identity is simply a gate that acts on 3 qubits.

+

This gate will take a 3 qubit state and flip the second qubit of this state when the first is $|1\rangle$ It will take $|110\rangle \to|100\rangle, |111\rangle \to |101\rangle$ and vice-versa.

+

Edit: important to note is that $|1\rangle\langle 0|+|0\rangle\langle 1|$ is the Pauli X gate

+",4991,,,,,8/1/2020 16:56,,,,2,,,,CC BY-SA 4.0 +13140,1,13191,,8/1/2020 17:48,,5,477,"

The inequality $\chi \le H(X)$ gives the upper bound on accessible information. +This much is clear to me. However, what isn't clear is how this tells me I cannot transmit more than $n$ bits of information.

+

I understand that if $\chi < H(X)$, then reliable in-ferment isn't possible, with the Fano inequality giving the lower bound for the chance of an error being made.

+

However, I've seen some examples state that $\chi\le n$ proves this, which I can only see being the case of $H(X)$ is maximum for each qubit. Do they mean that if $\chi = H(X)$ then given that this is all the information about one qubit, then for $n$ qubits, if $\chi=H(X)$ for all of them then $\chi =n$?

+

Is it taking the $H(X)$ as all the information of a single qubit/bit, regardless of its value, and as such if $\chi$ is equal to it, it is said to have access to all that information as well?

+

Edit: Maybe to make this clearer, I am asking where $n$ comes from if we take $\chi \le H(X)$, as in many cases $H(X)$ will not be maximum.

+",4991,,55,,8/27/2020 12:52,8/27/2020 12:52,How can the Holevo bound be used to show that $n$ qubits cannot transmit more than $n$ classical bits?,,1,3,,,,CC BY-SA 4.0 +13141,1,,,8/2/2020 0:12,,2,285,"

Termux has some issues with cmake, therefore qiskit-aer-0.5.2 installation returns error 1.

+
Collecting qiskit
+  Downloading qiskit-0.19.6.tar.gz (4.0 kB)
+Collecting qiskit-terra==0.14.2
+  Downloading qiskit-terra-0.14.2.tar.gz (6.3 MB)
+     |████████████████████████████████| 6.3 MB 110 kB/s
+Collecting qiskit-aer==0.5.2
+  Downloading qiskit-aer-0.5.2.tar.gz (10.3 MB)
+     |████████████████████████████████| 10.3 MB 60 kB/s
+    ERROR: Command errored out with exit status 1:
+     command: /data/data/com.termux/files/usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-install-891uqs3t/qiskit-aer/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-install-891uqs3t/qiskit-aer/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /data/data/com.termux/files/usr/tmp/pip-pip-egg-info-v59grdvz
+         cwd: /data/data/com.termux/files/usr/tmp/pip-install-891uqs3t/qiskit-aer/
+    Complete output (559 lines):
+      ERROR: Command errored out with exit status 1:
+       command: /data/data/com.termux/files/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/setup.py'"'"'; __file__='"'"'/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /data/data/com.termux/files/usr/tmp/pip-wheel-76sn2q3h
+           cwd: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/
+      Complete output (520 lines):
+
+
+      --------------------------------------------------------------------------------
+      -- Trying "Ninja" generator
+      --------------------------------
+      ---------------------------
+      ----------------------
+      -----------------
+      ------------
+      -------
+      --
+      Not searching for unused variables given on the command line.
+      CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
+      -- Configuring incomplete, errors occurred!
+      See also "/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
+      --
+      -------
+      ------------
+      -----------------
+      ----------------------
+      ---------------------------
+      --------------------------------
+      -- Trying "Ninja" generator - failure
+      --------------------------------------------------------------------------------
+
+
+
+      --------------------------------------------------------------------------------
+      -- Trying "Unix Makefiles" generator
+      --------------------------------
+      ---------------------------
+      ----------------------
+      -----------------
+      ------------
+      -------
+      --
+      Not searching for unused variables given on the command line.
+      -- The C compiler identification is Clang 10.0.1
+      -- Detecting C compiler ABI info
+      -- Detecting C compiler ABI info - done
+      -- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
+      -- Detecting C compile features
+      -- Detecting C compile features - done
+      -- The CXX compiler identification is Clang 10.0.1
+      -- Detecting CXX compiler ABI info
+      -- Detecting CXX compiler ABI info - done
+      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
+      -- Detecting CXX compile features
+      -- Detecting CXX compile features - done
+      -- Configuring done
+      -- Generating done
+      -- Build files have been written to: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_cmake_test_compile/build
+      --
+      -------
+      ------------
+      -----------------
+      ----------------------
+      ---------------------------
+      --------------------------------
+      -- Trying "Unix Makefiles" generator - success
+      --------------------------------------------------------------------------------
+
+      Configuring Project
+        Working directory:
+          /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build
+        Command:
+          cmake /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-install/cmake/data -DPYTHON_EXECUTABLE:FILEPATH=/data/data/com.termux/files/usr/bin/python3 -DPYTHON_VERSION_STRING:STRING=3.8.5 -DPYTHON_INCLUDE_DIR:PATH=/data/data/com.termux/files/usr/include/python3.8 -DPYTHON_LIBRARY:FILEPATH=/data/data/com.termux/files/usr/lib/libpython3.8.so -DSKBUILD:BOOL=TRUE -DCMAKE_MODULE_PATH:PATH=/data/data/com.termux/files/usr/lib/python3.8/site-packages/skbuild/resources/cmake -DCMAKE_BUILD_TYPE:STRING=Release
+
+      -- The CXX compiler identification is Clang 10.0.1
+      -- Detecting CXX compiler ABI info
+      -- Detecting CXX compiler ABI info - done
+      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
+      -- Detecting CXX compile features
+      -- Detecting CXX compile features - done
+      -- ***************************************************
+      -- Build CMake from source: ON
+      -- ***************************************************
+      -- SuperBuild - CMakeProject-src-download
+      -- SuperBuild - CMakeProject-src-download - URL: https://github.com/Kitware/CMake/releases/download/v3.18.0/cmake-3.18.0.tar.gz
+      -- SuperBuild - CMakeProject-src-download - CMakeProject_SOURCE_DIR: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/src
+      -- SuperBuild -   CMakeProject-build
+      -- SuperBuild -   CMakeProject-build - CMakeProject_BINARY_DIR: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build
+      -- SuperBuild -   CMakePythonDistributions
+      -- Configuring done
+      -- Generating done
+      CMake Warning:
+        Manually-specified variables were not used by the project:
+
+          PYTHON_EXECUTABLE
+          PYTHON_INCLUDE_DIR
+          PYTHON_LIBRARY
+          PYTHON_VERSION_STRING
+          SKBUILD
+
+
+      -- Build files have been written to: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build
+      Scanning dependencies of target CMakeProject-src-download
+      [  3%] Creating directories for 'CMakeProject-src-download'
+      [  6%] Performing download step (download, verify and extract) for 'CMakeProject-src-download'
+      -- Downloading...
+         dst='/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/cmake-3.18.0.tar.gz'
+         timeout='none'
+      -- Using src='https://github.com/Kitware/CMake/releases/download/v3.18.0/cmake-3.18.0.tar.gz'
+      -- [download 0% complete]
+      -- [download 100% complete]
+      -- [download 0% complete]
+      -- [download 1% complete]
+...
+      -- [download 100% complete]
+      -- verifying file...
+             file='/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/cmake-3.18.0.tar.gz'
+      -- Downloading... done
+      -- extracting...
+           src='/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/cmake-3.18.0.tar.gz'
+           dst='/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/src'
+      -- extracting... [tar xfz]
+      -- extracting... [analysis]
+      -- extracting... [rename]
+      -- extracting... [clean up]
+      -- extracting... done
+      [  9%] No update step for 'CMakeProject-src-download'
+      [ 12%] No patch step for 'CMakeProject-src-download'
+      [ 15%] No configure step for 'CMakeProject-src-download'
+      [ 18%] No build step for 'CMakeProject-src-download'
+      [ 21%] No install step for 'CMakeProject-src-download'
+      [ 24%] Completed 'CMakeProject-src-download'
+      [ 24%] Built target CMakeProject-src-download
+      Scanning dependencies of target LibUV
+      [ 27%] Creating directories for 'LibUV'
+      [ 30%] Performing download step (download, verify and extract) for 'LibUV'
+      -- Downloading...
+         dst='/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-prefix/src/libuv-v1.23.0.tar.gz'
+         timeout='none'
+      -- Using src='https://dist.libuv.org/dist/v1.23.0/libuv-v1.23.0.tar.gz'
+      -- [download 0% complete]
+      -- [download 1% complete]
+....
+      -- [download 98% complete]
+      -- [download 100% complete]
+      -- verifying file...
+             file='/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-prefix/src/libuv-v1.23.0.tar.gz'
+      -- Downloading... done
+      -- extracting...
+           src='/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-prefix/src/libuv-v1.23.0.tar.gz'
+           dst='/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-src'
+      -- extracting... [tar xfz]
+      -- extracting... [analysis]
+      -- extracting... [rename]
+      -- extracting... [clean up]
+      -- extracting... done
+      [ 33%] No update step for 'LibUV'
+      [ 36%] No patch step for 'LibUV'
+      [ 39%] Performing configure step for 'LibUV'
+      loading initial cache file /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/initial-cache.txt
+      loading initial cache file /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-prefix/tmp/LibUV-cache-Release.cmake
+      -- The C compiler identification is Clang 10.0.1
+      -- The CXX compiler identification is Clang 10.0.1
+      -- Detecting C compiler ABI info
+      -- Detecting C compiler ABI info - done
+      -- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
+      -- Detecting C compile features
+      -- Detecting C compile features - done
+      -- Detecting CXX compiler ABI info
+      -- Detecting CXX compiler ABI info - done
+      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
+      -- Detecting CXX compile features
+      -- Detecting CXX compile features - done
+      -- Configuring done
+      -- Generating done
+      -- Build files have been written to: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-build
+      [ 42%] Performing build step for 'LibUV'
+      Scanning dependencies of target uv
+      [  1%] Building C object CMakeFiles/uv.dir/src/fs-poll.c.o
+      [  2%] Building C object CMakeFiles/uv.dir/src/inet.c.o
+      [  4%] Building C object CMakeFiles/uv.dir/src/threadpool.c.o
+      [  5%] Building C object CMakeFiles/uv.dir/src/timer.c.o
+      [  7%] Building C object CMakeFiles/uv.dir/src/uv-common.c.o
+      [  8%] Building C object CMakeFiles/uv.dir/src/uv-data-getter-setters.c.o
+      [ 10%] Building C object CMakeFiles/uv.dir/src/version.c.o
+      [ 11%] Building C object CMakeFiles/uv.dir/src/unix/async.c.o
+      [ 13%] Building C object CMakeFiles/uv.dir/src/unix/core.c.o
+      [ 14%] Building C object CMakeFiles/uv.dir/src/unix/dl.c.o
+      [ 16%] Building C object CMakeFiles/uv.dir/src/unix/fs.c.o
+      [ 17%] Building C object CMakeFiles/uv.dir/src/unix/getaddrinfo.c.o
+      [ 19%] Building C object CMakeFiles/uv.dir/src/unix/getnameinfo.c.o
+      [ 20%] Building C object CMakeFiles/uv.dir/src/unix/loop-watcher.c.o
+      [ 22%] Building C object CMakeFiles/uv.dir/src/unix/loop.c.o
+      [ 23%] Building C object CMakeFiles/uv.dir/src/unix/pipe.c.o
+      /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-src/src/unix/pipe.c:252:15: warning: comparison of integers of different signs: 'socklen_t' (aka 'int') and 'size_t' (aka 'unsigned int') [-Wsign-compare]
+        if (addrlen >= *size) {
+            ~~~~~~~ ^  ~~~~~
+      1 warning generated.
+      [ 25%] Building C object CMakeFiles/uv.dir/src/unix/poll.c.o
+      [ 26%] Building C object CMakeFiles/uv.dir/src/unix/process.c.o
+      [ 27%] Building C object CMakeFiles/uv.dir/src/unix/signal.c.o
+      [ 29%] Building C object CMakeFiles/uv.dir/src/unix/stream.c.o
+      [ 30%] Building C object CMakeFiles/uv.dir/src/unix/tcp.c.o
+      [ 32%] Building C object CMakeFiles/uv.dir/src/unix/thread.c.o
+      [ 33%] Building C object CMakeFiles/uv.dir/src/unix/tty.c.o
+      [ 35%] Building C object CMakeFiles/uv.dir/src/unix/udp.c.o
+      [ 36%] Building C object CMakeFiles/uv.dir/src/unix/android-ifaddrs.c.o
+      [ 38%] Building C object CMakeFiles/uv.dir/src/unix/linux-core.c.o
+      [ 39%] Building C object CMakeFiles/uv.dir/src/unix/linux-inotify.c.o
+      [ 41%] Building C object CMakeFiles/uv.dir/src/unix/linux-syscalls.c.o
+      [ 42%] Building C object CMakeFiles/uv.dir/src/unix/procfs-exepath.c.o
+      [ 44%] Building C object CMakeFiles/uv.dir/src/unix/pthread-fixes.c.o
+      [ 45%] Building C object CMakeFiles/uv.dir/src/unix/sysinfo-loadavg.c.o
+      [ 47%] Building C object CMakeFiles/uv.dir/src/unix/sysinfo-memory.c.o
+      [ 48%] Building C object CMakeFiles/uv.dir/src/unix/proctitle.c.o
+      [ 50%] Linking C shared library libuv.so
+      [ 50%] Built target uv
+      Scanning dependencies of target uv_a
+      [ 51%] Building C object CMakeFiles/uv_a.dir/src/fs-poll.c.o
+      [ 52%] Building C object CMakeFiles/uv_a.dir/src/inet.c.o
+      [ 54%] Building C object CMakeFiles/uv_a.dir/src/threadpool.c.o
+      [ 55%] Building C object CMakeFiles/uv_a.dir/src/timer.c.o
+      [ 57%] Building C object CMakeFiles/uv_a.dir/src/uv-common.c.o
+      [ 58%] Building C object CMakeFiles/uv_a.dir/src/uv-data-getter-setters.c.o
+      [ 60%] Building C object CMakeFiles/uv_a.dir/src/version.c.o
+      [ 61%] Building C object CMakeFiles/uv_a.dir/src/unix/async.c.o
+      [ 63%] Building C object CMakeFiles/uv_a.dir/src/unix/core.c.o
+      [ 64%] Building C object CMakeFiles/uv_a.dir/src/unix/dl.c.o
+      [ 66%] Building C object CMakeFiles/uv_a.dir/src/unix/fs.c.o
+      [ 67%] Building C object CMakeFiles/uv_a.dir/src/unix/getaddrinfo.c.o
+      [ 69%] Building C object CMakeFiles/uv_a.dir/src/unix/getnameinfo.c.o
+      [ 70%] Building C object CMakeFiles/uv_a.dir/src/unix/loop-watcher.c.o
+      [ 72%] Building C object CMakeFiles/uv_a.dir/src/unix/loop.c.o
+      [ 73%] Building C object CMakeFiles/uv_a.dir/src/unix/pipe.c.o
+      /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-src/src/unix/pipe.c:252:15: warning: comparison of integers of different signs: 'socklen_t' (aka 'int') and 'size_t' (aka 'unsigned int') [-Wsign-compare]
+        if (addrlen >= *size) {
+            ~~~~~~~ ^  ~~~~~
+      1 warning generated.
+      [ 75%] Building C object CMakeFiles/uv_a.dir/src/unix/poll.c.o
+      [ 76%] Building C object CMakeFiles/uv_a.dir/src/unix/process.c.o
+      [ 77%] Building C object CMakeFiles/uv_a.dir/src/unix/signal.c.o
+      [ 79%] Building C object CMakeFiles/uv_a.dir/src/unix/stream.c.o
+      [ 80%] Building C object CMakeFiles/uv_a.dir/src/unix/tcp.c.o
+      [ 82%] Building C object CMakeFiles/uv_a.dir/src/unix/thread.c.o
+      [ 83%] Building C object CMakeFiles/uv_a.dir/src/unix/tty.c.o
+      [ 85%] Building C object CMakeFiles/uv_a.dir/src/unix/udp.c.o
+      [ 86%] Building C object CMakeFiles/uv_a.dir/src/unix/android-ifaddrs.c.o
+      [ 88%] Building C object CMakeFiles/uv_a.dir/src/unix/linux-core.c.o
+      [ 89%] Building C object CMakeFiles/uv_a.dir/src/unix/linux-inotify.c.o
+      [ 91%] Building C object CMakeFiles/uv_a.dir/src/unix/linux-syscalls.c.o
+      [ 92%] Building C object CMakeFiles/uv_a.dir/src/unix/procfs-exepath.c.o
+      [ 94%] Building C object CMakeFiles/uv_a.dir/src/unix/pthread-fixes.c.o
+      [ 95%] Building C object CMakeFiles/uv_a.dir/src/unix/sysinfo-loadavg.c.o
+      [ 97%] Building C object CMakeFiles/uv_a.dir/src/unix/sysinfo-memory.c.o
+      [ 98%] Building C object CMakeFiles/uv_a.dir/src/unix/proctitle.c.o
+      [100%] Linking C static library libuv_a.a
+      [100%] Built target uv_a
+      [ 45%] Performing install step for 'LibUV'
+      [ 50%] Built target uv
+      [100%] Built target uv_a
+      Install the project...
+      -- Install configuration: "Release"
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/os390.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/android-ifaddrs.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/tree.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/darwin.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/pthread-barrier.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/version.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/unix.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/errno.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/linux.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/aix.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/stdint-msvc2008.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/bsd.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/sunos.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/threadpool.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/posix.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/include/uv/win.h
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/share/doc/libuv/LICENSE
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/lib/pkgconfig/LICENSE
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/lib/pkgconfig/libuv.pc
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/lib/libuv.so
+      -- Installing: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/LibUV-install/lib/libuv_a.a
+      [ 48%] Completed 'LibUV'
+      [ 48%] Built target LibUV
+      Scanning dependencies of target CMakeProject-build
+      [ 51%] Creating directories for 'CMakeProject-build'
+      [ 54%] No download step for 'CMakeProject-build'
+      [ 57%] No update step for 'CMakeProject-build'
+      [ 60%] No patch step for 'CMakeProject-build'
+      [ 63%] Performing configure step for 'CMakeProject-build'
+      loading initial cache file /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/initial-cache.txt
+      loading initial cache file /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build-prefix/tmp/CMakeProject-build-cache-Release.cmake
+      -- The C compiler identification is Clang 10.0.1
+      -- The CXX compiler identification is Clang 10.0.1
+      -- Detecting C compiler ABI info
+      -- Detecting C compiler ABI info - done
+      -- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
+      -- Detecting C compile features
+      -- Detecting C compile features - done
+      -- Detecting CXX compiler ABI info
+      -- Detecting CXX compiler ABI info - failed
+      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++
+      -- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - broken
+      CMake Error at /data/data/com.termux/files/usr/share/cmake-3.18/Modules/CMakeTestCXXCompiler.cmake:59 (message):
+        The C++ compiler
+
+          "/data/data/com.termux/files/usr/bin/c++"
+
+        is not able to compile a simple test program.
+
+        It fails with the following output:
+
+          Change Dir: /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build/CMakeFiles/CMakeTmp
+
+          Run Build Command(s):/data/data/com.termux/files/usr/bin/make cmTC_793bc/fast && make[3]: Entering directory '/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build/CMakeFiles/CMakeTmp'
+          /data/data/com.termux/files/usr/bin/make  -f CMakeFiles/cmTC_793bc.dir/build.make CMakeFiles/cmTC_793bc.dir/build
+          make[4]: Entering directory '/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build/CMakeFiles/CMakeTmp'
+          Building CXX object CMakeFiles/cmTC_793bc.dir/testCXXCompiler.cxx.o
+          /data/data/com.termux/files/usr/bin/c++   -g -o CMakeFiles/cmTC_793bc.dir/testCXXCompiler.cxx.o -c /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
+          Linking CXX executable cmTC_793bc
+          /data/data/com.termux/files/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_793bc.dir/link.txt --verbose=1
+          /data/data/com.termux/files/usr/bin/c++ -g -static-libstdc++ -static-libgcc -lrt  CMakeFiles/cmTC_793bc.dir/testCXXCompiler.cxx.o -o cmTC_793bc
+          /data/data/com.termux/files/usr/bin/arm-linux-androideabi-ld: cannot find -lc++_shared
+          clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
+          make[4]: *** [CMakeFiles/cmTC_793bc.dir/build.make:106: cmTC_793bc] Error 1
+          make[4]: Leaving directory '/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build/CMakeFiles/CMakeTmp'
+          make[3]: *** [Makefile:140: cmTC_793bc/fast] Error 2
+          make[3]: Leaving directory '/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build/CMakeFiles/CMakeTmp'
+
+
+
+
+
+        CMake will not be able to correctly generate this project.
+      Call Stack (most recent call first):
+        CMakeLists.txt:7 (project)
+
+
+      -- Configuring incomplete, errors occurred!
+      See also "/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build/CMakeFiles/CMakeOutput.log".
+      See also "/data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build/CMakeProject-build/CMakeFiles/CMakeError.log".
+      make[2]: *** [CMakeFiles/CMakeProject-build.dir/build.make:131: CMakeProject-build-prefix/src/CMakeProject-build-stamp/CMakeProject-build-configure] Error 1
+      make[1]: *** [CMakeFiles/Makefile2:130: CMakeFiles/CMakeProject-build.dir/all] Error 2
+      make: *** [Makefile:149: all] Error 2
+      Traceback (most recent call last):
+        File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 589, in setup
+          cmkr.make(make_args, env=env)
+        File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/skbuild/cmaker.py", line 496, in make
+          raise SKBuildError(
+
+      An error occurred while building with CMake.
+        Command:
+          cmake --build . --target install --config Release --
+        Source directory:
+          /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake
+        Working directory:
+          /data/data/com.termux/files/usr/tmp/pip-wheel-3e9istkf/cmake/_skbuild/linux-armv8l-3.8/cmake-build
+      Please see CMake's output for more information.
+      ----------------------------------------
+      ERROR: Failed building wheel for cmake
+    ERROR: Failed to build one or more wheels
+    Traceback (most recent call last):
+      File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
+        subprocess.check_call(cmd)
+      File "/data/data/com.termux/files/usr/lib/python3.8/subprocess.py", line 364, in check_call
+        raise CalledProcessError(retcode, cmd)
+    subprocess.CalledProcessError: Command '['/data/data/com.termux/files/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/data/data/com.termux/files/usr/tmp/tmp1hbw_d_z', '--quiet', 'cmake!=3.17,!=3.17.0']' returned non-zero exit status 1.
+
+    During handling of the above exception, another exception occurred:
+
+    Traceback (most recent call last):
+      File "<string>", line 1, in <module>
+      File "/data/data/com.termux/files/usr/tmp/pip-install-891uqs3t/qiskit-aer/setup.py", line 56, in <module>
+        setup(
+      File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/skbuild/setuptools_wrap.py", line 468, in setup
+        return upstream_setup(*args, **kw)
+      File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/setuptools/__init__.py", line 143, in setup
+        _install_setup_requires(attrs)
+      File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/setuptools/__init__.py", line 138, in _install_setup_requires
+        dist.fetch_build_eggs(dist.setup_requires)
+      File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/setuptools/dist.py", line 695, in fetch_build_eggs
+        resolved_dists = pkg_resources.working_set.resolve(
+      File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 781, in resolve
+        dist = best[req.key] = env.best_match(
+      File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1066, in best_match
+        return self.obtain(req, installer)
+      File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1078, in obtain
+        return installer(requirement)
+      File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/setuptools/dist.py", line 754, in fetch_build_egg
+        return fetch_build_egg(self, req)
+      File "/data/data/com.termux/files/usr/lib/python3.8/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
+        raise DistutilsError(str(e))
+    distutils.errors.DistutilsError: Command '['/data/data/com.termux/files/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/data/data/com.termux/files/usr/tmp/tmp1hbw_d_z', '--quiet', 'cmake!=3.17,!=3.17.0']' returned non-zero exit status 1.
+    ----------------------------------------
+ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
+
+
+

Is there any way how to get Qiskit running on my mobile?

+",12832,,55,,8/2/2020 7:39,8/2/2020 7:39,Problem with installing Qiskit on Android with Termux emulator,,0,1,,,,CC BY-SA 4.0 +13142,1,13154,,8/2/2020 6:08,,2,170,"

Quantum error correction is a fundamental aspect of quantum computation. I have read some material about "Quantum Channel" and "Quantum error correction".

+

I have known the formula of gate error which has close relationship with decoherence time. However, no one tell me what is the certain probability of each error is reliable or what is the exact possibility in real environment.

+

For example, in depolarizing channel, each error can be approximated into pauli error, which is X,Y,Z error with their own possibility $p_x$,$p_y$ and $p_z$. So is that a certain scale of possibility (just for example, $1\%<p_x<10\%$) of each error is reliable or something close to that?

+",11765,,55,,8/3/2020 12:18,8/3/2020 12:56,What is the certain error rate in a quantum channel?,,1,2,,,,CC BY-SA 4.0 +13143,1,14985,,8/2/2020 12:30,,2,259,"

I wonder that there is generalized form to make Toffoli gate in multi-qubits system even if the two control qubits and one target qubit are not adjacent. In Wikipedia there is one way to make Toffoli gate with Hadamard, T gate and CNOTs, but I want to know how to make it for any case (i.e generalized version).

+",10028,,9006,,8/3/2020 7:17,12/5/2020 11:41,How to make Toffoli gate using matrix form in multi qubits system?,,2,3,,,,CC BY-SA 4.0 +13144,2,,13143,8/2/2020 13:09,,1,,"

My understanding of the OP's question is that there is some restriction imposed that a gates can only act on Adjacent Qubits. While this isn't necessary, we can still work with this restriction using SWAP gates to make non-adjacent qubit adjacent.

+

If the Control qubits are $i$ and $j$; and target qubit is $k$. Such that $i+1<j$ and $j+1<k$. Then we can use SWAP gates to bring these qubits closer.

+

If there is a distance between $i$ and $j$ i.e $j-i-1>0$, then we can use $j-i-1$ SWAP gates to bring the states of these qubits closer and apply the gate. Then another $j-i-1$ SWAP gate can be used to transfer the state back to its original position. This system is described for 2 qubits but can work for 3 qubits in case of a Toffoli Gate.

+

Example: We have 7 qubits $q_i$, $i\in \{0,1,2,3,4,5,6\}$. We need to apply a $Toffoli$ Gate to $q_5$ with $q_0$ and $q_3$ as control.

+

Then the original state of the system is $q_0q_1q_2q_3q_4q_5q_6$.

+

We can apply the $CCNOT$ gate as follows

+
    +
  1. We apply SWAP gate to $q_0$ and $q_1$ resulting in state $q_1q_0q_2q_3q_4q_5q_6$.
  2. +
  3. We apply SWAP gate to $q_0$ and $q_2$ resulting in state $q_1q_2q_0q_3q_4q_5q_6$.
  4. +
  5. We apply SWAP gate to $q_4$ and $q_5$ resulting in state $q_1q_2q_0q_3q_5q_4q_6$.
  6. +
  7. We apply CCNOT gate on $q_0,q_3,q_5$ and now $q_5 \rightarrow q_5' $ resulting in state $q_1q_2q_0q_3q_5'q_4q_6$.
  8. +
  9. We apply SWAP gate to $q_5'$ and $q_4$ resulting in state $q_1q_2q_0q_3q_4q_5'q_6$.
  10. +
  11. We apply SWAP gate to $q_0$ and $q_2$ resulting in state $q_1q_0q_2q_3q_4q_5'q_6$.
  12. +
  13. We apply SWAP gate to $q_0$ and $q_1$ resulting in state $q_0q_1q_2q_3q_4q_5'q_6$.
  14. +
+

In this manner you can apply $CCNOT$ gate to non-adjacent qubits using $SWAP$ gates.

+

Note: Just to be clear SWAP gates do not switch qubits but they are unitaries whose effect is that the state of the 2 qubits is swapped. +To know more about SWAP Gates see this

+",8757,,,,,8/2/2020 13:09,,,,0,,,,CC BY-SA 4.0 +13145,1,13146,,8/2/2020 15:55,,2,130,"

Given the following quantum state:

+

$\frac{1}{2}(|0000\rangle + |0100\rangle + |1000\rangle + |1100\rangle)$

+

How do I apply a QFT (given by the formula below) to that state in superposition?

+

$QFT_n|j\rangle = \frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}\omega_{N}^{j \times k} |k\rangle$ where $N = 2^n$

+",,user12136,,,,8/2/2020 17:00,How to apply QFT to a quantum state in superposition?,,1,0,,,,CC BY-SA 4.0 +13146,2,,13145,8/2/2020 17:00,,2,,"

QFT on any Superposition (Linear Combination of Basis States) can be applied using Linearity.

+

$$QFT_n|\psi\rangle = \sum_{k=0}^{2^n-1}a_kQFT_n|k\rangle$$

+

Hence $QFT_4|\psi\rangle$ where $|\psi\rangle = \frac{1}{2}(|0000\rangle + |0100\rangle + |1000\rangle + |1100\rangle)$ is +$$QFT_4(\frac{1}{2}(|0000\rangle + |0100\rangle + |1000\rangle + |1100\rangle)) \\ += \frac{1}{2}(QFT_4|0000\rangle + QFT_4|0100\rangle + QFT_4|1000\rangle + QFT_4|1100\rangle) \\ += \frac{1}{2}(QFT_4|0\rangle + QFT_4|4\rangle + QFT_4|8\rangle + QFT_4|12\rangle) \\ += \frac{1}{2}(\frac{1}{4}\sum_{k=0}^{15}\omega_N^{k\times 0}|k\rangle + +\frac{1}{4}\sum_{k=0}^{15}\omega_N^{k\times 4}|k\rangle + +\frac{1}{4}\sum_{k=0}^{15}\omega_N^{k\times 8}|k\rangle + +\frac{1}{4}\sum_{k=0}^{15}\omega_N^{k\times 12}|k\rangle ) \\ +=\frac{1}{8}\sum_{k=0}^{15}(\omega_N^{k\times 0}+\omega_N^{k\times 4}+\omega_N^{k\times 8}+\omega_N^{k\times 12})|k\rangle +$$

+

Here $\omega_N = e^{\frac{i2\pi}{2^4}} = e^{\frac{i\pi}{8}}$, therefore $\omega_N^0 = 1$, $\omega_N^4 = e^{\frac{i\pi}{2}} = i$, $\omega_N^8 = e^{i\pi}=-1$ and $\omega_N^{12} = e^{\frac{i3\pi}{2}}=-i$.

+

Thus $QFT_4|\psi\rangle$ is

+

$$ QFT_n|\psi\rangle = \frac{1}{8}\sum_{k=0}^{15}(\omega_k^{k\times 0}+\omega_k^{k\times 4}+\omega_k^{k\times 8}+\omega_k^{k\times 12})|k\rangle \\ += \frac{1}{8}\sum_{k=0}^{15}(1^{k}+i^{k}+(-1)^{k}+(-i)^{k})|k\rangle +$$

+

This sum $(1^{k}+i^{k}+(-1)^{k}+(-i)^{k})$ is $4$ when $k$ divides 4 otherwise its 0.

+

Thus $QFT_4|\psi\rangle$ is

+

$$QFT_n|\psi\rangle = \frac{1}{8}\sum_{k'=0}^{3}(4)|4k'\rangle \\ += \frac{1}{2}(|0\rangle + |4\rangle + |8\rangle + |12\rangle) \\ += \frac{1}{2}(|0000\rangle + |0100\rangle + |1000\rangle + |1100\rangle) +$$

+

Here I noticed that our initial state is an eigenvector of $QFT_4$ with an eigenvalue $1$. If I noticed this before I could have directly written the answer.

+

Nonetheless, I hope this helps.

+",8757,,,,,8/2/2020 17:00,,,,1,,,,CC BY-SA 4.0 +13147,2,,13126,8/2/2020 18:01,,1,,"

I would like to add to keisuke.akira answer.

+

The Noise Model in which only a Single Qubit Flips is correct. However we can assume a more general Noise Model which may be more realistic and still see the use of Bit Flip Code.

+

Since Quantum Circuits are analog, hence it is rare that a qubit flips completely. It is more likely that there is a small coherent rotation due to noise. This error is modeled as $E=e^{i\epsilon\sigma_x}$ (a small coherent rotation) where $\sigma_x$ is the Pauli-X matrix i.e $\begin{bmatrix}0 & 1 \\ 1& 0\end{bmatrix}$.

+

Here $\epsilon$ is small and represents the tiny probability of an error.

+

Thus $E=e^{i\epsilon\sigma_x} = \sin{(\epsilon)}\sigma_x + \cos{(\epsilon)}\sigma_I$

+

Now if this error was applicable on single qubit in state $|0\rangle$ (It works exactly same in case of $|1\rangle$). It would become

+

$$E|0\rangle = (i\sin{(\epsilon)}\sigma_x + \cos{(\epsilon)}\sigma_I)|0\rangle \\ += \cos{(\epsilon)}\sigma_I|0\rangle + i\sin{(\epsilon)}\sigma_x|0\rangle \\ += i\sin{(\epsilon)}|1\rangle + \cos{(\epsilon)}|0\rangle $$

+

Measuring this qubit would result in $|1\rangle$ with $P(1)=\sin^2(\epsilon) = O(\epsilon^2)$. Thus probability of error is $O(\epsilon^2)$

+

It is correct that the BitFlip Code protects against any single Bit Flip Error. However, by encoding one logical qubit in 3 qubits even in a general case where more than one BitFlip Error can take place. We decrease the error probability by an order of magnitude to $O(\epsilon^4)$.

+

Explanation:

+

In Bit Flip Code $|0\rangle_L = |000\rangle$ and $|1\rangle_L = |111\rangle$ +Now when $U=E^{\otimes 3}$ is applied to $|000\rangle$,

+

$$U|000\rangle = E^{\otimes 3}|000\rangle \\ += (i\sin{(\epsilon)}\sigma_x + \cos{(\epsilon)}\sigma_I)^{\otimes 3}|000\rangle \\ += (-i\sin^3{(\epsilon)}\sigma_x\sigma_x\sigma_x - \\ +\sin^2{(\epsilon)}\cos{(\epsilon)}\sigma_x\sigma_x\sigma_I - +\sin{(\epsilon)}\cos{(\epsilon)}\sin{(\epsilon)}\sigma_x\sigma_I\sigma_x - +\cos{(\epsilon)}\sin^2{(\epsilon)}\sigma_I\sigma_x\sigma_x - \\ +i\sin{(\epsilon)}\cos^2{(\epsilon)}\sigma_x\sigma_I\sigma_I + +i\cos{(\epsilon)}\sin{(\epsilon)}\cos{(\epsilon)}\sigma_I\sigma_x\sigma_I + +i\cos^2{(\epsilon)}\sin{(\epsilon)}\sigma_I\sigma_I\sigma_x + \\ +\cos^3{(\epsilon)}\sigma_I\sigma_I\sigma_I)|000\rangle \\ += (-i\sin^3{(\epsilon)}|111\rangle - \\ +\sin^2{(\epsilon)}\cos{(\epsilon)}(|110\rangle + |101\rangle + |011\rangle) + \\ +i\cos^2{(\epsilon)}\sin{(\epsilon)}(|100\rangle + |001\rangle + |010\rangle) + \\ +\cos^3{(\epsilon)}|000\rangle) +$$

+

While Decoding the Bit Flip Code Essentially find the majority of the 3 qubit states. +In this case the majority is state $|1\rangle$ when after $U$ the state are +$\{|110\rangle,|101\rangle,|011\rangle,|111\rangle\}$.

+

Thus probability of final measurement yielding us $1$ is +$$P(1) = (\sin^3(\epsilon))^2 + 3(\sin^2(\epsilon)\cos(\epsilon))^2 \\ += \sin^6(\epsilon) + 3\sin^4(\epsilon)\cos^2(\epsilon) = O(\epsilon^4)$$

+

In this manner Bit Flip Error Correcting Code has reduced the error probability from $O(\epsilon^2)$ to $O(\epsilon^4)$.

+",8757,,8757,,8/2/2020 18:18,8/2/2020 18:18,,,,0,,,,CC BY-SA 4.0 +13148,2,,5851,8/2/2020 19:22,,1,,"
+

what is being said with "a single probe within $2^𝑛$ possible locations"

+
+

It wants to say the process has translated the qubit (binary representation) into a single location in memory.

+
+

What is the "probe"? And what is behind "degree of freedom"?

+
+

A probe is an abstraction of a device that could visit a location (the degree of freedom related to location) in memory, and processes/stores the information (the so-called degree of freedom unrelated to location) retrieved from the location it's at.

+
+

The data register qubits enter at the top of the tree, and are routed down to the database - where is the connection with the switches from earlier?

+
+

The CPU has an index register $|x\rangle$ and a data register $|d\rangle$ (mentioned in text above your quote in the book), the CPU would like to add contents $d_x$ of the $x^{th}$ memory cell to the data register, i.e. $|d\rangle \rightarrow |d\bigoplus d_x\rangle$. The switches guide the data register qubit, based on index register $|x\rangle$, to one of the $2^n$ locations.

+
+

The binary to unary encoding is then reversed, leaving the data register with the desired contents.

+
+

Yes, it just says we have gone from qubit index to a location in memory, then applied the information retrieved from that location to the data register

+
+

The qubits are then routed back into a definite position - How does the way back work?

+
+

Swithces form a binary tree. We can go from leaf node (a location on memory) to the root node ("a definite position") by recursively visiting the parent node.

+",7460,,,,,8/2/2020 19:22,,,,0,,,,CC BY-SA 4.0 +13149,2,,13123,8/2/2020 20:21,,2,,"

Given a separable bipartite state as $|\psi\rangle\otimes|\phi\rangle$, you "get" the states of the single systems but taking only the corresponding state, e.g. here $|\psi\rangle$ or $|\phi\rangle$.

+

More generally, you might not know the structure of the state, and you might have entanglement between the different subsystems, in which case the reduced states are not pure, and you need to use density matrices to properly take this into account.

+

Given an $N$-partite state $\rho$, get the corresponding reduced states via the partial trace operation. +For example, if you want the state of the first $N-1$ qubits, you do +$$\operatorname{Tr}_N(\rho) \equiv +(I\otimes\operatorname{Tr})\rho +\equiv \sum_k(I\otimes\langle k\rvert)\rho(I\otimes \lvert k\rangle).$$ +More explicitly, if the matrix elements of $\rho$ are written as $\rho_{i_1,...,i_N;j_1,...,j_N}$, we have +$$[\operatorname{Tr}_N(\rho)]_{i_1,...,i_{N-1};j_1,...,j_{N-1}} \equiv +\sum_{k}\rho_{i_1,...,i_{N-1},k;j_1,...,j_{N-1},k}.$$

+

To get the state of a single qubit, you do the above for all degrees of freedom except the first one.

+",55,,,,,8/2/2020 20:21,,,,0,,,,CC BY-SA 4.0 +13150,2,,9978,8/2/2020 20:47,,2,,"

We know that the Initial state $|\psi\rangle$ can be represented as $\sin\frac{\theta}{2}|\chi\rangle + \cos\frac{\theta}{2}|\xi\rangle$.

+

We can prove the result $G^R|\psi\rangle = \sin\frac{(2R+1)\theta}{2}|\chi\rangle + \cos\frac{(2R+1)\theta}{2}|\xi\rangle$ by Induction

+

Base Case

+

When $R=0$, $G^R=G^0=I$ and $2R+1=2\times0+1=1$. +Thus $G^0|\psi\rangle = \sin\frac{(2\times 0+1)\theta}{2}|\chi\rangle + \cos\frac{(2\times 0+1)\theta}{2}|\xi\rangle += \sin\frac{\theta}{2}|\chi\rangle + \cos\frac{\theta}{2}|\xi\rangle = |\psi\rangle$ +is true. Base Case Proven

+

Inductive Step

+

Let us assume this is true for $\forall R \leq k$ i.e. $G^{k}|\psi\rangle = \sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle $

+

Induction Proof

+

Note: The math below is terse but not that complicated. However, it requires some prior knowledge of trigonmetry identities as well as Ket-Bra Algebra

+

First we will derive some useful results. +From the same paper's Appendix B1 we are given that +$G = UO = (H^{\otimes n}(2|0\rangle\langle0|-I)H^{\otimes n})O$ where $O$ is the oracle.

+

We know that since all states in $|\chi\rangle$ are marked and all states in $|\xi\rangle$ are unmarked therefore,

+

$$O|\chi\rangle =-|\chi\rangle$$ +$$O|\xi\rangle =|\xi\rangle$$

+

Thus by Linearity, +$$O(\sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle) = +-\sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle$$

+

Moreover it is important to note that $\langle\xi|\chi\rangle =\langle\chi|\xi\rangle=0$ as $|\chi\rangle and |\xi\rangle$ are orthogonal

+

Now, +$$U = H^{\otimes n}(2|0\rangle\langle0|-I)H^{\otimes n} \\ += 2H^{\otimes n}|0\rangle\langle0|H^{\otimes n} - I $$

+

We note that $H^{\otimes n}|0\rangle = \frac{1}{N}\sum_{x=0}^{N-1}|x\rangle = |\psi\rangle = \sin\frac{\theta}{2}|\chi\rangle + \cos\frac{\theta}{2}|\xi\rangle$

+

Thus, +$$ U = 2|\psi\rangle\langle \psi| - I \\ += 2(\sin\frac{\theta}{2}|\chi\rangle + \cos\frac{\theta}{2}|\xi\rangle)(\sin\frac{\theta}{2}\langle\chi| + \cos\frac{\theta}{2}\langle\xi|) - I \\ += 2(\sin^2\frac{\theta}{2}|\chi\rangle\langle\chi| ++ \cos\frac{\theta}{2}\sin\frac{\theta}{2}|\xi\rangle\langle\chi| ++ \cos\frac{\theta}{2}\sin\frac{\theta}{2}|\chi\rangle\langle\xi| ++ \cos^2\frac{\theta}{2}|\xi\rangle\langle\xi|) - I$$

+

Therefore for $G^{k+1}|\psi\rangle$ +$$G^{k+1}|\psi\rangle = GG^k|\psi\rangle += G(\sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle) \\ += UO(\sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle) \\ += U(-\sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle) \\ += (2(\sin^2\frac{\theta}{2}|\chi\rangle\langle\chi| ++ \cos\frac{\theta}{2}\sin\frac{\theta}{2}|\xi\rangle\langle\chi| ++ \cos\frac{\theta}{2}\sin\frac{\theta}{2}|\chi\rangle\langle\xi| ++ \cos^2\frac{\theta}{2}|\xi\rangle\langle\xi|) - I)\\ +(-\sin\frac{(2k+1)\theta}{2}|\chi\rangle + \cos\frac{(2k+1)\theta}{2}|\xi\rangle)\\ +$$

+

If we expand this expression, cancel out the terms where inner product is zero and combine the coefficients involving the same state we get,

+

$$ G^R|\psi\rangle \\ += (-(2sin^2\frac{\theta}{2}-1)\sin\frac{(2k+1)\theta}{2} ++ (2\cos\frac{\theta}{2}\sin\frac{\theta}{2})\cos\frac{(2k+1)\theta}{2})|\chi\rangle \\ ++ (-(2\cos\frac{\theta}{2}\sin\frac{\theta}{2})\sin\frac{(2k+1)\theta}{2} ++ (2cos^2\frac{\theta}{2}-1)\cos\frac{(2k+1)\theta}{2})|\xi\rangle$$

+

Using some trigonometry we can simply it further +$$ G^R|\psi\rangle \\ += (\cos\theta\sin\frac{(2k+1)\theta}{2} + \sin\theta\cos\frac{(2k+1)\theta}{2})|\chi\rangle \\ ++ (-\sin\theta\sin\frac{(2k+1)\theta}{2} + \cos\theta\cos\frac{(2k+1)\theta}{2})|\chi\rangle \\ += \sin(\theta + \frac{(2k+1)\theta}{2})|\chi\rangle + \cos(\theta + \frac{(2k+1)\theta}{2})|\xi\rangle \\ += \sin\frac{(2k+3)\theta}{2}|\chi\rangle + \cos\frac{(2k+3)\theta}{2}|\xi\rangle \\ += \sin\frac{(2(k+1)+1)\theta}{2}|\chi\rangle + \cos\frac{(2(k+1)+1)\theta}{2}|\xi\rangle $$

+

This is exactly what we wanted. Hence our proof by Mathematical Induction is complete.

+

QED

+",8757,,,,,8/2/2020 20:47,,,,0,,,,CC BY-SA 4.0 +13151,1,,,8/2/2020 21:44,,3,206,"

Since 2009, many matrix inversion algorithms have appeared.

+

Is there somewhere a table, or recently released overview, comparing the speed of matrix inversion algorithms, like done in this table taken from Shao comparing different algorithms for quantum state preparation?

+

+",12804,,55,,8/3/2020 9:10,8/3/2020 9:10,Comparison of matrix inversion algorithms,,0,1,,,,CC BY-SA 4.0 +13152,1,,,8/3/2020 0:15,,2,121,"

Given that the error mitigation matrix (meas_fitter.filter) does not vary so much for a given backend and number of qubits, then what are the advantages and disadvantages in the determination of the calibration matrix each time that we do an experiment and mitigate its error? Is any reliable error mitigation matrix available for us to use without having to calculate it ourselves? Thanks.

+",10455,,2293,,8/17/2020 2:53,8/17/2020 2:53,"Error mitigation matrix as backend property: Are any ""reliable"" mitigation matrices publicly available?",,2,0,,,,CC BY-SA 4.0 +13153,2,,13152,8/3/2020 3:58,,3,,"

Yes, if we have fixed backend, number of qubits, and noise model (e.g., Basic device noise model in https://qiskit.org/documentation/stubs/qiskit.providers.aer.noise.NoiseModel.html#qiskit.providers.aer.noise.NoiseModel), we would have a fixed calibration matrix. I think the advantage is that once we have this calibration matrix, we can use it to perform measurement error mitigation on any new experiment as long as conditions (e.g., backend, number of qubits, noise model) have not changed. In this case, we don't need to determine the calibration matrix each time we do an experiment, which I think is very convenient.

+

I haven't come up with any disadvantage about this method. But it is worth noting that we do need to recalculate the calibration matrix if we do the experiment on a different working environment. For example, if we choose a new backend, we might need to define a new corresponding noise model to ensure the noise on the new device can be well modeled. Subsequently, we would have a new calibration matrix for measurement error mitigation.

+

I can also share one tutorial on measurement error mitigation as well as a nice YouTube video.

+
    +
  1. https://qiskit.org/documentation/tutorials/noise/3_measurement_error_mitigation.html
  2. +
  3. https://www.youtube.com/watch?v=yuDxHJOKsVA
  4. +
+

I hope my answer would help.

+",12841,,,,,8/3/2020 3:58,,,,0,,,,CC BY-SA 4.0 +13154,2,,13142,8/3/2020 10:15,,2,,"

As I explained in my answer on a previous question of yours, the depolarizing channel is not really 'physical' - actual quantum systems don't really behave that way.

+

So for simulations where you, for instance, investigate the performance of some code against the depolarizing channel, it doesn't really matter what the exact value of $p$ is in your simulations. Moreover, what is much more interesting is to perform the simulation for a range of values of $p$, and see how the performance of the code depends on $p$. As you may be aware, for higher $p$, a code may do more bad than good (i.e. it creates more errors than it can correct); for a low $p$ the code will actually do some good, and thus an interesting value for $p$ might be the point where the code starts to add benefit - this value is often referred to as the pseudo threshold. This excellent answer elaborates a bit on why we call it the pseudo threshold, and not just threshold.

+

Now, if you want to simulate actual systems more closely, as I explained in my answer linked above, it's 'better' to use the amplitude damping and dephasing channel. The error rates are mostly expressed in the damping time $T_{1}$ and dephasing time $T_{2}$; what exactly these values are is highly dependent on what system you are simulating.

+

For instance, the transmon qubits from IBM have a typical $T_{1}$ of $~50 \mu s$ and a $T_{2}$ of $~60 \mu s$. As another example, the quantum dot based semiconductor qubits of QuTech's Quantum Inspire have a typical $T_{1}$ of $> 20 ms$ and a $T_{2}$ of $> 6 \mu s$.

+

As you can see, these values vary quite a bit; one of the main pillars of current physical qubit systems development is to increase these characteristic times.

+

Note that this is just one part of the story; $T_{1}$ and $T_{2}$ say only something about what happens to your qubits when they are idle. The operations that you perform on the qubits are faulty themselves as well, and in a proper simulation of a QECC this has to be taken into account. Errors in operations can be seen as the perfect operation followed by some error in the form of a quantum channel, but what channel is applicable here is another question entirely and out of the scope for this answer; of course you're welcome to ask a separate question about this!

+",8141,,8141,,8/3/2020 12:56,8/3/2020 12:56,,,,3,,,,CC BY-SA 4.0 +13155,2,,13126,8/3/2020 12:20,,1,,"

You are analysing the case where you know a unitary has definitely been applied on the first qubit. In that case, it should not be surprising that there's no change in entanglement. You can take a couple of perspectives:

+
    +
  • single qubit unitaries do not change entanglement. To change entanglement with a unitary requires a two-qubit unitary.
  • +
  • If you know what error has occurred, you can undo it with no problem.
  • +
+

The real trick with error correcting codes is that they still work even if you don't know that the error has occurred. For example, if you have a probability $p$ that the error occured, you should really be describing your state as +$$ +\rho=(1-p)|\psi\rangle\langle\psi|+(1-p)X_1|\psi\rangle\langle\psi|X_1, +$$ +where $|\psi\rangle$ was your original (encoded) state. Here, the entanglement will most definitely vary with $p$.

+",1837,,8141,,8/3/2020 12:33,8/3/2020 12:33,,,,0,,,,CC BY-SA 4.0 +13156,2,,8274,8/3/2020 14:32,,1,,"

If take e.g. this decomposition of the square root of NOT then it's so simple in the IBM Q composer:

+

+

And although it is unlikely that this circuit form actually consists of 3 elementary gates (I think the cu1 gate is implemented using 5 elementary ones), in my opinion, it looks just easier than others e.g. from here:

+

+

You can also use functions (subroutines) in the composer (like as csx from qelib1.inc), but unfortunately they do not work well any time or work with restrictions.

+",12280,,12280,,8/20/2020 5:08,8/20/2020 5:08,,,,0,,,,CC BY-SA 4.0 +13157,1,13162,,8/3/2020 17:14,,6,689,"

The Gottesman–Knill theorem states that stabilizer circuits, circuits that only consist of gates from Clifford group, can be perfectly simulated in polynomial time on a probabilistic classical computer. Clifford Gates are hence extremely useful in Quantum Computing.

+

Is there a way to identify if an arbitrary Unitary $U$ of size $2^n \times 2^n$ is a Clifford Gate. +If such an algorithm(s) exists, what is the best computational complexity achieved thus far? Are there lower bounds on this problem?

+",8757,,,,,8/4/2020 14:52,How do I check if a gate represented by Unitary $U$ is a Clifford Gate?,,2,0,,,,CC BY-SA 4.0 +13158,2,,13157,8/3/2020 17:31,,9,,"

Here's a simple strategy based on the idea that Clifford operations conjugate Pauli products into other Pauli products.

+

If $U$ is a Clifford operation, then $U P U^\dagger$ (where $P$ is a Pauli operation on one of the qubits) will be a matrix equivalent to a product of Pauli operations. If you check this for each $X_q$ and $Z_q$ for each qubit $q$, the operation is guaranteed to be Clifford.

+

Performing the multiplication and checking if the matrix is a product of Paulis can be done in $O(8^N)$ time using naive matrix multiplication, and you need to do this $2N$ times, so overall this would be $O(N 8^N)$ time.

+",119,,,,,8/3/2020 17:31,,,,7,,,,CC BY-SA 4.0 +13160,2,,13071,8/4/2020 4:02,,3,,"

I think you can also use the method of composite gates which might be easier to implement. The idea is that you create a circuit with gates and then turn it into an instruction by using the to_instruction() method. Once you've done this, you can consider this instruction as a predefined gate and add it to your new circuit by using the append() method. Let me show you an example code. I'll follow your example for X gate, but this code can be generalized to arbitrary gates.

+
from qiskit import QuantumCircuit
+
+# customize a gate instruction (e.g., X gate)
+qc = QuantumCircuit(1, name='X')
+qc.x(0)
+custom_gate = qc.to_instruction()
+
+# append custom gate to a new circuit
+new_circ = QuantumCircuit(2)
+new_circ.append(custom_gate, [0])
+print(new_circ)
+
+     ┌───┐
+q_0: ┤ X ├
+     └───┘
+q_1: ─────
+    
+
+

As you can see, we first define single-quibit circuit qc with a X gate and turn it into an instruction. Then it can be appended to any new circuit. Here we attach it to a two-qubit circuit with name new_circ.

+

I hope my answer would help.

+",12841,,12841,,8/4/2020 6:48,8/4/2020 6:48,,,,0,,,,CC BY-SA 4.0 +13161,1,13165,,8/4/2020 7:11,,3,3489,"

A documentation of Qiskit language is provided on qiskit.org/documentation/. However, this is an on-line source and sometimes I would apprecite to have an off-line version at hand.

+

My questions are:

+
    +
  1. Is it possible to download the documentation I mentioned above in PDF? Or is it available somewhere?
  2. +
  3. Could you please recommend me any other Qiskit textbook for beginers in Qiskit?
  4. +
+",9006,,55,,8/7/2020 22:59,8/7/2020 22:59,Where can I find the Qiskit tutorial as a pdf?,,1,0,,,,CC BY-SA 4.0 +13162,2,,13157,8/4/2020 12:09,,8,,"

Following Dehaene and de Moor (Theorem 6 in particular), every Clifford unitary can be represented (up to a global scalar factor) by an expression of the form +$$ + U = 2^{-k/2} \!\!\!\!\!\!\sum_{\substack{x_r,x_c \in \{0,1\}^k \\ x_b \in \{0,1\}^{n-k}}}\!\!\!\!\! i^{p(x_b,x_c,x_r)} (-1)^{q(x_b,x_c,x_r)} \bigl\lvert T_1[x_r;x_b] \bigr\rangle\!\bigl\langle T_2[x_c;x_b] \oplus t \bigr\rvert +\qquad\qquad\qquad(\ast) +$$ +where $0 \leqslant k \leqslant n$, $p$ is a linear function of $n+k$ arguments, $q$ is a quadratic function of $n+k$ arguments, $t$ is a binary vector of dimension $n$, $\oplus$ is addition modulo 2, and $T_1$ and $T_2$ are invertible linear transformation acting on $n$-dimensional vectors modulo $2$.

+

This result looks messy — and the statement in the paper is even messier — but we don't have to dig too deep into it, to make use of it. Taking advantage of this allows us to filter out many matrices as being non-Clifford very quickly, and also allows us to find better run-time bounds for verifying a Clifford operator in particular cases.

+

1. Check the magnitudes of the coefficients

+

Looking at Equation $(\ast)$, we can see that every term in the sum will correspond to a different entry of the matrix, because for any two terms, either some bit in the row-index or some bit in the column-index (or both) will be different. +Furthermore, up to the scalar factor of $2^{-k/2}$ each term is proportional to $+1$, $i$, $-1$, or $-i$.

+

This implies that, for any Clifford unitary $U$, there exists an integer $k \geqslant 0$ such that every entry of $U$ is either zero or has norm $2^{-k/2}$.

+

So the first thing you should compute is $k = -2 \log_2 \lvert\alpha\rvert$ for the first non-zero entry $\alpha$ that you find. If $k$ is not a non-negative integer (up to machine precision), your matrix $U$ is not Clifford. Then, as you read the rest of the matrix $U$, you should check whether every other non-zero entry also has norm $2^{-k/2}$; if not, your matrix $U$ is not Clifford.

+

2. Compute a global phase

+

Again looking at Equation $(\ast)$, each term is either purely real or purley imaginary. Note that a Clifford gate may differ from such an expression by an irrelevant global phase. However, we may infer such a global phase from any non-zero coefficient: any coefficient which is neither purely real nor purely imaginary, can be described in terms of a purely real or purely imaginary amplitude, multiplied by some phase factor.

+

So, for that same coefficient $\alpha$ as above, compute $\omega = \exp(-i \arg(\alpha))$, and compute the matrix $U' = \omega U$. The corresponding coefficient $\omega \alpha$ will be purely real; if $U$ is Clifford, all the other coefficients of $U'$ will be either purely real or purely imaginary. If this is not the case, then $U$ is not Clifford.

+

(By performing the substitution $U \gets U'$ above, we may reduce to the case where $\alpha$ is a positive real; I suppose that this is done for the remaining description below.)

+

3. Test the number of entries in each row/column

+

If the matrix $U$ is unitary, then in particular each of its columns and rows are unit vectors. As each non-zero coefficient of $U$ has the same magnitude, namely $2^{-k/2}$, it follows that every row or column must have precisely $2^k$ non-zero entries.

+

So, given the value of $k$ computed from the first non-zero entry, you can simply check as you read the matrix $U$ whether the number of non-zero entries in each row or column is $2^k$. If not, then $U$ is not Clifford.

+

4. Test how $U$ affects Pauli operators

+

The above tests can actually all be performed basically at the same time, in an initial pass through the matrix, and so can be done in $4^n$ time (or to put it another way, linear in the size of the matrix). I suggest these because for several plausible ways in which you might obtain a matrix $U$ which may or may not be Clifford, I would expect that one of these tests would quickly discover some evidence that $U$ is not Clifford, which would improve the speed of your test.

+

After these tests, I have more or less run out of tricks, and would suggest that you perform the test that Craig Gidney suggested: compute whether $U P_j U^\dagger$ is a Pauli operator, for the single-qubit Pauli operators $P_j \in \{X_j,Z_j\}$ acting on any one qubit $1 \leqslant j \leqslant n$. However, there are still useful things to observe here.

+

[Edit: note that the following includes some corrections and improvements on the previous version of the answer. Apologies for the errors.]

+
    +
  • The number of non-zero coefficients $2^k$ in each row or column will give you a better bound on the run-time of computing each matrix $U P_j U^\dagger$. In general, you may be forced to use a fully general multiplication algorithm — in $O((2^n)^3) = O(8^n)$ time, or perhaps faster if the size of the matrix motivates using a better matrix multiplication algorithm than the naive one — but using a naive algorithm, it will actually only require $O(4^k 2^n)$ time if you use a representation of $U$ which can take advantage of the cases where $2^{k-n}$ is small.

    +
  • +
  • If $U$ is a Clifford operator, then $Q = U P_j U^\dagger$ will be a Pauli operator. The operator $Q$ will some form $i^m Z^{\otimes a} X^{\otimes b}$, for some $a,b \in \{0,1\}^n$ — where $A^{\otimes v}$ represents a tensor product which is $A$ on those qubits $j$ for which $v_j = 1$, and $\mathbf 1$ on those qubits where $v_j = 0$ — and where $m$ is an integer which is odd if and only if $a \cdot b = \sum_j a_j b_j$ is odd.

    +
      +
    1. When you compute $Q = U P_j U^\dagger$ in the first place, you should store it as a sparse matrix — because if it is a Pauli matrix, it will have exactly one non-zero entry per row or column. In particular, if you find that any row or column has more than one non-zero entry, $U$ is not Clifford.

      +
    2. +
    3. As you compute $Q$, you should consider the values of every entry which you compute, because the coefficients of $Q$ will either all be $\pm 1$, or all be $\pm i$, if $Q$ is Pauli. If this does not hold, $U$ is not Clifford.

      +
    4. +
    5. As Craig again notes, index of the non-zero entry in the first column of $Q$ indicates what the value of $b \in \{0,1\}^n$ is. Set $b$ to this value. At the same time, let $\gamma$ be the inverse (or equivalently in this case, the complex conjugate) of the non-zero entry of the first column of $U$. Then, evaluate $Q' = \gamma Q X^{\otimes b}$. Using sparse representations of $Q$ and $X^{\otimes b}$, this should take time $2^n$.

      +
    6. +
    7. If $Q$ is a Pauli matrix, the matrix $Q'$ which you have computed should have the form $Z^{\otimes a}$ for some matrix $a$, as the upper-left entry of $Q'$ is equal to $1$. In particular, $Q'$ should only have diagonal entries consisting of $\pm 1$, and you can check whether this is so while you are computing $Q'$. If this is not the case, $U$ is not Clifford.

      +
    8. +
    9. Finally, we can compute $a$ by querying a handful of entries of $Q'$, to test whether they are $+1$ or $-1$. For each bit-string $e_j \in \{0,1\}^n$ consisting of a $1$ at index $j$ and $0$ elsewhere, read the entry $\langle e_j \rvert\,Q'\,\lvert e_j \rangle$. If this is $+1$, set $a_j = 0$; if it is $-1$, set $a_j = 1$. Then, for all remaining vectors $x \in \{0,1\}^n$, test whether $\langle x \rvert \, Q' \lvert x \rangle = (-1)^{x \cdot a}$. If this is true for all $x$, we have $Q' = Z^{\otimes a}$; otherwise $Q'$ is not a Pauli operator, and $U'$ is not Clifford.

      +
    10. +
    +

    This test performs a number of operations on very sparse matrices, each of which takes time $O(2^n)$ or much less, which is to say on the order of the square root of the size of the input matrix $U$.

    +
  • +
+

For each Pauli operator $P_j$, this then takes time $O(4^k 2^n)$, and you must repeat this $2n$ times to test each $P_j \in \{X_j, Z_j\}$ for $1 \leqslant j \leqslant n$. (If you don't know for certain whether $U$ is unitary, you should also compute $U U^\dagger$, which also takes $O(4^k 2^n)$ time). All together, this then takes time $O(n 4^k 2^n)$.

+

Summary

+

Ignoring the time required to do basic arithmetic computations:

+
    +
  • First, check whether $U$ could even conceivably be unitary, by computing an appropriate value of $k \leqslant n$, and testing the coefficients of $U$ for consistency with this value of $k$. Computing $k$ will take time $O(2^n)$ time in the worst case (the time required to find a non-zero entry in some row or column — or much faster if you have a sparse representation); the consistency checks will take time $O(4^n)$, which is the time required to even read the matrix (again faster if you have a sparse representation).
  • +
  • Assuming that $U$ passes the consistency checks, you can test whether $U$ is unitary if necessary in time $O(4^k 2^n)$, and then test whether it is Clifford in time $O(n 4^k 2^n)$.
  • +
+",124,,124,,8/4/2020 14:52,8/4/2020 14:52,,,,2,,,,CC BY-SA 4.0 +13163,1,,,8/4/2020 12:58,,2,94,"

I know that for a given spin-j quantum state, say $\vert\psi\rangle = (\psi_0 , \psi_1 , \cdots , \psi_{2j})$, we can construct a polynomial as follows

+

$ +w(z) = \sum_{k = 0}^{2j} (-1)^k \psi_k \sqrt{\binom{2j}{k} } z^{2j-k} +$

+

and by means of the inverse stereographic projection of the roots of $w(z)$, the Majorana's representation of $\vert\psi\rangle$ is obtained on sphere. I also know that the Majorana's representation for the eigen-state of $\mathbf{J.n}$ operator with eigen-value $m$ is the configuration of points on sphere in which there are $j+m$ points in the $\mathbf{n}$ direction and other $j-m$ points in the antipodal point (equivalently $-\mathbf{n}$ direction).

+

My question is why the Majorana's representation of $e^{i\mathbf{n.J} \theta} \vert \psi \rangle$ is just that of $\vert\psi\rangle$ rotated around $\mathbf{n}$ by an angle of $\theta$? (This is transparent when $\vert \psi \rangle$ is an eigen-vector of angular momentum in some direction but I do not see why this is true in general.)

+

Thank you

+",12853,,12853,,8/4/2020 19:11,8/4/2020 19:11,Why an element of SU(2) acts as a rotation for Majorana representation of states?,,0,2,,,,CC BY-SA 4.0 +13164,1,13169,,8/4/2020 13:53,,5,152,"

Let $\mathcal{H}_A \otimes \mathcal{H}_B$ be the tensor product of two finite dimensional Hilbert spaces, let $d = \operatorname{dim}(\mathcal{H}_A \otimes \mathcal{H}_B)$ and let $| \psi \rangle \in \mathcal{H}_A \otimes \mathcal{H}_B$ be a pure entangled state.

+

We say the entanglement in $| \psi \rangle$ is $\epsilon_0$-robust, for some $\epsilon_0 \in [0,1]$, if $ (1-\epsilon) | \psi \rangle \langle \psi | + \epsilon \, \mathbb{I}/d$ is entangled for all $\epsilon \in [0, \epsilon_0]$. More generally we say the entanglement in $| \psi \rangle$ is completely $\epsilon_0$-robust if $ (1-\epsilon) | \psi \rangle \langle \psi | + \epsilon \, \tau$ is entangled for all $\epsilon \in [0, \epsilon_0]$ and all states $\tau$ on $\mathcal{H}_A \otimes \mathcal{H}_B$.

+

Are there any pure entangled states that are not $\epsilon_0$-robust (or completely $\epsilon_0$-robust) for all $\epsilon_0 > 0$?

+",9854,,9854,,8/4/2020 15:11,8/5/2020 7:35,Are all pure entangled states `robust'?,,2,0,,,,CC BY-SA 4.0 +13165,2,,13161,8/4/2020 14:37,,3,,"

The Qiskit documentation is included in the Qiskit Github repositories, so if you clone the Qiskit repositories locally, you'll have full access to the documentation offline. Alternatively, you could use something like HTTrack to download and access the documentation website offline.

+

The Qiskit textbook is probably the best resource for learning Qiskit. There is also a nice set of Qiskit tutorials here, and the documentation itself includes a set of tutorials.

+",8623,,8623,,8/4/2020 16:13,8/4/2020 16:13,,,,0,,,,CC BY-SA 4.0 +13166,2,,13164,8/4/2020 15:02,,2,,"

For a fixed $\epsilon_0$, why not simply consider +$$ +|\psi\rangle=\cos\theta|00\rangle+\sin\theta|11\rangle? +$$ +Since it's a two-qubit state, entanglement can be determined using the PPT criterion. Hence, +$$ +\rho=(1-\epsilon)|\psi\rangle\langle\psi|+\epsilon I/4 +$$ +is entangled if $\epsilon<2\sin(2\theta)/(1+2\sin(2\theta))$. Any $\epsilon$ you give me, and I just pick $0<\theta<\arcsin(\epsilon_0/2)/2\approx\epsilon_0/4$, and the state is not $\epsilon_0$-robust. Given there exists a state that is not $\epsilon_0$-robust, entanglement is not completely $\epsilon_0$-robust.

+

To prove things the other way around (for fixed $|\psi\rangle$, is there always a non-zero $\epsilon_0$ such that for all $\epsilon<\epsilon_0$, the mixed state is entangled?), we can consider entanglement witnesses. Let $W$ be an entanglement witness for $|\psi\rangle$. We have $\text{Tr}(W\rho)\geq 0$ for all separable states $\rho$ and $\text{Tr}(W|\psi\rangle\langle \psi|)=-\sigma<0$.

+

Now, the trace of $W$ will be some specific value $\text{Tr}(W)=k\geq 0$ (this is positive since the maximally mixed state is separable). Consider +$$ +\text{Tr}(W(\epsilon I+(1-\epsilon)|\psi\rangle\langle\psi|))=\epsilon k-(1-\epsilon)\sigma. +$$ +For any +$$ +\epsilon<\frac{\sigma}{k+\sigma}, +$$ +the trace is negative and hence the state is entangled.

+",1837,,1837,,8/5/2020 7:35,8/5/2020 7:35,,,,1,,,,CC BY-SA 4.0 +13167,2,,13152,8/4/2020 15:06,,3,,"
+

"what are the advantages and disadvantages in the determination of the +calibration matrix each time that we do an experiment and mitigate its +error?"

+
+

Advantage: The noise matrix will be a more accurate description of the current noise situation. My understanding is that each day, the qubtis are cooled from 300K all the way down to about 15mK, and I can imagine that there might be tiny differences in the noise characteristics due to the qubits' slightly different local environment each day. I'm also not sure how consistent the pressure, humidity, and other properties of the surroundings of the qubits are from day to day. Experience tells us that even on the same day, two identical quantum computations done one after the other can apparently be affected quite differently by noise. Someone on the hardware team from IBM might know better about why this is, but what members of the public know is only that the noise is slightly different each day (and even each time), so it's likely that the matrix made immediately before an experiment will be the most accurate description of the noise of that experiment.

+

Disadvantage: Recalculating the noise matrix every time you do an experiment requires more work, and in some sense may even take away the quantum advantage. For example the noise matrix for the Melbourne chip with 15 qubits will be a $2^{15} \times 2^{15}$ matrix. The whole point of quantum computation is to avoid the $\mathcal{O}(2^N)$ scaling, so if you have to calculate a noise matrix before doing a 15-qubit experiment, maybe you might as well do the calculation on a classical computer. Ideally you would have a noise matrix prepared once, and then never have to do this $\mathcal{O}(2^N)$ procedure ever again.

+

The more interesting question is whether or not there is any reliable noise matrix available out there, so that people don't have to make it themselves each time. For this part I do not have an answer yet, but would be keen to know if someone else does.

+",2293,,,,,8/4/2020 15:06,,,,0,,,,CC BY-SA 4.0 +13168,1,,,8/4/2020 15:13,,2,257,"

I tried to plot a Bloch vector. However, my Bloch sphere is appearing as an ellipse/oval instead of a circle. I am having the same issues with qsphere also. instead of

+
from qiskit.visualization import plot_bloch_vector
+
+%matplotlib inline
+
+plot_bloch_vector([0,1,0], title="New Bloch Sphere")
+
+",12854,,5955,,8/20/2020 22:08,4/23/2021 19:17,My Bloch sphere/ qsphere is appearing as an ellipse/oval,,1,2,,,,CC BY-SA 4.0 +13169,2,,13164,8/4/2020 15:29,,4,,"

The set of separable states is closed.

+

Thus, around any entangled state - not necessarily pure - there is an $\epsilon$-ball which lies entirely within the entangled states.

+

Or, in the language of your question: All entangled states are "robust".

+

(As illustrated by DaftWullie's answer, the size of this ball can depend on the state: There are pure entangled states arbitrarily close to separable ones.)

+",491,,,,,8/4/2020 15:29,,,,3,,,,CC BY-SA 4.0 +13170,2,,12729,8/4/2020 18:33,,3,,"

I think in this case you can split the experiments into multiple jobs. The idea is that you split measurement calibration circuits generated by complete_meas_cal into a number of batches, execute the first batch and use the corresponding results to initialize a measurement correction fitter with CompleteMeasFitter. Then you can use the CompleteMeasFitter.add_data method to update the measurement correction fitter with the rest of calibration circuit batches. Finally, you will get the fitter you want. Here is a sample code for explanation. I use only four qubits for simplicity but this code can be generalized to 15 qubits for your case.

+
from qiskit import QuantumCircuit, execute, Aer, IBMQ
+IBMQ.load_account()
+provider = IBMQ.get_provider(hub='ibm-q')
+device = provider.get_backend('ibmq_16_melbourne')
+
+from qiskit.ignis.mitigation.measurement import (complete_meas_cal,CompleteMeasFitter)
+# Generate the calibration circuits
+qr = qiskit.QuantumRegister(4)
+meas_calibs, state_labels = complete_meas_cal(qr=qr, circlabel='mcal')
+
+#Split calibration circuits into two batches
+job1_res = qiskit.execute(meas_calibs[0:8], backend=device, shots=1024,optimization_level=0).result()
+job2_res = qiskit.execute(meas_calibs[8:16], backend=device, shots=1024,optimization_level=0).result()
+
+#Initialize the measurement correction fitter with the first 8 calibration circuits
+meas_fitter = CompleteMeasFitter(job1_res, state_labels, circlabel='mcal')
+meas_fitter.plot_calibration()
+
+

+
#Update the measurement correction fitter with the second 8 calibration circuits
+meas_fitter.add_data(new_results=job2_res)
+meas_fitter.plot_calibration()
+
+

+

We create a circuit with four qubits, so we get 16 calibration circuits. we split them into two batches. As you can see, if we plot the calibration matrix after initializing the measurement correction fitter with the first batch of calibration circuits, it only shows a half calibration matrix. After we update the fitter with the last batch of calibration circuits, we can see the full calibration matrix.

+

I hope my answer would help.

+",12841,,1859,,9/11/2020 8:23,9/11/2020 8:23,,,,0,,,,CC BY-SA 4.0 +13171,1,,,8/4/2020 20:06,,2,287,"

I'm trying to write a 1-bit teleportation error correction code and there is one part in it where I need to add a gate that's dependent on a measurement from earlier in the circuit. The measurement is stored on a single classical bit, and I'm trying to use c_if to apply the gate based on the measurement result of that bit.

+

Intuitively I would think this could be written as: qc.h(q[0]).c_if(c[3], 1) but that only returns an error while qc.h(q[0]).c_if(c, 1) gives no error (though it doesn't give the result I'm looking for). Is there a way to link c_if to a single classical bit instead of the classical register?

+

This question is similar and the answer seems to imply that it isn't possible to use c_if this way.

+

If c_if can't do this, would something like what they mentioned in their question: if(c[3]==1) qc.h(q[0]) work in qiskit? For my purposes the operation needs to be integrated into the circuit, so if it does work would the gate be applied automatically?

+",12856,,9006,,8/5/2020 6:58,8/5/2020 13:55,Is it possible to implement c_if statement based on a measurement in a single specified classical bit in qiskit?,,1,0,,,,CC BY-SA 4.0 +13173,2,,8274,8/5/2020 4:02,,2,,"

I cannot add a comment, but I have a little question to the answer, sorry.

+

Why exactly $-\pi/2$ (with minus) is a parameter of the cU1 gate in your circuit? +Isn't e.g. $\pi/2$ (without minus) appropriate?

+",12416,,9006,,8/5/2020 6:57,8/5/2020 6:57,,,,2,,,,CC BY-SA 4.0 +13174,1,13178,,8/5/2020 6:07,,1,66,"

Let's say I have the state of the system of 2 qubits: $\frac{1}{\sqrt{3}}|00\rangle+\frac{2}{\sqrt{3}}|10\rangle$, and I want to measure it in the standard basis. How would I write it mathematically? What is the $n$ number of qubits version of it?

+",2559,,9006,,8/5/2020 6:59,8/5/2020 7:18,What is the matrix for measuring a superposition of general number of qubits in standard basis?,,1,0,,,,CC BY-SA 4.0 +13175,2,,8326,8/5/2020 6:16,,3,,"

Yes it is possible! +However you need to make some small changes to the circuit. In the paper An Experimental Study of Shor's Factoring Algorithm on IBM Q

+

They have factored 12,21 and 35 using something called the Kitaev approach. In Shor's algorithm, you perform the QFT in such a manner that the entire answer is given to you at once. However if you instead have a circuit where bit of the answer is given out one at a time, you can drastically reduce the number of required qubits. For example in this paper the number 15 is factored using only 5 qubits. Actually all experimental implementations of Shor's algorithm have been using the Kitaev approach, as otherwise far too many qubits are needed.

+",11857,,9006,,8/5/2020 6:56,8/5/2020 6:56,,,,0,,,,CC BY-SA 4.0 +13176,2,,13097,8/5/2020 6:40,,1,,"

I shall explain taking the case of a = 2. The process is the same for any other value of a you have mentioned.

+

So to factor N = 15, you need the gates $U^4$, $U^2$ and $U^1$ gates. Where U performs the following operation +$ U|y\rangle = |ya \: \text{mod} \: N\rangle $
+$ U^2|y\rangle = |ya^2\: \text{mod} \:N\rangle $
+$ U^4|y\rangle = |ya^4\: \text{mod} \:N\rangle $

+

We first apply $U^4$ then $U^2$ and finally $U^1$. I am assuming that you are aware that we start Shor's algorithm by giving an input $|1\rangle$ to $U^4$ which simply performs $|16\: \text{mod} \:15\rangle = |1\rangle$. Actually if you try out all the possible input values you will realise that $U^4$ is actually an identity operation.

+

For $U^2$, the operation performed is $U^2|1\rangle = |4\: \text{mod} \:15\rangle = |4\rangle$. Now in shors algorithm the size of the register on which U acts is 4 qubits (for N = 15, as 4 qubit are needed to represent 15, size of register is $log_2(n)$). So $|1\rangle$ is represented by 0001 and similarly $|4\rangle$ by 0100. Therefore we need to swap 1st and third row. This is the general procedure.

+

Now the two possible kets which may enter $U$ are $|1\rangle$ and $|4\rangle$. So you need to be able to map them to $|2\rangle$ and $|8\rangle$ respectively. Which is a mapping from 0001 and 0100 to 0010 and 1000 respectively. Hence the first mapping demands swapping of bits 1 and 2 and the second mapping demands swapping qubits 3 and 4. This is the process of designing these gates. In your question you have talked about U gate. You can either create $U^2$ by applying U twice or by the method I have described above. Hope this helps!

+",11857,,16092,,6/15/2021 1:08,6/15/2021 1:08,,,,0,,,,CC BY-SA 4.0 +13177,2,,12365,8/5/2020 6:47,,1,,"

All your real parts and imaginary parts are interchanged. Have you used complex(1,0) instead of complex(0,1) or something similar? Without the code one can only guess. Hope you can resolve it.

+",11857,,,,,8/5/2020 6:47,,,,0,,,,CC BY-SA 4.0 +13178,2,,13174,8/5/2020 7:18,,2,,"

For measuring 2 qubits, there are 4 possible outcomes, corresponding to projectors +$$ +P_{00}=|00\rangle\langle 00|,\qquad P_{01}=|01\rangle\langle 01|,\qquad P_{10}=|10\rangle\langle 10|,\qquad P_{11}=|11\rangle\langle 11|. +$$ +So, if you have a state $|\psi\rangle$, you get the outcome $x$ with probability $p_x=\langle\psi|P_x|\psi\rangle$.

+

This immediately generalises to $n$ qubits where you have $2^n$ possible outcomes $x\in\{0,1\}^n$ using $P_x=|x\rangle\langle x|$ and $p_x=\langle\psi|P_x|\psi\rangle$.

+",1837,,,,,8/5/2020 7:18,,,,1,,,,CC BY-SA 4.0 +13179,1,,,8/5/2020 8:23,,3,70,"

In this paper on quantum Ising model dynamics, they consider the Hamiltonian +$$\mathcal{H} = \sum_{j < k} J_{jk} \hat{\sigma}_{j}^{z}\hat{\sigma}_{k}^{z}$$ +and the correlation function +$$\mathcal{G} = \langle \mathcal{T}_C(\hat{\sigma}^{a_n}_{j_n}(t_n^*)\cdot\cdot\cdot \hat{\sigma}^{a_1}_{j_1}(t_1^*)\hat{\sigma}^{b_m}_{k_m}(t_m) \cdot\cdot\cdot \hat{\sigma}^{b_1}_{k_1}(t_1)) \rangle$$ +where $a,b= \pm$ and the time dependence of the Heisenberg picture +$$\hat{\sigma}_{j}^{a}(t) = e^{it\mathcal{H}}\hat{\sigma}_{j}^{a}e^{-it\mathcal{H}}$$ +where the time ordering operator $\mathcal{T_C}$ orders operators along a closed path $\mathcal{C}$.

+

Question: +Can anyone see the reasoning behind the subsequent statement on page 6:

+
+

If an operator $\hat{\sigma}^{a=\pm}_{j}$ occurs in $\mathcal{G}$ one or more times, the operator $\hat{\sigma}^{z}_{j}$ (appearing in the time evolution operator) is forced to take on a well defined value $\sigma_{j}^{z}(t)$ at all points in time.

+
+

I understand why it would be well-defined for all times after $t_1$ (denoting the first occurrence of the operator $\hat{\sigma}^{a=\pm}_{j}$) since this results in the state on site $j$ being an eigenstate of $\hat{\sigma}_{j}^{z}$, hence it commutes with the Ising Hamiltonian above. But surely before $t_1$ the state on site $j$ could be in any spin orientation and hence would be affected by the Ising interaction?

+

Thanks for any assistance.

+",2032,,55,,8/27/2020 12:54,8/27/2020 12:54,Quantum Ising model correlation function query,,0,0,,,,CC BY-SA 4.0 +13181,1,13182,,8/5/2020 13:04,,0,495,"

I am running a standard VQE from the example shown in here https://qiskit.org/textbook/ch-applications/vqe-molecules.html, however I keep getting this output constantly (as many times the vqe runs which is a lot).

+
DeprecationWarning: The Python built-in `round` is deprecated for complex scalars, 
+and will raise a `TypeError` in a future release. Use `np.round` or `scalar.round` 
+instead.
+
+

is there any way to suppress this without suppressing the entire python terminal as I need the output for other things.

+",12862,,55,,8/6/2020 8:34,8/6/2020 8:34,Suppress deprecation warnings from Qiskit,,2,0,,,,CC BY-SA 4.0 +13182,2,,13181,8/5/2020 13:27,,1,,"

You can add the following before running the VQE to suppress the deprecation warning

+
import warnings
+warnings.filterwarnings('ignore', category=DeprecationWarning)
+# run VQE here
+
+

That turns all the deprecation warnings off, if you want to turn them on again you can add

+
warnings.filterwarnings('always', category=DeprecationWarning)
+
+

I don't think there is a way to turn off just Qiskit's deprecation warnings.

+",9800,,,,,8/5/2020 13:27,,,,2,,,,CC BY-SA 4.0 +13183,2,,13171,8/5/2020 13:55,,3,,"

c_if must be used on an entire ClassicalRegister. However, it is still possible to use it on a single classical bit. You would need to create a ClassicalRegister of size 1, and attach that to your circuit. This would be the register that you input into the c_if call.

+
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
+
+c1 = ClassicalRegister(1)
+c3 = ClassicalRegister(3)
+q4 = QuantumRegister(4)
+qc = QuantumCircuit(q4, c3)  # Instantiate with one of the classical registers 
+qc.add_register(c1) # Add the other classical register
+
+qc.x(0)
+qc.measure(range(4), range(4)
+qc.x(0).c_if(c1, 1)  # Add an X-Gate if the classical register c1 outputs 1
+
+

Do note though, using c_if is not supported on the real hardware, so you would only be able to run this circuit on the simulator.

+",6180,,,,,8/5/2020 13:55,,,,0,,,,CC BY-SA 4.0 +13185,2,,13181,8/5/2020 14:40,,1,,"

@Cryoris answer is perfectly valid, but a more "Pythonic" way of doing this is with the help of the with keyword:

+
import warnings
+
+with warnings.catch_warnings():
+    warnings.filterwarnings("ignore", category=DeprecationWarning) 
+    # Run VQE here, respect the identation.
+# /!\ At this level of identation, warnings are no longer ignored.
+# No need to think to call another method afterwards.
+
+

The issue with this code being that you ignore all the deprecation warnings. If you want to only ignore the one that bother you, add a filter:

+
import warnings
+
+with warnings.catch_warnings():
+    warnings.simplefilter("ignore", 
+                          category=DeprecationWarning, 
+                          message=(
+                                 "The Python built-in round is deprecated for complex "
+                                 "scalars, and will raise a TypeError in a future release. "
+                                 "Use np.round or scalar.round instead."
+                             ) 
+                         ) 
+    # Run VQE here, respect the identation.
+# /!\ At this level of identation, warnings are no longer ignored.
+# No need to think to call another method afterwards.
+
+

This answer has been constructed from this other answer and the warnings module documentation.

+

I tested with

+
import warnings
+def f():
+    warnings.warn("The Python built-in round is deprecated for complex scalars, and will raise a TypeError in a future release. Use np.round or scalar.round instead.", DeprecationWarning)
+    
+with warnings.catch_warnings():
+    warnings.filterwarnings("ignore", 
+                          category=DeprecationWarning, 
+                          message=(
+                                 "The Python built-in round is deprecated for complex "
+                                 "scalars, and will raise a TypeError in a future release. "
+                                 "Use np.round or scalar.round instead."
+                             ) 
+                         ) 
+    print("In 'with' block:")
+    f()
+    print("Done")
+print("Out of 'with' block:")
+f()
+print("Done")
+
+

that prints

+
In 'with' block:
+Done
+Out of 'with' block:
+-c:2: DeprecationWarning: The Python built-in round is deprecated for complex scalars, and will raise a TypeError in a future release. Use np.round or scalar.round instead.
+Done
+
+

in my IPython session. You can check that the warning has been filtered within the with block and not filtered outside of it.

+",1386,,,,,8/5/2020 14:40,,,,0,,,,CC BY-SA 4.0 +13186,1,13188,,8/5/2020 16:27,,1,111,"

As the title says, I am asking myself is there is a specific function which returns the type of something. Ideally, I would work as follows :

+
let a = 4.0;
+Message(Type(a));
+
+

This would print :

+
double
+
+

Is there anything similar to this ? I tried to look at the api, but didn't find anything, I could definitely have missed something there.

+",8746,,,,,8/5/2020 19:28,Is there a Q# funtion which returns the type of a variable?,,1,0,,,,CC BY-SA 4.0 +13188,2,,13186,8/5/2020 19:28,,4,,"

No, there isn't. We are avoiding having the means for types to impact the program flow, but I'd be interested to hear what the use case is. If is it only a matter of wanting to print the type rather than getting something that can be used within the program, then that is certainly something we could cover in the future (please consider making a feature request).

+",12864,,,,,8/5/2020 19:28,,,,5,,,,CC BY-SA 4.0 +13189,1,13190,,8/5/2020 20:22,,1,50,"

I am working with multiple operations and used partial application in different cases in Q#. I have 2 questions :

+
    +
  • Can a partial applicated operation be passed as an argument ?
  • +
  • Lets say you have an operation with 3 parameters. Can you first fill one argument, store it, fill another argument, store it, and then finally call the operation by filling the last argument ?
  • +
+

Of course, I you need clarifications, I will comment and edit appropriately. Thanks for reading !

+",8746,,,,,8/5/2020 20:55,Usage of partial application in Q#,,1,0,,,,CC BY-SA 4.0 +13190,2,,13189,8/5/2020 20:55,,2,,"
+

Can a partial applicated operation be passed as an argument ?

+
+

Yes.

+

For example, let's say you want to pass an argument of type (Qubit => Unit) (an operation applied to a single qubit, say, a gate), and you want to get it by using Ry gate with a fixed rotation angle parameter. The signature of Ry operation is operation Ry (theta : Double, qubit : Qubit) : Unit, so its type is ((Double, Qubit) => Unit). If you use partial application to define a new operation

+
let RyHalfPi = Ry(PI() / 2.0, _);
+
+

the signature of the new operation will be (Qubit => Unit) (since you already defined the first parameter), and it will behave as an operation that takes a single qubit parameter for all purposes, including passing it as an argument.

+
+

Can you first fill one argument, store it, fill another argument, store it, and then finally call the operation by filling the last argument ?

+
+

Yes, in exactly the same way as in the first case!

+

If, for example, you want to use R1Frac gate with signature (Int, Int, Qubit) : Unit, you can first fill in the numerator:

+
let R1Frac10 = R1Frac(10, _, _);
+
+

to get operation with signature (Int, Qubit) : Unit, and then fill in the power to get a single-qubit gate:

+
for (power in 0 .. 1 << 10) {
+    let R1Frac10Power = R1Frac10 (power, _);
+    // ...
+}
+
+

You can also fill in parameters out of order (not necessarily left to right like I did in the example), following the same principle: you'll get an operation which takes all leftover (unsupplied) arguments in the order in which they are left.

+
    +
  • You can check the testing harnesses of the Quantum Katas for more examples - they use partial application quite extensively to use unified testing harness for tasks with slightly different operation signatures.
  • +
+",2879,,,,,8/5/2020 20:55,,,,4,,,,CC BY-SA 4.0 +13191,2,,13140,8/5/2020 21:43,,3,,"

Like many ideas in quantum information theory, I think this is best understood using a $2$-party communication scenario. Suppose Alice has a classical random variable, $X$ which can take values $1,2, \cdots, k$ with probabilities $p_{X}(1), p_{X}(2), \cdots, p_{X}(k)$. Alice then encodes this information by encoding the classical index $j$ in the state $\rho^{j}$. One can represent this scenario as a classical ensemble, $\mathcal{E} = \{ p_X(j), \rho^{j} \}_{j=1}^{k}$ (note that the set $\{\rho^j\}$ is, per se, not mutually orthogonal). For convenience, let's explicitly keep the classical index $j$ by representing this as a classical-quantum state (where the classical index $j$ is correlated to the state $\rho^{j}$ that carries its information) +$$ \sigma = \sum\limits_{j=1}^{k} p_X(j) | j \rangle_{X} \langle j | \otimes \rho^{j}. $$

+

Now, Alice sends this state to Bob, whose task is to determine the classical index $j$ by performing some (optimal) measurement on the state. On some thought, it becomes clear that this is equal to the maximum mutual information of this ensemble. Define, +$$ I_{\mathrm{acc}}(\mathcal{E})=\max _{\left\{\Lambda_{y}\right\}} I(X ; Y), $$ +where $\{ \Lambda_{y} \}$ is a POVM and $Y$ is a random variable corresponding to the outcome of the measurement. This quantity $I_{\mathrm{acc}}(\mathcal{E})$ is called the accessible information of the ensemble $\mathcal{E}$. Now, in general, one has +$$ I_{\mathrm{acc}}(\mathcal{E}) \leq \chi(\mathcal{E}) $$ +where +$$ \chi(\mathcal{E}) \equiv H\left(\rho_{B}\right)-\sum_{x} p_{X}(x) H\left(\rho_{B}^{x}\right) $$ +is the Holevo information --- but this is where out classical-quantum state will become useful. Interestingly, for classical-quantum states, the Holevo information is equal to the mutual information. That is, +$$ \chi(\mathcal{E})=I(X ; B)_{\sigma}, $$ +which, when combined with the following (simple) bound: +$$ I(X;Y) \leq \log \left( \mathrm{dim}(\mathcal{H}) \right), $$ +gives us the desired result. Note that the $\mathrm{dim}(\mathcal{H})$ is the Hilbert space where the states $\{\rho^j\}$ belong.

+

To make the final result transparent, it is instructive to ask what kind of states will saturate this upper bound on the mutual information (and in turn the accessible information). This would correspond to the case where the maximum amount of information can be encoded and accessed from this protocol. It is a simple exercise to show that this happens when the set $\{ \rho_{j} \}$ is mutually orthogonal and hence all states $\rho^j$ are distinguishable. Now, if $k=2^n$, say, for example, because the random variable takes values in $n$-bit strings, then, we need, $\mathrm{dim}(\mathcal{H}) = 2^n$, which can be achieved by choosing states from an $n$-qubit space, $\mathcal{H} \cong (\mathbb{C}^{2})^{\otimes n}$. Therefore, if we want to classically encode (and retrieve) $n$-bits, then we need $n$-qubits. Vice versa, $n$-qubits can contain at most $n$-bits of information.

+

A few remarks:

+
    +
  1. You don't need to store information in $n$-qubits. You can store the information in any $k$-dimensional quantum system (I'm pointing this out because the tensor product structure of the qubit space plays no role in this protocol, it might as well be a single-particle space with $k$-levels).
  2. +
  3. The key constraint comes from the ability to successfully retrieve information, which requires the states to be distinguishable.
  4. +
+

More details can be found in Section 11.6 of Mark Wilde's book.

+",1108,,1108,,8/7/2020 3:21,8/7/2020 3:21,,,,3,,,,CC BY-SA 4.0 +13192,1,,,8/6/2020 5:23,,0,49,"

+

+

The simulation result is 111, but the actual result is 000 001 010 011 100 101 110 111

+",12866,,,,,8/12/2020 7:33,The results of Toffoli gate are quite different from those of simulation,,1,0,,8/12/2020 15:51,,CC BY-SA 4.0 +13193,2,,13192,8/6/2020 5:36,,1,,"

This problem is caused by noise in quantum circuit. When you use a simulator, usually there is no noise (unless it is simulated), so you have ideal quantum computer. However, in reality, a quantum processor is influenced by thermal and electromagnetic noise. Current challenge for quantum computer designers it to shield the noise from qubits.

+

Qubits also suffer from decoherence. This means that qubits randomly change state from 0 to 1 (spontaneous excitation) or from 1 to 0 (spontaneous relaxation). Additionally the qubits phase can also change. Of course, decoherence is connected with noise, however, quantum nature of qubits also causes the decoherence. This is also chalange for the designers - to avoid decoherence as much as possible and enlong the time the qubits work as expected.

+

Try to increase number of shot for algorithm run on actual quantum computer. It can help to get "better" results. Also, try to run the algorithm on different backends.

+
+

EDIT (Comments added by JSdJ):

+

Decoherence is not really spontaneous excitation or relaxation, it has more to do with the degrading of the relative phase of the qubit; to some extent it's the process that destroys the thing in the qubit what makes it 'quantum'. Spontaneous relaxation is also known as amplitude damping, and is a much larger problem than spontaneous excitation.

+

Moreover, the noise apparent in these results is more a result of the imperfect gates rather than the degradation of the qubits themselves (which would also be apparent if they were idle). Noise stemming from imperfect gates is tricky and doesn't normally allow such a 'clean' noise model as the deph. or amp. channel. It will also greatly depend on the actual system that is being used. As a last note, if you increase the number of shots in the actual computation, this will not limit the intrinsic noise in the quantum system. It will diminish the effect of statistical noise, however

+",9006,,9006,,8/12/2020 7:33,8/12/2020 7:33,,,,4,,,,CC BY-SA 4.0 +13194,1,,,8/6/2020 7:21,,4,310,"

I've been following this website to check out how parameter-shift works for calculation of gradients for backpropagation in Variational Quantum Machine Learning Circuits

+

Most of it made makes sense until I got to the example part where they started explaining how one could calculate the gradient in case of a Pauli gate:

+
+

$$ U_i(\theta_i) = exp(-i\frac{\theta_i}{2}\hat P_i) $$

+
+
+

The Gradient of this unitary is: +$$ \nabla_{\theta_i}U_i(\theta_i) = -\frac{i}{2}\hat P_i U_i(\theta_i) = -\frac{i}{2}U_i(\theta_i)\hat P_i $$

+
+

which makes sense, the problem starts with the following sentence:

+
+

Substituting this into the quantum circuit function $f(x;\theta_i)$, we get: +$$ \nabla_{\theta_i}f(x;\theta) = \frac{i}{2} \langle \psi_{i-1}|U_i^{\dagger}(\theta_i)(P_i \hat B_{i+1} - \hat B_{i+1}P_i)U_i(\theta_i)|\psi_{i-1}\rangle$$ +where $f(x;\theta)$ was given by the following: +$$ \langle 0 | U_0^{\dagger}(x)U_i^{\dagger}(\theta_i)\hat BU_i(\theta_i)U_0(x)|0\rangle$$

+
+

Now I have no idea how that came to be, what am I missing?

+",10376,,55,,8/14/2020 6:29,8/14/2020 6:29,Calculating gradient of a gate using Parameter shift rule,,0,1,,,,CC BY-SA 4.0 +13195,1,13290,,8/6/2020 11:10,,0,246,"

I was reading about the Grover Search algorithm on https://qiskit.org/textbook/ch-algorithms/grover.html#example. I understood the method but I have a few questions. My question regards the two-qubit case.

+

Does the diffusion operator $D=2|s\rangle\langle s|-1$, depend upon the initial state i.e $|+\rangle|+\rangle$ and the marked state?

+

Actually I was reading an article https://journals.aps.org/pra/pdf/10.1103/PhysRevA.68.022306, which had an equation +\begin{equation} +-U_{S_j}|S_j\rangle_{w}=|w\rangle +\end{equation} +with $U_x=1-2|x\rangle\langle x|$, $S_1=\left(\dfrac{0+1}{\sqrt{2}}\right)^{\otimes 2}$, and $w$ is the marked state. The other $S_{j's}$ can be the states for instance $|+\rangle|-\rangle$, $|-\rangle|-\rangle$, $|-\rangle|+\rangle$ etc. with total such $S_j$ being $16$. My question is how does one make the diffusion operator for a state $|+\rangle|-\rangle$. As an example from the table in the article it states for instance if $j=2$, $S_2=|+\rangle|-\rangle$ +$$-U_{S_2}|S_1\rangle_{10}=-|00\rangle,$$ +where $10=w$ is the marked state. +Can somebody explain how this equation came? can somebody atleast hint at some references?

+",6070,,55,,8/14/2020 6:37,8/14/2020 6:37,Grover search with different diffusion operators,,1,0,,,,CC BY-SA 4.0 +13196,1,,,8/6/2020 15:10,,3,74,"

Given a pure two qubit state $|\psi_{AB}\rangle$. If we trace out system $B$, the remaining density matrix $\rho_A = Tr_B|\psi_{AB}\rangle\langle\psi_{AB}|$, can be represented as a point lying anywhere on or inside a Blochsphere.

+

When you're on the Bloch sphere you have a separable state; when you're in the center, your state is maximally entangled. So by entanglement you can affect the distance from the center.

+

How do have to steer (by applying timevarying unitaries $U(t)$) the composite system $|\psi_{AB}\rangle$, such that the resulting trajectory on or inside the Bloch sphere of system $A$ is an ellipse? +$$ +\rho_A(t)=Tr_B \left( U(t)|\psi_{AB}\rangle\langle\psi_{AB}|U'(t)\right) \sim\pmatrix{x(t)\\y(t)\\z(t)}_{\text{Bloch}_A} \text{ with } \frac{x^2(t)}{a^2}+\frac{y^2(t)}{b^2}=1 +$$

+",5280,,5280,,8/7/2020 9:39,8/10/2020 16:21,Reduced Density Matrix Equation of Motion to describe an Ellipse,,0,7,,,,CC BY-SA 4.0 +13198,1,,,8/6/2020 17:52,,7,4181,"

The formal definition states that it's the distance between two quantum states. What does that mean experimentally? Does distance here mean the distance between two states on the Bloch Sphere? I am a little confused about the meaning of gate fidelity.

+",7856,,55,,5/12/2022 8:06,5/12/2022 8:06,What does quantum gate fidelity mean?,,3,1,,,,CC BY-SA 4.0 +13199,1,,,8/6/2020 18:40,,1,96,"

I am trying to think about quantum noise visually here. If, for example, one wants to implement an X-gate to perform a 180-degree rotation around the Bloch Sphere. In a perfect world, the X-gate will move the quantum state from the |0> state to the |1> state.

+

My question is, how does the existence of noise affect the implementation of gates (i.e. the X-gate)?

+

Does it make the quantum state rotate some angle that's is slightly greater than or smaller than 180 degrees? In short, how can one visualize noise on the Bloch Sphere?

+",7856,,55,,8/10/2020 6:15,8/10/2020 7:54,How does noise affect the implementation of quantum gates?,,1,1,,,,CC BY-SA 4.0 +13200,1,,,8/6/2020 19:15,,0,69,"

I have an array of qubits, with indices to represent each such that if we have 3 qubits, we have 0, 1, 2 representing each. From here I would like to measure the probability of our qubits after running it through some gates. How can I grab these probabilities and spit out one of the indices based on which has the highest probability?

+

Cheers!

+",12239,,,,,8/7/2020 4:25,How can I mesure a register of qubits and grab the index of the qubit with the highest probability in Q#?,,1,6,,,,CC BY-SA 4.0 +13201,1,13207,,8/7/2020 2:12,,1,124,"

I'm just curious. Say I have 3 qubits on a straight line 0-1-2. How do you guys (on the IBMQ or Rigetti team for example, or anyone who actually works on quantum computer) entangle 0-2 if I, say, am busy on the 1 qubit already (maybe I already have a CNOT between 0-1)? Is there a circuit for it, or is it purely hardware technique with no circuit equivalent? Say if I have:

+
2-1-0-3
+    | |
+    4-5
+
+

would it be better to CNOT 0 with 2, or 0 with 5, given that they have the same distance? Thank you!

+",7598,,55,,8/10/2020 6:14,8/10/2020 6:14,How do you CNOT between qubits faraway from each other?,,2,1,,,,CC BY-SA 4.0 +13202,1,13226,,8/7/2020 2:20,,2,1410,"

Is there a way in Qiskit to initialize $n$ qubits with binary values (0s and 1s)? For example, how can I initialize two qubits in the state $|11\rangle$? Here is a code snippet:

+
from qiskit import QuantumCircuit
+import numpy as np
+
+n = 2
+circuit = QuantumCircuit(n, n)
+
+# Seeking some sort of initialization routine like this
+circuit.initializeQubits(initialState=np.ones(n), ...)   
+
+# Define rest of the circuit
+...
+
+

I am aware of the method in this tutorial, which is also referenced here and here. This method creates an arbitrary qubit state by defining an $N$ dimensional ($N = 2^n$) state vector of amplitudes. The problem with this method is it requires creating a state vector which is exponentially large. I'm trying to initialize the qubits by defining an $n$ dimensional binary vector, which for the above example would be [1, 1].

+",12614,,9118,,10/26/2020 18:31,10/26/2020 18:31,Qiskit: Initializing $n$ qubits with binary values ($0$s and $1$s),,5,1,,,,CC BY-SA 4.0 +13203,1,13204,,8/7/2020 3:22,,1,55,"

According to Quantum threshold theorem, error rate can be arbitrarily low. But when I use IBM Quantum Experience to measure a simple $|+\rangle$, it gives result of $|1\rangle$ with probability of 52.148%.

+",12876,,,,,8/7/2020 4:12,Dose Quantum threshold theorem apply to IBM Quantum Experience,,1,0,,,,CC BY-SA 4.0 +13204,2,,13203,8/7/2020 4:12,,2,,"

I'm not sure what your specific question is - the IBM Q processor does not implement an error correction scheme by default, so the theorem doesn't apply.

+

Furthermore, the statistic provided in the Wikipedia page suggests this chip would be incapable of sufficiently depressing the error rate:

+
+

At a 0.1% probability of a depolarizing error, the surface code would require approximately 1,000-10,000 physical qubits per logical data qubit

+
+

IBM's chips have 10-20 qubits, and your own figures indicate an error rate of >2%, so you'd either need significantly reduced error rates or significantly increased qubit volume.

+",8343,,,,,8/7/2020 4:12,,,,0,,,,CC BY-SA 4.0 +13205,2,,13200,8/7/2020 4:25,,1,,"

One potential strategy is to probabilistically estimate the qubits' probabilities. Here's some pseudocode:

+
counts = Int[NumberOfQubits]
+for counter in trials:
+   ApplyOperationToArray
+   results = MeasureArray
+   AddResults(results, counts)
+idx = maxIdx(counts)
+
+

As mentioned in the comments, we cannot ascertain which qubit has the highest probability by the no-cloning theorem. However, this approach also has limitations - namely, the computation will always have a chance for failure!

+",8343,,,,,8/7/2020 4:25,,,,0,,,,CC BY-SA 4.0 +13206,2,,13202,8/7/2020 7:20,,0,,"

Qiskit assumes that initially each qubitt is set to the $|0\rangle$ state. So if you have $n$ qubits, the initial state is $|00..0\rangle$. If you want to flip the state of some specific qubits, you have to apply an $X$ gate to each of those specific qubits. For example, the following code sets the $|11\rangle$ state:

+
qr = QuantumRegister(2)
+cr = ClassicalRegister(2)
+circuit = QuantumCircuit(qr, cr, name='mycircuit')
+circuit.x(qr[0])
+circuit.x(qr[1])
+
+",5551,,,,,8/7/2020 7:20,,,,0,,,,CC BY-SA 4.0 +13207,2,,13201,8/7/2020 7:36,,2,,"

If you don't have the ability to perform the controlled-not directly between a pair of qubits, then you simply need to swap the qubits to place them onto a pair of qubits which can have a controlled-not applied to them.

+",1837,,,,,8/7/2020 7:36,,,,0,,,,CC BY-SA 4.0 +13208,1,13209,,8/7/2020 9:57,,3,104,"

Assume a composite quantum systes with state $|\psi_{AB}\rangle$ or better $\rho=|\psi_{AB}\rangle\langle\psi_{AB}|$. I want to know the state of system $A$ only, i.e. $\rho_A$.

+

Is there any difference if I trace out system $B$, i.e. $\rho_A=Tr_B\rho$ compared to building up $\rho_A$ from projections on the Pauli operators, i.e. $\displaystyle\rho_A=\sum_{k=1,x,y,z}Tr\big((\sigma_k\otimes 1\big)^\dagger \rho)\sigma_k$.

+

Some numerics indicate, that this is the same...

+",5280,,55,,8/7/2020 12:41,8/7/2020 12:41,Is the partial trace $\mathrm{Tr}_B(\rho)$ equal to $\sum_k \mathrm{Tr}[(\sigma_k\otimes I)^\dagger \rho]\sigma_k$?,,1,1,,,,CC BY-SA 4.0 +13209,2,,13208,8/7/2020 10:06,,4,,"

They are exactly the same. Remember that you can write +$$ +\rho=\sum_{i,j}\rho_{ij}\sigma_i\otimes\sigma_j. +$$ +If you take the partial trace, you have +$$ +\rho_A=\sum_{i,j}\rho_{ij}\sigma_i \text{Tr}(\sigma_j). +$$ +$\text{Tr}(\sigma_j)=0$ unless $j=0$, i.e. the identity operator. Thus, we can write +$$ +\rho_A=\sum_i2\rho_{i0}\sigma_i, +$$ +and of course we can calculate +$$ +2\rho_{i0}=\text{Tr}((\sigma_i\otimes I)\rho). +$$

+",1837,,,,,8/7/2020 10:06,,,,6,,,,CC BY-SA 4.0 +13210,1,,,8/7/2020 11:55,,2,533,"

I am currently reading https://arxiv.org/abs/1501.03099.

+

In the third part of the paper, "Measuring and detecting quantumness", the authors define the SWAP operators, use them on the initial state $\rho_a \otimes \rho_a \otimes \rho_b\otimes \rho_b $ and take the trace.

+ +

Now, I know that $\mathrm{Tr}(\rho_a \otimes \rho_b)$ = $\mathrm{Tr}(\rho_a)\mathrm{Tr}(\rho_b)$ according to the property of the Trace operator on a product state. +Does this mean that the SWAP operator acting on these two qubits must also preserve the trace?

+

Therefore if my interpretation is correct, I have two questions regarding this.

+
    +
  1. Why would the SWAP operator $S_{CD}$ change the whole system state as the states of the qubits C and D are the same in equation (12)?

    +
  2. +
  3. How is the trace in equations (12) and (13) different if the SWAP operators must preserve trace? And how do these equations hold?

    +
  4. +
+",12560,,55,,8/9/2020 5:18,8/9/2020 5:36,Can SWAP operators change trace of a product state?,,1,5,,8/9/2020 18:37,,CC BY-SA 4.0 +13211,2,,13201,8/7/2020 11:55,,2,,"

For interactions between non-nearest neighbour qubits, ancilla qubits are required, together with SWAP gates. The state of one of the (in this case) two qubits is swapped with the ancilla. This operation is repeated until the qubits are NN, and then the interaction can take place. After this is done, then the state of the ancilla is swapped back with the desired qubit, which from this point on will now have the resultant state from the interaction encoded on it.

+

It is due to the NN restrictions on must current QC's that circuit depth can explode relative to the amount of qubits or interactions, and then the overall runtime becomes and issue due to decoherence.

+",4991,,,,,8/7/2020 11:55,,,,0,,,,CC BY-SA 4.0 +13212,1,,,8/7/2020 13:09,,4,267,"

I'm inspired by [1] which clearly lays out near term applications of quantum computing: optimization, simulation and sampling. They claim that quantum sampling is likely to be the first application that achieves quantum supremacy "Our calculations show that, for relatively small circuits involving high-fidelity quantum gates, it will be possible to sample from probability distributions that are inaccessible classically, using a circuit of just 7 × 7 qubits in layers that are around 25 deep"

+

However, the authors only loosely describe potential applications of quantum sampling, viz. "inference and pattern recognition in machine learning". Can anyone describe the utility of quantum sampling in further depth?

+

[1] Mohseni, M., Read, P., Neven, H., Boixo, S., Denchev, V., Babbush, R., ... & Martinis, J. (2017). Commercialize quantum technologies in five years. Nature, 543(7644), 171-174.

+",12878,,55,,8/10/2020 8:01,8/10/2020 8:01,What are known applications of quantum sampling?,,1,2,,,,CC BY-SA 4.0 +13213,1,13227,,8/7/2020 13:41,,3,70,"

I am learning Q# so, as I often do, I am writing some unit tests to play with quantum gates. +I was able to write these tests for X gate:

+
    @Test("QuantumSimulator")
+    operation XGateAppliedToZeroShouldTransformIntoOne() : Unit {
+        
+        using (q = Qubit()) {
+            X(q);
+            Assert([PauliZ], [q], One, "X gate transform |0> state in |1> state.");
+
+            X(q);
+            Assert([PauliZ], [q], Zero, "X gate transform |1> state in |0> state.");
+        }
+        
+        Message("Test passed.");
+    }
+
+

I am wondering how to write similar tests for the H gate: from what I know it will put the system in a superposition state that will give me 0 or 1 with a probability of 50%. How can I test an expected probability? Am I completely in the wrong direction here?

+",12873,,55,,8/8/2020 18:34,8/8/2020 18:34,Testing superposition states in Q#,,2,1,,,,CC BY-SA 4.0 +13214,2,,13213,8/7/2020 15:18,,2,,"

Welcome Daniele! It's a fantastic question - some forms of physical hardware can measure on different axis', so you could verify the qubit state by measuring with the $| + \rangle $ and $ |-\rangle$ basis states (and, if you got $|+\rangle$ with high probability, you could assume $H |0\rangle \mapsto |+\rangle$).

+

In Q#, I don't believe this has yet been implemented. Some alternative approaches include:

+
    +
  • Measuring the qubit directly over many trials, expecting about a 50/50 probability of getting 0 or 1.
  • +
  • If you have verified the $X$ gate, you could perform $ HZH $ and ensure it behaves like $X$.
  • +
  • If you have verified the $X$ gate, you could perform $HXH$ on $|0\rangle$ and ensure it always returns $|0\rangle$.
  • +
+

For Q# programming, you can probably trust the programmers/quantum runtime! But you open up a great secondary question- how would we verify a real quantum chip, especially because we can't just ask the universe for amplitudes :)

+

More broadly, verifying the validity of quantum operations is a critical but challenging task. One way, of course, is getting the right answer: if we ran a chemistry simulation and correctly predicted the molecule's bond length, we are good to go.

+

For questions without easily verifiable answers, the solutions become more challenging! For example, the approach listed where we simply randomly sample omits potential phase changes (think: $ |0\rangle \mapsto \frac{1}{\sqrt{2}}(|0\rangle + e^{i\theta} |1\rangle)$). What do we do in that case? One approach tries to reconstruct the state via a quantum neural network, but overall I think this is an active field of research with some awesome open-ended questions to be asked/answered.

+",8343,,,,,8/7/2020 15:18,,,,2,,,,CC BY-SA 4.0 +13215,2,,13198,8/7/2020 18:49,,3,,"

Fidelity is a distance measure between quantum states. The gate fidelity uses fidelity to decide how noisy a quantum gate is.

+

Take two copies of a state, apply your implementation of a gate on one copy and apply the ideal gate on another copy (this can be done on paper, not in a lab) and compute the fidelity between the two outputs. This is the gate fidelity. There are some subtleties on what state you should use in this comparison but this should be made clear by the author.

+

See the discussion in Section 4 of this paper.

+",5669,,,,,8/7/2020 18:49,,,,0,,,,CC BY-SA 4.0 +13216,2,,13066,8/7/2020 18:54,,1,,"

Classical information is stored the same way as it is for classical computers. You cannot use quantum states to store (in a retrievable way) more information that you would with classical bits.

+",55,,,,,8/7/2020 18:54,,,,0,,,,CC BY-SA 4.0 +13217,2,,13210,8/7/2020 22:32,,4,,"

The SWAP operator has been widely used to ``linearize'' polynomial functions of the density matrix. To understand this carefully, consider the following setup: Let $\mathcal{H} = \mathcal{H}_{A} \otimes \mathcal{H}_{A'}$, where $\mathcal{H}_{A} \cong \mathcal{H}_{A'}$, that is, we take two copies of the Hilbert space. The SWAP operator acting on this doubled space is defined as, +$$ +\hat{S} = \sum_{i, j}|i\rangle_{A}\langle j|\otimes| j\rangle_{A'}\langle i|. +$$ +Why is this the SWAP operator? It's easy to see from its action on product states (which is to swap them): $| ij \rangle \overset{\hat{S}}{\mapsto} | ji \rangle$.

+

Now, the simplest version of this linearization takes the form takes the form, +$$ \operatorname{Tr}\left( \rho^{2} \right) = \operatorname{Tr}\left( \hat{S} \rho \otimes \rho \right) . $$ +(The proof is straightforward, just expand the state $\rho$ and apply the definition of the SWAP operator). A slight generalization of this is $\operatorname{Tr}\left( \rho \sigma \right) = \operatorname{Tr}\left( \hat{S} \rho \otimes \sigma \right)$. This simple equation illustrates my claim of ``linearization'': we began with a quadratic function of the state but now it is in a linear form with just the trace of the product of two operators (at the expense of doubling the space). This observation can be generalized to a $m$-th order polynomial as: +$$ +\operatorname{Tr}\left\{\rho^{m}\right\}=\operatorname{Tr}\left\{\hat{S} \rho^{\otimes m}\right\}, \text{ where } \hat{S}\left|\psi_{1}\right\rangle \otimes \cdots \otimes\left|\psi_{m}\right\rangle=\left|\psi_{m}\right\rangle \otimes\left|\psi_{1}\right\rangle \otimes \cdots \otimes\left|\psi_{m-1}\right\rangle +$$ +is the cyclic shift operator (a generalization of the SWAP operator above).

+

With regard to your questions: note that +$$ \operatorname{Tr}\left( \rho^{2} \right) = \operatorname{Tr}\left( \hat{S} \rho \otimes \rho \right) \neq \operatorname{Tr}\left( \rho \otimes \rho \right) = \operatorname{Tr}\left( \rho \right) \operatorname{Tr}\left( \rho \right) = \left( \operatorname{Tr}\left( \rho \right) \right)^2 . $$ +As an example, consider any mixed state $\rho$, the $\operatorname{Tr}\left( \rho^{2} \right)$, also known as its purity is (strictly) $<1$, while it is normalized and therefore $\operatorname{Tr}\left( \rho \right) = 1$ and so the RHS is $1$. Hence, these two aren't equal.

+

In Eqns. (12) and (13) in the referenced paper, they iteratively use the SWAP on different spaces (they have four copies of the original Hilbert space) and use this to linearize expressions of the form $\operatorname{Tr}\left( \rho_{a}^{2} \rho_{b}^{2} \right)$. In particular, the SWAP doesn't preserve the trace (in the sense of the equation with the $\neq$ above) and is being used as a linerization trick.

+

Many useful tricks of this sort have been discussed in this (wonderful) paper: Measuring polynomial functions of states.

+",1108,,1108,,8/9/2020 5:36,8/9/2020 5:36,,,,0,,,,CC BY-SA 4.0 +13218,2,,13063,8/7/2020 22:53,,1,,"

Given an arbitrary classical algorithm, you can trivially convert it into a "quantum algorithm" by simply making it into a reversible circuit. There are standard ways to do this.

+

Of course, this doesn't really give you any "quantum advantage". Any quantum algorithm obtained this way will have the same efficiency as the same algorithm run on classical computer.

+

On the other hand, if the question is whether there is a standardised way to convert a given classical algorithm into a quantum one that solves the same problem more efficiently, then the answer is negative. Quantum algorithms that are more efficient than their classical counterparts do so by solving the given problem in very different ways, and there is no easy way to find such algorithms given a classical solution to the problem.

+",55,,,,,8/7/2020 22:53,,,,0,,,,CC BY-SA 4.0 +13219,2,,9222,8/8/2020 1:40,,1,,"

CW from self-answer, and also because this is more of an extended comment than an answer.

+

Let $A$ be the adjacency matrix of the Cayley graph of our group $\mathcal{H}$ of order $N$. Notice that $A$ is square-hermitian. Further let $\mathbb{I}_N$ be the $N\times N$ identity matrix.

+

It occurs to me that I am, in a sense, asking to prepare the ground state $E_0$ of $A$ - i.e. the uniform superposition over all elements of $\mathcal{H}$ - by doing an initially very slow, very lazy random walk along $A$.

+

That is, it feels like $E_0$ of $A$ is adiabatically evolved, with an "initial Hamiltonian" being $\mathbb{I}_N+\epsilon A$ which acts on $\vert e\rangle$, and a "final Hamiltonian" being $A$ itself.

+

A defining paper on adiabatic state preparation appears to be Aharanov and Ta-Shma. I believe the speed at which one could prepare $A$ by such an evolution is indeed given by spectral properties of $A$, or rather of $\mathbb{I}_N+\epsilon A$.

+

Post-selection may be a bit of a red-herring. If post-selection doesn't work out one could just lower $\epsilon$, and make the walk lazier. What seems to be more important is that the system appears to stay in some ground state, as the adiabatic theorem implies.

+",2927,,,,,8/8/2020 1:40,,,,0,,,8/8/2020 1:40,CC BY-SA 4.0 +13220,1,13222,,8/8/2020 3:45,,2,97,"

I'm trying to derive $P(\text{First qubit}=0) = \frac{1}{2} + \frac{1}{2}|⟨a|b⟩|^2$ for the swap test.

+

+

The wiki page shows one way, but the result should also be obtainable via direct expansion of the tensor products, as attempted here. Present question is about bringing this process to completion as I — rather disappointingly — wasn't able to finish the proof myself.

+

To summarize the thought process (adapted from here), let's assume we start out with:

+

$$ +|a \rangle = a_0 |0\rangle + a_1 |1\rangle \\ +|b \rangle = b_0 |0\rangle + b_1 |1\rangle \\ +|\phi_0 \rangle = |0 \rangle |a \rangle |b \rangle +$$

+

Applying $H$ to $|\phi_0\rangle$, we get:

+

$$ +|\phi_1 \rangle = H|0\rangle|a\rangle|b\rangle = \frac{1}{\sqrt{2}}|0\rangle|a\rangle|b\rangle + \frac{1}{\sqrt{2}}|1\rangle|a\rangle|b\rangle +$$

+

Applying the swap, we get:

+

$$ +|\phi_2 \rangle = \frac{1}{\sqrt{2}}|0\rangle|a\rangle|b\rangle + \frac{1}{\sqrt{2}}|1\rangle|b\rangle|a\rangle +$$

+

Applying the second H, we get:

+

$$ +|\phi_3 \rangle = H|\phi_2\rangle = \\ +\frac{1}{2}|0\rangle|a\rangle|b\rangle + \frac{1}{2}|1\rangle|a\rangle|b\rangle + \frac{1}{2}|0\rangle|b\rangle|a\rangle - \frac{1}{2}|1\rangle|b\rangle|a\rangle = +$$ +$$ +\frac{1}{2}|0\rangle \left[|a\rangle|b\rangle + |b\rangle|a\rangle\right] + \frac{1}{2}|1\rangle \left[|a\rangle|b\rangle - |b\rangle|a\rangle \right] \tag{1}\label{1} +$$

+

If we want to calculate $P(\text{First qubit}=0)$, then the interesting quantity from $|\phi_3\rangle$ is the first term of \eqref{1}:

+

$$ +\frac{1}{2}|0\rangle \left[|a\rangle|b\rangle + |b\rangle|a\rangle\right] += \\ +\frac{1}{2} \left[ +2 a_0 b_0 |0,0\rangle ++ \left( a_0 b_1 + a_1 b_0 \right) |0,1\rangle ++ \left( a_0 b_1 + a_1 b_0 \right) |1,0\rangle ++ 2 a_1 b_1 |1,1\rangle +\right] = +$$ +$$ +a_0 b_0 |0,0\rangle ++ \frac{1}{2} \left( a_0 b_1 + a_1 b_0 \right) |0,1\rangle ++ \frac{1}{2} \left( a_0 b_1 + a_1 b_0 \right) |1,0\rangle ++ a_1 b_1 |1,1\rangle \tag{2}\label{2} +$$

+

Where I used: +$$ +|a \rangle |b \rangle = +a_0 b_0 |0,0\rangle ++ a_0 b_1 |0,1\rangle ++ a_1 b_0 |1,0\rangle ++ a_1 b_1 |1,1\rangle +\\ +|b \rangle |a \rangle = +a_0 b_0 |0,0\rangle ++ a_1 b_0 |0,1\rangle ++ a_0 b_1 |1,0\rangle ++ a_1 b_1 |1,1\rangle +$$

+

Squaring the amplitudes from \eqref{2}, we get:

+

$$ +|a_0 b_0|^2 ++ \frac{1}{4} | a_0 b_1 + a_1 b_0 |^2 ++ \frac{1}{4} | a_0 b_1 + a_1 b_0 |^2 ++ |a_1 b_1|^2 = +$$ +$$ +|a_0 b_0|^2 ++ \frac{1}{2} | a_0 b_1 + a_1 b_0 |^2 ++ |a_1 b_1|^2 \tag{3}\label{3} +$$

+

I'm trying to prove that \eqref{3} equals $\frac{1}{2} + \frac{1}{2}|⟨a|b⟩|^2$ but I could not. +I tried using:

+

EDIT: The following equations do not hold, as explained by C. Kang in the answers.

+

$$ +|\langle a| b \rangle|^2 = +\langle a| b \rangle\langle a| b \rangle^\dagger = +\langle a| b \rangle\langle b| a \rangle = +\langle b| \langle a| b \rangle |a\rangle = +|a_0 b_0|^2 + |a_1 b_0|^2 + |a_0 b_1|^2 + |a_1 b_1|^2 +$$ +$$ +|a_0 b_0|^2 + |a_1 b_1|^2 = |\langle a| b \rangle|^2 - |a_1 b_0|^2 - |a_0 b_1|^2 \tag{4}\label{4} +$$

+

Substituting \eqref{4} into \eqref{3}, I got:

+

$$ +|\langle a| b \rangle|^2 - |a_1 b_0|^2 - |a_0 b_1|^2 + \frac{1}{2} | a_0 b_1 + a_1 b_0 |^2 +$$

+

But I'm not sure how to turn this into $\frac{1}{2} + \frac{1}{2}|⟨a|b⟩|^2$. Any thoughts?

+",12643,,12643,,8/8/2020 13:29,8/8/2020 13:29,Alternative derivation of $P(\text{First qubit}=0)$ for the swap test,,1,0,,,,CC BY-SA 4.0 +13222,2,,13220,8/8/2020 5:05,,1,,"

Welcome to the community Attila! I do not believe your equation 4 holds; consider the orthogonal vectors $ [\frac{i}{\sqrt{2}}, \frac{-i}{\sqrt{2}}]^T, [\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}}]^T$ - their inner product should be 0 by orthogonality, but it can been seen that each of the terms you have would be nonzero, so their sum must be nonzero.

+

The correct expansion for (4) would be: +$$ | \langle a | b \rangle |^2 = | \overline{a_0}b_0 + \overline{a_1}b_1 |^2 = (\overline{a_0} b_0 + \overline{a_1} b_1) \overline{(\overline{a_0}b_0 + \overline{a_1}b_1)} $$

+

Which, by distributivity of complex conjugation simplifies to:

+

$$ (\overline{a_0}b_0 + \overline{a_1}b_1)(a_0\overline{b_0} + a_1\overline{b_1}) = |a_0b_0|^2 + |a_1b_1|^2 + \overline{a_1 b_0} a_0 b_1 + \overline{a_0 b_1}a_1 b_0 $$

+

Let's also rewrite (3). Again, we can use the trick for the norm squared:

+

$$ |a_0 b_1 + a_1 b_0 |^2 = (a_0 b_1 + a_1 b_0)(\overline{a_0 b_1} + \overline{a_1 b_0}) = |a_0 b_1|^2 + |a_1 b_0|^2 + a_0 b_1 \overline{a_1 b_0} + a_1 b_0 \overline{a_0 b_1}$$

+

So, the entire (3) is:

+

$$ \frac{1}{2} (2|a_0 b_0|^2 + 2 |a_1 b_1|^2 + |a_0 b_1|^2 + |a_1 b_0|^2 + a_0 b_1 \overline{a_1 b_0} + a_1 b_0 \overline{a_0 b_1}) = \frac{1}{2}( |a_0 b_0|^2 + |a_0 b_1|^2 + |a_1 b_0|^2 + |a_1 b_1|^2 + |\langle a | b \rangle |^2)$$

+

Finally, recognize that $ |a_0 b_0|^2 + |a_0 b_1|^2 + |a_1 b_0|^2 + |a_1 b_1|^2 $ is actually just 1! (As it's the amplitudes of $|a \rangle |b \rangle$). Thus, we yield:

+

$$ \frac{1}{2} (1 + | \langle a| b \rangle |^2 )$$

+

As desired!

+",8343,,,,,8/8/2020 5:05,,,,8,,,,CC BY-SA 4.0 +13223,2,,12147,8/8/2020 5:38,,1,,"

This is somewhat late, but the Wikipedia page has aggregated some of the main techniques for quantum Hamiltonian simulation.

+

If you're looking for a bit more of a walkthrough (over scientific papers), Microsoft provides a good overview of both Trotteriation / Qubitization. IBM also talks about VQEs.

+",8343,,,,,8/8/2020 5:38,,,,0,,,,CC BY-SA 4.0 +13224,2,,13202,8/8/2020 7:14,,0,,"

may be you can define a function like below

+
from qiskit import QuantumCircuit
+def qubitinitialize(n,n_init):
+#n = number of qubits
+#n_init = initial state of each qubit
+    qc = QuantumCircuit(n)
+    for i in n_init:
+        if i == 1:
+            qc.x(i)
+return(qc)
+
+

This function will return a circuit with initial state as you provide in n_init

+
n = 4  #number of qubits 
+n_init = [0,0,1,0] #a bit string of qubit initialization we need 
+qc_n = qubitinitialize(n,n_init)
+qc_n.draw('mpl')
+
+

just remember that 0,1,2,3 in the bit string will convert to q3,q2,q1,q0

+",12890,,12890,,8/8/2020 7:34,8/8/2020 7:34,,,,0,,,,CC BY-SA 4.0 +13226,2,,13202,8/8/2020 9:47,,5,,"

You can also create a Statevector, that can be directly initialized as follows:

+
from qiskit.quantum_info import Statevector
+sv = Statevector.from_label('11')
+
+

You can use sv.evolve(qc) to apply an operator/circuit to the state, where qc is the operator/circuit. sv.data gives you the numpy array, containing the actual implementation of the state.

+

Check this for more details.

+",12785,,,,,8/8/2020 9:47,,,,0,,,,CC BY-SA 4.0 +13227,2,,13213,8/8/2020 17:24,,3,,"

As @JSdJ indicated in their comment, one approach is to perform the assertion in the 𝑋-basis instead of the 𝑍-basis:

+
    open Microsoft.Quantum.Diagnostics;
+
+    @Test("QuantumSimulator")
+    operation CheckThatHPreparesPlus() : Unit {        
+        using (q = Qubit()) {
+            within { H(q); }
+            apply {
+                AssertMeasurement([PauliZ], [q], Zero, "H operation did not prepare |+⟩, given input in |0⟩.");
+            }
+        }
+    }
+
+

Another approach would be to use the AssertMeasurementProbability operation, which asserts that the probability of a given hypothetical measurement is equal to an expected probability:

+
    open Microsoft.Quantum.Diagnostics;
+
+    @Test("QuantumSimulator")
+    operation CheckThatHPreparesPlus() : Unit {        
+        using (q = Qubit()) {
+            within { H(q); }
+            apply {
+                AssertMeasurementProbability(
+                    [PauliZ], [q], Zero, 0.5,
+                    "State prepared by H operation does not admit 50/50 measurement in 𝑍 basis.", 1e-8
+                );
+            }
+        }
+    }
+
+

This second approach checks a weaker condition than the asserting in the 𝑋-basis, since measuring a qubit in either the |+⟩ or |−⟩ state will result in 50/50 probabilities when measured in the 𝑍-basis, but only the |+⟩ has a 100% probability of returning a Zero when measured in the 𝑋-basis.

+

Either way, though, one thing to keep in mind is that these assertions use that they're run on a simulator to do their job. By design, these assertions can be safely stripped when run on hardware, such that the no-cloning theorem applies. As Chris Kang notes in his answer, to test that hardware does what you expect can be involve some fairly different techniques compared to using a simulator to check that your program does what you expect. There's a lot of neat research out there (that's my main area of research, for example) on how to do that — you might find quantum tomography to be an interesting place to start!

+",1978,,,,,8/8/2020 17:24,,,,0,,,,CC BY-SA 4.0 +13228,1,,,8/8/2020 17:32,,0,51,"

+

please in need some help I want to get a list of the providers in Qiskit and i use the command providers.backends() yet it says provider not defined. any suggestions. +thank you

+",11600,,55,,8/8/2020 18:35,8/10/2020 7:35,provider.backends( ) not responding in Qiskit?,,2,0,,,,CC BY-SA 4.0 +13229,2,,13228,8/8/2020 19:23,,0,,"

You need to load your IBMQ account first.

+
IBMQ.save_account("your IBMQ credentials")
+provider = IBMQ.load_account()
+provider.backends()
+
+

For more details on loading your IBMQ account checkout this video.

+",12785,,,,,8/8/2020 19:23,,,,0,,,,CC BY-SA 4.0 +13230,1,13236,,8/8/2020 19:31,,2,152,"

Within the context of Grover's algorithm,  if there are  $N/4$  elements marked instead of just one ($N = 2^n$) , if we run one iteration of Grover's algorithm (one phase inversion and one inversion about the mean ) and then measure, the probability that we see a marked element is 1 (simple calculation). 

+

I propose the following extension. 

+

The extension of Grover's algorithm. 

+

First iteration.  We use an oracle that marks  $2^{n-2} - 1$ elements (chosen at random or otherwise) plus the element x* that we are interested in.  We run one iteration of Grover and we end up with a superposition of $2^{n-2}$ marked states including  x*.

+

Second iteration.  We use another oracle that marks  $2^{n-4}-1$  elements (from the  $2^{n-2}-1$  above) and x*. We run another Grover iteration and we end up with a superposition of $2^{n-4}$  marked states including x*.

+

And so on..........

+

At the k-th step we use an oracle that marks $ 2^{n-2k}-1$  elements and x* and we end up with a superposition of  +$2^{n-2k}$  marked states, including x*.

+

We continue this process for about  O(log N ) = O(n) steps. The difference is that at each iteration we use a different oracle.  

+

At the end, when we measure we will find x* with high probability. 

+

If correct (big IF here ) this would be an exponential speedup compared to Grover.

+

Question.  What am I missing  here? Is implementation possible?

+",10110,,,,,8/9/2020 14:16,Can we use different oracles for each (extended) Grover iteration?,,2,5,,,,CC BY-SA 4.0 +13231,2,,4829,8/8/2020 23:49,,1,,"

Suppose we are given the ($n\times n$ adjacency matrix $M_0$ of graph $G_0$ and $M_1$ of graph $G_1$, and we wish to know whether $G_0\simeq G_1$. It is a folklore result that if we can prepare states:

+

$$\vert\alpha_G\rangle=\sum\limits_{\sigma\in S_n}\vert \sigma (G)\rangle,$$

+

with $S_n$ being the symmetric group on $n$ elements, we can prepare such a state for $G=G_0$ and another for $G=G_1$, and run the $\mathsf{SWAP}$ test between them, to answer the graph isomorphism problem.

+

Following the ideas of Aharonov and Ta-Shma we can propose a "quantum Zeno effect" preparation for such a state $\vert \alpha_G\rangle$.

+

That is, Aharanov and Ta-Shma speak of adiabatic state preparation in terms of this "quantum Zeno effect."

+

Of course, although the quantum Zeno effect was discussed/envisioned by Turing, there is no other relation between the quantum Zeno effect and "Zeno" hypercomputation, as mentioned above.

+",2927,,,,,8/8/2020 23:49,,,,0,,,,CC BY-SA 4.0 +13232,2,,13202,8/9/2020 7:44,,0,,"

Aer simulators will support what you're looking for very soon: https://github.com/Qiskit/qiskit-aer/pull/834

+",7659,,,,,8/9/2020 7:44,,,,0,,,,CC BY-SA 4.0 +13233,2,,13228,8/9/2020 12:17,,1,,"

Well try doing this as it worked for me

+
IBMQ.save_account("your_API_id", overwrite=True)
+provider = IBMQ.load_account()
+provider.backends()
+
+",12897,,9006,,8/10/2020 7:35,8/10/2020 7:35,,,,0,,,,CC BY-SA 4.0 +13234,2,,13212,8/9/2020 12:24,,3,,"

The two main classes of sampling problems demonstrating quantum supremacy are BosonSampling and IQP which are intermediate models of optical and qubit based quantum information processing architectures. Even reasonable approximations to the outputs from these problems, given some highly plausible conjectures, are hard for classical computers to compute. +Recently the complexity of IQP sampling has been connected to the complexity of quantum algorithms for approximate optimization problems, suggesting further applications of IQP and closely related classes.

+

Applications of BosonSampling to molecular simulations, meteorology, and decision problems have been suggested, though more work is needed in this space.

+

For more information see this article.

+",12897,,55,,8/10/2020 6:17,8/10/2020 6:17,,,,0,,,,CC BY-SA 4.0 +13235,2,,13230,8/9/2020 12:28,,0,,"

See this video here professor Vazirani explains why you cannot have less than sqrt(N) steps if you want at least a constant probability.

+",12897,,,,,8/9/2020 12:28,,,,3,,,,CC BY-SA 4.0 +13236,2,,13230,8/9/2020 14:16,,4,,"
+

What am I missing here? Is implementation possible?

+
+

The problem with this idea is that the diffusion operation you use is supposed to match the initial state of the search. If your initial state is $|v\rangle$ then your diffusion operation is $I - 2|v\rangle\langle v|$. This operation is only cheap to implement when $|v\rangle$ is simple. For example, typically $|v\rangle$ would be $|+\rangle^{\otimes n}$ since you can implement $I - 2|+\rangle^{\otimes n}\langle +|^{\otimes n}$ using a multi-controlled NOT with some Hadamards around it.

+

When you switch oracles halfway through your search, the initial state for the second half of the search is the superposition of classical states meeting the oracle from the first half: $\sum_{k | P_1(k)} |k\rangle$. The problem is that it is not cheap to implement $I - 2\sum_{k | P_1(k)} |k\rangle\langle k|$. You will find that each oracle call during the second half of the search is as expensive as the whole first half of the search.

+

Basically, you're right that the number of oracles calls is going to decrease exponentially as the algorithm progresses but the cost of each call is going up exponentially. You end up not getting any benefit.

+",119,,,,,8/9/2020 14:16,,,,12,,,,CC BY-SA 4.0 +13238,1,13249,,8/9/2020 15:22,,2,159,"

This paper discusses strictly contractive channels, i.e. channels that strictly decrease the trace distance between any two input quantum states.

+

It is shown that if a quantum circuit is composed of rounds of gates followed by strictly contractive channels then the trace distance between any two input states would decay exponentially with circuit depth, which means we would not be able to distinguish outputs corresponding to any two different inputs.

+

In light of this, how is it even possible to build any kind of fault-tolerant circuit which is capable of "arbitrarily long" computations, given that the standard noise model, the depolarizing channel, is strictly contractive?

+",12047,,55,,8/13/2020 8:28,8/13/2020 8:28,How is it not a contradiction that it is possible to build fault tolerant circuits with strictly contractive (e.g.: depolarizing noise) channels?,,2,3,,,,CC BY-SA 4.0 +13239,2,,13097,8/9/2020 16:29,,1,,"

In general, you need to use modular exponentiation algorithm. In Qiskit tutorial, I guess they saw some pattern to for that specific case to implement operator $U$. Yet you can use the following idea to create operator $U$. Let's suppose that $a=11$ and $N=21$. u is the matrix that corresponds to operator $U$. By using u, you should be able to create a gate. Note that we are cheating since if you do all below operations, you already know the order $r$ and there is no need for order finding algorithm.

+
import numpy as np
+u = np.zeros([32, 32], dtype = int) 
+
+for i in range(21):
+    u[11*i%21][i]=1
+for i in range(21,32):
+    u[i][i]=1
+  
+
+",7986,,,,,8/9/2020 16:29,,,,0,,,,CC BY-SA 4.0 +13240,2,,13238,8/9/2020 18:26,,0,,"

So that's where quantum error correction comes in. By measuring the stabilizers, the code is projected back into a pure state. I'll give an example using a Bell state:

+

Imagine the state +$$\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle),$$

+

which is stabilized by XX and ZZ (meaning we can catch errors by verifying that these two operators have eigenvalue +1 on our state). Now imagine that the state undergoes a stochastic X channel on the second qubit, described by:

+

$$E(\rho) = (1-p)I\rho I + p X_2\rho X_2.$$

+

The overall state will now become a mixed state described by: +$$\rho = \frac{1}{2}[(1-p)(|00\rangle + |11\rangle)(\langle 00| + \langle 11|) + p(|01\rangle + |10\rangle)(\langle 01| + \langle 10|)].$$ +This state is a mixed state with trace less than 1, since the error channel is non-unitary.

+

When we measure the stabilizers XX and ZZ, we either get [+1, +1] with probability $1+p$, meaning that we have projected ourselves back into the state $\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$, or with probability $p$ we get [+1, -1], meaning the state is $\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$. Both of these new states are again pure states, and the goal of error correction is to be able to figure out what errors we have projected onto the state, so we can undo it and recover our state. The key point is that by measuring stabilizers, error correction naturally relies on a non-unitary process in order to deal with these trace reduction concerns.

+",3056,,,,,8/9/2020 18:26,,,,6,,,,CC BY-SA 4.0 +13241,2,,13198,8/10/2020 6:11,,5,,"

Very briefly, gate fidelity refers to a way to compare how "close" two gates, or more generally operations, are to each other.

+

As discussed e.g. in (Magesan et al. 2012), if one wants to compare the action of an operation $\mathcal E$ and a gate $\mathcal U$ on a given state $\rho$, one can define their "gate fidelity" as the quantum state fidelity between $\mathcal E(\rho)$ and $\mathcal U\rho\mathcal U^\dagger$.

+

A related notion is that of average gate fidelity, which is defined as the above but averaging over all states $\rho$, and thus gives a better quantifier of how similar the operations themselves are (as opposed to just comparing their action on a single input state). See the paper above for more details.

+",55,,,,,8/10/2020 6:11,,,,2,,,,CC BY-SA 4.0 +13242,2,,13199,8/10/2020 7:54,,2,,"

The effect of noise is to give us outputs that are not quite correct. The effect of noise that occurs throughout a computation will be quite complex in general, as one would have to consider how each gate transforms the effect of each error. There is a very good article that shows Noise and its effect in practical using Qiskit https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html) So, yes there will be deviation and that will cause the measurement to change.

+",12902,,,,,8/10/2020 7:54,,,,0,,,,CC BY-SA 4.0 +13243,2,,13131,8/10/2020 9:55,,4,,"

I would suggest you use the code from the tutorial about quantum state tomography, adapting it to a real device of your choice. You can find the updated tutorial here

+

Caveat: as state tomography requires 3^n circuits, you will need probably to find a method of batch processing of these circuits if they exceed the job circuit limit of your real device. See the code here

+

“This performs measurement in the Pauli-basis resulting in :math:`3^n circuits for an n-qubit state tomography experiment.”

+

For an example of results of « full state tomography » on real devices (Melbourne and ibmqx4) for up to 5 qubits, I suggest you have a look at the end of my own qiskit tutorial here

+

For the exploration of a certain subspace on a real device, I have some doubt about the approach as noise will inevitability produce a result somewhere in the entire Hilbert space and not confined to the chosen subspace.

+

However, you may be interested by this recent paper

+

and by its presentation in Phys.org

+

I quote from this presentation written by Ingrid Fadelli

+

“By combining statistical learning and unitary t-design theory, the researchers were able to devise a rigorous and efficient procedure that allows classical machines to produce approximate classical descriptions of quantum many-body systems. These descriptions can be used to predict several properties of the quantum systems that are being studied by performing a minimal number of quantum measurements.”

+

So, you are surely right in proposing that full tomography can be replaced by alternate methods using a lower number of measurements.

+

For your last question about the 3^n bound, I see that JSdJ already answered to you.

+",4600,,4600,,8/10/2020 20:58,8/10/2020 20:58,,,,4,,,,CC BY-SA 4.0 +13244,1,,,8/10/2020 15:35,,3,167,"

I know the $|1\rangle$ state can relax spontaneously to the $|0\rangle$ state, but can the opposite also happen?

+",12906,,9006,,8/11/2020 10:24,8/11/2020 10:24,Is spontaneous excitation possible?,,3,3,,,,CC BY-SA 4.0 +13245,2,,13244,8/10/2020 15:59,,5,,"

As a first note: the (uncontrolled) transition of $|1\rangle$ to $|0\rangle$ is generally not referred to as dephasing but as relaxation. The noise-process that involves (spontaneous) relaxation is also called the amplitude damping channel.

+

Now, if you have a system which has a finite temperature, meaning that there is some energy in the system, the reverse might spontaneously happen as well - the $|0\rangle$ state spontaneously transitions to the $|1\rangle$ state, something we call (spontaneous) excitation. So yeah, if there is any energy in the system (i.e. de facto every conceivable system), the reverse is also possible.

+

If you're familiar with the math, you might want to check out the generalized amplitude damping channel, for instance as introduced here. It formalizes the above idea that, in addition of a small relaxation probability, there is also a (small) probability of a spontaneous excitation.

+",8141,,,,,8/10/2020 15:59,,,,0,,,,CC BY-SA 4.0 +13247,1,13263,,8/10/2020 16:27,,1,98,"

On page 566, it states that using $S(\rho^{'})-S(\rho,\varepsilon) \ge S(\rho)$ and combining this with $S(\rho) \ge S(\rho^{'})-S(\rho,\varepsilon))$, we get $S(\rho^{'})=S(\rho)-S(\rho,\varepsilon)$. I can see no way in which this case holds, as by subbing this back in you'd end up getting either $S(\rho)-2S(\rho,\varepsilon) \ge S(\rho)$ or $S(\rho) \ge S(\rho)-2S(\rho,\varepsilon)$

+

The first inequality should never hold, with equality only when $S(\rho,\varepsilon)=0$, and the second should hold, but contradicts the first.

+

This is meant to be a way to show the necessity of $S(\rho)=S(\rho^{'})-S(\rho,\varepsilon)$

+

If feel like it should actually be $S(\rho^{'})=S(\rho)+S(\rho,\varepsilon))$, as subbing this back in gives equality in the two cases I stated, which is what you want to show. But I am assuming here that the book is right and I am wrong, so where am I going wrong?

+",4991,,55,,8/24/2020 9:26,8/24/2020 9:26,Proof of quantum data processing inequality in N&C on pg 566,,1,0,,,,CC BY-SA 4.0 +13248,1,13256,,8/10/2020 17:25,,2,69,"

I'm starting with Qiskit in Python.

+

My question is regarding to have registers and sub-register. Something like this

+
axreg=QuantumRegister(4,name='ax')
+ahreg=QuantumRegister(axreg[:2],name='ah')
+alreg=QuantumRegister(axreg[2:],name='al')
+
+

The constructor of QuantumRegister has only the number of qubits to create, and I find no way to add previously existing qubit to other register

+",12893,,,,,8/11/2020 4:33,Can a Qubit belong to 2 different registers?,,1,0,,,,CC BY-SA 4.0 +13249,2,,13238,8/10/2020 18:17,,4,,"

This is a very interesting question. Indeed, CP maps - and this includes the operations used in the error correction (measurement and subsequent unitaries) - will always decrease the trace norm.

+

The answer is that if you take a (strictly) contractive map on, say, a qubit, and consider how it acts if you apply it to many qubits, there will always be some subspace where the map is much less contractive - still contractive, but supressed exponentially. The art of (quantum) error correction is to encode the information in those subspaces, and to "re-focus" it into those subspaces (which is the actual error correction procedure).

+

Let me give a (slightly oversimplified) example.

+

Consider a noise which flips a bit with probability $\epsilon=0.01$ (per unit time, if you wish).

+

Now encode a (classical) bit in $N$ zeros or $N$ ones, $0\cdots 0$ and $1\cdots 1$. Then, these states (seen as quantum states, if you wish, or as probability distributions) will keep a trace distance on the order of at most $\epsilon^{-N/2}$ -- after all, you have to flip half the bits in either to get any overlap between them (and if they are orthogonal, the trace distance stays 1).

+

So what happened? Before, the noise was $\epsilon=0.01$. Now, the noise is $\epsilon=0.01^{-N/2}$. So for $N=10$, you might be able to go about $10^{10}$ time steps, rather than $100$.

+

Of course, this will break down if you let more time pass -- so what you have to do after a short interval of time is to "re-focus" your information, that is, move it back to that subspace which is best protected (like all zeros and all ones). This is what error correction does. This is a CP map and does not increase distinguishability, but it will allow you to stay with the best error rate of $1$ error in $10^{10}$.

+

(Note: Clearly, this is not a way to safely encode quantum information - this is not what this example is supposed to illustrate.)

+",491,,491,,8/10/2020 20:33,8/10/2020 20:33,,,,7,,,,CC BY-SA 4.0 +13250,1,,,8/10/2020 19:07,,1,152,"

In this answer, it is stated that applying post-selection to quantum teleportation results in Alice communicating to Bob backwards in time. Could someone explain how this works?

+

I am particularly confused by how Alice decides what to post-select on. For example, if she wanted to teleport +$$\newcommand{\ket}[1]{\lvert #1\rangle}\ket{-} = \frac{1}{\sqrt{2}}(\ket{0}-\ket{1})$$ +then she could not post select on $\ket{00}$ because the amplitude of this state in the first two qubits would be zero.

+

So, it seems like what state she post-selects on depends on what state she wants to teleport. This means she needs to tell Bob what state she is going to post-select on after deciding what state to send him. This seems equivalent to sending him the two classical bits in the usual quantum teleportation.

+

What am I missing here?

+",12908,,55,,8/10/2020 19:52,8/10/2020 19:52,Post-selection applied to quantum teleportation,,1,3,,,,CC BY-SA 4.0 +13251,1,,,8/10/2020 19:18,,3,484,"

There are two possibilities to prepare a qubit in a particular state like $ | - \rangle $ in Qiskit.

+

The first approach is using the initialize function:

+
qc = QuantumCircuit(1)
+initial_state = [1/sqrt(2),-1/sqrt(2)]
+qc.initialize(initial_state, 0)
+
+

The second approach is using standard quantum gates:

+
qreg_q = QuantumRegister(1, 'q')
+creg_c = ClassicalRegister(1, 'c')
+qc = QuantumCircuit(qreg_q, creg_c)
+qc.x(qreg_q[0])
+qc.h(qreg_q[0])
+
+

Are these two possibilities different? What is the "best practice" for preparing an arbitrary qubit state?

+

Is there a comparable initialize function in Q#?

+",12909,,55,,8/14/2020 6:23,8/14/2020 6:23,What is the right way to prepare a specific qubit state in Qiskit / Q#?,,1,0,,,,CC BY-SA 4.0 +13252,2,,13251,8/10/2020 19:44,,1,,"

(Disclaimer: I don't know what's going on "under the hood" in Qiskit's initialize, my answer is based on Q# part of the question, but I suspect it's something similar.)

+

The state of a quantum system is not something that can be directly initialized to the necessary state (quantum computing would've been a lot easier if it was possible!) Instead we prepare the states by starting in a well-defined state (typically a state of all $|0\rangle$s) and applying the necessary gates to transform the system to the necessary state.

+

In Q#, the corresponding library operation is PrepareArbitraryState which takes an array of coefficients and prepares a quantum state with these coefficients. You can see that "under the hood" it compiles a sequence of gates necessary to prepare the state depending on the given coefficients and applies them to the qubits.

+

To return to your original question, the options you're considering might end up being identical (if you have a simple state, initialize will probably compile it to the same gates as the ones you've written out manually). The factors to consider are:

+
    +
  • If you're looking to write code that is easy to change if you realize you need a different state, you'll probably want to use the library operation.
  • +
  • Same goes if you're looking to initialize a system to a fairly complex state and you don't want to figure out all the rotations by hand.
  • +
  • On the other hand, if you're looking to learn more the logic behind state preparation and to practice applying gates to change the system state, you'll want to do it by hand (like Superposition quantum kata offers you to).
  • +
+",2879,,,,,8/10/2020 19:44,,,,3,,,,CC BY-SA 4.0 +13253,2,,13250,8/10/2020 19:48,,1,,"

As I understand it, the key caveat to postselection, at least in regards to retrocausal effects, is that Bob already knows what state Alice will post-select. Since he already knows what she will do, and she always does so with 100% success rate, then he can just treat his qubit as already having underwent the measurement and received a pure state, so that he can progress with any operations he intended to do once he had received the information immediately.

+

The "time travel" aspect comes into it because Bob doesn't actually need to wait for Alice to measure, so he can be said to have already received her measurement result before she made it, as she will always succeed in making it.

+",4991,,,,,8/10/2020 19:48,,,,0,,,,CC BY-SA 4.0 +13254,2,,13244,8/10/2020 20:18,,2,,"

Spontaneous emission from an excited state $|1\rangle$ to ground state $|0\rangle$ is a well known phenomenon, but spontaneous excitation is not discussed as often, although there has been discussion about spontaneous excitation for accelerating qubits, along with its relation to the Unruh effect which comes up when relativity is considered.

+

As JSdJ said in their answer, if the temperature is high, we can expect ground state systems to absorb photons or phonons or some form of energy which takes them from $|0\rangle$ to $|1\rangle$ without outside control of the situation (i.e. shining a laser on the system to force the excitation). In the absence of a laser, this excitation could be considered spontaneous excitation.

+

Keep in mind also that Wolfgang Ketterle's group has observed negative temperature at his lab, which means the opposite is true: $|1\rangle$ is the preferred state and you would need to provide external energy to force the system to go from $|1\rangle$ to $|0\rangle$ except in the case of spontaneous emission, which at negative temperature would be the equivalent of spontaneous excitation.

+",2293,,,,,8/10/2020 20:18,,,,0,,,,CC BY-SA 4.0 +13255,1,13260,,8/10/2020 21:13,,3,89,"

The GHZ state is defined as $|\mathrm{GHZ}\rangle = \frac{|000\rangle + |111\rangle}{\sqrt{2}}$. Is there a name for the phase flipped GHZ state, i.e. $Z_1(|\mathrm{GHZ}\rangle)=\frac{|000\rangle - |111\rangle}{\sqrt{2}}$ ?

+",4986,,8141,,8/11/2020 10:48,8/11/2020 10:48,Is there a name for $Z_{1}(|\mathrm{GHZ}\rangle)$?,,1,1,,,,CC BY-SA 4.0 +13256,2,,13248,8/11/2020 4:33,,1,,"

If you want to add previously existing qubits to other register you can obviously compose or append to add previously existing qubits to other register, let's say we have have two qubits who are in state |++> and we want to add them to our register which has for example 4 qubits, we can do

+
sub_circuit = QuantumCircuit(2)
+circuit = QuantumCircuit(4)
+qr = circuit.qregs[0]
+circuit.x(range(4))
+sub_circuit.h(range(2))
+circuit = circuit.append(sub_circ.to_instruction(), [qr[0], qr[1]])
+
+

You'll get something like this

+

+",12897,,,,,8/11/2020 4:33,,,,1,,,,CC BY-SA 4.0 +13257,1,,,8/11/2020 6:29,,2,248,"

It stated in Qiskit's documentation.

+

This question arose after I accidentally called the U3 gate with parameter $\theta$=$2\pi$ in the program and Qiskit executed the program without error:

+
tetha = 2 * np.pi
+qc.u3(theta, phi, lam, reg)
+
+

I checked other values out of bounds and every time it worked (including looping at a distance of $4\pi$) according to the formula for U from the documentation (judging by the resulting unitary operator) but ignoring violation of declared boundaries for $\theta$, e.g:

+
print(Operator(U3Gate(1.5 * np.pi, 0, 0)))
+print(Operator(U3Gate(5.5 * np.pi, 0, 0)))
+print(Operator(U3Gate(-.5 * np.pi, 0, 0)))
+print(Operator(U3Gate(3.5 * np.pi, 0, 0)))
+
+Operator([[-0.70710678+0.j, -0.70710678+0.j],
+          [ 0.70710678+0.j, -0.70710678+0.j]],
+         input_dims=(2,), output_dims=(2,))
+Operator([[-0.70710678+0.j, -0.70710678+0.j],
+          [ 0.70710678+0.j, -0.70710678+0.j]],
+         input_dims=(2,), output_dims=(2,))
+Operator([[ 0.70710678+0.j,  0.70710678+0.j],
+          [-0.70710678+0.j,  0.70710678+0.j]],
+         input_dims=(2,), output_dims=(2,))
+Operator([[ 0.70710678+0.j,  0.70710678+0.j],
+          [-0.70710678+0.j,  0.70710678+0.j]],
+         input_dims=(2,), output_dims=(2,))
+
+

But do $\theta$ values outside the declared range make any real sense in quantum computing?

+

Or is it just a little flaw in Qiskit?

+

Just in case, the formula for the U3 gate is +$$ +\mathrm{U3}= +\begin{pmatrix} +\cos(\theta/2) & -\mathrm{e}^{i\lambda}\sin(\theta/2) \\ +\mathrm{e}^{i\phi}\sin(\theta/2) & \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) +\end{pmatrix}. +$$

+",12416,,9006,,8/11/2020 10:09,8/11/2020 14:01,Why is declared that $0 \le \theta \le \pi$ for Qiskit's U3 gate?,,1,11,,,,CC BY-SA 4.0 +13258,1,,,8/11/2020 7:34,,1,190,"

Can someone please explan how the $\rm I$, $\rm X$ and $\rm Z$ gates work?

+

If $\rm{I = X^2 = Z^2}$, can you explain why this is the case or why it wouldn't work?

+",12913,,9006,,8/12/2020 7:10,8/12/2020 7:10,"What are the I, X, Z gates in quantum gates?",,1,1,0,8/12/2020 18:34,,CC BY-SA 4.0 +13259,2,,13257,8/11/2020 8:41,,1,,"

You use the mathematical representation of the gate to generate something you can apply to your qubit. Nothing breaks if you input $\theta$ higher that the range given. We can see this with some examples : +With $\theta = 0$ and not thinking about the phase, +$$ +U3 = +\begin{pmatrix} +1 & 0 \\ +0 & 1 \\ +\end{pmatrix} +$$ +With $\theta = \frac{\pi}{2}$ and not thinking about the phase, +$$ +U3 = +\begin{pmatrix} +0.7071 & 0.7071 \\ +0.7071 & 0.7071 \\ +\end{pmatrix} +$$ +With $\theta = \pi$ and not thinking about the phase, +$$ +U3 = +\begin{pmatrix} +0 & 1 \\ +1 & 0 \\ +\end{pmatrix} +$$ +With $\theta = \frac{3\pi}{2}$ and not thinking about the phase, +$$ +U3 = +\begin{pmatrix} +-0.7071 & 0.7071 \\ +0.7071 & -0.7071 \\ +\end{pmatrix} +$$ +With $\theta = 2\pi$ and not thinking about the phase, +$$ +U3 = +\begin{pmatrix} +-1 & 0 \\ +0 & -1 \\ +\end{pmatrix} +$$ +The process then continues alternating a global phase of -1 and 1. As you can see the only thing changing are the pbases and not the complex amplitudes so there is no problem with the quantum computation.

+",8746,,8746,,8/11/2020 14:01,8/11/2020 14:01,,,,5,,,,CC BY-SA 4.0 +13260,2,,13255,8/11/2020 9:01,,3,,"

As @keisuke.akira already mentioned, and as far as I am aware, there is not really an agreed upon name for such a specific state.

+

I'd like to add one more thing: it might even be a bad idea to give that state (identified as $Z_{1}|\mathrm{GHZ}\rangle$) a specific name, because (as you may be well aware) $Z_{1}|\mathrm{GHZ}\rangle = Z_{2}|\mathrm{GHZ}\rangle = Z_{3}|\mathrm{GHZ}\rangle$. This could create some unwarranted ambiguity.

+

If you identify the state as $\frac{1}{\sqrt{2}}(|000\rangle - |111\rangle)$ you don't have this problem, of course.

+

Also, it may be of interest to note that the $|\mathrm{GHZ}\rangle$ state (generalized to $n$ qubits) is often used in anonymous quantum networking, precisely because of the fact that such a local phase flip has a completely non-local effect, thereby hiding the identity of the party applying the phase flip.

+

Now, this may be really out of focus, but there's one other thing that might be of interest to you. You might now that the $\mathrm{GHZ}$ state is (up to local Cliffords) equivalent to a graph state. Moreover, in this review paper they introduce (Eq. $(28)$, page $16$) the set of states $\{|W\rangle = Z_{W}|G\rangle\}$, where $|G\rangle$ is a graph state. This set forms an orthonormal basis, and if the $|\mathrm{GHZ}\rangle$ state were a graph state your state $Z_{1}|\mathrm{GHZ}\rangle$ would be an element of this basis, namely $|W_{100}\rangle$. However, the $\mathrm{GHZ}$ state is only equivalent to a graph state, so it doesn't really work. (If it were to work, we would have $|W_{100}\rangle = |W_{010}\rangle = |W_{001}\rangle$, which is clearly not possible for a basis!)

+",8141,,8141,,8/11/2020 10:11,8/11/2020 10:11,,,,0,,,,CC BY-SA 4.0 +13261,2,,13258,8/11/2020 10:08,,2,,"

$I$ is identity operator, which means that input state is not affected. In mathematical notation: $I|\psi\rangle = |\psi\rangle$.

+

$X$ operator is a negation. It changes 0 to 1 and conversely, i.e. $X|0\rangle = |1\rangle$ and $X|1\rangle = |0\rangle$. If it is applied on a qubit in arbitrary superposition, i.e. $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$, the state changes to $X|\psi\rangle = \beta|0\rangle + \alpha|1\rangle$.

+

$Z$ operator is a little bit more difficult to understand for beginners. The operator changes a phase of qubit. Consider for example state $|\psi\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$. This state is an equally distributed superposition of state $|0\rangle$ and $|1\rangle$. When you apply $Z$ operator, you get a state $|\psi\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$. This is also an equally distributed superpositon of $|0\rangle$ and $|1\rangle$, however, the phase changed as you can see from minus sign before $|1\rangle$. If it is applied on a qubit in arbitrary superposition, i.e. $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$, the state changes to $Z|\psi\rangle = \alpha|0\rangle - \beta|1\rangle$. Again, only the phase changes.

+

An identity $I = X^2 = Z^2$ can be easily verified by direct multiplication of matrix representations of the operators: +$$ +X = +\begin{pmatrix} +0 & 1 \\ +1 & 0 +\end{pmatrix} +$$ +and +$$ +Z = +\begin{pmatrix} +1 & 0 \\ +0 & -1 +\end{pmatrix}. +$$

+",9006,,,,,8/11/2020 10:08,,,,1,,,,CC BY-SA 4.0 +13262,2,,13244,8/11/2020 10:21,,2,,"

I tried to prepare a two simple circuits on IBM Q (1 qubit Armonk processor). First one was composed only of $X$ gate. So, when the gate was applied on state $|0\rangle$, it changed to $|1\rangle$. As you can see from the figure below, after measurement there is non-zero probability that the qubit is in state $|0\rangle$. This is a spontaneous relaxation.

+

+

When you replaced gate $X$ with $I$ (or there is no gate at all), the qubit remains in state $|0\rangle$. However, after measurement, there is also non-zero probability that the qubit is in state $|1\rangle$. This is a spontaneous excitation.

+

+

As you can see, the spontaneous excitation does not occur as often as the relaxation.

+

Note that these results can be also influenced by read-out errors and imperfect gates.

+",9006,,,,,8/11/2020 10:21,,,,0,,,,CC BY-SA 4.0 +13263,2,,13247,8/11/2020 10:23,,3,,"

Combining those two equations gives

+

$$S(\rho')-S(\rho,\epsilon)\geq S(\rho)\geq S(\rho')-S(\rho,\epsilon)$$

+

and since the left and right hand sides are the same, the inequalities must be equalities, which indeed gives $S(\rho')=S(\rho)+S(\rho,\epsilon)$, or equivalently $S(\rho)=S(\rho')-S(\rho,\epsilon)$. It's quite possible this was a typo where they mixed up the $'$ symbol. In my copy of the book Equations 12.132 and 12.136 have it in the right order. It looks like they are trying to prove that Equation 12.132 holds, so I'm fairly confident this is a typo.

+",4517,,,,,8/11/2020 10:23,,,,1,,,,CC BY-SA 4.0 +13264,1,,,8/11/2020 14:23,,8,336,"

There exists a nice way of preparing any superposition (with real amplitudes — this is the case I'm interested in) of states $\{\ldots0001\rangle,\,|\ldots0010\rangle,\,|\ldots0100\rangle,\ldots\}$, etc. This can be achieved with an $O(\log_2 n)$-depth circuit having $O(n)$ gates. To do so, one takes the circuit from Fig. 5 here, and replaces the $G(1/2)$ gate with $R_y$ rotations.

+

I'm wondering if this idea can be somehow generalized in order to prepare any superposition (with real coefficients) of constant Hamming weight states. Clearly, such a circuit will contain at least $O\left({n}\choose{m}\right)$ parametric gates. Would be cool if the depth could be made, similarly to the case above, significantly smaller than the number of gates.

+

Please do not suggest the UCC ansatz :D

+

UPDATE

+

In the comments below, Mark S pointed out a paper in which the preparation of Dicke states is discussed. Those are the equal-weight superpositions of constant Hamming weight states. The circuit contains only $O(kn)$ gates, and cannot be generalized to case of interest in an obvious way, as it can be done in the first paper cited above. Still, may be useful.

+",6313,,6313,,8/13/2020 13:28,8/13/2020 13:56,Preparing any superposition of fixed Hamming weight states,,1,6,,,,CC BY-SA 4.0 +13265,2,,13198,8/11/2020 15:17,,1,,"

I find the above answers correct and sophisticated. My explanation would give you just a very general understanding.

+

In order to understand gate fidelity, you have to know the difference between a physical gate and a software-visible (logical) gate. Due to the current hardware-technology limitations, physical gates (those that are implemented physically on the real quantum devices) do not precisely map to (implement) the logical gates.

+

The difference between an ideal gate (a logical gate) and what the corresponding physical gate that a quantum hardware offers is called gate infidelity.

+",9318,,,,,8/11/2020 15:17,,,,0,,,,CC BY-SA 4.0 +13266,1,13270,,8/11/2020 15:55,,0,1380,"

I know I can make a random_circuit, but I see that Qiskit has random_statevector. I'd like to optimize computation time by initializing a state by that instead of putting a random circuit at the beginning. Is it possible and how do I do it? Thank you!

+",7598,,55,,8/12/2020 8:33,8/12/2020 15:04,How to initialize a random state in Qiskit?,,2,0,,,,CC BY-SA 4.0 +13267,2,,11966,8/11/2020 20:38,,2,,"

First try to sign-in into https://quantum-computing.ibm.com/, if not done already. There you will get to see one of IBM's free 15 qubit quantum machines named ibmq_16_melbourne.

+

If successful, try adding the following snippet:

+
provider = IBMQ.get_provider('ibm-q')
+qcomp = provider.get_backend('ibmq_16_melbourne')
+job = execute(circuit, backend=qcomp)
+from qiskit.tools.monitor import job_monitor
+from qiskit.providers.ibmq.job import job_monitor
+job_monitor(job)
+result = job.result()
+
+

If you want to come up with a histogram, try:

+
from qiskit.tools.visualization import plot_histogram
+plot_histogram(result.get_counts(circuit))
+
+

For more info, refer to this YouTube video on Qiskit Hello World.

+",12918,,,,,8/11/2020 20:38,,,,0,,,,CC BY-SA 4.0 +13268,1,13275,,8/11/2020 22:29,,2,596,"

Im trying to use IBM quantum machine instead of qiskit aer simulator with the following command:

+
backend = IBMQ.get_backend('ibmq_16_melbourne', 'ibm-q')
+
+

It's giving me the following error:

+
+
AttributeError    Traceback (most recent call last)
+
+ 
+ <ipython-input-22-39269ac2204d> in <module>
+----> 1 backend = IBMQ.get_backend('ibmq_16_melbourne', 'ibm-q')
+
+AttributeError: 'IBMQFactory' object has no attribute 'get_backend'
+
+

What syntax I should try to submit the job to designated quantum machine?

+",12920,,55,,8/12/2020 8:32,9/1/2021 23:34,Qiskit error on get_backend(),,2,0,,,,CC BY-SA 4.0 +13269,2,,13268,8/11/2020 23:48,,2,,"

you should get_provider first.

+
IBMQ.load_account()
+provider = IBMQ.get_provider(hub='ibm-q')
+backend = provider.get_backend('ibmq_16_melbourne')
+
+

or you can simply use simulator:

+
from qiskit import Aer
+simulator = Aer.get_backend('qasm_simulator')
+
+",12921,,,,,8/11/2020 23:48,,,,1,,,,CC BY-SA 4.0 +13270,2,,13266,8/12/2020 0:27,,3,,"

here is an example of how to initialize the random statevector then send it to the quantum circuit:

+
from qiskit.quantum_info import random_statevector, Statevector
+from qiskit import QuantumCircuit
+# import numpy as np
+
+vec = random_statevector(2)
+# vec = Statevector([1, 0])
+print('before circuit: {}'.format(vec)) 
+
+qc = QuantumCircuit(1)
+qc.x(0)
+qc.draw()
+
+new_vec = vec.evolve(qc)
+print('after circuit: {}'.format(new_vec))
+
+

you should notice that the dim of state vector is 2 so the quantum circuit is 1 qubit.

+",12922,,12922,,8/12/2020 0:46,8/12/2020 0:46,,,,0,,,,CC BY-SA 4.0 +13272,1,,,8/12/2020 3:25,,5,346,"

I recently got flung into the world of quantum computing and I'm a beginner at coding. I was assigned to do the Portfolio Optimization tutorial of the Qiskit Finance Tutorials and input real data. Truth be told, I'm clueless. It's my understanding that I have to replace the "TICKER" and "RandomDataProvider" parts of the code in order to generate a real-life portfolio.

+
# Generate expected return and covariance matrix from (random) time-series
+stocks = [("TICKER%s" % i) for i in range(num_assets)]
+data = RandomDataProvider(tickers=stocks,
+                 start=datetime.datetime(2016,1,1),
+                 end=datetime.datetime(2016,1,30))
+data.run()
+mu = data.get_period_return_mean_vector()
+sigma = data.get_period_return_covariance_matrix()
+
+

I've imported Quandl and WikipediaDataProvider. I want to keep the number of assets the same, using Microsoft "MSFT", Disney "DIS", Nike "NKE", and Home Depot "HD" stocks. How might I apply this financial from Quandl to the tutorial? I've tried this so far:

+
num_assets = 4
+
+# Generate expected return and covariance matrix from (random) time-series
+stocks = [("MSFT%s" , "DIS%s" , "NKE%s" , "HD%s" % i) for i in range(num_assets)]
+data = WikipediaDataProvider(tickers=stocks,
+                 token="xeesvko2fu6Bt9jg-B1T",
+                 start=datetime.datetime(2016,1,1),
+                 end=datetime.datetime(2016,1,30))
+data.run()
+mu = data.get_period_return_mean_vector()
+sigma = data.get_period_return_covariance_matrix()
+
+

But get the error:

+
---------------------------------------------------------------------------
+TypeError                                 Traceback (most recent call last)
+<ipython-input-59-19e4d9cde1e3> in <module>
+      3 # Generate expected return and covariance matrix from (random) time-series
+      4 stocks = [("MSFT%s" , "DIS%s" , "NKE%s" , "HD%s" % i) for i in range(num_assets)]
+----> 5 data = WikipediaDataProvider(tickers=stocks,
+      6                  token="xeesvko2fu6Bt9jg-B1T",
+      7                  start=datetime.datetime(2016,1,1),
+
+TypeError: Can't instantiate abstract class WikipediaDataProvider with abstract methods run
+
+

I apologize for my limited coding skills - I'm very new to all of this! Thank you in advance.

+",12924,,55,,8/12/2020 8:33,8/12/2020 22:59,Qiskit Portfolio Optimization Application,,1,6,,,,CC BY-SA 4.0 +13273,1,13284,,8/12/2020 6:32,,3,419,"

I can see in example code of qiskit, to implement job monitors on IBM Quantum machines, example uses any of the following

+
from qiskit.tools.monitor import job_monitor
+from qiskit.providers.ibmq.job import job_monitor
+
+

I have downloaded qiskit in my laptop and used both of them. Could not see any differences.

+

What is the difference between them? Does the invocation vary depending on the Quantum machine on which job is being executed?

+",12925,,55,,8/12/2020 8:33,8/12/2020 14:55,Existence of multiple job monitor in qiskit,,3,0,,,,CC BY-SA 4.0 +13274,2,,10174,8/12/2020 6:50,,0,,"

To change the endianness of a circuit in Qiskit you can use the reverse_bits method of the QuantumCircuit. To do so for the QFT you can pick the QFT from the circuit library, reverse it, and add it to your circuit:

+
from qiskit import QuantumCircuit
+from qiskit.circuit.library import QFT
+
+iqft = QFT(3, inverse=True)  # get the IQFT
+reversed_bits_QFT = iqft.reverse_bits()  # reverse bit order
+
+circuit = QuantumCircuit(3)
+circuit.compose(reversed_bits_QFT, inplace=True)  # append your QFT 
+
+",9800,,,,,8/12/2020 6:50,,,,0,,,,CC BY-SA 4.0 +13275,2,,13268,8/12/2020 7:33,,1,,"

First, check the IBM Quantum Services page to see if you have access to any additional systems. Make sure you are logged in with your IBMid to see what your account can access.

+

By default, basic users have access to the 5 qubit machines, but do not have access to 15 qubit machines like ibmq_16_melbourne.

+

Also, it looks like the snippet you provided is in an older syntax.

+

Check the IBM Quantum Provider page on GitHub for information for the modern syntax. The new syntax would look like this:

+
provider = IBMQ.get_provider('ibm-q')
+backend = provider.get_backend('ibmq_16_melbourne')
+
+

Keep in mind that you can always use the simulators provided in Aer:

+
from qiskit import Aer
+Aer.backends()    # lists the available simulators
+backend = Aer.get_backend('aer_simulator')
+
+

More information about Aer's simulators is available in the relevant tutorial.

+",12918,,17931,,9/1/2021 23:34,9/1/2021 23:34,,,,1,,,,CC BY-SA 4.0 +13276,2,,13273,8/12/2020 7:47,,1,,"

briefly, no big difference.

+

you can see the difference from the source code (the links below or the source code from your installed places such as anaconda3\envs[qiskit_envs_name]\Lib\site-packages\qiskit)

+

ibmq version: +https://qiskit.org/documentation/_modules/qiskit/providers/ibmq/job/job_monitor.html

+

tools version: +https://qiskit.org/documentation/_modules/qiskit/tools/monitor/job_monitor.html

+

for detail, the ibmq version has a little bit more info, such as queue_info and RUNNING status, and the tools version has a quiet parameter to control the print out messages

+",12921,,12921,,8/12/2020 7:58,8/12/2020 7:58,,,,0,,,,CC BY-SA 4.0 +13277,1,,,8/12/2020 8:04,,1,49,"

In this paper, while using a diagonalization argument in Section $5$, the authors write:

+
+

Fix some enumeration over all $poly(n)$-size quantum verifiers $M_{1}, + M_{2},...$ which we can do because the number of such machines is +countably infinite (by the Solovay-Kitaev theorem [15]). Some of these +verifiers may try to decide a language by trivially “hardwiring” its +outputs; for example, by returning 1 independent of the input. We +start by fixing a unary language $L$ such that no machine $M_{i}$ hardwires +the language. We can always do this because there are more languages +than $poly(n)$-sized machines.

+
+

Maybe I am missing something very basic, but:

+
    +
  1. Why do we care if some of the verifiers have the output hardwired?
  2. +
  3. How can we find an $L$, like in the description? Why will this $L$ even be decidable? I know there are more languages than there are Turing machines; but those extra languages aren't decidable.
  4. +
+",1351,,,,,9/11/2020 16:01,Hardwiring the output in black box separation,,0,0,,,,CC BY-SA 4.0 +13278,2,,13273,8/12/2020 10:02,,1,,"

They are different depending on the qiskit version.

+

Check qiskit version using: +qiskit.qiskit_version

+

I have installed latest qiskit which gives: +{'qiskit-terra': '0.14.2', +'qiskit-aer': '0.5.2', +'qiskit-ignis': '0.3.3', +'qiskit-ibmq-provider': '0.7.2', +'qiskit-aqua': '0.7.3', +'qiskit': '0.19.6'}

+

Check your respective version.

+",12926,,,,,8/12/2020 10:02,,,,0,,,,CC BY-SA 4.0 +13279,1,,,8/12/2020 11:45,,2,79,"

When I try QSVM over Iris data, it needs multiclass extension, but when I provide it, a following error is returned:

+
AttributeError                            Traceback (most recent call last)
+<ipython-input-18-86cd4e7dd846> in <module>
+      2 
+      3 feature_map = ZZFeatureMap(feature_dimension=feature_dim, reps=2, entanglement='linear')
+----> 4 qsvm = QSVM(feature_map, training_input, test_input, multiclass_extension=AllPairs)
+
+d:\anaconda\envs\ai\lib\site-packages\qiskit\aqua\algorithms\classifiers\qsvm\qsvm.py in __init__(self, feature_map, training_dataset, test_dataset, datapoints, multiclass_extension, quantum_instance)
+    148         else:
+    149             multiclass_extension.set_estimator(_QSVM_Estimator, [feature_map])
+--> 150             qsvm_instance = _QSVM_Multiclass(self, multiclass_extension)
+    151 
+    152         self.instance = qsvm_instance
+
+d:\anaconda\envs\ai\lib\site-packages\qiskit\aqua\algorithms\classifiers\qsvm\_qsvm_multiclass.py in __init__(self, qalgo, multiclass_classifier)
+     37         super().__init__(qalgo)
+     38         self.multiclass_classifier = multiclass_classifier
+---> 39         self.multiclass_classifier.params.append(qalgo)
+     40 
+     41     def train(self, data, labels):
+
+AttributeError: type object 'AllPairs' has no attribute 'params'
+
+

The code is :

+
seed = 10598
+
+feature_map = ZZFeatureMap(feature_dimension=feature_dim, reps=2, entanglement='linear')
+qsvm = QSVM(feature_map, training_input, test_input, multiclass_extension=AllPairs)
+```
+
+",12929,,9006,,8/13/2020 7:19,9/12/2020 8:00,Type object 'AllPairs' has no attribute 'params',,1,0,,,,CC BY-SA 4.0 +13280,1,,,8/12/2020 12:29,,3,54,"

I'm reading about cluster states using this online source. It is explained that a CNOT can be performed on cluster states using as little as $4$ qubits. However, the standard implementation is with $15$ qubits. Why is that the case?

+

Is it also possible with any number of qubits beyond $4$? So can I implement a CNOT in a cluster state with $5$ qubits for instance, and if yes, how?

+",2005,,55,,8/14/2020 6:10,8/14/2020 6:10,Limitations on the number of qubits for a $\mathrm{CNOT}$-gate in cluster states,,1,0,,,,CC BY-SA 4.0 +13281,2,,11606,8/12/2020 12:54,,1,,"

I have just realized that web interface of IBM Q was updated and custom gates, i.e.

+
gate ccu1 ( p ) c1, c2, t  {
+  cu1 ( p / 2 ) c1, c2;
+  cx c2, t;
+  cu1 ( - p / 2 ) c1, t;
+  cx c2, t;
+  cu1 ( p / 2 ) c1, t;
+},
+
+

is correctly transpiled to gates used in the custom gate and subsequently to basic gate set used on IBM Q.

+

Overall, custom gate functionality is now available in QASM.

+",9006,,,,,8/12/2020 12:54,,,,0,,,,CC BY-SA 4.0 +13282,1,13283,,8/12/2020 13:30,,1,1147,"

I'm relatively new to the subject of quantum computing, and I recently came across the idea of eigenvalues and eigenvectors. I believe I understand the relationship between the two, where eigenvalues determine the factor by which an eigenvector is stretched, and eigenvectors represent the direction that the transformation is pointing towards, but I was wondering how exactly eigenvectors and eigenvalues would be expressed in the Bloch sphere.

+",12915,,55,,8/14/2020 6:14,11/9/2020 17:49,How are eigenvectors and eigenvalues expressed in the Bloch sphere?,,2,0,,,,CC BY-SA 4.0 +13283,2,,13282,8/12/2020 14:04,,1,,"

The eigenvectors for a one-qubit unitary are two orthogonal vectors. As such, on the Bloch sphere, they are visualised as a single axis (going through the origin). (Remember that angles on the Bloch sphere are doubled so orthogonal states are an angle $\pi$ different on the Bloch sphere, i.e. opposite directions along the same axis.)

+

The eigenvalue (or, more precisely, the relative angle between the two eigenvalues) is the angle of rotation around that axis.

+",1837,,,,,8/12/2020 14:04,,,,0,,,,CC BY-SA 4.0 +13284,2,,13273,8/12/2020 14:55,,1,,"

They both are (almost) identical: +https://qiskit.org/documentation/_modules/qiskit/tools/monitor/job_monitor.html +https://qiskit.org/documentation/_modules/qiskit/providers/ibmq/job/job_monitor.html

+

The only difference is that qiskit.tools.monitor.job_monitor() have a argument named quiet, which is set to false by default:

+
job_monitor(job, interval=None, quiet=False, output=sys.stdout)
+
+

If we set to to true, it will not print any status message.

+

As a best practice, you can use help() function.

+

If we import the first version:

+
from qiskit.tools.monitor import job_monitor
+help(job_monitor)
+
+

Corrosponding output shows:

+
Help on function job_monitor in module qiskit.tools.monitor.job_monitor:
+
+job_monitor(job, interval=None, quiet=False, output=<ipykernel.iostream.OutStream object at 0x7fa9383ff7c0>)
+    Monitor the status of a IBMQJob instance.
+
+    Args:
+        job (BaseJob): Job to monitor.
+        interval (int): Time interval between status queries.
+        quiet (bool): If True, do not print status messages.
+        output (file): The file like object to write status messages to.
+        By default this is sys.stdout.
+
+

Now, if we import the second version:

+
from qiskit.providers.ibmq.job import job_monitor
+help(job_monitor)
+
+

Corrosponding output shows:

+
Help on function job_monitor in module qiskit.providers.ibmq.job.job_monitor:
+
+job_monitor(job: qiskit.providers.ibmq.job.ibmqjob.IBMQJob, interval: Union[float, NoneType] = None, output: <class 'TextIO'> = <ipykernel.iostream.OutStream object at 0x7fa9383ff7c0>) -> None
+    Monitor the status of an ``IBMQJob`` instance.
+
+    Args:
+        job: Job to monitor.
+        interval: Time interval between status queries.
+        output: The file like object to write status messages to.
+            By default this is sys.stdout.
+
+",12918,,,,,8/12/2020 14:55,,,,2,,,,CC BY-SA 4.0 +13285,2,,13282,8/12/2020 14:56,,0,,"

A state $\rho$ with Bloch sphere coordinates $\newcommand{\bs}[1]{\boldsymbol{#1}}\bs r\equiv (x,y,z)$ has the form +$$\rho = \frac{I + \bs r\cdot\bs \sigma}{2}\equiv \frac{I+x\sigma_x + y \sigma_y + z\sigma_z}{2}, $$ +with $\sigma_x,\sigma_y,\sigma_z$ the Pauli matrices.

+

Computing the eigenvalues (eigenvectors) of $\rho$ thus amounts to computing those of $\bs r\cdot\bs\sigma$. Observe that +$$\bs r\cdot\bs \sigma=\begin{pmatrix}z & x-iy \\ x+iy & -z,\end{pmatrix}$$ +and thus the eigenvalues are $\lambda_\pm = \pm\sqrt{-\det(\bs r\cdot\bs \sigma)}=\pm\|\bs r\|$. The corresponding eigenvectors are then seen to be +$$\lvert\lambda_\pm\rangle = \frac{1}{\sqrt{2\|\bs r\|(\|\bs r\|\mp z)}}\begin{pmatrix}x-iy \\ \pm \|\bs r\| - z\end{pmatrix}.$$ +The vectors in the Bloch sphere corresponding to $\lvert\lambda_\pm\rangle$ have coordinates +$$\begin{cases} +x_\pm &=& \pm x/ \|\bs r\|, \\ +y_\pm &=& \pm y/ \|\bs r\|, \\ +z_\pm &=& \pm z/ \|\bs r\|. +\end{cases}$$ +In other words, the eigenvectors of $\bs r\cdot\bs\sigma$ correspond to the two unit vectors in the Bloch sphere along the same direction as $\rho$.

+

The eigenvectors of $\rho$ are then clearly the same as those of $\bs r\cdot\bs \sigma$, while its eigenvalues are $(1\pm\lambda_\pm)/2$.

+",55,,55,,8/12/2020 15:16,8/12/2020 15:16,,,,2,,,,CC BY-SA 4.0 +13286,2,,13266,8/12/2020 15:04,,2,,"

How about using the data attribute, like this:

+
qc = QuantumCircuit(1)   
+initial_state = qc.initialize(random_statevector(2).data, 0)
+
+",12932,,,,,8/12/2020 15:04,,,,0,,,,CC BY-SA 4.0 +13287,2,,13280,8/12/2020 15:42,,1,,"

In answer to your second question, remember that you can always add any extra vertices (with arbitrary edges) to your graph. You just have to remove those vertices by using a $Z$ measurement on those qubits. It's kind of a cheat, which you perhaps didn't intend....

+

I think the reason for the "standard" implementation is that this is something that you can build out of the standard cluster state formed on the 2D square lattice, where the minimal one is not. Note that to have your separate qubit lines running from left to right, they have to be separated by another row that you (mostly) apply $Z$-measurements to. So the vertical line has two edges. I assume most of the extra qubits on the horizontal lines are there to compensate for the effect of those two vertical edges instead of one.

+",1837,,,,,8/12/2020 15:42,,,,0,,,,CC BY-SA 4.0 +13288,2,,13279,8/12/2020 16:25,,1,,"

The multiclass code was refactored a little some while ago. Here is a tutorial showing the use of these classifiers with QSVM that works with how things are now that should help https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/machine_learning/qsvm_multiclass.ipynb

+

You will see you now pass an instance of the multiclass in and no longer have that other setup around the multiclass extension and the algorithm.

+",9831,,,,,8/12/2020 16:25,,,,0,,,,CC BY-SA 4.0 +13289,1,,,8/12/2020 17:12,,5,335,"

Here it is explained how to define a custom non-parametric gate in Qiskit. How do I define a new parametric gate?

+

For example, I want to have the $CCR_y$ gate defined as

+

+

in order to use it as

+
qc.ccry(theta, c1, c2, targ)
+
+

Is this possible?

+",6313,,55,,8/14/2020 6:14,8/14/2020 6:14,Defining a custom parametric gate in Qiskit in terms of standard gates?,,1,3,,,,CC BY-SA 4.0 +13290,2,,13195,8/12/2020 19:07,,4,,"
    +
  1. it should be clear that the core of the Grover algorithm includes 3 steps

    +

    a) prepare initial state $|s\rangle$

    +

    b) apply $U=1-2|\omega\rangle\langle \omega|$

    +

    c) apply $D=2|s\rangle\langle s|-1$

    +

    then repeat step b and c

    +
  2. +
  3. In the original Grover algorithm, the diffusion operator is fixed as $D=2|s\rangle\langle s|-1$, which you can say it depends upon the initial state. Actually in the image of qiskit textbook, you can see the initial state is $|s\rangle=H^{\otimes n}|0\rangle^{n}$ +

    +
  4. +
  5. In the paper your reference, it extends the Grover algorithm, especially extends the diffusion operator from $|s\rangle$ (named as $\left|S_{1}\right\rangle$) to another 15 states $\left|S_{j}\right\rangle$

    +
  6. +
  7. For the equation you mentioned in the case of $j = 2$, the detail derivation is as follows: + +the tensor product formula can learn from here

    +
  8. +
+",12921,,,,,8/12/2020 19:07,,,,3,,,,CC BY-SA 4.0 +13291,1,,,8/12/2020 19:51,,13,249,"

If one generates an $n\times n$ Haar random unitary $U$, then clearly $\Pr(U=I)=0$. However, for every $\epsilon>0$, the probability +$$\Pr(\|U-I\|_{\rm op}<\varepsilon)$$ +should be positive. +How can this quantity be computed?

+",12167,,55,,4/30/2021 8:11,6/5/2021 17:42,What is the probability $\Pr(\|U-I\|_{\rm op}<\varepsilon)$ of a Haar-random unitary being close to the identity?,,1,10,,,,CC BY-SA 4.0 +13292,2,,13272,8/12/2020 22:59,,3,,"

I changed the stock parameter to a list of strings and added the line stockmarket = StockMarket.NASDAQ as such:

+
num_assets = 4
+
+# Generate expected return and covariance matrix from (random) time-series
+stocks = ['MSFT', 'DIS', 'NKE', 'HD']
+data = WikipediaDataProvider(
+                             token="xeesvko2fu6Bt9jg-B1T",
+                             tickers = stocks,
+                             stockmarket = StockMarket.NASDAQ,
+                             start=datetime.datetime(2016,1,1),
+                             end=datetime.datetime(2016,1,30))
+data.run()
+mu = data.get_period_return_mean_vector()
+sigma = data.get_period_return_covariance_matrix()
+print(mu)
+print(sigma)```
+
+",12924,,,,,8/12/2020 22:59,,,,0,,,,CC BY-SA 4.0 +13293,1,,,8/13/2020 0:29,,3,56,"

I'm trying to simulate a quantum network over a real classical network using the Simulaqron framework. I know the documentations says this is possible but I am having trouble finding examples of how to do this exactly. What are the steps to simulating a quantum network over a classical network in Simulaqron?

+

Also are there other frameworks that can do this?

+",12934,,55,,8/14/2020 6:01,8/14/2020 6:01,Simulating a Quantum Network over a real Classical Network Using Simulaqron,,0,2,,,,CC BY-SA 4.0 +13294,2,,12354,8/13/2020 2:57,,0,,"

I rechecked the small $w$ QFT for unitarity and it doesn't work. The off diagonal terms fail to cancel when input and output bases differ by multiples of $w$. However, the superposition only depends on the value of the first QFT $\mod w$. A prime-factor QFT can be factored if its basis is the product of two relatively prime numbers as described at

+

https://en.wikipedia.org/wiki/Prime-factor_FFT_algorithm

+

Then, the non-base $w$ part can be summed out and the QFT can be simplified to a base $w$ QFT. So if you assume $N=Lw$, the input and output indices can be rewritten as

+

$n = n_1L+n_2w$

+

$k = k_1 L' L + k_2 w' w $

+

where +$L' = L^{-1} \mod w$ and $w' = w^{-1} \mod L$

+

This represents modular structure of the indices

+

$n \mod w = n_1 L \mod w$ and $n \mod L = n_2 w \mod L$

+

$k \mod w = k_1 (L^{-1} \mod w)(L \mod w) + 0 = k_1 \mod w = k_1$ and

+

$k \mod L = 0 + k_2 (w^{-1} \mod L) (w \mod L) = k_2 \mod L = k_2$

+

$$ +X_{k_1 L' L + k_2 w' w} = \sum_{n_1=0}^{w-1} (\sum_{n_2=0}^{L-1} x_{n_1L+n_2w} \omega_{L}^{n_2k_2}) \omega_{w}^{n_1k_1} + $$

+

If you sum out the $\mod L$ subregister, leaving only the $\mod w$ subregister, you get

+

$$ +Y_{k_1}= \sum_{k_2=0}^{L-1}X_{k_1 L' L + k_2 w' w} = \sum_{n_1=0}^{w-1} (\sum_{k_2=0}^{L-1} \sum_{n_2=0}^{L-1} x_{n_1L+n_2w} \omega_{L}^{n_2k_2}) \omega_{w}^{n_1k_1} = \phi_L \sum_{n_1=0}^{w-1} y_{n_1L} \omega_{w}^{n_1k_1} = \phi_L \sum_{n_1=0}^{w-1} y_{n_3} \omega_{w}^{n_3L'k_1} + $$

+

Plancherel's theorem implies that the summed out probability (indexed by $n_1$) is constant before and after the application of a QFT. Assuming one performs the base $N$ QFT before the base $w$ QFT, $x_{n_1L+n_2w}$ will have solutions (= 0, 1) for all $n_1, n_2$ (i.e. for each index $n_1$, every index $n_2$ will have a basis vector with coefficient $1$), so the base $L$ part of the first QFT will have the same phase value for all $n_1$. So that, up to a constant phase, the QFT on the $\mod w$ subregister only depends on the base $w$ QFT.

+

It's possible to choose a good $L, N=Lw$ such that $N=Lw$ is very close to the group order and such that $L \mod w = 1$ so that both QFTs in the compressed 'classical' circuit can use a plain base $w$-QFT. Changing $L$ will cause small changes in the $w$ phases that are in superposition and induce (a typically sizeable) change in the overall phase.

+",9305,,,,,8/13/2020 2:57,,,,0,,,,CC BY-SA 4.0 +13295,1,13296,,8/13/2020 3:34,,5,736,"

I'm having trouble understanding Grover's Algorithm, so I'd like to start with the case with 1 qubit. But I don't see anyone build it for 1 qubit, only 2 is the minimum. Is it because that's impossible or too trivial? Can anyone provide me with an example of the circuit if it's trivial? Thank you!

+",7598,,55,,8/14/2020 6:20,8/14/2020 6:20,Can anyone provide me with an example of the for Grover's algorithm on one qubit?,,1,0,,,,CC BY-SA 4.0 +13296,2,,13295,8/13/2020 5:33,,11,,"

The case of 1 qubit turns out to be pretty bad for understanding Grover's algorithm. There are several scenarios for the function you're looking at:

+
    +
  1. Both inputs are solutions to $f(x) = 1$.
    +The classical solution takes one function evaluation, so there is no speedup.

    +
  2. +
  3. Both inputs are not solutions.
    +No matter how many iterations you do, Grover's algorithm is going to give you a random value which will not be a solution, which is not very interesting.

    +
  4. +
  5. Exactly one of the inputs is a solution.
    +This case is slightly more interesting. The classical solution is: pick a random input, and it has a 50% chance of being the answer, otherwise you'll need to check the second one.
    +Grover's search will start with a superposition of both inputs $\frac{1}{\sqrt2}(|0\rangle + |1\rangle)$; if you do a measurement immediately you'll get the correct answer with 50% chance. One Grover iteration will convert the system to the $\frac{1}{\sqrt2}(|0\rangle - |1\rangle)$ state - which also has 50% chance of measuring the correct answer! If you keep doing iterations, your probability of success is going to remain the same, so you're strictly worse off compared to the classical solution.

    +
  6. +
+

No solutions, all solutions and exactly half of the search space being solutions are all corner cases of Grover's search algorithm, and the single-qubit case doesn't have any other scenarios, so it's not very illustrative. That's why all sources start with at least 2 qubits.

+",2879,,,,,8/13/2020 5:33,,,,0,,,,CC BY-SA 4.0 +13297,2,,13264,8/13/2020 13:56,,3,,"

Here's an idea for somewhere to get started... (I have not worked through this in any more detail than presented here, but it looks plausible.) Let +$$ +U_{\Lambda}(\alpha_1,\alpha_2,\ldots,\alpha_{|\Lambda|}) +$$ +be a unitary that acts on a set of qubits $\Lambda$ such that, if those qubits start in the state $|0\rangle^{\otimes|\Lambda|}$, they are output in the state +$$ +\sum_i\alpha_i|0\rangle^{\otimes(i-1)}|1\rangle|0\rangle^{\otimes|\Lambda|-i}. +$$ +You say you already know how to do this.

+

Now consider wanting to make a state +$$ +\sum\beta_{i<j}|ij\rangle +$$ +(where $|ij\rangle$ is a shorthand to say 1s on qubits $i,j$ and 0 elsewhere) on $N$ qubits. Presumably we could do this by

+
    +
  1. let $\alpha_i=\sqrt{\sum_{j:j>i}|\beta_{ij}|^2}$.
  2. +
  3. Implement $U_{1,2,\ldots,N}(\alpha_1,\alpha_2,\ldots,\alpha_N)$.
  4. +
  5. Apply controlled-$U_{2,3,\ldots ,N}(\tilde\beta_{12},\tilde\beta_{13},\ldots,\tilde\beta_{1N})$ controlled off qubit 1, where $\tilde\beta_{ij}=\beta_{ij}/\alpha_i$. This gets all the terms correct where the first qubit is in the 1 state.
  6. +
  7. Then apply controlled-$U_{3,4,\ldots,N}(\tilde\beta_{23},\tilde\beta_{24},\ldots,\tilde\beta_{2N})$ where qubit 1 is controlled off $|0\rangle$, and qubit 2 is controlled off being in state $|1\rangle$.
  8. +
  9. Repeat in order until all are done. On the $n^{th}$ round, you control off $n$ qubits such that the first $n-1$ are in the $|0\rangle$ state and the $n^{th}$ is in the $|1\rangle$ state.
  10. +
+

This should get you the correct 2-excitation state. But this is a procedure that you can nest to get higher excitation states: for the $k$-excitation case, you first perform the division in steps 1 & 2, then replace the $U$s in the controlled-$U$ with the $k-1$ excitation version.

+",1837,,,,,8/13/2020 13:56,,,,0,,,,CC BY-SA 4.0 +13298,1,,,8/13/2020 14:51,,1,62,"

I just started using Qiskit and I have implemented the QSVM example. However, I having trouble with the return. The qsvm.predict() results are reasonable but when trying to calculate the margin myself, this does not make sense. I was hoping someone could help me:

+
xData = qsvm_res['svm']['support_vectors']
+yData = qsvm_res['svm']['yin']
+qsvm_alphas = qsvm_res['svm']['alphas']
+
+w = np.zeros(n_features)
+
+for n in range(len(qsvm_alphas)):
+    w += qsvm_alphas[n]*yData[n]*xData[n]
+
+

Thanks,

+

Matthias

+",12942,,5955,,8/20/2020 22:07,8/20/2020 22:07,Qiskit QSVM - Alphas and Support Vectors,,0,1,,8/24/2020 8:56,,CC BY-SA 4.0 +13299,2,,13289,8/13/2020 15:02,,2,,"

Although it might not be exactly what you are looking for, you can still use the method you would to create the non-parametric custom gate. You would just encapsulate it into a function that takes in the parameter and creates the custom gate:

+
def add_ccry(theta):
+    qc = QuantumCircuit(3)
+    qc.cry(theta/2, 1, 2)
+    qc.cx(0, 1)
+    qc.cry(-theta/2, 1, 2)
+    qc.cx(0, 1)
+    qc.cry(theta/2, 0, 2)
+    gate = qc.to_gate()
+    return gate
+
+qc = QuantumCircuit(3, 3)
+qc.append(add_ccry(np.pi), [0, 1, 2]) # As an example. Theta will be numpy.pi
+
+",6180,,6180,,8/13/2020 15:59,8/13/2020 15:59,,,,1,,,,CC BY-SA 4.0 +13300,1,13301,,8/13/2020 15:48,,2,108,"

I was wondering if the complexity of a quantum circuit that solves a problem that is in NP implies P=NP?

+",12302,,,,,8/13/2020 23:51,Does finding an algorithm that solves an NP-Problem in Polynomial time in a Quantum Computer imply P = NP?,,1,0,0,,,CC BY-SA 4.0 +13301,2,,13300,8/13/2020 16:07,,4,,"

In short, no — as things stand, if there were a polynomial-time algorithm to solve an $\mathsf{NP}$-complete problem on a(n idealised) quantum computer (with reasonably low error probabilities), this would not imply that $\mathsf{P} = \mathsf{NP}$. The question of "what problems are in $\mathsf{P}$" is a very different one from "what problems can you efficiently solve in principle on an idealised quantum computer".

+

The problems that are in $\mathsf{P}$, are not actually "the problems that can be solved in practise"; it is the set of decision problems that can be solved, in polynomial time, very specifically on a classical computer (more precisely: a deterministic Turing machine, or any model of computation which is polynomial-time equivalent to a deterministic Turing machine).

+

It is, perhaps, possible that there is a classical algorithm to efficiently simulate an idealised quantum computer, i.e., to simulate polynomial-time uniform quantum circuit families which produce outcomes in {0,1}. But we have no particular evidence that this is the case, and certainly no proof. So, if we discovered an $\mathsf{NP}$-complete problem L which happened to be solvable efficiently (and with low enough probability of error) by quantum computers — that is, if we discovered such a problem L, which belonged to the class $\mathsf{BQP}$ of problems solvable by a quantum computer in that sense — this would not necessarily provide us with any way to solve the problem in polynomial time using deterministic Turing machines (or in other words to show that L is also in $\mathsf{P}$), nor even any evidence in that direction.

+

More generally, there are no other formal results or other evidence to the effect that $\mathsf{NP} \subseteq \mathsf{BQP}$ only if $\mathsf{NP} = \mathsf{P}$. So, even if we could solve $\mathsf{NP}$-complete problems on a quantum computer, this wouldn't provide us with any proof (or formal reason to believe) that $\mathsf{P} = \mathsf{NP}$.

+

(It would, however, be an extremely exciting and surprising result.)

+",124,,124,,8/13/2020 23:51,8/13/2020 23:51,,,,2,,,,CC BY-SA 4.0 +13302,1,,,8/13/2020 16:26,,3,2284,"

I installed qiskit using qiskit documents from here https://qiskit.org/documentation/install.html. When I first installed qiskit the version was 0.12.xx on ubuntu with python installed. Everything was working great.

+

yesterday I needed qiskit version 0.19.6 for "IBM Advocate Test". When I run qiskit.__qiskit_version__
it shows

+
{'qiskit-terra': '0.xx.xx',
+ 'qiskit-aer': '0.x.x',
+ 'qiskit-ignis': '0.x.x',
+ 'qiskit-ibmq-provider': '0.x.x',
+ 'qiskit-aqua': '0.x.x',
+ 'qiskit': '0.12.xx'}
+
+

Then I run some commands that were in the test file so everyone trying to give the test have updated qiskit version.
Commands are:

+
!pip install --upgrade qiskit==0.19.6 
+!pip install --upgrade metakernel
+!pip install --upgrade portalocker
+!pip install --upgrade matplotlib
+
+

So after running them there were some sort of errors I don't remember, then I seek on internet and found something useful here

+

Updating qiskit doesn't update qiskit version from Spyder

But Qiskit just updated to version 0.13.xx. I have tried this Q&A but didn't work for me. I rebooted the kernel, restarted pc after running every aspect of command, tried on jupyter notebook and terminal.

+

Plz help me for what else needs to be done.

+",12944,,55,,8/14/2020 8:08,9/13/2020 20:01,Updating qiskit doesn't update qiskit version using jupyter notebook/terminal,,2,1,,,,CC BY-SA 4.0 +13303,1,13305,,8/13/2020 16:32,,5,223,"

In phase estimation, we start by using an eigenvector $\newcommand{\ket}[1]{\lvert#1\rangle}\ket u$ to find the corresponding eigenvalue lambda. So far so good. In the order finding algorithm, we also use phase estimation to find the eigenvalues for the unitary $\ket{xy\bmod N}$. +However, the eigenvectors/eigenvalues depend on the order $r$, which we don't know.

+

As a solution, textbooks note that the eigenvectors add up to $\ket1$ and then use that to initialize the phase estimation circuit.

+

My question is - why does that work? Why can I use the sum of eigenvectors and not just a specific eigenvector?

+",11582,,55,,8/19/2020 23:17,8/19/2020 23:17,Why can I use the Sum of Eigenvectors for Phase Estimation in Shor,,1,0,,,,CC BY-SA 4.0 +13304,1,13312,,8/13/2020 16:55,,3,108,"

A quote from the paper "Quantum annealing for constrained optimization" by I. Hen, F. M. Spedalieri:

+
+

Let us now consider the driver Hamiltonian +$$H_d = - \sum_{i=1}^n \left( \sigma_i^x \sigma_{i+1}^x + \sigma_i^y \sigma_{i+1}^y \right)$$ +where the label $i = n + 1$ is identified with $i = 1$ ... This driver has the following atractive properties (i) as can easily be verified, it obeys $[H_d, \sum_{i = 1}^n \sigma_i^z] = 0$; (ii)...

+
+

I don't see why $[H_d, \sum_{i = 1}^2 \sigma_i^z] = 0$. Note that for $n=2$ from this commutation relation we have:

+

$$H_d \left(\sigma_1^z + \sigma_2^z \right) = \left(\sigma_1^z + \sigma_2^z \right) H_d$$

+

and

+

$$H_d = -2\left(\sigma_1^x \sigma_{2}^x + \sigma_1^y \sigma_{2}^y \right)$$

+

but actually:

+

$$H_d \left(\sigma_1^z + \sigma_2^z \right) = -\left(\sigma_1^z + \sigma_2^z \right) H_d$$

+

because $\sigma^x \sigma^z = -\sigma^z \sigma^x$ and $\sigma^y \sigma^z = -\sigma^z \sigma^y$, hence $\sigma_1^x \sigma_{2}^x \sigma_1^z = -\sigma_1^z \sigma_1^x \sigma_{2}^x$ and the similar for other terms. So, in contradiction, instead of commuting operators, we have anticommuting operators $\{H_d, \sum_{i = 1}^2 \sigma_i^z \} = 0$. Where is my mistake(s)?

+
+

Edit

+

According to the answers below indeed $[H_d, \sum_{i = 1}^2 \sigma_i^z] = 0$. Also, the operators $H_d$ and $ \sum_{i = 1}^2 \sigma_i^z$ (for $n=2$) commute and anticommute at the same time and there is no contradiction (as I have wrongly stated above). This is because:

+

$$H_d \left(\sigma_1^z + \sigma_2^z \right) = \left(\sigma_1^z + \sigma_2^z \right) H_d = 0$$

+

Let's prove for the first part:

+

$$H_d \left(\sigma_1^z + \sigma_2^z \right) = -2\left(\sigma_1^x \sigma_{2}^x + \sigma_1^y \sigma_{2}^y \right) \left(\sigma_1^z + \sigma_2^z \right) = +\\ +=-2\left(-i \sigma_1^y \sigma_{2}^x + i \sigma_1^x \sigma_{2}^y \right) -2\left(-i \sigma_1^x \sigma_{2}^y + i\sigma_1^y \sigma_{2}^x \right) = 0 +$$

+",9459,,9459,,8/14/2020 10:50,8/14/2020 13:21,"The commutation relation $[H_d, \sum_{i = 1}^n \sigma_i^z] = 0$ from the paper about the constrained quantum annealing (CQA)",,2,0,,,,CC BY-SA 4.0 +13305,2,,13303,8/13/2020 17:17,,4,,"

As you say, we would be able to use phase estimation if we knew the eigenvector $|u_s \rangle$ that depends on the order $r$ and the integer $s$ which is $0 \leq s \leq r - 1$. However, we don't know the eigenvector, only the superposition of them, which is $|1 \rangle$. Now, what does phase estimation result in for a superposition? It is just a superposition of estimated phases because phase estimation is ultimately a linear operator.

+

So if we end up with a superposition of estimated phases, then we can make our measurement which will result in the phase for one of the eigenvectors. Which one? We don't know but we know that it is of the form $\frac{s}{r}$. Why does it have this form? Because of the form of the unitary's eigenvalue: $U |u_s \rangle = \exp \left[ 2 \pi i \frac{s}{r} \right] |u_s \rangle $. Using the fact that the phase is $\frac{s}{r}$, we can use the continued fractions algorithm to calculate both $s$ and $r$ (even though we only really care about $r$).

+",12643,,12643,,8/13/2020 17:26,8/13/2020 17:26,,,,1,,,,CC BY-SA 4.0 +13306,2,,13302,8/13/2020 18:22,,1,,"

The best way to not mix different versions is to use python virtual environments. If you are using python 3.3 or newer then you can easily do it as follows:

+
cd /path/to/qiskit/advocate/folder
+python3 -m venv /path/to/new/venv 
+
+

Replace the path in the above code with the appropriate path. Once that is done then you can use pip install qiskit==0.19.6. This is if you are accessing the shell via a terminal. If you are doing it from a jupyter notebook, then add ! in front of all these commands.

+

Also version 0.13.xx is lower than 0.19.6. So it would seem that somehow you have downgraded qiskit.

+",12785,,,,,8/13/2020 18:22,,,,0,,,,CC BY-SA 4.0 +13308,2,,13304,8/13/2020 21:01,,2,,"

Since $[\sigma_i^k,\sigma_j^k]=0$, you can expand the first product in $[H_d, \sum_{i = 1}^2 \sigma_i^z]$ as +$$\begin{align} +(\sigma_1^x \sigma_2^x + \sigma_1^y \sigma_2^y) (\sigma_1^z + \sigma_2^z)= & \sigma_2^x \sigma_1^x \sigma_1^z +\sigma_1^x \sigma_2^x \sigma_2^z + \sigma_2^y \sigma_1^y \sigma_1^z +\sigma_1^y \sigma_2^y \sigma_2^z +\\ = & i(-\sigma_2^x \sigma_1^y - \sigma_1^x \sigma_2^y + \sigma_2^y \sigma_1^x + \sigma_1^y \sigma_2^x) +\\=&i([\sigma_1^y,\sigma_2^x]+[\sigma_2^y,\sigma_1^x])=0 +\end{align}$$

+

and the second product as +$$\begin{align} +(\sigma_1^z + \sigma_2^z)(\sigma_1^x \sigma_2^x + \sigma_1^y \sigma_2^y)= & \sigma_1^z \sigma_1^x \sigma_2^x +\sigma_2^z \sigma_2^x \sigma_1^x + \sigma_1^z \sigma_1^y \sigma_2^y +\sigma_2^z \sigma_2^y \sigma_1^y +\\ = &i(\sigma_1^y \sigma_2^x + \sigma_2^y \sigma_1^x -\sigma_1^x \sigma_2^y - \sigma_2^x \sigma_1^y) +\\=&i([\sigma_1^y,\sigma_2^x]+[\sigma_2^y,\sigma_1^x])=0 +\end{align}$$ +showing that $[H_d, \sum_{i = 1}^2 \sigma_i^z]=0$ as claimed.

+",8623,,8623,,8/14/2020 13:21,8/14/2020 13:21,,,,5,,,,CC BY-SA 4.0 +13312,2,,13304,8/14/2020 7:42,,2,,"

There's the mathematical way of doing this (which I'll do in a moment), and there's a more conceptual side to it. Note that the operator $\sum Z_i$ has a bunch of eigenspaces, with eigenvalues $-N,2-N,4-N,\ldots,N-2,N$. The eigenspace $-N+2k$ is spanned by all basis states comprising $N-k$ $|0\rangle$s and $k$ $|1\rangle$s. Now, observe that a term $X_nX_{n+1}+Y_nY_{n+1}$ is a hopping term that preserves the number of excitations (the value $k$). Specifically it changes the state of the pair of qubits based on +$$ +00\rightarrow00,\quad 01\rightarrow 10,\quad 10\rightarrow 01,\quad 11\rightarrow 11. +$$ +So, you can see that the eigenspace of the $\sum_iZ$ operator does not change under that action. Similarly, the eigenvectors of $H_d$ can be grouped in terms of excitation number. An eigenvector of $H_d$ within a particular excitation subspace is unchanged by the action $\sum_iZ_i$ (because, within that excitation subspace, $\sum_iZ_i$ is just a multiple of the identity).

+

That should make commutation quite clear. For any eigenvector $|\lambda\rangle$, +$$ +[H_d,\sum_iZ_i]|\lambda\rangle=0, +$$ +and if it's true for every eigenvector, it's true for every state. If it's true for every state, the whole operator is 0.

+
+

Let's return to doing things the more obvious way. Unfortunately, just applying commutation properties is not very revealing. We want to calculate +$$ +(X_1X_2+Y_1Y_2)(Z_1+Z_2)-(Z_1+Z_2)(X_1X_2+Y_1Y_2). +$$ +What you want to compare are the two terms +$$ +X_1X_2Z_1-Z_2Y_1Y_2. +$$ +We recall that $X_1Z_1=-iY_1$ and $Z_2Y_2=-iX_2$, +so this is +$$ +-iY_1X_2+iY_1X_2=0. +$$ +Other pairs of terms cancel in a similar way.

+",1837,,,,,8/14/2020 7:42,,,,4,,,,CC BY-SA 4.0 +13313,1,13314,,8/14/2020 9:41,,4,678,"

I know how Grover's diffusion operator works ($U_s = 2|s\rangle\langle s|-I$) with the inversion around the mean. However, I want to implement it in simpler gates, to use the algorithm. How can I do this ?

+",8746,,55,,8/19/2020 23:23,8/19/2020 23:23,How can you decompose Grover's diffusion operator into gates?,,1,0,,,,CC BY-SA 4.0 +13314,2,,13313,8/14/2020 9:41,,6,,"

Grover's diffusion operator can be implemented with H, X and a controlled Z gate. I will show this mathematically. Since $|s\rangle = |+\rangle^{\otimes n} $ : +$$ +U_s = 2|s\rangle\langle s|-I = H^{\otimes n}(2|0\rangle\langle0|-I)H^{\otimes n} +$$ +We know have the H gate which appeared. We now know that we will have to apply the Hadamard gate to every qubit at the beginning and the end of Grover's diffusion operator. We will only work with $2|0\rangle\langle 0|-I$. $|0\rangle\langle0|$ is the outer product of the first basic state. It is a matrix filled with 0s only (0, 0) is filled with a 1. $I$ Is the identity matrix. +$$ +2|0\rangle\langle 0|-I = 2 +\begin {bmatrix} +1 & 0 & \cdots & 0 \\ +0 & 0 & \cdots & 0 \\ +\vdots & \vdots & \ddots & 0\\ +0 & 0 & 0 & 0 +\end {bmatrix} +- +I = +\begin {bmatrix} +2 & 0 & \cdots & 0 \\ +0 & 0 & \cdots & 0 \\ +\vdots & \vdots & \ddots & 0\\ +0 & 0 & 0 & 0 +\end {bmatrix} - +\begin {bmatrix} +1 & 0 & \cdots & 0 \\ +0 & 1 & \cdots & 0 \\ +\vdots & \vdots & \ddots & 0\\ +0 & 0 & 0 & 1 +\end {bmatrix} += +\begin {bmatrix} +1 & 0 & \cdots & 0 \\ +0 & -1 & \cdots & 0 \\ +\vdots & \vdots & \ddots & 0\\ +0 & 0 & 0 & -1 +\end {bmatrix} +$$ +We now have the matrix which represents $2|0\rangle\langle 0|-I$. It flips the phase of every state apart from $|0\cdots0\rangle$. If we apply a global phase of $-1$ (which can be ignored), we only have to flip the phase of $|0\cdots0\rangle$. +$$ +\begin {bmatrix} +1 & 0 & \cdots & 0 \\ +0 & -1 & \cdots & 0 \\ +\vdots & \vdots & \ddots & 0\\ +0 & 0 & 0 & -1 +\end {bmatrix} += -1 +\begin {bmatrix} +-1 & 0 & \cdots & 0 \\ +0 & 1 & \cdots & 0 \\ +\vdots & \vdots & \ddots & 0\\ +0 & 0 & 0 & 1 +\end {bmatrix} = -1 X^{\otimes n} +\begin {bmatrix} +1 & 0 & \cdots & 0 & 0 \\ +0 & 1 & \cdots & 0 & 0 \\ +\vdots & \vdots & \ddots & 0 & 0 \\ +0 & 0 & 0 & 1 & 0 \\ +0 & 0 & 0 & 0 & -1 \\ +\end {bmatrix} X^{\otimes n} +$$ +We can transform the matrix by applying the X gate to every qubit to only have to flip the phase of $|1\cdots1\rangle$ state. However, this matrix is only a controlled Z operation with all the qubits except the last one as control.

+

There we have it : Grover's diffusion operator with only H gates , X gates and a controlled Z gate. This paper describes a slightly different way to do it with a toffoli (CCNOT) gate but the method has the same complexity (I think). I hope this answered your question.

+",8746,,,,,8/14/2020 9:41,,,,0,,,,CC BY-SA 4.0 +13315,1,13324,,8/14/2020 9:58,,6,128,"

Consider an $N$-dimensional space $\mathcal H$. Two orthonormal bases $\newcommand{\ket}[1]{\lvert #1\rangle}\{\ket{u_j}\}_{j=1}^N,\{\ket{v_j}\}_{j=1}^N\subset\mathcal H$ are said to be Mutually Unbiased Bases (MUBs) if $\lvert\langle u_i\lvert v_j\rangle\rvert =1/\sqrt N$ for all $i,j$.

+

Suppose we want to fully reconstruct a state $\rho$ by means of projective measurements. A single basis provides us with $N-1$ real parameters (the $N$ outcome probabilities associated with the measurement, minus one for the normalisation constraint).

+

Intuitively, if two bases are mutually unbiased, they provide fully uncorrelated information (finding a state in some $\ket{u_j}$ says nothing about which $\ket{v_k}$ would have been found), and thus measuring the probabilities in two different MUBs should characterise $2(N-1)$ real parameters. +If we can measure in $N+1$ different MUBs (assuming they exist), it thus stands to reason that we characterised $(N-1)(N+1)=N^2-1$ independent real parameters of the state, and thus obtained tomographically complete information. +This is also mentioned in passing in this paper (page 2, second column, arXiv:0808.0944).

+

What is a more rigorous way to see why this is the case?

+",55,,5870,,8/17/2020 12:56,11/23/2020 19:31,Why does full state reconstruction require at least $N+1$ MUBs?,,1,0,,,,CC BY-SA 4.0 +13316,1,,,8/14/2020 11:51,,8,157,"

I'm quite new to this field, and have started sending jobs to IBM's quantum computers. I have access to around 11 locations. I can see that these have different numbers of qubits within them, and then different layouts of them as well.

+

I am trying to test a quantum machine learning network I have trained. However, when I test it on real hardware the different machines are giving me quite different results. For example, with ibmq_essex I get around 62% accuracy, while with ibmq_london I get around 70%.

+

I am curious to know:

+
    +
  • is there a particular reason for this, outside of just the inherent "randomness" of QM?
  • +
  • Are different IBM pieces of hardware better for different tasks?
  • +
+

Thanks

+",12955,,,,,10/1/2020 20:17,What are the differences between the IBM machines?,,3,1,,,,CC BY-SA 4.0 +13317,2,,5287,8/14/2020 12:27,,8,,"

I work in patents, rather than Quantum computing itself, but was looking a bit at this area. Patenting, so far, shows Element Six (a deBeers company ultimately owned by Anglo American) seem to have by far the most patents relating to diamond in quantum computing applications. I, also, found mention of a company called Quantum Brilliance, but there is not evidence of them in patents yet. But, note, there is a significant lag in such things becoming visible via patenting.

+",12956,,,,,8/14/2020 12:27,,,,0,,,,CC BY-SA 4.0 +13318,1,13322,,8/14/2020 12:40,,5,572,"

When running Grovers Algorithm one has to know how many solutions there are right? When the number of solutions are not known is then what do you do then?

+",11646,,491,,8/15/2020 21:37,8/15/2020 21:37,What to do when the amount of solutions is not known before applying Grovers Algorithm?,,1,0,,,,CC BY-SA 4.0 +13320,2,,13316,8/14/2020 13:48,,6,,"

Besides number of qubits, the devices can have other differences as well. The architecture of the device can be different, meaning that each device could have different connectivity maps. This would affect the mapping of valid multiqubit gates.

+

They also can have different error rates at any given time. Calibrations are run on each device daily. These error rates can change after each calibration. If one device has poor error rates compared to another device, it's accuracy will most likely be less than the device with the better error rates.

+

Those are some high level differences at least.

+",6180,,,,,8/14/2020 13:48,,,,0,,,,CC BY-SA 4.0 +13321,2,,13316,8/14/2020 13:59,,3,,"

The inherent uncertainty of QM is managed by making sure you're taking enough shots relative to the error bounds and probability of success for a given algorithm. If you don't have exact equations, and haven't done so already, just watching the extent to which your results convergence, or fail to converge, as you increase your shots, is a good first step.

+

Regarding differences between hardware, some information is aggregated here. But you can also map your logical qubits to the physical qubits of specific hardware, at specific optimization levels directly in Qiskit. This Q&A is a good example with corresponding code.

+

EDIT: Some of the links in the linked Q&A are apparently dead. This pulse tutorial has a lot of good information on getting backend information in Qiskit. +You may also find this tutorial on transpiler passes and optimization levels relevant.

+",8623,,8623,,8/14/2020 14:30,8/14/2020 14:30,,,,0,,,,CC BY-SA 4.0 +13322,2,,13318,8/14/2020 15:14,,6,,"

It's a good question, as the number of solutions is sometimes unknown. The approach is described in Algorithm 2 of this paper. Essentially, you can repeatedly apply Grover's, but incrementally (yet exponentially) increase the number of applications of the Grover iterate; thus, if you find the solution, you're done. Otherwise, because the prior trial failed, there are likely more solutions than expected, so you can increase the number of applications of the iterate.

+

The entire proof is sketched out here, but here's the brief pseudocode:

+
m = 1
+while m <= \sqrt{N}:
+   pick k in {1 ... m}
+   apply the Grover iterate k times to the superposition state
+   measure the register; if a solution, exit and return
+   otherwise, m = lambda * m
+
+

For some $ \lambda \in (1, \frac{4}{3}) $.

+

(Btw: This technique underlies Amplitude Amplification!)

+",8343,,,,,8/14/2020 15:14,,,,3,,,,CC BY-SA 4.0 +13323,1,,,8/14/2020 15:29,,4,144,"

In a text (section 3.6 page 92) about noiseless subsystems by D. Lidar, it is mentioned:'A subsystem is a tensor factor in a tensor product, and this does not have to be a subspace (e.g., in general it is not closed under addition).'

+

I do not understand how if some quantum states $\rho, \sigma \in \mathbb{C}^n \otimes \mathbb{C}^m$ +then how can their addition not be in $\mathbb{C}^n \otimes \mathbb{C}^m$?

+

Thank you in advance.

+",12047,,12047,,8/14/2020 16:10,9/2/2020 18:16,Is there a proof or example to show that a noiseless subsystem is not necessarily closed under addition?,,1,1,,,,CC BY-SA 4.0 +13324,2,,13315,8/14/2020 16:22,,4,,"

Denote the projections onto basis elements by $P_j^{(k)}=|u_j^{(k)}\rangle\langle u_j^{(k)}|$, where superscript indexes different bases. +Tomography of a density matrix $\rho$ gives us probabilities $\text{Tr}(\rho P_j^{(k)})$. +This is actually a value of the Hilbert-Schmidt inner product between $\rho$ and $P_j^{(k)}$ in the space $L(\mathcal{H})$ $-$ the complex space of all $N\times N$ matrices. +Such values can be used to reconstruct a projection of $\rho$ onto the $\text{span}\{P_j^{(k)}\}$ in the space $L(\mathcal{H})$. For a full reconstruction of $\rho$ we must have $\text{span}\{P_j^{(k)}\}_{j,k} = L(\mathcal{H})$.

+

Since $\sum_{j=1}^N P_j^{(k)} = I$ we can write +$$ + \text{span}\{P_j^{(k)}\}_{j=1}^N = \text{span}\{P_j^{(k)}-I/N\}_{j=1}^{N-1} \oplus \langle I\rangle = \mathcal S_k \oplus \langle I\rangle, +$$ +where $\mathcal S_k$ is a subspace of dimension $N-1$ in $L(\mathcal{H})$.

+

The element $I$ is special since we a priory know the length of projection on it $\text{Tr}(\rho I) = 1$ (so we could consider the space $L(\mathcal{H}) \ominus \langle I\rangle$ of dimension $N^2-1$, but it's easier for me to work in the full space).

+

Now note that +$$ +\text{Tr}\big((P_i^{(k)}-I/N)(P_j^{(l)}-I/N)\big) = 0 +$$ +whenever $k\neq l$. This means that $\mathcal S_k \perp \mathcal S_l$. Hence the dimension of the span of $P_j^{(k)}$ of $m$ MUBs is exactly $m(N-1)+1$ in $L(\mathcal H)$.

+",5870,,5870,,11/23/2020 11:06,11/23/2020 11:06,,,,0,,,,CC BY-SA 4.0 +13325,1,13327,,8/14/2020 17:25,,4,199,"

I'm studying Deutsch–Jozsa algorithm and I don't understand this passage about Hadamard gate result:

+

$$\newcommand{\ket}[1]{\lvert #1\rangle}H\ket x=\frac{1}{\sqrt2}(\ket0+(-1)^x\ket1)=\frac{1}{\sqrt2}\sum_{z\in\{0,1\}}(-1)^{xz}\ket z$$

+

Why this equivalence is true? In particular, what is $z$?

+",11696,,55,,8/15/2020 6:45,8/15/2020 6:45,"Why does the Hadamard gate satisfy $H|x\rangle=\frac{1}{\sqrt2}\sum_{z\in\{0,1\}}(-1)^{xz}\lvert z\rangle$?",,2,0,,,,CC BY-SA 4.0 +13327,2,,13325,8/14/2020 17:37,,5,,"

This is just a compact way of representing the Hadamard operator. The summation operator can be expanded, yielding:

+

$$ \frac{1}{\sqrt{2}} \Big( (-1)^{x \cdot 0} | 0 \rangle + (-1)^{x \cdot 1} | 1 \rangle \Big) = \frac{1}{\sqrt{2}} \Big( |0\rangle + (-1)^x |1 \rangle \Big) $$

+

This occurs because the matrix representation of the Hadamard operator is:

+

$$ \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 1 \\ 1 & -1 \end{bmatrix} $$

+",8343,,8343,,8/14/2020 19:17,8/14/2020 19:17,,,,2,,,,CC BY-SA 4.0 +13328,2,,13325,8/14/2020 19:10,,1,,"

Hadamard gate is used in the Deutch - Jozsha algorithm to prepare a superposition representing all possible bit combinations. It uses the quantum parallelism concept to compute all values of f(x) from the superposition in polynomial time, instead of growing exponentially with the number of bases. We can breakdown the algorithm into the following major steps.

+
    +
  1. We initially prepare two quantum registers. The first is an n-qubit +register initialized to |0>, and the second is a one-qubit register +initialized to |1>.

    +
  2. +
  3. Then we apply a Hadamard gate to each qubit. At this stage, our input register is an equal superposition of all the states in the computational basis.

    +
  4. +
  5. Then the quantum oracle is applied such that it does not decohere the inputs.

    +
  6. +
  7. At this point, the second single qubit register may be ignored.

    +
  8. +
  9. Then we apply a Hadamard gate to each qubit in the first register.

    +
  10. +
+

In this approach, we are constructing a constant and balanced oracle. When the oracle is constant, it has no effect on the input qubits, and the quantum states before and after querying the oracle are the same. The following quantum circuit diagram depicts the algorithm.

+

+",4501,,4501,,8/14/2020 19:17,8/14/2020 19:17,,,,0,,,,CC BY-SA 4.0 +13329,2,,13302,8/14/2020 19:44,,4,,"

I accidentally encountered the solution. Sorry I didn't tried your solution butwe have a solution. +So

+
    +
  1. you need to make sure that you have updated python version.

    +
  2. +
  3. run this command conda info --env to check your conda environments it should look like this

    +
    # conda environments:
    +#
    +base                  *  /home/alrazi/anaconda3
    +python3-env              /home/alrazi/anaconda3/envs/python3-env
    +
    +
  4. +
+

Now the Solution is simple and it works fine on different issues like I have

+

"Collecting qiskit +Cache entry deserialization failed, entry ignored +Could not find a version that satisfies the requirement qiskit (from versions: ) +No matching distribution found for qiskit"

+

Start-up your system and open the terminal type these commands:

+
sudo apt-get update
+sudo apt-get dist-upgrade
+conda info --env   
+
+

it will give you least one environment which is most of the time named as "base" or something else if you installed anaconda with more customization. Now activate the one with asterisk "*".

+
conda activate base
+pip install qiskit --upgrade
+
+

so it will take some time. I am showing you some last lines +

+

Here you can see the qiskit 0.19.6 is uninstalling and it is installing 0.20.0

+

Make sure you have the latest version of python, and qiskit installed because they rely on each other that's why you should never install custom qiskit versions without knowing the correct python related versions.

+

you can check the qiskit and all of it's components version by typing:

+
conda list
+
+

and I got this after scrolling up

+
qiskit                    0.20.0                   pypi_0    pypi
+qiskit-aer                0.6.1                    pypi_0    pypi
+qiskit-aqua               0.7.5                    pypi_0    pypi
+qiskit-ibmq-provider      0.8.0                    pypi_0    pypi
+qiskit-ignis              0.4.0                    pypi_0    pypi
+qiskit-terra              0.15.1                   pypi_0    pypi
+
+

rebooting your pc will give you some extra powers at this point.

+

Mashaallah! we got working and upto date Qiskit. Now you can run Jupyter Notebook without any casualty Inshaallah.

+",12944,,,,,8/14/2020 19:44,,,,0,,,,CC BY-SA 4.0 +13330,2,,13316,8/14/2020 19:48,,5,,"

First of all, the name of backends (devices) have nothing to do with their location! They are all located in US.

+

Back to your question, as others already mentioned the difference is in the architecture (topology), number of qubits, connectivity, and performance (influenced by various types of errors).

+

If you click the name of any backend (device) in your IBM_Q Experience dashboard, you'll see detailed information about the error rate for each backend.

+

For example ibmq_london and ibmq_essex have the same topology and number of quits but qubit_1 in ibmq_london has lower gate error rate compared to the same qubit in ibmq_essex. +That's the reason applying the same gate to same qubits on different backends, results in different output.

+

+
+

Update

+
+

is there a particular reason for this, outside of just the inherent "randomness" of QM?

+
+

Yes, the reason is the difference in performance between devices.
+Many factors influence the performance such as number of qubits, connectivity, gate errors (operational error rates), measurement errors (readout error), retention errors (decoherence and dephasing errors).

+
+

Are different IBM pieces of hardware better for different tasks?

+
+

As long as the number of qubits doesn't limit your choice of device, you'd always go for devices with higher Quantum volume (higher performance). You can find QV in backend specification for each device.

+",9318,,9318,,10/1/2020 20:17,10/1/2020 20:17,,,,0,,,,CC BY-SA 4.0 +13331,2,,5895,8/15/2020 1:58,,3,,"

Exactly, it's a little bit difficult to find related examples except matthew mentioned. The link is out of date and the update one is here:

+

2_relaxation_and_decoherence

+

2_relaxation_and_decoherence.ipynb

+

It contains lots of figures, perhaps they are what you want.

+",12922,,,,,8/15/2020 1:58,,,,0,,,,CC BY-SA 4.0 +13332,1,,,8/15/2020 10:29,,1,63,"

The fidelity between two density matrix $\rho$ and $\sigma$ is the following:

+

$$F(\rho,\sigma)=\operatorname{Tr}\left[\sqrt{\sqrt{\rho} \sigma \sqrt{\rho}} \right]^2$$

+

If one of the two state is a pure state the expression is very easy, but in general it is this one. +To compute it I would naïvely diagonalise $\rho$ to find $\sqrt{\rho}$, then compute $\sqrt{\rho} \sigma \sqrt{\rho}$, then diagonalize again to find the square root: $ \sqrt{\sqrt{\rho} \sigma \sqrt{\rho}}$, take the trace and square.

+

It is a "complicated" thing to do.

+

I wondered if there are tricks to compute fidelity between two mixed states ? Also, are there some "usual" tricks to make proof based on that (like proving inequalities).

+

Again my "confusion" is that this formula for two mixed state is not easy to handle so I wondered if I see it under the wrong angle ?

+",5008,,55,,8/19/2020 22:29,8/19/2020 22:29,"Calculating fidelity for mixed states: are there tricks or it is ""brute force"" calculations?",,0,1,,,,CC BY-SA 4.0 +13334,1,13337,,8/15/2020 13:56,,4,857,"

In the book "Quantum Computer Science", when explaining the error correction code, it uses this picture and says "the action of controlled-z is unaltered by exchanging the target and control qubits".

+

Does this mean that the act of cZ(control ancilla qubit and target codeword qubit) is equal to cz(control codeword qubit and target ancilla qubit)? If this is the case, why is that?

+

In my understanding, |1>Z|0>(first qubit is control qubit) is not equal to Z|0>|1>(second qubit is control qubit).

+

+",9105,,55,,8/19/2020 22:29,9/22/2020 6:13,Why is the action of controlled-Z unaltered by exchanging target control qubits?,,1,0,,,,CC BY-SA 4.0 +13335,1,13336,,8/15/2020 14:34,,2,63,"

I'm a communication engineering student. And I'm thinking of doing my project on BB84 protocol but I don't know where to start. As a beginner, are there any documents or tutorials about quantum networks and how to use simulators like QuISP or Simulaqron?

+",12950,,55,,8/18/2020 9:00,8/18/2020 9:00,Any good resources for learning about quantum networks and how to do a simulation of BB84 protocol?,,1,0,,,,CC BY-SA 4.0 +13336,2,,13335,8/15/2020 14:45,,1,,"

A very good book about quantum networks (with a communication engineering flavour) is "Quantum Networking" by Rodney Van Meter.

+

Regarding SimulaQron, look at this simple tutorial for getting started:

+

https://softwarequtech.github.io/SimulaQron/html/GettingStarted.html

+

I strongly suggest to read the main paper on SimulaQron (https://arxiv.org/abs/1712.08032) +where the BB84 example is clearly illustrated.

+",5551,,5551,,8/15/2020 18:06,8/15/2020 18:06,,,,1,,,,CC BY-SA 4.0 +13337,2,,13334,8/15/2020 15:13,,7,,"

If we have an arbitrary two qubit state:

+

$$|\psi \rangle = a |00\rangle + b|01\rangle + c|10\rangle + d|11\rangle$$

+

then after applying $CZ_{1 \rightarrow 2}$ controlled from the first qubit we will obtain:

+

$$CZ_{1 \rightarrow 2}|\psi \rangle = a |00\rangle + b|01\rangle + c|10\rangle - d|11\rangle$$

+

because control operation works when the control qubit is $|1\rangle$ and $Z$ gate changes the sign of the amplitude of the $|1\rangle$ state, hence $CZ_{1 \rightarrow 2}$ action is changing the sign of the $|11\rangle$.

+

Now the action of $CZ_{2 \rightarrow 1}$:

+

$$CZ_{2 \rightarrow 1}|\psi \rangle = a |00\rangle + b|01\rangle + c|10\rangle - d|11\rangle$$

+

The same is true here only the sign of the $|11\rangle$ should be changed because of similar reasons. This can be seen also by using matrices:

+

$$CZ_{1 \rightarrow 2} = |0\rangle \langle 0| I + |1 \rangle \langle 1| Z = \\ += +\begin{pmatrix} +1&0&0&0 \\ +0&1&0&0 \\ +0&0&1&0 \\ +0&0&0&-1 \\ +\end{pmatrix}=\\ +=I |0\rangle \langle 0| + Z |1 \rangle \langle 1| = CZ_{2 \rightarrow 1} +$$

+",9459,,9459,,9/22/2020 6:13,9/22/2020 6:13,,,,1,,,,CC BY-SA 4.0 +13340,1,,,8/16/2020 2:25,,2,256,"

My main question: Can someone please explain to me how the list of array is used to define the dimension in qutip?

+

Context:

+

If I have my density operator A = Qobj(np.arange(1,65).reshape(8,8)) of 3 qubits, how do I take the partial transpose such that I want to make bipartite entanglement between qubit 1 with qubit 2 and 3?

+

I am guessing that I would have to define my mask as X.dims = [[2,4],[2,4]] and take qt.partial_transpose(X, [1,0]) which taking partial transposition over the second subsystem. But what does this X.dims = [[2,4],[2,4]] mean in qutip?

+

If this is correct then how would I define my dimension for entanglement between qubit 1 and 3 and qubit 2?

+",12967,,10480,,3/26/2021 4:39,3/26/2021 4:39,Defining dimension of an operator in qutip,,1,0,,,,CC BY-SA 4.0 +13341,1,13344,,8/16/2020 2:56,,4,721,"

A quantum algorithm begins with a register of qubits in an initial state, a unitary operator (the algorithm) manipulates the state of those qubits, and then the state of the qubits is read out (or at least some information about the state on a single run of the algorithm).

+

It seems to me that a quantum computer answers the question of the unitary acts on the quantum state. This is "just" a matter of linear algebra. It strikes me, then, that quantum computers can be seen as linear algebra calculators.

+

Why then do we need quantum mechanics? Can we not find a classical system which implements linear algebra operations and use this to implement the algorithms which have been designed for quantum computers? Of course classical digital computers will not suffice, these machines are based on binary processing of information rather than the manipulation of vectors in a high dimensional space.

+

Question: Are there any candidates for classical linear algebra solvers (classical analog computers) which could implement the "quantum computer" algorithms whiles enjoying a similar speedup over digital classical computers?

+

Question 2: Perhaps I'm over simplifying by reducing a quantum computer to being simply a linear algebra solver. Is this the case? What complexity am I glossing over?

+",12968,,55,,8/18/2020 8:32,8/18/2020 8:32,Can classical linear algebra solvers implement quantum algorithms with similar speed-ups?,,2,1,,,,CC BY-SA 4.0 +13342,1,,,8/16/2020 9:12,,2,177,"

I'm interested in the field of distributed quantum computing, i.e. using multiple smaller quantum devices/circuits to cooperate to be able to perform some task that would require a larger device (where large/small refers to the total number of qubits the device has).

+

I'm looking for simple, abstract problems that could be solved when such a paradigm is utilized. +To be even more specific, I wonder if sharing entangled states between such devices is a must in this type of problems, or are there tasks that could be broken down in such a way that each device performs some quantum computation independently from the others, and they all use classical communication to share partial results etc.

+

Does anyone know any articles on the subject? Thanks!

+",12971,,55,,8/18/2020 8:46,2/14/2021 22:00,Distributed quantum computing with classical communication,,2,0,,,,CC BY-SA 4.0 +13343,2,,13342,8/16/2020 11:38,,1,,"

One of the possible methods for distributed quantum computing is remote quantum entanglement. There is a proposal by Mihir Pant and others to develop protocols for quantum “repeater” nodes, which enable a pair of users to achieve large gains in entanglement rates in a linear chain of quantum repeaters, by exploiting the diversity of multiple paths in the network. They are trying to develop quantum repeater protocols that enable multiple user pairs to generate entanglement simultaneously at rates that can far exceed what is possible with repeaters time-sharing among assisting individual entanglement flows. Please find more details about this approach in the following research article published by Nature.

+

There is a paper published in arxiv about using Quantum Interconnects for Distributed Quantum Computing and Quantum Internet. It is more of a compilation of necessary distributed quantum computing modules for the realization of a quantum internet. Quantum interconnects (QuICs) are devices or processes that allow the transfer of quantum states between two specified physical degrees of freedom (material, electromagnetic, etc.), or, more broadly, connect a quantum system with a classical one. It will be nice if you can explore this paper to see the details of the QuICs components.

+

There is another recent work on the use of distributed quantum phase estimation algorithms with two different distribution schemes. Please find the summary of this paper shared in ResearchGate and EuropePMC.

+",4501,,,,,8/16/2020 11:38,,,,0,,,,CC BY-SA 4.0 +13344,2,,13341,8/16/2020 11:59,,5,,"

The complexity that you are glossing over is that in the general case you need to store $2^n$ complex amplitudes to even represent an $n$ qubit system classically. Therefore, for a quantum computer of let's say 1000 qubits you need to store $2^{1000}$ complex amplitudes. Even if you use one atom per amplitude to do this, you still run out of atoms in the observable universe.

+

As far as I know, the above is the general argument. However, there might still be ways to represent certain quantum algorithms in a classically tractable manner by utilising some clever insight to save on the representational needs of the algorithm, thereby going below the $2^n$ requirement. But this is likely to be problem-specific and unlikely to work in the general case.

+",12643,,,,,8/16/2020 11:59,,,,5,,,,CC BY-SA 4.0 +13346,2,,13341,8/16/2020 14:17,,3,,"

As per the question's statement regarding digital vs. analog computation, there are other threads on this site that have inquired about similar proposals. See, e.g., here, and here. Among other things, classical analog systems cannot engage in entanglement; thus recasting a quantum computer as an analog computer will not lead to the same observed speed-up.

+

Nonetheless, further to @Attila Kun's answer there are specific problems in linear algebra/machine learning that have had fast quantum algorithms but have been recast as classical algorithms having similar speedups.

+

For example, the recommendation problem used by Netflix/Amazon/etc. has a fast algorithm on a quantum computer. This algorithm showed exponential improvement over the (then) best-known classical algorithm.

+

However, in attempting to prove that the quantum algorithm truly was superior, E. Tang showed that there was indeed a "classical system which implements linear algebra operations and use[s] this to implement the algorithms which have been designed for quantum computers".

+

Tang's work has kicked off a program of dequantization - i.e. of redesigning fast quantum algorithms in linear algebra/machine learning as fast classical algorithms. A Quanta Magazine article describes the problem and Tang's approach.

+

Which problems are amenable to this dequantization is an active area of research, as this thread discusses. This may depend on the rank of the matrices considered.

+",2927,,2927,,8/16/2020 16:25,8/16/2020 16:25,,,,0,,,,CC BY-SA 4.0 +13347,1,13460,,8/16/2020 16:30,,8,381,"

The (pending-peer review) proof of $MIP^\ast=RE$ in this pre-print has been hailed as a significant breakthrough. The significance of this result is addressed by Henry Yuen (one of the authors) in this blog post. Scott Aaronson also lists some of the major implications in this blog post.

+

For a non-local game ($G$), define the supremum of success probabilities for non-relativistic tensor product strategies as $\omega^\ast(G)$, and the supremum of success probabilities for a relativistic commuting operator (QFT) strategy as $\omega^{co}(G)$. Since non-relativistic QM is a special case of QFT, it's clear that an optimal commuting operator-based strategy is at least as good as an optimal tensor product-based strategy, $\omega^\ast(G) \le \omega^{co}(G)$.

+

My understanding of Yuen's post is that one consequence of $MIP^\ast=RE$ is that non-local games exist for which $\omega^\ast(G) < \omega^{co}(G)$. Specifically, he says

+
+

There must be a game $G$, then, for which the quantum value is different +from the commuting operator value. But this implies Tsirelson’s +problem has a negative answer, and therefore Connes’ embedding +conjecture is false.

+
+

I understand this to mean that there is a class of problems for which algorithms using techniques from QFT (commuting operators) have higher success probabilities than algorithms using techniques from non-relativistic QM (tensor products, quantum circuit formalism).

+

The first part of my question is, assuming this proof stands:

+
    +
  • Does $MIP^\ast=RE$ imply that there is a set of problems that can be solved more efficiently by employing the mathematical formalism of QFT (commuting operators) rather than non-relativistic QM formalism (conventional quantum circuits)?
  • +
+

Unless I am misinterpreting, this seems to follow directly from Yuen's statements. If that's so, is it possible that there exists a set of non-local games for which $\omega^\ast(G) < 0.5$ and $\omega^{co}(G) > 0.5$? Specifically, the second part of my question is:

+
    +
  • Does $MIP^\ast=RE$ imply that there is (or might be) a set of problems that can be solved using commuting operators that cannot be solved using quantum circuits, or is this possibility forclosed by the universality of the quantum circuit model?
  • +
+

EDIT: Henry Yuen has created an MIP* Wiki for those interested in better understanding this complexity class or the $MIP^\ast = RE$ result.

+",8623,,8787,,8/25/2022 14:58,8/25/2022 14:58,Consequences of $MIP^\ast=RE$ Regarding Quantum Algorithms,,1,4,,,,CC BY-SA 4.0 +13348,1,13461,,8/16/2020 17:12,,4,308,"

I am reading Distance measures to compare real and ideal quantum processes and it is explained the motivation behind Bures metric and angle metric.

+

Bures metric is defined as:

+

$$B(\rho,\sigma)=\sqrt{2-2 F(\rho,\sigma)}$$

+

Angle metric is defined as:

+

$$A(\rho,\sigma)=\arccos(\sqrt{F(\rho,\sigma)})$$

+

Where $F(\rho,\sigma)$ is the fidelity between $\rho$ and $\sigma$ density matrices. He says that we can understand such motivation on pure states: we would see it comes from the usual euclidian distance.

+

If I do such calculations, I would define the euclidian distance as:

+

$$d(X,Y)=||X-Y||=\sqrt{\langle X-Y | X-Y \rangle}=\sqrt{2-2 Re(\langle X | Y \rangle)} $$

+

To find the Bure metric I have to assume $\langle X | Y \rangle \geq 0$.

+

But why would it be the case ? For instance if I consider:

+

$$|\psi \rangle = | a \rangle + |b \rangle $$

+

I cannot change the relative phase between $|a \rangle$ and $|b \rangle$ as I want (because it would change the physical state $|\psi \rangle$). Thus if $\langle a | b \rangle $ is not a positive number I guess there is nothing much I can do for that.

+

How to understand the intuition behind such metric then? Should I actually consider it as an "abstract" definition on which I verify that it satisfies the axioms of a metric? But it would be weird in the way the paper explains the motivation behind.

+

Similar question for the angle metric.

+

[edit]: I think it might come from the fact we want to define a distance between physical states. Considering $|\Phi \rangle$ and $| \Psi \rangle$ two physical state, their global phase do not matter. Thus, to have a simple formula we can choose their phases $\phi_{\Psi}, \phi_{\Phi}$ so that $\langle \Psi | \Phi \rangle \geq 0$ which correspond to the upper bound: $\sup_{\phi_{\Psi}, \phi_{\Phi}}(Re[\langle \Psi | \Phi \rangle])=\langle \Psi | \Phi \rangle$. It somehow makes sense because we are interested into distance between physical +and not mathematical states. We can thus fix the global phases of the two states as we would like.

+

Does that make sense ?

+",5008,,5008,,8/23/2020 11:03,8/25/2020 10:26,What is the intuition behind Bures and angle metrics?,,1,8,,,,CC BY-SA 4.0 +13349,1,,,8/16/2020 18:39,,1,25,"

Let $\rho\in\mathrm{D}(\mathcal H)$ be a state in some (finite-dimensional) Hilbert space $\mathcal H$ and suppose that $\operatorname{rank}(\rho)=r$. +This means that we can write it as +$$\rho = \sum_{k=1}^r p_k \mathbb P_{u_k}, \quad\text{with}\quad p_k>0, \,\,\sum_k p_k=1, \,\, \mathbb P_{u_k}\equiv \lvert u_k\rangle\!\langle u_k\rvert.\tag1$$

+

The set of purifications of $\rho$ is easily characterised as the set of states $\newcommand{\ket}[1]{\lvert #1\rangle}\ket\psi\in\mathcal H\otimes \mathcal H_A$, with $\dim\mathcal H_A=r$, that have the form +$$\ket\psi=\sum_{k=1}^r \sqrt{p_k} \ket{u_k}\otimes\ket{v_k},\tag2$$ +for any orthonormal basis $\{\ket{v_k}\}_{k=1}^r\subset \mathcal H_{A}$. +We can of course also consider purifications with larger ancillary spaces, but those would be trivially reducible to the case with $\dim\mathcal H_A=r$.

+ +

Consider now the more general set of extensions of $\rho$. +This is the set of states $\tilde\rho\in\mathrm{D}(\mathcal H\otimes\mathcal H_A)$, for some auxiliary space $\mathcal H_A$, such that $\operatorname{Tr}_A\tilde\rho=\rho$. An example of a non-pure extension for a qubit can be found e.g. in this answer.

+

One way to characterise extensions is to observe that any extension can be written as the partial trace of a purification. As per our observation above about purifications, we can take a purification $\ket\psi$ that uses a bipartite auxiliary space, $\mathcal H_A=\mathcal H_B\otimes\mathcal H_C$, so that $\ket{v_k}\in\mathcal H_B\otimes\mathcal H_C$, and then tracing out $\mathcal H_C$ gives +\begin{align}\newcommand{\ketbra}[2]{\lvert #1\rangle\!\langle #2\rvert} +\tilde\rho + = \sum_k \sqrt{p_j p_k} \ketbra{u_j}{u_k}\otimes \operatorname{Tr}_C[\ketbra{v_j}{v_k}] + = \sum_k \sqrt{p_j p_k} \ketbra{u_j}{u_k}\otimes \sigma_{jk}, +\tag3 +\end{align} +where $\sigma_{jk}\equiv \operatorname{Tr}_C[\ketbra{v_j}{v_k}]\in\mathrm{Lin}(\mathcal H_B)$ is such that $\operatorname{Tr}(\sigma_{jk})=\delta_{jk}$. +Any extension can be written as (3), as if $\tilde\rho$ is a generic extension, then its purification has the form in Eq. (2), and then partial tracing we get the form in Eq. (3).

+

Are there nicer/more elegant/terser characterisations for the set of extensions of $\rho$?

+",55,,,,,8/16/2020 18:39,Is there a nice characterisation for the set of extensions of a given state?,,0,0,,,,CC BY-SA 4.0 +13350,1,,,8/16/2020 19:25,,2,81,"

So when trying to load my account I get this error:

+
ibmqfactory._initialize_providers:WARNING:2020-08-16 17:47:17,410: Unable to instantiate provider for {'hub': 'ibm-q', 'group': 'open', 'project': 'main'}: "{'online_date': ['Not a valid datetime.']}"
+ibmqfactory.load_account:WARNING:2020-08-16 17:47:17,411: No Hub/Group/Projects could be found for this account. 
+
+

I have tried changing the date format on my machine but other than that I'm lost.

+",12975,,55,,8/18/2020 8:55,1/5/2023 15:03,Qiskit IBMQ.load_account fails on version 0.20.0,,1,3,,,,CC BY-SA 4.0 +13351,1,,,8/16/2020 19:42,,3,160,"

I am trying to find the cost for a n-bit Toffoli gate based on the recurrent circuit presented on Barenco's Work in Lemma 7.5 (Elementary gates for quantum computation)

+

The construction requires that we iteratively take the square root of Pauli X. I was wondering if there is some proof that we can always take the square root of Pauli X as many times as possible?

+",12302,,9006,,8/17/2020 8:04,8/17/2020 8:04,Can you take infinitely many square roots of Pauli-X?,,1,0,,,,CC BY-SA 4.0 +13353,2,,13351,8/16/2020 20:37,,4,,"

Unitary matrices can be raised to any power, including fractional powers, so any root you want you can find. You find the root by eigendecomposing the matrix, modifying the eigenvalues (raising them to the desired power), then putting the matrix back together.

+

In the case of the Pauli X matrix, the eigenvectors are $|+\rangle\langle +|$ and $|-\rangle\langle -|$ so you can find roots like this:

+

$$X^s = \frac{1}{2}\begin{bmatrix} 1 & 1 \\ 1 &1\end{bmatrix} + \frac{e^{i \pi s}}{2}\begin{bmatrix} 1 & -1 \\ -1 & 1\end{bmatrix}$$

+

Once that's done the actual challenge is realizing $X^s$ gates using the gate set you have available on your computer. For example, if you're using the Clifford+T gate set then you could approximate the rotation using a series of H and T gates.

+

Note that, for performing a many-controlled NOT, there are more efficient ancilla-free constructions than the one you linked: https://algassert.com/circuits/2015/06/22/Using-Quantum-Gates-instead-of-Ancilla-Bits.html

+",119,,,,,8/16/2020 20:37,,,,1,,,,CC BY-SA 4.0 +13354,1,13364,,8/16/2020 23:50,,2,251,"

This could be seen as a followup to the question "How to calculate the distance of stabilizer code?". Summarizing the accepted answer : distance is the minimum weight of the set +$$E = \bigl\{e : e \not \in S, e \in \mathrm{Nor}(P_N,S)/(\pm I) \bigr\}$$ +where $S$ is the stabilizer group (generated by $K_n$'s in the previous question), and $\mathrm{Nor}(P_N,S)$ is its +normalizer in the Pauli group of order $2^{2N+1}$ (where $N$=number of qubits; using real version of group here).

+

My question is the following: does this hold for $k=0$ stabilizer codes? I suspect that it doesn't always hold but can't find a reference for it... it does seem to work for most cases, but some simple counter examples are also easy to find : take the GHZ state $\tfrac{1}{\sqrt 2}\bigl(\lvert00\rangle + \lvert11\rangle\bigr)$, with $K_1=X_1X_2$ and $K_2=Z_1Z_2$. In this case, $\mathrm{Nor}(P,S)=\pm S$, so the set $E$ is empty. Something is obviously broken in this process: I think that the distance should be 2. What's going on here?

+",12265,,124,,8/17/2020 9:26,9/7/2020 18:39,How to calculate distance of $k=0$ stabilizer code?,,2,7,,,,CC BY-SA 4.0 +13355,1,,,8/17/2020 2:48,,1,38,"

Qiskit's function CompleteMeasFitter builds a calibration matrix in this way (2 qubit case):

+
    +
  • Everything is initialized in the state $|00\rangle$, which is the usual case for IBM hardware.
  • +
  • For $|00\rangle$, it just measures the proportion of counts for $|00\rangle, |01\rangle, |10\rangle, |11\rangle$.
  • +
  • For $|01\rangle$, it applies an $X$ gate to the second qubit, then measures the counts for all 4 states.
  • +
  • For $|10\rangle$, it applies an $X$ gate to the first qubit, then measures the counts for all 4 states.
  • +
  • For $|11\rangle$, it applies an $X$ gate to both qubits, then measures the counts for all 4 states.
  • +
+

In the $|00\rangle$ case the calibration matrix is picking up the measurement error.
+In all other cases, the calibration matrix is picking up measurement error plus some gate error.
+For states involving more 1s, the calibration matrix elements are less pure (there's more errors).

+
    +
  • Is there a consequence of this? E.g. the $|00\rangle$ counts will be corrected better than the others?
  • +
  • Is there any way to mitigate this bias?
  • +
+",2293,,2293,,3/14/2021 3:58,3/14/2021 3:58,"There seems to be a bias against states with more 1s, in IBM's calibration matrix generator: What are the consequences and possible solutions?",,0,1,,,,CC BY-SA 4.0 +13358,1,,,8/17/2020 3:10,,7,1208,"

If I were to create a circuit with the following gate:

+

$$\tag{1}R_\phi = \begin{bmatrix} 1 & 0 \\ 0 & e^{i \phi} \end{bmatrix},$$

+

with $\phi$ specified to be equal to 0, then the gate that I am running is just the identity gate, and the circuit is to do nothing to the qubits. Would the IBM hardware actually "run" some gate with some parameter being set as close as possible to 0? Or would IBM's compilers recognize that nothing is to be done, and just not "apply" any gate at all?

+

While the two cases would ideally be equivalent, in practice the one where "nothing" is done, would be less susceptible to error, which could make a significant difference in the outcomes we observe.

+

Likewise, if we put two $X$ gates next to each other in a circuit to be run on the IBM hardware, would IBM's compilers notice that the circuit is just the identity circuit, and decide to do nothing rather than apply two gates that cancel each other out?

+

To what extent does IBM's software and firmware "compile" circuits like this?

+",2293,,2293,,8/17/2020 13:49,8/17/2020 13:49,"Would IBM's ""compiler"" turn my identity circuit into nothing?",,1,0,,,,CC BY-SA 4.0 +13361,1,,,8/17/2020 3:35,,3,459,"

I have been using the Ignis module for performing error mitigation but it accounts only for the measurement errors. For this reason, I want to know if there is some way to perform gate error mitigation using Qiskit.

+",10455,,9006,,8/17/2020 8:07,6/3/2021 14:03,How to implement gate error mitigation in Qiskit?,,2,0,,,,CC BY-SA 4.0 +13362,2,,13358,8/17/2020 3:56,,9,,"

Any compilation/circuit optimization happens transparently by Qiskit. As a user you have control over what happens via the optimization_level argument passed to transpile(). Setting optimization level high (e.g. level 3) will do more circuit optimizations and setting it low will do little or no optimization (e.g. level 0). The two examples that you provide are straightforward. They will be optimized at optimization level 3 and left alone at optimization level 0.

+",2503,,2293,,8/17/2020 13:43,8/17/2020 13:43,,,,3,,,,CC BY-SA 4.0 +13363,1,13375,,8/17/2020 8:22,,1,104,"

I'm wavering between taking 2nd Quantum Mechanics course and not. I've just completed the 1st course that already covered fundamentals of QC. I intend to take Quantum Information Processing along with Quantum Mechanics 2 next semester, but recently I've read some opinions that advanced QM will not be very helpful for doing (serious) research in Quantum Information/Computing. Can someone confirm whether perturbation theory has anything to do with QI/QC? I really want to expand my knowledge in QM, but the course is very challenging so I don't want to waste much time for something I'll barely use.

+",7648,,55,,8/27/2020 12:51,8/27/2020 12:51,Is a 2nd course on Quantum Mechanics helpful for research in Quantum Information/Computing?,,1,2,,8/27/2020 12:54,,CC BY-SA 4.0 +13364,2,,13354,8/17/2020 10:17,,4,,"

Note that in the case $k = 0$, the stabiliser 'code' is a $2^0 = 1$ dimensional subspace of the Hilbert space, which is to say that it consists of a single stabiliser state. This will have somewhat peverse effects on the features such as the 'distance' of the code.

+

The "code distance" is ultimately defined in terms of the minimum weight of a Pauli operator $E$ which is not 'detectable' (by which I mean, distinguishable from the identity) according to the Knill–Laflamme conditions: +$$ \langle \psi_j \rvert E \lvert \psi_k \rangle = C_E \delta_{j,k} $$ +where $\lvert \psi_j \rangle, \lvert \psi_k \rangle$ are states in the code. In the case of a 1-dimensional subspace, there is only a single state $\lvert \psi \rangle =: \lvert \psi_0 \rangle$. Thus we would take $j,k \in \{ 0 \}$, so that the $\delta_{j,k}$ term is always equal to $1$. But that means that by simply defining $C_E = \langle \psi \rvert E \lvert \psi \rangle$, the Knill–Laflamme condition is always satisfied. +Thus, the 'distance' of the code is defined for a $k = 0$ stabiliser code as the minimum over the empty set.

+

Using the less abstract approach for stabiliser codes, of considering weights of Pauli operators which are in the normaliser of the code, bear in mind that we're talking then of operators which map the code-space to itself, but are not proportional to a member ofthe stabiliser group. But for $k = 0$ operators which map the state $\lvert \psi \rangle$ to itself are necessarily proportional to stabilisers, so no such operator exists. Again, we are considering the minimum weight over an empty set of operators.

+

According to your conventions, it could possibly be sensible to talk about the distance as being infinite; but in practise it would be better to say that the distance is undefined.

+",124,,,,,8/17/2020 10:17,,,,5,,,,CC BY-SA 4.0 +13365,1,13369,,8/17/2020 12:07,,1,101,"

For example, the 5-qubit QECC.

+

If $X_i, Y_i, Z_i$ commutes with $M_i$, the eigenvalue will be +1. Otherwise, the eigenvalue will be -1. What's the relation between the commute and the sign of the eigenvalue? Moreover, since the control qubit is the ancilla qubit and the target qubit is $\psi$, how comes that a change in the target qubit could influence the measurement of the control qubit? For example, if $X_0$ appears, why is the measurement result of ancilla qubit be 0100? +

+

+",9105,,,,,8/17/2020 19:55,What's the relation between the sign of error correction code and commute of operators?,,1,0,,,,CC BY-SA 4.0 +13366,1,13376,,8/17/2020 12:47,,2,137,"

I am trying to solve the problem of optimization (VRP) with genetic algorithm and quantum computing in the platform IBM Q Experience. +But I am unable to advance on this. How can I do it? +According to my understanding of quantum computing, we cannot apply the two processes of crossover and mutation in their classic sense.

+",12982,,9006,,8/18/2020 6:53,8/18/2020 6:58,How can I solve the problem of optimisation the quantum computer?,,1,2,,,,CC BY-SA 4.0 +13367,2,,13350,8/17/2020 14:19,,0,,"

This looks like this issue: https://github.com/Qiskit/qiskit-ibmq-provider/issues/677

+

Can you verify the version of your qiskit elements by doing

+
import qiskit
+print(qiskit.__qiskit_version__)
+
+",12195,,,,,8/17/2020 14:19,,,,0,,,,CC BY-SA 4.0 +13368,1,,,8/17/2020 15:11,,10,396,"

I have been investigating uses for quantum machine learning, and have made a few working examples (variations of variational quantum classifiers using PennyLane). However, my issue now is its relationship with classical machine learning. At the moment (in my tests, at least), QML seems to not provide any major improvement in performance (compared to a classical network) and is significantly slower when running on real hardware.

+

I understand that this is a young field people are still exploring, but I'm curious as to why you would not just always use a classical ML algorithm for problems. Therefore, my questions are:

+
    +
  • What benefits (or predicted benefits) are there using quantum machine learning?
  • +
  • Is there little benefit now, but the potential for performance increases when hardware improves?
  • +
  • It wouldn't surprise me to learn there are examples where QML outperforms classical ML. Here, my question is why is this the case? How would moving to a quantum regime improve performance?
  • +
+",12955,,,,,9/8/2022 9:33,What are the benefits of using quantum machine learning?,,2,2,,,,CC BY-SA 4.0 +13369,2,,13365,8/17/2020 15:43,,3,,"

What you are describing is called indirect measurement, and it forms the backbone of the stabilizer formalism. To understand it, we can just work with a general element of the Pauli group, which in the below diagram is the gate labeled $P$. Also, the $|\phi\rangle$ wire is generally a bundle of $n$ wires, and the gate $P$ acts on all of them (in your example, it is a five-qubit state, and each single-qubit Pauli is $X$, $Z$, or $I$), but for this example let's just assume it's a single qubit.

+

Any element of the Pauli group has an eigenspace such that half of the eigenvectors have eigenvalue +1, and the other half has eigenvalue -1. In the case of a single-qubit Pauli $P$, we can call these two eigenvectors $|\phi_+\rangle$ and $|\phi_-\rangle$, and write the input state in this basis $|\phi\rangle = \alpha |\phi_+\rangle + \beta |\phi_-\rangle $.

+

+

Working out the action of the circuit, we get

+

$$ +|0\rangle|\phi\rangle \rightarrow \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) |\phi\rangle \rightarrow \frac{1}{\sqrt{2}}(|0\rangle |\phi\rangle + |1\rangle P |\phi\rangle ) \rightarrow \frac{1}{2} (|0\rangle(I + P)|\phi\rangle + |1\rangle(I - P)|\phi\rangle) +$$

+

This means that the outcome we obtain when measuring the ancilla determines which operator we apply to the data qubit(s). Working out just the first term, as if we measured the ancilla and collapsed it to $|0\rangle$:

+

$$ +\frac{1}{2}(I+P) |\phi\rangle = \frac{1}{2} (I+P) (\alpha|\phi_+\rangle + \beta|\phi_-\rangle) = \frac{1}{2} (\alpha|\phi_+\rangle + \beta|\phi_-\rangle + \alpha|\phi_+\rangle - \beta|\phi_-\rangle) = \alpha |\phi_+\rangle +$$

+

So the action of the operator is to project onto its positive eigenspace, conditioned on the ancilla outcome (and you can check that the other outcome projects onto the negative eigenspace). Since we only project onto a subspace, instead of collapsing to an individual state, this is called indirect measurement. To be clear, in this example $|\phi_+\rangle$ is just a ray in Hilbert space, but you can imagine other projectors like $ZZ$ which define even/odd subspaces, not rays.

+

If we intentionally prepare $|\phi\rangle = |\phi_+\rangle$, then the ancilla can only ever give 0, because no part of the data state lies in the negative eigen(sub)space ($\alpha=1, \beta=0$).

+

Now, what happens if some error $U$ occurs, somewhere before the gate $P$? Since the error is also assumed to be some Pauli, it also has some positive and negative eigenspaces. Furthermore, note that any two elements of the Pauli group must either commute or anticommute.

+

+

Assume that $U$ commutes with $P$: +$$ +UP = PU \rightarrow PU|\phi_+\rangle = U|\phi_+\rangle +$$ +so the new error state $U|\phi_+\rangle$ still has eigenvalue +1 under $P$. Meauring the ancilla can still only ever give $|0\rangle$ (i.e $m_Z = +1$).

+

Now assume that $U$ anti-commutes with $P$: +$$ +UP = -PU \rightarrow PU|\phi_+\rangle = -U|\phi_+\rangle +$$ +Now the state that was supposed to be in the positive eigenspace has eigenvalue -1 under $P$ due to the error, so the spaces have flipped! This means the ancilla can only ever give $|1\rangle$ upon measurement (i.e. $m_Z = -1$).

+

In this way, errors ($U$) that commute with the stabilizers ($P$) are undetectable, because they do not flip the sign of the corresponding ancillas. But any errors that anticommute with at least one stabilizer will flip at least one ancilla, and we can detect the error. Then, the only thing left is to make sure that different errors trigger unique sets of ancillas, which are called syndromes, so that the errors are uniquely decodable.

+

(image credit to TU Delft Fundamentals of Quantum Information course notes)

+",4622,,4622,,8/17/2020 19:55,8/17/2020 19:55,,,,5,,,,CC BY-SA 4.0 +13370,2,,13368,8/17/2020 17:48,,0,,"

Check out these resources. It shows how QML might turn out to be in the future, see IBM Q for AI.

+

In case of quantum-inspired algorithms, when the dataset meets certain conditions, it might be better than the classical approaches, see Quantum-inspired algorithms in practice

+",10425,,9006,,8/18/2020 6:50,8/18/2020 6:50,,,,0,,,,CC BY-SA 4.0 +13371,1,13372,,8/17/2020 18:18,,0,298,"

I have some questions about the Choi-Jamiolkowski isomorphism.

+

I remind how it can be defined. First, we define $|\mathcal{I}_{H_0} \rangle \rangle \in H_0 \otimes H_0$

+

$$|\mathcal{I}_{H_0} \rangle \rangle = \sum_i |i i \rangle$$

+

Where the family $\{ |i\rangle \}_i $ is an orthonormal basis of $H_0$.

+

C.J isomorphism: pure case

+

Let $X \in \mathcal{L}(H_0, H_1)$, the C.J isomorphism consist in associating to this linear operator, a kets $|X \rangle \rangle \in H_1 \otimes H_0 $:

+

$$ |X \rangle \rangle \equiv ( X \otimes I_{H_0} ) |\mathcal{I}_{H_0} \rangle \rangle$$

+

A little calculation shows that the isomorphism simply consists in performing the following mapping:

+

$$ \sum_{i,j} \langle i | X | j \rangle |i \rangle \langle j | \leftrightarrow \sum_{i,j} \langle i | X | j \rangle |i, j \rangle \rangle$$

+

Basically we replace: $|i\rangle \langle j | \in \mathcal{L}(H_0,H_1) \leftrightarrow |i,j \rangle \rangle \in H_1 \otimes H_0$

+

C.J isomorphism: mixed case

+

The mixed case consist in associating linear operator to quantum map. Let $\mathcal{M} \in \mathcal{L}(\mathcal{L}(H_0),\mathcal{L}(H_1))$. We define the Choi matrix $M \in \mathcal{L}(H_1 \otimes H_0)$ such that:

+

$$\mathcal{C}(\mathcal{M}) \equiv (\mathcal{M} \otimes \mathcal{I}_{H_0}) (|\mathcal{I}_{H_0} \rangle \rangle \langle \langle \mathcal{I}_{H_0} | )$$

+

We notice the strong analogy with the definition of the Choi isomorphism for the pure case.

+

My questions

+
    +
  • Is there an analog "easy" definition for the Choi isomorphism in the mixed case as there were in the pure case with $|i \rangle \langle j| \leftrightarrow |i,j \rangle \rangle$ ? Or should we always take the "brute force" definition to calculate the isomorphism ?
  • +
  • Why is this isomorphism important ? I have seen this post which talks about the intuition from quantum teleportation (I did not really understand the answer, I would need to dig in). But my question is more related on why this isomorphism is often used and not another one to perform calculation.
  • +
  • Are there typical relationship between the pure and mixed case ? I managed to prove that if $\mathcal{U}(\rho)=U \rho U^{\dagger}$ is a unitary map, then $\mathcal{C}(\mathcal{U})=|U \rangle \rangle \langle \langle U |$. But are there some other usefull relationship ?
  • +
  • (related to my second question): I checked and it seems that the mixed isomorphism is different from the "natural" isomorphism we would consider to associate matrix to quantum map. Basically where the inputs (density matrices) would be replaced by vector: $|i \rangle \langle j | \rightarrow |i,j\rangle$ and the quantum map would then just be a matrix eating vector and giving vector. The resulting matrix seem to not be the same as the mixed case choi matrix. Would you confirm ?
  • +
+",5008,,55,,8/24/2020 9:26,10/4/2022 9:03,Some questions to get intuition on Choi isomorphism,,1,3,,8/20/2020 22:09,,CC BY-SA 4.0 +13372,2,,13371,8/17/2020 19:14,,3,,"
+

Is there an analog "easy" definition for the Choi isomorphism in the mixed case as there were in the pure case with |i⟩⟨j|↔|i,j⟩⟩ ? Or should we always take the "brute force" definition to calculate the isomorphism ?

+
+

Basically, you can use a trick to get some intuition for the Choi matrix that works on both pure and mixed states. We know that any quantum channel $\Lambda$ should be a linear map - therefore, if you define the action of $\Lambda$ on a basis of $\mathcal{H}_{0}$, everything that $\Lambda$ can do to any state $\rho$ is encoded into that information.

+

Lets pick the most straightforward basis (actually, it's not really a basis for $\mathcal{H}_{0}$ that we use but for the space of $d\times d$ matrices, where $d=2^{n}$): $$\{|i\rangle\langle j|\}\,\,\,\,\forall i,j \in \{1,...,d\},$$ this gives us $d^{2}$ elements. All information about $\Lambda$ is encoded into the following $d^{2}$ elements:

+

$$\{\Lambda\left(|i\rangle\langle j|\right)\}\,\,\,\,\forall i,j \in \{1,...,d\}.$$

+

The Choi matrix contains these $d^{2}$ elements, but then not as a list. Rather, we put the $(i,j)$-th element of that list (which is a $d'\times d'$ matrix) into a new matrix as the $(i,j)$-th element - where $d'$ is the size of the output Hilbert space of the map $\Lambda$. We get a $d \times d$ block matrix where each entry is itself a $d' \times d'$ matrix: +$$\rho_{\mathrm{Choi}} = +\begin{bmatrix} +\Lambda\left(|0\rangle\langle 0|\right) & \Lambda\left(|0\rangle\langle 1|\right) & \dots & \Lambda\left(|0\rangle\langle d-1|\right) \\ +\Lambda\left(|1\rangle\langle 0|\right) & \Lambda\left(|1\rangle\langle 1|\right) & \dots & \Lambda\left(|1\rangle\langle d-1|\right) \\ +\vdots & \vdots & \ddots & \vdots \\ +\Lambda\left(|d-1\rangle\langle 0|\right) & \Lambda\left(|d-1\rangle\langle 1|\right) & \dots & \Lambda\left(|d-1\rangle\langle d-1|\right) \\ +\end{bmatrix}. +$$

+

From this point of view, it is pretty clear that the Choi matrix is a clever way of writing down the information encoded into $\Lambda$.

+

The important thing to notice is that, given the map lambda to be $CPTP$, the above matrix is always a valid density matrix, which is obvious from your definition.

+
+

Why is this isomorphism important? I have seen this post which talks about intuition from quantum teleportation (I did not really understand the answer, I would need to dig in). But my question is more related on why this isomorphism is often used and not another one to perform calculation.

+
+

The Choi-Jamiolkowski isomorphism states that having $d^{2}$ elements in the second equation is always enough (and that the resulting Choi matrix is always a state), which makes it important just for that. Moreover, it is often easier to work with density matrices rather than maps, and some properties that one needs or looks for in maps nicely translate into the 'normal' properties of density matrices for the Choi matrix:

+
    +
  • The process fidelity of a map $\Lambda$ is the same as the state fidelity of it's Choi matrix.
  • +
  • The CP constraint of $\Lambda$ translates nicely into the positive-semidefiniteness of the Choi matrix.
  • +
+

However, it is important that not all properties translate nicely. The TP constraint on $\Lambda$ is a stronger constraint than $\rho$ just having unit trace. This also means that not all $d^{2} \times d^{2}$ density matrices represent a $d\times d$ map!

+

People have been using (at least theoretically) the isomorphism to perform quantum process tomography by actually performing the (easier) quantum state tomography. However, because of the above reason of the TP constraint, not all methods of state tomography give valid 'isomorphism-correct' quantum states - something which I've seen gone wrong in a paper or two!

+
+

Are there typical relationship between the pure and mixed case ? I managed to prove that if U(ρ)=UρU† is a unitary map, then C(U)=|U⟩⟩⟨⟨U|. But are there some other usefull relationship?

+
+

I believe that the first answer answers this question as well. If you have some other representation of $\Lambda$ (e.g. a Kraus representation, it's $\chi$ matrix or a Stinespring dilation) there exist nice ways of translating one representation into another, but I guess that this is best asked as a separate question, but:

+
    +
  • for the $\chi \leftrightarrow \rho_{\mathrm{Choi}}$ translation I already have an answer on a previous question.
  • +
  • for the Kraus decomposition, the Kraus operators are basically the eigenvectors of the Choi matrix.
  • +
+
+

(related to my second question): I checked and it seems that the mixed isomorphism is different from the "natural" isomorphism we would consider to associate matrix to quantum map. Basically where the inputs (density matrices) would be replaced by vector: |i⟩⟨j|→|i,j⟩ and the quantum map would then just be a matrix eating vector and giving vector. The resulting matrix seem to not be the same as the mixed case choi matrix. Would you confirm ?

+
+

This is indeed not the same as the Choi matrix. Rather, this would be a representation sometimes just called the superoperator representation or natural representation (TQI by Watrous, page 77). It isn't used that often though, because both the CP and the TP constraints (especially the TP) are really finicky. I'd advice you to stay away from this representation unless you really know what you're doing. These matrices are often invertible, but that is a big no-no physically speaking.

+",8141,,8141,,10/4/2022 9:03,10/4/2022 9:03,,,,7,,,,CC BY-SA 4.0 +13373,1,13396,,8/17/2020 19:53,,5,273,"

$|0⟩$ and $|1⟩$ are usually referred as the computational basis. $|+⟩$ and $|-⟩$, the polar basis.

+

What about $|i\rangle$ and $|\mbox{-}i\rangle$?

+

+

And collectively? Orthonormal states?

+

References are welcomed!

+",1859,,1859,,8/19/2020 12:40,8/20/2020 10:49,Terminology: what do $|i\rangle$ and $|\mbox{-}i\rangle$ represent?,,3,0,,,,CC BY-SA 4.0 +13374,2,,13373,8/17/2020 20:42,,4,,"

Quirk refers to the $\frac{1}{\sqrt{2}}|0\rangle + \frac{i}{\sqrt{2}}|1\rangle$ state as $|i\rangle$ and to the $\frac{1}{\sqrt{2}}|0\rangle - \frac{i}{\sqrt{2}}|1\rangle$ state as $|-i\rangle$:

+

+

When I implemented this it just seemed like a natural choice at the time. I didn't get it from a textbook or a paper.

+",119,,,,,8/17/2020 20:42,,,,2,,,,CC BY-SA 4.0 +13375,2,,13363,8/18/2020 1:13,,4,,"

If you want an excellent answer, you will have to say what "2nd course in QM" means, by specifying which exact topics will be covered, other than just "perturbation theory", which is the only thing you've said about the 2nd QM course so far. Also it would be helpful for you to tell us what was covered in the first QM course.

+

However, I can already give a decent answer with what you've provided so far:

+
+

"Can someone confirm whether perturbation theory has anything to do +with QI/QC?"

+
+

There's several benefits of learning perturbation theory.

+

1) Even for the "theoretical computer science" aspect of QI/QC:

+
    +
  • "Perturbative gadgets" first introduced by Kitaev, Kempe & Regev in 2004, were used in the proof that adiabatic quantum computers can simulate circuit-based quantum computers with polynomial overhead. They are central to proofs of QMA completeness using our wisdom of the k-local Hamiltonian problem. They are also crucial in the compiling of problems onto adiabatic quantum computers or quantum annealers.
  • +
+

2) At the hardware level:

+
    +
  • If you want to understand how the hardware works, you will benefit from understanding perturbation theory, because for example, superconducting qubits (the most popular type of qubit in current large-scale hardware) are not actually qubits (2-level systems) but are oscillators with a large number of levels, and they are approximated by 2-level systems, and when choosing real physical systems with the properties (such as energy scales) required for your hardware, you could find perturbation theory very useful.

    +
  • +
  • If you want to understand how to model noise/decoherence in the engineering of quantum hardware, you are likely to see perturbation theory in many possible sub-areas (ex. perturbative master equations where the system-bath coupling is considered weak).

    +
  • +
  • When implementing gates, you may not physically be easily able to do the exact unitary you wish, but using perturbation theory on a known physical phenomenon could help you find a gate that closely approximates the gate you wish to implement.

    +
  • +
+

3) On an academic level:

+
    +
  • Even if you just want to do more "hardcore" quantum information, such as studying multi-partite entanglement witnesses, quantum discord, quantum "contextuality", or thinking about interesting "quantum games" or paradoxes like the GHZ paradox, the mathematics you will learn when you study basic undergraduate level perturbation theory, will no doubt help you with doing anything involving quantum mechanics.
  • +
  • You are also likely to want to be able to understand the talks at conferences, or at department seminars, or even when your colleagues/classmates in your physics/chemistry department are presenting their work, if you want to fit in well with other academics in QI/QC (academia is not just about being smart, it's about being social too).
  • +
+

4) Outside of QM:

+
    +
  • Perturbation theory is not just useful for modeling in quantum mechanics, but it's used in weather modeling, engineering, financial modeling, fluid dynamics, and even in pure mathematics (many techniques for solving or approximately solving differential equations use perturbation theory). You don't need to take a QM course to learn this, but it will give you a good appreciation for the general technique.
  • +
+
+

Aside from perturbation theory, there will be a lot of more advanced quantum mechanics and mathematical techniques you'll learn in this course that will be helpful in your career in QI/QC (or even elsewhere).

+

I am speaking from experience:

+

I personally did not take QM2 during my undergrad. I graduated from University of Waterloo and there was 6 undergrad quantum courses: QM1, QM2, QM3, Quantum Theory 1, Quantum Theory 2, and Quantum Computing. QM1, QM2, and QM3 were all mandatory for all physics degrees, and QT2 was required for others. I was also doing a degree in Biology and a degree in Mathematics and taking several arts courses in Music, Philosophy, Psychology and Anthropology, so I was very protective about wasting my time. I felt that QM1 and Quantum Computing was enough, so I skipped QM2, QM3, QT1, QT2, and later found out that I missed a lot:

+
    +
  • Variational Principle (which is now extremely popular if you are to look at the VQE algorithm or the variational model for quantum computing).
  • +
  • Advanced mathematics of spin (Clebsch-Gordon coefficients, adding angular momenta, etc.).
  • +
  • Perturbation theory (as you mentioned yourself, and I went into detail describing above).
  • +
  • So much that I don't even know that I missed. I wasn't there, so I don't even know what I don't know. This has caused me to lose a lot of confidence when working in quantum computing, because I wasn't aware whether or not I was at some disadvantage due to everyone else having learned something about a topic on which I was working.
  • +
+
+

"I really want to expand my knowledge in QM, but the course is very +challenging so I don't want to waste much time for something I'll +barely use."

+
+

You said you want to do "reasearch" in quantum computing. Most research is done at the post-PhD level, and much of the rest of it is done as a post-graduate student (Masters or PhD student). You can do some research as an undergraduate student too, but for most of your life you will not be a student (whether it's undergrad, masters, or PhD) so really, except in very rare cases, most of your career will be at the post-PhD level if you want to be a researcher. As an undergrad, it's not easy to see what things will be like 10 years later as a researcher, so you came to the right place for advice. My advice is to keep a more open mind about what might be a "waste of time", "barely useful", or "too challenging". At any university, QM2 is not considered extremely advanced if you want to do research in quantum information (QM1, QM2, and QM3 are all mandatory for anyone to get a physics degree at University of Waterloo, for example).

+

In one of the comments, someone said:

+
+

"spherical harmonics/calculating hydrogen orbitals/perturbation theory are not useful for quantum computing."

+
+
    +
  • I have addressed perturbation theory already.
  • +
  • Spherical harmonics and solving the Schroedinger equation for the hydrogen atom are certainly useful as QCQC (quantum computing for quantum chemistry) has now become one of the most popular areas in the field, since it's probably the area where QC might be able to have the most real-world impact (factoring numbers, or Shor's algorithm, is not actually useful, since people are already switching to post-quantum cryptography). Paragraph 3 of this answer and the citation marked as "reference 1" claim that QCQC is the one area where quantum computing is "not just hype".
  • +
  • If you want to choose research as a career, also try not to put 100% of your eggs in the QI/QC basket, because a "quantum winter" may come, where popularity of quantum computing decays. If I had to guess right now, I'd say the next big thing will be energy science as our world starts to become more worried about running out of resources and reducing our ecological footprint: you may wish to study condensed matter physics so that you remain employable in the materials science, materials design, energy storage, energy transport, and energy conversion fields (where people design long lasting batteries, better solar cells, more energy efficient smartphone screens, stronger materials for cars, bikes, planes, spaceships, etc.). If you want to remain employable in any of these fields, or to at least be able to understand what's going on when the next huge discoveries are published, you will need an understanding of QM2, QM3 and more.
  • +
+",2293,,,,,8/18/2020 1:13,,,,2,,,,CC BY-SA 4.0 +13376,2,,13366,8/18/2020 6:58,,0,,"

Please have a look at this paper: Ising formulations of many NP problems. It deals with binary optimization on quantum annealers (e.g. D-Wave). As mentioned in comments, quantum annealers are more suitable for optimization tasks in comparison with gate-based universal quantum computers like IBM Q.

+

Here you can find something more about D-Wave, how it works and how it can be programmed.

+",9006,,,,,8/18/2020 6:58,,,,0,,,,CC BY-SA 4.0 +13377,2,,13340,8/18/2020 8:29,,2,,"

From the official documentation:

+
+

Q.dims: List keeping track of shapes for individual components of a multipartite system (for tensor products and partial traces).

+
+

In other words, you can think of it as the dimensions of the (matrix representation of) the object under consideration, taking into account the tensorial structure of the underlying space. +The first element tells you about the number of rows while the second element tells you about the number of columns.

+

Consider as an example

+
fooQ = qutip.tensor(qutip.basis(2, 0), qutip.basis(2, 1))
+
+

This is the tensor product of two qubit ket states, thus it's a vector in a space of dimension $2\times 2$. As a matrix, you can represent it as a $4\times 1$ matrix. But if you want to remember the tensor structure of this space, which makes it easier to do things such as partial tracing, it's better to store each individual dimension. You then end up with fooQ.dims == [[2, 2], [1, 1]], because there are $2\times 2$ rows, and $1=1\times 1$ column.

+

In your example, [[2, 4], [2, 4]] represents a density matrix in a space $\mathcal H_1\otimes\mathcal H_2$ with $\dim\mathcal H_1=2$ and $\dim\mathcal H_2=4$.

+

You can retrieve the overall dimensions of the space by doing e.g.

+
number_of_rows = np.prod(fooQ.dims[0])
+number_of_cols = np.prod(fooQ.dims[1])
+
+

Or you can "unravel" the dimensions, obtaining a list of the dimensions of each individual component space, with

+
unravelled_dimensions = np.transpose(fooQ.dims)
+
+",55,,,,,8/18/2020 8:29,,,,0,,,,CC BY-SA 4.0 +13380,1,13382,,8/18/2020 15:03,,2,49,"

Came across This question regarding the maximum number of almost orthogonal vectors one can embed in a Hilbert space. They state that $N(\frac{1}{2},2)=3$, and that explicit construction of the vectors using the Bloch sphere shows this. However, I cannot seem to grasp what they mean by this. Their further example of $N(\frac{1}{\sqrt{2}},2)=6$ does make sense to me, as these are simply the eigenvectors of the pauli operators. But how does one show that the number of vectors which meet the following criteria is only 3?

+

$$\langle V_i|V_i\rangle = 1$$

+

$$|\langle V_i|V_j\rangle| \leq \epsilon, i \neq j$$

+",4991,,9006,,8/19/2020 7:33,8/19/2020 7:33,"$N(\frac{1}{2},2)=3$ for vectors in a Hilbert Space",,1,0,,,,CC BY-SA 4.0 +13381,1,13384,,8/18/2020 15:39,,2,357,"

I was wondering if there is any way to present the CNOT matrix as we usually present single qubit operations

+

$$... 1 \otimes NOT \otimes 1 ...$$

+

I know that for adjacent qubits in a circuit we can present it identically

+

$$... 1 \otimes CNOT \otimes 1 ...$$

+

But is there a way to present the operation mathematically if there are several CNOTs acting on not neighboring wires?

+",12302,,55,,8/24/2020 8:58,8/24/2020 8:58,Is there a good way to mathematically write a CNOT operation over non-neighboring qubits in a circuit?,,2,0,,8/25/2020 17:25,,CC BY-SA 4.0 +13382,2,,13380,8/18/2020 15:53,,3,,"

Here's a very visual way to think about this (I make no claim about it being a rigorous proof). Let +$$ +|V_1\rangle=|0\rangle,|V_2\rangle=\frac12|0\rangle+\frac{\sqrt{3}}{2}|1\rangle,|V_3\rangle=\frac12|0\rangle-\frac{\sqrt{3}}{2}|1\rangle. +$$ +These each have overlaps of 1/2. Now draw these on the Bloch sphere. They are three equally spaced vectors around a great circle. You cannot push one closer to another because that would increase their overlap.

+

Now, can I add a fourth vector? Whatever vector I add into the sphere, it must make an angle of $\pi/2$ or less with one of the existing vectors, and hence would have overlap $1/\sqrt{2}$ or greater. So, at least for this choice of three vectors, I cannot add a fourth and maintain the value of $\epsilon$.

+

With this picture in mind, you can probably also convince yourself that these vectors have to be selected this way. $|V_1\rangle$ is arbitrary, I can just orient the view so that it's at the top of the sphere. For $|V_2\rangle$ I've got an arbitrary freedom of rotation about the $V_1\rangle$ axis, so I just picked the orthogonal component to be real and positive. At that point, my choice of $|V_3\rangle$ was fixed - there was only one possible choice that could have the correct overlap.

+

If the visual version doesn't do it for you, I'm sure someone will formalise this mathematically...

+",1837,,,,,8/18/2020 15:53,,,,1,,,,CC BY-SA 4.0 +13383,2,,13381,8/18/2020 15:57,,1,,"

Personally, I just define myself some notation. For example, instead of the NOT that you wrote down, I define $X_n$ to be +$$ +X_n=1^{\otimes(n-1)}\otimes X\otimes 1^{\otimes(N-n)}. +$$ +Similarly, I might then define $CNOT^i_j$ to be a controlled-not controlled off $i$ and targeting $j$. If I had to write it out as tensor products, I'd probably do something like +$$ +1^{\otimes N}+1^{\otimes (i-1)}\otimes |1\rangle\langle 1|\otimes 1^{\otimes(j-i-1)}\otimes(X-1)\otimes 1^{\otimes(N-j)} +$$ +assuming $j>i$.

+",1837,,,,,8/18/2020 15:57,,,,1,,,,CC BY-SA 4.0 +13384,2,,13381,8/18/2020 16:16,,4,,"

If you are only referring to the abstract circuit representation, then you can just reorder your basis such that all the qubits partaking in CNOTs are made "adjacent" according to your labeling. For example, if the basis is ordered like $1,2,3$, and you want to perform a CNOT between qubits 1 and 3, then you just write something like

+

$$ +CNOT_{1,3} \otimes I_2 +$$

+

where the basis is now ordered $1,3,2$. But if you don't want to reorder the basis, there is also another way of writing the CNOT:

+

$$ +|0\rangle\langle0|\otimes I + |1\rangle\langle1|\otimes X +$$

+

which could include an identity on the state of the second qubit like

+

$$ +(|0\rangle\langle0|)_1 \otimes I_2 \otimes I_3 + (|1\rangle\langle1|)_1 \otimes I_2 \otimes X_3 +$$

+

This is no longer just a product of unitaries, which is expected since the action of the CNOT should not factorize into product of operations.

+",4622,,,,,8/18/2020 16:16,,,,3,,,,CC BY-SA 4.0 +13385,2,,13373,8/18/2020 16:21,,3,,"

This is another reference.

+

$|i\rangle$ and $|\mbox{-}i\rangle$ are two orthogonal y-basis states. In the above link they are called $|R\rangle$ and $|L\rangle$.

+

$$|i\rangle = \frac{1}{\sqrt{2}}\left[ +\begin{array}{c} + 1 \\ + i +\end{array} +\right] \;\; , \;\; |\mbox{-}i\rangle = \frac{1}{\sqrt{2}}\left[ +\begin{array}{c} + 1 \\ + -i +\end{array} +\right]$$

+

You can simply check the orthonormality by using the definition of inner product space $\mathbb{C}^2$, +$\langle v | w\rangle =\sum(v_i^{*} w_i)$, +and Kronecker delta function.

+

$$\langle i|i\rangle = [1.1 + (-i).i]/2 = 1$$

+

$$\langle i|\mbox{-}i\rangle = [1.1 + (-i).(-i)]/2 = 0$$

+",9318,,9318,,8/20/2020 7:07,8/20/2020 7:07,,,,0,,,,CC BY-SA 4.0 +13386,1,13392,,8/18/2020 17:21,,2,87,"

In A theoretical framework for quantum networks is proven that a linear map $\mathcal{M} \in \mathcal{L}(\mathcal{H_0},\mathcal{H_1})$ is CP (completely positive) iff its Choi operator $M$ is semi definite positive. Something confuses me in this derivation.

+

First, some definition reminders.

+

Let $X \in \mathcal{L}(H_0,H_1)$, let $\{|i \rangle \}_i$ be an orthonormal basis of $H_0$, we have:

+

$$ | \mathcal{I} \rangle \rangle \equiv \sum_i |ii \rangle$$ +$$|X \rangle \rangle \equiv (X \otimes \mathcal{I}) | \mathcal{I} \rangle \rangle$$

+

The Choi operator is defined as:

+

$$ M = \mathcal{M} \otimes \mathcal{I}_{H_0} | \mathcal{I} \rangle \rangle \langle \langle \mathcal{I} |$$

+

In his proof, he assumes $M \geq 0$ the goal is to show that it implies $\mathcal{M}$ is CP.

+

$M$ is semi definite positive which implies it is hermitian with positive eigenvalues. It can thus be diagonalized. With $\lambda_i \geq 0$, we have:

+

$$ M = \sum_i \lambda_i |u_i \rangle \langle u_i |=\sum_i | K_i \rangle \langle K_i |$$

+

With $|K_i \rangle = \sqrt{\lambda_i} |u_i \rangle$

+

But he seems to "automatically" consider that $|K_i \rangle = |K_i \rangle \rangle$. I don't understand that. Why would we necesseraly have $|K_i \rangle = (K_i \otimes \mathcal{I}) | \mathcal{I} \rangle \rangle$. It is a very particular case. Why can the state be written as a local operation acting on a maximally entangled state ?

+

I have a super vague memory that any quantum state can be written as $(K \otimes \mathbb{I}) | \mathcal{I} \rangle \rangle$. Said differently, there always exist a linear operation $K$ (not necesseraly unitary of course) such that any vector in $H_1 \otimes H_0$ can be written as $K \otimes \mathcal{I} | \mathcal{I} \rangle \rangle$ I guess it would solve the problem. But I cannot find the source of that and I may be totally wrong.

+

In the end, why can we write: $|K_i \rangle = |K_i \rangle \rangle$. I would like a proof of that (and if the property I just talked about holds I would like a link to a reference expressing it or a proof of that as well in the answer)

+",5008,,55,,8/22/2020 7:30,8/22/2020 7:30,"Why can every $|X\rangle\in H_1\otimes H_0$ be written as $|X\rangle=(X\otimes I_{H_0})|\Omega \rangle$ for some $X\in\mathcal L(H_0,H_1)$?",,3,7,,,,CC BY-SA 4.0 +13387,2,,13386,8/18/2020 18:39,,2,,"

You've already defined the Choi matrix as $M = \rho_{\mathrm{Choi}} = \left(\mathcal{M}\otimes I\right)(|\mathcal{I}\rangle\rangle\langle\langle\mathcal{I}||)$. I'm gonna write the maximally entangled state as $|\mathcal{\Omega}\rangle$ because it's better readable to me and I'm more accustomed to it.

+

You've already pointed out that $M$ being positive-semidefinite means that we can perform a real-valued spectral decomposition:

+

$$ +M = \sum_{i}\lambda_{i}|u_{i}\rangle\langle u_{i}| = \sum_{i}\sqrt{\lambda_{i}}|u_{i}\rangle\langle u_{i}| \sqrt{\lambda_{i}}. +$$ +We can decompose these $\sqrt{\lambda_{i}}|u_{i}\rangle$'s into a tensor product of a basis for both of the copies of the Hilbert spaces: +$$ +\sqrt{\lambda_{i}}|u_{i}\rangle = \sum_{l}|a^{i}_{l}\rangle \otimes |b^{i}_{l}\rangle, +$$

+

which means that we can write: +\begin{equation} +\begin{split} +M =& \sum_{i}\lambda_{i}|u_{i}\rangle\langle u_{i}| = \sum_{i}\sum_{l}\sum_{m} |a^{i}_{l}\rangle \otimes |b^{i}_{l}\rangle \langle a^{i}_{m}| \otimes \langle b^{i}_{m}| \\ +=& \sum_{i,l,m} |a^{i}_{l}\rangle \langle a^{i}_{m}| \otimes |b^{i}_{l}\rangle \langle b^{i}_{m}|. +\end{split} +\end{equation}

+

As you may be well aware, we can write the 'output' of the map $\mathcal{M}$ on 'input' $\rho_{\mathrm{in}}$, which thus is $\rho_{\mathrm{out}} = \mathcal{M}\left(\rho_{\mathrm{in}}\right)$, in terms of the Choi matrix $M$:

+

$$ +\mathcal{M}\left(\rho_{\mathrm{in}}\right) = d \mathrm{tr}_{2}\big[M\left(I \otimes \rho_{\mathrm{in}}^{T}\right)\big], +$$ +where the trace is the partial trace over the second subsystem, and the $T$ superscript means the transpose.

+

Now, we plug in our above decomposition for $M$: +\begin{equation} +\begin{split} +\mathcal{M}\left(\rho_{\mathrm{in}}\right) &= d\mathrm{tr}_{2}\big[M\left(I \otimes \rho_{\mathrm{in}}^{T}\right)\big] \\ +&= d\mathrm{tr}_{2}\big[\sum_{i,l,m} |a^{i}_{l}\rangle \langle a^{i}_{m}| \otimes |b^{i}_{l}\rangle \langle b^{i}_{m}| \left(I \otimes \rho_{\mathrm{in}}^{T}\right)\big] \\ +&= d\sum_{i,l,m}\mathrm{tr}_{2}\big[ |a^{i}_{l}\rangle \langle a^{i}_{m}| \otimes |b^{i}_{l}\rangle \langle b^{i}_{m}| \rho_{\mathrm{in}}^{T}\big] \\ +&= d\sum_{i,l,m}|a^{i}_{l}\rangle \langle a^{i}_{m}| \langle b^{i}_{m}| \rho_{\mathrm{in}}^{T}|b^{i}_{l}\rangle \\ +&= d\sum_{i,l,m}|a^{i}_{l}\rangle \langle a^{i}_{m}| \langle b^{*i}_{l}| \rho_{\mathrm{in}}|b^{*i}_{m}\rangle \\ +&= d\sum_{i,l,m}|a^{i}_{l}\rangle \langle b^{*i}_{l}| \rho_{\mathrm{in}}|b^{*i}_{m}\rangle \langle a^{i}_{m}| \\ +&= \sum_{i} A_{i} \rho_{\mathrm{in}} A_{i}^{\dagger}, +\end{split} +\end{equation} +with $A_{i} = \sum_{l}\sqrt{d} |a^{i}_{l}\rangle \langle b^{*i}_{l}|$. This is just the Kraus decomposition, which is enough for $\mathcal{M}$ being CP.

+",8141,,,,,8/18/2020 18:39,,,,5,,,,CC BY-SA 4.0 +13388,1,13390,,8/18/2020 19:42,,-1,71,"

This question is taken from https://github.com/quantumlib/Cirq/issues/3032.

+

The "standard" protocol measures Alice's and Bob's qubits in different bases, while the one in Cirq measures in the same basis. I can't prove the equivalence of these seemly different protocols that violate Bell's inequality.

+",362,,55,,8/24/2020 9:00,8/24/2020 9:00,What is the analysis of the Bell Inequality protocol in Cirq's 'examples'?,,1,0,,,,CC BY-SA 4.0 +13389,1,,,8/18/2020 22:24,,1,35,"

I would like to know how the gates are defined in quantum random access codes? Consider the $2 \to 1$ code described in Lemma 3.1 of this paper.

+

The section defines the encoding and decoding circuits. But it is not clear to me how to define gates. Say, I want to apply an $Rz(\theta)$ on the first qubit or a CNOT gate on both qubits.

+

How do I do that?

+",1798,,9006,,8/19/2020 7:34,8/19/2020 7:34,Gate definitions for quantum random access codes,,0,1,,,,CC BY-SA 4.0 +13390,2,,13388,8/19/2020 1:14,,1,,"

The part you're overlooking is these lines:

+
    # Players do a sqrt(X) based on their referee's coin.
+    circuit.append([
+        cirq.CNOT(alice_referee, alice)**0.5,
+        cirq.CNOT(bob_referee, bob)**0.5,
+    ])
+
+

The players rotate their qubits conditioned on what the local referee said. This is equivalent to changing the measurement basis conditioned on what the local referee said.

+

The only relevant property is that the effective measurement bases start off offset by -45 degrees (mostly agree), so that a 90 degree rotation by one player gets you to +45 degrees (still mostly agree) while a rotation by both players gets you to +135 degrees (mostly disagree). The example sets up such a situation.

+",119,,119,,8/20/2020 3:50,8/20/2020 3:50,,,,1,,,,CC BY-SA 4.0 +13391,1,,,8/19/2020 1:39,,4,411,"

Is there a function in Qiskit similar to this function in Q# which measures strings of Pauli operators applied to different qubits?

+",5705,,55,,8/24/2020 9:03,9/18/2021 11:00,Is there a function in Qiskit to measure tensor products of Pauli operators?,,1,0,,,,CC BY-SA 4.0 +13392,2,,13386,8/19/2020 7:29,,3,,"

Let $K$ be a vector +$$ +|K\rangle=\sum_{ij}K_{ij}|i,j\rangle. +$$ +We could rewrite this ias +$$ +|K\rangle=\left(\left(\sum_{ij}K_{ij}|i\rangle\langle j|\right)|j\rangle\right)\otimes|j\rangle, +$$ +and this is just the same as +$$ +|K\rangle=K\otimes 1\sum_j|j,j\rangle=|K\rangle\rangle +$$ +if we define the matrix $K$ to be $K=\sum_{ij}K_{ij}|i\rangle\langle j|$.

+",1837,,,,,8/19/2020 7:29,,,,1,,,,CC BY-SA 4.0 +13393,1,13419,,8/19/2020 10:11,,2,70,"

I read an interesting paper of QEC with only two extra qubits.

+

In the paper, there is a circuit. Note that .

+

Here are some contexts of the paper:

+

"The stablizer is $XZZXI$. If the second gate fails and introduces an $IZ$ fault, then this fault will propagate through the subsequent gates to become an $IIZXI$ error on the data."

+

Since the stablizer on the second gate is $Z$, how could it introduce the $IZ$ fault? $IZ$ is equal to $Z$, isn't it? Why the subsequent gate becomes $IIZXI$?

+

+",9105,,55,,8/24/2020 9:04,8/24/2020 9:04,Circuit of quantum error correction code,,1,1,,,,CC BY-SA 4.0 +13394,2,,13386,8/19/2020 10:26,,0,,"

Let $\newcommand{\kett}[1]{\lvert #1\rangle\!\rangle}\newcommand{\ket}[1]{\lvert#1\rangle}\ket m\equiv \sum_k \ket{k,k}$ denote the (unnormalised) maximally entangled state.

+

The relation $\kett X=(X\otimes I)\ket m$ amounts to some simple index juggling. By this, I mean that you are considering the same object, i.e. the same set of numbers, but interpreting it in different ways (as an operator rather than as a vector).

+

To see this, let $X\in\mathcal L(H_0,H_1)$ be your operator, whose matrix elements (in some choice of basis) we write as $X_{ij}$. +Note that you can understand $X_{ij}$ as an operator ("sending the index $j$ to the index $i$"), or as a vector in $H_0\otimes H_1$. +More formally, if we write with $\kett X$ the "vector interpretation" of $X$, we have +$$\langle i,j\kett X = X_{ij} =\langle i|X|j\rangle = \langle i,j|(X\otimes I)\ket m,$$ +where we used +$\langle i,j|X\otimes I|k,\ell\rangle = X_{ik}\delta_{j\ell},$ +and thus +$\kett X=(X\otimes I)\ket m.$ +This is also often written as $\kett X=\operatorname{vec}(X)$, with $\operatorname{vec}:\mathrm{Lin}(\mathcal X,\mathcal Y)\to\mathcal Y\otimes\mathcal X$ the "vectorisation" operation.

+",55,,55,,8/19/2020 11:32,8/19/2020 11:32,,,,0,,,,CC BY-SA 4.0 +13395,1,13397,,8/19/2020 12:21,,6,944,"

In Nielsen and Chuang (Quantum Computing and Quantum Information) the following definition is given to a projective measurement:

+
+

Projective measurements are described by an observable $M$: +$$M = \sum_m m P_m$$ +with $P_m$ a projector onto the Eigenspace of $M$ with eigenvalue $m$.

+
+

My question now is, when we say we measure a system of $n$ qubits in the computational basis, to which observable do we refer precisely?

+

For 1 qubit, I know that this refer to the Z observable:

+

$$Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix} = |0 \rangle \langle 0| - |1\rangle \langle 1|.$$

+

For $n$ qubits,my intuition would be:

+

\begin{align*} + P_1 & = \underbrace{Z \otimes I \otimes ... \otimes I}_{n \textrm{ terms}}. \\ + P_2 & = I \otimes Z \otimes ... \otimes I. \\ + & ... \\ + P_n & = I \otimes I \otimes ... \otimes Z. +\end{align*}

+

with $I$ being the identity matrix.

+

Then the observable would be as in the definition. Is that correct?

+",10065,,16092,,6/16/2021 15:24,6/16/2021 15:24,What's the observable when measuring multiple qubits in the computational basis?,,3,0,,,,CC BY-SA 4.0 +13396,2,,13373,8/19/2020 13:29,,4,,"

In my opinion the nature of these states becomes quite clear when we look at it from an optics angle. We can identify the computational basis states with the vertical and horizontal polarization directions: +$$ +|0\rangle \sim |\updownarrow\,\rangle \qquad +|1\rangle \sim |\leftrightarrow\,\rangle +$$ +The superposition states then correspond to diagonally polarized light: +$$ +|+\rangle \sim |⤢\,\rangle \qquad +|-\rangle \sim |⤡\,\rangle +$$

+

Now, the superposition states that have an $i$ do actually correspond to circularly polarized light: +$$ +|+i\rangle \sim |\circlearrowright\,\rangle \qquad +|-i\rangle \sim |\circlearrowleft\,\rangle +$$ +Which also explains the labels $R$ for right and $L$ for left in @Z..'s post.

+

This correspondence is explained by the fact that circularly polarized light is created by superposing vertical light with horizontal light that has a $\pi/2$ phase difference. This phase difference is exactly $\mathrm{e}^{i \pi/2}=i$.

+",10250,,1859,,8/20/2020 10:49,8/20/2020 10:49,,,,2,,,,CC BY-SA 4.0 +13397,2,,13395,8/19/2020 13:35,,6,,"

Note that your current definitions of the projection matrices $\{P_{1},P_{2},...,P_{n}\}$ are actually not projection matrices, since $P_{i}^{2} = I \not= P_{i} \,\, \forall i$.

+

What works 'better' is if you have something like:

+

\begin{equation} +\begin{split} +P_{1}^{+1} =& |0\rangle\langle 0 | \otimes I \otimes I....\otimes I \\ +P_{1}^{-1} =& |1\rangle\langle 1 | \otimes I \otimes I....\otimes I \\ +P_{2}^{+1} =& I \otimes |0\rangle\langle 0 | \otimes I....\otimes I \\ +P_{2}^{-1} =& I \otimes |1\rangle\langle 1 | \otimes I....\otimes I \\ +& \vdots \\ +P_{n}^{+1} =& I \otimes I....\otimes I \otimes |0\rangle\langle 0|\\ +P_{n}^{-1} =& I \otimes I.... \otimes I \otimes |1\rangle\langle 1 |\\ +\end{split} +\end{equation}

+

However, a PVM must have that $\sum_{i = 0}^{2n-1} P_{i} = I$, which is clearly not the case here! +One could solve for this by renormalizing, but there is another thing missing here: these projectors actually don't account for any correlations that the measurements might have.

+

A better 'choice' is therefore the measurement operators $Z_{n} = Z \otimes Z \otimes Z ... \otimes Z$. This operator has $2^{n}$ eigenvectors:

+

$$Z_{n} = \sum_{i \in \{0,1\}^{n}} m_{i} |i\rangle\langle i|,$$ +where $m_{i} = 1 - 2p_{m} = \pm 1$ with $p_{m}$ the parity of the bitstring $i$ (i.e. $m_{i} = +1$ if the parity is even and $m_{i} = -1$ when the parity is odd). The problem here is that the measurement might only return the measurement outcome, so that you only learn the parity of the measured state.

+

If you want to tell all the different states apart, it is better to associate each state $|i\rangle$ with its own measurement outcome. If $i_{d}$ is the decimal representation of the bitstring $i$, a clear choice is to associate this decimal representation with the state $|i\rangle$ as the measurement outcome. The observable $D$ for this measurement is then:

+

$$ +D = \sum_{i} i_{d} |i\rangle\langle i|. +$$

+

This is also the content of the answer by DaftWullie.

+",8141,,8141,,6/16/2021 8:59,6/16/2021 8:59,,,,2,,,,CC BY-SA 4.0 +13398,2,,13395,8/19/2020 13:59,,2,,"

You simply want any diagonal operator that has distinct diagonal elements (which would imply that every basis element maps to a distinct output of the measurement).

+

One convenient way to denote this in terms of Pauli matrices is +$$ +\sum_{i=1}^N2^{N-i-1}(1-Z_i) +$$ +For a basis state $|x\rangle$ where $x$ is a binary number, the eigenvalue is the decimal representation of $x$ (and hence distinct). Of course, you can drop all the identity terms as those just give a shift in all the eigenvalues.

+",1837,,,,,8/19/2020 13:59,,,,0,,,,CC BY-SA 4.0 +13399,2,,13395,8/19/2020 15:28,,2,,"

Note that if you are considering a projective measurement, there is no need to deal with observables at all. +A projective measurement is characterised by the basis $\newcommand{\ket}[1]{\lvert #1\rangle}\{\ket{u_i}\}_i$ on which you are measuring, and therefore the associated projection probabilities $p_i\equiv \lvert\langle u_i\rvert \psi\rangle\rvert^2$ (when $\ket\psi$ is the state being measured). +You don't need anything else.

+

Bringing an observable into the picture can be useful, depending on the circumstances and what exactly you are interested in. +But remember that observables are used to compute expectation values. In other words, you define an observable by attaching numbers to the possible measurement outcomes, and then computing the expectation value of these numbers with respect to the probability distribution $p_i$.

+",55,,,,,8/19/2020 15:28,,,,0,,,,CC BY-SA 4.0 +13400,2,,11945,8/19/2020 19:10,,3,,"

Qubits need to be able to share entanglement in order to run quantum algorithms. Qubits without entanglement are essentially classical bits. You can't just have two 50 qubit processors and treat them like a 100 qubit system, it's totally different. If you can share entanglement between the two processors, then you have a 100 qubit processor, not 2x50.

+",2149,,,,,8/19/2020 19:10,,,,0,,,,CC BY-SA 4.0 +13401,1,,,8/19/2020 20:33,,1,90,"

The original KLM paper says:

+

The basic states of a bosonic qubit encoded in modes $l_1$ and $l_2$ are $|0\rangle\mapsto|0\rangle_{l_1}|1\rangle_{l_2}$ and $|1\rangle\mapsto|1\rangle_{l_1}|0\rangle_{l_2}$.

+

Why couldn't we simply encode qubits as $|0\rangle\mapsto|0\rangle_{l_1}$ and $|1\rangle\mapsto|1\rangle_{l_1}$?

+",6313,,55,,8/24/2020 9:20,8/24/2020 9:20,Why do we use two optical modes per qubit in the KLM scheme?,,1,2,,,,CC BY-SA 4.0 +13402,1,,,8/19/2020 21:00,,2,74,"

Some quantum computers hold their qubits in a 2D array. I've even seen a 1D topology I think.

+

On IBM Q, you can see which qubits talk to which qubit. I would like to know what determines/limits the connectedness of each qubit.

+

I would imagine it has something to do with decoherence? But any other specific reason?

+",13009,,2927,,8/19/2020 22:10,8/20/2020 14:30,What determines the topology/connectedness of quantum computers?,,1,1,,,,CC BY-SA 4.0 +13404,1,,,8/20/2020 0:26,,10,207,"

I'm studying BQP-completeness proofs of a number of interesting problems of Janzing and Wocjan, and Wocjan and Zhang. Janzing and Wocjan show that estimating entries of matrix powers $(A^m)_{ij}$ with $A_{ij}\in\{-1,0,1\}$ is (promise) BQP-complete. That is, the problem is both in BQP, and can simulate other problems in BQP.

+

Janzing and Wocjan emphasize that their BQP-hardness reduction requires a negative-sign in an entry of $A$ to simulate interference afforded by BQP algorithms. At a critical point in their reduction they apply a (conditional)-$Z$ rotation, which leads to a matrix $A$ with a negative entry. +I don't think their proof of BQP-hardness would carry over when entries $A_{ij}$ are strictly non-negative, e.g. in $\{0,1\}$. Indeed, I believe that such a restricted matrix-powers problem may be amenable to some form of Stockmeyer approximation, e.g. in $\mathsf{AM}$, and hence not BQP-complete under the reasonable hypothesis that $\mathsf{BQP}\not\subseteq\mathsf{AM}$.

+

The proof of BQP-hardness of matrix powers appears initially to be similar to the BQP-hardness of the HHL algorithm, which was wonderfully summarized by @DaftWullie here. +However, HHL considers the Taylor-series expansion of $A^{-1}$, where $A=I-Ue^{-1/T}$ and $U$ is a unitary operator which simulates a given unitary circuit with a clock register construction — so that $U$ (and powers of $U$) will have negative or complex entries, if any of the gates in the circuit do. For the case $\tilde A = U \mathrm{e}^{-1/T}$, this again suggests that the BQP-completeness of estimating entries of matrix powers $\tilde A^m$ is associated with whether $\tilde A$ has entries apart from non-negative reals.

+

Given this, considered as a special case of HHL which is motivated by the comparison to the problem of Janzing and Wocjan, I'd like to know: is HHL still BQP-complete if all of the entries of $A$ and $\lvert b \rangle$ are in $\{0,1\}$ ?

+",2927,,124,,8/25/2020 13:13,8/25/2020 13:13,"Is HHL still BQP-complete when the matrix entries are only in {0,1}?",,0,6,,,,CC BY-SA 4.0 +13405,1,,,8/20/2020 1:45,,1,53,"

I want to perform a CHSH inequalities test using operators $A \, \& B$ and their combinations each possessed by Alice and Bob, which obey the following commutator relation.

+

$$[A, B] = 2C$$

+

Consider that the eigenvalue spectrum of all three operators is unbounded. I now want to recast them in the standard CHSH form by defining new operators such that their norm is less than or equal to unity. Given that the above operator relation holds, do there exist operators $A'$, $B'$ and $C'$ such that their eigenvalues lie between $-1$ and $1$, i.e.

+

$$||A'||\leq 1,\quad ||B'||\leq 1, \quad ||C'|| \leq 1,$$

+

such that +$$A' = f_1(A), \quad B' = f_2(B), \quad C' = f_3(C)$$

+

and the following relation holds?

+

$$[A', B'] = 2 C'$$

+

Note that this transformation will allow me to write down operators which replicate standard spin operators, using which the CHSH bound of "2" can be possibly violated on an entangled state in textbook fashion, as this relation is now similar to relation between spin generators. Is there a convenient algorithm to generate these new operator relations from the given commutator structure in the first equation? Or is there an easier way to perform the CHSH test using operators in the first equation?

+",13011,,,,,8/20/2020 1:45,CHSH test using unbounded operators,,0,3,,,,CC BY-SA 4.0 +13406,1,,,8/20/2020 7:28,,5,556,"

The documentation for the new version Qiskit 0.20.0 states that:

+
    +
  • UGate is "Implemented using two X90 pulses on IBM Quantum systems:
  • +
+

$U(θ,ϕ,λ)=RZ(ϕ−π/2)RX(π/2)RZ(π−θ)RX(π/2)RZ(λ−π/2)$"

+
    +
  • U3Gate is "Implemented using two X90 pulses on IBM Quantum systems:
  • +
+

$U3(θ,ϕ,λ)=RZ(ϕ)RX(−π/2)RZ(θ)RX(π/2)RZ(λ)$"

+

It looks like only the latter matches the known rotation sequence for U3: +$z$-rotation ($\lambda$), $y$-rotation ($\theta$), $z$-rotation ($\varphi$)

+

Although their presentation matrices completely coincide: +$$ +\mathrm{U3}= +\mathrm{U}= +\begin{pmatrix} +\cos(\theta/2) & -\mathrm{e}^{i\lambda}\sin(\theta/2) \\ +\mathrm{e}^{i\phi}\sin(\theta/2) & \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) +\end{pmatrix}. +$$

+

Is this an inaccuracy in the documentation or am I missing something and these gates are actually different?

+

Just in case, the aforementioned difference stated in the documentation refers to the hardware (not software) implementation of these gates on IBM Q systems.

+",12416,,12416,,8/20/2020 16:15,8/20/2020 16:15,Why are there such different UGate and U3Gate implementations in the Qiskit documentation?,,1,0,0,,,CC BY-SA 4.0 +13407,1,13412,,8/20/2020 7:49,,1,75,"

I was wondering what would be an equation for Hadamard operation for a single qubit, given the input as the current $\theta$ (0 to $+\pi/2$) and $\varphi$ ($-\pi$ to $+\pi$) and output expected in $\theta$ and $\varphi$ with same ranges. Most expressions of Hadamard that I saw use Cartesian transformation, but not $\theta/\varphi$ transform.

+

I could convert the input to Cartesian form, and convert the output back into $\theta/\varphi$ form well, but I'm looking for an equation that does it without using Cartesian conversion step? The goal is to understand direct relation between input and output. I tried interpreting Hadamard as subtracting $\pi/4$ from $\theta$ and adding $\pi$ to phase, but I see that it doesn't quite work for arbitrary input.

+

Note: here $\varphi$ refers to relative phase ($-\pi$ to $+\pi$) and $\theta$ refers to component amplitude factor (0 to $+\pi/2$).

+",13012,,9006,,8/21/2020 7:05,8/24/2020 12:18,Hadamard direct mapping of input to output in $\theta$ and $\varphi$ form,,1,0,,,,CC BY-SA 4.0 +13409,2,,13406,8/20/2020 13:48,,3,,"

If you look at the source code then you will see that the UGate is defined as an alias for the U3Gate. As to why do they need this alias, I do not know for sure. But if I were to hazard a guess, then it would be because in most quantum computing literature, $U$ is used to refer to an arbitrary unitary gate/operator. Since in qiskit U3Gate is the most generic single qubit unitary gate, it makes sense to identify it with $U$ from quantum computing literature.

+",12785,,,,,8/20/2020 13:48,,,,13,,,,CC BY-SA 4.0 +13410,2,,13402,8/20/2020 14:30,,2,,"

What limits the connectedness is ultimately a platform-specific question. For example, in trapped-ion quantum computers, all of the ions are coupled through a collective motional mode such that all qubits are actually "connected", so that the graph of qubit-qubit connections is complete.

+

The more mainstream approach (at least in industry) involves the use of superconducting qubits, which encompasses an ever-growing zoo of different qubit models (transmons, fluxonium, etc.), each with its pros and cons. Since these designs are fabricated via lithographic processes onto 2-dimensional substrates, the geometry of the plane itself constrains which qubits can talk to each other. The difficulty lies in the fact that on top of these couplings, the qubits also require drive and readout lines that need to reach the edge of the chip so that the signals can be routed through the qubit chip housing and eventually to classical control hardware. There are ways of getting "lines" (coplanar waveguides) to cross on chips via airbridges, and there is current work on 3D-integrated technology that can "break the plane", where different aspects of the chip's functionality are spread across different wafers that can be stacked and bonded in the vertical direction.

+

Furthermore, like you said, decoherence is also generally an issue, because for certain qubit types, having too many couplings can cause frequency crowding. More specifically, when two-qubit gates (like CNOTs) are implemented, specific resonances between coupled qubits are driven by precisely timed and shaped signals. When there are many couplings, there are many potential resonances that could be driven, when only one is actually desired for the gate. Thus, it becomes increasingly difficult to isolate the desired one (the signal might have a limit on its spectral purity), and these spurious resonances (cross-talk) will result in erroneous entanglement.

+",4622,,,,,8/20/2020 14:30,,,,0,,,,CC BY-SA 4.0 +13412,2,,13407,8/20/2020 17:05,,0,,"

I think I got it. The two rotations with angles $-\pi/4$ and $\pi/2$ should do it. The first rotation is about Y-axis and the second one is about Z-axis. So it still not what I was looking for. I was looking for change in the angle that determines the amplitudes instead of Y-rotation (the two are not same). But the Y-rotation is enough for my intuition. How I got this answer? Well, I just observed the change through multiple trials and learned the pattern :)

+",13012,,13012,,8/24/2020 12:18,8/24/2020 12:18,,,,3,,,,CC BY-SA 4.0 +13413,1,13414,,8/20/2020 17:41,,6,240,"

By convention, we often write a single qubit gate as:

+

$$U=e^{i \alpha} R_z(\beta) R_y(\gamma) R_z(\delta)$$

+

We notice that in addition to the three rotations, there is a coefficient $e^{i \alpha}$. What disturbs me is that this extra phase $e^{i \alpha}$ shouldn't really matter as it will only add a global phase in the computation. Thus, why is it usually written ? It it because we want to "mathematically" identify the expression of the unitary but in term of physics this phase will never be added in practice on a quantum computer ?

+",5008,,5008,,2/8/2022 19:44,2/8/2022 19:44,Adding a phase to qubit: why is it necessary for arbitrary single qubit gate,,1,3,,,,CC BY-SA 4.0 +13414,2,,13413,8/20/2020 19:00,,6,,"

A reason why we need that $e^{i \alpha}$ term:

+

It is right that the global phase $e^{i \alpha}$ will not change the action of the gate, but let's consider these two gates:

+

$$ +U1\big(\frac{\pi}{2}\big) = +\begin{pmatrix} +1 & 0 \\ +0 & i +\end{pmatrix} +\qquad +R_z\big(\frac{\pi}{2}\big) = +\begin{pmatrix} +e^{-i \frac{\pi}{4}} & 0 \\ +0 & e^{i \frac{\pi}{4}} +\end{pmatrix}$$

+

It can be easily seen that $R_z\big(\frac{\pi}{2}\big) = e^{-i \frac{\pi}{4}} U1\big(\frac{\pi}{2}\big)$. So both gates are differ by a global phase $e^{-i \frac{\pi}{4}}$ which means that they are equavalent when we apply them in the circuits. Nevertheless, as was discussed in this question [1] and in this this answer [2] the control version of this gates are not equivalent to each other:

+

$$ +CU1\big(\frac{\pi}{2}\big) = +\begin{pmatrix} +1 & 0 &0 &0 \\ +0 & 1 &0 &0 \\ +0 & 0 &1 &0 \\ +0 & 0 &0 &i +\end{pmatrix} +\qquad +CR_z\big(\frac{\pi}{2}\big) = +\begin{pmatrix} +1 & 0 &0 &0 \\ +0 & 1 &0 &0 \\ +0 & 0 &e^{-i \frac{\pi}{4}} &0 \\ +0 & 0 &0 &e^{i \frac{\pi}{4}} +\end{pmatrix}$$

+

So if we are trying to construct a circuit by applying a control version of some unitary, the global phase of the unitary shouldn't be neglected. This scenario is not seldom. For example, in QPE (and thus in HHL) algorithm, we should be careful with the global phase in the unitary whose controlled versions are used in the algorithm.

+",9459,,9459,,8/20/2020 19:05,8/20/2020 19:05,,,,0,,,,CC BY-SA 4.0 +13415,2,,13391,8/21/2020 2:54,,1,,"

You can create a string of Pauli operators, applied to different qubits, using the Pauli class from qiskit.quantum_info, and then just do a measurement like you would do for any circuit.

+",12785,,,,,8/21/2020 2:54,,,,3,,,,CC BY-SA 4.0 +13416,1,,,8/21/2020 6:40,,2,105,"

Can the qiskit function QuantumCircuit.initialize be used to initiate any number of qubits (which exist currently on the quantum computers) and can it be used on a real quantum computer?

+",8031,,55,,8/24/2020 9:25,8/24/2020 9:25,Using QuantumCircuit.initialize() on a real quantum computer,,1,0,,,,CC BY-SA 4.0 +13417,2,,13416,8/21/2020 6:59,,2,,"

The initialize method uses an algorithm to generate a set of gates that implement your input statevector. Therefore it can also be used on real hardware. +But it is important to note, that this is a generic algorithm that works for any statevector. There might be much more efficient preparations for your particular case. You should definitely check if there aren’t too many gates generated, before running initialize on real hardware. +State preparation is still an active field of research.

+",9800,,9006,,8/22/2020 6:23,8/22/2020 6:23,,,,0,,,,CC BY-SA 4.0 +13419,2,,13393,8/21/2020 13:44,,1,,"

+

As you can see in th picture, the (I,Z) error occurs on 2 qubits going into a CNOT. I happens on the control and Z error happens on the target ancilla qubit, and then propagates upwards through the next CNOT, then continues from the ancilla to the following CNOT and becomes an X error on the 4th data qubit because of the Hadamard gate, and finally the 5 data qubits have an error pattern (I on the first qubit, I for the second qubit, Z on the third one, X for the fourth one, and I on the 5th one).

+",12047,,,,,8/21/2020 13:44,,,,0,,,,CC BY-SA 4.0 +13420,1,,,8/21/2020 16:49,,3,22,"

I've heard that you run up against the very large constant factors when comparing run times of quantum and classical computers -- things simply take much longer in a carefully controlled quantum setup than in a GHz CPU. So even though a quantum algorithm may have exponential speed-up, we will start with a big constant-factor disadvantage and only realize an actual speed-up once the problem is large enough that the scaling advantage overcomes the constant factor. But what are these constant factors? So this question is actually two:

+
    +
  1. Are there already hypothetical durations of how long a continuous-variable gate would take on a continuous-variable quantum computer?
  2. +
  3. What are these constant factors that makes the speed up for quantum algorithms on qc more difficult?
  4. +
+",13030,,,,,8/21/2020 16:49,Are there already hypothetical durations of how long a continuous-variable gate would take on a continuous-variable quantum computer?,,0,0,,,,CC BY-SA 4.0 +13421,1,13423,,8/21/2020 21:55,,1,139,"

Is there a similare function in Q# like Statevector.probabilities in Qiskit to get state vector probability, for example, if my circuit contains one qubit with one $H$ gate, the function returns something like [0.5, 0.5].

+",12910,,55,,8/24/2020 9:18,8/24/2020 9:18,How to get state vector probabilities in Q#,,1,0,,,,CC BY-SA 4.0 +13422,2,,13401,8/21/2020 22:19,,1,,"

Mathematically, both options are ok. You can use "single-rail" or "dual-rail" encoding. Dual-rail has some implementation advantages. Look here for example : +https://arxiv.org/pdf/1103.6071.pdf

+",12265,,,,,8/21/2020 22:19,,,,0,,,,CC BY-SA 4.0 +13423,2,,13421,8/21/2020 22:27,,2,,"

You may be looking for DumpMachine which will gove you all the information about the whole quantum machine including complex amplitudes and phases. You can find the tutorials here : here

+",8746,,,,,8/21/2020 22:27,,,,0,,,,CC BY-SA 4.0 +13424,1,13425,,8/21/2020 23:09,,2,154,"

Consider this expression where $A$ and $B$ are matrices, $|i \rangle$ is a ket (column vector) and $\langle j |$ is a bra (row vector) : +$$ +A | i \rangle \langle j | B \tag1\label1 +$$

+

Due to the general associative properties of the bra-ket notation, this can be interpreted as the inner product of 2 vectors: +$$ +\left( A | i \rangle \right) \left( \langle j | B \right) \tag2\label2 +$$

+

But by regrouping the terms and considering that outer products can be given a matrix representation, \eqref{1} can also be interpreted as the product of 3 matrices:

+

$$ +A (| i \rangle \langle j |) B \tag3\label3 +$$

+

My confusion comes from the mismatch of the dimensions of expressions \eqref{2} and \eqref{3}. \eqref{2} yields a complex scalar, while \eqref{3} yields a matrix. If the associative property holds, I'd expect the dimensions not to depend on the grouping of the terms. Could somebody please shed some light where I am getting confused?

+",12643,,55,,8/24/2020 9:18,8/24/2020 9:18,Confused about associativity of outer product notation,,1,0,,,,CC BY-SA 4.0 +13425,2,,13424,8/21/2020 23:39,,2,,"

It seems you're conflating inner products and outer products. An inner product would be expressed as +$$\langle i \vert j \rangle \;\;\; \text{or} \;\;\; \langle i \vert A^\dagger B \vert j\rangle.$$ +A column vector times a row vector, $C^{j \times 1} R^{1 \times i}$, results in a $j \times i$ matrix. A row vector times a column vector with compatible dimension, $R^{1 \times j} C^{j \times 1}$, gives a scalar.

+",8623,,,,,8/21/2020 23:39,,,,1,,,,CC BY-SA 4.0 +13426,1,13431,,8/22/2020 3:08,,5,704,"

We know that generalized (POVM) measurement is defined by matrices $M_i$ which are

+
    +
  • Positive semidefinite
  • +
  • Add up to a unit matrix, $\sum_i M_i = \mathbb{I}$
  • +
+

and the probability of obtaining outcome $i$ on state $\rho$ is

+
    +
  • $p_i = Tr(\rho M_i)$
  • +
+

I can easily construct POVM example on a qubit by choosing

+
    +
  • $M_0 = |\Psi\rangle\langle\Psi|$
  • +
  • $M_1 = \mathbb{I}- |\Psi\rangle\langle\Psi|$
  • +
+

But this is simply a projective measurement (on state $\Psi$).

+

How to construct a non-trivial (non-projective) POVM measurement example?

+",2105,,55,,4/18/2022 18:06,4/18/2022 18:26,What are examples of non-trivial POVM measurements?,,1,0,,,,CC BY-SA 4.0 +13429,1,,,8/22/2020 6:04,,1,75,"

I have a circuit that prepares a state $|s\rangle$ which is a superposition of the basis states $$\sum_{x=0}^{2^{n-1}}\alpha_x|x\rangle$$ +with amplitude $\alpha_x$ for a circuit of $n$ qubits. Particularly, the solution to the problem I'm looking is on the state $|0\rangle$.

+

The challenge is that, $|0\rangle$ usually has a really low probability (and sometimes its not even present in the superposition).

+

I was wondering if there was a simple way to boost the amplitude of $|0\rangle$ given I know specifically location of my solution?

+",12302,,55,,8/24/2020 9:18,8/24/2020 9:18,Amplitude amplification for known state but unknown amplitude,,0,4,,,,CC BY-SA 4.0 +13431,2,,13426,8/22/2020 7:52,,5,,"

Here's a few examples

+

POVMs with two components

+

These are POVMs involving only two matrices $M_1,M_2\ge0$ with $M_1+M_2=I$. +This implies that they are mutually diagonalisable, as discussed e.g. in this question. Using their (mutual) eigenvectors as basis, we can therefore always write them as

+

$$\newcommand{\on}[1]{{\operatorname{#1}}} M_1 = \on{diag}(s_1,..., s_N), +\qquad M_2 = \on{diag}(1-s_1,...,1-s_N),$$ +where $N$ is the dimension of the underlying space and $s_i\in[0,1]$. +Note that $M_i$ are not, in general, projections.

+

For a concrete example, consider +$M_1 = M_2 = \on{diag}(1/2,1/2). %\begin{pmatrix}1/2 & 0 \\ 0 & 1/2\end{pmatrix}.$ +Of course, this represents a completely useless measurement, as $\on{Tr}(\rho M_i)=1/2$ for all $\rho$.

+

POVMs that are sum of projectors

+

Suppose $N=3$, $\newcommand{\bs}[1]{\boldsymbol{#1}}\newcommand{\PP}{\mathbb P}\newcommand{\ketbra}[1]{\lvert #1\rangle\!\langle #1\rvert}$ and consider $M_1=\ketbra1+\ketbra2$ and $M_2=\ketbra3$. This is a POVM that's also not sum of trace-1 projectors.

+

You can also show that, if $N=2$, the only POVMs that are sum of projectors have the form $\{\PP(\bs u),\PP(-\bs u)\}$, where $\PP(\bs u)\equiv \frac12 (I+\bs u\cdot\bs \sigma)$ projects onto the $+1$ eigenspace of $\bs u\cdot\bs \sigma\equiv\sum_k u_k \sigma_k$, with $\sigma_k$ the Pauli matrices and $u\in\mathbb R^3$ with $\|\bs u\|=1$. +This can be seen from the above observation about diagonalisability. Another proof is found around page 19 of these notes by Nicholas Wheeler (Link to pdf).

+

Still considering the qubit case $N=2$, we can more generally take a set of $n$ vectors $\mathbf a_i$ such that $\sum_i \mathbf a_i=0$ and $\|\mathbf a_i\|\le1$, and then +$$\sum_i \frac{2}{n}\PP(\mathbf a_i) = I,$$ +so that $\big\{\frac{2}{n}\PP(\mathbf a_i)\big\}_{i=1}^n$ is an $n$-element qubit POVM. This is also shown in Wheeler's notes linked above.

+

A question related to this is Are three POVM measurements on a single qubit physically realizable?.

+

State discrimination

+

Another common scenario is unambiguous state discrimination. Given two pure states $\newcommand{\ket}[1]{\lvert #1\rangle}\ket\psi,\ket\varphi$, the optimal POVM to distinguish between them is +$$M_1 = \frac{1}{1+\lvert\langle\varphi|\psi\rangle\rvert}\ketbra{\varphi^\perp}, +\quad +M_2 = \frac{1}{1+\lvert\langle\varphi|\psi\rangle\rvert}\ketbra{\psi^\perp}, +\quad +M_3 = I - M_1 - M_2. +$$

+

On the other hand, the POVM that optimally distinguishes between two states, uses $M_1=\sum_{i: \lambda_i>0}\mathbb{P}(|\lambda_i\rangle)$, $M_2=\sum_{i: \lambda_i<0}\mathbb{P}(|\lambda_i\rangle)$, where $|\lambda_i\rangle$ is the eigenstate with eigenvalue $\lambda_i$ of $\mathbb{P}(|\psi\rangle)-\mathbb{P}(|\phi\rangle)$, where $|\psi\rangle,|\phi\rangle$ are the states we are trying to discriminate. +This is also discussed in What is the Helstrom measurement?.

+

For example, to optimally discriminate between $|0\rangle$ and $|+\rangle$, we get +$$M_1 = \frac1{2(2-\sqrt2)}\mathbb{P}((-1+\sqrt2)|0\rangle+|1\rangle) += \frac1{2(2-\sqrt2)} \begin{pmatrix}3-2\sqrt2 & \sqrt2-1\\\sqrt2-1&1\end{pmatrix}, \\ +M_2 = \frac1{2(2+\sqrt2)}\mathbb{P}((-1-\sqrt2)|0\rangle+|1\rangle) += \frac1{2(2+\sqrt2)} \begin{pmatrix}3+2\sqrt2 & -\sqrt2-1\\-\sqrt2-1&1\end{pmatrix}. +$$

+

Example without any specific structure

+

A generic example with $N=3$, given in this answer, is +$$ +M_1 =\frac{1}{9} + \begin{pmatrix} + 3 & 2 & -1\\ + 2 & 3 & -1\\ + -1 & -1 & 3\\ + \end{pmatrix}, +\quad +M_2 =\frac{1}{9} + \begin{pmatrix} + 3 & -1 & 2\\ + -1 & 3 & -1\\ + 2 & -1 & 3\\ + \end{pmatrix}, +\quad +M_3 =\frac{1}{9} + \begin{pmatrix} + 3 & -1 & -1\\ + -1 & 3 & 2\\ + -1 & 2 & 3\\ + \end{pmatrix}. +$$

+",55,,55,,4/18/2022 18:26,4/18/2022 18:26,,,,1,,,,CC BY-SA 4.0 +13432,1,13434,,8/22/2020 13:40,,3,69,"

Consider the density matrices $\rho_0 = |0 \rangle \langle 0|$ and $\rho_1 = |1 \rangle \langle 1|$. Let $\{p_1, p_2\}$, and $\{p_3, p_4\}$ be two probability distributions, that is, +$$0 \leq p_1, p_2, p_3, p_4 \leq 1$$ +$$p_1 + p_2 = 1$$ +$$~\text{and}~ p_3 + p_4 = 1.$$ +These probability distributions refers two mixed states $\rho = p_1 \rho_0 + p_2 \rho_1$ and $\rho' = p_3 \rho_0 + p_4 \rho_1$. Now I have the following questions:

+
    +
  1. Is there is a unitary matrix $U$ such that $\rho' = U^\dagger \rho U$ ?

    +
  2. +
  3. How to calculate $U$ when all $p_1, p_2, p_3$ and $p_4$ are known, if $U$ exists?

    +
  4. +
  5. Can we represent $U$ with a quantum circuit with qubits if $U$ exists?

    +
  6. +
+",962,,55,,8/24/2020 9:12,8/24/2020 9:12,Can we always find a unitary operation connecting qubit states with given eigendecompositions?,,1,0,,,,CC BY-SA 4.0 +13433,1,13457,,8/22/2020 14:39,,0,96,"

I am implementing an Ising chain over 8 qubits. It involves pair-wise CNOT between all the qubits. In the first time step, I am doing CNOTs between qubits 0 and 1, 2 and 3, 4 and 5, and 6 and 7. In the second time step, I would do CNOTs between qubits 1 and 2, 3 and 4, and 5 and 6. I have written the code as follows:

+
# Block A for the first time step
+qp.cx(q0,q1)
+qp.cx(q2,q3)
+qp.cx(q4,q5)
+qp.cx(q6,q7) 
+
+# Block B for the second time step
+qp.cx(q1,q2)
+qp.cx(q3,q4)
+qp.cx(q5,q6)
+
+

I would like the gates in Block A to be applied simultaneously. Then, in the next step, gates in Block B should be applied simultaneously. How to convey to the compiler that I do not want the above written code to be compiled sequentially, rather I want it to be applied block-wise.

+",11572,,55,,8/24/2020 9:10,8/24/2020 14:16,Implementing block of gates at different times in a same qiskit program,,1,1,,,,CC BY-SA 4.0 +13434,2,,13432,8/22/2020 14:42,,3,,"

Since conjugation of the state $\rho$ with unitaries, i. e. $\rho \mapsto U \rho U^\dagger$, preserves eigenvalues, this could only be possible in your case if $p_1 =p_3$ or $p_1 = p_4$. In those cases the unitary transformation required is the identity and $\sigma_x$ respectively.

+",9854,,,,,8/22/2020 14:42,,,,0,,,,CC BY-SA 4.0 +13435,1,13464,,8/22/2020 15:20,,2,146,"

I would like to understand an example of finding a noiseless subsystem of a quantum channel from the irreducible representation of its Kraus operators.

+

Assume we have $2$ dephasing channels acting on two qubits, then +$$\mathcal{E}(\rho_{AB})= \sum_{i=1}^4 K_i \rho_{AB} K_i^\dagger,$$ +where the Kraus operators are +$$K_1=\mathbf{1}_{AB}/2, +\qquad K_2= \frac{1}{2}\mathbf{1}_{A}\otimes Z_B, +\qquad K_3=\frac{1}{2}Z_A\otimes \mathbf{1}_{B}, +\qquad K_4=\frac{1}{2}Z_{A}\otimes Z_B.$$ +How do I decompose this as $\bigoplus_j \mathbf{1}_{n_j}\otimes M(d_j) $? Will each Kraus operator be expressible in this decomposition?

+

I can see they are diagonal, and this channel has three decoherence-free subspaces; one spanned by $|00\rangle$, one spanned by $|11\rangle$,and one spanned by $\{|01\rangle,|10\rangle\}$. +As mentioned in this book, decoherence free subspaces are a special case of noiseless subsystems, where $M(d_j)$ is just a constant, and $n_j$ is the dimension of the decoherence-free subspace. How do I extract these $n_j$'s from the Kraus operators or their irreps? +Thanks in advance.

+",12047,,12047,,8/25/2020 7:03,8/25/2020 7:15,Finding the irreducible representation of Kraus operators of a dephasing channel,,1,7,,,,CC BY-SA 4.0 +13436,1,,,8/23/2020 0:01,,3,227,"

Schoening's algorithm for 3SAT can be converted to a quantum algorithm.  The classical circuit representing a 3SAT expression in CNF form can be converted to a quantum version involving reversible unitary gates and a lot of ancillary qubits. Flipping a variable (if the clause is not satisfied) can be done using CNOT, CCNOT, CCCNOT gates properly placed (also involving ancillary qubits ). The random choices that the algorithm makes can be implemented by "flipping a coin " and choosing what branches of the large quantum circuit to be activated at a given stage of the computation.  In principle I see no problem in the implementation. 

+

A related approach can be found  here

+

Two simplistic computations involving simple expressions with 1-clauses and 2-clauses are described here (in order to see what I'm looking for ):

+

first simplistic sample computation

+

second simplistic sample computation

+

Note that at each step a lot of states are affected. In terms of classical truth assignments it's like running a lot of classical Schoening algorithms in parallel. I am not talking about applying Grover's algorithm for 3SAT, I am thinking about translating Schoning's algorithm into a quantum algorithm.

+

Question.  Have these types of algorithms been studied extensively, in order to assess their efficiency? What are the known results in this direction,  and the open problems? More importantly (this is the main question), could anyone provide a proof that these algorithms are not polynomial?

+",10110,,10110,,8/25/2020 11:45,8/25/2020 11:45,What is known about the quantum version of Schoening's algorithm for 3SAT?,,0,1,0,,,CC BY-SA 4.0 +13437,1,13438,,8/23/2020 0:15,,4,115,"

From Nielsen & Chuang (10th edition), page 69:

+
+

Suppose $A$ is any linear operator on a Hilbert space, $V$. It turns +out that there exists a unique linear operator $A^\dagger$ on $V$ such +that for all vectors $|v\rangle$, $|w\rangle \in V$,

+

$$ (|v, A|w\rangle)=(A^\dagger|v\rangle, |w\rangle). \tag{2.32} $$

+

This linear operator is known as the adjoint or Hermitian conjugate of +the operator $A$. From the definition it is easy to see that $(AB)^\dagger = B^\dagger A^\dagger$. By convention, if $|v\rangle$ is a vector, then we define $|v\rangle^\dagger \equiv \langle v|$. With this definition it is not difficult to see that $(A|v\rangle)^\dagger = \langle v|A^\dagger$.

+
+

Well, to me it is difficult to see that +$$ +(A|v\rangle)^\dagger = \langle v|A^\dagger \tag1\label1 +$$

+

at least without invoking +$$ +A^\dagger=\left(A^* \right)^T \tag2\label2 +$$ +which I don't want to do because the book haven't introduced \eqref{2} at this point!

+

I realise that by using the definition $|v\rangle^\dagger \equiv \langle v|$ and right multiplying it by $A^\dagger$ I get:

+

$$ +|v\rangle^\dagger A^\dagger = \langle v| A^\dagger \tag3 +$$

+

This is pretty close to \eqref{1} and I only need to show that

+

$$ +|v\rangle^\dagger A^\dagger = (A|v\rangle)^\dagger \tag4\label4 +$$

+

My first instinct was to use $(AB)^\dagger = B^\dagger A^\dagger$ here. However, this does not feel quite right because $A$ and $B$ are both linear operators but in \eqref{4} I'm dealing with a linear operator and a vector. I tried getting around this by going to the matrix representation of linear operators and extending the vector $|v \rangle$ into a matrix such as:

+

$$ +B = +\begin{bmatrix} + \vert & \vert & \dots & \vert \\ + |v \rangle & 0 & \dots & 0 \\ + \vert & \vert & \dots & \vert \\ +\end{bmatrix} +$$

+

Then I could invoke $(AB)^\dagger = B^\dagger A^\dagger$ but I'm not sure what to do with this because at this point in the book we don't know that $B^\dagger = \left(B^* \right)^T$. Therefore, we don't know that the first row of $B^\dagger$ will be $\langle v|$. Does anybody know how to proceed?

+",12643,,55,,8/24/2020 9:27,8/24/2020 9:27,Deriving $\left( A | v \rangle \right)^\dagger = \langle v | A^\dagger$ without using $A^\dagger=\left(A^* \right)^T$,,1,0,,,,CC BY-SA 4.0 +13438,2,,13437,8/23/2020 7:26,,4,,"

The application of $(AB)^\dagger = B^\dagger A^\dagger$ directly is indeed not quite right.

+

At first note that +$$ +(A|v\rangle,|w\rangle) = (|w\rangle, A|v\rangle)^* = (A^\dagger|w\rangle, |v\rangle)^* = (|v\rangle , A^\dagger|w\rangle) +$$ +BTW, from this you can immediately deduce $(A^\dagger)^\dagger = A$.

+

Now for all $|w\rangle$ we have +$$ +(A|v\rangle)^\dagger |w\rangle = (A|v\rangle,|w\rangle) = (|v\rangle,A^\dagger|w\rangle) = +$$ +$$ += \langle v | \big(A^\dagger|w\rangle\big) = \langle v | A^\dagger|w\rangle = \big(\langle v | A^\dagger \big)|w\rangle +$$ +Since it's true for all $|w\rangle$ we can deduce the required $(A|v\rangle)^\dagger= \langle v | A^\dagger$.

+",5870,,5870,,8/23/2020 7:50,8/23/2020 7:50,,,,0,,,,CC BY-SA 4.0 +13439,1,,,8/23/2020 13:59,,2,26,"

Quantum circuits can be expressed as the matrix product of each gate in the circuit, where each gate is a unitary matrix (say) $G_i$. So, the whole circuit is $S = G_n G_{n-1} \cdots G_1$.

+

Since $S$ is unitary there isn't a non-lossy decomposition that reduces the rank (and would therefore be more efficient), but it seems like we might be able to get a close approximation, which could potentially speed up any circuit.

+

Note: I'm very new to QC so it's very likely this question has a lot of misunderstandings - I just want some help clarifying my knowledge! Thanks!

+",12376,,55,,8/24/2020 9:27,8/24/2020 9:27,Can low-rank factorizations approximate quantum circuits?,,0,0,,,,CC BY-SA 4.0 +13440,1,,,8/23/2020 14:21,,0,651,"

When trying to import qiskit I obtain following error:

+
/opt/anaconda3/lib/python3.8/site-packages/qiskit/__init__.py:63: RuntimeWarning: Could not import the Aer provider from the qiskit-aer package. Install qiskit-aer or check your installation.
+  warnings.warn('Could not import the Aer provider from the qiskit-aer '
+/opt/anaconda3/lib/python3.8/site-packages/qiskit/__init__.py:73: RuntimeWarning: Could not import the IBMQ provider from the qiskit-ibmq-provider package. Install qiskit-ibmq-provider or check your installation.
+  warnings.warn('Could not import the IBMQ provider from the '
+---------------------------------------------------------------------------
+ModuleNotFoundError                       Traceback (most recent call last)
+<ipython-input-3-578b7f7e9727> in <module>
+----> 1 import qiskit
+
+/opt/anaconda3/lib/python3.8/site-packages/qiskit/__init__.py in <module>
+     78 # Moved to after IBMQ and Aer imports due to import issues
+     79 # with other modules that check for IBMQ (tools)
+---> 80 from qiskit.execute import execute  # noqa
+     81 from qiskit.compiler import transpile, assemble, schedule  # noqa
+     82 
+
+/opt/anaconda3/lib/python3.8/site-packages/qiskit/execute.py in <module>
+     24 import logging
+     25 from time import time
+---> 26 from qiskit.compiler import transpile, assemble, schedule
+     27 from qiskit.qobj.utils import MeasLevel, MeasReturnType
+     28 from qiskit.pulse import Schedule
+
+/opt/anaconda3/lib/python3.8/site-packages/qiskit/compiler/__init__.py in <module>
+     33 
+     34 from .assemble import assemble
+---> 35 from .transpile import transpile
+     36 from .schedule import schedule
+
+/opt/anaconda3/lib/python3.8/site-packages/qiskit/compiler/transpile.py in <module>
+     22 from qiskit.providers.models import BackendProperties
+     23 from qiskit.providers.models.backendproperties import Gate
+---> 24 from qiskit.transpiler import Layout, CouplingMap, PropertySet, PassManager
+     25 from qiskit.transpiler.basepasses import BasePass
+     26 from qiskit.dagcircuit import DAGCircuit
+
+/opt/anaconda3/lib/python3.8/site-packages/qiskit/transpiler/__init__.py in <module>
+    412 """
+    413 
+--> 414 from .runningpassmanager import FlowController
+    415 from .passmanager import PassManager
+    416 from .passmanager_config import PassManagerConfig
+
+/opt/anaconda3/lib/python3.8/site-packages/qiskit/transpiler/runningpassmanager.py in <module>
+     21 from time import time
+     22 
+---> 23 from qiskit.dagcircuit import DAGCircuit
+     24 from qiskit.converters import circuit_to_dag, dag_to_circuit
+     25 from .propertyset import PropertySet
+
+/opt/anaconda3/lib/python3.8/site-packages/qiskit/dagcircuit/__init__.py in <module>
+     39    DAGCircuitError
+     40 """
+---> 41 from .dagcircuit import DAGCircuit
+     42 from .dagnode import DAGNode
+     43 from .dagdepnode import DAGDepNode
+
+/opt/anaconda3/lib/python3.8/site-packages/qiskit/dagcircuit/dagcircuit.py in <module>
+     29 import math
+     30 
+---> 31 import retworkx as rx
+     32 import networkx as nx
+     33 
+
+/opt/anaconda3/lib/python3.8/site-packages/retworkx/__init__.py in <module>
+      7 # that they have been altered from the originals.
+      8 
+----> 9 from .retworkx import *
+     10 
+     11 
+
+ModuleNotFoundError: No module named 'retworkx.retworkx' 
+
+

Have I installed Qiskit to the target directory incorrectly? +I attempted to install Qiskit in Terminal using: +python3 -m pip install qiskit -t /opt/anaconda3/lib/python3.8/site-packages.
I navigated to the path manually and I could find all the qiskit modules, including the retworkx modules (whatever it may be).
+If anybody has experienced this sort of error before and happens to know a fix, I would appreciate it very much.

+",12809,,55,,8/24/2020 9:28,9/15/2020 1:44,Trouble importing Qiskit,,2,1,,,,CC BY-SA 4.0 +13441,1,,,8/23/2020 14:46,,1,35,"

I am fairly new to this topic and I couldn't find resources that were beginner-friendly. So basically what are the differences between these two?

+",10376,,,,,8/23/2020 14:46,Difference between a Non-Gaussian Circuit and Gaussian Circuit,,0,4,,,,CC BY-SA 4.0 +13442,1,13449,,8/23/2020 15:43,,2,82,"

I know how this can be proved using the quantum relative entropy. However, even with this proof, and am still confused about how this emerges.

+

Say I have a source that produces two states $\rho_1$ and $\rho_{2}$ with probability a half each, and both are mixed states, ie $S(\rho_i)>0$ for each of them. The dimensions of the Hilbert space is $2$.

+

How can $S(\rho)=H(p_{i})+\sum_{i}p_{i}S(\rho_{i})\le \log(d)$, given that $H(p_{i})=1$ and $S(\rho_i)>0$, given that $\log(d)=\log(2)=1?$

+

I am assuming that I am missing something obvious in the actual construction of $\rho$, in that something is bounding $H(p_{i})$ away from 1. I am assuming this has something to do with orthogonal supports, as $S(\rho) \le H(p)+\sum_{i}p_iS(\rho_{i})$ if they are not orthogonal.

+",4991,,55,,8/25/2020 14:59,8/25/2020 14:59,How is $S(\rho)=H(p_{i})+\sum_{i}p_{i}S(\rho_{i})\le \log(d)$ possible if $\rho_{i}$ are not pure states?,,1,4,,,,CC BY-SA 4.0 +13443,1,,,8/23/2020 17:18,,1,158,"

I am following this paper, and I am stuggling with a derivation.

+

Basically, I consider an orthonormal basis $\{B_i \}$ with respect to Hilbert-Schmidt scalar product, on the density matrix space $\mathcal{L}(H)$.

+

I have a noisy process: $\mathcal{E}=\mathcal{N} \circ \mathcal{U}$ which tries to implement the unitary map $\mathcal{U}$. The noise map $\mathcal{N}$ is actually defined from this last equation.

+

We can decompose those process on the basis $\{B_i\}$ which define the so-called $\chi$ matrix. We have:

+

$$ \mathcal{E}(\rho) = \sum_{ij} \chi_{\mathcal{E}}^{ij} B_i \rho B_j^{\dagger} $$ +$$ \mathcal{U}(\rho) = \sum_{ij} \chi_{\mathcal{U}}^{ij} B_i \rho B_j^{\dagger} $$ +$$ \mathcal{N}(\rho) = \sum_{ij} \chi_{\mathcal{N}}^{ij} B_i \rho B_j^{\dagger} $$

+

I am struggling to prove that the fidelity of the process which is defined as: $F(\mathcal{E},\mathcal{U})=Tr(\chi_{\mathcal{E}}\chi_{\mathcal{U}})$ verifies:

+

$$F(\mathcal{E},\mathcal{U})=F(\mathcal{N},\mathcal{I})$$

+

$\mathcal{I}$ being the identity map.

+

In the paper he work with the particular basis $\{B_i\}$ being the Pauli basis. I considered a general orthonormal basis in my derivation. I don't know if it is why I don't find the appropriate result. I would like to avoid using any external result such as the fidelity of the process is equal to the average fidelity of the output state with respect to the ideal one.

+

Is it possible to have a simple proof of that ? Does it indeed works even without considering the particular Pauli basis as the orthonormal basis ?

+

[edit]: I just realized that chi matrix associated to different basis of $\mathcal{L}(H)$ are related via unitary transformation. Thus prooving it on the Pauli basis is enough. So I just need to understand how to derive it on the Pauli basis.

+",5008,,55,,8/24/2020 9:26,8/24/2020 9:26,Why the chi-matrix fidelity of the process is the fidelity of the chi-matrix noise map,,0,1,,,,CC BY-SA 4.0 +13444,1,13451,,8/23/2020 21:09,,4,1127,"

I am trying to understand the Hadamard Test by finding the average value of $U_1$, which is a diagonal matrix with $1$ everywhere except on the first element.

+

I performed the regular Hadamard Test as presented in the wiki page:

+

+

and so far so good, everything works as it should.

+

What is the circuit variant to perform the Hadamard Test to calculate the imaginary part? The wiki page says you only have to start with $\frac{1}{\sqrt{2}}(|0\rangle-i |1\rangle)$ instead of $H|0\rangle$, I attempted doing the test adding a phase shift of -i on $|0\rangle$ by applying $U_s$ = $\begin{bmatrix}\ 1 & 0 \\ 0 & -i \end{bmatrix}$ on the control qubit after $H$, but all im getting is random measurements

+",12302,,55,,8/27/2020 0:07,8/27/2020 0:07,Hadamard Test to calculate imaginary part,,2,2,,,,CC BY-SA 4.0 +13445,1,,,8/23/2020 22:26,,1,56,"

Lets say $\rho,\sigma$ satisfy $F(\rho,\sigma)=0$, i.e., they are quantum states living on orthogonal supports. What can we say about $F(\text{Tr}_A(\rho),\text{Tr}_B(\sigma))$?

+

I am looking for upper bounds here, so we clearly know that $$F(\text{Tr}_A(\rho),\text{Tr}_B(\sigma))\geq F(\rho,\sigma)=0$$ +but this is trivial. Can we prove any upper bound? I don't mind if we also assume $\rho,\sigma$ are pure states, in which case can we give a non-trivial upper bound?

+

One example I tried was orthogonal EPR pairs which satisfied RHS=0 and LHS (i.e., after taking partial trace)=$\frac{1}{2}$. But is this the maximum one can achieve for orthogonal quantum states?

+",13042,,55,,8/27/2020 0:05,8/27/2020 0:05,"Given $\rho,\sigma$ such that $F(\rho,\sigma)=0$, what can we say about $F(\text{Tr}_A(\rho),\text{Tr}_B(\sigma))$?",,1,1,,,,CC BY-SA 4.0 +13446,2,,13445,8/23/2020 22:47,,3,,"

The Bell states are orthogonal and their partial trace is equal - the maximally mixed states - and thus indistinguishable. So yes, this is the maximum you can achieve. Another extremal example could be a tensor product $|a\rangle\otimes|b_i\rangle$ with two orthogonal states $|b_i\rangle$.

+",491,,,,,8/23/2020 22:47,,,,0,,,,CC BY-SA 4.0 +13447,2,,13444,8/24/2020 7:01,,1,,"

Here, I think you wanted this link

+
OPENQASM 2.0;
+include "qelib1.inc";
+
+qreg q[2];
+creg c[1];
+
+x q[0];
+x q[1];
+h q[0];
+s q[0];
+cu1(pi) q[0],q[1];
+h q[0];
+measure q[0] -> c[0];
+
+",13045,,13045,,8/24/2020 7:13,8/24/2020 7:13,,,,1,,,,CC BY-SA 4.0 +13448,2,,13440,8/24/2020 7:20,,1,,"

It would be better if you install Qiskit after opening anaconda and then terminal from Anaconda and use pip install qiskit. For more info visit, you can try visiting https://qiskit.org

+",13045,,,,,8/24/2020 7:20,,,,0,,,,CC BY-SA 4.0 +13449,2,,13442,8/24/2020 7:30,,3,,"

I guess you meant to consider generic (not necessarily pure) states $\rho_1,\rho_2$ rather than $|\psi\rangle\langle\psi|$ and $\lvert\phi\rangle\langle \phi\rvert$, so I'll consider the slightly modified question "how is $$S(\rho)= H(p)+\sum_i p_i S(\rho_i)\le \log d$$ possible for a state $\rho=\sum_i p_i\rho_i$ with $H(p)=\log d$?"

+

The first thing to notice is that, in general, +$S(\rho)\le H(p)+\sum_i p_i S(\rho_i)$. +This is not an identity unless $\rho_i$ have orthogonal support. +You then also have $S(\rho)\le\log d$. +From these, you cannot imply $H(p)+\sum_i p_i S(\rho_i)\le \log d$, which is indeed untrue in general, as you observed.

+

When $\rho_i$ do have orthogonal support, then $S(\rho)= H(p)+\sum_i p_i S(\rho_i)$, and therefore you must also have $H(p)+\sum_i p_i S(\rho_i)\le \log d$. +So then why don't we have a contradiction? +Well, consider the case with $H(p)=\log d$. This means that you are dealing with a state $\rho$ that is a balanced mixture of $d$ different states with orthogonal support. The only way to get $d$ states with orthogonal support in a $d$-dimensional space is that they each have unit rank, i.e. they are all pure, and thus $S(\rho_i)=0$ for all $i$.

+",55,,55,,8/25/2020 12:39,8/25/2020 12:39,,,,10,,,,CC BY-SA 4.0 +13451,2,,13444,8/24/2020 10:19,,3,,"

Here is a circuit for calcualating $Im(\langle\psi|U |\psi \rangle)$ (circuit composer from IBM):

+

+

Initial state: +$$|\Psi_0 \rangle=|0\rangle |\psi\rangle$$

+

After $S^{\dagger} H$ on the first qubit:

+

$$|\Psi_1 \rangle=\frac{1}{\sqrt{2}}(|0\rangle - i|1\rangle) |\psi\rangle$$

+

Controlled $U$

+

$$|\Psi_2 \rangle=\frac{1}{\sqrt{2}}(|0\rangle |\psi\rangle - i|1\rangle U |\psi\rangle)$$

+

After final Hadamard on the control qubit:

+

\begin{align*} +|\Psi_3 \rangle &=\frac{1}{2} \big[(|0\rangle + |1\rangle) |\psi\rangle - i(|0\rangle - |1\rangle) U |\psi\rangle \big] = +\\ +&=\frac{1}{2} \big[|0\rangle (|\psi\rangle - i U |\psi\rangle) + |1\rangle(|\psi\rangle + i U |\psi\rangle) \big] +\end{align*}

+

The probability of measuring $|0\rangle$ and the probability of measuring $|1\rangle$:

+

$$p_0 = \frac{1}{4}\big[(\langle \psi | + i \langle \psi | U^{\dagger})(|\psi\rangle - i U |\psi\rangle) \big]= \frac{1}{4}\big[2 - i \langle\psi|U|\psi\rangle + i \langle\psi|U^{\dagger}|\psi\rangle \big] +\\ +p_1 = \frac{1}{4}\big[(\langle \psi | - i \langle \psi | U^{\dagger})(|\psi\rangle + i U |\psi\rangle) \big]= \frac{1}{4}\big[2 + i \langle\psi|U|\psi\rangle - i \langle\psi|U^{\dagger}|\psi\rangle \big]$$

+

because $U^\dagger U = I$ and $\langle \psi|\psi \rangle = 1$. Calculating the expectation value of $\sigma_z$:

+

$$\langle \sigma_z \rangle = p_0 - p_1 = -i \frac{\langle\psi|U |\psi \rangle - \langle\psi| U^{\dagger} |\psi \rangle}{2} = Im(\langle\psi|U |\psi \rangle)$$

+

So the circuit works as was described in the Wikipedia page about the Hadamard test.

+",9459,,9459,,8/24/2020 10:35,8/24/2020 10:35,,,,3,,,,CC BY-SA 4.0 +13452,1,13455,,8/24/2020 10:34,,-2,270,"

I'm following the tutorial in Grover's Algorithm - Example 3 qubits

+

I'm trying to understand the amplitude amplification using the reflection. But I cannot understand if we really need the step 3d (apply X gates to the 3 qubits).

+

As described in the tutorial, the state before and after are the same (and I have checked using the 'statevector_simulator'

+

Why do we need this step?

+

This is my code (doubt in line DO WE REALLY NEED?!?)

+
def oracle(qc: QuantumCircuit, qr: QuantumRegister):
+    # Combined: Negate |101> and |110>
+    qc.cz(qr[0],qr[2]) # Negate |101> and |111>
+    qc.cz(qr[1], qr[2]) # Negate |110> and |111>
+
+    qc.barrier(qr[0]) # stetic only
+
+# Perform the reflection around the average amplitude
+def diffuser(qc: QuantumCircuit, qr: QuantumRegister):
+    # |𝜓3𝑎⟩=1/2(|000⟩+|011⟩+|100⟩−|111⟩)
+    qc.h(qr)
+    
+    # |𝜓3𝑏⟩=1/2(−|000⟩+|011⟩+|100⟩+|111⟩)
+    qc.x(qr)
+    
+    # |𝜓3𝑐⟩=1/2(−|000⟩+|011⟩+|100⟩−|111⟩)
+    # Do controlled-Z
+    qc.barrier(qr[0])
+    qc.barrier(qr[1])
+    qc.h(2)
+    qc.ccx(0,1,2)
+    qc.barrier(qr[0])
+    qc.barrier(qr[1])
+    qc.h(2)
+
+    # DO WE REALLY NEED?!?
+    # |𝜓3𝑑⟩=1/2(−|000⟩+|011⟩+|100⟩−|111⟩)
+    # qc.x(qr)
+
+    # |𝜓3𝑒⟩=1/√2(−|101⟩−|110⟩)
+    qc.h(qr)
+
+# endregion oracles/checkers
+
+
+# 3 Qubits circuit
+n = 3
+qr = QuantumRegister(n)
+qc = QuantumCircuit(qr)
+
+# for qubit in range(n):
+#     grover_circuit.h(qubit)
+# Initialize: All inputs in uniform superposition
+# |𝜓1⟩=1/√8(|000⟩+|001⟩+|010⟩+|011⟩+|100⟩+|101⟩+|110⟩+|111⟩)
+qc.h(qr)
+# Apply oracle
+# |𝜓2⟩=1/√8(|000⟩+|001⟩+|010⟩+|011⟩+|100⟩−|101⟩−|110⟩+|111⟩)
+oracle(qc, qr)
+# Apply augmentation
+diffuser(qc, qr)
+
+# Plot circuit
+qc.draw('mpl')
+plt.show()
+
+# Get state vector (simulated one run)
+backend_sv = Aer.get_backend('statevector_simulator')
+job_sv = execute(qc, backend_sv)
+statevec = job_sv.result().get_statevector()
+print('Qiskit statevector')
+for cn in statevec:
+    rcn = complex(round(cn.real, 8), round(cn.imag, 8))
+    print(f'{rcn:+.2g}')
+
+# Get unitary (simulated one run)
+backend_uni = Aer.get_backend('unitary_simulator')
+job_uni = execute(qc, backend_uni)
+unitary = job_uni.result().get_unitary()
+print('Qiskit unitary')
+print(unitary)
+
+
+# Add measure and simulate
+qc.measure_all()
+backend_sim = Aer.get_backend('qasm_simulator')
+shots = 1024
+results = execute(qc, backend=backend_sim, shots=shots).result()
+answer = results.get_counts()
+plot_histogram(answer)
+plt.show()
+
+",12893,,12893,,8/24/2020 16:22,8/24/2020 16:22,Grover's 3-qubits tutorial: Why we need the last X gates,,1,0,,,,CC BY-SA 4.0 +13453,1,13459,,8/24/2020 11:02,,3,88,"

I am asked to prove the following:

+
+

Consider the Deutsch-Jozsa circuit. The output of the circuit is of the form $|\psi\rangle \otimes \frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)$. Prove that the state$|\psi\rangle$ right before the measure is entangled if and only if it is entangled right before applying the final series of $H$ gates (Hadamard gates)

+
+

Here's my attempt.

+

Let $|\psi_m\rangle$ be the state right before the measure and $|\psi_h\rangle$ be the state right before applying the final Hadamard gates (i.e $|\psi_m\rangle = H^{\otimes n}|\psi_h\rangle$)

+

$|\psi_m\rangle$ entangled $\Rightarrow |\psi_h\rangle$ entangled :

+

Assume $|\psi_h\rangle$ is not entangled. Then $|\psi_h\rangle$ can be written as:$$|\psi_h\rangle +=|x_1\rangle \otimes...\otimes|x_n\rangle$$

+

If we now apply the $H$ gates, we get:$$H|x_1\rangle \otimes...\otimes H|x_n\rangle$$ $$=\frac{1}{2^{n/2}}\big[(|0\rangle+(-1)^{x_1}|1\rangle) \otimes ... \otimes (|0\rangle+(-1)^{x_n}|1\rangle) \big] $$

+

Unless there's something I misunderstood or miscalculated, I do not see how this could be not entangled.

+

Could you please help me out there, please?

+

Also, I have no idea how to prove the if-part.

+",9407,,55,,8/27/2020 0:03,8/27/2020 0:03,Prove entanglement in the final state of the Deutsch-Jozsa circuit,,1,0,,,,CC BY-SA 4.0 +13454,1,,,8/24/2020 12:31,,2,42,"

The quantum computing text books and theory in general seems to have added an asymmetry in the distribution of change in phase across the components in the context of a qubit. Is there any reason for this? I know that global phase can be ignored and it allows us to assign all change to only one component. But I have observed that the impact would be different in multi-qubit contexts. For example, a controlled phase rotation between two qubits would no longer be symmetrical, if the phase distribution is symmetrical, in contradiction to what the textbook and many algorithms consider.

+

Is this asymmetry introduced due to any physics/hardware related problem which forbids distributing the phase change equally? Or is it only a software trick to reduce the operations (one instead of two with half change)?

+

I'm generally concerned about any loss of symmetry in such a beautiful and natural science. I don't think the nature itself pushes any changes entirely to one component. If it is a reference frame issue (we want to align our reference frame with one of the component for our convenience), then I'm afraid that this reference frame needs to a global one (single one for all qubits), but I see that this reference frame is local to each qubit, which appears quite artificial to me.

+",13012,,55,,8/25/2020 19:31,9/25/2020 8:01,Asymmetry in distributing phase change across components,,1,3,,,,CC BY-SA 4.0 +13455,2,,13452,8/24/2020 12:40,,2,,"

In this specific case it appears that you do not need the X-gates, however the diffuser is supposed to be general and removing the X-gates gives incorrect results for other oracles. Take an oracle that marks the state $|101\rangle$:

+
def oracle(qc: QuantumCircuit, qr: QuantumRegister):
+    # Negate |101>
+    qc.h(2)
+    qc.x(1)
+    qc.ccx(0,1,2)
+    qc.h(2)
+    qc.x(1)
+
+

Two Grover iterations should give you a 94.5% chance of measuring $|101\rangle$, but if you comment out the qc.x(qr) line you won't see this.

+

Explanation:

+

To perform Grover's algorithm, we need the diffuser to do a reflection around $|s\rangle$. It is obvious how we can do a reflection around $|111\dots1\rangle$: a multiple controlled-Z gate ($MCZ$). To achieve a reflection around the state $|s\rangle$, we wrap this gate in the transformations $|s\rangle \rightarrow |111\dots1\rangle$ and $|111\dots1\rangle \rightarrow |s\rangle$, i.e

+

$$U_s = H^{\otimes n}X^{\otimes n}(MCZ) X^{\otimes n}H^{\otimes n}$$

+

If you remove the X-gates, you no longer have $U_s$, and instead something else that may work in specific cases but is not guaranteed to work generally.

+",10415,,,,,8/24/2020 12:40,,,,2,,,,CC BY-SA 4.0 +13456,1,,,8/24/2020 13:15,,2,110,"

In some quantum algorithms, the output of the quanutm circuit is probabilistic. For example. the measurement outcome (once) for a specific qubit "0" indicates success, which means that the resulting state is what we desired. Therefore, we can first measure that special qubit for once, if the outcome is "0", then we measure the rest, othervise, we will not record this time. Can this be done in Qiskit?

+

I tried to solve this in another way. I don't care the qubit, after the measurement is finished, the indicater and the working system will be a joint state $\rho_{is}$, where i and s represents the indicater and system. Then we can project this state as: +$$\rho_s=P\rho_{is}P^{\dagger}$$ +with $P=|0\rangle \langle 0|\otimes I_s$ the projector operator. But when I put this into a function called "state_fidelity" with one other density matrix, it is error with information that the input is not a valid. Is there any points that I was wrong?

+

Thanks for help!

+",6128,,55,,8/27/2020 0:09,8/27/2020 0:09,Can we measure the quantum circuit sequently when using Qiskit?,,1,0,,,,CC BY-SA 4.0 +13457,2,,13433,8/24/2020 14:16,,1,,"

Did you try to put a barrier between your two blocks? You can do this by writing this qp.barrier() right after your first block, then Qiskit will transpile separately the two blocks. Is this what you were searching for?

+",12396,,,,,8/24/2020 14:16,,,,2,,,,CC BY-SA 4.0 +13458,2,,13456,8/24/2020 15:02,,2,,"

I believe you have a function that allows you to do that, check this documentation to see how this works exactly.

+

If you want to see an example on how to use it, you can check the step 4 of the second part of this tutorial of Qiskit, the quantum teleportation, where they apply gates regarding the measured values.

+

Hope this works! :)

+",12396,,,,,8/24/2020 15:02,,,,1,,,,CC BY-SA 4.0 +13459,2,,13453,8/24/2020 16:19,,2,,"

Suppose we have two n-qubits states such that $H^{\otimes n}|\psi\rangle = |\varphi\rangle$. Then you have the following (remember that H is reversible meaning we can go from the first to the second line) :

+

\begin{align*} +|\psi\rangle \text{ is separable iff }& \exists (|\psi_i\rangle)_{i \in [\![1,n]\!]} \text{ such that } |\psi\rangle = |\psi_1\rangle \otimes ... \otimes |\psi_n\rangle \\ +\text{iff } & \exists (|\psi_i\rangle)_{i \in [\![1,n]\!]} \text{ such that } \underbrace{H^{\otimes n} |\psi\rangle}_{= |\varphi\rangle} = \underbrace{(H|\psi_1\rangle)}_{= |\varphi_1\rangle} \otimes ... \otimes \underbrace{(H|\psi_n\rangle)}_{= |\varphi_n\rangle} \\ +\text{iff } & \exists (|\varphi_i\rangle)_{i \in [\![1,n]\!]} \text{ such that } |\varphi\rangle = |\varphi_1\rangle \otimes ... \otimes |\varphi_n\rangle \\ +\text{iff }& |\varphi\rangle \text{ is separable} +\end{align*}

+

More generally, I would say that if you have a separable state, if you apply any reversible 1-qubit gate then it stays separable.

+

By the way, the last state you wrote is indeed separable, notice you were able to factorize it (i.e. write it with tensor products), and you also forgot the $1/\sqrt{2}$ factor for each $H$ you apply, meaning the state should have a total factor of $1/2^n$.

+",12396,,,,,8/24/2020 16:19,,,,0,,,,CC BY-SA 4.0 +13460,2,,13347,8/24/2020 16:41,,10,,"

I don't know if the MIP* = RE result, and in particular the claim that there exists a nonlocal game $G$ where $\omega^*(G) \neq \omega^{co}(G)$, has any algorithmic implications for quantum computers. There's a couple things to say here.

+

The MIP* = RE result is about what computational problems can be verified using nonlocal games, as opposed to what can be solved by nonlocal games (I'm not sure what that would mean, anyhow!). The distinction between verifying and solving is because of the following: in a nonlocal game, we assume that Alice and Bob magically know the answer to the problem (so we assume they can solve any computational problem instantly). Their challenge is not to solve it, but to prove to a polynomial-time classical verifier they know the answer. Just knowing the answer to something doesn't mean that you're able to convince someone else of the answer. Whether Alice and Bob can use correlations from the tensor product framework or the commuting operator framework affects what they're able to prove to the verifier. MIP* = RE shows that, with tensor product correlations, Alice and Bob can prove that they know a Turing Machine eventually halts. This is something that cannot be done if Alice and Bob share commuting operator correlations; therefore commuting operator model differs from the tensor product model.

+

The second thing I wanted to mention is, separately, it is an interesting question whether one can define a model of quantum computation that talks about commuting operators and infinite dimensional systems. It appears that Cleve, et al has tried to come up with a model for this, something they call the C*-circuit model: https://arxiv.org/pdf/1811.12575.pdf. You might find this interesting.

+",13048,,,,,8/24/2020 16:41,,,,0,,,,CC BY-SA 4.0 +13461,2,,13348,8/24/2020 20:48,,4,,"

Filling out a number of details for the sake of a complete answer —

+

Starting from the linked article, Distance measures to compare real and ideal quantum processes [arXiv:quant-ph/0408063], the definition of fidelity is given in Eqn. (4) as +$$ F(\rho,\sigma) = \mathrm{tr}\Bigl( \!\sqrt{\sqrt{\rho} \!\phantom|\sigma \phantom|\!\!\sqrt{\rho}\phantom|}\Bigr)^2$$ +— which might look a bit intimidating, but demonstrates two important things about fidelity: that it is defined in general on density operators (not just state vectors), and that it is always a non-negative real number. If you want to compute it for pure states, the definition above ends up being equivalent to +$$ F(\lvert \psi\rangle\! \langle \psi\rvert,\lvert \phi\rangle\! \langle \phi\rvert) = \langle\psi\vert \phi\rangle\! \langle\phi\vert \psi\rangle = \bigl\lvert \langle\psi\vert \phi\rangle \bigr\rvert^2$$ +which is always a non-negative real, and in particular, which does not depend on any global phases that you might consider for either the state $\lvert \psi \rangle$ or $\lvert \phi \rangle$ (which is not physical information about the state).

+

The Bures metric (from the second column of page 4) is then +$$ +B(\rho,\sigma) = \sqrt{2 - 2\sqrt{F(\rho,\sigma)}} $$ +which for pure states simplifies to +$$\begin{aligned} B(\lvert \psi\rangle\! \langle \psi\rvert,\lvert \phi\rangle\! \langle \phi\rvert) &= \sqrt{2 - 2\sqrt{F(\lvert \psi\rangle\! \langle \psi\rvert,\lvert \phi\rangle\! \langle \phi\rvert)}} \\&= \sqrt{2 - 2\bigl\lvert \langle\psi\vert \phi\rangle \bigr\rvert} \\&= \sqrt{2 - 2 \max \langle\psi'\vert \phi'\rangle},\end{aligned} $$ +where the maximum is taken over unit vectors $\lvert \psi'\rangle \propto \lvert \psi\rangle$ and $\lvert \phi'\rangle \propto \lvert \phi\rangle$.

+

You ask (not unreasonably) why, for pure states, you would take the absolute value $\lvert \langle \psi \vert \phi \rangle \rvert$, instead of the real part $\mathrm{Re}\,\langle \psi \vert \phi \rangle$ as you would if you were dealing directly with the inner products of vectors $\lvert \psi \rangle$ and $\lvert \phi \rangle$. The answer is that, because we are interested in the states and not actually in particular vectors which represent those states, working directly with the state vectors won't necessarily provide a sensible answer. For a state $\lvert \phi' \rangle \propto \lvert \phi \rangle$, the values of $\mathrm{Re}\,\langle \psi \vert \phi \rangle$ and $\mathrm{Re}\,\langle \psi \vert \phi' \rangle$ usually won't be the same — but whether we use $\lvert \phi' \rangle$ or $\lvert \phi \rangle$ to represent the state should be a purely arbitrary choice with no impact either on the physics or on our the analysis of the physics. Any choice of formula should be stable under such arbitrary choices, and furthermore (for a metric) should yield the value $0$ if we were to consider different ways $\lvert \phi' \rangle$ and $\lvert \phi \rangle$ to represent the same state.

+

Bear in mind that, at the end of the day, their remark about simplifying to the Euclidean metric is likely to have been a quick attempt to provide intuition, rather than a serious attempt to provide a formal statement. However, there is a sense in which taking the absolute value (or if you prefer, the maximum inner product among equivalent states up to global phases) is the correct approach to considering the connection to the "Euclidean distance" between "states", and I expect that this is what they have in mind.

+",124,,124,,8/25/2020 10:26,8/25/2020 10:26,,,,3,,,,CC BY-SA 4.0 +13462,2,,9786,8/25/2020 1:52,,5,,"

There are a number of equivalent formulations to CEP. One of them is Tsirelson's problem from quantum information theory, which asks whether the infinite dimensional commuting operator correlations can be approximated arbitrarily well by finite dimensional quantum correlations. This was shown in a combination of papers by Junge, et al (https://arxiv.org/pdf/1008.1142.pdf), Fritz (https://arxiv.org/pdf/1008.1168.pdf), and Ozawa (https://arxiv.org/pdf/1211.2712.pdf).

+

However, this equivalence takes a lot of work; in particular, it requires going through Kirchberg's QWEP problem, which is an equivalent problem to CEP but in the language of C* algebras.

+

If you're looking for a computability-theoretic formulation of Connes' Embedding Conjecture, then there is one due to Goldbring and Hart (https://arxiv.org/pdf/1308.2638.pdf), which says that if CEP has a positive answer, then the "universal theory of type II von Neumann algebras" is decidable. This essentially means that one can write a computer algorithm to decide whether logical sentences about type II von Neumann algebras are true (within a suitably defined logic system). I'm not sure if this can be phrased as an algorithmic word problem.

+

Here's yet another formulation of CEP that I like, which I find rather concrete:

+

The Connes Embedding Conjecture posits that for every tracial von Neumann algebra $(M,\tau)$, for every finite subset $\{x_1,\ldots,x_n\}$ of self-adjoint elements from $M$, one can approximate them using finite-dimensional matrices in the following way: for every $\epsilon > 0$ and every integer $N \geq 1$, there exists a dimension $d$ and $d \times d$ matrices $A_1,\ldots,A_n$ such that for every word $i \in \{1,\ldots,n\}^N$, we have the following approximation: +$$ +\Big | \tau(x_{i_1} x_{i_2} \cdots x_{i_N}) - \frac{1}{d} \mathrm{tr}(A_{i_1} \cdots A_{i_N})\Big|\leq \epsilon. +$$

+

If you don't know what a von Neumann algebra is, don't worry -- me neither. But the point is that CEC is positing that these complicated infinite dimensional objects can always be modelled by finite dimensional matrices (so long as we're looking at finite subsets of the von Neumann algebra).

+

Hope this helps.

+",13048,,,,,8/25/2020 1:52,,,,0,,,,CC BY-SA 4.0 +13464,2,,13435,8/25/2020 7:15,,1,,"

To clear up my own confusion, these DFSs exist for the channel that maps $|0\rangle$ to $|0\rangle$ and $|1\rangle$ to $e^{j\phi}|1\rangle$. This is not the channel discussed in the question.

+",12047,,,,,8/25/2020 7:15,,,,0,,,,CC BY-SA 4.0 +13465,1,13466,,8/25/2020 8:18,,1,36,"

$\def\ket#1{|#1\rangle} +\def\bra#1{\langle#1|} +\def\mt#1{\mathrm{#1}} +\def\E{\mathcal E} +\def\F{\mathcal F}$ +Let $\ket\phi$ and $\ket\psi$ be pure states on the same quantum system, so that $\ket\psi=\mt U\ket\phi$ for some unitary $\mt U$. +Say we have a quantum operation (CPTP map) $\E$, and write $\sigma_\phi=\E(\ket\phi\bra\phi)$, $\sigma_\psi=\E(\ket\psi\bra\psi)$.

+

Question: given that $\ket\psi$ and $\ket\phi$ are related by a unitary $\mt U$, are $\sigma_\psi$ and $\sigma_\phi$ related by a quantum operation? I.e. does there exist a quantum operation $\F$ such that $\sigma_\psi=\F(\sigma_\phi)$ (or the other way around)?

+

My feeling says this has to be true, but I'm struggling to prove it.

+",2687,,,,,8/25/2020 9:56,Are two outputs of a quantum operation (CPTP map) themselves related by a quantum operation?,,1,0,,,,CC BY-SA 4.0 +13466,2,,13465,8/25/2020 9:56,,2,,"

Two states are always related by a CPTP map, regardless where they come from.

+

Just take e.g. $$\mathcal F(\rho) =\mathrm{tr}(\rho) \, \sigma_\psi\ . $$

+",491,,,,,8/25/2020 9:56,,,,2,,,,CC BY-SA 4.0 +13467,1,,,8/25/2020 11:46,,-1,48,"

I needed help with CIRQ coding as I'm quite new to Quantum Computing. +I read the tutorials on CIRQ but don't really understand it. +I'd be very thankful if someone could help.

+

A program to create the state using CIRQ coding.

+ +

A program to create the state $\frac{1}{\sqrt 2}(|00\rangle+|11\rangle)$.

+",12913,,27,,8/27/2020 8:15,8/27/2020 8:15,Create this state using CIRQ Coding language,,1,1,,9/11/2020 8:34,,CC BY-SA 4.0 +13468,2,,13467,8/25/2020 15:21,,3,,"

The state you want to create is called a Bell State. Creating it can be accomplished by a Hadamard gate followed by a CNOT gate . In Cirq this will be

+
q0 = cirq.GridQubit(0, 0)
+q1 = cirq.GridQubit(0, 1)
+
+circuit = cirq.Circuit(
+    cirq.H(q0),
+    cirq.CNOT(q0, q1)
+    
+)
+
+

Printing the circuit show's that this is indeed the case.

+
print(circuit)
+
+# Circuit:
+# (0, 0): ───H───@───
+#                │
+# (0, 1): ───────X───
+
+
+",362,,,,,8/25/2020 15:21,,,,0,,,,CC BY-SA 4.0 +13469,1,,,8/25/2020 20:35,,1,197,"

I am attempting to use a VQE algorithm to find the ground state of a deuterium nucleus by applying a constructed hamiltonian to an ansatz state with one parameter created by a circuit. While I am getting a different expectation value for different parameters, it does not line up with what I am supposed to get (from the paper I am attempting to replicate). I think the basis is wrong. How should I change the basis to fit the hamiltonian I am using? Should I change the basis of the hamiltonian (which I got from tensor products of pauli operators)? Or should I change the basis of the ansatz itself to fit that of the hamiltonian?

+

PS: https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.120.210501 this is the paper whose results I am trying to replicate (The H2 graph to be specific). They are using ↑ and ↓ as their basis while I am still on qiskit's default 0 and 1

+",13056,,,,,8/25/2020 20:35,Changing the Basis,,0,3,,,,CC BY-SA 4.0 +13471,2,,13454,8/26/2020 7:32,,1,,"

If I understand your question correctly, you're asking why we choose to write phase gates like +$$ +\left(\begin{array}{cc} 1 & 0 \\ 0 & e^{i\phi} \end{array}\right) +$$ +rather than +$$ +\left(\begin{array}{cc} e^{-i\phi/2} & 0 \\ 0 & e^{i\phi/2} \end{array}\right). +$$ +As you rightly state, these are entirely equivalent due the the global phase, but controlled-versions of the gate are not. (Although the mapping is easily made by applying a phase gate on the control qubit.)

+

I am not aware of a specific reason why we choose the one convention over the other. It's certainly not a restriction of the hardware. My personal opinion is that we find it easier to think about the action of controlled gates as they're specified, and that helps us formulate our algorithms (we're used to thinking about a controlled-not gate for example). On the other hand, I think that if there were a clear winner in terms of the technology to use for implementing a quantum computer, and if that naturally built the symmetrised version of gates, we'd probably switch to using that formulation pretty quickly!

+

One might also argue that there's a far more fundamental break in the symmetry when you're considering two-qubit gates anyway. On the control qubit, there is a far more drastic distinction between $|0\rangle$ and $|1\rangle$. You might argue that we should be symmetrising that instead but, again, we'd find it much harder to think about and manipulate.

+",1837,,,,,8/26/2020 7:32,,,,0,,,,CC BY-SA 4.0 +13472,1,,,8/26/2020 11:57,,4,964,"

In Qiskit we can't use noise models in the 'state vector_simulator' or the 'unitary simulator', hence making it impossible to compute fidelity of the output of the noisy circuit and the noiseless circuit. We can, of course, do a noisy simulation using the qasm simulator but it gives us the probability distribution instead of a state vector/density matrix. How do we compare the fidelity in this case? +Or is there any other way to do it?

+",13060,,55,,8/27/2020 12:43,12/26/2022 13:28,Is there any way we get the state vector/density matrix of a noisy simulation in qiskit?,,1,0,,,,CC BY-SA 4.0 +13473,2,,13472,8/26/2020 12:32,,2,,"

I think you can use noise in the statevector simulator.

+

If nevertheless you want to use the qasm simulator, you can use snapshots: https://qiskit.org/documentation/apidoc/aer_extensions.html. Although in the lack of notebooks it's a little tricky to understand how to use. You can see examples here for how to insert a snapshot in a circuit: https://github.com/Qiskit/qiskit-aer/blob/master/test/terra/reference/ref_snapshot_state.py. Then another example here for how to read the snapshot result: https://github.com/Qiskit/qiskit-aer/blob/master/test/terra/backends/qasm_simulator/qasm_snapshot.py

+

If you apply the snapshot on a subset of the qubits, be aware that the qubit ordering may be confusing.

+",7659,,55,,12/26/2022 13:28,12/26/2022 13:28,,,,3,,,,CC BY-SA 4.0 +13474,1,13475,,8/26/2020 14:12,,2,172,"

I got a problem in understanding the proof of the Theorem 2.6 (Unitary freedom in the ensenble for density matrices), 2.168 and 2.169 in the Nielsen and Chuang book

+

Equation 2.168

+

Suppose $|{\tilde\psi_i}\rangle = \sum_j{u_{ij}|{\tilde\varphi_j}\rangle}$ for some unitary $u_{ij}$. Then +$\sum_i{|{\tilde\psi_i}\rangle\langle\tilde\psi_i|} = \sum_{ijk}{u_{ij}u_{ik}^*|\tilde\varphi_j\rangle\langle\tilde\varphi_j|}$ (2.168)

+

I don't get this step. If I take $\langle\tilde\psi_i|=(|\tilde\psi_i\rangle)^\dagger=\sum_j(u_{ij}|\tilde\varphi_j\rangle)^\dagger=\sum_j{\langle\tilde\varphi_j|u_{ij}^\dagger}$ and substitute this in the outer product I receive $\sum_i{|{\tilde\psi_i}\rangle\langle\tilde\psi_i|} = \sum_{ijk}{u_{ij}|\tilde\varphi_j\rangle\langle\tilde\varphi_j|u_{ik}^\dagger}$
+Can someone explain this to me please?

+

Equation 2.169 -> 2.170 +$$\sum_{jk}{(\sum_i{u_{ki}^\dagger u_{ij})}|\tilde\varphi_j\rangle\langle\tilde\varphi_k|} = \sum_{jk}{\delta_{kj}|\tilde\varphi_j\rangle\langle\tilde\varphi_k|}$$ +I can't understand why $(\sum_i{u_{ki}^\dagger u_{ij}}) = \delta_{kj}$.
I understand that $u_{ki}^\dagger u_{ij} = I$ for $k=j$, but why is it zero otherwise?

+

It would be so kind if someone could enlighten me.

+",11909,,55,,8/26/2020 23:55,8/26/2020 23:55,Nielsen & Chuang Theorem 2.6 Proof,,1,2,,,,CC BY-SA 4.0 +13475,2,,13474,8/26/2020 14:30,,4,,"

Let $U$ be a unitary matrix. By definition $U^\dagger U=I$. So, if I take an off-diagonal element, this corresponds to ($j\neq k$) +$$ +(U^\dagger U)_{j,k}=I_{j,k}=0, +$$ +and of course +$$ +(U^\dagger U)_{j,k}=\sum_iu_{ji}^\star u_{ik}. +$$

+",1837,,,,,8/26/2020 14:30,,,,9,,,,CC BY-SA 4.0 +13476,2,,9534,8/26/2020 15:49,,0,,"

As narrowed down in the comments, the focus of my answer is on the process of encoding an arbitrary state, so that when an error occurs it may be corrected. (Source for the diagrams / info)

+

My understanding is that the Hamming parity check matrix is used to determine the encoding unitary. Consider the [[7, 1, 3]] Steane code, which has the following parity matrix:

+

+

And the associated circuit:

+

+

So, the first three qubits correspond with the first three columns of the parity check matrix. This enables us to yield a superposition where the first three qubits range from 0-3, and the last four qubits have maintained their parity.

+

One open question for me remains, namely in the necessity for the repetition code to begin with. Answers/edits on this front appreciated!

+",8343,,,,,8/26/2020 15:49,,,,5,,,,CC BY-SA 4.0 +13477,1,,,8/26/2020 17:10,,1,540,"

I am attempting to run a VQE calculation on the 'ibmq_qasm_simulator'. The job is failing with a series of errors caused by:

+
qiskit.providers.ibmq.job.exceptions.IBMQJobApiError: "Unable to retrieve result for job 5f46829baa801d001a09d0d7: '404 Client Error: Not Found for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs/5f46829baa801d001a09d0d7/resultDownloadUrl. Cannot get presigned download url., Error code: 3202.'"
+
+

I have used the same code on the statevector simulator successfully. I have copied the full error message below:

+
FAILURE: Can not get job id, Resubmit the qobj to get job id. Terra job error: 'Error submitting job: \'(\\\'Connection aborted.\\\', OSError("(110, \\\'ETIMEDOUT\\\')"))\'' 
+Traceback (most recent call last):
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/session.py", line 250, in request
+    response.raise_for_status()
+  File "/opt/conda/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
+    raise HTTPError(http_error_msg, response=self)
+requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs/5f46829baa801d001a09d0d7/resultDownloadUrl
+
+The above exception was the direct cause of the following exception:
+
+Traceback (most recent call last):
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/job/ibmqjob.py", line 856, in _retrieve_result
+    result_response = self._api.job_result(self.job_id(), self._use_object_storage)
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/clients/account.py", line 243, in job_result
+    return self._job_result_object_storage(job_id)
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/clients/account.py", line 263, in _job_result_object_storage
+    download_url = job_api.result_url()['url']
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/rest/job.py", line 147, in result_url
+    return self.session.get(url).json()
+  File "/opt/conda/lib/python3.7/site-packages/requests/sessions.py", line 546, in get
+    return self.request('GET', url, **kwargs)
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/api/session.py", line 270, in request
+    raise RequestsApiError(message) from ex
+qiskit.providers.ibmq.api.exceptions.RequestsApiError: '404 Client Error: Not Found for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs/5f46829baa801d001a09d0d7/resultDownloadUrl. Cannot get presigned download url., Error code: 3202.'
+
+The above exception was the direct cause of the following exception:
+
+Traceback (most recent call last):
+  File "OH-_iqs_length.py", line 90, in <module>
+    ret = vqe.run(quantum_instance)
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/quantum_algorithm.py", line 70, in run
+    return self._run()
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py", line 362, in _run
+    optimizer=self.optimizer)
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/vq_algorithm.py", line 201, in find_minimum
+    gradient_function=gradient_fn)
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/aqua/components/optimizers/slsqp.py", line 87, in optimize
+    options=self._options)
+  File "/opt/conda/lib/python3.7/site-packages/scipy/optimize/_minimize.py", line 618, in minimize
+    constraints, callback=callback, **options)
+  File "/opt/conda/lib/python3.7/site-packages/scipy/optimize/slsqp.py", line 423, in _minimize_slsqp
+    g = append(fprime(x), 0.0)
+  File "/opt/conda/lib/python3.7/site-packages/scipy/optimize/optimize.py", line 327, in function_wrapper
+    return function(*(wrapper_args + args))
+  File "/opt/conda/lib/python3.7/site-packages/scipy/optimize/slsqp.py", line 63, in approx_jacobian
+    jac[i] = (func(*((x0+dx,)+args)) - f0)/epsilon
+  File "/opt/conda/lib/python3.7/site-packages/scipy/optimize/optimize.py", line 327, in function_wrapper
+    return function(*(wrapper_args + args))
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py", line 450, in _energy_evaluation
+    sampled_expect_op = self._circuit_sampler.convert(self._expect_op, params=param_bindings)
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/aqua/operators/converters/circuit_sampler.py", line 194, in convert
+    param_bindings=param_bindings)
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/aqua/operators/converters/circuit_sampler.py", line 272, in sample_circuits
+    had_transpiled=self._transpile_before_bind)
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/aqua/quantum_instance.py", line 374, in execute
+    self._skip_qobj_validation, self._job_callback)
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/aqua/utils/run_circuits.py", line 302, in run_qobj
+    results.append(job.result(**qjob_config))
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/job/ibmqjob.py", line 276, in result
+    return self._retrieve_result(refresh=refresh)
+  File "/opt/conda/lib/python3.7/site-packages/qiskit/providers/ibmq/job/ibmqjob.py", line 869, in _retrieve_result
+    'job {}: {}'.format(self.job_id(), str(err))) from err
+qiskit.providers.ibmq.job.exceptions.IBMQJobApiError: "Unable to retrieve result for job 5f46829baa801d001a09d0d7: '404 Client Error: Not Found for url: https://api.quantum-computing.ibm.com/api/Network/ibm-q/Groups/open/Projects/main/Jobs/5f46829baa801d001a09d0d7/resultDownloadUrl. Cannot get presigned download url., Error code: 3202.'"
+
+

How can i do about fixing this? Any help would be greatly appreciated!

+",12714,,55,,8/30/2020 21:01,1/18/2023 3:08,Unable to retrieve result for Job Error during VQE simulation,,1,0,,,,CC BY-SA 4.0 +13478,2,,6987,8/26/2020 17:45,,7,,"

I'm not sure if the 286 qubit estimate has ever been fully explained, but we can backwards reason about how to get to the figure.

+

First off, accuracy of quantum chemistry simulations via Trotterization is a function of the basis set (in both classical and quantum simulations). The basis set is kinda like a coordinatization the electron orbitals. There are a lot of different types of basis sets, like sto-ng or coupled cluster bases, each with varying performance.

+

Sto-ng is the minimal basis set, which requires the fewest number of qubits / classical simulation time at the cost of accuracy. For this, each typical electron orbital is assigned a qubit. So, doing a quick calculation (with orbitals pulled from here):

+
    +
  • Carbon: 4 orbitals, 16 atoms
  • +
  • Hydrogen: 1 orbital, 18 atoms
  • +
  • Nitrogen: 5 orbitals, 2 atoms
  • +
  • Oxygen: 5 orbitals, 4 atoms
  • +
  • Sulfur: 9 orbitals, 1 atom
  • +
+

In total, this adds up to 64 + 18 + 10 + 20 + 9 = 121 orbitals. Now, we also need to account for spin up/spin down orbitals, so that's at least 242 electrons, for our least accurate simulations.

+

It's likely that the estimate of 286 is a coupled cluster estimate or sto-ng estimate with additional orbitals thrown in (for example, we might also want to simulate the possibility that electrons become excited beyond the valence orbitals).

+

As for the classical estimate, the comment by Mark S is entirely right: on a classical computer, we'd need to store the potential combinations where the electrons sit. In a naive computation, this is simply $ 2^n $ where $n$ is the number of spin-orbitals. There are some optimizations that can be made to reduce this cost, but this exponential scaling is what really prevents ab initio techniques from being applied more widely (think: an extra electron will double the storage cost of your computation... yikes!!)

+",8343,,,,,8/26/2020 17:45,,,,6,,,,CC BY-SA 4.0 +13479,2,,13477,8/26/2020 18:00,,0,,"

While it's not always helpful, you can find solutions for most error codes here: https://quantum-computing.ibm.com/docs/manage/errors

+

In your case since you're running with Qiskit Aqua, it automatically re-submitted the job, as indicated by

+
FAILURE: Can not get job id, Resubmit the qobj to get job id.
+
+

So your VQE calculation should resume once the new job finishes.

+",12195,,,,,8/26/2020 18:00,,,,0,,,,CC BY-SA 4.0 +13480,1,,,8/26/2020 19:11,,2,170,"

Can anyone explain how Qiskit does the merging of single-qubit gates for the purpose of optimization?

+
    +
  1. u1(lambda1) * u1(lambda2) = u1(lambda1 + lambda2)

    +
  2. +
  3. u1(lambda1) * u2(phi2, lambda2) = u2(phi2 + lambda1, lambda2)

    +
  4. +
  5. u2(phi1, lambda1) * u1(lambda2) = u2(phi1, lambda1 + lambda2)

    +
  6. +
  7. u1(lambda1) * u3(theta2, phi2, lambda2) = u3(theta2, phi2 + lambda1, lambda2)

    +
  8. +
  9. u3(theta1, phi1, lambda1) * u1(lambda2) = u3(theta1, phi1, lambda1 + lambda2)

    +
  10. +
  11. Using Ry(pi/2).Rz(2lambda).Ry(pi/2) = Rz(pi/2).Ry(pi 2lambda).Rz(pi/2),

    +
  12. +
  13. u2(phi1, lambda1) * u2(phi2,lambda2) = u3(pi - lambda1 - phi2, phi1 + pi/2, lambda2 + pi/2)

    +
  14. +
  15. For composing u3's or u2's with u3's,u2(phi,lambda) = u3(pi/2, phi, lambda)

    +
  16. +
+

How do they come up with these equations? Is there a property to derive them?

+",9778,,55,,8/27/2020 13:11,9/26/2020 14:05,"Optimize chains of single-qubit u1, u2, u3 gates by combining them into a single gate in Qikist",,1,1,,,,CC BY-SA 4.0 +13481,1,13486,,8/26/2020 20:50,,2,129,"

Is it possible to solve the following kind of optimization using Quantum Computing?

+
Minimize
+5*x1 - 7*x2
+
+binary
+x1
+x2
+
+

If yes, is it possible to have a sample code using QISKit?

+",2884,,55,,8/30/2020 21:01,8/30/2020 21:01,Optimization using Quantum Logics,,1,2,,,,CC BY-SA 4.0 +13482,1,,,8/27/2020 2:30,,1,72,"
+

A qubit is a quantum system in which the Boolean states 0 and 1 are +rep- resented by a prescribed pair of normalised and mutually +orthogonal quantum states labeled as ${|0⟩, |1⟩}$

+
+

According to [1]. Then a quantum register $\mid x_1x_2...x_n\rangle, x_i\in\{0,1\}$ is defined to be collection of n qubits.

+

Now I often see expressions like $\mid x_1, ... x_n \rangle$ where the $x_i$ belong to some $S \subset \mathbf{Z}$.

+
    +
  1. Can the individual constituents $\mid x_i \rangle$ be called qubits even though they are non-binary?
  2. +
  3. Would it be appropriate to call $\mid x_1, ... x_n \rangle$ a qubit register in this case?
  4. +
  5. What is the physical interpretation of such a register?
  6. +
+",5710,,55,,8/31/2020 7:16,8/31/2020 7:16,"In $|x_1,...,x_n\rangle$, can the individual constituents be called qubits?",,1,3,,,,CC BY-SA 4.0 +13483,1,13484,,8/27/2020 3:14,,2,152,"

I was trying to build the Toffoli gate using the following diagram (found in the qiskit textbook): +

+

So, I set V := Rx(pi/2) (as shown in the following diagram) (Note: that I am switching now to the little-endian format) +

+

However, the unitary matrix equivalent to the previous was

+

$$ +\begin{pmatrix} +1 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ +0 & 1 & 0 & 0 & 0 & 0 & 0 & 0\\ +0 & 0 & 1 & 0 & 0 & 0 & 0 & 0\\ +0 & 0 & 0 & 1 & 0 & 0 & 0 & 0\\ +0 & 0 & 0 & 0 & 1 & 0 & 0 & 0\\ +0 & 0 & 0 & 0 & 0 & 1 & 0 & 0\\ +0 & 0 & 0 & 0 & 0 & 0 & 0 & -i\\ +0 & 0 & 0 & 0 & 0 & 0 & -i & 0\\ +\end{pmatrix} +$$

+

That will lead to a relative phase of $(-i)$ in the states $\lvert 110 \rangle$ and $\lvert 111 \rangle$

+

What is the reason for that?

+",12998,,,,,8/27/2020 4:07,Unexpected Relative Phase while making the Toffoli Gate,,1,0,,,,CC BY-SA 4.0 +13484,2,,13483,8/27/2020 4:07,,2,,"

$R_x(\pi/2)$ isn't a square root of the X gate. If you square it, you get $-iX$ instead of $X$. That's where the phase is coming from.

+",119,,,,,8/27/2020 4:07,,,,0,,,,CC BY-SA 4.0 +13485,2,,13480,8/27/2020 7:13,,1,,"

As pointed by DaftWullie, you can verify these formulas direcly by substituing parameters and multiplying matrices describing the gates. Also you can use very useful formula valid for any rotation around an axis $a$ for angles $\alpha$ and $\beta$: +$$ +R_a(\alpha)R_a(\beta) = R_a(\alpha+\beta). +$$

+

This can be used in the first identity for example, since $U1$ is in fact z-rotation (up to global phase).

+",9006,,,,,8/27/2020 7:13,,,,0,,,,CC BY-SA 4.0 +13486,2,,13481,8/27/2020 7:14,,3,,"

Qiskit has an optimization module and you can find tutorials that illustrate its functionality here.

+

To solve the example you posted, e.g., with the Quantum Approximate Optimization Algorithm (QAOA), you can do the following:

+
from qiskit import Aer
+from qiskit.optimization import QuadraticProgram
+from qiskit.aqua.algorithms import QAOA
+from qiskit.optimization.algorithms import MinimumEigenOptimizer
+
+# construct optimization problem
+qp = QuadraticProgram()
+qp.binary_var('x1')
+qp.binary_var('x2')
+qp.minimize(linear=[5, -7])
+
+# initialize optimizer
+qaoa_mes = QAOA(quantum_instance=Aer.get_backend('statevector_simulator'))
+qaoa = MinimumEigenOptimizer(qaoa_mes)
+
+# solve problem
+result = qaoa.solve(qp)
+print(result)
+
+

which prints:

+
optimal function value: -7.0
+optimal value: [0. 1.]
+status: SUCCESS
+
+

Qiskit's optimization module also provides other quantum optimization algorithms for quadratic programs and you can find a more detailed description here.

+",10429,,,,,8/27/2020 7:14,,,,0,,,,CC BY-SA 4.0 +13487,2,,13482,8/27/2020 7:14,,3,,"

The $|x_i\rangle$ you mention here are qudits, they are the generalization of qubits to base $d$ with $|S| = d$. It is categorized by a superposition of $d$ states, same way a qubit is described by the superposition of 2 states.
+In base 3 it has a specific name as well, this is called qutrit.

+",12396,,,,,8/27/2020 7:14,,,,4,,,,CC BY-SA 4.0 +13488,1,13491,,8/27/2020 11:02,,1,99,"

The main functionality for ordering gates in a cirq circuit that I'm aware of is using the predefined insert strategies of cirq.Circuit.insert(). As far as I see, none of the predefined strategies use the possibility to shuffle commuting gates to reduce circuit depth, i.e. that CNOTs that share the same target or control commute, etc. The docs also don't seem to mention anything like this.

+

I'd like to specifically use the commutation rules of CNOTs to reduce the depth of my circuits, and before I start writing my own code, my question is: does cirq provide any functionality of this sort?

+",562,,,,,8/27/2020 21:24,Reordering commuting gates in cirq to reduce circuit depth?,,1,0,,,,CC BY-SA 4.0 +13489,1,13497,,8/27/2020 17:49,,3,94,"

I'm studying Shor algorithm. This is a demostration about the eigenvectors and eigenvalues of $U_a$ gate:

+

+

Can somebody explain me from the third step to the last?

+",11696,,55,,8/31/2020 7:14,8/31/2020 7:14,Eigenvectors and eigenvalues of the gate $U_a:|s\rangle\mapsto|sa \bmod N\rangle$,,1,0,,,,CC BY-SA 4.0 +13490,1,13496,,8/27/2020 18:07,,4,149,"

If you have a pure composite system whose two subsystems are in a product state, then the outcomes of measuring the subsystems (in any basis) are statistically independent. If the subsystems are entangled, then the measurement outcomes will generically be correlated.

+

Is there an example of an entangled state of a composite system of two isomorphic qudits, such that if you measure both subsystems in one basis, then the subsystems' measurement outcomes in that basis are independent, but if you measure both subsystems in another basis, then the outcomes are correlated?

+

For example, is there an entangled state $|\psi\rangle$ of two qubits such that for the joint probability mass function for a measurement in the $Z$-basis +$$\left\{ P(\uparrow, \uparrow) = |\langle \uparrow \uparrow | \psi\rangle|^2, P(\uparrow, \downarrow) = |\langle \uparrow \downarrow | \psi\rangle|^2, P(\downarrow, \uparrow) = |\langle \downarrow \uparrow | \psi\rangle|^2, P(\downarrow, \downarrow) = |\langle \downarrow \downarrow | \psi\rangle|^2 \right\},$$ +the measurement outcomes of the two qubits are independent, but for the joint probability mass function for a measurement of the same state in the $X$-basis +$$\left\{ P(+, +) = |\langle + + | \psi\rangle|^2, P(+, -) = |\langle + - | \psi\rangle|^2,\\ P(-, +) = |\langle - + | \psi\rangle|^2, P(-, -) = |\langle - - | \psi\rangle|^2 \right\},$$ +the measurement outcomes of the two qubits are dependent?

+

I don't see why this shouldn't be possible, but I can't think of an example.

+",551,,55,,8/28/2020 8:42,8/28/2020 9:02,Example of a two-qudit state whose measurement outcomes are independent in one basis but dependent in another,,2,1,,,,CC BY-SA 4.0 +13491,2,,13488,8/27/2020 21:24,,0,,"

No, there's no built-in functionality to optimize the circuit in that way.

+

There is cirq.commutes(A, B) which will tell you if A and B commute. However, cirq.commutes is permitted to fail instead of giving a result, and it is somewhat new so there's still several landmines you can hit when using it. For example, it currently will refuse to check if an operation commutes with a moment. You can instead use cirq.definitely_commutes(A, B), which replaces the failures with false negatives, keeping in mind that you will sometimes see things that you know commute not moving through each other because the comparison isn't supported yet.

+",119,,,,,8/27/2020 21:24,,,,1,,,,CC BY-SA 4.0 +13494,1,,,8/28/2020 0:09,,4,581,"

I try to run simple circuit measurement program using Qiskit in Visual Code. I received this error:

+

AttributeError: 'IBMQFactory' object has no attribute 'backend'

+

from the line of code print(IBMQ.backends())

+

Does anyone know what this mean and how to solve it?

+",5124,,55,,8/31/2020 7:13,5/28/2021 11:28,IBMQFactory object has not attribute backends,,1,0,,,,CC BY-SA 4.0 +13495,2,,13494,8/28/2020 0:20,,2,,"

With the help of documentation from this URL https://github.com/Qiskit/qiskit-ibmq-provider, I realized that I need to run load_account() of my APIToken and store the provider object as shown below

+
my_provider = IBMQ.load_account()
+print(my_provider.backends())
+backend = my_provider.get_backend('ibmq_qasm_simulator')
+
+",5124,,1386,,5/28/2021 11:28,5/28/2021 11:28,,,,0,,,,CC BY-SA 4.0 +13496,2,,13490,8/28/2020 2:24,,4,,"

The state $|00\rangle + i|11\rangle$ has deterministic Z parity and random X parity.

+

+

Basically the trick is to rotate $|00\rangle + |11\rangle$ around the Z axis to mess up the agreement of the X observables. Instead of ZZ, YY, and XX being deterministic; ZZ, XY, and YX are.

+",119,,,,,8/28/2020 2:24,,,,0,,,,CC BY-SA 4.0 +13497,2,,13489,8/28/2020 7:18,,3,,"

You have the state +$$ +\frac{1}{\sqrt{r}}\sum_{s=0}^{r-1}e^{-2\pi i\frac{k}{r}(s+1)}|a^{s+1}\text{ mod }N\rangle. +$$ +Perform a change of variable $p=s+1$ so this simply reads +$$ +\frac{1}{\sqrt{r}}\sum_{p=1}^{r}e^{-2\pi i\frac{k}{r}p}|a^p\text{ mod }N\rangle. +$$ +Now consider for a moment that $p=r$ term, +$$ +e^{-2\pi i\frac{k}{r}r}|a^r\text{ mod }N\rangle=|a^r\text{ mod }N\rangle. +$$ +By definition, $a^r\equiv 1\text{ mod }N$, which we could also write as $a^0$. Hence, this term is exactly the same as using $p=0$ instead. Thus, the state has become +$$ +\frac{1}{\sqrt{r}}\sum_{p=0}^{r-1}e^{-2\pi i\frac{k}{r}p}|a^p\text{ mod }N\rangle, +$$ +which is $|w_k\rangle$.

+",1837,,,,,8/28/2020 7:18,,,,3,,,,CC BY-SA 4.0 +13498,2,,13490,8/28/2020 8:56,,2,,"

Consider two copies of a $d$-dimensional system, $\mathcal X_1,\mathcal X_2$, and take two mutually unbiased bases (MUBs) in each space. Denote these bases with +$$\newcommand{\ket}[1]{\lvert #1\rangle} U\equiv \{\ket{u_k}\}_k,\,V\equiv \{\ket{v_k}\}_k.$$

+

Consider the state $\mathcal X_1\otimes\mathcal X_2\ni\ket\psi\equiv\sum_k \ket{u_k}\otimes\ket{u_k}$ (apply normalisations at will).

+

Then, measuring in the basis $U$ on both sides, the measurement outcomes are fully correlated: if $\ket{u_k}$ is found in $\mathcal X_1$, then with certainty $\ket{u_k}$ will be found in $\mathcal X_2$.

+

On the other hand, using different bases on different sides, we get fully uncorrelated outcomes. For example, measuring with $U$ on $\mathcal X_1$, the post-measurement state on $\mathcal X_2$ is some $\ket{u_k}$. Measuring this state in the basis $V$ we can get any $\ket{v_j}$ with equal probability.

+

In the particular case of qubits, you can use the eigenstates of the Pauli matrices as mutually unbiased bases. If for some reason you want to completely change bases, i.e. change the measurement basis in both spaces at the same time, you just need three MUBs, so that the state give correlated outcomes in $U\otimes U$ but uncorrelated ones in $V\otimes W$, with $W$ the third MUB.

+

Of course, which bases you want to use will also depend on the initial state. E.g., the example in this other answer works by using the same measurement basis on both sides (the Pauli $X$ basis) because the initial state includes some phases.

+",55,,55,,8/28/2020 9:02,8/28/2020 9:02,,,,0,,,,CC BY-SA 4.0 +13499,1,13501,,8/28/2020 20:34,,1,350,"

$\newcommand{\bra}[1]{\left<#1\right|} +\newcommand{\ket}[1]{\left|#1\right>}$Here is what I tried:

+

Given that we have two projectors: +$$ +A = \sum_i \ket{i} \bra{i}, \hspace{2em} +B = \sum_j \ket{j} \bra{j} +$$ +The goal is to prove that: +$$ +A \otimes B = \sum_k \ket{k} \bra{k}. \tag1\label1 +$$ +Plugging into \eqref{1}, we get: +$$ +A \otimes B += \left( \sum_i \ket{i} \bra{i} \right) \otimes \left( \sum_j \ket{j} \bra{j} \right) += \sum_{i,j} \ket{i} \bra{i} \otimes \ket{j} \bra{j} +\tag{2}\label{2} +$$ +I'm not sure how to proceed from \eqref{2}. It would be convenient if for every $\ket{i}$ and $\ket{j}$ there is a $\ket{k}$ for which the following identity is true: +$$ +\ket{k} \bra{k} = \ket{i} \bra{i} \otimes \ket{j} \bra{j} \tag{3}\label{3} +$$ +This would prove \eqref{1} immediately. Is \eqref{3} true though? If yes, why? If not, how else can we proceed to prove \eqref{1}?

+",12643,,55,,8/28/2020 22:33,11/8/2022 14:27,Nielsen & Chuang Exercise 2.32: Show that the tensor product of two projectors is a projector,,2,2,,,,CC BY-SA 4.0 +13500,1,13502,,8/29/2020 4:48,,3,1201,"

Let $|\phi\rangle,|\psi\rangle$ be two state vectors, and let $d=\frac{1}{2}\mathrm{Tr}(\sqrt{(|\phi\rangle\langle\phi|-|\psi\rangle\langle\psi|)^2})$ be their trace distance. Then it will always hold that $d = \sqrt{1-|\langle\phi|\psi\rangle|^2}$.

+

I'm looking for a reference for this result. A textbook reference would be optimal, but any papers mentioning the result would be fine as well.

+",13074,,55,,8/31/2020 9:32,7/6/2022 20:11,Relation between trace distance and inner product between pure states,,2,1,,,,CC BY-SA 4.0 +13501,2,,13499,8/29/2020 6:58,,4,,"

I wouldn't approach the problem the way that you have. Instead, I'd take the definition of what it means to be a projector: $P$ is a projector if and only if $P^2=P$ and $P=P^\dagger$.

+

So, let's take +$$ +P=P_A\otimes P_B. +$$ +We can calculate $P^\dagger=P_A^\dagger\otimes P_B^\dagger=P_A\otimes P_B=P$, which follows from the assumption that $P_A$ and $P_B$ are projectors.

+

Similarly, +$$ +P^2=P_A^2\otimes P_B^2=P_A\otimes P_B=P. +$$ +You're done!

+",1837,,,,,8/29/2020 6:58,,,,0,,,,CC BY-SA 4.0 +13502,2,,13500,8/29/2020 7:55,,3,,"

A derivation of this is given in Mark Wilde's book https://arxiv.org/abs/1106.1445 equation 9.173, pages 274-275.

+",9854,,,,,8/29/2020 7:55,,,,0,,,,CC BY-SA 4.0 +13503,1,13504,,8/29/2020 9:00,,3,92,"

I'm following the Qiskit textbook. I'm currently here: https://quantum-computing.ibm.com/jupyter/user/qiskit-textbook/content/ch-states/representing-qubit-states.ipynb

+

Here's an example of my initialization code:

+
initial_state = [1/sqrt(2), 1j/sqrt(2)]
+
+qc = QuantumCircuit(1)
+
+qc.initialize(initial_state, 0)
+
+state = execute(qc,backend).result().get_statevector() 
+
+print(state) 
+
+

[0.70710678+0.j 0. +0.70710678j]

+
results = execute(qc,backend).result().get_counts()
+
+plot_histogram(results)
+
+

When I plot this to a histogram, the same 50/50 distribution occurs as when I remove the imaginary "j" from the initialization. Why is the j in there?

+",12442,,55,,8/30/2020 21:00,8/30/2020 21:00,"When defining the state vector of a qubit in qiskit, what difference does putting ""j"" make?",,1,0,,,,CC BY-SA 4.0 +13504,2,,13503,8/29/2020 10:21,,1,,"

Those two states are different quantum states (with different relative phases) that have the same probabilities of measurement outcomes when we measure in $Z$ basis. The first state without $i$ ($j$ in the Python):

+

$$|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$$

+

with $i$:

+

$$|i\rangle = \frac{1}{\sqrt{2}}(|0\rangle + i|1\rangle)$$

+

In order to show the difference between these two states let's apply $H S^{\dagger}$ gates to each of them and see how much different results we can obtain:

+

$$ H S^{\dagger} |+\rangle = H \frac{1}{\sqrt{2}}(|0\rangle - i|1\rangle) = \frac{1}{2}((1-i)|0\rangle + (1 + i)|1\rangle)$$

+

The probability of measuring $|0\rangle$ or $|1\rangle$ is equal to $|\frac{1-i}{2}|^2 = |\frac{1+i}{2}|^2 = 0.5$. Now let's apply the same gates to the $|i\rangle$:

+

$$ H S^{\dagger} |i\rangle = H \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = |0\rangle$$

+

The probability of measuring $|0\rangle$ is equal to $1$. These two states ($|+\rangle$ and $|i\rangle$) can lead to different results, so $i$ (or $j$ in Python) does make a difference.

+
+

Answer to the questions in the comments

+

Measurement in $Z$ basis is the conventional measurement: measuring if the state is in $|0\rangle$ or $|1\rangle$ state (there are other basis measurements: a related example can be found in this answer). $|0\rangle$ and $|1\rangle$ are eigenvectors (also eigenbasis) of $Z=\begin{pmatrix} 1&0 \\ 0 & -1 \end{pmatrix}$ operator. $HS^{\dagger}$ is two separate gates: $H$ and $S^{\dagger}$. Here I have applied firstly $S^\dagger = \begin{pmatrix} 1&0 \\ 0 & -i \end{pmatrix}$ gate, then $H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1&1 \\ 1 & -1 \end{pmatrix}$ gate.

+",9459,,9459,,8/29/2020 18:32,8/29/2020 18:32,,,,7,,,,CC BY-SA 4.0 +13505,2,,8702,8/29/2020 16:27,,4,,"

Use the command ls -alt in Terminal on macOS to find hidden files. It's there. This should work for all Mac users.

+",13081,,45,,9/1/2020 6:53,9/1/2020 6:53,,,,0,,,,CC BY-SA 4.0 +13506,1,,,8/29/2020 19:06,,1,103,"

I have a single qubit $a$ in state

+

$$ |s\rangle = \alpha_0|0\rangle + \alpha_1|1\rangle $$

+

$\alpha_0$ may be 0 whereas $\alpha_1$ is always positive and above $0$. Almost always $$\alpha_0 << \alpha_1$$

+

Is there any way to flip $\alpha_0$ and $\alpha_1$ if and only if $\alpha_0 > 0$?

+

I was thinking of having two ancillary qubits and perform two controlled CNOTs to detect both state $0$ and state $1$ and then CCNOT with those two ancillary qubits to flip $a_0$ and $a_1$

+

But does this make sense? I am not sure if detecting a superposition is possible in this way

+",12302,,55,,8/30/2020 23:43,9/1/2020 7:10,Can I switch $\alpha_0$ and $\alpha_1$ conditionally to $\alpha_0>0$ in a state $\alpha_0|0\rangle+\alpha_1|1\rangle$?,,2,1,,,,CC BY-SA 4.0 +13507,2,,13506,8/29/2020 19:09,,1,,"

No, that's not possible. For example, it would allow you to implement an operation that sent both $|0\rangle$ and $|1\rangle$ to $|1\rangle$. Two states going to the same state means the operation is irreversible and non-unitary.

+",119,,,,,8/29/2020 19:09,,,,9,,,,CC BY-SA 4.0 +13508,1,,,8/30/2020 10:25,,1,118,"

Recently May and Schlieper have published a preprint (https://arxiv.org/abs/1905.10074) arguing that the modular exponential register in Shor's algorithms can be replaced with a universally hashed modular exponential register. I've previously asked here ( Shor's Discrete Logarithm Algorithm with a QFT with a small prime base) whether Shor's algorithm for discrete logarithms (which can be used for factoring semiprimes) can be modified to only output the logarithm modulo some small prime $w$ (it seems it can). If further, the QFT can be factored into $\bmod w$ and $\bmod L$ (where $N=Lw$ is about the size of the group order) QFTs, (see the later comments and the second answer) the output qubits can be found through a quantum circuit with only $\mathrm{O(\log N)}$ qubits. $\mathrm{O(\log N)}$ runs with different small prime bases suffice to reconstruct using the Chinese Remainder Theorem the entire logarithm in polynomial time (roughly quintic).

+

Obviously this could be wrong, but while that's open, one can ask whether May and Schlieper's hashing trick can be extended to estimating probability amplitudes for general quantum circuits. I've tried to make my argument as terse for Stack Exchange and I've focused on the proof of compressibility and left out details about how Markov random fields should represent hashed quantum circuits.

+

A quantum circuit can be treated as an exponentially large Factor Analysis (FA) problem. The variables and factors are the basis vectors at each layer of the quantum circuit. The quantum gates are linear transformations from factors (which can also be variable) to variables (which can also be factors). The gates are assumed to have (an arbitrary, non-physical) Gaussian noise, which allows FA to work. Factors and variables are related by

+

\begin{equation} + x_{i+1,b} = G_ix_{i,a} + n_{i+1,b} +\end{equation}

+

where $n$ is Gaussian noise, $x_i$ are the values of variables representing the probability amplitudes at each layer and $G_i$ is the unitary quantum gate. This implies Gaussian distributions like

+

\begin{equation} + p(x_{i+1,a}) = \frac{1}{\sqrt{2\pi\sigma_{i,a}^2}} \exp{\bigg( -\frac{[x_{i+1,a} - G_{i}x_{i,b}]^2}{\sigma_{i,a}^2} \bigg)} +\end{equation} +which can then be converted to a MRF.

+

(Explanation of Factor Analysis)

+

http://users.ics.aalto.fi/harri/thesis/valpola_thesis/node37.html

+

https://www.cs.ubc.ca/~murphyk/Teaching/CS532c_Fall04/Lectures/lec17.pdf

+

This FA problem can, by the Hammersley–Clifford theorem, be converted into a Markov Random Field (MRF) whose nodes are variables and whose edges are shared variance between the nodes. This MRF can be solved in polynomial time in the size of the MRF (which is still exponential size in the number of qubits) by Gaussian Belief Propagation (GaBP). Unlike general Belief Propagation, GaBP can be guaranteed to converge exponentially quickly in polynomial time by using diagonal loading. +(GaBP explained here: https://arxiv.org/abs/0811.2518)

+

The 4 Clifford+T gates for a universal set of quantum gates. They are

+

$H = \frac{1}{\sqrt{2}}$ \begin{pmatrix} +1 & 1 \\ +1 & -1 +\end{pmatrix}

+

$X = $ \begin{pmatrix} +0 & 1 \\ +1 & 0 +\end{pmatrix}

+

$CX = $ +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0 +\end{pmatrix}

+

$T = $ \begin{pmatrix} +1 & 0 \\ +0 & \omega +\end{pmatrix}

+

where $\omega = e^{\frac{i \pi}{4}}$

+

X Gate:

+

\begin{equation} + p(x'_{0,Re}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{0,Re} - x_{1,Re}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{0,Im}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{0,Im} - x_{1,Im}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{1,Re}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{1,Re} - x_{0,Re}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{1,Im}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{1,Im} - x_{0,Im}]^2}{\sigma^2} \bigg)} +\end{equation}

+

T Gate:

+

\begin{equation} + p(x'_{0,Re}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{0,Re} - x_{0,Re}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{0,Im}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{0,Im} - x_{0,Im}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{1,Re}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{0,Re} - \frac{1}{\sqrt{2}}(x_{0,Re}-x_{0,Im})]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{1,Im}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{1,Im} - \frac{1}{\sqrt{2}}(x_{0,Im}+x_{0,Re})]^2}{\sigma^2} \bigg)} +\end{equation}

+

CX Gate:

+

\begin{equation} + p(x'_{0,Re}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{0,Re} - x_{0,Re}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{0,Im}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{0,Im} - x_{0,Im}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{1,Re}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{1,Re} - x_{1,Re}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{1,Im}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{1,Im} - x_{1,Im}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{2,Re}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{2,Re} - x_{3,Re}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{2,Im}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{2,Im} - x_{3,Im}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{3,Re}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{3,Re} - x_{2,Re}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{3,Im}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{3,Im} - x_{2,Im}]^2}{\sigma^2} \bigg)} +\end{equation}

+

H Gate:

+

\begin{equation} + p(x'_{0,Re}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{0,Re} - \frac{1}{\sqrt{2}}(x_{0,Re}+x_{1,Re})]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{0,Im}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{0,Im} - \frac{1}{\sqrt{2}}(x_{0,Im}+x_{1,Im})]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{1,Re}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{1,Re} - \frac{1}{\sqrt{2}}(x_{0,Re}-x_{1,Re})]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{1,Im}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{[x'_{1,Im} -\frac{1}{\sqrt{2}}(x_{0,Im}-x_{1,Im})]^2}{\sigma^2} \bigg)} +\end{equation}

+

To apply the hashing trick, we would like to hash each layer, sending qubits to hashed qubits according to some universal hash function and minimize the number of edges connecting the nodes representing hashed states to minimize the runtime of GaBP. To prove that the hashing trick does approximate transition amplitudes, we need to show that each approximation of the action of a quantum gate on hashed qubits (which necessarily forgets some information containing entanglement) produces at most a certain error in probabilities and transition amplitudes. The extra structure of quantum circuits means that the proof of compressibility will be easier with quantum states than with belief propagation and MRFs, but GaBP can nail down computational complexity bounds. Unitarity is and should be necessary to show that errors per layer are additive and independent because linear non-unitary "quantum" circuits can be used to solve $\mathrm{PP-Complete}$ problems.

+

A natural hashing strategy is to use a non-cryptographic hash function family like $(ax+b) \bmod 2^n \div 2^{(n-p)}$ which is +well adapted to hashing qubits, but for each layer keep up to 2 "windows" open on the qubits acted on by the preceding and following quantum gates. Conveniently, the shared covariance between layers can be represented sparsely by $\mathrm{O}(m=2^p)$ edges. Qubits from this hash function can be "wrapped" and "unwrapped" out of the hashed qubits for gates to act on them because the hash function is non-cryptographic.

+

For ordinary qubits, the universal hash function family $(ax+b) \mod 2^n \div 2^{n-p}$, where $m=2^p$ is effective. $m$, here, is the number of hashed variables (to be multiplied by the unwrapped variables for the total number of variables in the layers). These hash functions make it possible to sparsely 'wrap' and 'unwrap' hashed variables describing unhashed qubits used by gates (we can assume that at most 2 qubits are used by each gate) and the hashed remaining qubits. Each layer of variables borders two quantum gates with at most 2 qubits each, so neighboring layers will differ by at most 4 qubits and 8 variables in terms of which qubits are hashed or not hashed. Each variable is specified by a certain bit of $x$, so mapping nodes from one layer to the next entails hashing a pair of qubits from the former layer and unhashing a pair of qubits from the next layer (which is used in the gate in the layer after next). The qubits that aren't wrapped or unwrapped in neighboring layers can be specified by a 'bitfield' $x_{constant}$, the 'bitfield' to be wrapped into the hashed qubits can be specified as $x_{wrap}$, and the 'bitfield' to be unwrapped can be specified as $x_{unwrap}$. For fixed bases of both pair of qubits, the hashed qubits differ by $a(x_{wrap} - x_{unwrap}) \mod 2^n \div 2^{n-p}$. This quantity, added to the normal prehashed quantity, can result in two neighboring hashed outputs. The fraction of qubit bases going to each possible output can then be calculated. This means that each unhashed node has at most 17 neighbors including itself, but each hashed node has up to $8 \times 2 \times 2 + 2 + 1 = 35$ neighbors including itself and each layer of the MRF is sparse, so $2^p = O(m)$. If some of the wrapped and unwrapped qubits overlap, the overlapping 'bitfields' will cancel, resulting in the correct difference.

+

Hashed precisions $A^h_{ij}$ can be computed as multiple of the unhashed precisions $A_{ij}$ up to the point that the precision is split among adjacent hashed qubits. This is because $A_{ij}$ in unhashed form consists of copies of $A_{ij}$ restricted to qubits which are acted on by a quantum gate.

+

Let $B_{\alpha} = a(x_{wrap} - x_{unwrap}) \bmod 2^n \div 2^{n-p}$ and \newline +$C_{\alpha}= a(x_{wrap} - x_{unwrap}) \bmod 2^{n-p} / 2^{n-p}$.

+

The wrapping and unwrapping affects hashed variables like

+

$x^h_{a,b,h(i)+B_{\alpha}+1} = C_{\alpha}\sum_i x_{a,c,i}$

+

$x^h_{a,b,h(i)+B_{\alpha}} = (1-C_{\alpha}) \sum_i x_{a,c,i}$

+

%$k$ is a normalization constant equal to the number of unhashed qubits mapped to hashed qubits.

+

$x'$ represents the next layer. $x$ represents the current layer. The variances can be taken to be identical across the MRF , except where very small variances are used to fix the value of a variable (which is outside of the part of the MRF used to encode quantum gates). The $\mu$s are hashed $i$s, but there is no need to specify which $i$ because each layer is homogeneous. $G$ is the unitary gate, $a,b$ represent the unwrapped variables. In most cases, $a$ and $b$ will represent different unwrapped qubits.

+

The noise model is

+

$$ +C_{\alpha}x'_{a,\mu+B_{\alpha}+1} = C_{\alpha}Gx_{b,\mu} + n_{\mu} +$$ +and +$$ +(1-C_{\alpha})x'_{a,\mu+B_{\alpha}} = (1-C_{\alpha})Gx_{b,\mu} + n_{\mu} +$$

+

The $x'$ $x$ are sums of the unhashed variables. The $C_{\alpha}$ and $1-C_{\alpha}$ weights are the fractions of the variables which map to each pattern. The noise $n_{\mu}$ is the sum of the noise for each variable with the same hash value ($C_{\alpha}\sum_{h^{-1}(\mu)} n_i$ or $(1-C_{\alpha})\sum_{h^{-1}(\mu)} n_i$) and, as such, grows quadratically, while variables grow linearly. This means the noise variables are proportional to $\sqrt{C_{\alpha}}$ or $\sqrt{1-C_{\alpha}}$ and the variance is proportional to $C_{\alpha}$ or $1-C_{\alpha}$. The linear weighting on the variance partially cancels out the quadratic weighting on the variables, resulting in a linear factor for the precision matrix.

+

This results in Gaussians

+

\begin{equation} + p(x'_{a,\mu+B_{\alpha}+1}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{C_{\alpha}[x'_{a,\mu+B_{\alpha}+1} - Gx_{b,\mu}]^2}{\sigma^2} \bigg)} +\end{equation}

+

\begin{equation} + p(x'_{a,\mu+B_{\alpha}}) \propto \frac{1}{\sqrt{2\pi\sigma^2}} \exp{\bigg( -\frac{(1-C_{\alpha})[x'_{a,\mu+B_{\alpha}} - Gx_{b,\mu}]^2}{\sigma^2} \bigg)} +\end{equation}

+

There are 4 cases over first layer precision and second layer precision and interlayer precision. The variances aren't necessarily complete, except for the interlayer precisions, and precisions from other gates may have to be added.

+

First and second layer precisions are the same as the unhashed precisions.

+

$A^h_{x,x,a,b,\mu,\mu} = A_{x,x,a,b,i,i}$

+

The second layer precisions are

+

$A^h_{x',x',a,b,\mu,\mu} = A_{x',x',a,b,i,i}$

+

The interlayer precisions are

+

$A^h_{x',x,a,b,\mu,\mu+B_{\alpha}+1} = C_{\alpha}A_{x',x,a,b,i,i}$

+

$A^h_{x',x,a,b,\mu,\mu+B_{\alpha}}= (1-C_{\alpha})A_{x',x,a,b,i,i}$

+

In other words only the interlayer precisions change.

+

We need to estimate the error caused by one quantum gate on a hashed quantum gate. This error is induced because, going from one layer to the next, part of the state is forgotten (that is, wrapped back into the hashed states) and part of the state is unwrapped (revealing unknown information). For a universal set of two qubit quantum gates, 4 qubits will be unwrapped in each layer, so that $32m$ variables will be used at each layer. (We can set $m = 2^{ p }$, where $m$ is the needed number of hashed variables.) Each layer will be predictable from the previous layer through a unitary transformation up to the variables representing the 2 qubits forgotten changing layers.

+

The error estimates in Theorem 6.1 in May and Schlieper may be adapted for hashed applications of quantum gates. The probability of observing the desired qubits $z$ may be given a lower bound of $\frac{m-1}{m}p(x)$ and, since the number of levels in $z$ is small, $c$ (usually 4), there is an upper bound of $\frac{m-1}{m}p(x)+\frac{1}{m}$ from the available probality and and upper bound of $\frac{m-1}{m}p(x)+\frac{c^2}{m}$ from summing out forgotten qubits.

+

Here, $x$ stands for the unwrapped qubits in the following layer. This can include the qubits unwrapped for the next gate. $y$ are the hashed qubits which are preserved going from one gate to another. $z$ are the unwrapped qubits in the previous layer that are hashed into $y$ and forgotten. $y'$ is $y$ hashed with $z$. $z'$ are the $z$ which correspond to the hashed with $z$ basis $y'$. The transformation between $w_{x,y',z'}$ and $w_{x,y,z}$ is unitary.

+

The weights for $w_{x,y',z'}$ are calculated from the universal hash function $(ax+b) \bmod 2^n \div 2^{n-p}$. Each basis vector can be encoded as an unsigned integer and hashed into a smaller unsigned integer, like a bitfield. To hash the $z$ qubits into the $y$ qubits, add the bitfield represening the $z$ qubits and apply the hash function. The $\bmod 2^n$ differs by $ax_z \bmod 2^n$. The resulting $y'$ value will then shift by either $\lfloor ax_z \bmod 2^n \div 2^{n-p} \rfloor$ or $\lfloor ax_z \bmod 2^n \div 2^{n-p} \rfloor +1$. The fractions of the two shifts are +$$1 - \frac{ax_z \bmod 2^{n-p} }{2^{n-p}} $$ and +$$\frac{ax_z \bmod 2^{n-p} }{2^{n-p}}$$, respectively.

+

The state after the last quantum gate is applied, but before the $z$ qubits are hashed in and discarded is: +\begin{equation} + \psi = \sum_x \sum_y \sum_z w_{x,y,z}|x \rangle | y \rangle |z \rangle +\end{equation}

+

The state remembered by the next layer after $z$ is hashed into $y$ and forgotten is +\begin{equation} + \psi' = \sum_x \sum_{y'} w_{x,y'}|x \rangle | y' \rangle +\end{equation} +This differs from May and Schlieper because $z$s originally with the same $(x,y)$ will be randomly sent to a different $(x,y')$.

+

The condition in Theorem 6.1 +\begin{equation} + W_{x,y} := \sum_z w_{x,y,z} = 0 +\end{equation} +does not hold in general in our case. Instead we are forced to forget a only a small number of qubits each layer of the MRF to keep this sum from becoming too large. And, in any case, the formula becomes +\begin{equation} + W_{x,y'} := \sum_{z'} w_{x,y',z'} +\end{equation}

+

The probability of observing a hashed state is

+

\begin{equation} + p_h(x,y') = \frac{1}{\mathcal{H}} \sum_{h \in \mathcal{H}} (\sum_{i = 0}^{m-1} |\sum_{z'} w_{x,y',z'}|^2) +\end{equation}

+

$\mathcal{H}$ is a normalization factor over all possible hash functions in the given family. The sum over $z'$ is correct because the $ w_{x,y',z'}$ are unitary transformations of $ w_{x,y,z}$. The universality of the hash function allows the expression to be simplified to

+

\begin{equation} + p_h(x,y') = \sum_{z'} |w_{x,y',z'}|^2 + \frac{1}{m} \sum_{z'_1 \neq z'_2} w_{x,y',z'_1}\overline{w_{x,y',z'_2}} +\end{equation}

+

The derivation of the error in probability is almost the same, except that there is a range in possible errors and, unlike May and Schlieper's proof the errors aren't packed into $x=0$ basis vectors.

+

\begin{equation} + W_{x,y'} = \frac{1}{m} |\sum_{z'} w_{x,y',z'}|^2 = \frac{1}{m} \sum_{z'} |w_{x,y',z'}|^2 + \frac{1}{m} \sum_{z'_1 \neq z'_2} w_{x,y',z'_1}\overline{w_{x,y',z'_2}} = p_h(x,y') - \frac{1}{m} \sum_{z'} |w_{x,y',z'}|^2 +\end{equation}

+

\begin{equation} + \frac{m-1}{m} p(x,y') \leq p_h(x,y') \leq \frac{m-1}{m} p(x,y') + W_{x,y'} \leq\frac{m-1}{m} p(x,y') + \frac{c^2}{m} +\end{equation}

+

Since $p_h$ is a probability, there is a different logical upper bound

+

\begin{equation} + \frac{m-1}{m} p(x,y') \leq p_h(x,y') \leq \frac{m-1}{m} p(x,y') + \frac{1}{m} +\end{equation}

+

On average, this second inequality should hold, although I don't know how to prove it can't be violated. Since both these upper bounds are an absolute cap on the error in probability, summing out $y$ will still leave the same error margins and the desired single qubit probability amplitude estimates will be accurate to $\mathrm{O}(\frac{1}{m})$.

+

Summing over only the $z$ qubits is necessary because it can be that $W_x > 1$ even with only polynomially many hashed variables which cannot be interpreted as a probability. For instance, one layer of $n$ Hadamard gates with state to be hashed $\sum^{2^n -1}_{i=0}\frac{1}{\sqrt{2^n}} x_i$, would have $W_x = 2^n$ which is nonsensically large. Even a hashed state would still have $W_x = m$. To control $W$ one needs to work only with small unitary transform that affect a constantly bounded number of qubits, like ordinary quantum gates which necessitates only summing out one quantum gate at a time.

+

To guarantee $W_{x,y'}$ is small enough, we need to reduce the number of $z'$ per $x,y'$ to a constant so that increasing $m$ will make them inconsequential. The terms summed in $W_{x,y'}$ will always be $|w_{x,y'}| \leq 1$ so $W_{x,y'} \leq \frac{c^2}{m}$. On average, the $w_{x,y',z'}$ will be much smaller, on the order of $\mathrm{O}(\frac{1}{\sqrt{m}})$ which results in an average error in probability around $\mathrm{O}(\frac{1}{m^2})$.

+

This argument narrows down the range of error in probability, but perhaps there could still be large error margins in phase. To narrow the range of error in phase, perform Hadamard(s) on the $y'$ qubits and extract the phase. The probability estimates then make comparable restrictions the range of phase error. So the restriction on errors in probability is also a restriction on errors in probability amplitude.

+

We can then use the unitarity of quantum gates to show that quantum gates preserve the magnitude of errors in amplitude. Since unitary transformations preserve inner products, the correlation between the correct state and the approximate state will remain the same. Non-unitary linear transformations can also be represented as FA problems and hashed and it must be because errors can be amplified by non-unitary gates that the hashing trick will fail on them. Otherwise, the hashing trick could be used to solve $\mathrm{PP-Complete}$ counting problems which are considerably hard than $\mathrm{NP}$.

+

In the worst case, amplitude errors will add up over $g$ gates, so amplitude and probability errors at the end of the circuit will be at most $\mathrm{O}(\frac{g}{m})$. Likewise, the independence of errors between implies that the total error for the circuit are roughly bounded by multiplying the probability error margins together and assuming $m$ is large enough for the linear approximation to hold to get

+

\begin{equation} + \frac{m-g}{m} p^{total}(x,y') \leq p^{total}_h(x,y') \leq \frac{m-g}{m} p^{total}(x,y') + \frac{g}{m} +\end{equation}

+

So, as long as $m \gg g \epsilon$, the final error in probability and probability amplitude will be $< \epsilon$.

+

Using the broadcast variant of GaBP, the runtime to calculate probability amplitudes is $\mathrm{O}(E \log N)$, where $E$ is the number of edges and $N$ is the number of nodes in the MRF. For quantum circuits the running time is roughly quadratic log. For estimates of probability amplitudes which are accurate up to $\pm \epsilon$, the running time is $\mathrm{O}((\frac{g^2+gn\log g}{\epsilon})\log{(\frac{g^2+gn\log g}{\epsilon}}))$, where $n$ is the number of qubits and $g$ is the number of gates.

+",9305,,9305,,9/11/2020 21:09,9/11/2020 21:09,Can hash functions speed up quantum simulation? (Generalizing May and Schlieper's idea),,0,12,,,,CC BY-SA 4.0 +13509,1,,,8/30/2020 18:27,,1,55,"

I assume $\mathcal{E} \in \mathcal{L}(\mathcal{L}(H))$ is a CPTP map. I call $\{B_i\}$ an orthonormal basis for Hilbert-Schmidt scalar product of $\mathcal{L}(H)$

+

This quantum map can be decomposed as:

+

$$\mathcal{E}(\rho)=\sum_{ij} \chi_{ij} B_i \rho B_j^{\dagger}$$

+

The matrix having for element $\chi_{ij}$ is called the chi-matrix of the process.

+

My question are:

+

Is there a physical interpretation for the diagonal coefficients of this chi matrix in a general case (i.e interpretation valid for any basis). I know that in quantum error correction theory they might have an importance, but even without Q.E.C can we relate them to some physical property ?

+

Same question in the particular case the chi-matrix is actually diagonal, is there a general interpretation of the $\chi_{ii}$ ?

+",5008,,55,,11/25/2020 9:47,11/25/2020 9:47,Is there a physical interpretation for the diagonal terms of a $\chi$ matrix?,,0,4,,,,CC BY-SA 4.0 +13511,1,,,8/30/2020 21:15,,2,491,"

For example, if I had a gate rz(0), it holds no value in a circuit. It comes out to a matrix of [[1,0], [0,1]], which seems to be of no value, but I am wondering if there is any purpose of such gate in a circuit.

+",12790,,9006,,8/31/2020 6:26,8/31/2020 6:34,Is a 0 degree rotation around an axis meaningless?,,2,0,,,,CC BY-SA 4.0 +13512,2,,13511,8/30/2020 21:27,,3,,"

Operations like that can be removed without changing the function of the circuit.

+

They may be in the circuit to achieve some alternative purpose in context, for example to reserve a particular location for a particular purpose.

+",119,,,,,8/30/2020 21:27,,,,0,,,,CC BY-SA 4.0 +13513,1,13575,,8/31/2020 2:44,,7,197,"

I am interested in applying the power of Quantum Computing to drug discovery. Although I realize that quantum computing is limited in regards to modeling drug-like compounds and their interactions right now, I was curious as to any useful resources in the space. Thanks.

+",13092,,55,,8/31/2020 21:15,4/5/2021 11:46,What are some current applications of Quantum Computing in drug discovery? Are there any test examples of this?,,1,0,,,,CC BY-SA 4.0 +13514,1,,,8/31/2020 3:13,,2,34,"

+

In Google's quantum supremacy experiment, supplementary Section VIIIH, they calculate the correlation coefficient of the linear fit coefficients $p_0$,$p_1$. I can't figure out the definition of this quantity. Is this the same as the Pearson correlation coefficient?

+",11562,,55,,8/31/2020 21:16,8/31/2020 21:16,"When we do a linear fit, what is the correlation coefficient of the estimated parameters?",,0,0,,,,CC BY-SA 4.0 +13515,1,13521,,8/31/2020 3:19,,2,299,"

Inspired by this article which uses a $|+\rangle$ state as a control for a $CSWAP$, I realised you can conditionally measure a qubit by (maybe) swapping it with an empty ancilla, measuring it and (maybe) swapping it back.

+

As such, you could prepare a Bell pair, (maybe) measure half of it and then check if the other half was affected as follows: +

+

If measurement changes the top qubit then the second $H$ gate should put it back into the |+> state and we should measure random results. If the measurement doesn't change the top qubit, then it should turn the $|+\rangle$ back to $|0\rangle$, deterministically measuring 0. Right?

+

If so, then I'm hoping there's some extension of the uncertainty principle that would imply that because there is no knowledge about whether the second qubit was measured, we could learn something about the first qubit. I hope.

+

Of course I've tried to test this but I don't believe the qiskit simulator and none of the IBM devices allow operations to take place after measurement ("Qubit measurement not the final instruction. [7006]"). +So can anyone think of a way I could test it? +Does this count as a Bell Test? +Has this been tried before? +Am I missing something obvious?

+

Not sure if this is the right place to post this but just interested to hear people's thoughts/predictions.

+",13093,,55,,9/10/2020 11:48,9/10/2020 11:48,Is this a Bell test?,,1,0,,,,CC BY-SA 4.0 +13516,2,,13511,8/31/2020 6:34,,1,,"

Just to add, sometimes a circuit is described in general way and parameters such as rotation angles are evaluated (for example in Qiskit) based on a particular case the circuit is constructed for. So, a calculated rotation angle can be zero which yields for example gate rz(0). As pointed by Craig Gidney and you, such gate is in fact identity operator and it can be removed from the circuit without affecting its function.

+

In practise these gates are removed during the circuit transpilation. However, it also depends on optimization level you have set. In some cases these gates are left without change.

+

Finally, it is worth noting that identity gates can be used for measuring relaxation times on a quantum processor (roughly speaking, put for example 10 identity gates in row on a qubit set to state $|1\rangle$ and measure a probability that the qubit stays in the state $|1\rangle$).

+",9006,,,,,8/31/2020 6:34,,,,0,,,,CC BY-SA 4.0 +13517,1,13518,,8/31/2020 8:59,,1,103,"

Let $P_1 = \lbrace I, -I, iI, -iI, X, -X, iX, -iX, Y, -Y, iY, -iY, Z, -Z, iZ, -iZ\rbrace$. Let $P_n$ be the $n$-tensor fold of $P_1$. It is said that two operators either commute if $AB = BA$ or anti-commute if $AB = -BA$ for all $A,B \in P_n$.

+

Let us have $n=1$ and $A=I$ and $B=Y$, then we have:

+

\begin{align*} + IY &\stackrel{\text{true}}{=} YI,\\ + IY &\stackrel{\text{true}}{=} -YI. +\end{align*}

+

In other words, $I$ and $Y$ both commute and anti-commute. I have also added a matlab code snippet for completeness.

+
I = [1 0; 0 1];
+Y = [0 -i;i  0];
+if isequal(I*Y,Y*I)
+   disp('commute') 
+end
+if isequal(I*Y,-Y*I)
+   disp('ANTI-commute') 
+end
+
+

I am referring to Daniel Gottesman's PhD thesis.

+

What am I missing?

+

Edit: +My Matlab code should run only one of the if statements (not both). It seems that my machine was caching the answers from previously. A restart of the program has fixed the issue.

+",7528,,7528,,9/1/2020 10:25,9/1/2020 10:25,The commutativity of $I$ and $Y$ in a stabilizer code,,1,7,,,,CC BY-SA 4.0 +13518,2,,13517,8/31/2020 9:27,,3,,"

It should be $IY \ne - YI$ instead of $IY = - YI$. +$$IY \ne - YI \\ +\begin{pmatrix} +1&0\\ +0& 1 +\end{pmatrix} +\begin{pmatrix} +0&-i\\ +i& 0 +\end{pmatrix} +\ne +-\begin{pmatrix} +0&-i\\ +i& 0 +\end{pmatrix} +\begin{pmatrix} +1&0\\ +0& 1 +\end{pmatrix} +\\ +Y = +\begin{pmatrix} +0&-i\\ +i& 0 +\end{pmatrix} \ne +-\begin{pmatrix} +0&-i\\ +i& 0 +\end{pmatrix} += -Y +$$

+

So $I$ and $Y$ don't anti-commute. Moreover $I$ anti-commutes only with the matrix with all $0$ entries. Also, $I$ commutes with all matrices, because from definition $IM = M = MI$, where $M$ is a random matrix.

+
+

On the contrary all pairs from $\{X, Y, Z \}$ anti-commute with each other. As an example:

+

$$\{X Z \} = XZ + ZX = 0$$

+

because $XZ = -ZX$. Also, we have thess relations: $XY = -YX$ and $YZ = -ZY$ from which we can conclude $\{XY\} = \{ZY\} = 0$.

+",9459,,9459,,9/1/2020 10:15,9/1/2020 10:15,,,,28,,,,CC BY-SA 4.0 +13519,2,,13500,8/31/2020 9:31,,2,,"

$\newcommand{\bra}[1]{\langle #1\rvert}\newcommand{\braket}[2]{\langle #1\rvert #2\rangle}\newcommand{\ket}[1]{\lvert #1\rangle}\newcommand{\on}[1]{\operatorname{#1}}\newcommand{\ketbra}[2]{\lvert #1\rangle\!\langle #2\rvert} +$Define $A\equiv \ketbra\phi\phi - \ketbra\psi\psi$. Being $A$ hermitian, $\on{Tr}(\sqrt{A^2})$ equals the sum of its singular values. Being $A$ spanned by only two vectors, its singular vectors must be of the form $\alpha\ket\phi+\beta\ket\psi$. We then see that +$$A(\alpha\ket\phi+\beta\ket\psi)= + (\alpha +\beta \braket{\phi}{\psi})\ket\phi - + (\alpha \braket{\psi}{\phi} +\beta)\ket\psi, +$$ +and the expectation value thus reads +$$ + \langle A\rangle\equiv (\alpha^*\bra\phi + \beta^* \bra\psi)A(\alpha\ket\phi+\beta\ket\psi) = + (|\alpha|^2 - |\beta|^2) (1 - |\braket\phi\psi|^2).\tag1 +$$ +Now remember that the largest singular value is the largest value of $|\langle \Psi|A|\Psi\rangle|$ over all unit vectors $\ket\Psi$. From (1), we easily see that this equals $1-|\braket\phi\psi|^2$.

+

From $\on{Tr}(A)=0$ we know that the eigenvalues of $A$ are $\pm\sqrt{-\det(A)}$, and thus its singular values are equal. +We conclude that $\on{Tr}(\sqrt{A^2})=2(1-|\braket\phi\psi|^2)$.

+

Of course, the more standard argument passing through the matrix representation of $A$ in a basis $\{\ket\phi,\ket{\phi_\perp}\}$ works equally well.

+",55,,55,,7/6/2022 20:11,7/6/2022 20:11,,,,2,,,,CC BY-SA 4.0 +13521,2,,13515,8/31/2020 12:23,,1,,"

No, this isn't a Bell test. Testing for a violation of Bell's inequality requires testing over several distinct measurement bases. For a good example of Bell tests run on IBM hardware, see section II(3) here.

+

To run the circuit in the OP, just move the second $H$-gate on $q_0$ in front of the measurement on $q_2$. This will have no impact on your outcomes distribution (i.e. these two operations commute).

+

Edit: After skimming through the linked article, I would recommend caution when considering this commentary. The author, although impressive for a college junior, has some severe misconceptions regarding several important concepts.

+",8623,,8623,,8/31/2020 13:36,8/31/2020 13:36,,,,4,,,,CC BY-SA 4.0 +13522,1,,,8/31/2020 13:56,,2,898,"

I’m trying to simulate LiH using VQE. But I keep getting the error +QiskitChemistryError:PySCF is not installed +And I tried several ways to see whether my driver for the molecule was typed wrong. But couldn’t find any. I again downloaded the VQE molecule Jupyter notebook from the qiskit documentation and tried running it without any modification. It still gives me the same error. +(Running with the updated qiskit version 0.20.0 on Windows10)

+",10039,,55,,8/31/2020 21:20,6/29/2021 20:52,How to fix “QiskitChemistryError:PySCF is not installed”,,2,0,,,,CC BY-SA 4.0 +13523,2,,13522,8/31/2020 14:14,,1,,"

Typically you would need to install it through pip install pyscf, however I believe pyscf does not support Windows. If you look on their installation guide they give some instructions for installing the library, but on Windows you probably need to either use the ubuntu subsytem for Windows or set up a VM.

+",6180,,,,,8/31/2020 14:14,,,,0,,,,CC BY-SA 4.0 +13524,1,,,8/31/2020 15:20,,3,274,"

I'm trying to implement a circuit for Quantum Amplitude Estimation in Qiskit using elementary gates.

+

I have created the circuit that represent my algorithm $A$ but now from the theory I know that I have to create the Q-operator defined as: $Q = A S_0 A^{-1} S_{\psi_{0}}$ , where $S_0$ and $S_{\psi_{0}}$ are two reflections.

+

How can I implement these two reflections in the circuit using Qiskit gates?

+


+UPDATE +
+I built a quantum circuit for reproducing an algorithm $A$ for computing expected value of a random variable, given by:

+
    +
  1. Load a random variable X as a quantum state
  2. +
+

$$ +L|0\rangle_n = |\psi\rangle_n = \sum_{i=0}^{2^n - 1}\sqrt{p_i} |i\rangle_n +\ \ \ such \ that \ \sum_{i=0}^{2^n - 1}p_i = 1 +$$

+
    +
  1. Create an operator for the encoding
  2. +
+

$$ +F|i\rangle_n |0\rangle = \sqrt{1 - f(i)} |i\rangle_n |0\rangle + \sqrt{f(i)} |i\rangle_n |1\rangle +$$

+

So my algorithm $A$ is given by the final state:

+

$$ +F (L|0\rangle_n)|0\rangle = F|\psi\rangle_n|0\rangle = \sum_{i=0}^{2^n-1} \sqrt{1 - f(i)} \sqrt{p_i} |i\rangle_n |0\rangle + \sum_{i=0}^{2^n-1} \sqrt{f(i)} \sqrt{p_i} |i\rangle_n |1\rangle +$$ +
+I used 3 qubits for loading distribution and one ancilla qubit; so my Qiskit circuit is the following +

+

From this I would create $Q$ operator for Amplitude Estimation. +How can I procede?

+",12747,,12747,,9/29/2020 13:58,9/29/2020 13:58,How to define Q-operator in Quantum Amplitude Estimation,,1,0,,,,CC BY-SA 4.0 +13525,2,,13522,8/31/2020 15:22,,0,,"

I was able to run PySCF on Windows by first downloading Visual studio installer. After installing it, you have to install desktop development with C++ in there and it'll solve your issue most probably.

+",12897,,,,,8/31/2020 15:22,,,,0,,,,CC BY-SA 4.0 +13527,1,13542,,8/31/2020 16:52,,1,143,"

How do quantum gates work on qubits in the physical world?

+

What are different ways through which qubits can be manipulated in the physical world?

+

For example, by analogy a classical NOT gate uses electric volts as signals to change the state of the input bit to a (classical) NOT gate.

+

Accordingly, how would one implement an $X$ gate acting on a qubit?

+",9660,,55,,9/1/2020 22:29,9/1/2020 22:29,How do quantum gates work on qubits in the physical world?,,1,0,,,,CC BY-SA 4.0 +13528,1,,,8/31/2020 17:09,,4,1213,"

I was going through the qiskit textbook and in this chapter I came across a statement under the topic "Kickback with the T-gate" related to the Controlled-Z gate that

+
+

the controlled-Z rotation gates are symmetrical in fashion (two controls instead of a control and a target). There is no clear control or target qubit for all cases.

+
+

What does it imply exactly?

+

+",13105,,10480,,2/8/2021 17:09,2/8/2021 18:12,controlled-Z rotation gates in symmetrical fashion,,2,2,,,,CC BY-SA 4.0 +13529,1,13533,,8/31/2020 23:32,,3,1030,"

I am trying to produce any arbitrary superposition state of two qubits, for example $a|00\rangle + b|01\rangle + c|10\rangle + d|11\rangle$, such that $a^2 + b^2 + c^2 + d^2 = 1$ . How can I do that with Qiskit?

+

One way that I have found out is to use $U_3(\theta, 0, 0)$ gates for suitable values of $\theta$ on both of the qubits. Is there another way?

+",12785,,55,,9/1/2020 22:29,9/1/2020 22:29,How can I create an arbitrary superposition state of two qubits in Qiskit?,,3,0,,,,CC BY-SA 4.0 +13530,1,,,9/1/2020 0:04,,3,149,"

What is the best way to handle parametric circuits in Qiskit? When I create a variational form like TwoLocal and then do var_form.parameters it returns a set but that is an unordered structure so I fear that it will give me different results upon different calls.

+

Here is what I have:

+
var_form = TwoLocal(num_qubits=4,
+                       rotation_blocks=["ry","rx"],
+                       entanglement_blocks=["cx"],
+                       entanglement="full",
+                       reps=1,
+                       skip_final_rotation_layer=False,
+                       insert_barriers=True)
+
+parameters=np.random.random(var_form.num_parameters)
+param_dict={}
+for i in range(var_form.num_parameters):
+    param_dict[list(var_form.parameters)[i]]=parameters[i]
+
+

Here is what I want:

+
def get_var_form(parameters):
+    """parameters is a list like [0,1,2,3,4....]"""
+    
+    ## 
+    # DO MAGIC HERE 
+    var_form = TwoLocal(num_qubits=4,
+                       rotation_blocks=["ry","rx"],
+                       entanglement_blocks=["cx"],
+                       entanglement="full",
+                       reps=1,
+                       skip_final_rotation_layer=False,
+                       insert_barriers=True)
+    
+    #I want to insert parameters----->var_form
+    ##
+    
+    return var_form #with given parameters
+
+

How can I do this?

+",5620,,55,,9/1/2020 22:28,1/29/2021 23:07,What is the best way to handle parametric circuits in Qiskit?,,1,0,,,,CC BY-SA 4.0 +13531,1,13556,,9/1/2020 0:45,,9,888,"

Why exactly is machine learning on quantum computers different than classical machine learning? Is there a specific difference that allows quantum machine learning to outperform classical machine learning?

+",13092,,55,,3/11/2021 10:09,3/11/2021 10:09,What is the advantage of quantum machine learning over traditional machine learning?,,2,0,,,,CC BY-SA 4.0 +13532,1,13536,,9/1/2020 1:04,,2,439,"

I've seen a similar question asked (How do I compute the square root of the $Y$ gate?) but I'm trying to understand how I can use the gates $Y^{\frac{1}{2}}$ or $Y^{\frac{1}{4}}$ in Qiskit in terms of other building blocks, if it is possible.

+

Is there a way to use the gate $Y^{\frac{1}{2}} = \begin{bmatrix} +\frac{1}{2} + + \frac{1}{2}i & -\frac{1}{2} - \frac{1}{2}i\\ +\frac{1}{2} + \frac{1}{2}i & \frac{1}{2} + \frac{1}{2}i +\end{bmatrix}$ in Qiskit? I can say that $Y = iRY(\pi)$ and compute the square root manually, but how can I describe such an operation, if possible, in Qiskit?

+",12088,,,,,9/1/2020 4:36,Principal square root of Pauli Y gate in Qiskit?,,1,0,,,,CC BY-SA 4.0 +13533,2,,13529,9/1/2020 3:21,,5,,"

qiskit.quantum_info has a useful random_statevector function that you can use to generate a random statevector that's sampled from the uniform measure. +For a 2-qubit state, you would call it as follows:

+
from qiskit.quantum_info import random_statevector
+state = random_statevector(4) # note: the parameter you pass is the number of entries in the vector, not the number of qubits
+
+

Once you have this statevector, the initialize function lets you initialize your qubits to the state you just created. The documentation for initialize is not very helpful so here's how you would use it:

+
from qiskit import QuantumCircuit
+qc = QuantumCircuit(2)
+qc.initialize(state.data, [0,1])
+
+

Note that you will have to use state.data to get the underlying array representing the statevector, because initialize doesn't accept an argument of type StateVector.

+

Hope this helps!

+",8955,,8955,,9/1/2020 5:28,9/1/2020 5:28,,,,0,,,,CC BY-SA 4.0 +13534,1,13541,,9/1/2020 3:23,,2,450,"

Consider two quantum states $\rho$ and $\sigma$ and the probability distributions induced by measuring both of them in the standard basis. Let’s call the probability distributions $p_{\rho}$ and $p_{\sigma}$ respectively. What is the relation between the trace distance between $\rho$ and $\sigma$ and the total variation distance between $p_{\rho}$ and $p_{\sigma}$?

+",1351,,55,,9/1/2020 22:15,9/3/2020 7:54,Relationship between trace distance and total variation distance,,1,1,,,,CC BY-SA 4.0 +13535,1,13537,,9/1/2020 3:37,,1,1290,"

I have a question regarding modifying Qiskit circuits. I have a set of circuits that are pretty similar to each other. The only difference being some gates in the beginning of each circuit. I was wondering if instead of creating new circuits each time, I could just append gates to the beginning of the circuit. However, currently, all the methods I am aware of that act on the QuantumCircuit only append to the end of the circuit.

+

Is there a way I can add certain gates to the beginning of a Qiskit Circuit as opposed to creating new ones each time?

+",11644,,9006,,9/1/2020 7:00,10/1/2020 8:01,Can I append gates in a certain position in a Qiskit circuit,,1,0,,,,CC BY-SA 4.0 +13536,2,,13532,9/1/2020 4:36,,1,,"

For some reason this took a while to find, but has a simple solution:

+
circ.append(YGate().power(1/2), [qbit])
+
+

Where circ is the QuantumCircuit object and qbit is the register to apply the gate on.

+",12088,,,,,9/1/2020 4:36,,,,0,,,,CC BY-SA 4.0 +13537,2,,13535,9/1/2020 6:59,,1,,"

Have a look at Introduction to Coding Quantum Algorithms: A Tutorial Series Using Qiskit.

+

In lesson 2, there is a lot of statements allow you manipulate circuits. You can add a gate on specific place, delete a gate, combine circuits etc.

+

The manual I refer to is very easy to understand. Each manipulation is documented with examples.

+

Concerning combining of the circuit, you can use this statement:

+
newCircuit = oldCircuit1 + oldCircuit2
+
+

or

+
newCircuit = oldCircuit2 + oldCircuit1
+
+

So, you can easily add one circuit to the end or the begin of another circuit.

+",9006,,,,,9/1/2020 6:59,,,,0,,,,CC BY-SA 4.0 +13538,2,,13506,9/1/2020 7:10,,1,,"

Elaborating more on the previous answer, here is a proof that it's indeed not possible.

+

Let us assume that there is a unitary $ U $ acting on qubit $a$ and on $m$ ancillary qubits such that $U\Big(|s \rangle \otimes |0 \rangle^m_{anc}\Big)$ is the desired output. Then on inputs $|+ \rangle, |- \rangle$ the outputs are

+
    +
  • $U\Big(|+ \rangle \otimes |0 \rangle^m_{anc}\Big) = |+ \rangle \otimes |\phi_+ \rangle_{anc} $
  • +
  • $U\Big(|- \rangle \otimes |0 \rangle^m_{anc}\Big) = |- \rangle \otimes |\phi_- \rangle_{anc} $
  • +
+

So we may write +$$U = |+ \rangle \langle +| \otimes W_+ + |- \rangle \langle -| \otimes W_-$$ +where $W_{\pm} |0 \rangle^m = |\phi_{\pm} \rangle $.

+

On input $|1 \rangle$ we have the output state +$$ |\chi \rangle = U\Big(|1 \rangle \otimes |0 \rangle^m_{anc}\Big) = \frac{1}{\sqrt{2}} \Big(|+ \rangle \otimes |\phi_+ \rangle_{anc} - |- \rangle \otimes |\phi_- \rangle_{anc}\Big)$$ +and since we want the qubit to be in $|1 \rangle$ state, it must hold that +$$ \langle \chi| \Big( |1 \rangle \langle 1| \otimes \mathbb{1} \Big) |\chi \rangle = 1 \implies \text{Re}\{\langle \phi_+ | \phi_- \rangle\} = 1 \implies |\phi_+ \rangle = |\phi_- \rangle := |\phi \rangle$$ +But +$$ U\Big(|0 \rangle \otimes |0 \rangle^m_{anc}\Big) = \frac{1}{\sqrt{2}} \Big(|+ \rangle \otimes |\phi_+ \rangle_{anc} + |- \rangle \otimes |\phi_- \rangle_{anc}\Big) = |0 \rangle |\phi \rangle_{anc}$$ +so finally $U\Big(|s \rangle \otimes |0 \rangle^m_{anc}\Big) = |s \rangle \otimes |\phi \rangle_{anc}$ and $U$ does not flip $a_0, a_1$.

+

To overcome this impossibility, you may want to obtain an algorithm that has the desired output state only with some success probability. A solution towards this direction is the following: if you can obtain two copies of the input state $|s \rangle$, then

+
    +
  1. Apply amplitude amplification on the first copy to amplify the amplitude of $|0 \rangle$ state.

    +
  2. +
  3. Apply an X gate on the second copy and then a Controlled-X (control is the first copy). Now the state is $ c_0 |0 \rangle X|s \rangle + c_1 |1 \rangle |s \rangle $.

    +
  4. +
  5. Measure the first qubit. If it's zero, then the state of the second qubit is in the correct state ($X|s \rangle$). If it's one, then there is some error probability but this will be small since from step 1, $|c_0|^2$ will be big if $a_0 \neq 0 $.

    +
  6. +
+",13109,,,,,9/1/2020 7:10,,,,0,,,,CC BY-SA 4.0 +13539,2,,13529,9/1/2020 11:10,,3,,"

Putting my answer here just for completeness. +Initialise 2 qubits with random state in a quantum circuit, that's it, you will have what you need. After that you can use statevector_simulator to verify the final superposition state. You can also use plot_bloch_multivector to view it.

+

I made code a bit verbose for clarity.

+

Code

+
from qiskit import QuantumCircuit, Aer, execute
+from qiskit.quantum_info.states.random import random_statevector
+from qiskit.extensions import Initialize
+from qiskit.visualization import plot_bloch_multivector
+
+state_backend = Aer.get_backend('statevector_simulator')
+
+def initrstate(qc, label=""):
+   state = random_statevector((2,1)).data
+   print(state) # if you want to see what state you have initialized the qubit to
+   init = Initialize(state)
+   init.label = label
+   return init
+
+def viewstate(qc):
+   result = execute(qc, state_backend).result()
+   fstate = result.get_statevector()
+   print(fstate) # This will be the superposition state
+   return fstate
+
+qc = QuantumCircuit(2)
+init1 = initrstate(qc)
+init2 = initrstate(qc)
+qc.append(init1, [0])
+qc.append(init2, [1])
+
+plot_bloch_multivector(viewstate(qc)) #Plot the state vectors on the bloch sphere
+
+",13102,,13102,,9/1/2020 11:16,9/1/2020 11:16,,,,0,,,,CC BY-SA 4.0 +13540,2,,13530,9/1/2020 12:30,,1,,"

This is what I came up with:

+
param_dict={}
+for i in range(var_form.num_parameters):
+    param_dict[list(var_form.ordered_parameters)[i]]=parameters[i]
+
+ansatz=var_form.bind_parameters(param_dict)
+
+

maybe its not the best way, but it works...

+",5620,,,,,9/1/2020 12:30,,,,1,,,,CC BY-SA 4.0 +13541,2,,13534,9/1/2020 13:07,,3,,"

A bound on the total variation distance

+

Rammus already provided a short answer, but I'd like to elaborate a bit on why this is the case. This is basically the proof of theorem $9.1$ on page $405$ of Nielsen & Chuang. Note that they call the total variation distance the (classical) trace distance, to draw the connection to the quantum trace distance.

+

For any two states $\rho$ and $\sigma$, let the trace distance be $D(\rho, \sigma) = \frac{1}{2}\mathrm{tr}|\rho - \sigma|$ (eq. $9.11$, page $403$). Furthermore, let $\{E_{m}\}$ be any POVM such that $p_{m} = \mathrm{tr}(\rho E_{m})$ and $q_{m} = \mathrm{tr}(\sigma E_{m})$, where I've slightly changed your notation to ease the analysis. Note that in your case $\{E_{m}\}$ is just the collection of projectors on the standard basis.

+

Note that $|\rho - \sigma|$ means $\sqrt{(\rho - \sigma)^{\dagger}(\rho - \sigma)}$ and is not a number; if we take the trace of this operator it of course becomes a number.

+

The classical trace distance between $\{p_{m}\}$ and $\{q_{m}\}$ is (eq. $9.1$, page $400$): +\begin{equation} +D(p_{m},q_{m}) = \frac{1}{2} \sum_{m}|p_{m} - q_{m}| = \frac{1}{2} \sum_{m}|\mathrm{tr}(E_{m}(\rho - \sigma))|. +\end{equation}

+

The most straightforward answer to your question: Theorem $9.1$ can be rephrased to say:

+

\begin{equation} +D(p_{m},q_{m}) \leq D(\rho, \sigma) +\end{equation}

+

Why 'exactly'?

+

The classical trace distance looks a bit like the quantum trace distance, but not completely. The important detail to note is that for any $E_{m}$: +\begin{equation} +|\mathrm{tr}(E_{m}(\rho - \sigma))| \leq \mathrm{tr}(E_{m}|\rho - \sigma|). +\end{equation} +This holds, because (and I again quote Nielsen & Chuang, eq. $9.25-9.27$ (page $405$)), we can always write $\rho - \sigma = Q - S$ for some positive operators $Q$ and $S$ with orthogonal support, meaning that $|\rho - \sigma| = Q + S$.

+

Proof of the above statements

+

We know that both $\rho$ and $\sigma$ are positive and Hermitian; this means that $A = \rho - \sigma$ is also Hermitian, now with both positive and negative (but real!) eigenvalues. That is, $A$ has eigenvalue-eigenvector pairs $(\lambda_{i},|\psi_{i}\rangle)$, with some $\lambda_{i} \geq 0$ and the others less than zero. Also, $\langle \psi_{i}| \psi_{i'}\rangle = \delta_{ii'}$. Splitting the spectrum of $A$ into the positive part $\{\lambda_{+}\}$ and negative part $\{\lambda_{-}\}$, we can write for $A$:

+

\begin{equation} +\begin{split} +A = \sum_{i}\lambda_{i} |\psi_{i}\rangle \langle \psi_{i} | &= \sum_{i\in +}\lambda_{i} |\psi_{i}\rangle \langle \psi_{i} | + \sum_{i \in -}\lambda_{i} |\psi_{i}\rangle \langle \psi_{i} | \\ +&= \sum_{i\in +}\lambda_{i} |\psi_{i}\rangle \langle \psi_{i} | - \sum_{i \in -} |\lambda_{i}| |\psi_{i}\rangle \langle \psi_{i} | \\ +&= Q - S, +\end{split} +\end{equation} +where both $Q = \sum_{i\in +}\lambda_{i} |\psi_{i}\rangle \langle \psi_{i} |$ and $S = \sum_{i \in -}|\lambda_{i}| |\psi_{i}\rangle \langle \psi_{i} |$ are positive operators, with completely orthogonal support. It is now easy to verify that $|\rho - \sigma| = Q + S$. Moreover, by construction we have $\rho - \sigma = Q - S$.

+

We can now write:

+

\begin{equation} +\begin{split} +|\mathrm{tr}(E_{m}(\rho - \sigma))| &= |\mathrm{tr}(E_{m}(Q - S))|\\ +&= |\mathrm{tr}(E_{m}Q) - \mathrm{tr}(E_{m}S)| \\ +& \leq \mathrm{tr}(E_{m}Q) + \mathrm{tr}(E_{m}S) = \mathrm{tr}(E_{m}(Q+S)) \\ +&= \mathrm{tr}(E_{m}|\rho - \sigma|)), +\end{split} +\end{equation}

+

which proves our equation above.

+

Back to the problem at hand

+

In the end, we can now combine the two equations: +\begin{equation} +\begin{split} +D(p_{m},q_{m}) &= \frac{1}{2} \sum_{m}|p_{m} - q_{m}| = \frac{1}{2} \sum_{m}|\mathrm{tr}(E_{m}(\rho - \sigma))| \\ +& \leq \frac{1}{2} \sum_{m}\mathrm{tr}(E_{m}|\rho - \sigma|) = \frac{1}{2} \mathrm{tr}|\rho - \sigma| = D(\rho, \sigma). +\end{split} +\end{equation} +where the last identity holds because $\{E_{m}\}$ is a POVM and thus $\sum_{m} E_{m} = I$.

+

Of course there is a particular POVM $\{E_{m}\}$ for which the bound is saturated, but it is highly dependent on both $\rho$ and $\sigma$; it is very unlikely that this is exactly the standard basis.

+",8141,,8141,,9/3/2020 7:54,9/3/2020 7:54,,,,3,,,,CC BY-SA 4.0 +13542,2,,13527,9/1/2020 13:52,,3,,"

This really depends on the technology that the qubits are built upon. For example, IBM has chosen to build superconducting transmon qubits which are controlled through microwave pulses. And by varying the amplitude and shape of the pulses they are able to implement the specified gates. I would suggest looking into this youtube series by QuTech that gives a general overview of the current state of the art. I'd also reccommend taking a look at this circuit session by Nathan Earnest-Noble that gives a brief overview of the transmon qubits and an intro to Qiskit OpenPulse.

+",5620,,,,,9/1/2020 13:52,,,,2,,,,CC BY-SA 4.0 +13543,1,13659,,9/1/2020 13:53,,6,620,"

The book Quantum Computing and Quantum Information by Nielsen and Chuang is a well-known and celebrated text book that can act as a resource in a wide variety of topics. Of course, in such a vast textbook there might arise small errors.

+

Its own preface (at least in the $10$th anniversary edition) addresses this as well, and links to the website http://www.squint.org/qci/ for a list of errata and requests any newly found errors to be send to qci@squint.org. Neither links are still functional, let alone maintained.

+

There is also the list of errata to be found on the website of Dr. Nielsen, although this doesn't seem to be maintained anymore either: there is a time-stamp from back in $2014$ and the list refers to the first until the fifth print of the book, which is not the last print of the book.

+

A google search provides some other resources, sometimes PDF documents, which all seem to be one version or another of the list of errata linked above.

+

My question is: Is there (still) an 'official' or 'semi-official' list of errata, preferably for the $10$th anniversary edition, and also preferably still being maintained?

+

As a follow up question, is there also a way to notify the maintainers about any as of yet unnoticed errors?

+",8141,,,,,1/25/2021 10:59,Is there any 'official' list of errata for Nielsen & Chuang?,,1,1,,,,CC BY-SA 4.0 +13544,1,13545,,9/1/2020 14:19,,2,173,"

I'm trying to wrap my head around the expectation argument in Qiskit's VQE class, so to understand it I'm trying to create an ExpectationBase object to understand it better, but I'm getting nowhere. Can anyone give a hand?

+",5620,,55,,9/1/2020 22:13,9/1/2020 22:13,How to build an ExpectationBase object?,,1,0,,,,CC BY-SA 4.0 +13545,2,,13544,9/1/2020 15:43,,2,,"

The VQE computes the expectation values of the input operator with respect to the parameterized ansatz circuit. There are different ways to compute this expectation value, e.g. you could

+
    +
  • convert operator to a matrix, the ansatz circuit to a statevector and compute the dot-product, or
  • +
  • convert the operator to Pauli strings, diagonalize the ansatz circuit in each basis of the Pauli strings and measure.
  • +
+

The expectation argument allows you to choose the kind of expectation computation you want to use.

+
    +
  • qiskit.aqua.operators.MatrixExpectation does the dot product
  • +
  • qiskit.aqua.operators.PauliExpectation does the Pauli string transform (this is what you would do on real quantum hardware)
  • +
  • qiskit.aqua.operators.AerPauliExpectation uses a special expectation value from Qiskit's Aer element
  • +
+
+

A bit more advanced:

+

If you were to create your own kind of expectation computation you can check how MatrixExpectation or PauliExpectation are implemented. They require some knowledge of how the operator flow in Aqua works though. In brief, the ExpectationValue provides a convert method that maps an operator expression that realizes the expectation value (something like OperatorMeasurement @ StateFn) to a new expression that implements your expectation value scheme. For MatrixExpectation this means converting all operators to matrices and for PauliExpectation this means converting the operator to Pauli strings and applying the right basis transformations to the ansatz circuit.

+",9800,,,,,9/1/2020 15:43,,,,4,,,,CC BY-SA 4.0 +13546,1,13550,,9/1/2020 15:56,,3,130,"

Given many copies of some unknown quantum state $\rho$, I would like to compute its von Neumann entropy $S(\rho)$. What algorithm could be used for this that minimizes the number of copies required? We require that the estimate of the entropy has to be $\varepsilon-$close and one will need more copies as $\varepsilon\rightarrow 0$.

+

The naive solution is to do tomography and obtain a classical description of the state. This would require exponentially many copies as we increase the dimension of $\rho$. But the classical description of the state has a lot more information so perhaps there is a smarter way?

+",13114,,55,,9/10/2020 11:48,9/10/2020 11:48,How can one estimate the von Neumann entropy of an unknown quantum state?,,1,2,,,,CC BY-SA 4.0 +13547,1,,,9/1/2020 16:15,,8,223,"

In Trotterization, the typical Hamiltonian considered is:

+

$$ H = \sum_{p, q} h_{pq} a^{\dagger}_p a_q + \sum_{p, q, r, s} a^{\dagger}_p a^{\dagger}_q a_r a_s $$

+

Which is then converted into a sequence of gates by the Jordan Wigner transformation.

+

However, how do we choose the ordering of the $ pq$ and $pqrs$ terms? For example, if our Hamiltonian was:

+

$$ H = (a^{\dagger}_1 a_2 + a^{\dagger}_2 a_1) + (a^{\dagger}_2 a_3 + a^{\dagger}_3 a_2) + (a^{\dagger}_1 a^{\dagger}_2 a_2 a_3 + a^{\dagger}_3 a^{\dagger}_2 a_2 a_1)$$

+

There are at least $ 3! = 6$ ways to order the Hamiltonian, a number which quickly explodes as the size of the Hamiltonian grows.

+

Note that the terms don't have clean commutation rules - sometimes the terms will commute or anticommute. Is there an approach to ordering the Hamiltonian that maximizes simulation accuracy?

+",8343,,8343,,9/2/2020 14:47,2/22/2021 14:50,Impact of ordering Hamiltonian terms for Trotterization,,1,6,,,,CC BY-SA 4.0 +13548,1,13553,,9/1/2020 16:18,,4,361,"

Suppose we have a depolarizing channel operation +$$E(\rho)=\frac{p}{2}\textbf{1}+(1-p)\rho$$ +acting on a Spin$\frac{1}{2}$ density matrix of the form $\rho=\frac{1}{2}(\textbf{1}+\textbf{s}\cdot\textbf{$\sigma$})$. I have found the Kraus operators to be: +$$E_1=\sqrt{\left(1-\frac{3}{4}p\right)}\textbf{1}, E_2=\frac{\sqrt{p}}{2}\sigma_x,E_3=\frac{\sqrt{p}}{2}\sigma_y \text{ and } E_4=\frac{\sqrt{p}}{2}\sigma_z$$ +I am now supposed to find the unitary matrix U such that the Operation can be expressed in a bigger system i.e. after adding a System S. As far as I understand it, the new operation can be written as: +$$E(\rho)=\sum_kE_k\rho E_k^\dagger=\text{Tr}_S(U\rho\otimes\rho_EU^\dagger)$$ +Supposing the new system S is prepared on a state $|e_0\rangle$, How do I find the correct unitary matrix?

+

I appreciate your cooperation.

+
+

Crossposted to physics: https://physics.stackexchange.com/questions/576952/how-to-find-the-unitary-operation-of-a-depolarizing-channel

+",13115,,55,,9/1/2020 21:57,9/1/2020 21:57,How to find the unitary operation of a depolarizing channel?,,1,2,,,,CC BY-SA 4.0 +13549,1,,,9/1/2020 16:27,,0,383,"

I was installing the editable version of qiskit-terra from source in my conda environment using the following command

+
pip install -e .
+
+

and I got the following error:

+
ERROR: Command errored out with exit status 1:
+ command: 'C:\Users\Tanya Garg\Anaconda3\envs\fixissueenv\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Tanya Garg\\qiskit-terra\\setup.py'"'"'; __file__='"'"'C:\\Users\\Tanya Garg\\qiskit-terra\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
+     cwd: C:\Users\Tanya Garg\qiskit-terra\
+Complete output (13 lines):
+running develop
+running egg_info
+writing qiskit_terra.egg-info\PKG-INFO
+writing dependency_links to qiskit_terra.egg-info\dependency_links.txt
+writing requirements to qiskit_terra.egg-info\requires.txt
+writing top-level names to qiskit_terra.egg-info\top_level.txt
+reading manifest file 'qiskit_terra.egg-info\SOURCES.txt'
+reading manifest template 'MANIFEST.in'
+warning: no files found matching 'test\python\pickles\*.pickle'
+writing manifest file 'qiskit_terra.egg-info\SOURCES.txt'
+running build_ext
+building 'qiskit.transpiler.passes.routing.cython.stochastic_swap.utils' extension
+error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
+
+

What does this error mean and how can I address it?

+",13116,,13117,,9/4/2020 11:39,9/4/2020 11:41,Command errored out with exit status 1 while installing the editable env for qiskit terra,,1,0,,,,CC BY-SA 4.0 +13550,2,,13546,9/1/2020 16:32,,1,,"

Similar ideas with Quantum PCA may be useful. Meaning, apply Quantum Phase Estimation on unitary $e^{-i\rho t}$ to obtain estimates of the eigenvalues of $\rho$ and finally estimate von Neumann entropy as $S(\rho) = -\sum \tilde{\lambda_i} \text{log}\tilde{\lambda_i}$. In the original paper there is the claim that you obtain estimates of the eigenvalues with accuracy $O(\epsilon)$ from $O(\frac{1}{\epsilon^3})$ copies of $\rho$.

+",13109,,,,,9/1/2020 16:32,,,,1,,,,CC BY-SA 4.0 +13551,2,,13529,9/1/2020 17:09,,2,,"

Adding my answer as well to fill out the other suggestions. You can use this to construct a circuit based on an arbitrary state vector: https://qiskit.org/documentation/stubs/qiskit.aqua.circuits.StateVectorCircuit.construct_circuit.html#qiskit.aqua.circuits.StateVectorCircuit.construct_circuit

+

You initialize StateVectorCircuit with your array of complex values.

+",4966,,,,,9/1/2020 17:09,,,,0,,,,CC BY-SA 4.0 +13552,2,,13524,9/1/2020 17:14,,2,,"

Short answer:

+

Check out qiskit.aqua.algorithms.amplitude_estimators.q_factory.QFactory which constructs $Q$ if you provide it with $A$. You can use the i_objective argument to specify the "good" state in $S_{\Psi_0}$.

+

Long answer:

+

The $S_0$ operation is flips the sign of the $|0\rangle$ state and leaves all the others in place. This can be implemented with a multi-controlled Z gate with X gates around the target gate, so it applies a -1 factor to $|0\rangle$ and not $|1\rangle$. In Qiskit, you can do that with the QuantumCircuit.mcx method and Hadamard gates around that (since there's no mcz method and HXH = Z):

+
from qiskit import QuantumCircuit
+s0 = QuantumCircuit(n)
+s0.x(n - 1)
+s0.h(n - 1)
+s0.mcx(list(range(n - 1)), n - 1)
+s0.h(n - 1)
+s0.x(n - 1)
+
+

The $S_{\Psi_0}$ operation, called the oracle in Grover's algorithm, applies a -1 factor to the "good" qubit states. This requires additional information, how do you determine if a state is "good" or "bad" in your scenario?

+

As an example: In many optimization examples we define the operator $A$ as +$$ +A|0\rangle^{\otimes (n + 1)} = \sqrt{1 - a} |\psi_0\rangle|0\rangle + \sqrt{a} |\psi_1\rangle|1\rangle +$$ +for $n$-qubit states $|\psi_{0,1}\rangle$. There we define good states by the last qubit begin in state $|1\rangle$ and hence the circuit for $S_{\Psi_0}$ is just a $Z$ gate on the last qubit:

+
s_psi0 = QuantumCircuit(n + 1)
+s_psi0.z(n)
+
+

In the amplitude estimation algorithm, the QFactory class (full import qiskit.aqua.algorithms.amplitude_estimators.q_factory.QFactory) is used, which constructs $Q$ if you provide it with $A$. There it assumes that the good state can be specified by the a single qubit begin in state $|1\rangle$. The index of this qubit is specified via i_objective (per default the last qubit index is used).

+

The above example, where the "good" state is specified by the last qubit being in state $|1\rangle$ would therefore be

+
from qiskit.aqua.algorithms.amplitude_estimators.q_factory import QFactory
+q = QFactory(your_a_factory)
+
+",9800,,,,,9/1/2020 17:14,,,,2,,,,CC BY-SA 4.0 +13553,2,,13548,9/1/2020 17:55,,5,,"

From N&C: Assuming the environment is in some pure state we recall that Kraus representations comes from the unitary evolution $$\sum_{k}E_k\rho E_k^*=\sum_k \langle e_k |U\left(\rho\otimes|e_0\rangle \langle e_0|\right)U^*|e_k\rangle$$ for some unitary $U$. So we need a unitary such that $E_k=\langle e_k|U|e_0\rangle$. We can pick $$U=\begin{pmatrix} E_1 & \cdots & \cdots & \cdots \\ E_2 & \cdots & \cdots & \cdots \\ \vdots & \cdots & \cdots & \cdots \\ E_n & \cdots & \cdots & \cdots\end{pmatrix}$$ in the basis for $e_k$. To find your unitary you just need to find the remaining entries that make the resulting matrix unitary (this should be possible).

+

More uniquely, each Kraus representation has a Stinespring dilation, which is merely an isometry $V$ such that $$\sum_{k}E_k\rho E_k^*=tr_S(V\rho V^*)$$ and now $V$ can be written as the matrix $$V=\begin{pmatrix} E_1 \\ E_2 \\ \vdots \end{pmatrix}$$ in the basis for $e_k$, and you don't need to worry about the degrees of freedom on the environment. This freedom in the unitary determining the Kraus representations comes from the fact that there are many equivalent kraus representations of the same unitary representation (there is more about this in N&C).

+",11793,,11793,,9/1/2020 18:19,9/1/2020 18:19,,,,2,,,,CC BY-SA 4.0 +13554,2,,13323,9/1/2020 18:42,,2,,"
+

I do not understand how if some quantum states $\rho, \sigma \in \mathbb{C}^n \otimes \mathbb{C}^m$ +then how can their addition not be in $\mathbb{C}^n \otimes \mathbb{C}^m$?

+
+

The author is not claiming that this is false. This is certainly true, you are right about that!

+
+

In a [text][1] (section 3.6 page 92) about noiseless subsystems by D. Lidar, it is mentioned:'A subsystem is a tensor factor in a tensor product, and this does not have to be a subspace (e.g., in general it is not closed under addition).'

+
+

The author is saying that there are non-subspace structures (i.e. tensor factors) which have the noiseless property. The point is kind of abstract but it comes from the notion that $\mathbb{C}^n$ isn't naturally a subspace of $\mathbb{C}^n\otimes \mathbb{C}^m$. However, this doesn't mean you can't think of a way to think of $\mathbb{C}^n$ as a subspace, it just means you need to fix something in $\mathbb{C}^m$ to do so.

+

More to the point, if you did want to think about $\mathbb{C}^n$ as a subspace of $\mathbb{C}^n\otimes \mathbb{C}^m$ you would need to fix a basis of $\mathbb{C}^m$ and identify how the basis of $\mathbb{C}^n$ gets mapped to the basis of $\mathbb{C}^n\otimes \mathbb{C}^m$. It's because of this "identication requirement" these noiseless subsystems are not technically subspaces.

+

Ultimately, the difference between noiseless subspace and noiseless subsystem is subtle, but I hope to illustrate the difference with an example. Encoding a single qubit into a noiseless subspace of a 2-qubit space can be given by the mapping $$\alpha|0\rangle+\beta|1\rangle \mapsto \alpha|0\rangle_1|0\rangle_2+\beta|1\rangle_1|1\rangle_2$$ this encoding can be seen as a linear (or subspace) endcoding as we are mapping a basis of $\mathbb{C}^2$ to a basis of $\mathbb{C}^2\otimes \mathbb{C}^2\cong \mathbb{C}^4$. Now, consider an encoding of a qubit of the form +$$\alpha|0\rangle+\beta|1\rangle \mapsto (\alpha|0\rangle_1+\beta|1\rangle_1)\otimes |\psi\rangle_2 $$ where $|\psi\rangle_2$ is an arbitrary qubit in the second space of $\mathbb{C}^2\otimes \mathbb{C}^2$. This encoding is into the first subsystem and is not a subspace encoding because we have not fixed the state of the second system in the tensor product (this makes the encoding non-linear and that's why its not the same as a subspace encoding). That being said, if we did fix $|\psi\rangle_2$ to be a specific element of $\mathbb{C}^2$ then we would get a subspace encoding like the first example, just in a different basis.

+",11793,,11793,,9/2/2020 18:16,9/2/2020 18:16,,,,5,,,,CC BY-SA 4.0 +13555,2,,13549,9/1/2020 20:33,,4,,"

It looks like the error message suggests to install Microsoft Visual C++ 14.0 or greater by following the link: https://visualstudio.microsoft.com/visual-cpp-build-tools/ . So I would first check to see if you have Microsoft Visual C++ and what version of that you do have, and if you don't have it or have an older version, then try exiting your conda environment, installing/updating it, and installing the editable version of qiskit-terra again with the commands taken from the Qiskit documentation at https://qiskit.org/documentation/contributing_to_qiskit.html#install-qiskit-terra :

+
conda activate name-of-env
+pip install cython
+pip install -r requirements-dev.txt
+pip install -e .
+
+

Make sure that you are in the qiskit-terra directory before you execute these commands.(If you have already installed cython and the developer requirements, then you can skip those commands.)

+",13117,,,,,9/1/2020 20:33,,,,0,,,,CC BY-SA 4.0 +13556,2,,13531,9/1/2020 22:24,,4,,"

Potentially, the same advantage that quantum computing can provide over classical computing. By "quantum machine learning", in the way you seem to be using the term here, people usually refer to quantum algorithms developed to solve tasks usually handled by machine learning, that is, very roughly speaking, pattern recognition tasks (though in the quantum case algorithms aimed at performing linear algebra operations are also included in the category).

+

Just as there are tasks for which quantum algorithms are known to, or promise to provide enhancement over classical computers, think Grover's or Shor's, one can hope pattern recognition tasks can be similarly sped up. That's pretty much the point of quantum machine learning, also often referred to as "quantum-enhanced machine learning" in this context, to distinguish it from applications of classical machine learning to quantum information tasks, which is an entirely different field of study.

+

See also this question and links therein.

+",55,,,,,9/1/2020 22:24,,,,4,,,,CC BY-SA 4.0 +13557,1,,,9/2/2020 0:54,,3,126,"

What is the complexity of the quantum unconstrained binary optimization (QUBO) algorithm in the number of queries to the quantum processor?

+

To clarify, I'm asking about the complexity on quantum annealers.

+",13118,,55,,9/4/2020 9:28,9/4/2020 9:28,What is the query complexity of the QUBO algorithm?,,0,4,,,,CC BY-SA 4.0 +13558,1,,,9/2/2020 8:44,,6,2322,"

I want to construct an ansatz circuit in Qiskit, so I need some parameters to act on the gates (e.g. RX(a), RY(b)). In the Qiskit tutorials I find a way to implement a parameter:

+
import numpy as np
+
+theta_range = np.linspace(0, 2 * np.pi, 128)
+circuits = [qc.bind_parameters({theta: theta_val})
+            for theta_val in theta_range]
+circuits[-1].draw()
+
+

There is only one parameter, theta. I want more parameters in the some range. How can I achieve that?

+",12877,,55,,9/4/2020 9:29,11/8/2021 7:29,How to add several parameters in qiskit circuit?,,1,1,,,,CC BY-SA 4.0 +13559,2,,13558,9/2/2020 9:03,,6,,"

You can create an arbitrary number of parameters in your circuit by using the qiskit.circuit.Parameter class. Here's a brief example

+
from qiskit.circuit import Parameter, QuantumCircuit
+
+# define your parameters
+a, b, c = Parameter('a'), Parameter('b'), Parameter('c')
+
+circuit = QuantumCircuit(2)
+circuit.rx(a, 0)  # RX(a) on qubit 0
+circuit.ry(b, 0)  # RY(b) on qubit 1
+circuit.crz(c, 0, 1)  # CRZ(c) controlled on qubit 0, acting on qubit 1
+
+# bind the values
+bound_circuit = circuit.bind_parameters({a: 0, b: 1, c: 2})
+
+# or if you have a list of values
+a_vals = [0, 1, 2, 3]
+b_vals = [1, 2, 3, 4]
+c_vals = [2, 3, 4, 5]
+bound_circuits = [circuit.bind_parameters(
+    {a: a_val, b: b_val, c: c_val}) 
+     for (a_val, b_val, c_val) in zip(a_vals, b_vals, c_vals)]
+
+

For convenience there's also the ParameterVector class to construct multiple parameters at once. The above example can also look like

+
from qiskit.circuit import ParameterVector, QuantumCircuit
+
+# define your parameters
+p = ParameterVector('p', 3)  
+
+circuit = QuantumCircuit(2)
+circuit.rx(p[0], 0)  # RX(p[0]) on qubit 0
+circuit.ry(p[1], 0)  # RY(p[1]) on qubit 1
+circuit.crz(p[2], 0, 1)  # CRZ(p[2]) controlled on qubit 0, acting on qubit 1
+
+# bind the values
+bound_circuit = circuit.bind_parameters({p: [0, 1, 2]})
+
+# or for a list of values
+values = [ [0, 1, 2], [1, 2, 3], [2, 3, 4] ]
+bounds_circuits = [circuit.bind_parameters({p: val for val in values})
+
+",9800,,9800,,11/8/2021 7:29,11/8/2021 7:29,,,,12,,,,CC BY-SA 4.0 +13560,1,,,9/2/2020 11:08,,2,604,"

I'm a quantum beginner, and I really need some examples to help me understand quantum computing. In particular, how to get the ground energy of Hubbard or using model with VQE in Qiskit.

+

Code examples would be great.

+",12877,,55,,9/4/2020 9:29,9/4/2020 9:29,Examples of VQE on Qiskit,,1,0,,,,CC BY-SA 4.0 +13561,2,,13560,9/2/2020 11:21,,2,,"

Did you have a look to the following chapters in the Qiskit Textbook?

+ +",1859,,,,,9/2/2020 11:21,,,,2,,,,CC BY-SA 4.0 +13562,1,,,9/2/2020 11:47,,1,73,"

I am reading about the noise models that can be simulated in Qiskit and I found out the phase_amplitude_damping_error function. I read about it and it seems to be a function that simulates a combined dephasing and generalized amplitude damping channel (amplitude damping with finite temperature). I am pretty sure that the function implements such channel. However, I am wondering where do the Kraus operators that are described there come from (it is a Kraus rank 6 channel), as I have not been able to find any bibliography regarding such combined channel.

+",2371,,10480,,4/30/2021 2:05,4/30/2021 2:05,Qiskit function phase_amplitude_damping_error,,0,0,,,,CC BY-SA 4.0 +13563,1,13574,,9/2/2020 14:08,,6,784,"

I'm not sure if this is a good question for the site, but here goes.

+

On the "Quantum logic gate" Wikipedia page, it is said that:

+
+

The $\sqrt{\mathrm{SWAP}}$ gate is not, however maximally entangling; more than one application of it is required to produce a Bell state from product states.

+
+

I'm a bit confused by this remark, its definition for the gate in the $|00\rangle, |01\rangle, |10\rangle, |11\rangle$ basis is +$$ +\sqrt{\mathrm{SWAP}} = \begin{bmatrix} +1 & 0 & 0 & 0 \\ +0 & \frac{1}{2}(1+i) & \frac{1}{2}(1-i) & 0 \\ +0 & \frac{1}{2}(1-i) & \frac{1}{2}(1+i) & 0 \\ +0 & 0 & 0 & 1 \\ +\end{bmatrix} \,. +$$

+

It seems like if I apply the gate on the product state $|01\rangle$ I should end up with something proportional to $\frac{1}{\sqrt2}|01\rangle - \frac{i}{\sqrt2}|10\rangle$ which looks maximally entangled to me? Am I misunderstanding something?

+",13110,,55,,9/2/2020 14:56,9/3/2020 17:08,"Is the square root of SWAP gate ""maximally entangling""?",,2,8,,,,CC BY-SA 4.0 +13565,1,13572,,9/2/2020 14:40,,6,448,"

One can rattle off names of implementations of Superconducting Qubits, transmon qubits, etc

+

For example, see Physical realizations used by Google

+

But NV centre Qubits as in this question, Is there any company that backs and implements diamond vacancy quantum computers? have no large company spending money on it.

+

Any research on it is relegated to academia or the companies in stealth mode.

+

What about its implementation makes it unattractive?

+

One would think that since it operates at near room temperatures should make it more appealing? +For reference See Quantum computing book by Nielsen and Chuang

+

Disclaimer This question is completely produced by a comment in this answer.

+",462,,8623,,9/2/2020 21:11,9/3/2020 8:15,Why isn't NV-center-based quantum computing mainstream?,,1,0,,,,CC BY-SA 4.0 +13566,2,,13563,9/2/2020 15:00,,0,,"

$$\sqrt{SWAP}|01\rangle\ = \frac{1+i}{2}|01\rangle + \frac{1-i}{2}|10\rangle$$

+

$$\sqrt{SWAP}(\frac{1+i}{2}|01\rangle + \frac{1-i}{2}|10\rangle)=\frac{1+i}{2}(\frac{1+i}{2}|01\rangle + \frac{1-i}{2}|10\rangle)+\frac{1-i}{2}(\frac{1-i}{2}|01\rangle + \frac{1+i}{2}|10\rangle)$$

+

$$=\frac{i}{2}|01\rangle+\frac{1}{2}|10\rangle-\frac{i}{2}|01\rangle+\frac{1}{2}|10\rangle=|10\rangle$$

+

completing the action of the SWAP gate. Repeated application is only going to transition between these two possibilities. I don't believe, given a product state like you have shown, you can generate entanglement via multiple applications, like the article states. As for why it is not being called maximally entangling, I think it's due to coefficients being complex, as opposed to real for the bell states. So this seems more like the editor of that sections personal definition.

+",4991,,4991,,9/2/2020 15:57,9/2/2020 15:57,,,,7,,,,CC BY-SA 4.0 +13568,1,13569,,9/2/2020 15:53,,2,88,"

Analogous to this question Is there any company that backs and implements diamond vacancy quantum computers?

+",462,,55,,9/2/2020 18:51,9/2/2020 18:51,Is there any company trying out ion trap qubits?,,1,0,,,,CC BY-SA 4.0 +13569,2,,13568,9/2/2020 16:26,,3,,"

IonQ, Honeywell, and Infineon Technologies (list here).

+

From my understanding, IonQ and Honeywell seem to be leading in the trapped ion space

+",8343,,,,,9/2/2020 16:26,,,,0,,,,CC BY-SA 4.0 +13572,2,,13565,9/2/2020 18:48,,7,,"

I suspect that fabrication challenges play a significant role in limiting broader interest. Growing single crystal diamonds is notoriously difficult, but not the primary impediment here. Rather, controlling the spatial distribution of NV centers in a diamond lattice with sufficient precision to produce a scalable and controllable network of qubits seems to be currently out of reach. David Awschalom discusses this briefly here.

+

In addition to spatial distribution, orientation of the NV center relative to the nitrogen impurity may also need to be controlled for certain applications. Complicating the matter further, the final position and orientation of the NV center in the lattice is only fixed after an annealing process during which the lattice damage (from ion implantation) is repaired and the NV center is allowed to migrate to one of the nitrogen impurity's four nearest neighbors.

+

Despite the difficulties, it seems highly likely that NV centers, or similar semiconductor impurities (there are at least seven other possibilities, see, e.g., here), will play an important role in quantum computing. These systems have some very attractive qualities that will likely be leveraged more as fabrication processes improve.

+

One of the most striking qualities is extremely long coherence times made possible by coupling NV center electron spins to surrounding nuclear spins through hyperfine interactions. Relatively recently, Tim Taminiau's group showed a 75 second coherence time for a single qubit state here. The system described in that paper uses the NV center plus 9 surrounding nuclear spins (one ${}^{14}$N plus eight ${}^{13}$C) to create a fully connected 10-qubit register. That's 10 connected qubits from a single NV center, very impressive!

+

As a final note, Awschalom (from the videos linked above) is a leading expert on this topic and runs a group at Chicago doing great work in this space. Awschalom is also Director of Q-Next, which just received commitments for \$115M in funding from the DOE, plus \$93M in private money. Hopefully with Awschalom at the helm this funding will help drive NV Center technology towards maturity.

+",8623,,8623,,9/3/2020 8:15,9/3/2020 8:15,,,,0,,,,CC BY-SA 4.0 +13573,1,,,9/2/2020 18:55,,3,130,"

In the paper by Brassard, Hoyer, Tapp (1998) on Quantum Counting we have the following expression for the state:

+

$$|Y\rangle =\sum_{i\in\mathbb{Z}}x_i|i\rangle |Y_i\rangle.$$

+

Now we have a quantum algorithm $\mathcal{A}$. Then we have the operator $S_0^{\phi}$ which changes the phase of the state by a factor of $\phi$ if and only the first register holds a zero. The paper goes into more detail about the setup.

+

Lemma 1 claims that

+

$$\mathcal{A}S_0^{\phi}\mathcal{A}^{-1}|Y\rangle=|Y\rangle-(1-\phi)\langle Y|\mathcal{A}|0\rangle ^*\mathcal{A}|0\rangle.$$

+

How is this lemma arising? What is the proof for that lemma?

+",12480,,55,,9/3/2020 8:11,5/28/2021 1:35,"Lemma 1 in the paper by Brassard, Hoyer, Tapp (1998) on Quantum counting",,2,1,,,,CC BY-SA 4.0 +13574,2,,13563,9/2/2020 19:50,,4,,"

It seems like the article you're referencing is defining "maximally entangling" as "capable of producing Bell states from product states". However there are other ways to describe how much entanglement an operator $U$ introduces into a state.

+

One definition that I like but haven't had much success with is the "entangling power" introduced in [1], which describes the maximum entropy resulting from applying the operation to a bipartite input state (note that $|\psi\rangle,|\phi\rangle$ are each defined over two-qubit systems): +$$ +K_E(U) \equiv \max_{|\psi\rangle,|\phi\rangle}E\left(U |\psi\rangle|\phi\rangle \right) +$$

+

where $E$ is the Von Neumann entropy of the partial trace state. The article computes the entangling power of $CNOT$ as 1 ebit and entangling power of $SWAP$ as 2 ebits.

+

Another way to describe operator entanglement is the operator Schmidt rank of [2,3], which just finds the number of nonzero coefficients in the decomposition

+

$$ +V = \sum_{j=0}^3 c_j \sigma_j \otimes \sigma_j +$$ +where $V$ is related to $U$ by local rotations only. Then the Schmidt rank of $CNOT$ is 2 and the Schmidt rank of $SWAP$ is 4.

+

So to address your question, I believe its impossible to construct a Bell state starting from a separable two-qubit state and using only $SWAP$'s for entanglement, but both of the definitions above suggest that the $SWAP$ gate is capable of creating more entanglement than a $CNOT$ in at least some sense. This suggests that the definition of "maximally entangling" provided is either inconsistent or poorly defined or both. As for how much entanglement $\sqrt{SWAP}$ produces, you might look into computing either of the quantities defined above for a more rigorous (albeit less conceptual) answer.

+
+

[1] (Shen and Chen, 2018) Entangling power of two-qubit unitary operations. https://iopscience.iop.org/article/10.1088/1751-8121/aad7cb

+

[2] (Nielsen, 2002) Quantum dynamics as a physical resource. https://journals.aps.org/pra/abstract/10.1103/PhysRevA.67.052301

+

[3] (Nielsen, 2000) Quantum Information Theory. https://arxiv.org/abs/quant-ph/0011036

+",1939,,1939,,9/3/2020 17:08,9/3/2020 17:08,,,,4,,,,CC BY-SA 4.0 +13575,2,,13513,9/3/2020 0:33,,5,,"

There are several startups that have formed around QC-assisted drug discovery. The ones listed below have resources on their websites that you might find helpful.

+ +

For a general understanding of molecular simulation, Simulating Molecules using VQE from the Qiskit Textbook is a great resource if you're generally familiar with QC (if not, you may want to start with Nielsen and Chuang for the fundamentals).

+

If you're interested in more general state of the art molecular simulation research, Google has been putting out some high quality (and high pedagogical value) papers in the context of FeMoco simulation (see, e.g. here).

+",8623,,,,,9/3/2020 0:33,,,,1,,,,CC BY-SA 4.0 +13576,1,,,9/3/2020 2:36,,1,18,"

100 runs of 1 shot each were executed one by one over a single qubit initialised with 0 (default) and no quantum gate implemented on top of it. All measurement results were found to be noise free i.e. 100% of measurements yielded 0. +However, runs with 100 shots rarely yield 100% accuracy.

+",13127,,,,,9/3/2020 2:36,Do we expect similar results in form of measurement histogram for both (1 run with 100 shots) and (100 runs with 1 shot each)?,,0,1,,,,CC BY-SA 4.0 +13578,1,,,9/3/2020 6:43,,1,171,"

I am trying to understand what exactly happens in QAOA. I am reading this blog which says,

+
+

We would be just repetitively applying $U_C$. But once we got into a state which is the eigenstate of $H_C$ we wouldn’t get any further. This is basic linear algebra — if we apply an operator to its eigenvector, it can change its length, but not direction. The same applies if we had a $H_B$ which commutes with $H_C$. So we need this intermediate step of applying $H_B$ which allows us to escape from the local minimum. How do we make sure we escape it? Well, that’s where the classical optimization loop is useful – we try to find the right values of the parameters $β$ and $γ$ which make it happen.

+
+

I want to know what do they mean by local minimum?

+

It also says,

+
+

It doesn’t need to be just $\sum_i^N \sigma_i^x$. We want it to be something that does not commute with $H_C$ and this choice of $H_B$ meets this requirement and is super easy to implement.

+
+

What does that mean?

+

$H_C$ is the cost hamiltonian which corresponds to the objective function to be optimized and $H_B$ is the operator which is summation of Pauli-z operators on $i$-th qubit. $H_B$ is the mixing operator.

+",13129,,55,,9/3/2020 20:32,9/4/2020 17:25,"What is meant by ""local minimum"" in QAOA?",,1,7,,,,CC BY-SA 4.0 +13579,1,13588,,9/3/2020 7:05,,1,82,"

In PyQuil, a qubit is initialised as $|0\rangle$ by default. Suppose, I want to initialise a qubit in an arbitrary state, say $\frac{1}{\sqrt{3}}|0\rangle+\sqrt{\frac{2}{3}}|1\rangle$. How to do this arbitrary qubit initialisation in PyQuil?

+",11572,,55,,9/4/2020 9:49,9/4/2020 9:49,How to create a qubit in an arbitrary state in PyQuil,,1,0,,,,CC BY-SA 4.0 +13580,2,,13573,9/3/2020 7:31,,1,,"

First observe that

+

\begin{align*} +S_0^{\phi} +&= \phi \cdot |0 \rangle \langle 0| \otimes \mathbb{1} + |1 \rangle \langle 1| \otimes \mathbb{1} \\ +&= \phi \cdot |0 \rangle \langle 0| \otimes \mathbb{1} + \Big(\mathbb{1} - |0 \rangle \langle 0|\Big) \otimes \mathbb{1} \\ +&= \mathbb{1} \otimes \mathbb{1} - (1 - \phi) \cdot |0 \rangle \langle 0| \otimes \mathbb{1} +\end{align*}

+

So it holds that

+

\begin{align*} +\mathcal{A} S_0^{\phi} \mathcal{A}^{-1} |Y \rangle +&= |Y \rangle - (1 - \phi) \cdot \mathcal{A} \Big(|0 \rangle \langle 0| \otimes \mathbb{1}\Big) \mathcal{A}^{-1}|Y \rangle \\ +&= |Y \rangle - (1 - \phi) \cdot \mathcal{A} \Big(|0 \rangle \otimes \mathbb{1}\Big) \Big(\langle 0| \otimes \mathbb{1}\Big) \mathcal{A}^{-1}|Y \rangle \\ +&= |Y \rangle - (1 - \phi) \cdot \mathcal{A} \Big(|0 \rangle \otimes \mathbb{1}\Big) \Big(\langle Y| \mathcal{A} \Big(|0 \rangle \otimes \mathbb{1}\Big)\Big)^{\dagger} +\end{align*} +and with an "abuse of notation" the two expressions are equal.

+",13109,,,,,9/3/2020 7:31,,,,4,,,,CC BY-SA 4.0 +13581,1,13594,,9/3/2020 7:35,,0,91,"

Is it possible to implement a quantum gate from a matrix in Q#, the equivalent of unitary function in Qiskit ? My final goal is to implement cirq CZPowGate in Q#.

+

Thank you.

+",12910,,55,,9/4/2020 9:50,9/4/2020 16:58,How to implement quantum gate from matrix in Q#,,1,0,,,,CC BY-SA 4.0 +13582,1,,,9/3/2020 9:27,,3,69,"

We all know the current form of Schroedinger's equation. Due to some new observations, let's say it gets modified in a way that a correction term gets added. What are the ramifications for Quantum computing?

+

Note I am not talking about relativistic or other corrections already present.

+",462,,55,,9/3/2020 12:11,9/3/2020 12:11,What happens to Quantum computing if Schroedingers equation gets a correction term to account for some new changes in fundamental physics?,,0,3,,9/4/2020 11:47,,CC BY-SA 4.0 +13584,1,13585,,9/3/2020 14:24,,2,287,"

+

This is a simulation I did in my program. I'm hoping to print out the probability of the state $|0001\rangle$ (which is $0.052$), and store this number in a letter (a). How can I do this? Thanks!!

+",12334,,1859,,11/23/2020 9:49,11/23/2020 9:49,How can I print out the probability of a certain state in histogram?,,1,0,,,,CC BY-SA 4.0 +13585,2,,13584,9/3/2020 15:13,,3,,"

.get_counts() returns a dictionary with the keys being the measured state and their corresponding values being the number of times that result was measured. To get the number of times that state was measured you can do:

+
print(counts['0001'])
+
+

To get probability, you need to divide this by the total number of shots. If you're not sure of the number of shots, you can sum the total number of shots in the dictionary using:

+
sum(counts.values())
+
+

and from this print the probability:

+
print(counts['0001'] / sum(counts.values()))
+
+",10415,,,,,9/3/2020 15:13,,,,1,,,,CC BY-SA 4.0 +13586,1,13587,,9/3/2020 15:19,,3,115,"

Let $\Phi\in\mathrm T(\mathcal X,\mathcal Y)$ be a quantum channel, $\Phi:\mathrm{Lin}(\mathcal X)\to\operatorname{Lin}(\mathcal Y)$. +We define its Choi representation as the operator $J(\Phi)\in \mathrm{Lin}(\mathcal{Y})\otimes \mathrm{Lin}(\mathcal{X})$ defined by +$$J(\Phi) = (\Phi\otimes I) \,d\,\mathbb P_+= \sum_{a,b}\Phi(E_{a,b})\otimes E_{a,b},\tag1$$ +where $\mathbb P_+\equiv \lvert +\rangle\!\langle +|$ with $\sqrt d|+\rangle=\sum_i |i,i\rangle$, and $E_{a,b}\equiv |a\rangle\!\langle b|$.

+

One way to retrieve the map from the Choi, used for example in Watrous, Eq. (2.66), is +$$\Phi(X) = \operatorname{Tr}_{\mathcal X}[J(\Phi)(I_{\mathcal Y}\otimes X^T)].\tag2$$ +Verifying the equivalence between these two isn't too hard: +$$ + \operatorname{Tr}_{\mathcal X}[J(\Phi)(I_{\mathcal Y}\otimes X^T)] + = \sum_{a,b} \operatorname{Tr}_{\mathcal X} [ + \Phi(E_{a,b})\otimes E_{a,b} X^T + ] + = \Phi(X). +$$

+

More generally, this gives us a way to associate to each bipartite state $\rho$ a map $\Phi_\rho$ such that $J(\Phi_\rho)=d\,\rho$, and if $\operatorname{Tr}_{\mathcal Y}\rho=I/d$, then $\Phi_\rho$ is trace-preserving (and thus CPTP).

+

In (Horodecki, Horodecki, Horodecki 1998) the authors mention another way to associate a map to a state $\rho$. Writing its eigendecomposition as $\rho=\sum_i p_k \mathbb P_{\psi_k}$, and writing with $\psi$ the operator whose vectorisation is $|\psi\rangle$, i.e. $\operatorname{vec}(\psi)\equiv |\psi\rangle$, we have $|\psi_k\rangle=(\psi_k\otimes I)\,\sqrt d |+\rangle$, and thus +$$\rho = \sum_k p_k (\psi_k \otimes I) \,d\,\mathbb P_+(\psi_k^\dagger\otimes I) + = (\Phi_\rho\otimes I) \mathbb P_+,\tag3$$ +where $\Phi_\rho(X) = d\sum_k p_k \psi_k X \psi_k^\dagger.$

+

I presume (2) and (3) should be equivalent, provided $d \,\rho=J(\Phi)$. What's a good way to show this equivalence?

+",55,,10480,,1/31/2021 20:50,1/31/2021 20:50,Equivalence of two ways to recover a map from its Choi state,,1,4,,,,CC BY-SA 4.0 +13587,2,,13586,9/3/2020 15:19,,1,,"

The goal is to start from a bipartite state $\rho$, and find the channel $\Phi_\rho$ such that $J(\Phi_\rho)=d\, \rho$.

+

The goal is, given $J(\Phi)$, to show that we can retrieve $\Phi$ via (3) rather than (2). In other words, that (2) is equivalent to +$$\Phi(X) = d\sum_k p_k \psi_k X \psi_k^\dagger,$$ +where $p_k$ are the eigenvalues of $J(\Phi)/d$ and $\psi_k$ the (unvectorised operators corresponding to the) eigenvectors of $J(\Phi)/d$. +We, therefore, wish to show that +$$d\sum_k p_k \psi_k X \psi_k^\dagger = \operatorname{Tr}_{\mathcal X}[J(\Phi)(I_{\mathcal Y}\otimes X^T)].$$ +Writing $J(\Phi)=d \sum_k p_k \mathbb P_{\psi_k}$, we get from the RHS: +$d\sum_k p_k \operatorname{Tr}_{\mathcal X}[\mathbb P_{\psi_k}(I_{\mathcal Y}\otimes X^T)]$. +We therefore only need to show that, for all $k$, +$$\psi_k X \psi_k^\dagger = \operatorname{Tr}_{\mathcal X}[\mathbb P_{\psi_k}(I_{\mathcal Y}\otimes X^T)].$$ +This can be proven directly analysing the matrix components, or again applying the previous trick to write $\mathbb P_{\psi_k}=(\psi_k\otimes I)\mathbb P_+(\psi_k^\dagger\otimes I)$.

+",55,,,,,9/3/2020 15:19,,,,0,,,,CC BY-SA 4.0 +13588,2,,13579,9/3/2020 15:38,,1,,"

As far as I know, you can only do this with the ReferenceDensitySimulator, which contains a set_initial_state method. This is unfortunate because density matrix simulation is very costly.

+

In your case:

+
from pyquil import Program
+from pyquil.simulation import ReferenceDensitySimulator
+from pyquil.pyqvm import PyQVM
+from pyquil.gates import I
+
+state_ket = np.array([1/np.sqrt(3), np.sqrt(2/3)])
+state_bra =  np.array([[1/np.sqrt(3)], [np.sqrt(2/3)]])
+
+rho1 = state_ket * state_bra
+
+prog = Program(I(0))
+qam = PyQVM(n_qubits=1, quantum_simulator_type=ReferenceDensitySimulator)
+
+# must call reset() to change the current state of the density matrix
+density_matrix = qam.wf_simulator.set_initial_state(rho1).reset()
+qam.execute(prog)
+np.testing.assert_array_equal(qam.wf_simulator.density, rho1)
+
+",362,,,,,9/3/2020 15:38,,,,0,,,,CC BY-SA 4.0 +13589,1,13590,,9/3/2020 18:14,,3,210,"

$\newcommand{\expterm}[0]{\frac{-iH(t_2 - t_1)}{\hbar}} +\newcommand{\exptermp}[0]{\frac{iH(t_2 - t_1)}{\hbar}}$Nielsen & Chuang (10th edition, page 82) states that $H$ is a fixed Hermitian operator known as the Hamiltonian. In exercise 2.54, we prove that if $A$ and $B$ are commuting Hermitian operators, then the following holds: +$$ +\exp(A)\exp(B)=\exp(A+B) \tag{1}\label{1} +$$

+

The goal is to prove +$$\exp \left[ \expterm \right] \exp \left[ \exptermp \right] = I.\tag{2}\label{2}$$ +If $\expterm$ is Hermitian, then we can plug $A=\expterm$ and its Hermitian conjugate $B = \exptermp$ into \eqref{1} to prove \eqref{2}. However, I don't see why $\expterm$ is necessarily Hermitian. Take $H=I$ for example: $H$ is Hermitian but $\expterm$ is not, so we can't use \eqref{1}. Any thoughts?

+",12643,,,,,9/4/2020 7:58,Nielsen & Chuang Exercise 2.55: Prove that $\exp \left[ -\frac{iH(t_2 - t_1)}{\hbar} \right]$ is unitary,,1,2,,,,CC BY-SA 4.0 +13590,2,,13589,9/3/2020 20:44,,6,,"

If $H$ is Hermitian, then $iH$ is not Hermitian, but rather skew-Hermitian: $(iH)^\dagger = -i H^\dagger =-iH$.

+

Still, the identity in (1) holds generally for commuting matrices, they don't have to be Hermitian:

+

$$e^{A+B} = \sum_{k=0}^\infty \frac{(A+B)^k}{k!}=\sum_{k=0}^\infty \frac{1}{k!} \sum_{j=0}^k \binom{k}{j} A^j B^{k-j} = \sum_{k=0}^\infty \sum_{j=0}^k \frac{A^j B^{k-j}}{j! (k-j)!} +\\ = \sum_{n,m=0}^\infty \frac{A^n B^m}{n! m!} = e^A e^B,$$ +where the commutativity was necessary to use Newton's formula in the second step, and in the penultimate step we changed the summation variables with $n=j, m=k-j$.

+

More generally, $e^A$ is unitary if $A$ is skew-Hermitian, as $$(e^A)^\dagger e^A = e^{A^\dagger} e^A = e^{-A}e^A=I,$$ +and similarly for $e^{A}(e^A)^\dagger=I$. +Vice-versa, for any unitary $U$ there is always a skew-Hermitian $A$ such that $U=e^A$, see this question on math.SE.

+

See also this similar question on math.SE.

+",55,,55,,9/4/2020 7:58,9/4/2020 7:58,,,,0,,,,CC BY-SA 4.0 +13592,1,,,9/4/2020 4:25,,2,161,"

I would like to know about the mathematical relations among T1, T2, frequency, readout error, and single-qubit error?

+

+

This screenshot is from the ibmq-16 Melbourne excel data file.

+",13138,,55,,9/4/2020 17:16,8/16/2022 2:02,"Need mathematical Calculation of input(T1,T2,f) and output(Readout Error)",,1,1,,,,CC BY-SA 4.0 +13594,2,,13581,9/4/2020 16:58,,1,,"

There's a feature request for a Q# operation to apply an arbitrary unitary operation given its representation as a matrix; if you're interested, please go on and leave a comment on that request!

+

In the meantime, though, it's actually really straightforward to implement the same unitary operation as cirq.CZPowGate in Q#.

+
open Microsoft.Quantum.Math as Math;
+
+operation ApplyCZPow(t : Double, control : Qubit, target : Qubit) : Unit is Adj + Ctl {
+    Controlled R1([control], (t * Math.PI(), target));
+}
+
+

This uses the R1 operation provided with the Microsoft.Quantum.Intrinsic namespace together with the Controlled keyword to apply the same rotation as cirq.CZPowGate.

+
+

To see how this works, note that as per the Cirq documentation for CZPowGate, that instruction is represented by the unitary matrix +$$ +U_{\text{CZPowGate}}(t) = \left(\begin{matrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 1 & 0 \\ +0 & 0 & 0 & e^{i \pi t} +\end{matrix}\right). +$$ +This is a special case of a controlled operation with a single control qubit, as it has the pattern +$$ +\Lambda(U) = \left(\begin{matrix} +𝟙 & 0 \\ +0 & U +\end{matrix}\right) = |0\rangle\langle0| \otimes 𝟙 + |1\rangle\langle1| \otimes U +$$ +for some unitary matrix $U$. In particular, $U$ in this case represents a rotation that leaves the $|0\rangle$ state alone but that applies a phase to the $|1\rangle$ state; precisely the action of the R1 operation.

+

In Q#, the Controlled keyword can be used to get the controlled version of any controllable operation (that is, an operation with is Ctl in its signature). Each Controlled operation takes as its first input an array of controls, and takes all of the original inputs to the uncontrolled operation as the second input. For example, CNOT(control, target) in Q# is shorthand for Controlled X([control], target). +Similarly, a Toffoli in Q# can be written as Controlled X([control1, control2], target) and the Fredkin operation can be written as Controlled SWAP([control], (target1, target2)).

+

Using the same pattern here works since R1 is a controllable operation. We can check that we get what we expect by using the Microsoft.Quantum.Diagnostics.DumpOperation operation to check the unitary representation of our new ApplyCZPow operation (run online without installing):

+
open Microsoft.Quantum.Diagnostics as Diag;
+
+operation DumpApplyCZPow(t : Double) : Unit {
+    Diag.DumpOperation(2, ApplyToFirstTwoQubitsCA(ApplyCZPow(t, _, _), _));
+}
+
+

+",1978,,,,,9/4/2020 16:58,,,,2,,,,CC BY-SA 4.0 +13595,2,,13578,9/4/2020 17:25,,1,,"
+

I want to know what do they mean by local minimum?

+
+

In general any optimization problem's goal is to either maximize or minimize the objective function.
+The local minimums are the candidate solutions to your optimization problem. Same as in the blog that you've mentioned!

+

In general, QAOA (Quantum Approximate Optimization Algorithm) tries to solve same optimization problems but with a different approach than classical algorithms.

+

There is this nice video from D-Wave in which they explain, in an abstract level, how optimization problems could be solved using characteristics (minimal energy state) of quantum systems.

+",9318,,,,,9/4/2020 17:25,,,,1,,,,CC BY-SA 4.0 +13596,1,13602,,9/4/2020 18:01,,3,144,"

I am just starting to get up to speed with quantum computing via the Quiskit learning path: online tutorial

+

Here they explain the Dirac notation and use it to describe quantum states as elements in $\mathbb{C}^2$ (square could be for the initial lesson but my question holds in n.

+

i.e a quantum state $| a \rangle = \begin{pmatrix}a_1 \\ a_2 \end{pmatrix}$ where $a_1, a_2 \in \mathbb{C}$

+

Shortly after this the concept of the basis is introduced, with the x, y and z examples given. Their orthonormality is stressed. In all three cases this 'basis' is two dimensional.

+

So as a concrete example $ \{| 0 \rangle , | 1 \rangle \}$ is given as an orthonormal basis for the space to describe and measure quantum states.

+

Clearly this pair of basis is not an orthonormal basis of $\mathbb{C}^2$ so I understand there may be additional constraints on the space of possible valid quantum states. But then I have not yet seen why it is necessary to embed this apparently two dimensional space into teh 4-dimension $\mathbb{C}^2$.

+

We have touched on the Bloch Sphere which is a two dimensional representation of pure states but that is derived from the two dimensional orthonormal basis rather than the other way around - but perhaps this is a more profound representation of the space than it seems at this point.

+

What is the reason we both need a 4-dimensional space to describe our possible quantum states and can work with a two dimensional basis?

+",13144,,55,,9/9/2020 12:33,9/9/2020 12:33,"when we specify quantum states in $\mathbb C^2$, why do we only have $2$ basis states?",,2,1,,,,CC BY-SA 4.0 +13598,1,,,9/4/2020 19:01,,5,135,"

The max-relative entropy between two states is defined as

+

$$D_{\max }(\rho \| \sigma):=\log \min \{\lambda: \rho \leq \lambda \sigma\},$$

+

where $\rho\leq \sigma$ should be read as $\sigma - \rho$ is positive semidefinite. There is also a smoothed version of this quantity and this is given by taking the infimum of $D_{\max}(\rho\|\sigma)$ over all states $\bar{\rho}$ which are within an $\varepsilon$ ball of $\rho$ according to some metric. For example, one may require that the trace distance between $\rho$ and $\bar{\rho}$ is at most $\varepsilon$ and define a ball this way. So we have

+

$$D^{\varepsilon}_{\max}(\rho\|\sigma) = \inf\limits_{\bar{\rho}\in\mathcal{B}^{\varepsilon}(\rho)}D_{\max}(\bar{\rho}\|\sigma)$$

+

Now consider the case where $\rho = \rho_{AB}$ (some bipartite state) and $\sigma = \rho_A\otimes\rho_B$. A quantity known as the max-information that $B$ has about $A$ is given by

+

$$I_{\max}(A:B)_\rho = D_{\max}(\rho_{AB}||\rho_A\otimes\rho_B)$$

+

Note that this is not the only definition of the max-information (there are several as shown here but they are all equivalent after smoothing). The smoothed max-information for our definition of the max-information is

+

$$I^{\varepsilon}_{\max}(A:B)_{\rho_{AB}} = \inf\limits_{\bar{\rho}_{AB}\in\mathcal{B}^{\varepsilon}(\rho_{AB})} I(A:B)_{\bar{\rho}} = \inf\limits_{\bar{\rho}_{AB}\in\mathcal{B}^{\varepsilon}(\rho_{AB})}D_{\max}(\bar{\rho}_{AB}\|\bar{\rho}_A\otimes\bar{\rho}_B)$$

+

In contrast, the smoothed max-relative entropy is

+

$$D^{\varepsilon}_{\max}(\rho_{AB}\|\rho_A\otimes\rho_B) = \inf\limits_{\bar{\rho}_{AB}\in\mathcal{B}^{\varepsilon}(\rho_{AB})} D_{\max}(\bar{\rho}_{AB}\|\rho_A\otimes\rho_B)$$

+

Are the two quantities $D^{\varepsilon}_{\max}(\rho_{AB}\|\rho_A\otimes\rho_B)$ and $I^{\varepsilon}_{\max}(A:B)_{\rho_{AB}}$ close to each other (e.g. the difference is some function of $\varepsilon$) such that they are qualitatively equivalent?

+",4831,,55,,8/11/2022 15:31,8/11/2022 15:31,Connection between smooth max-relative entropy and smooth max-information,,0,0,,,,CC BY-SA 4.0 +13601,2,,13596,9/5/2020 6:47,,3,,"

Any complex vector $v \in \mathbb{C}^n$ can be written as a linear combination +$$ +v = \sum_{i=1}^n \alpha_ib_i, +$$ +where $b_i$ are basis vectors and $\alpha_i \in \mathbb{C}$ are coefficients. Since real numbers are subset of complex ones and $\alpha_i$ are complex numbers, basis vectors can be real.

+

In your particular example, it is not problem to use basis composed of real vectors $|0\rangle$ and $|1\rangle$ since complex amplitudes are "hidden" in complex coefficients of the linear combination.

+

Regarding ortogonality, a dot product on space $\mathbb{C}^n$ for vectors $v$ and $w$, both from that space, is defined as +$$ +v \cdot w = \sum_{i=1}^n v_i w_i^*, +$$ +where $w_i^*$ is complex conjugated number to $w_i$. Since both members of vectors $|0\rangle$ and $|1\rangle$ are real, $w_i^*=w_i$ and hence these vectors are orthogonal in $\mathbb{C}^2$.

+

On the Bloch sphere. In the end you need only two parameters - angles $\theta$ and $\varphi$ since you have only two degrees of freedom. This is given by constraints imposed on qubits:

+
    +
  • lenght of a vector describing qubit is 1
  • +
  • global phase can be neglected as two qubits differing in the global phase only are physically indistinguisable
  • +
+",9006,,,,,9/5/2020 6:47,,,,1,,,,CC BY-SA 4.0 +13602,2,,13596,9/5/2020 6:52,,6,,"
+

Clearly this pair of basis is not an orthonormal basis of $C^2$...

+
+

$\{\lvert0\rangle,\lvert1\rangle\}$ is an orthonormal basis of $C^2$. $C^2$ is a 2-dimensional complex vector space, which means that every element of the space is essentially a vector of 2 complex numbers.
+$\lvert0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$, and $\lvert1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$ are both vectors in this space because 0 and 1 are also complex numbers. The vectors are also orthogonal: +$$ +\begin{aligned} +\langle0\rvert1\rangle & = \begin{pmatrix} 1\:\:0 \end{pmatrix}\begin{pmatrix} 0\\1 \end{pmatrix}\\ +& = 1(0) + 0(1)\\ +& = 0 +\end{aligned} +$$

+

About the 4-dimensional space: yes, representing 2 complex numbers requires 4 real numbers. However, keep in mind that every quantum state must be normalized. When you specify 3 of these 4 real numbers, you lose your degree of freedom in choosing the 4th one.
+Further, the global phase of a quantum state is typically ignored because it has no impact on the probability distributions associated with measurement. This additional redundancy brings down your total degrees of freedom to 2. These 2 parameters correspond to the angles $\theta$ and $\phi$ which specify a location on the surface of the Bloch Sphere.

+

I hope that answers your question...

+",8955,,,,,9/5/2020 6:52,,,,4,,,,CC BY-SA 4.0 +13604,1,13606,,9/5/2020 14:36,,5,261,"

Suppose there is some $n$-qubit state $\rho$. It is well known fact that, given some orthonormal basis $U = \{|u_i\rangle\}$, if $p_i = \langle u_i| \rho |u_i \rangle$ (that is, measuring $\rho$ with $U$ produce the result $u_i$ with probability $p_i$) and $P = (p_1,...)$, then $H(P) \geq S(\rho)$.

+

Although that statement is written in papers and even in Wikipedia, I haven't found any proper proof nor I have been able to prove it myself. +I would be glad for some help.

+",13152,,55,,9/5/2020 15:10,9/20/2020 22:37,Prove that Shannon and von Neumann entropies satisfy $H(P)\ge S(\rho)$ with $P$ diagonal of $\rho$,,3,0,,,,CC BY-SA 4.0 +13605,1,13611,,9/5/2020 15:47,,11,7122,"

I am new to qiskit and I have to simulate a quantum circuit. I read this documentation https://qiskit.org/textbook/ch-states/single-qubit-gates.html where it is left as an exercise to the reader to write a function to measure in the $|+i\rangle$ and $|-i\rangle$ or the y-basis. I want to know if I've done it correctly or not.

+

I need to measure a state in the y-basis after preparing it in an equal superposition the $|0\rangle$ and $|1\rangle$ states. To do this, I first applied the Hadamard gate which does the first part and takes the $|0\rangle$ state to the $|+\rangle$ state. Now comes the measurement part. To do this I applied an $S^\dagger$ and then the $H$ gate again.

+

Now I simply measure the state

+
def Y_measurement(qc,qubit,cbit):
+    qc.sdg(qubit)
+    qc.h(qubit)
+    qc.measure(qubit,cbit)
+    return qc
+
+circuit = QuantumCircuit(1,1)
+circuit.h(0)
+circuit.barrier()
+
+
+Y_measurement(circuit, 0, 0)
+
+circuit.draw(output='mpl') 
+
+

+

Is this correct?

+",7706,,7706,,9/6/2020 9:55,9/7/2020 6:45,How to measure in another basis,,1,0,,,,CC BY-SA 4.0 +13606,2,,13604,9/5/2020 15:48,,4,,"

This can be seen through "twirling" with a bunch of unitaries.

+

Call your density operator $\rho$. +Let $U_i$ be a unitary with $\pm 1$ on the diagonal, and zeros everywhere else when expressed in your basis. +Consider all $2^d$ such unitaries where $d$ is the dimension of your density matrix. +I leave it to you to show that $\rho_D = \frac{1}{2^d}\sum\limits_i U_i\rho U^\dagger_i$, where $\rho_D$ is the diagonal matrix with entries $p_i$.

+

Using the concavity of entropy and the unitary invariance of entropy, we have that +$$H(P) = S(\rho_D) = S\left(\frac{1}{2^d}\sum_i U_i\rho U^\dagger_i\right) \geq \frac{1}{2^d}\sum\limits_i S(U_i\rho U^\dagger_i) = S(\rho).$$

+",5669,,13152,,9/6/2020 16:55,9/6/2020 16:55,,,,5,,,,CC BY-SA 4.0 +13607,1,,,9/6/2020 0:18,,6,293,"

Denote the Haar measure on the unitary group $U(\mathcal X)$ by $\eta$. Does this equation hold (assuming the integral exists):

+

$\int d\eta(U) f(U) = \int d\eta(U) f(U^\dagger)$?

+

Intuitively this makes sense because choosing a random $U$ seems to be the same as choosing a random $U^\dagger$, but I'm not sure how to prove this.

+",13157,,13157,,9/7/2020 22:47,9/7/2020 22:47,Is the Haar measure invariant under conjugation?,,1,0,,,,CC BY-SA 4.0 +13608,1,,,9/6/2020 1:52,,6,268,"

Microsoft has its own agenda regarding quantum computer - it is topological quantum computer being invented by the team lead by Michael Freedman https://www.microsoft.com/en-us/research/project/topological-quantum-computing/

+

While this idea is very efficient implementation, it still required experimental proof of anyons. At last such proof has arrived, see New evidence that the quantum world is even stranger than we thought (original publication in Nature Physics, article Direct observation of anyonic braiding statistics).

+

My question is this: Does this experimental observation and manipulation of anyons solve the main obstacles towards topological quantum computer (e.g. as being implemented by Microsoft)? Or is any fundamental (not technical) challenge remain towards topological quantum computer?

+",1326,,9006,,9/6/2020 6:22,12/20/2020 14:23,Does this experimental discovery of anyons enables the topological quantum computer (e.g. Microsoft) to become a reality?,,1,0,,,,CC BY-SA 4.0 +13609,1,,,9/6/2020 6:05,,3,60,"

Let's say I am given access to a magical box that lets me apply a projector $|\psi\rangle \langle\psi|$, where $|\psi\rangle$ is a quantum state. I do not know anything about $|\psi\rangle$: just that I am given this magical box. Can I prepare $|\psi\rangle$, in a polynomial amount of time, using it?

+

One way to do it is: start with any arbitrary efficiently preparable quantum state, apply the projector. If the outcome is $1$, you have $|\psi\rangle$ as your post-measurement state. If not, repeat. Is this intuition correct? A problem I see with it is, the arbitrary quantum state can be almost orthogonal to $|\psi\rangle$. There is no way of knowing whether or not it would be beforehand, as we know nothing about $|\psi\rangle$. Hence, the probability of succeeding in successfully projecting onto $|\psi\rangle$ can be exponentially small, and it will take us an exponentially large time to prepare the state.

+

Also, is the opposite true? If we can efficiently prepare a state, can we efficiently project onto that state?

+",1351,,55,,9/6/2020 9:44,9/6/2020 9:44,Preparing a state given access to projector,,0,2,,,,CC BY-SA 4.0 +13610,1,,,9/6/2020 6:11,,2,271,"

I've recently tried to run this sample from Qiskit (Portfolio Optimization)

+

I was able to change RandomDataProvider to YahooDataProvider and able to run it on real stock prices.

+

However, there is one peculiar challenge I'm facing - I'm not sure if it is my lack of understanding. At this particular code

+
budget = num_assets // 2  # set budget
+penalty = num_assets      # set parameter to scale the budget penalty term
+qubitOp, offset = portfolio.get_operator(mu, sigma, q, budget, penalty)
+
+

No matter what budget or penalty I set this to, I always receive portfolio with about half of the total number of assets. +For example, if my total number of assets is 5, then my budget is 2 (from above code). The result always contains 2 assets [0 0 1 1 0]

+

If I change my budget to

+
budget = num_assets // 3
+
+

and my total assets are 5, then I expect to see only 1 asset in the resulting portfolio. However, I see 2

+

If I increase my num_assets to 10 and make

+
budget = num_assets
+
+

I still get a portfolio of 5 or 6 stocks (close to half of 10) and not a portfolio of 10.

+

Note - I'm running on qasm_simulator

+

Is there a gap in my understanding? What role do these variables - budget and penalty - play while building the portfolio?

+",13134,,55,,9/6/2020 9:42,5/10/2022 5:22,Qiskit sample - Portfolio optimization,,2,1,,,,CC BY-SA 4.0 +13611,2,,13605,9/6/2020 6:15,,11,,"

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.

+

Note that the blue Hadamard gate is used for preparing state $|+\rangle$ which is then measured. Pink gates are those needed for measuring in different basis. So, measurement in z basis needs no additional gate (left circuit), measuring in y basis needs $S^\dagger$ and $H$ additional gates (middle circuit) and measuring in x basis needs additional $H$ gate (right circuit).

+",9006,,9006,,9/7/2020 6:45,9/7/2020 6:45,,,,4,,,,CC BY-SA 4.0 +13612,2,,13610,9/6/2020 6:47,,2,,"

The budget constraint is only added as a penalty term (multiplied by ‘penalty’ coefficient) in the Hamiltonian and does not enforce equality. This means the objective function is +$$ \text{min}_{x\in\{0,1\}^n} \hspace{0.5em} q x^T \Sigma x - \mu^T x + \text{penalty} \cdot (B - 1^T x)^2$$

+",13109,,,,,9/6/2020 6:47,,,,0,,,,CC BY-SA 4.0 +13613,2,,13604,9/6/2020 9:36,,0,,"

Let $\newcommand{\ket}[1]{\lvert #1\rangle}\newcommand{\braket}[2]{\langle #1 | #2\rangle}\{\ket{u_k}\}_k$ be some orthonormal basis for the space, and define $p_k\equiv \langle u_k|\rho| u_k\rangle$. Let $\newcommand{\bs}[1]{\boldsymbol{#1}}\bs p\in\mathbb R^n$ denote the corresponding vector. Write the eigendecomposition of $\rho$ as +$$\rho = \sum_\ell \lambda_\ell |\lambda_\ell\rangle\!\langle\lambda_\ell\rvert, +\qquad \lambda_\ell\ge0, \quad \sum_\ell \lambda_\ell=1.$$ +From these, we see that +$$p_k = \sum_\ell \lambda_\ell \lvert \braket{u_k}{\lambda_\ell}\rvert^2 = \sum_\ell M_{k,\ell}\lambda_\ell \equiv (M\bs\lambda)_k,$$ +where $M_{k,\ell}\equiv \lvert \braket{u_k}{\lambda_\ell}\rvert^2$ is easily seen to be a bistochastic matrix, due to the completeness of both the bases $\{\ket{u_k}\}_k$ and $\{\ket{\lambda_\ell}\}_\ell$. +See also Schur-Horn's lemma.

+

We therefore proved that $\bs p=M\bs\lambda$ for some bistochastic matrix $M$. +This is equivalent to $\bs p\preceq \bs\lambda$, where $\preceq$ here denotes the majorization preorder. +This, in turn, implies that $H(\bs p)\ge H(\bs \lambda)$ (see e.g. this related answer on math.SE). Because by definition of the von Neumann entropy $H(\bs\lambda)=S(\rho)$, we reach the conclusion.

+",55,,55,,9/20/2020 22:37,9/20/2020 22:37,,,,0,,,,CC BY-SA 4.0 +13614,2,,13608,9/6/2020 11:12,,3,,"

This is not the first time that there is found 'experimental proof' of (non-Abelian) anyons. Note also that the article does not use the word proof but rather evidence - that's why I also used the quotation marks above.

+

Back in 2012 there supposedly was found the first experimental evidence of Majorana bound states by an observation of the zero bias peak. I say supposedly, because there were people who were actually explaining the results as something else, something less 'quantum' - I won't go into the details, partly because it is out of scope and partly because there are other people on this website with much more expertise regarding the subject.

+

Anyway, there have been new experiments by various groups, and many of these have always had some 'controversy' - other people in the field didn't always share the optimism and sometimes explained the results differently. Also (for instance) QuTech voiced concerns about their own results.

+

The result you have linked definitely looks like a very nice result on the road to topologically protected quantum computers, but I don't expect it to be the 'main' result or in the end even the only result that determines if we can make a topological quantum computer or not.

+

I haven't read the paper, but it looks like they show evidence of the thing what makes a single anyon an 'anyon' - the non-trivial phase it picks up under conjugation. This is a very good result, and definitely a necessary property of a topological qubit. However, there are other fundamental things that this system must do before it makes a quantum computer. Computations are performed using braiding of multiple anyons 'through' each other - that's at least one fundamental step above making just a single qubit (as a rule of thumb, two anyons make one qubit, but I believe that's an oversimplification). That means that to perform computations you need to braid more than two anyons together - I would say that that is equally a fundamental step as is braiding of two anyons.

+

Of course, something being shown in the lab does not mean it is at all feasible - don't gross over these technical challenges, they will prove at least as though I presume.

+",8141,,8141,,12/20/2020 14:23,12/20/2020 14:23,,,,0,,,,CC BY-SA 4.0 +13615,1,13631,,9/6/2020 17:16,,0,144,"

I'm trying to visualize a simple circuit in Qiskit. A single gate $Y$ is applied to the single-qubit register. The expected state is:

+

$$ Y |0\rangle += \begin{bmatrix} 0 & -i \\ i & 0 \end{bmatrix} \begin{bmatrix} 1 \\ 0 \end{bmatrix} += \begin{bmatrix} 0 \\ i \end{bmatrix} += i |1\rangle $$

+

Then I visualize the final state with plot_state_qsphere function (documentation). Since the coefficient of $|1\rangle$ is $i$ I'm expecting phase $\pi/2$ since $i = e^{i \pi/2}$.

+
from qiskit import *
+from qiskit.tools.visualization import plot_state_qsphere
+print(qiskit.__qiskit_version__) # {'qiskit-terra': '0.15.1', 'qiskit-aer': '0.6.1', 'qiskit-ignis': '0.4.0', 'qiskit-ibmq-provider': '0.8.0', 'qiskit-aqua': '0.7.5', 'qiskit': '0.20.0'}
+circuit = QuantumCircuit(1)
+circuit.y(0)
+statevector = execute(circuit, backend=Aer.get_backend('statevector_simulator')).result().get_statevector()
+print(statevector) # [0.-0.j 0.+1.j]
+plot_state_qsphere(statevector)
+
+

In this representation, $\pi/2$ phase corresponds to green color. However, I visualize the red color ($0$ phase). Is it a known bug? Am I missing something?

+

+",1874,,55,,9/6/2020 17:32,9/7/2020 14:25,Qiskit plot_state_qsphere phase error,,1,4,,,,CC BY-SA 4.0 +13616,1,,,9/6/2020 22:17,,1,88,"

I was wondering if there is any good references where I could read to understand the construction of Unitary Operators such as the Diffuse Operator in Grover's Algorithm.

+

I am looking to build my own set of unitary operators with the objective of boosting the amplitude of specific quantum states for which there is no access to oracles to perform the phase flip prior to the inversion about the mean.

+",12302,,,,,9/7/2020 8:20,Alternative Grover's Diffuse Operator,,1,0,,9/11/2020 15:11,,CC BY-SA 4.0 +13617,1,13620,,9/7/2020 4:56,,1,202,"

I wonder what is a Qiskit stabilizer and why we need it. Also I want to know the difference between stabilizer and extended stabilizer.

+",10028,,9006,,9/7/2020 6:48,9/7/2020 6:59,What is a Qiskit stabilizer,,1,0,,,,CC BY-SA 4.0 +13618,1,,,9/7/2020 6:49,,2,43,"

Do I need to download Qiskit separately or can I learn and write programs as well as practically view possible visualizations in IBM Quantum Experience itself?

+",13172,,45,,10/2/2020 5:35,10/2/2020 5:35,Do I need to download Qiskit from IBM Quantum Experience?,,1,0,,,,CC BY-SA 4.0 +13619,2,,13618,9/7/2020 6:58,,4,,"

You can use so-called Quantum Lab in IBM Q Experience web interface. Log into your account on IBM Q and click on this icon:

+

+

After that, click on New notebook button and here you can write your code in Qiskit and run it.

+

+

The Quantum Lab is based on Jupyter notebooks and interactive Python.

+

Also, you can use the Qiskit tutorial which is a part of the Quantum Lab.

+",9006,,,,,9/7/2020 6:58,,,,3,,,,CC BY-SA 4.0 +13620,2,,13617,9/7/2020 6:59,,1,,"

These are related to simulation of a quantum device on a classical computer. If all the gates in a circuit are H, S, and CNOT, then the circuit can be simulated on a classical computer in polynomial time. This is what the stabilizer simulator does. If the circuit is composed mostly of H, S, and CNOT, but there is also a small number t of T gates, then the circuit can be simulated in time that polynomial in 2^t. This is what the extended stabilizer simulator does.

+",7659,,,,,9/7/2020 6:59,,,,0,,,,CC BY-SA 4.0 +13621,2,,13607,9/7/2020 8:00,,5,,"

I will answer this question in a more general context. You might know that Haar's theorem tells you that on any locally compact group $G$, there is a unique left-invariant (Borel) measure $\mu$, up to a positive constant. Left-invariance means that $\mu(g A)=\mu(A)$ for any $g\in G$ and (measurable) set $A\subset G$. This is the (left-) Haar measure on $G$.

+

The same argument yields a unique right-invariant measure, up to a constant. +Note that we can always turn a left-invariant Haar measure into a right-invariant Haar measure by taking the inverse: $\tilde\mu(A) := \mu(A^{-1})$. That is exactly what you are interested in.

+

For certain groups, the left- and right-invariant Haar measures coincide (unimodular groups) and the unitary group $U(d)$ is such a group. For these groups, your statement is correct. The proof is straightforward:

+

Unimodularity implies that the "inverse" of the normalised Haar measure $\mu$ on $U(d)$ is itself a left- and right-invariant Haar measure on $U(d)$. By uniqueness, $\tilde\mu$ can only differ by a positive constant from $\mu$. However, it is clear that both measures are normalised, thus $\tilde\mu = \mu$.

+",2305,,,,,9/7/2020 8:00,,,,0,,,,CC BY-SA 4.0 +13622,2,,13616,9/7/2020 8:20,,0,,"

Here is the decomposition of Grover's diffusion algorithm into simple gates : How can you decompose Grover's diffusion operator into gates?.

+

However, when you want to increase the amplitude of states, you should look into amplitude amplification. You could start looking at : wikipedia.

+

However, you will always require a Hermitian Projector operator or an oracle function.

+",8746,,,,,9/7/2020 8:20,,,,0,,,,CC BY-SA 4.0 +13623,1,13625,,9/7/2020 9:06,,0,227,"

If, for some $x$, I have the $n$-qubit state +$$\sum_{y\in\{0,1\}^n} (-1)^{xy}|y\rangle,$$ +and I would like to apply to that the $n$-qubit Hadamard transform, with the aim of calculating the final state.

+

I understand I can continue like following: +$$\sum_{y\in\{0,1\}^n}\sum_{j\in\{0,1\}^n}(-1)^{xy}(-1)^{jy} |j\rangle += \sum_{y\in\{0,1\}^n}\sum_{j\in\{0,1\}^n}(-1)^{y(x+j)}|j\rangle, $$ +but what cancels out here and why?

+",13130,,23,,9/11/2020 15:33,9/11/2020 15:33,"What is the output of applying the Hadamard matrix to $\sum_{y\in\{0,1\}^n} (-1)^{xy}|y\rangle$?",,1,5,,,,CC BY-SA 4.0 +13624,2,,13604,9/7/2020 9:41,,2,,"

I will expand on my comment as an answer because it is not as immediate as I initially thought it was. Let $D(\rho \| \sigma ) := \mathrm{Tr}[\rho( \log \rho - \log \sigma)]$ be the relative entropy where $\rho$ is a state and $\sigma$ is a positive semidefinite operator. We can write the von Neumann entropy of a state $\rho$ in terms of the relative entropy, +$$ +S(\rho) = -D(\rho \| \mathbb{1}). +$$

+

Now the relative entropy satisfies something known as the data processing inequality) DPI which states that for any CPTP map $\mathcal{N}$ we have +$$ +D(\rho \| \sigma) \geq D(\mathcal{N}(\rho) \| \mathcal{N}(\sigma)). +$$

+

Let us take the CPTP map $\mathcal{M}(\rho) = \sum_i |i \rangle \langle i | \rho | i \rangle \langle i |$ which is defined by the measurement in your question. This map when applied to $\rho$ prepares the state $ \sum_i p(i) | i \rangle \langle i |$ where $p(i)$ is the probability of obtaining outcome $i$ when measuring the state $\rho$. Now by the above we have +$$ +\begin{aligned} +S(\rho) &= -D(\rho \| \mathbb{1}) \\ +&\leq -D(\mathcal{M}(\rho) \| \mathcal{M}( \mathbb{1})) \\ +&= -D(\mathcal{M}(\rho) \| \mathbb{1}) \\ +&= S(\mathcal{M}(\rho)) \\ +&= H(p). +\end{aligned} +$$

+",9854,,,,,9/7/2020 9:41,,,,2,,,,CC BY-SA 4.0 +13625,2,,13623,9/7/2020 9:59,,2,,"

Use the identity +$$ +\sum_{y\in\{0,1\}^n} (-1)^{y\cdot z} = 2^n \delta_{z,0} +$$ +with $z=x+j$. This identity is based on the fact that "summing $d$-th roots of unity gives zero" if $d>1$.

+

Then you see that the result of applying the Hadamard gate twice is indeed the input state: +$$ +\sum_{y\in\{0,1\}^n} \sum_{j\in\{0,1\}^n} (-1)^{y\cdot (x+j)} |j\rangle = 2^n |x\rangle +$$ +Note that usually the Hadamard gate is normalised by $2^{-n/2}$ for it to be unitary.

+

Remark: In higher-dimensional systems, $H\neq H^{-1}$, which you can see above since the identity would give you $j=-x$ which is only equal to $x$ in $\mathbb{Z}_2=\{0,1\}$. There, the inverse has an additional minus sign in the exponent (well, and replace $-1$ by $e^{2\pi i/d}$).

+

EDIT: I was asked to elaborate on the sum of roots of unity. Let's show the following +$$ +\sum_{y\in\mathbb{Z}_d^n} \omega^{y\cdot z} = d^n \delta_{z,0}, +$$ +where $d>1$ and $\omega$ is primitive $d$-th root of unity, e.g. $\omega=e^{2\pi i/d}$. Above, we have $d=2$. We have the following identity for the sum of all primitive $d$-th roots: +$$ +\sum_{k=0}^{d-1} \omega^k = 0. +$$ +I will not give a proof of this. It should be clear from the geometrical intuition, just think about the equidistant position of the roots of unity on the unit circle (cp. Wiki). +Next, we have to count how many times we get each root of unity in the second-to-last equation. If $z\neq 0$, there are $d^{n-1}$ possible solutions $y\in\mathbb{Z}_d^n$ to each of the linear systems $y\cdot z = k$ for $k\in\mathbb{Z}_d$. Clearly, the solution spaces are mutally disjoint and their union is $\mathbb{Z}_d^n$. Thus, any primitive root appears exactly $d^{n-1}$ times, and the sum is $d^{n-1} \sum_{k=0}^{d-1} \omega^k = 0$. If $z=0$, however, any term is identically $1$ and the result is $d^n$.

+

PS: BTW, the matrix representation of the Hadamard gate is just the discrete Fourier transform; the math is the same.

+",2305,,2305,,9/8/2020 12:15,9/8/2020 12:15,,,,3,,,,CC BY-SA 4.0 +13626,1,13640,,9/7/2020 10:00,,0,79,"

I use dotnet run command to run my .qs quantum circuit. Is there a way to run my circuit N times, and get results of each run (like the shots parameter in Qiskit) ?

+

Thank you.

+",12910,,55,,9/8/2020 5:53,9/8/2020 5:53,Run circuit N times in Q#,,2,1,,,,CC BY-SA 4.0 +13629,1,13630,,9/7/2020 13:24,,23,4924,"

I wonder what are magic states, and a magic state gadget. While I'm reading a paper, these terms frequently appear.

+",10028,,2293,,5/28/2021 18:05,9/14/2022 9:48,What are magic states?,,3,1,,,,CC BY-SA 4.0 +13630,2,,13629,9/7/2020 14:13,,25,,"

Magic states are certain states that have very nice properties with respect to fault-tolerant quantum computation.

+

In the vast landscape of quantum gates, there is a crude but useful distinction to be made between Clifford gates and all other gates (also referred to as the inspired non-Clifford gates). The set of Clifford gates is in technical terms the normalizer of the Pauli group, which basically means that it's the set of operations that map the set of Pauli eigenstates to the set of Pauli eigenstates - as the Pauli operators and its eigenstates are very important in quantum computation, we also care deeply about the Clifford gates.

+

There is another reason why we care about Clifford gates. In the scope of Quantum Error correction (specifically stabilizer codes and Fault-tolerance), all Clifford operations on stabilizer codes can be implemented transversally. This is a certain way of implementing (logical) operations on codes that are more or less 'the most easy way' of fault-tolerant - making them highly desirable.

+

Unfortunately it's impossible (as shown here) to have a complete universal gateset of operations with only transversal implementations, which means that at least one operation in the universal gateset needs to be implemented differently. As is often (but not necessarily) the choice, the set of Clifford operations (or rather, a generating set) is chosen as the transversal gates, and one other (non-Clifford) gate is implemented differently.

+

Implementing these non-clifford gates in a fault-tolerant manner is very tough and costly - there exist some methods that are on paper fault-tolerant, but lack implementability in one way or another. Magic states are a way of circumventing the need for non-Clifford gates by preparing certain states that kind of 'encode' the non-Clifford action into the state. Intuitively, you can think of this as applying all the necessary non-Clifford gates in a computation in advance, resulting in the magic states; the rest of the computation can then be performed by using only Clifford gates, making the fault-tolerant implementation containable.

+

Without a reference I cannot be completely sure what is meant by a 'magic state gadget', but I think the authors are referring to a gadget that would perform magic state distillation. Such a procedure produces pure magic states from noisy magic states - it was shown that this can be performed in a reasonably scalable fashion, and moreover in a fault-tolerant fashion. This gives a blue print of a fault-tolerant quantum computer with only Clifford gates (and the magic state distillation gadget).

+

Note that one needs a lot of magic states to perform computations - designs of quantum computers with magic states will most likely have the vast majority of its usable qubits be used for the distillation of magic states - the actual computation will almost be 'an afterthought'.

+

As a closing note, it may very well be that at some point all we care about in quantum computing resources is the distillation of magic states. This is of course an oversimplification, but I use it to emphasize the possible importance of these states.

+",8141,,8141,,9/14/2022 9:48,9/14/2022 9:48,,,,0,,,,CC BY-SA 4.0 +13631,2,,13615,9/7/2020 14:25,,1,,"

This is due to an internal normalization based on setting the phase of the largest magnitude element to one. This cannot be changed without modifications to the source code. As an alternative, see the following examples from the Kaleidoscope package I made: https://nonhermitian.org/kaleido/tutorials/interactive/qsphere.html

+",332,,,,,9/7/2020 14:25,,,,0,,,,CC BY-SA 4.0 +13634,1,13636,,9/7/2020 18:00,,2,364,"

Let's say I have a QuantumCircuit with multiple barriers as shown in the visual below: +

+

How would I split up the QuantumCircuit on the barriers into a list of 3 QuantumCircuits in Qiskit?

+

NB: Not directly relevant to the question, but the circuit is a random Unitary circuit, as I'm doing randomised-benchmarking. The circuit is generated as shown in the Qiskit Textbook: 5.3 Randomized Benchmarking.

+",12248,,55,,9/9/2020 20:46,9/9/2020 20:46,How to split a Quantum Circuit on a barrier in Qiskit?,,1,0,,,,CC BY-SA 4.0 +13635,2,,13354,9/7/2020 18:28,,3,,"

In the classic paper https://arxiv.org/pdf/quant-ph/9608006.pdf, on page 10, the distance of an $[n,0]$ code is defined as the smallest non-zero weight of any stabilizer in the code. The physical interpretation for this definition given is, +"An $[[n, 0, d]]$ code is a quantum state such that, +when subjected to a decoherence of $[(d − 1)/2]$ coordinates, it is possible to determine exactly which coordinates were decohered."

+",13182,,13182,,9/7/2020 18:39,9/7/2020 18:39,,,,0,,,,CC BY-SA 4.0 +13636,2,,13634,9/7/2020 19:29,,1,,"

For such a simple circuit, probably the easier way is to dump it as QASM and read it back.

+
def split_circuit_by_barrier(circuit):
+    qasm = circuit.qasm()
+    prelude = []
+    circuits = [[]]
+    for line in qasm.splitlines():
+        if any([line.startswith(t) for t in ['OPENQASM', 'include', 'qreg', 'creg']]):
+            prelude.append(line)
+        elif line.startswith('barrier'):
+            circuits.append([])
+        else:
+            circuits[-1].append(line)
+    circuits_with_prelude = [prelude+circuit for circuit in circuits]
+    for circuit_with_prelude in circuits_with_prelude:
+        yield QuantumCircuit.from_qasm_str('\n'.join(circuit_with_prelude))
+
+

Taking your example:

+
for subcircuit in (split_circuit_by_barrier(circuit)):
+    print(subcircuit)
+
+
                             ┌───┐ ┌───┐
+   q_0: ─────────────────■───┤ H ├─┤ S ├─────
+        ┌───┐┌───┐┌───┐┌─┴─┐┌┴───┴┐├───┤┌───┐
+   q_1: ┤ H ├┤ H ├┤ S ├┤ X ├┤ SDG ├┤ H ├┤ X ├
+        └───┘└───┘└─��─┘└───┘└─────┘└───┘└───┘
+meas: 2/═════════════════════════════════════
+
+        ┌─────┐┌───┐
+   q_0: ┤ SDG ├┤ H ├───────■───────────────────
+        └┬───┬┘├───┤┌───┐┌─┴─┐┌─────┐┌───┐┌───┐
+   q_1: ─┤ X ├─┤ H ├┤ S ├┤ X ├┤ SDG ├┤ H ├┤ H ├
+         └───┘ └───┘└───┘└───┘└─────┘└───┘└───┘
+meas: 2/═══════════════════════════════════════
+
+        ┌─┐
+   q_0: ┤M├───
+        └╥┘┌─┐
+   q_1: ─╫─┤M├
+         ║ └╥┘
+meas: 2/═╩══╩═
+         0  1
+
+",1859,,1859,,9/7/2020 19:40,9/7/2020 19:40,,,,5,,,,CC BY-SA 4.0 +13637,1,13641,,9/7/2020 20:06,,3,363,"

I know that U1 equivalent gate of Qiskit in Q# is R1, but I would like to implement U2 and U3 gate of Qiskit in Q#, what is the best way ?

+

Thank you.

+",12910,,55,,9/9/2020 20:46,9/9/2020 20:46,Implement U2 and U3 gate in Q#,,1,1,,,,CC BY-SA 4.0 +13638,1,,,9/7/2020 23:03,,4,71,"

I asked earlier Which quantum gates can we use in terms of depth?. In the question, I asked

+
+

I want to measure the depth of a circuit, but I do not know which quantum gates should be used when the circuit is decomposed.

+
+

and the answers is

+
+

depending on hardware.

+
+

If we use the quantum computer made of ion trap, what is the gate set, especially two-qubit gate? I have heard that $XX$ rotation is one of them, is it right?

+",9894,,55,,9/9/2020 20:45,11/7/2022 11:09,What is the elementary gate set for ion-trap quantum computers?,,1,0,,,,CC BY-SA 4.0 +13639,2,,13626,9/8/2020 0:28,,1,,"

As mentioned by Jonathcraft, it's possible to modify the host program. For example, set the driver of the Q# program to be C#, then call the Q# program multiple times with a for loop.

+",8343,,,,,9/8/2020 0:28,,,,0,,,,CC BY-SA 4.0 +13640,2,,13626,9/8/2020 1:01,,3,,"

Quantum programs in Q# can include classical logic as well as low-level quantum instructions, such that you can directly include the "shot" concept from circuits in your Q# programs by using a for-loop.

+
@EntryPoint()
+operation RunSeveralTimes(nTimes : Int) : Result[] {
+    mutable results = new Result[nTimes];
+    for (idx in 0..nTimes - 1) {
+        set results w/= idx <- DoSomething();
+    }
+    return results;
+}
+
+

When running this program with dotnet run, you can now pass --n-times as a command-line argument to control how many times your DoSomething() operation gets called. Similarly, if you're using Q# in Jupyter Notebooks, you can use a command like %simulate RunSeveralTimes nTimes=50. From Python interoperability, you can pass nTimes as a keyword argument, e.g.: RunSeveralTimes.simulate(nTimes=50).

+

The Q# standard libraries also offer several functions and operations to make this sort of loop easier to write:

+
    +
  • EstimateFrequency and EstimateFrequencyA: run an operation many times, and collect the probability with which a measurement at the end returns One.
  • +
  • DrawMany: run an operation many times with the same input, and collect all outputs.
  • +
  • ForEach: run an operation once for each of many inputs, and collect all outputs.
  • +
+",1978,,,,,9/8/2020 1:01,,,,1,,,,CC BY-SA 4.0 +13641,2,,13637,9/8/2020 2:11,,3,,"

The gates Rx, Ry and Rz in Q# have the same definition as RXGate, RYGate and RZGate in Qiskit, and the U2Gate and U3Gate documentation offers decomposition of these gates into Rx, Ry and Rz, so I would just use that decomposition:

+
operation U2(psi : Double, lambda : Double, q : Qubit) : Unit is Adj + Ctl {
+    Rz(lambda, q);
+    Ry(0.5 * PI(), q);
+    Rz(psi, q);
+}
+
+

and a similar one for U3.

+",2879,,,,,9/8/2020 2:11,,,,3,,,,CC BY-SA 4.0 +13642,2,,13629,9/8/2020 2:48,,7,,"

Consider a quantum computer that can:

+
    +
  • Prepare qubits in state $|0\rangle$
  • +
  • Apply unitary gates from the Clifford group
  • +
  • Measure qubits in the $X$, $Y$, and $Z$ bases
  • +
+

This seems ideal because:

+
    +
  • We know how to implement all three functionalities quite easily (compared to more complicated gates or measurements)
  • +
  • We can design algorithms for such a quantum computer quite easily, since all gates and measurements are quite fundamental operations that everyone working in quantum information knows and understands.
  • +
+

But, the above quantum computer is not universal!

+

You just need one more functionality to make the above quantum computer universal though:

+
    +
  • Be able to prepare a magic state
  • +
+

Examples of magic states are (here I give $H$-type and $T$-type magic states):

+

\begin{align} +|H\rangle &\equiv \cos(\frac{\pi}{8})|0\rangle + \sin(\frac{\pi}{8})|1\rangle,\tag{1} \\ +|T\rangle &\equiv\cos(\beta)|0\rangle + e^{i\pi/4}\sin(\beta)|1\rangle, \beta\equiv\frac{1}{2}\arccos(\frac{1}{\sqrt{3}}).\tag{2} +\end{align}

+

The above example is not unique. In fact to make any universal quantum computer, you need to be able to prepare at least one magic state.

+

The term "magic state" was introduced in 2004 by Bravyi and Kitaev.

+",2293,,2293,,10/18/2020 19:15,10/18/2020 19:15,,,,0,,,,CC BY-SA 4.0 +13643,1,13650,,9/8/2020 6:14,,6,1280,"

For any fixed $n$, how do we prove that the $n$-qubit Clifford group (subgroup of $ U(2^n) $ generated by Hadmard gates, phase-shift gates and CNOT gates) is finte or not? I know that for the single qubit case, where only H gate and S gate are involved, it is a finite group since these two gates correspond to $\pi$ rotations on the Bloch sphere along axes that manifest symmetry. I guess it remains to be finite in multi-qubit case but I couldn't find a way to prove that rigorously.

+

Moreover, if it is finite, what is the expression of the number of elements in the group as a function of $n$?

+",8131,,55,,9/9/2020 20:41,9/9/2020 20:41,Is the Clifford group finite?,,1,4,,,,CC BY-SA 4.0 +13644,1,13645,,9/8/2020 7:44,,3,115,"

How to implement a 3 qubit gate, that exchanges the level $|110\rangle$ and $|000\rangle$, with elementary gates (CNOT, SWAP, Toffoli, local gates, etc.(everything Qiskit allows)): +$$ +U=\pmatrix{ +0 & 0 & 0 & 0 & 0 & 0 & 1 & 0\\ +0 & 1 & 0 & 0 & 0 & 0 & 0 & 0\\ +0 & 0 & 1 & 0 & 0 & 0 & 0 & 0\\ +0 & 0 & 0 & 1 & 0 & 0 & 0 & 0\\ +0 & 0 & 0 & 0 & 1 & 0 & 0 & 0\\ +0 & 0 & 0 & 0 & 0 & 1 & 0 & 0\\ +1 & 0 & 0 & 0 & 0 & 0 & 0 & 0\\ +0 & 0 & 0 & 0 & 0 & 0 & 0 & 1\\ +}=? +$$ +I tried to decompose the unitaries hamiltonian $U=\exp(-i\pi $$H$$)$ in the Zeeman basis, but it doesn't looks not very promising.

+",5280,,9006,,9/9/2020 7:05,9/9/2020 7:05,Decomposition of $|110\rangle \leftrightarrow |000\rangle$ Exchange Gate,,2,0,,,,CC BY-SA 4.0 +13645,2,,13644,9/8/2020 8:29,,4,,"

One simple idea would be to introduce an ancilla (I'm sure there will be protocols without an ancilla as well) that starts in $|0\rangle$. You can use a Toffoli (and some X gates) to flip the ancilla if the system is in the state $|000\rangle$. You can also do the same if it's in state $|110\rangle$. So, the ancilla is in state $|1\rangle$ if you need to flip the first two bits. In other words, two controlled-not gates will do the job. Then you just have to undo the computation of the ancilla.

+

+

I believe the following does the same without an ancilla (although you'll want to check it carefully: +

+

The theory was basically that controlled off the third qubit being 0, you essentially wanted to do a swap of the first two qubits (and swap can be composed of 3 controlled-nots). Except that swap usually preserves 00 and 11, switching 01 and 10, so if we perform an $X$ on one of the qubits, that means 01 and 10 are preserved, swapping 00 and 11. An initial construction would make many gates controlled off the third qubit, but it turns out these are unnecessary -- if the central toffoli does nothing, everything else cancels.

+",1837,,1837,,9/8/2020 8:48,9/8/2020 8:48,,,,3,,,,CC BY-SA 4.0 +13646,2,,13644,9/8/2020 8:50,,4,,"

Adding to @DaftWullie's answer,

+

If you're only looking to implement a gate in Qiskit that swaps $\lvert000\rangle$ and $\lvert110\rangle$ without worrying about the underlying gates, the easiest way to do that would be to create a NumPy array containing the matrix and attach that to the circuit using QuantumCircuit.iso.

+

The code would look roughly like this:

+
from qiskit import QuantumCircuit, execute, Aer
+import numpy as np
+
+unitary = np.zeros((8,8))
+unitary[0][6] = unitary[6][0] = 1
+unitary[1][1] = unitary[2][2] = unitary[3][3] = unitary[4][4] = unitary[5][5] = unitary[7][7] = 1
+
+ckt = QuantumCircuit(3)
+ckt.iso(unitary, [0,1,2,3], [])
+ckt.measure_all()
+
+execute(ckt, backend=Aer.get_backend('qasm_simulator'), shots=1024).result()
+
+# do what you want with the result 
+
+

Do keep in mind qiskit's "reverse-ordering" of qubits when you're playing around with this! Hope this helps...

+",8955,,,,,9/8/2020 8:50,,,,1,,,,CC BY-SA 4.0 +13647,1,,,9/8/2020 10:09,,1,912,"

Running the program in Quantum Lab, it shows error. I am looking for solution.

+

Here is a code I run:

+
circ = QuantumCircuit(3)
+
+circ.h(0)
+
+circ.cx(0, 1)
+
+circ.cx(0, 2)
+circ.draw('mpl')
+
+from qiskit import Aer
+
+backend = Aer.get_backend('statevector_simulator')
+job = execute(circ, backend)
+result = job.result()   
+outputstate =result.get_statevector(circ, decimals=3)
+print(outputstate) 
+
+

An here is an error I got:

+
NameError                                 Traceback (most recent call last)
+<ipython-input-3-17b8e431afa9> in <module>
+
+----> 1 circ = QuantumCircuit(3)
+
+      2 # Add a H gate on qubit 0, putting this qubit in superposition.
+
+
+      3 circ.h(0)
+
+      4 # Add a CX (CNOT) gate on control qubit 0 and target qubit 1, putting
+
+      5 # the qubits in a Bell state.
+
+
+NameError: name 'QuantumCircuit' is not defined
+```
+
+",13172,,9006,,9/9/2020 7:08,9/9/2020 7:08,Getting an error running a program in IBM Q Experience Quantum lab,,1,0,,,,CC BY-SA 4.0 +13648,2,,13647,9/8/2020 10:52,,2,,"

You need to import QuantumCircuit from qiskit:

+

from qiskit import QuantumCircuit

+

I imagine you will probably also need to do:

+

from qiskit import execute

+

And you can combine your three imports neatly into one line like so:

+
from qiskit import Aer, QuantumCircuit, execute
+
+",10415,,,,,9/8/2020 10:52,,,,1,,,,CC BY-SA 4.0 +13649,1,,,9/8/2020 12:34,,4,89,"

See article here: https://arxiv.org/abs/quant-ph/0208112

+

There are two steps in this procedure that I am curious about. First off, they suppose one can construct a circuit which efficiently performs the computation

+

$$\sqrt{p_i^{(m)} } |i\rangle|0\cdots 0\rangle \rightarrow \sqrt{p_i^{(m)} } |i\rangle|\theta_i\rangle.$$ +How would one implement such a circuit? My guess is that one implements it in a similar way that one would on a classical computer, but quantum parallelism allows for $\theta_i$ to be calculated for all bit-combinations simultaneously. However, I have no idea how one starts when designing such circuits. Is there any place I can learn this so I can implement this procedure for any function $f(i) = \theta_i$?

+

My next question is regarding the next step of the procedure. That is +$$\sqrt{p_i^{(m)} } |i\rangle|\theta_i\rangle|0\rangle \rightarrow \sqrt{p_i^{(m)} } |i\rangle|\theta_i\rangle(\cos\theta_i|0\rangle + \sin \theta_i|1\rangle). $$ +This step is also completely unfamiliar to me. How does one perform a rotation on an ancilla qubit, where the rotation angle is given by the binary number represented by the state $|\theta_i\rangle$?

+

Any literature or answers getting me closer to learning this would be highly appreciated.

+",5632,,55,,9/9/2020 20:39,11/9/2021 13:20,How one would implement the circuit to create superpositions corresponding to efficiently integrable probability distributions?,,0,5,,,,CC BY-SA 4.0 +13650,2,,13643,9/8/2020 12:40,,9,,"

Sometimes, there is a bit of confusion around the Clifford group in the field ... and it's a matter of definition.

+

A lot of people define the Clifford group $\mathrm{Cl}_n(p)$ of $n$ qudits of prime dimension $p$ as the unitary normaliser of the generalised Pauli group (e.g. Gottesman, Nielsen & Chuang). As such, it is clearly not a finite group as the centre is $U(1)$.

+

However, this is also a bad definition, both from the mathematical and the physical point of view. Why? First, because the centre is mathematically boring and doesn't add anything to the structure of the group and second, because the global phase of a unitary is unphysical.

+

There are three ways of resolving this:

+
    +
  1. Define it by its generators (see Gottesman's paper on higher-dimensonal generators). Then, it's clear that it is finite since all generators have algebraic matrix entries. Using the standard generators, you will still get a too large centre in the qubit case: $\mathbb{Z}_8$. The minimal one is $\mathbb{Z}_4$ in the qubit case an $\mathbb{Z}_p$ in the qudit case. Redefining the $H$ gate as $\frac{1+i}{\sqrt{2}} H$ makes the centre minimal for qubits.
  2. +
  3. You can define it as the normaliser in the unitary group with entries in $\mathbb{Q}[i]$ (rational complex numbers). This will give you a group with minimal centre (see Ref. 1).
  4. +
  5. Define the projective group $\overline{\mathrm{Cl}}_n(p):=\mathrm{Cl}_n(p)/U(1)$, or equivalently, the image under the adjoint representation, i.e.~the unitary channels associated to Cliffords. Its elements can be seen as permutations of the Pauli operators (possibly with added phases) which preserve commutation relations. Since there are $p^{2n}$ Pauli operators, the number of permutations is finite (and thus is $\overline{\mathrm{Cl}}_n(p)$). +Moreover, it holds +$$ +\overline{\mathrm{Cl}}_n(p)/\overline{\mathcal{P}}_n(p) \simeq \mathrm{Sp}_{2n}(p), +$$ +where $\overline{\mathcal{P}}_n(p)$ is the (generalised) Pauli group up to phases and $\mathrm{Sp}_{2n}(p)$ is the symplectic group over the finite field $\mathbb{F}_p$. Its cardinality is +$$ +|\mathrm{Sp}_{2n}(p)| = p^{n^2} \prod_{i=1}^n (p^{2i} - 1). +$$ +Thus, the projective Clifford group has cardinality +$$ +|\overline{\mathrm{Cl}}_n(p)| = |\overline{\mathcal{P}}_n(p)| |\mathrm{Sp}_{2n}(p)| = p^{2n} p^{n^2} \prod_{i=1}^n (p^{2i} - 1) +$$ +For the non-projective ones, one has to multiply with the order of the centre. For a reference, see e.g. Ref. 2
  6. +
+

References:

+
    +
  1. Gabriele Nebe, E. M. Rains, and N. J. A. Sloane. “The invariants of the Clifford groups”
  2. +
  3. D. Gross, "Hudson’s theorem for finite-dimensional quantum systems"
  4. +
+",2305,,2305,,9/8/2020 14:19,9/8/2020 14:19,,,,7,,,,CC BY-SA 4.0 +13651,1,13824,,9/8/2020 12:42,,1,380,"

Let's say I have a QuantumCircuit with depth $d$ layers. How can I generate a new QuantumCircuit with the last n layers removed. For example, let's say the QuantumCircuit has $d=8$ layers as follows:

+

+

And let's say the last n=4 layers are desired to be removed then the resulting QuantumCircuit should be as follows leaving only the first 4 layers of the above QuantumCircuit:

+

+

How can this be done in Qiskit?

+",12248,,55,,9/9/2020 20:35,9/19/2020 17:02,How to remove last n layers of Quantum Circuit in Qiskit?,,2,1,,,,CC BY-SA 4.0 +13652,1,13660,,9/8/2020 12:51,,1,341,"

I want to compare the fidelity of a circuit implemented on IBMQ Santiago with the ideal circuit simulated using the statevector backend. Is there a way to do this? So far I have only seen examples where both circuits involve the statevector backend.

+",5705,,55,,9/9/2020 20:34,9/9/2020 20:34,How do I compute the fidelity on the IBM Q using qiskit without the statevector simulator?,,1,0,,,,CC BY-SA 4.0 +13653,2,,13531,9/8/2020 12:54,,9,,"

As so often, and especially in young research areas, the answer depends quite a lot on how you break down the question. Let me try a few examples:

+

Does quantum mechanics change what is theoretically learnable?

+

A beautiful paper is this reference which states a few complex results in rather clear words. Again, it depends very much on what you define as "learning". Overall, exponential speedups in the number of data samples seem to not be possible in many settings, but exponential time complexity speedups very well possible.

+

What asymptotic computational speedups can quantum computing provide for machine learning?

+

Probably the most studied approach here is to outsource linear algebra subroutines such as matrix inversion or singular value decomposition to quantum computers. These subroutines appear for example in convex optimisation used in linear regression or kernel methods.

+

Quantum computing research is traditionally very focused on exponential speedups, which have been claimed in many quantum machine learning papers. But they rely on lots of assumptions about how you load your data into a quantum computer, and how to process the results. The assumptions require deep technical knowledge to grasp, and it is not always clear how good classical methods are in this case. For example, the quantum algorithm may require a sparse data matrix for an exponential speedup over the vanilla classical method, but under this assumption there is another classical method that is much faster too. Some quantum algorithms have since been "de-quantised", which is a euphemism for "found to not really provide an exponential speedup if the same assumptions are imposed on classical algorithms".

+

Standard quantum algorithms can often give you a quadratic speedup for sampling and unstructured search problems. But classical methods are quite fast at heuristic sampling in the first place (think of contrastive divergence), and search problems so vast that a quadratic speedup does not make them tractable either.

+

Can quantum computations give rise to machine learning models that generalise well?

+

Most of the work in near-term quantum machine learning, that is QML using small and noisy devices that are the current "prototypes" of quantum computers, are interested in what models quantum computers very naturally give rise to. Do they look like neural networks? Or like anything else? Are they good generalisers? Can they be trained efficiently?

+

Of course, speedups are important here to - if we find a quantum model that is powerful, but easy to classically simulate, one does not need the quantum computer in the first place (still, a quantum computer may just be the fastest hardware in absolute terms to process those models, and therefore still advantageous). But much more important is to show that the quantum model generalises well.
+This type of research, much driven by "variational" or "trainable" or "parametrised" quantum circuits which are optimised with the usual classical techniques of deep learning, has only few answers yet to the question of quantum advantages. There are interesting clues though - quantum models of this type are mathematically speaking linear algebra computations applied to data mapped into the very large Hilbert spaces of quantum systems. They are also modular and trainable like neural networks.

+

If one accepts that quantum computers are strictly speaking more powerful than classical computers, the quantum model could in principle express a larger class of functions. But how to utilise this potential advantage in a concrete quantum algorithm design is very hard to point out and not "automatically given". For example, one can show that certain ways to encode data into a quantum computer gives quantum models only access to very trivial function classes, and they are unlikely to learn anything interesting.

+

One reason why this is an extremely challenging (but very interesting) research area is this: if the goal is to build powerful generalisers, but the theoretical foundations of generalisation are poorly understood even in classical machine learning, and our current devices are too small and noisy to run meaningful empirical benchmarks, how can one actually show that the quantum model has an advantage? In other words, a lot of work is needed to even find a satisfying investigation framework for the question "are quantum models better machine learning models?".

+

So, overall I'd say like every decent research field, the art is to reformulate the question until we can answer it - at which stage the answer is usually hard to understand for non-experts.

+",13188,,,,,9/8/2020 12:54,,,,4,,,,CC BY-SA 4.0 +13654,1,,,9/8/2020 13:36,,1,212,"

I want to reduce the depth of a ucrz gate acting on multiple qubits with ancilla qubits in qiskit. One way to do this could be the mcmt implementation with method='v-chain'. However, it seems that mcmt is incompatible with base gates acting on multiple qubits. How can I reduce the circuit depth with ancillas?

+
from qiskit import QuantumCircuit, QuantumRegister
+from qiskit.extensions.quantum_initializer.ucrz import UCRZGate
+import numpy as np
+
+nqbits=3 # the number of qubits
+qr = QuantumRegister(nqbits) #initialize register
+QM = QuantumCircuit(qr) #initialize circuits
+ang_li=list([np.pi,np.pi,-np.pi,np.pi])# list of angles
+QM.ucrz(ang_li,q_controls=[qr[1],qr[2]],q_target=[qr[0]])#apply the gate
+on the first register
+display(QM.draw())#This is the full circuit
+display(QM.decompose().decompose().decompose().draw()) #This is the decomposed circuit whose depth I wanna reduce with ancillas
+
+qr2 = QuantumRegister(2*nqbits-1) #initialize the second register
+ancilla = QuantumCircuit(qr2) #initialize the second circuit 
+ancilla.mcmt(UCRZGate(ang_li),[1,2],0,[4,5], mode='v-chain') #try to apply the same gate with 'vchain'+ ancilas. it gives an error!! Seens mcmt is incompatible with base gates acting on multiple qubits
+display(ancilla.decompose().decompose().decompose().decompose().draw())
+print(ancilla.decompose().decompose().decompose().decompose().count_ops())
+print(ancilla.decompose().decompose().decompose().decompose().depth())
+
+",13189,,55,,9/9/2020 20:33,9/9/2020 20:33,qiskit - MCMT - base gate acting on only one qubit,,0,1,,,,CC BY-SA 4.0 +13655,1,,,9/8/2020 16:12,,0,918,"

This is the code that I have used. Why can't i use get_statevecto when i use quantum computer. I got a state_vector when i have used qasm_simulator.

+
qcomp = provider.get_backend('ibmq_5_yorktown') 
+fidelitycount = 0
+shots = 1
+for i in range(shots):
+    num_qubits = 5
+    adj_matrix_fcg = np.ones((num_qubits,num_qubits),dtype=int)
+    circuit_fcg_5 = qiskit.circuit.library.GraphState(adj_matrix_fcg)
+    sv2 = execute(circuit_fcg_5, qcomp).result().get_statevector(circuit_fcg_5)
+    #fidelity = qiskit.quantum_info.state_fidelity(sv1)
+    #fidelitycount += fidelity
+
+print(sv2)
+
+
+

and this is the error

+

+",8330,,55,,9/9/2020 20:33,9/9/2020 20:33,QiskitError: 'No statevector for experiment,,1,0,,,,CC BY-SA 4.0 +13656,2,,13655,9/8/2020 16:22,,3,,"

When running on real backends you can't get a statevector since you can't return the quantum state of the device, only get measurement outcomes. The get_statevector method on the Result class only works if the backend (in this case a simulator) returns a statevector after executing the circuit.

+

That being said you can however try to use quantum tomography to reconstruct the state. You can see examples in the tutorial on how to do this here:

+

https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/noise/8_tomography.ipynb

+",5529,,,,,9/8/2020 16:22,,,,1,,,,CC BY-SA 4.0 +13657,1,13675,,9/8/2020 16:31,,8,806,"

I'm looking into the circuit for the VQE, but am stumped at how we can identify the expectation value of the Pauli series. Essentially, how do we find:

+

$$ \langle \psi | H_i | \psi \rangle $$

+

Given $H_i$ can be decomposed into Paulis?

+

The first strategy that comes to mind is simply applying the adjoint of the state prep routine and finding the average number of 0s measured, but this doubles the number of state prep calls necessary. Is there an alternative circuit I'm missing?

+",8343,,,,,9/11/2020 19:00,Circuit for VQE Expectation Value Finding,,1,0,,,,CC BY-SA 4.0 +13658,2,,13651,9/8/2020 17:27,,1,,"

Based on this question I have been able to solve this problem as follows:

+
initial_d = qc.depth() # in my case 8
+n = 4 # number of layers to remove
+while qc.depth() > (initial_depth - n):
+    qc.data.pop(-1)
+
+",12248,,,,,9/8/2020 17:27,,,,0,,,,CC BY-SA 4.0 +13659,2,,13543,9/8/2020 17:28,,7,,"

Michael Nielsen said the book is not maintained. I asked him on Twitter .

+",362,,362,,1/25/2021 10:59,1/25/2021 10:59,,,,2,,,,CC BY-SA 4.0 +13660,2,,13652,9/8/2020 19:26,,1,,"

It is not possible to compare the statevector of a circuit run on the statevector_simulator and on a real device, like IBMQ Santiago, because the result of a job run on hardware is in the form of counts. You can see this by running the following command in qiskit:

+
job.result().data(circuit)
+
+

for a specific circuit and job run on a real IBMQ device. The output you will get will be in the form of

+
{'counts': {...}}
+
+

where {...} is a dictionary mapping states to counts for those states.

+

If you run the same command on a job run on the statevector simulator, you will get

+
{'counts':{...}, 'statevector': array([...])}
+
+

where array([...]) is an array form of the resulting statevector, and the dictionary for counts maps that same statevector to a count of 1.

+

However, you can compute the hellinger fidelity, which compares counts instead of state vectors. You can read more about it here: https://qiskit.org/documentation/stubs/qiskit.quantum_info.hellinger_fidelity.html

+",13117,,13117,,9/8/2020 19:48,9/8/2020 19:48,,,,2,,,,CC BY-SA 4.0 +13661,1,13671,,9/9/2020 7:03,,3,116,"

I'm taking a quantum information systems class and thought of this while trying to wrap my head around some material, so I apologize if this comes off as dumb or founded on misunderstandings.

+

Say you have a system consisting of three qubits a, b, and c, where qubits b and c are entangled in a Bell state, but you're not aware of this fact. You take a measurement of qubits a and b, inherently losing the information/collapsing the wavefunction (?).

+

As qubit c was in an entangled state with qubit b, but was never directly or knowingly measured, does the measurement also affect the third qubit, causing it to lose its information as well? I feel like the answer is yes but it's interesting to think about.

+

TLDR: If a qubit is measured in a forest, but no one is around to take the measurement it, does it still affect its state?

+",13195,,13195,,9/13/2020 22:16,9/13/2020 22:16,Effect of quantum entanglement on measurement,,1,2,,,,CC BY-SA 4.0 +13662,1,13663,,9/9/2020 11:08,,1,209,"

I started to learn Qiskit, so sorry if my question is very basic. So far I used qasm_simulator or state_vectorsimulator, however, now I would like to run my circuit on real IBM Q processor.

+

Here is my code, I wanted to execute:

+
%matplotlib inline
+# Importing standard Qiskit libraries and configuring account
+from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister, execute, Aer, IBMQ
+from qiskit.compiler import transpile, assemble
+from qiskit.tools.jupyter import *
+from qiskit.visualization import *
+
+provider = IBMQ.load_account()
+backend = provider.backends(name='ibmq_ourense')
+
+q = QuantumRegister(5, name = 'q')
+c = ClassicalRegister(2,name = 'c')
+
+circuit = QuantumCircuit(q,c)
+circuit.h(q[0])
+circuit.cx(q[0],q[1])
+circuit.measure(q[0],c[0])
+circuit.measure(q[1],c[1])
+
+job = execute(circuit, backend, shots = 1024)
+counts = job.result().get_counts()
+plot_histogram(counts)
+
+

However, this error was shown:

+
---------------------------------------------------------------------------
+AttributeError                            Traceback (most recent call last)
+<ipython-input-26-b48ae13f56aa> in <module>
+     11 circuit.measure(q[1],c[1])
+     12 
+---> 13 job = execute(circuit, backend, shots = 1024)
+     14 counts = job.result().get_couns()
+     15 plot_histogram(counts)
+
+/opt/conda/lib/python3.7/site-packages/qiskit/execute.py in execute(experiments, backend, basis_gates, coupling_map, backend_properties, initial_layout, seed_transpiler, optimization_level, pass_manager, qobj_id, qobj_header, shots, memory, max_credits, seed_simulator, default_qubit_los, default_meas_los, schedule_los, meas_level, meas_return, memory_slots, memory_slot_size, rep_time, rep_delay, parameter_binds, schedule_circuit, inst_map, meas_map, scheduling_method, init_qubits, **run_config)
+    258                                 seed_transpiler=seed_transpiler,
+    259                                 optimization_level=optimization_level,
+--> 260                                 backend=backend)
+    261 
+    262     if schedule_circuit:
+
+/opt/conda/lib/python3.7/site-packages/qiskit/compiler/transpile.py in transpile(circuits, backend, basis_gates, coupling_map, backend_properties, initial_layout, layout_method, routing_method, translation_method, seed_transpiler, optimization_level, pass_manager, callback, output_name)
+    211                                            callback, output_name)
+    212 
+--> 213     _check_circuits_coupling_map(circuits, transpile_args, backend)
+    214 
+    215     # Transpile circuits in parallel
+
+/opt/conda/lib/python3.7/site-packages/qiskit/compiler/transpile.py in _check_circuits_coupling_map(circuits, transpile_args, backend)
+    244 
+    245         # If coupling_map is None, the limit might be in the backend (like in 1Q devices)
+--> 246         elif backend is not None and not backend.configuration().simulator:
+    247             max_qubits = backend.configuration().n_qubits
+    248 
+
+AttributeError: 'list' object has no attribute 'configuration'
+
+

I think that the problem is hidden in getting backends or execute command.

+

Note: I run my code in Quantum Lab on IBM Q website interface.

+

Could any please help me how to change my code to run it on real IBM Q processor?

+",9006,,55,,9/9/2020 20:46,10/10/2020 1:03,Error while running Qiskit code on real quantum hardware,,1,0,,,,CC BY-SA 4.0 +13663,2,,13662,9/9/2020 11:18,,3,,"

Looks like backend = provider.backends(name='ibmq_ourense') returns a list of backends whose name is ibmq_oursense (a list whose length is obviously 1). Try backend = provider.backends(name='ibmq_ourense')[0].

+",7659,,,,,9/9/2020 11:18,,,,4,,,,CC BY-SA 4.0 +13665,2,,4469,9/9/2020 15:09,,1,,"

It sounds like GLOA algorithms are a type of genetic algorithm. Genetic algorithms are heuristic algorithms which often do not have any specified time complexity nor accuracy (which is likely why you couldn't find anything). So why do we even use these algorithms you might ask? The answer is that often they work and if they do so in a reasonable amount of time, then why not use them. Often they are easy to program and can be applied to problems where one might have no idea how to find an optimal solution.

+

On the other hand the SK algorithm is an exact or deterministic algorithm with polynomial complexity in $O(\log(1/\epsilon))$ where $\epsilon$ is the desired accuracy of the quantum gate. The SK algorithm (unlike heuristic algorithms) takes advantage of the fact that quantum gates are elements of the unitary group $U(d)$, which is a Lie group and therefore a smooth manifold in which one can make conclusions about the geometry and distance between points.

+

GLOA's may have advantages when engineering quantum circuits as it may be possible to incorporate other desired aspects of circuit design into the optimization. However, they will not be as efficient nor optimal as the SK algorithm (or the more powerful number theoretic approximation algorithms for $U(d)$).

+",11793,,,,,9/9/2020 15:09,,,,0,,,,CC BY-SA 4.0 +13667,1,13668,,9/9/2020 18:36,,3,741,"

Is there a way in Qiskit to take a circuit object and return a list of tuples where each tuple consists of a gate and the qubit(s) they act on? The list obeys some partial order since the gate order cannot be swapped unless they commute.

+",13199,,55,,9/9/2020 21:00,9/10/2020 8:39,Qiskit: Get gates from circuit object,,1,0,,,,CC BY-SA 4.0 +13668,2,,13667,9/9/2020 18:51,,3,,"

You can inspect the QuantumCircuit.data structure:

+

https://qiskit.org/documentation/stubs/qiskit.circuit.QuantumCircuit.html

+

For example, here is a loop that prints the name, qubits and any other parameters for all the gates in a circuit.

+
for gate in qc.data:
+    print('\ngate name:', gate[0].name)
+    print('qubit(s) acted on:', gate[1])
+    print('other paramters (such as angles):', gate[0].params)
+
+",5551,,409,,9/10/2020 8:39,9/10/2020 8:39,,,,0,,,,CC BY-SA 4.0 +13669,1,,,9/9/2020 19:55,,0,101,"

How can I solve this situation?

+

I'm using the IBMQX2 chip. When I run my simulation some circuits are executed and the following WARNING message is displayed:

+
account._job_result_object_storage:WARNING:2020-09-10 05:31:30,318: An error occurred while sending download completion acknowledgement: "HTTPSConnectionPool(host='api.quantum-computing.ibm.com', port=443): Read timed out. (read timeout=None)"
+
+

After a long time a few more circuits are run and the following error message is displayed:

+
IBMQBackendApiError: 'Error sending job: "HTTPSConnectionPool (host = \ 'api .quantum -computing.ibm.com \', port = 443): Reading timeout. (reading timeout = None) ".
+
+

At this point, the entire simulation is permanently stopped. When I used Windows 10 this type of message did not appear but, recently, I changed the operating system to Ubuntu 20.04. I don't know if it is necessary to do some kind of configuration on Linux.

+",13200,,45,,9/19/2020 9:46,9/19/2020 9:46,Error associated with HTTPSConnectionPool,,1,1,,,,CC BY-SA 4.0 +13670,2,,13669,9/9/2020 20:29,,2,,"

This is not exactly a problem. When Qiskit finishes downloading a job result, it sends an acknowledgement to the server, so the server can do some cleanup. This warning (not error) message just says that the acknowledgement failed, which is usually due to temporary networking issues. This failed acknowledgement has no impact to you, as the result has already been downloaded.

+",12195,,,,,9/9/2020 20:29,,,,0,,,,CC BY-SA 4.0 +13671,2,,13661,9/9/2020 20:59,,4,,"

It depends on what exactly you mean by "affected".

+

First of all, I'd say from your description that your "a" does not actually enter the discussion. The question is then essentially: suppose Alice (A) and Bob (B) have entangled states, and A performs a measurement; does this affect B's state?

+

The knowledge acquired by A with her measurement allows her to predict something about B's (eventual) measurement results. Assuming for example they share a maximally entangled state, then A knows that if B uses her same measurement basis, then he'll find her same outcome, i.e. their measurement results will be correlated.

+

Does this mean that A's act of measuring affected Bob's state? Not really, because if they don't exchange information about their respective measurement outcomes, there is no way for Bob to know anything about what Alice did to her state, and vice versa. It's hard to maintain that Alice affected Bob's state in any way, if from Bob's perspective there is no observable modification on the state caused by Alice's actions.

+

The situation is more akin to the states being correlated, albeit this type of correlation is stronger than what is possible classically.

+

There's also plenty of posts on similar topics on physics.SE. E.g. If two particles are entangled and you collapse the wave function of one of the particles. Does the other particle collapse as well?.

+",55,,55,,9/10/2020 9:59,9/10/2020 9:59,,,,1,,,,CC BY-SA 4.0 +13672,1,13674,,9/9/2020 22:41,,4,194,"

Let's say you want to do an experiment with 14+ qubits. You apply some arbitrary unitary operator $U \in (\mathbb{C}^2)^{\otimes n} \times (\mathbb{C}^2)^{\otimes n}$ to the state $|\psi\rangle \in (\mathbb{C}^2)^{\otimes n} $. That is

+

$$ U|\psi \rangle = |\phi \rangle $$

+

We can take $|\psi \rangle = |0\rangle^{\otimes n} $ to fits with current quantum computing setting. Now, if we do this experiment with $2^{13} = 8192$ shots, how is this enough to build up the statistical distribution as we have more than $2^{14}$ slots to distribute them to. If your output state $|\phi\rangle$ is particular eigenstate, says $|0110\cdots 1 \rangle$, then this many shots is more than enough. But if $|\phi\rangle$ is in a $2^n$ superposition state, then how is this enough? We wouldn't have enough experimental data to build up an accurate statistical distribution. Of course, I can repeat my experiment/job with 8192 shots a bunch of times and average out the results but even then it would still take a huge amount of experiments to have enough number of shots to get meaningful results... especially for variational type quantum algorithms... where one would need millions of shots to get within chemical precision.

+",9858,,9858,,11/17/2020 4:00,5/1/2021 19:29,How can we only use 8192 shots for an experiment with 14 or more qubits?,,2,0,,,,CC BY-SA 4.0 +13673,1,,,9/10/2020 4:36,,4,469,"

I am mainly talking about QSVM from Qiskit (https://qiskit.org/documentation/stubs/qiskit.aqua.algorithms.QSVM.html#qiskit.aqua.algorithms.QSVM) versus a classical SVM. Is it just a time complexity speed-up?

+",13092,,55,,9/18/2020 9:55,3/10/2021 10:43,What is the advantage of QSVM over the classical SVM?,,1,1,,,,CC BY-SA 4.0 +13674,2,,13672,9/10/2020 8:28,,4,,"

Reading out all the probabilities for all the possible output bit strings isn't common in quantum computing. The ideal case is to induce an interference effect that will allow your result to be read out with just one shot. Though that isn't something most algorithms achieve, they nevertheless use only $O(1)$ shots, or some other complexity that is far less than $O(2^n)$.

+

Nevertheless, if you want more than 8192 you could submit several jobs and combine results.

+",409,,,,,9/10/2020 8:28,,,,2,,,,CC BY-SA 4.0 +13675,2,,13657,9/10/2020 10:50,,8,,"

Let's denote $P$ as a Pauli tensor product term (Pauli term: e.g. $Z \otimes Z$, $X \otimes X$ or $Y \otimes X \otimes X$), then note that $P$ is a Hermitian matrix whose expectation value is real, the eigenvalues are $+1$ and $-1$ with corresponding eigenspaces. The expectation value of $P$ will be equal to:

+

$$ \langle \psi | P |\psi\rangle = p_{+} - p_{-}$$

+

where $p_{+}$ is the probability of $|\psi\rangle$ being in the $+1$ eigenspace and $p_{-}$ is the probability of $|\psi\rangle$ being in the $-1$ eigenspace of $P$. We will prove this. Note that $p_{+}$ and $p_{-}$ can be calculated by measuring in $P$ eigenbasis: $p_{+} = \frac{N_{+}}{N}$ and $p_{-} = \frac{N_{-}}{N}$, where $N_+$ is the number of measured eigenvectors that have $+1$ eigenvalue, $N_-$ is the number of measured eigenvectors that have $-1$ eigenvalue and $N$ is the total number of measurements.

+

Now the prove. Arbitrary $|\psi \rangle$ can be expressed as superposition of eigenbasis vectors of arbitrary Hermitian matrix (but we are interested in $P$) that acts in the same Hilbert space, so:

+

$$|\psi\rangle = \sum_{j_+} a_{j_+}|j_+\rangle + \sum_{j_-} b_{j_-}|j_-\rangle$$

+

where $a_{j_+}$ and $b_{j_-}$ are amplitudes of eigenvectors $|j_+\rangle$ and $|j_-\rangle$ of the $P$. We have separated the sum for our convenience: $|j_+\rangle$ are eigenvectors that have $+1$ eigenvalue (that means $P|j_+\rangle = |j_+\rangle$) and $|j_-\rangle$ are eigenvectors that have $-1$ eigenvalue (that means $P|j_-\rangle = -|j_-\rangle$). So:

+

$$P |\psi\rangle = \sum_{j_+} a_{j_+}|j_+\rangle - \sum_{j_-} b_{j_-}|j_-\rangle$$

+

By taking into account that all eigenbasis vectors $|j_+\rangle$, $|j_-\rangle$ are orthogonal to each other (e.g. $\langle j_+| k_+\rangle = 0$ when $j \ne k$ or $\langle j_+| k_-\rangle = 0$ ):

+

$$\langle \psi |P |\psi\rangle = \sum_{j_+} |a_{j_+}|^2 - \sum_{j_-} |b_{j_-}|^2= p_{+} - p_{-}$$

+

In this answer, one can find Qiskit implementation for $Z\otimes Z \otimes ... \otimes Z$ Pauli term. The answer also includes a discussion on how one can use the same procedure for calculating expectation value for an arbitrary Pauli term. Also, note that if the Hamiltonian $H = \sum_i c_i P_i$, where $P_i$ are Pauli terms and $c_i$ are real numberes, then $\langle \psi | H| \psi \rangle = \sum_i c_i \langle \psi | P_i | \psi \rangle$.

+
+

Replying to the comments of the answer

+

In Microsoft's docs it was proposed (not only) an approach of measuring $\langle ZZ \rangle$ and the question was how one can generalize their approach. Actually the generalization of their approach is not obvious to me and I suggest asking a separate question focused on generalizing their approach. Nevertheless, I want to mention that their approach is not the only way of finding $\langle ZZ \rangle$ and here are three alternative ways for doing it:

+

+
    +
  1. If the measured bitstring has odd (even) $1$s then we have measured the state in $-1$ ($+1$) eigenspace. The generalized Qiskit implementation of this approach can be found in this answer. Also, this approach is used (if I have understood the paper right) in this paper from IBM (Fig. 1 shows not only measurements but also simple one qubit unitary transformations ($I$ or $X_{-\frac{\pi}{2}}$ or $Y_{-\frac{\pi}{2}}$) that are specific for each Pauli term).

    +
  2. +
  3. If we measure the ancillary qubit in $| 0\rangle$ ($|1\rangle$) state then we have measured it in $+1$ ($-1$) eigenspace. This circuit is also used for the Hadamard test / scattering circuit. Note that, Pauli terms have real expectation values, so the described circuit for calculating imaginary part of the expectation value in the Hadamard test is not relevant here. The generalization of this approach is fairly simple: for example, this is the circuit for $\langle XZZY \rangle$.

    +
  4. +
  5. If measure the target qubit (targeted by CNOT) $|0\rangle$ ($|1\rangle$) then we have measured the state in the $+1$ ($-1$) eigenspace. Although its working, but the generalization of this approach is not obvious for me and I think this question about generalizing the approach shown in Microsoft's docs deserves a separate question.

    +
  6. +
+

P.S. There exist also other approaches for calculating $\langle ZZ \rangle$.

+",9459,,9459,,9/11/2020 19:00,9/11/2020 19:00,,,,25,,,,CC BY-SA 4.0 +13676,1,,,9/10/2020 14:40,,4,158,"

The end of Section III in the paper Improved Simulation of Stabilizer Circuits by Aaronson and Gottesman shows how to compute the inner product of stabilizer states $|\psi\rangle$ and $|\varphi\rangle$ represented by sets of generators of their stabilizer group.

+

Given generators for $|\psi\rangle$ and $|\varphi\rangle$, it suggests to compute the inner product of $U |\psi\rangle$ and $U |\varphi\rangle$, where $U$ is chosen to ensure that $U |\psi\rangle=|0\rangle^{\otimes n}$. It then computes generators for $U |\varphi\rangle$ represented as a tableau and applies Gaussian elimination to this tableau.

+

I don't understand the following aspects of this algorithm:

+
    +
  • How does the algorithm conclude? (The final steps of the algorithm are not clear to me)
  • +
  • Why is this algorithm correct? (The reasoning in the paper is not clear to me)
  • +
+",2444,,,,,9/10/2020 14:40,Inner Product of Stabilizer States,,0,1,,,,CC BY-SA 4.0 +13677,1,13678,,9/10/2020 17:15,,3,266,"

Given a circuit, if one wishes to add a gate, it is done through a line like the one below

+
mycircuit.cx(0, 1)
+
+

Here, we have added a control-X gate on the 0 and 1 qubits. This is probably a Python question but how can one do this given the string 'cx' and integers 0 and 1 i.e. without manually typing them?

+

I tried using https://stackoverflow.com/questions/3061/calling-a-function-of-a-module-by-using-its-name-a-string but getattr did not work for me.

+
from qiskit import QuantumCircuit
+circ = QuantumCircuit(2)
+circ.draw()
+a = ('cx', 0, 1)
+circ = getattr(circ, a[0])(a[1], a[2])
+circ.draw()
+
+",13206,,13206,,9/10/2020 18:35,9/10/2020 18:51,Qiskit: Add a standard gate to circuit from a string,,1,2,,,,CC BY-SA 4.0 +13678,2,,13677,9/10/2020 18:51,,2,,"

You are getting AttributeError: 'InstructionSet' object has no attribute 'draw' because getattr doesn't return a QuantumCircuit. It returns an InstructionSet, which doesn't have a draw() method.

+
from qiskit import QuantumCircuit
+circuit = QuantumCircuit(2)
+print(type(circuit)) # prints <class 'qiskit.circuit.quantumcircuit.QuantumCircuit'>
+circuit.draw()
+a = ('cx', 0, 1)
+circuit = getattr(circuit, a[0])(a[1], a[2])
+print(type(circuit)) # prints <class 'qiskit.circuit.instructionset.InstructionSet'>
+
+
+

Removing the assignment of circuit to what is returned from getatrr should get rid of the error.

+
from qiskit import QuantumCircuit
+circuit = QuantumCircuit(2)
+circuit.draw()
+a = ('cx', 0, 1)
+getattr(circuit, a[0])(a[1], a[2])
+circuit.draw()
+
+",362,,,,,9/10/2020 18:51,,,,0,,,,CC BY-SA 4.0 +13679,1,13695,,9/10/2020 18:58,,3,339,"

I am doing the 5th exercise on https://qiskit.org/textbook/ch-states/representing-qubit-states.html#Quick-Exercise (all the way at the bottom).

+

Which states find the angle for the vector $\frac{1}{\sqrt2}\begin{pmatrix}i\\ 1\end{pmatrix}$. +I find that $$\cos\left(\frac{\theta}{2}\right) = \frac{i}{\sqrt{2}} +\qquad\text{and}\qquad e^{i\phi} \sin\left(\frac{\theta}{2}\right) = \frac{1}{\sqrt{2}}.$$

+

I don't know how to find the angles. Or do I just leave it in the form of cosine and sine inverse?

+",13208,,20084,,10/13/2022 19:24,10/13/2022 19:24,How to calculate spherical angles for Bloch vector,,2,0,,,,CC BY-SA 4.0 +13680,2,,13528,9/10/2020 19:54,,1,,"

For the mathematical explanation, check here: Why is the action of controlled-Z unaltered by exchanging target control qubits?

+

Maybe it would help you to see CZ in a different (symmetric) notation, like its current representation in Qiskit:

+
from qiskit import *
+circuit = QuantumCircuit(2)
+circuit.cz(0,1)
+circuit.draw('mpl')
+
+

+",1859,,,,,9/10/2020 19:54,,,,0,,,,CC BY-SA 4.0 +13681,1,13683,,9/10/2020 20:47,,2,678,"

I attempted to execute a list of $3200$ QuantumCircuits in Qiskit, each with the max_shots of $8096$ as follows:

+
ibmq_manhattan = provider.get_backend('ibmq_manhattan')
+job = execute(all_qc, backend=ibmq_manhattan, shots=8096)
+job_monitor(job)
+
+

and got the following response:

+
+

Job Status: job has been cancelled

+
+

Furthermore, I successfully performed the exact same execution locally using the Aer qasm_simulator. Presumably this is because there is a runtime timeout on the IBMQ backend device which is triggered as one might expect for such a large list. Is this correct? and if so how can I bypass this limitation?

+

This is a summary of the job on IBMQ: +

+",12248,,55,,9/18/2020 11:08,9/18/2020 11:08,How to execute many circuits on an IBMQ backend?,,2,0,,,,CC BY-SA 4.0 +13682,2,,13681,9/10/2020 21:00,,3,,"

Checkout the backend max_experiments property. The amount of circuits in a job ( len(all_qc)) should be smaller than that.

+

For example, in ibmq_16_melbourne:

+
from qiskit import IBMQ
+
+IBMQ.load_account()
+provider = IBMQ.get_provider(hub='ibm-q')
+device = provider.get_backend('ibmq_16_melbourne')
+device.configuration().max_experiments
+
+
75
+
+",1859,,1859,,9/10/2020 21:07,9/10/2020 21:07,,,,3,,,,CC BY-SA 4.0 +13683,2,,13681,9/10/2020 21:54,,1,,"

If you have more circuits than what the backend allows, consider using IBMQJobManager, which will divide the circuits and collect results for you.

+",12195,,,,,9/10/2020 21:54,,,,0,,,,CC BY-SA 4.0 +13684,1,13693,,9/10/2020 21:59,,0,522,"

I'm trying to run my quantum circuit and plot the simulation result (counts) using the statevector simulator (to avoid 'shot noise'). However, instead of a 2-d histogram, the examples on Qiskit textbook associated with statevector simulator used 'plot_state_city' (which generates 3-d pictures). I'm wondering how can I generate the histogram. Here's part of my code:

+

+

The output statevector isn't the correct one, so the corresponding histogram (and counts) is not what I desired. However, if I use the qasm-simulator, I can get the result I want: +

+

Is there a way I can get the similar histogram using the statevector simulator? Thanks!!

+",12334,,8955,,9/11/2020 8:26,9/11/2020 8:26,How to plot histogram using statevector simulator?,,2,0,,,,CC BY-SA 4.0 +13685,2,,13679,9/10/2020 23:21,,2,,"

The complex number $\frac{1}{\sqrt{2}}+i\frac{1}{\sqrt{2}}$ shows up in a lot situations. It's a primitive eighth root of unity so it equals $e^{i \frac{\pi}{4}}$. Also note that $i$ is a primitive fourth root of unity, so it equals $e^{i \frac{\pi}{2}}$. So in this case $\theta = \frac{\pi}{2}$ and $\phi = \frac{3 \pi}{2}$, which gives this state after pulling out a global phase of $i$. Global phases do not impact outcome probabilities, so states are considered equivalent if they are equal up to a global phase.

+

More generally if you suspect an angle is a rational multiple of $\pi$, but you aren't sure of the value, you can just enter, for example, acos(1/2^.5)/pi, or equivalently log(1/2^.5+i/2^.5)/pi, into your favorite math software, which in this case will spit out $0.25$ for the first and $0.25i$ for the second.

+",8623,,8623,,9/10/2020 23:50,9/10/2020 23:50,,,,0,,,,CC BY-SA 4.0 +13687,1,,,9/11/2020 3:06,,4,267,"

I do understand the math behind phase kickback. The math makes sense. For more context, I find this document very helpful.

+

But I’m struggling a lot to intuitively understand, why the conditional phase change to the second qubit will end up change the phase of the first qubit (the control qubit)?

+

Can somebody help to explain this in an intuitive way?

+",13107,,55,,9/18/2020 11:06,9/18/2020 11:06,How to understand intuitively the quantum gate phase kickback?,,1,2,,,,CC BY-SA 4.0 +13688,1,,,9/11/2020 3:28,,0,328,"

In qiskit, how can I initialise a qubit in a complex state, specifically in the state: +$$\left|q\right> = \frac{1}{\sqrt2} \left|0\right> + i \frac{1}{\sqrt2} \left|1\right>$$

+",13211,,55,,9/18/2020 11:05,9/18/2020 11:05,How to initialise a qubit in the state $\frac{1}{\sqrt2}(|0\rangle+|1\rangle)$ in qiskit?,,2,0,,,,CC BY-SA 4.0 +13689,1,13694,,9/11/2020 4:00,,2,191,"

I am pretty new to Quantum Computing and am not exactly sure what the phase is. +Could you please explain in terms of the Bloch sphere and point out how to mathematically calculate and represent the phase?

+",10153,,55,,7/19/2021 20:49,7/19/2021 20:49,"What is the ""phase"" of a state in terms of the Bloch sphere?",,1,0,,,,CC BY-SA 4.0 +13690,2,,13688,9/11/2020 6:35,,2,,"

You can generate a general quantum state $|\psi\rangle$ in Qiskit by using their Custom package.

+
from qiskit.aqua.components.initial_states import Custom 
+import math 
+state_vector = [1, 1j]
+Psi = Custom(1,state_vector = state_vector).construct_circuit()
+Psi.draw()
+
+

Running the above code in Qiskit would give you something like below:

+

+
+

But also notice that your state $|q\rangle = \dfrac{1}{\sqrt{2}}\big( |0\rangle + i | 1\rangle \big) $ is actually resulting from

+

$$ \dfrac{Z + Y}{\sqrt{2}} |0\rangle = |q\rangle $$

+

where $Z$ and $Y$ are the Pauli matrices and $|0\rangle = \begin{bmatrix} 1 \\ 0 \end{bmatrix} $.

+",9858,,,,,9/11/2020 6:35,,,,0,,,,CC BY-SA 4.0 +13691,2,,13684,9/11/2020 6:56,,1,,"

If I understand correctly, Statevector_simulator is a perfect simulator. It's going through all the linear algebra, do the actual math, instead of mimicking the quantum computer. Therefore, you won't have the probabilities distribution like qasm_simulator, or like when you run on the quantum hardware. The statevector simulator will output the statevector of the final quantum state, as the name suggested.

+",9858,,,,,9/11/2020 6:56,,,,0,,,,CC BY-SA 4.0 +13692,2,,13688,9/11/2020 6:57,,2,,"

You can use initialize function. Here is a code constructing your one qubit state:

+
from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit, Aer, execute
+import math as m
+
+quantumState = [
+    1 / m.sqrt(2) * complex(1, 0),
+    1 / m.sqrt(2) * complex(0, 1)]
+
+q = QuantumRegister(1, name = 'q')
+c = ClassicalRegister(1, name = 'c')
+
+circuit = QuantumCircuit(q,c)
+
+circuit.initialize(quantumState, [q[0]])
+
+

You can prepare multiqubit states as well, for example for $|\psi\rangle = \frac{1}{2}(|00\rangle + |01\rangle+|10\rangle+|11\rangle)$:

+
from qiskit import ClassicalRegister, QuantumRegister, QuantumCircuit, Aer, execute
+import math as m
+
+quantumState = [0.5,0.5,0.5,0.5]
+
+q = QuantumRegister(2, name = 'q')
+c = ClassicalRegister(2, name = 'c')
+
+circuit = QuantumCircuit(q,c)
+
+circuit.initialize(quantumState, [q[0],q[1]])
+
+",9006,,,,,9/11/2020 6:57,,,,0,,,,CC BY-SA 4.0 +13693,2,,13684,9/11/2020 6:59,,2,,"

It's a little difficult to tell without looking at your circuit, but I believe this is because your circuit contains a measurement in it.
+(edit: if there were no measurements the qasm simulator wouldn't work, so you obviously have a measurement happening in your circuit)

+

The statevector_simulator simply gives you the state generated by your circuit. If you have a measurement in there, it will collapse any superposition generated prior to it and you will only see the outcome of the measurement. As you have rightly discovered, using this to plot a histogram is of no use because the get_counts method will return something that looks like {'measurement_outcome' : 1}. However, the qasm_simulator performs as many measurement shots as you tell it to and aggregates the results in counts, which makes it useful for plotting histograms.

+

So if you want to plot a histogram and you need to use the statevector_simulator, remove the measurements from the circuit. If you don't want to mess with the circuit itself, there's a handy method called remove_final_measurements that you can pass to execute as follows:

+
execute(qc.remove_final_measurements(inplace=False), backend=simulator)
+
+",8955,,,,,9/11/2020 6:59,,,,4,,,,CC BY-SA 4.0 +13694,2,,13689,9/11/2020 7:08,,4,,"

Quantum phase does not have an analog in classical world, it is simply one of quantum phenomenon (feature,...). To put it simply mathematicaly, you can write any qubit as +$$ +|q\rangle = \alpha|0\rangle + \beta|1\rangle, +$$ +i.e. a superposition of states $|0\rangle$ and $|1\rangle$ (you can choose any other two orthogonal state but I think that quantum analogs to 0 and 1 bit are more illustrative).

+

Parameters $\alpha$ and $\beta$ are complex numbers, so you can write them in exponential form, i.e. $\alpha = |\alpha|\mathrm{e}^{i\varphi_\alpha}$, similarly $\beta= |\beta|\mathrm{e}^{i\varphi_\beta}$. Now, put this into our definition of qubit: +$$ +|q\rangle = |\alpha|\mathrm{e}^{i\varphi_\alpha}|0\rangle + |\beta|\mathrm{e}^{i\varphi_\beta}|1\rangle, +$$ +and factor out $\mathrm{e}^{i\varphi_\alpha}$: +$$ +|q\rangle = \mathrm{e}^{i\varphi_\alpha}[|\alpha||0\rangle + |\beta|\mathrm{e}^{i(\varphi_\beta-\varphi_\alpha)}|1\rangle]. +$$

+

$\varphi_\alpha$ is called global phase. Whole term $\mathrm{e}^{i\varphi_\alpha}$ can be neglected as two qubits which differ in global phase only are physically undistinguishable. So, after substituting $\varphi = \varphi_\beta-\varphi_\alpha$ we are left with +$$ +|q\rangle = |\alpha||0\rangle + |\beta|\mathrm{e}^{i\varphi}|1\rangle. +$$ +A parameter $\varphi$ is called relative phase.

+",9006,,,,,9/11/2020 7:08,,,,2,,,,CC BY-SA 4.0 +13695,2,,13679,9/11/2020 7:29,,3,,"

What you're trying to do is find a parametrisation of the state in the form +$$ +\left(\begin{array}{c} \cos\frac{\theta}{2} \\ \sin\frac{\theta}{2}e^{i\phi} \end{array}\right) +$$ +However, you'll notice that the first element is real, while it isn't in your state, so they cannot be matched. Instead, what is actually going on where is that you require equivalence up to a global phase. Hence, you should write your state as +$$ +i\left(\begin{array}{c} \frac{1}{\sqrt{2}} \\ \frac{-i}{\sqrt{2}} \end{array}\right). +$$ +So, now you can try to match up +$$ +\left(\begin{array}{c} \frac{1}{\sqrt{2}} \\ \frac{-i}{\sqrt{2}} \end{array}\right)=\left(\begin{array}{c} \cos\frac{\theta}{2} \\ \sin\frac{\theta}{2}e^{i\phi} \end{array}\right). +$$ +From this, you'll see that $\cos\frac{\theta}{2}=\frac{1}{\sqrt{2}}$ and hence $\theta=\pi/2$. It then follows that $e^{i\phi}=-i$ and hence $\phi=3\pi/2$.

+",1837,,,,,9/11/2020 7:29,,,,0,,,,CC BY-SA 4.0 +13696,2,,13687,9/11/2020 7:39,,4,,"

Part of the problem people usually have here is a sort-of-classical intuition. Because you're trying to describe the action of a gate such as controlled-$U$, we divide it up as "if the control qubit is something, do something on the target qubit". It makes it sound like the control qubit doesn't change, and it's only the target that changes. This is completely wrong. One semi-intuitive way to see this is to consider the specific example of controlled-phase. This is symmetric - it doesn't matter which qubit you identify as control and which as target. +$$ +|0\rangle\langle 0|\otimes I+|1\rangle\langle 1|\otimes Z=I\otimes |0\rangle\langle 0|+Z\otimes|1\rangle\langle 1| +$$ +Given that the gate is not the identity, something must change, and hence both qubits must change! It is a genuinely two-qubit gate that changes the two-qubit state.

+",1837,,,,,9/11/2020 7:39,,,,1,,,,CC BY-SA 4.0 +13697,1,,,9/11/2020 7:48,,2,258,"

How can I generate and print a 32 bit sequence of 0s and 1s in Qiskit or IBM Q experience quantum lab using quantum random number generator implementation?

+",13172,,9006,,9/18/2020 6:51,9/18/2020 6:51,quantum random number generator implementation in quantum lab,,2,2,,,,CC BY-SA 4.0 +13698,1,13699,,9/11/2020 8:34,,2,179,"

I am trying to understand the soundness bound reached in Theorem 4 of this paper, which deals with separating $QMA$ and $QCMA$ with respect to an in-place oracle. To state just the part I am confused with:

+
+

For some fixed integer $n$, let $N = 2^{{n}}$. Let $S \subseteq + [N^{2}]$ be a set such that $|S| = N$. Let

+

$$A = \frac{1}{2^{n}}~~ \Big| \sum_{i \in S} \beta_{i} \Big|^{2}$$

+

and

+

$$B = \sum_{i \in Z_{even} \cap S} | \beta_{i} |^{2}.$$

+

where each $\beta_{i}$ is a complex number, $[n] = \{1, 2, \ldots, + n \}$ and

+

$$\sum_{i \in [N^{2}]} | \beta_{i} |^{2} = 1.$$

+

$Z_{even}$ is the set of all even integers, where we know that $|Z_{even} \cap S| = \frac{1}{3} |S|$. I am trying to prove that

+

$$1 \geq \frac{\sqrt{3A} +(\sqrt{2} - 1)B}{\sqrt{2}}.$$

+
+

As per the paper, I am using the triangle and Cauchy Schwarz inequalities but I get stuck after a point. Here is my incomplete attempt at a solution:

+

$$A \leq \frac{1}{2^{n}}~ \Bigg(\sum_{i \in S} |\beta_{i}|\Bigg)^{2} \leq ~ \sum_{i \in S} |\beta_{i}|^{2} = B + \sum_{i \in Z_{odd} \cap S} | \beta_{i} |^{2}.$$

+

I am stuck after this.

+",1351,,55,,9/23/2020 9:30,9/23/2020 9:30,Question regarding soundness bound in QMA versus QCMA separation,,2,2,,,,CC BY-SA 4.0 +13699,2,,13698,9/11/2020 10:35,,3,,"

I'm not entirely convinced that this statement is true without further constraints.

+

Let me set +$$\beta_i=\left\{\begin{array}{cc} +\sqrt\frac{3x}{2^n} & i\in Z_\text{even}\cap S \\ +\sqrt\frac{3(1-x)}{2^{n+1}} & i\in Z_\text{odd}\cap S \\ +0 & \text{otherwise} +\end{array}\right. +$$ +These must satisfy the inequality for all $0\leq x\leq 1$. This inequality states +$$ +\sqrt{2}\geq \sqrt{x}+\sqrt{2(1-x)}+(\sqrt{2}-1)x. +$$ +This is exactly satisfied for $x=0,1$, but for any $x$ in between, it doesn't work. For example, $x=1/2$ gives the value $\sqrt{2}+1/2$.

+",1837,,,,,9/11/2020 10:35,,,,4,,,,CC BY-SA 4.0 +13700,2,,13698,9/11/2020 15:03,,2,,"

The correct inequality should be: +$$ \sqrt{3A} \leq \sqrt{B} + \sqrt{2(1-B)} $$ +The proof is the following: +\begin{align*} +\big| \sum_{i \in S} \beta_i \big| &\leq \big| \sum_{i \in S \cap \mathbb{Z}_{even}} \beta_i \big| + \big| \sum_{i \in S \cap \mathbb{Z}_{odd}} \beta_i \big| \\ +& \leq \sqrt{|S \cap \mathbb{Z}_{even}|} \cdot \sqrt{\sum_{i \in S \cap \mathbb{Z}_{even}} |\beta_i|^2} + \sqrt{|S \cap \mathbb{Z}_{odd}|} \cdot \sqrt{\sum_{i \in S \cap \mathbb{Z}_{odd}} |\beta_i|^2} \\ +& \leq \sqrt{|S \cap \mathbb{Z}_{even}|} \cdot \sqrt{\sum_{i \in S \cap \mathbb{Z}_{even}} |\beta_i|^2} + \sqrt{|S \cap \mathbb{Z}_{odd}|} \cdot \sqrt{\sum_{i \in S} |\beta_i|^2 - \sum_{i \in S \cap \mathbb{Z}_{even}} |\beta_i|^2} \\ +& \leq \sqrt{\frac{|S|}{3}} \cdot \sqrt{B} + \sqrt{\frac{2|S|}{3}} \cdot \sqrt{1-B} +\end{align*} +where triangle inequality and the fact that $ ||x||_1 \leq \sqrt{n} ||x||_2 $ were used in the first two lines.

+

The inequality is tight (see previous answer for an example).

+

Coming back to the original paper, the probability bound in the 'soundness' argument should be: +$$ \frac{1}{2}(p_{(i)} + p_{(ii)}) \leq \frac{1}{2}\cdot \Big( \frac{\big(\sqrt{p_{(ii)}} + \sqrt{2(1-p_{(ii)})}\big)^2}{3} + p_{(ii)} \Big) $$ +with maximum value $ \frac{1}{2} (1 + \frac{1}{\sqrt{3}}) \approx 0,788 $ and the general argument still holds.

+",13109,,13109,,9/11/2020 15:20,9/11/2020 15:20,,,,0,,,,CC BY-SA 4.0 +13701,1,13703,,9/11/2020 15:14,,3,517,"

I am new to quantum gates but do not understand the connection between the $RX$ and $X$ gates. I know that

+

$$R X(\theta)=\exp \left(-i \frac{\theta}{2} X\right)=\left(\begin{array}{cc} +\cos \frac{\theta}{2} & -i \sin \frac{\theta}{2} \\ +-i \sin \frac{\theta}{2} & \cos \frac{\theta}{2} +\end{array}\right)$$

+

Meanwhile the $X$ gate is given by

+

$$X = \left(\begin{array}{cc} +0 & 1 \\ +1 & 0 +\end{array}\right)$$

+

Is there a value of $\theta$ such that the two are the same? I see that choosing $\theta = \pi/2$ gives the result upto an overall factor of $-i$. Is that it or is there a deeper connection between the two gates? Is there a similar connection between the $Y$ and $RY$ gates and the $Z$ and $RZ$ gates such that the rotated gates are more general than the $X, Y$ and $Z$ gates?

+",13214,,,,,9/11/2020 16:19,What is the connection between $RX$ gates and $X$ gates (similar for $Y$ and $Z$)?,,1,0,,,,CC BY-SA 4.0 +13702,1,,,9/11/2020 16:15,,1,140,"

I'm just ttrying to run the simple example code in Google's Cirq startup page: +https://cirq.readthedocs.io/en/stable/google/engine.html

+

I think I have the access authorized correctly via Google's Console, but can someone help me understand where I would find the information for the PROCESSOR_ID? Thanks.

+

Code cut/paste from their webpage here:

+
import cirq
+import cirq.google as cg
+
+# A simple sample circuit
+qubit = cirq.GridQubit(5, 2)
+circuit = cirq.Circuit(
+    cirq.X(qubit)**0.5,                 # Square root of NOT.
+    cirq.measure(qubit, key='result')   # Measurement.
+)
+
+# Create an Engine object to use.
+# Replace YOUR_PROJECT_ID with the id from your cloud project.
+engine = cg.Engine(project_id=YOUR_PROJECT_ID, proto_version=cg.ProtoVersion.V2)
+
+# Create a sampler from the engine
+sampler = engine.sampler(processor_id='PROCESSOR_ID', gate_set=cg.SYC_GATESET)
+
+# This will run the circuit and return the results in a 'TrialResult'
+results = sampler.run(circuit, repetitions=1000)
+
+# Sampler results can be accessed several ways
+
+# For instance, to see the histogram of results
+print(results.histogram(key='result'))
+
+# Or the data itself
+print(results.data)
+
+",13104,,55,,9/18/2020 11:03,9/18/2020 11:03,Running Google Cirq example code from their webpage -- where do I find information about PROCESSOR_ID?,,2,0,,,,CC BY-SA 4.0 +13703,2,,13701,9/11/2020 16:19,,3,,"

You're almost correct - choosing $ \theta = \pi$ does yield $$ \begin{bmatrix} 0 & -i \\ -i & 0 \end{bmatrix} $$

+

Because this differs from the $X$ gate by a constant factor global phase ($ -i$), the gates are equivalent. (See here to learn more about the global phase).

+

This connection holds similarly for $ RY$ and $Y$, and $RZ$ and $Z$. A way to visualize this is the Bloch sphere: in essence, these gates are rotations about the $X, Y, Z$ axes (respectively):

+

+

So essentially our Pauli primitives are $\pi$ rotations over the respective axis.

+",8343,,,,,9/11/2020 16:19,,,,4,,,,CC BY-SA 4.0 +13704,2,,13702,9/11/2020 16:41,,1,,"

Do you have access specifically given by Google? See the second paragraph in the link you sent:

+
+

Note that the Quantum Engine API is not yet open for public access.

+
+

Likely their chips are only being used for internal testing now, and the docs are being prepped for public release / public chip access.

+",8343,,,,,9/11/2020 16:41,,,,2,,,,CC BY-SA 4.0 +13705,1,13706,,9/11/2020 19:00,,-1,32,"

Here is my code

+
import numpy as np
+import qiskit
+from qiskit import *
+
+
+number_of_qubits = 3
+backend_sim = Aer.get_backend('qasm_simulator')
+
+#Generate a circuit in qiskit
+input_circuit = QuantumCircuit(number_of_qubits, number_of_qubits)
+input_circuit.x(0)
+input_circuit.h(1)
+input_circuit.cx(0,1)
+input_circuit.i(1) 
+input_circuit.x(1)
+
+job_sim = execute(input_circuit, backend_sim, shots=1024)
+result_sim = job_sim.result()
+counts = result_sim.get_counts(input_circuit)
+print(counts)
+
+

No matter what gates I try (e.g. I can remove the last X gate), the result is always '000': 1024. What am I doing wrong?

+",4831,,,,,9/11/2020 19:25,Qiskit job not giving the right result after execution,,1,0,,,,CC BY-SA 4.0 +13706,2,,13705,9/11/2020 19:16,,1,,"

Your current circuit looks like this:

+

+

In order to get the "counts", you need to measure at the end of the circuit, before execute.

+
input_circuit.measure(range(number_of_qubits), range(number_of_qubits))
+
+

+",1859,,1859,,9/11/2020 19:25,9/11/2020 19:25,,,,1,,,,CC BY-SA 4.0 +13707,1,13709,,9/11/2020 20:26,,0,822,"

When using qiskit execute it is possible to stipulate the number of shots for each experiment/QuantumCircuit, however when using IBMJobManager this is seemingly not possible.

+

Is this correct and if so how many shots are executed by default? and if not how can the number of shots be specified?

+",12248,,,,,9/11/2020 21:47,How many shots are executed when using the IBMQJobManager?,,2,0,,,,CC BY-SA 4.0 +13708,2,,13702,9/11/2020 20:29,,2,,"

There is a method list_processors on the engine object that will return a list of processor objects which include a processor id:

+
for p in engine.list_processors():
+    print(p.processor_id)
+
+

That being said, as mentioned in the cirq docs you linked, Google's quantum computing service isn't publicly available yet. So the most likely result of running that code is an access error, or an empty list (meaning you have access to no processors). If you want to watch someone using the service (plus some neat hardware build stuff) you can watch the second half of the "Google's Quantum Computing Service" presentation at the 2020 quantum summer symposium.

+",119,,,,,9/11/2020 20:29,,,,1,,,,CC BY-SA 4.0 +13709,2,,13707,9/11/2020 21:31,,1,,"

You can specify IBMQJobManager.run(shots=my_shots). See run_config in IBMQJobManager.run() documentation: https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.run.html#qiskit.providers.ibmq.managed.IBMQJobManager.run

+

The default is 1024 or the maximum allowed by the backend, whichever is smaller.

+",12195,,,,,9/11/2020 21:31,,,,0,,,,CC BY-SA 4.0 +13710,2,,13707,9/11/2020 21:47,,1,,"

When using execute in qiskit, you can specify how many shots you want done for a circuit in the following way:

+
#for a defined circuit and backend
+job = execute(circuit, backend, shots=___)
+
+

where you fill in the blank with some number between 1 and 8192, the min and max shots you can execute on any backend. If you want to run one circuit, I would use execute.

+

If you want to run many circuits at once, then I would use IBMQJobManager. You first have to put the circuits in a list and transpile them to your backend, then run them using the method IBMQJobManager().run(). You can also specify the number of shots for each job as shown:

+
#for a defined list of circuits and backend
+circuits = transpile(circuit, backend)
+job = IBMQJobManager().run(circuits, backend, shots = ___)
+
+

where the range for the possible number of shots is the same as that for execute. More information about IBMQJobManager can be found here: https://qiskit.org/documentation/stubs/qiskit.providers.ibmq.managed.IBMQJobManager.html#qiskit.providers.ibmq.managed.IBMQJobManager

+

Also, the default number of shots on any job run on an IBMQ backend is 1024.

+",13117,,,,,9/11/2020 21:47,,,,0,,,,CC BY-SA 4.0 +13711,1,13712,,9/11/2020 21:50,,0,55,"

According to the ManagedResults Documentation the class has a combine_results method, however when attempting to use it as follows:

+
job_set = IBMQJobManager().run(circs, backend=ibmq_backend, name='job-set-abc')
+job_results = job_set.results()
+job_results_combined = job_results.combine_results() # fails on this line
+job_counts_combined = job_results_combined.get_counts()
+
+

I get the following error:

+
+

AttributeError: 'ManagedResults' object has no attribute 'combine_results'

+
+

Furthermore, the combine_results method is not listed under help(type(job_results)):

+

Does this mean that the method has been deprecated? If so how can I overcome this?

+",12248,,,,,9/11/2020 23:01,Is the combine_results method deprecated in qiskit v0.20.0,,1,0,,,,CC BY-SA 4.0 +13712,2,,13711,9/11/2020 23:01,,0,,"

It's still there. See the source code: https://github.com/Qiskit/qiskit-ibmq-provider/blob/stable/0.8/qiskit/providers/ibmq/managed/managedresults.py#L178

+

Are you using the right version of qiskit-ibmq-provider? combine_results was introduced in 0.8.

+

If you do

+
import qiskit
+print(qiskit.__qiskit_version__)
+
+

it'll show you the version of each element.

+",12195,,,,,9/11/2020 23:01,,,,2,,,,CC BY-SA 4.0 +13713,1,,,9/12/2020 2:58,,1,58,"

When I measure 2 and 3 qubits after putting H gate on all of them, there is a variation in probabilities of results in comparison with theoretical values (25% and 12.5%, respectively).

+

This occurs on different IBM machines and QASM simulators. What causes these differences?

+",13172,,55,,9/15/2020 16:21,9/15/2020 16:21,"What causes the random variations in the probabilities with respect to the theoretical values, in IBM and QASM simulators?",,0,3,,,,CC BY-SA 4.0 +13714,1,,,9/12/2020 9:10,,2,118,"

I am going through the QAOA section in the Qiskit Textbook - QAOA and am stuck in one of the steps. In section 5.2, the method for getting the Optimal Trial State Parameters are discussed. I do not follow how does Eq 2 follow from Eq 1. + +I have done some digging and have read other useful posts like Quantum Approximate Optimization Algorithm explained and How to do the direct evaluation by hand in QAOA algorithm, and they have helped understand the problem better; but I am still unable to derive Equation 2 from 1. Any help or guidance would be appreciated. I am trying to find the optimal parameters of beta and gamma for different kind of graphs.

+",13221,,,,,9/12/2020 9:10,Deriving Expression For QAOA Optimal Trial State Parameters,,0,0,,,,CC BY-SA 4.0 +13715,1,,,9/12/2020 9:35,,1,123,"

what is the significance of varying the number of shots while running a circuit in a quantum machine and qasm simulator?

+

Does more number of shots give better/accurate result? +I am running a simple 2 qubit measurement circuit after Hadamard gates on both qubits.

+",13172,,55,,9/15/2020 16:20,9/15/2020 16:20,What is the significance of varying the number of shots while running a circuit in a quantum machine and qasm simulator?,,1,0,,,,CC BY-SA 4.0 +13716,2,,13715,9/12/2020 10:09,,1,,"

When you perform one shot, the measurement at the end of the computation gives you one of the possible results. More shots produce a distribution.

+

In your simple example, you should get a uniform distribution over 00, 01, 10 and 11. You should notice that, with more shots, the distribution you get is more similar to the uniform one.

+",5551,,,,,9/12/2020 10:09,,,,2,,,,CC BY-SA 4.0 +13718,1,13722,,9/12/2020 12:17,,1,48,"

We know for a pure state conversion $|\psi \rangle \rightarrow_\textrm{LOCC} |\phi \rangle$ via local operation and classical communication (LOCC), an entanglement monotone should not increase, that is, $E(|\psi \rangle) \geq E(|\phi \rangle)$.

+

Say for a pure to mixed state conversion $|\psi \rangle \rightarrow_\textrm{LOCC} \rho$ given by the unique ensemble $l = \{ q_l, |\xi_l \rangle \} \in \mathcal{D}$ fixed by pointer states (which are omitted), where $\mathcal{D}$ is the set of all decompositions for $\rho$.

+

Naturally, the convex roof extension $E_\textrm{min}(\rho) = \min_\mathcal{D} \Sigma_i q_i |\xi_i \rangle \langle \xi_i|$ should not increase, nor should that of the obtained ensemble $l$ on average, i.e., $E(|\psi \rangle) \geq E_l(\rho) \geq E_\textrm{min}(\rho)$.

+

So, is it for certain there is not some decomposition $j = \{ q_j, |\xi_j \rangle \}$ that violates the nonincreasing criterion for $E$ on average, i.e., $E_j(|\rho \rangle) \geq E(\psi \rangle)$?

+",13204,,13204,,9/12/2020 19:34,9/12/2020 19:34,Is entanglement nonincreasing on average by local operations for all possible ensemble decompositions?,,1,0,,,,CC BY-SA 4.0 +13719,1,,,9/12/2020 15:32,,3,102,"

Suppose Alice and Bob share the quantum state $\frac{1}{\sqrt 2}(|x\rangle + (-1)^b |y\rangle)$ for some $x\neq y \in \{0,1\}^2$ and $b \in \{0,1\}$. They both do not know $x,y$, and use some middlemen who wishes to learn $b$. They are allowed to send only classical messages to him (i.e. not quantum states). The marginal density matrix of Alice, for example, is +$$ +\rho_A = tr_B(\rho_{AB}) = \frac{1}{2}( |x_1\rangle \langle x_1| +|y_1\rangle \langle y_1| ++ (-1)^b |x_1 \rangle \langle y_1| \cdot \langle x_2 | y_2 \rangle ++ (-1)^b |y_1 \rangle \langle x_1| \cdot \langle y_2 | x_2 \rangle +) +$$ +Note that when $x_2 \neq y_2$, then $\rho_A$ does not depends on $b$. Moreover, if also $x_1 \neq y_1$, from symmetry arguments, $\rho_B$ does not depends on $b$. +In such case, it seems to me that they can not send any data to the middleman (such as measurements), to help him deduce $b$, as the marginal density matrix, i.e. their personal view of the system, is oblivous of $b$. Is it correct to say so?

+

Of course when $x_2 = y_2$ for example, then Alice marginal density matrix does depends on $b$, and she can apply Hadamard gate + measure, to obtain exactly $b$, and send it to the middleman.

+",13152,,55,,9/15/2020 16:18,9/16/2020 7:09,Can Alice and Bob distinguish entangled state coefficients?,,2,0,,,,CC BY-SA 4.0 +13720,1,13721,,9/12/2020 17:39,,1,518,"

It seems like I can use https://qiskit.org/documentation/stubs/qiskit.circuit.random.random_circuit.html but I would like to control the gates that are allowed.

+

What is an efficient way to make random circuits with a fixed set of gates?

+",4831,,55,,9/18/2020 9:48,9/18/2020 9:48,Is there a way to generate random circuits in qiskit with only certain allowed gates?,,1,0,,,,CC BY-SA 4.0 +13721,2,,13720,9/12/2020 18:09,,2,,"

I think you should report of "feature request" issue if you have a good use case for this. It should not be hard to implement and I could help with it.

+

If by any chance your fixed set of gates is based on the amount of qubits involved in gate, you can control that with max_operands. For example, you can exclude CCXGate and CSwapGate (3-qubit operands) with max_operand=2.

+

If this is not the case, the source code for random_circuit seems straightforward to modify for your need. You can remove or add the gates from *_q_ops and *_param variables on top.

+
def random_circuit(num_qubits, depth, max_operands=3, measure=False,
+                   conditional=False, reset=False, seed=None):
+    
+    if max_operands < 1 or max_operands > 3:
+        raise CircuitError("max_operands must be between 1 and 3")
+
+    one_q_ops = [IGate, U1Gate, U2Gate, U3Gate, XGate, YGate, ZGate,
+                 HGate, SGate, SdgGate, TGate, TdgGate, RXGate, RYGate, RZGate]
+    one_param = [U1Gate, RXGate, RYGate, RZGate, RZZGate, CU1Gate, CRZGate]
+    two_param = [U2Gate]
+    three_param = [U3Gate, CU3Gate]
+    two_q_ops = [CXGate, CYGate, CZGate, CHGate, CRZGate,
+                 CU1Gate, CU3Gate, SwapGate, RZZGate]
+    three_q_ops = [CCXGate, CSwapGate]
+
+    qr = QuantumRegister(num_qubits, 'q')
+    qc = QuantumCircuit(num_qubits)
+
+    if measure or conditional:
+        cr = ClassicalRegister(num_qubits, 'c')
+        qc.add_register(cr)
+
+    if reset:
+        one_q_ops += [Reset]
+
+    if seed is None:
+        seed = np.random.randint(0, np.iinfo(np.int32).max)
+    rng = np.random.default_rng(seed)
+
+    # apply arbitrary random operations at every depth
+    for _ in range(depth):
+        # choose either 1, 2, or 3 qubits for the operation
+        remaining_qubits = list(range(num_qubits))
+        while remaining_qubits:
+            max_possible_operands = min(len(remaining_qubits), max_operands)
+            num_operands = rng.choice(range(max_possible_operands)) + 1
+            rng.shuffle(remaining_qubits)
+            operands = remaining_qubits[:num_operands]
+            remaining_qubits = [q for q in remaining_qubits if q not in operands]
+            if num_operands == 1:
+                operation = rng.choice(one_q_ops)
+            elif num_operands == 2:
+                operation = rng.choice(two_q_ops)
+            elif num_operands == 3:
+                operation = rng.choice(three_q_ops)
+            if operation in one_param:
+                num_angles = 1
+            elif operation in two_param:
+                num_angles = 2
+            elif operation in three_param:
+                num_angles = 3
+            else:
+                num_angles = 0
+            angles = [rng.uniform(0, 2 * np.pi) for x in range(num_angles)]
+            register_operands = [qr[i] for i in operands]
+            op = operation(*angles)
+
+            # with some low probability, condition on classical bit values
+            if conditional and rng.choice(range(10)) == 0:
+                value = rng.integers(0, np.power(2, num_qubits))
+                op.condition = (cr, value)
+
+            qc.append(op, register_operands)
+
+    if measure:
+        qc.measure(qr, cr)
+
+    return qc
+
+",1859,,1859,,9/13/2020 0:19,9/13/2020 0:19,,,,1,,,,CC BY-SA 4.0 +13722,2,,13718,9/12/2020 18:52,,1,,"

You don't even define $E_j(\rho)$. This makes your question hard to answer.

+

But if this is the average entanglement over that decomposition: Of course this can violate it. For instance, you can map any state to a maximally mixed state by LOCC, and the maximally mixed state can be written as a convex combination of the four Bell states, which are all maximally entangled.

+",491,,,,,9/12/2020 18:52,,,,5,,,,CC BY-SA 4.0 +13723,1,13724,,9/12/2020 20:33,,5,1065,"

I have two circuits that I believe are equivalent. When I say 'equivalent' I mean that they have equivalent unitary representations up to a global phase. How can one check this using Qiskit? How I would show equivalence isn't clear to me.

+",13222,,14239,,5/11/2022 20:50,5/11/2022 20:50,Test equivalence of circuits exactly on qiskit,,2,0,,,,CC BY-SA 4.0 +13724,2,,13723,9/12/2020 21:53,,1,,"

As it is point out, depends on your notion of equivalence.

+

State vectors

+

Two circuits are equivalent upto global phase if they represent the same state vector. Consider the following two circuits:

+
from qiskit import QuantumCircuit
+import numpy as np
+
+qc1 = QuantumCircuit(2)
+qc1.h(0)
+qc1.cx(0,1)
+
+qc2 = QuantumCircuit(2)
+qc2.u2(0, np.pi, 0)
+qc2.cx(0,1)
+
+

It is possible to check if their state vector is the same with the Qiskit qiskit.quantum_info module:

+
from qiskit.quantum_info import Statevector
+Statevector.from_instruction(qc1).equiv(Statevector.from_instruction(qc2)) # True
+
+

Unitary matrices

+

If you need to consider global phase, in that case you need to compare their unitary matrices via simulation.

+

In the following case:

+
qc1 = QuantumCircuit(1)
+qc1.x(0)
+
+qc2 = QuantumCircuit(1)
+qc2.rx(np.pi, 0)
+
+

These circuit has the same state vector, but not the same unitary:

+
Statevector.from_instruction(qc1).equiv(Statevector.from_instruction(qc2))  # True
+
+backend_sim = Aer.get_backend('unitary_simulator')
+job_sim = execute([qc1, qc2], backend_sim)
+result_sim = job_sim.result()
+unitary1 = result_sim.get_unitary(qc1)
+unitary2 = result_sim.get_unitary(qc2)
+
+np.allclose(unitary1, unitary2)  # False
+
+
+

Counts

+

If your circuits have measurements, you probably want to consider these to circuits equivalent, since their measured results are equivalent.

+
qc1 = QuantumCircuit(2,2)
+qc1.h(0)
+qc1.measure(0,0)
+qc1.measure(1,1)
+
+qc2 = QuantumCircuit(2,2)
+qc2.h(0)
+qc2.swap(0,1)
+qc2.measure(0,1)
+qc2.measure(1,0)
+
+

In this case, you want to compare their result counts, considering some statistical error:

+
backend_sim = Aer.get_backend('qasm_simulator')
+job_sim = execute([qc1, qc2], backend_sim, shots=1000)
+result_sim = job_sim.result()
+counts1 = result_sim.get_counts(qc1)
+counts2 = result_sim.get_counts(qc2)
+print(counts1, counts2)
+
+

Up to Ancillas

+

You might want to consider these two circuits equivalent:

+
qc1 = QuantumCircuit(3)
+qc1.x(0)
+
+qc2 = QuantumCircuit(1)
+qc2.rx(np.pi, 0)
+
+

It was suggested to invert one of them, compose them (wiring the ancillas) and check if it is the identity. For example:

+
from qiskit.quantum_info import Operator
+
+composed = qc1.compose(qc2.inverse(), qubits=range(len(qc2.qubits)))
+Operator(composed).equiv(Operator.from_label('I'*len(qc1.qubits))) # True
+
+",1859,,1859,,9/13/2020 14:03,9/13/2020 14:03,,,,7,,,,CC BY-SA 4.0 +13725,1,,,9/12/2020 23:29,,0,915,"

I'm new to qiskit and I want to know how do I define a projector operator in qiskit? Specifically, I have prepared a 3 qubit system, and after applying a whole lot of gates and measuring it in a state vector simulator, I have to apply the projector operator $|0\rangle_{1}|0\rangle_{2} \langle0|_{1}\langle0|_{2}$ on the state that I get after I measured all the qubits in the circuit. I do know the physics and math behind it, and the tensor product it represents but I'm unable to code this successfully. I was thinking maybe a 4x4 matrix representation of this operator might help but I'm not sure about it.

+

So I'm asking 2 questions here-

+
    +
  1. How do I define a projector operator like this in qiskit
  2. +
  3. How do I apply that operator to a state that I have measured with a state vector simulator?
  4. +
+

Thanks in advance

+",7706,,7706,,9/13/2020 9:35,9/17/2020 19:19,How to code a projector operator in qiskit?,,1,0,0,,,CC BY-SA 4.0 +13728,1,,,9/13/2020 10:11,,0,1577,"

When I run the following command

+
qc.draw(output='mpl')
+
+

for my circuit qc, I get this error:

+
ImportError: The class MatplotlibDrawer needs pylatexenc
+
+

How do I address this issue? Below an image of my problem

+

+

Update ------
+Installation steps on Google Colaboratoy:
+!pip install pylatexenc ?.

+ +

The installation attempt (was successful and the installed pylatexenc has version 2.7.)

+ +",8527,,13132,,9/18/2020 10:40,12/8/2020 11:22,Google Colab - ImportError: The class MatplotlibDrawer needs pylatexenc,,4,10,,,,CC BY-SA 4.0 +13731,1,,,9/13/2020 13:52,,1,532,"

I've been learning about quantum computing, and I noticed that another way to describe the state vector is as a path in a binary tree where each level of tree represents another qubit, each node represents a state, and the edge weights represent the probability amplitude of moving from one state to another. Here's an example: (Sorry for MS Paint!)

+

+

Now what's interesting is that if you start with a state vector of |0>, placing qubits into superposition opens paths in the tree, while entanglement and "measurement" close paths. I was working this out with the sudoku example in the qiskit textbook at Qiskit Grover's Algorithm Example, and I found that if you adhere to the following principles, you can find the solution state while avoiding false paths in the tree just by following the quantum circuit:

+
    +
  1. Start with a linear tree with every bit in the 0 state.
  2. +
  3. Place a single variable qubit into superposition, creating a single sub-tree/branch.
  4. +
  5. Apply all CNOT gates related to that qubit to close off any potential branching and adjust the states of the nodes appropriately.
  6. +
  7. Whenever a "clause bit" (as described in the link above) no longer has any more gates attached to it, or is no longer being interacted with, close all branches where the nodes do not have the "clause bit" in a position of 1.
  8. +
  9. Place the next variable qubit into superposition and repeat 3 & 4, until all variable qubits have been placed into superposition.
  10. +
+

So, the circuit design would look like this (forget about the diffuser and toffoli for the moment):

+

+

I did a step-by-step implementation of this in excel, drawing out all of the trees, and I found that only two main sub-trees form (one for each solution) and that at most only four sub-trees/branches are present at any one time. Furthermore, at the end, all of the clause bits were in the state 1. Now considering that there are a total of 8 qubits in this system, a total of 256 different paths are possible. Is this just a trivial example or could this actually be implemented as a viable algorithm for path finding?

+

+ +

+

Edit: +P.S. Could this answer P = NP? +Also I noticed my quantum circuit isn't quite correct.

+",13230,,13230,,9/14/2020 0:52,9/14/2020 0:52,Can one use a quantum circuit as a pathfinding algorithm?,,0,14,,,,CC BY-SA 4.0 +13732,1,13743,,9/13/2020 15:14,,1,150,"

Let's say I have two arbitrary quantum states $|\psi\rangle$ and $|\phi\rangle$. I apply the SWAP test circuit (something like what is given here), and measure the first qubit to get either $0$ or $1$. Is there any way to get back the states $|\psi\rangle$ and $|\phi\rangle$, in an unentangled form, after this measurement? From what I understand, measuring the output entangles the two states.

+",1351,,,,,9/14/2020 9:13,Question on output of SWAP test,,1,2,,,,CC BY-SA 4.0 +13733,1,,,9/13/2020 18:39,,-1,152,"

Using Python how can I implement a quantum circuit that returns $|01\rangle$ or $|10\rangle$ using only $CX$, $RX$ and $RY$ gates, starting with random parametric gates as parameters and optimizing it using gradient descent or other optimization algorithm?

+",8344,,55,,9/15/2020 16:13,9/15/2020 16:13,Implementing a circuit that returns $|01\rangle$ and $|10\rangle$ with equal probability,,1,2,,,,CC BY-SA 4.0 +13734,2,,13733,9/13/2020 18:46,,2,,"

One potential combo is $ RY(\theta)$ on qubit 1, $CX$ from qubit 1 to qubit 2, then $RX(\pi)$ on qubit 2. This would be the following transformation:

+

$$ |0\rangle |0\rangle \mapsto (\cos \frac{\theta}{2} |0\rangle + \sin \frac{\theta}{2}|1\rangle)|0\rangle \mapsto \cos \frac{\theta}{2} |00 \rangle + \sin \frac{\theta}{2} |11\rangle \mapsto \cos \frac{\theta}{2} |01 \rangle + \sin \frac{\theta}{2} |10\rangle $$

+

This could be implemented in Python with QISKit/Q#/etc.

+

(Matrices for $RX$, $RY$: https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.rx / https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.intrinsic.ry)

+",8343,,,,,9/13/2020 18:46,,,,0,,,,CC BY-SA 4.0 +13735,1,,,9/13/2020 19:55,,3,54,"

I've been wondering, are there any known tasks/algorithms that can be performed on 1 quantum device, but also be somehow modified and split between several smaller devices?

+

The thought behind the idea, is that if creating large quantum computers (meaning computers with large number of qubits to work with) that are also stable and noise-tolerant to some degree is a hard task, maybe we could utilize several smaller devices, which are naturally less prone to noise and perform algorithms that would require a larger device. +For instance, instead of using a computer with 10 qubits, we could maybe use 2 computer with 5 to 6 qubits each, or something in that direction.

+

If there is, by chance, a sub-field in quantum computation that deals with such questions, I'd really like to know about it and explore it more.

+",12971,,9006,,9/14/2020 6:08,9/14/2020 7:19,Splitting a quantum task between multiple devices,,1,1,,,,CC BY-SA 4.0 +13736,1,,,9/13/2020 23:08,,1,201,"

What would be measured if you measure two entangled qubits at exactly the same time?

+",13234,,55,,9/15/2020 12:33,9/15/2020 12:33,What would be measured if you measure two entangled qubits at exactly the same time?,,1,3,,,,CC BY-SA 4.0 +13737,2,,13736,9/13/2020 23:36,,4,,"

The same thing as if you hadn't. The ordering of independent measurements never matters, entanglement or no entanglement.

+",119,,,,,9/13/2020 23:36,,,,4,,,,CC BY-SA 4.0 +13739,1,13744,,9/14/2020 4:11,,1,80,"

Let $E$ be the set of all correctable errors and $E_a, E_b \in E$. Let $\lbrace \vert c_1\rangle, \vert c_2\rangle, \ldots \vert c_k\rangle\rbrace$ be the basis of codewords in the codespace. It is necessary that $$ \langle c_i \vert E^{\dagger}_{a}E_b \vert c_j\rangle = 0, \tag{1}$$ +for all $i, j \in \lbrace 1, 2, \ldots, k \rbrace \;\land i \neq j$. This is equivalent to +$$ \langle c_i \vert E^{\dagger}_{a}E_b \vert c_i\rangle = \langle c_j \vert E^{\dagger}_{a}E_b \vert c_j\rangle, \tag{2}$$ +for all $i, j \in \lbrace 1, 2, \ldots, k \rbrace$. Equation $(1)$ and $(2)$ can be combined as (Knill and Laflamme) +$$ \langle c_i \vert E^{\dagger}_{a}E_b \vert c_j\rangle = C_{ab} \delta_{ij},$$ +where $C_{ab} \in \mathbb{C}$ and +$\delta_{ij} = \begin{cases} 1 \text{ if }\, i = j, \\0 \text{ if }\, i \neq j. +\end{cases}$

+

Furthermore, since +$$\langle c_i \vert E^{\dagger}_{a}E_b \vert c_i\rangle = (\langle c_i \vert E^{\dagger}_{b}E_a \vert c_i\rangle)^*,$$ +for all the codewords in the codespace, we can write $C_{ab}$ as a Hermitian matrix.

+

The source of the above can be found in 2.1.3 Criteria for quantum error correction (page 11).

+

Questions

+
    +
  1. I cannot figure out how equations $(1)$ and $(2)$ are equivalent. My humble explanation suggests that for $(1)$, they are equivalent since $E^{\dagger}_a E_b$ would cancel out to $I$ and we are left with $\langle c_i\vert c_j \rangle = 0$, since they are orthogonal. For $(2)$ we have $E^{\dagger}_a E_b$ would cancel out to $I$ and we are left with $\langle c_i\vert c_i \rangle = \langle c_j\vert c_j \rangle = 1$, since we are projecting a state on itself.
  2. +
  3. How can we convert $C_{ab}$ to matrix, what is the matrix dimension and what is the nature of the elements in the cells of this matrix (a binary matrix or elements in $\mathbb{C}$ or something else)?
  4. +
  5. Links to questions two, how would $\delta_{ij}$ affect the matrix?
  6. +
+

I am certainly not looking for complete answers, I am trying to understand this myself. I am open to any suggestions and scholarly articles that helps. Any hints and tips are appreciated :).

+",7528,,,,,9/14/2020 21:24,Obtaining hermitian matrix using Knill and Laflamme condition?,,1,0,,,,CC BY-SA 4.0 +13740,1,,,9/14/2020 6:35,,4,383,"

I wanted to implement a non-unitary operation. I came to know that I can do it as a linear combination of unitaries from this paper (published version). Let us say I want to implement an operation like $\alpha_1 A_1 + i \alpha_2 A_2$ in a quantum circuit, +where $A_1$ and $A_2$ and unitary operators. Coeffient $\alpha$ are real. How do you do that

+",13236,,55,,9/15/2020 12:34,9/16/2020 6:39,How to implement linear combination of two unitary gates in a quantum circuit?,,1,2,,,,CC BY-SA 4.0 +13741,2,,13735,9/14/2020 7:19,,2,,"

If you could completely separate a computation between two different processors, then, in fact, one processor would be enough, and you could run one computation after the other. What you can do is try to rearrange a computation that minimises the number of two-qubit gates acting between two distinct blocks of qubits. Those two-qubit gates probably then need to be replaced by some sort of teleportation operation (or simply moving qubits between the two different devices), so you do need the ability to share entangled states between the two processors, which would be a challenging task, but that's why you try to keep the number to a minimum.

+

In fact, this is what some practical implementations (specifically, ion traps, see here) have been looking at doing. I don't know if there's been much work to look at optimising specific algorithms - from the theory perspective, we know that it can be done whatever circuit you supply, and circuit optimisations are going to be very specific to a given implementation.

+",1837,,,,,9/14/2020 7:19,,,,0,,,,CC BY-SA 4.0 +13742,2,,13740,9/14/2020 7:37,,3,,"

The place where I came to know about this technique was here, which will give more details than I'm about to reproduce. In overview, you want to make a unitary $B$ such that +$$ +B|0\rangle=(\sqrt{\alpha_1}|0\rangle+\sqrt{\alpha_2}|1\rangle)/\sqrt{\alpha_1+\alpha_2}, +$$ +(I'm assuming the $\alpha_i$ are positive) and a second unitary +$$ +U=|0\rangle\langle 0|\otimes A_1+|1\rangle\langle 1|\otimes A_2 +$$

+

A very crude way of implementing the operation would then be to start with +$$ +|0\rangle|\psi\rangle, +$$ +where $|\psi\rangle$ is the state that you want to apply the superposition of unitaries. You apply $B$ to the first qubit, $U$ across both, then $S$ (phase gate) and $B^\dagger$ on the first qubit. Measure the first qubit, and if it is $|0\rangle$, you have succeeded.

+

If your amplitudes were negative, you can compensate for that by changing the phase rotation at the point where I applied $S$ in that sequence.

+

To see this, the evolution sequence is +\begin{align*} +|0\rangle|\psi\rangle &\xrightarrow{B} (\sqrt{\alpha_1}|0\rangle+\sqrt{\alpha_2}|1\rangle)|\psi\rangle/\sqrt{\alpha_1+\alpha_2} \\ +&\xrightarrow{U} (\sqrt{\alpha_1}|0\rangle(A_1|\psi\rangle)+\sqrt{\alpha_2}|1\rangle(A_2|\psi\rangle))/\sqrt{\alpha_1+\alpha_2} \\ +&\xrightarrow{S} (\sqrt{\alpha_1}|0\rangle(A_1|\psi\rangle)+\sqrt{\alpha_2}i|1\rangle(A_2|\psi\rangle))/\sqrt{\alpha_1+\alpha_2} +\end{align*} +This gets you up to just before applying $B^\dagger$ and measuring. This is equivalent to projecting the first qubit onto $(\sqrt{\alpha_1}\langle 0|+\sqrt{\alpha_2}\langle 1|)/\sqrt{\alpha_1+\alpha_2}$. This measuremnt result leaves the second qubit in +$$ +\frac{\alpha_1A_1+i\alpha_2A_2}{\alpha_1+\alpha_2}|\psi\rangle, +$$ +which you can use to assess the success probability.

+

For such a small number of terms in superposition, this is likely to be highly successful. However, if the probability of success is low, then you can improve your changes by getting rid of the measurement and instead performing amplitude amplification (i.e. essentially Grover's search, searching for when that first qubit is $|0\rangle$).

+",1837,,1837,,9/16/2020 6:39,9/16/2020 6:39,,,,7,,,,CC BY-SA 4.0 +13743,2,,13732,9/14/2020 7:41,,2,,"

The output of the qubits is either +$$ +(I\pm\text{SWAP})|\phi\rangle|\psi\rangle +$$ +(up to normalisation). As a general rule, information is lost from this compared to $|\phi\rangle|\psi\rangle$ so you cannot reuse the states (unless the states happened to be eigenstates of SWAP, but if you know that, you wouldn't have bothered doing the SWAP test).

+

To demonstrate this, imagine that $|\phi\rangle|\psi\rangle$ is either $|01\rangle$ or $|10\rangle$. If you get the $I+\text{SWAP}$ answer, the output state is the same for both, $|01\rangle+|10\rangle$. You cannot tell which of the two inputs it was, so you've lost information.

+

It could be that whatever further processing you want to do can be done on that output. For example, you might be using the SWAP test to deliberately create a symmetric state that you need for something else.

+",1837,,1837,,9/14/2020 9:13,9/14/2020 9:13,,,,2,,,,CC BY-SA 4.0 +13744,2,,13739,9/14/2020 9:25,,2,,"
+
    +
  1. I cannot figure out how equations $(1)$ and $(2)$ are equivalent. My humble explanation suggests that for $(1)$, they are equivalent since $E^{\dagger}_a E_b$ would cancel out to $I$ and we are left with $\langle c_i\vert c_j \rangle = 0$, since they are orthogonal. For $(2)$ we have $E^{\dagger}_a E_b$ would cancel out to $I$ and we are left with $\langle c_i\vert c_i \rangle = \langle c_j\vert c_j \rangle = 1$, since we are projecting a state on itself.
  2. +
+
+

Eq. $1$ and $2$ are not necessarily equivalent, they are just both necessary for a QECC. Eq. $1$ states that orthogonality between codewords is preserved, even if one error $E_{a}$ acts upon one of the codewords, and some other error $E_{b}$ acts upon the other - that way we can always tell two error apart, regardless of what exactly the state encoded in the subspace is. +Eq. $2$ takes care of something else: whatever the state encoded in the subspace is, errors occurring on this state must not reveal anything about the state (otherwise we could learn something about the state, thereby destroying quantum information). In other words, the 'symmetric' inner product cannot depend on what exactly the 'current' codeword (or superposition thereof) is!

+

You can also check out Gottesman's introduction to QECC's (check section $2.2$ on page $5$ and specifically Eq. $(26)$) - he has what I believe to be a clear explanation on why we have these conditions exactly.

+
+
    +
  1. How can we convert $C_{ab}$ to matrix, what is the matrix dimension and what is the nature of the elements in the cells of this matrix (a binary matrix or elements in $\mathbb{C}$ or something else)?
  2. +
+
+

We say that we get a $|E|\times |E|$ matrix $C$, where the $(a,b)$-th element is the inner product $\langle c_{i}|E_{a}^{\dagger}E_{b}|c_{i}\rangle$ - Eq. $2$ tells us that it does not matter what codeword $|c_{i}\rangle$ we use, as every codeword should give the same result. Generally this matrix is in $C^{|E|\times |E|}$, but if $\{E_{1}...E_{|E|}\}$ is the set of correctable errors, you can view this set as a basis for the space $\mathcal{E}$ of correctable errors. As $C$ is Hermitian, there exist a basis of $\mathcal{E}$ such that $C$ becomes diagonal with real entries. These entries are not necessarily $1$ (they will be $\geq 0$ though, and generally speaking they are $\leq 1$). However, these scaling factors are relatively meaningless, and for additive (i.e. stabilizer) codes, in this particular basis the entries are normally $1$.

+

So, if our set of correctable errors is $\{E_{1}...E_{|E|}\}$, we get for our matrix $C$: +$$ +C = +\begin{bmatrix} +\langle c_{i*}|E_{1}^{\dagger}E_{1} | c_{i*}\rangle & \langle c_{i*}|E_{1}^{\dagger}E_{2} | c_{i*}\rangle & \cdots & \langle c_{i*}|E_{1}^{\dagger}E_{|E|} | c_{i*}\rangle \\ +\langle c_{i*}|E_{2}^{\dagger}E_{1} | c_{i*}\rangle & \langle c_{i*}|E_{2}^{\dagger}E_{2} | c_{i*}\rangle & \cdots & \langle c_{i*}|E_{2}^{\dagger}E_{|E|} | c_{i*}\rangle \\ +\vdots & \vdots & \ddots & \vdots \\ +\langle c_{i*}|E_{|E|}^{\dagger}E_{1} | c_{i*}\rangle & \langle c_{i*}|E_{|E|}^{\dagger}E_{2} | c_{i*}\rangle & \dots & \langle c_{i*}|E_{|E|}^{\dagger}E_{|E|} | c_{i*}\rangle \\ +\end{bmatrix} +$$ +Note that this is slightly different than your comment, since I do not use two separate codewords - if we use different codewords all entries become zero per the first QECC condition. Of course, per the second condition, the codeword $|c_{i*}\rangle$ is completely arbitrary.

+
+
    +
  1. Links to questions two, how would $\delta_{ij}$ affect the matrix?
  2. +
+
+

$\delta_{ij}$ is there to 'take care' of your equation $1$ - without it, orthogonality between different codewords would not be preserved. All information about what error has happened is encoded into $C$.

+",8141,,8141,,9/14/2020 21:24,9/14/2020 21:24,,,,7,,,,CC BY-SA 4.0 +13746,1,,,9/14/2020 16:24,,2,143,"

I read some paper about Quantum Circuit Optimization but I am on a low level. +And have some experience in ML.

+

But what I don't understand is it possible that ML can help to optimize Quantum Circuits and how does that work ?

+

Maybe in QAOA case , what does it bring us to optimize the Circuits ?

+",12711,,55,,9/15/2020 12:32,9/15/2020 12:32,Quantum Circuit Optimization with Machine Learning,,1,2,,9/21/2020 14:35,,CC BY-SA 4.0 +13747,2,,13746,9/14/2020 22:48,,2,,"

Yes, some works have been in this area. Here is an example: "Quantum Circuit Learning" https://arxiv.org/abs/1803.00745

+

and also this paper, "Learning to learn with quantum neural networks via classical neural networks" https://arxiv.org/abs/1907.05415

+

and also this paper, "Experimental pairwise entanglement estimation for an N-qubit system :A machine learning approach for programming quantum hardware" https://arxiv.org/abs/1902.07754

+",9858,,,,,9/14/2020 22:48,,,,0,,,,CC BY-SA 4.0 +13748,1,13758,,9/15/2020 0:07,,3,156,"

I am working with a very sparse matrix and it seems inefficient to load the full matrix as input into the Qiskit HHL algorithm. Is it possible to input only the non-zero elements, instead ? I am working with a "clean" banded, tri-diagonal matrix.

+",13244,,9006,,9/15/2020 12:50,1/30/2021 23:57,Is it required to input full matrix when using Qiskit HHL algorithm for sparse matrices?,,1,0,,,,CC BY-SA 4.0 +13749,1,,,9/15/2020 0:47,,2,112,"

The two-qubit eigenvalue ($\lambda_i$ >= 0, $i=1,\ldots,4$, $\lambda_4=1-\lambda_1-\lambda_2-\lambda_3$) condition of Verstraete, Audenaert, de Bie and de Moor

+

AbsoluteSeparability

+

(p. 6) for absolute separability is

+

\begin{equation} +\lambda_1-\lambda_3 < 2 \sqrt{\lambda_2 \lambda_4},\hspace{.5in}\lambda_1 >\lambda_2 >\lambda_3>\lambda_4. +\end{equation} +Implementing this condition,

+

2009paper

+

I presented an explicit formula +\begin{equation} +1-\frac{3217542976-5120883075 \pi +16386825840 \tan ^{-1}\left(\sqrt{2}\right)}{32768 + \sqrt{2}}-\frac{29901918259}{497664} \approx 0.00365826 +\end{equation}

+

for the two-qubit absolute separability probability in terms of the Hilbert-Schmidt measure. (``[C]opious use was made of trigonometric identities involving the tetrahedral dihedral angle $\phi=\cos ^{-1}\left(\frac{1}{3}\right)$, assisted by V. Jovovic.")

+

A "typo" in this formula +was corrected, and a somewhat reexpressed pair of formulas, +\begin{equation} \label{HSabs} + \frac{29902415923}{497664}+\frac{-3217542976+5120883075 \pi -16386825840 \tan + ^{-1}\left(\sqrt{2}\right)}{32768 \sqrt{2}} = +\end{equation} +\begin{equation} +\frac{32(29902415923 - 24433216974 \sqrt{2})+248874917445 \sqrt{2}(5 \pi - 16 \tan ^{-1}\left(\sqrt{2}\right))}{2^{16} \cdot 3^5} \approx 0.00365826 +\end{equation}

+

were given in eq.(A2) in

+

"Quasirandom estimations of two-qubit operator-monotone-based separability probabilities"

+

Quasirandom

+

(We, incidentally observe here that +\begin{equation} +5 \pi -16 \tan ^{-1}\left(\sqrt{2}\right)=\cos ^{-1}\left(\frac{5983}{3^8}\right).) +\end{equation}

+

Relatedly, in Table 2 (based on eq. (75) there) of

+

ON THE GEOMETRIC PROBABILITY OF ENTANGLED MIXED STATES

+

KhvedelidzeRogojin

+

a fully consistent numerical value of $0.365826 \%$ was given for the Hilbert-Schmidt two-qubit absolute separability probability.

+

In regard to this result, A. Khvedelidze recently wrote in an email:

+

"As far I remember we got this result using two numerical methods:

+
    +
  1. Evaluating integrals over the absolute separability area ;
  2. +
  3. Generating HS random states and testing them on the absolute separability
  4. +
+

Our attempts to evaluate all integrals analytically fell down."

+

So, let me pose the problem of giving an explicit analytic derivation of the two-qubit absolute Hilbert-Schmidt separability probability, as Khvedelidze and Rogojin were not able to do. ( Possibly, a somewhat different, but equivalent formula could emerge.)

+

The 2009 analytic derivation of mine was lengthy, "messy", with no full record of the step-by-step derivation given.

+

A Mathematica formulation of the problem, incorporating the Hilbert-Schmidt measure, proportional to (eq. (15.35) in GeometryOfQuantumStates) +\begin{equation} +\Pi_{j<k}^4 (\lambda_j-\lambda_k)^2 +\end{equation} +is

+

+

I've so far been able to perform the first two integrations (with a large outcome), but not the full three.

+",3089,,3089,,9/26/2020 14:44,9/26/2020 15:53,Give an explicit derivation of the exact formula for the two-qubit absolute separability Hilbert-Schmidt probability $\approx 0.00365826$,,1,1,,,,CC BY-SA 4.0 +13751,2,,13440,9/15/2020 1:44,,1,,"

I solved this issue by upgrading my python version:https://github.com/Qiskit/qiskit/issues/1040

+",11560,,,,,9/15/2020 1:44,,,,0,,,,CC BY-SA 4.0 +13753,2,,13719,9/15/2020 9:31,,1,,"

Yes, they can do it. The reduced density matrix is not the appropriate tool to use here: it gives you the statistics Alice can obtain while having no information at all about what Bob is doing. But in this case she (or the middleman, in any case) does have information about what Bob is doing, she can know the results of his measurements.

+

For example, if they both measure in the $\{|+\rangle,|-\rangle\}$ basis, the probability they get both result $+$ is $(1+(-1)^b)^2/8$, which does depend on $b$.

+

More generally, it is always possible to learn all the amplitudes of the state in this way. What you are asking is if local tomography is possible, and it is, because you can always find a tensor product basis for the shared Hilbert space.

+",12541,,,,,9/15/2020 9:31,,,,0,,,,CC BY-SA 4.0 +13754,1,,,9/15/2020 13:29,,2,97,"

What is the significance of different transpiling time, validating time, in queue time, running time for the same circuit run on different quantum systems for same no. of shots in IBM Q experience?

+

What does longer transpiling time mean?

+",13172,,55,,9/22/2020 18:12,9/22/2020 18:12,"What is the significance of transpiling time, validating time, in queue time and running time?",,2,0,,,,CC BY-SA 4.0 +13755,1,,,9/15/2020 14:12,,2,52,"

I'm struggling to find an analytic way to solve this problem.

+

There are $4! = 24$ possible classical operations on the four 2-Cbit basis states. How many of these are achievable via the classical operations $S_{ij}, C_{ij}, X_j$ and compositions thereof.

+

I've thought about this in terms of permutation groups and counting the members of each class of these operations, but I am not getting anywhere.

+

Edit: +C-Bits refer to classical bits (binary states) +$S_{ij}$ is the swap operation between bits $0$ and $1$. +$C_{ij}$ is the control not operation with control $i$ and target $j$. +$X_j$ is the not operation with target $j$.

+",13249,,13249,,9/15/2020 15:04,9/15/2020 15:56,Counting Achievable Operations,,1,1,,,,CC BY-SA 4.0 +13756,2,,13754,9/15/2020 14:51,,1,,"

Transpilation (in this context) is backend-specific. Longer transpiling time just means the software took longer to make your circuits compatible and more optimized for the backend you selected (e.g. because your circuits require a lot of remapping).

+

In general, transpiling time is important to those who do research on that topic. Much like classical compilers, the speed of the transpilation is also important in addition to the quality. But researchers typically do their own transpilation instead of letting IBM Q Experience do it (in which case tranpiling time is displayed as N/A).

+

Validating time is mostly just tourist information. While it's also backend-specific, the time difference is usually very small.

+

Queuing time depends on how busy the backend is as well as your priority. It gives some users satisfaction that their universities are in the Q network, which allows them higher priorities.

+

Running time can differ based on backend configuration. Newer backends may have new technologies that allow circuits to run faster. Also the transpiled circuits are likely of difference sizes for different backends.

+",12195,,12195,,9/15/2020 15:45,9/15/2020 15:45,,,,0,,,,CC BY-SA 4.0 +13757,2,,13754,9/15/2020 15:50,,2,,"

Transpiling time is the time it takes for your circuit to be translated into a circuit that can be run on the backend of your choosing. This process includes converting gates into the standard basis gates ['cx', 'u1', 'u2', 'u3', 'id'], optimizing the circuit so it is shorter, mapping virtual qubits in the circuit to physical qubits, etc. Converting gates into basis gates is mostly independent of the backend you choose (unless it has a different basis set), so the time it takes depends on the number and complexity of the gates in the circuit.

+

The optimization is dependent on the backend, as mapping virtual qubits to physical qubits, condensing gates, etc. depends on the geometry of the qubits for that backend, specifically which qubits are entangled and which aren't. The default optimization level is 1, which includes mapping qubits and collapsing adjacent gates, but if you specify a higher level (the max is 3) like so

+
job = (circuit, backend, optimization_level=3)
+
+

then transpilation will take longer. More information on transpilation can be found here: https://qiskit.org/documentation/tutorials/circuits_advanced/4_transpiler_passes_and_passmanager.html

+

Validating time is the time it takes to verify that the circuit is able to be run, so I think the time between different backends is arbitrary.

+

Queue time for different backends is more dependent on how busy the queue is, and how much other people use the queue. A more detailed explanation of the queue algorithm can be found here: https://quantum-computing.ibm.com/docs/manage/backends/queue/

+

Running time is the time it takes the backend to run the circuit itself. With more complex circuits, the run time will increase. For backends with higher quantum volume, the same circuit will run faster than on other backends with lower quantum volume.

+",13117,,,,,9/15/2020 15:50,,,,0,,,,CC BY-SA 4.0 +13758,2,,13748,9/15/2020 15:53,,3,,"

At the moment this is not possible, however in the near future it will be possible for the case of tridiagonal symmetric Toeplitz matrices.

+

The reason for this being that qiskit does not support QRAM or "black-box" access to the matrix elements, so to be able to partly specify the matrix one would need to develop specific methods that work with this limited information, which is only possible if the matrix has some structure.

+",4223,,,,,9/15/2020 15:53,,,,2,,,,CC BY-SA 4.0 +13759,2,,13755,9/15/2020 15:56,,1,,"

Why is 4! valid?

+

We can imagine the desired operation to implement as a truth table / permutation matrix. Recognize that we may do this because none of the operations actually modify the amplitudes - they solely switch the amplitudes among basis states. Plus, because the operations provided are unitary, we know that a permutation table is valid. Let's call this permutation function $f(x)$.

+

So, given the inputs of 00, 01, 10, 11, there are 4! potential outputs, depending on which output corresponds to which input (e.g plugging 00 into our operation could yield 00/01/10/11, $f(01)$ could yield all except $f(00)$.)

+

Universality

+

Now, which of these operations are actually implementable given the desired gate set? Recognize that each of the operations is also a permutation table:

+
    +
  • Swap: interchanges the amplitudes of 01, 10
  • +
  • CNOT: interchanges the amplitudes of 10, 11 or 01, 11
  • +
  • X: interchanges the amplitudes of 00, 10 and 11, 01 or 00, 01 and 10, 11
  • +
+

So, let's first find sub operations that allow us to selectively swap any two amplitudes. Note that we are seeking $4C2 = 6$ such operations, and we already have 3 of them ($SWAP$, $CNOT01$, $CNOT10$). This leaves us with 3 two amplitude swaps: $(00, 01)$, $(00, 10)$, and $(00, 11)$.

+
    +
  • $(00, 01)$: $X_0 CNOT_{0, 1} X_0$.
  • +
  • $(00, 10)$: $X_1 CNOT_{1, 0} X_1$
  • +
  • $(00, 11)$: Because every other 2-amplitude swap is implementable, we know that $(00, 11)$ is also implementable.
  • +
+

So, we know that all 2-amplitude swaps are possible with the given gates. Furthermore, we can split the permutation tables into four classes based on derangement (how many of the inputs are preserved):

+
    +
  • 4 inputs invariant ($1$)
  • +
  • 2 inputs invariant ($4C2 * !2 = 6$)
  • +
  • 1 input invariant ($4C1 * !3 = 8$)
  • +
  • 0 inputs invariant ($!4 = 9$)
  • +
+

(Note that three invariant inputs is not possible; we always need at least one amplitude to swap with).

+
    +
  • The first case is trivial, and satisfiable with an identity function.
  • +
  • We just proved the second case.
  • +
  • The third/fourth cases are provable by way of the second case.
  • +
+

I'm not as familiar with the combinatorics references here, so feel free to add more vernacular. The core idea is still the same: because we can tune our gate set to selectively affect only two amplitudes, we are able to produce any permutation matrix.

+",8343,,,,,9/15/2020 15:56,,,,4,,,,CC BY-SA 4.0 +13760,1,,,9/15/2020 23:03,,1,743,"

What is the importance of global phase? How it affect a unit vector if we see it on a Bloch sphere? What is the meaning of 'up to global phase' in exercise 4.3 of Nielsen and Chuang?

+",8527,,9006,,9/16/2020 7:37,10/24/2020 12:37,What is meaning of 'up to a global phase'?,,1,0,,9/16/2020 13:10,,CC BY-SA 4.0 +13761,1,,,9/16/2020 1:01,,4,207,"

Here is an exercise (4.27) from Nielsen and Chuang and I found the answer (given in the figure below) online without any explanation. The question was to construct a circuit by seeing a matrix (given in the figure).

+

So I want to know what should be the thought process after seeing the matrix?

+

+",8527,,55,,10/20/2021 19:19,10/20/2021 19:19,What is the thought process for circuit making after seeing input and output of a matrix?,,0,1,,,,CC BY-SA 4.0 +13762,1,,,9/16/2020 2:50,,3,79,"

After having a discussion with a quantum computing colleague, a question came up: is there any meaningful way to measure entanglement (or something related to it) in a solid-state many body system where you don't have the luxury of individual qubit control? Specifically, I am interested in the case of the solid-state, not cold atoms where you can do quite marvelous things at the single qubit level. I suppose there might be various entanglement witnesses out there, but I am wondering which among them is (in-principle) measurable in a real-life solid-state experiment.

+

To explain what I mean by "meaningful", please not that, as the comments indicate, I acknowledge that measuring the true degree of entanglement of a solid-state system is extremely difficult for fundamental reasons. It is near impossible to put a physical cat into a superposition of two states, for example. However, I would contend that in solid-state systems one is only interested in low-energy phenomena, so entanglement is only of interest for a small subset of the total degrees of freedom. For example, core electrons make up the majority of the degrees of freedom in a solid, but play almost no role in most properties. On the other hand, valence electrons are much fewer in number, but dictate most of the interesting chemical and physical properties. So, by "meaningful" measure of entanglement, I mean a method which allows you to ignore the inactive degrees of freedom that don't contribute anything to the physics of the solid-state system of interest.

+

As an example of the use of such an entanglement measurable, quantum phase transitions are quite interesting in the context of solid-state systems, and are thought to give rise to enormous entanglement among degrees of freedom as one nears the critical point. If one had an experimentally measurable quantity describing the entanglement, one should be able to identify one of the key properties of quantum phase transitions.

+

A somewhat related question that I posted several years ago about Quantum Fisher Information +https://physics.stackexchange.com/questions/274891/interpreting-the-quantum-fisher-information

+",2260,,2260,,9/21/2020 1:38,9/21/2020 1:38,Is there a measurable of entanglement for a many-body system?,,0,9,,,,CC BY-SA 4.0 +13763,1,,,9/16/2020 3:55,,2,135,"

I ran a 3-qubit measurement circuit on QASM simulator as well as on IBM Q Melbourne, Santiago and Vigo machines. The running time on the simulator is in few milliseconds (400-800) while in the case of all three quantum machines the running time is in seconds (4-13).

+

Why such a large difference as it does not give a clear picture of simulators' accuracy in comparison to realized of quantum hardware?

+",13172,,55,,9/17/2020 18:19,9/17/2020 18:19,Why running time of qasm simulator is significantly smaller in comparison with quantum machines?,,1,2,,,,CC BY-SA 4.0 +13765,2,,13760,9/16/2020 6:48,,5,,"

The point of the phrase "up to a global phase" is that a global phase is not important. It has no observable consequences.

+

So, states +$$ +|\psi_1\rangle=a|0\rangle+b|1\rangle,\qquad |\psi_2\rangle=e^{i\phi}(a|0\rangle+b|1\rangle) +$$ +are the same up to a global phase. There is no experiment that you can do to distinguish them. This is represented in the Bloch sphere by the fact that both states map to the same point.

+

The the N&C exercise, it's the same issue, but for unitaries rather than states: $U$ and $e^{i\theta}U$ have the same effect on a state, except for a difference in global phase, which is irrelevant. So it doesn't matter which of the two I make. Make whichever is easier. (Caveat: controlled-$U$ and controlled-$e^{i\theta}U$ are very different.)

+",1837,,9459,,10/24/2020 12:37,10/24/2020 12:37,,,,0,,,,CC BY-SA 4.0 +13766,2,,13719,9/16/2020 7:09,,1,,"

If Alice and Bob knew the values of $x$ and $y$, there would always be measurements they could perform which would allow the middleman to distinguish the value of $b$. An argument using the reduced density matrix of a single qubit is irrelevant because that neglects the correlations that can arise between measurement results of the two parties, and it is precisely those correlations that you're relying on in some cases.

+

However, the question states that $x$ and $y$ are unknown. This is far more of a problem. Let's assume we have no prior knowledge of those values, so all possibilities are equally likely. Then, Alice and Bob are trying to distinguish between two possible ensembles, whose best descriptions are joint density matrices +$$ +\rho_0=\frac{1}{12}\sum_{x\neq y\in\{0,1\}^2}(|x\rangle+|y\rangle)(\langle x|+\langle y|) +$$ +and +$$ +\rho_1=\frac{1}{12}\sum_{x\neq y\in\{0,1\}^2}(|x\rangle-|y\rangle)(\langle x|-\langle y|). +$$

+

I believe (although you'll want to check, because I did this quickly, not carefully) that these look like +$$ +\rho_0=\frac{1}{12}\left(\begin{array}{cccc} 3 & 1 & 1 & 1 \\ 1 & 3 & 1 & 1 \\ 1 & 1 & 3 & 1 \\ 1 & 1 & 1 & 3 \end{array}\right)=\frac{1}{6}I+\frac{1}{3}|++\rangle\langle ++| +$$ +and +$$ +\rho_1=\frac{1}{12}\left(\begin{array}{cccc} 3 & -1 & -1 & -1 \\ -1 & 3 & -1 & -1 \\ -1 & -1 & 3 & -1 \\ -1 & -1 & -1 & 3 \end{array}\right)=\frac{1}{3}I-\frac{1}{3}|++\rangle\langle ++|. +$$ +These clearly do not have support on orthogonal subspaces, so there is no measurement that can guarantee to distinguish between $\rho_0$ and $\rho_1$ even if Alice and Bob could perform two-qubit measurements jointly.

+

However, you could ask what the best measurement they could do is. This is called the Helstrom measurement. The probability of success is +$$ +\frac12+\frac14\text{Tr}|\rho_0-\rho_1|=\frac34 +$$ +Moreover, that differentiation is achieved by measuring both qubits in the $|\pm\rangle$ basis: if you get the $|++\rangle$ answer, you assume you had $\rho_0$ ($b=0$), otherwise you assume you had $\rho_1$ ($b=1$). Since this optimal basis happens to be a tensor product, this is measured by Alice and Bob independently and resolved by the referee.

+",1837,,,,,9/16/2020 7:09,,,,0,,,,CC BY-SA 4.0 +13767,2,,13763,9/16/2020 9:20,,3,,"

A simulator executes just an algorithm on a classical hardware as Martin said. +On a real quantum hardware, your circuit is calibrated before actually being executed. In addition, there are other tasks like loading pulses into waveform generator, qubits relaxation...which take time and explain the difference.

+",12386,,,,,9/16/2020 9:20,,,,0,,,,CC BY-SA 4.0 +13768,2,,13728,9/16/2020 11:19,,1,,"

The 0.15.2 is actually the version of your qiskit-terra package not Qiskit itself.
+I'd suggest you to check the version by qiskit.__qiskit_version__. See the documentation.

+

If all packages have the latest version, you simply need to install pylatexenc in the same env where your Qiskit has been installed. Just by typing pip install pylatexenc in terminal!

+

In case you don't have the latest version of Qiskit. +You need to upgrade it first by pip install qiskit --upgrade and then install pylatexenc.

+

Update
+For Google Colab, this thread from Stackoverflow might be relevant.
+%pip install pylatexenc

+",9318,,9318,,9/16/2020 13:02,9/16/2020 13:02,,,,9,,,,CC BY-SA 4.0 +13769,1,13770,,9/16/2020 12:16,,5,4708,"

I'm currently able to get state vector in Qiskit using state_vector backend using something like :

+
backend = Aer.get_backend('statevector_simulator')
+job = execute(qc, backend=backend, shots=1, memory=True)
+job_result = job.result()
+print(job_result.get_statevector(qc))
+
+

But now I would like to get state vector using qasm_backend, I have seen in the Qiskit doc this sample code :

+
backend = QasmSimulator()
+backend_options = {"method": "statevector"}
+
+# Circuit execution
+job = execute(qc, backend, backend_options=backend_options)
+
+

So I tried this backend implementation then trying to get state vector with :

+
job_result = job.result()
+print(job_result.get_statevector(qc))
+
+

But it still gives me an error saying that get_statevector is not available, what is the right way to do that ?

+

Thank you.

+",12910,,55,,9/17/2020 18:18,12/29/2021 11:17,How to get state vector from QasmSimulator in Qiskit,,2,0,,,,CC BY-SA 4.0 +13770,2,,13769,9/16/2020 12:58,,6,,"

If you're using the QasmSimulator class from Aer it does not generate a state vector result. The statevector method you passed in as a backend option is the simulation method/technique that Aer will use for simulating the circuit, but it is still the QASM simulator which is expected to return measurement counts not a statevector. You can see a description of the different simulation methods in the QasmSimulator Docs.

+

When you were calling Aer.get_backend('statevector_simulator') that returns a StateVectorSimulator backend object which will simulate the circuit and return the state vector at the end of the execution and return that in the result, which is why get_statevector works there. If you want to get the state vector while using the QasmSimulator you can use the SnapshotStatevector instruction in your circuit which will return the state vector at that point in the circuit. Although, if you do this the state vector won't be returned by get_statevector (that will still fail) it will be in the snapshots under Result.data.

+",5529,,15119,,5/6/2021 7:46,5/6/2021 7:46,,,,3,,,,CC BY-SA 4.0 +13771,1,,,9/16/2020 14:35,,2,89,"

How can I put the unitary matrix $$e^\frac{i\pi}{2}I$$ to the quantum circuit?

+

I don't know if it is belong to $$U3(\theta, \phi, \lambda), U2(\phi, \lambda), U1(\lambda)$$

+

Thanks a lot.

+",12882,,55,,9/17/2020 18:17,9/17/2020 18:17,How can I convert the unitary matrix $e^\frac{i\pi}{2}$ into a quantum circuit in Qiskit?,,1,0,,,,CC BY-SA 4.0 +13772,2,,13771,9/16/2020 14:48,,2,,"

$I$ is the identity matrix. In a quantum circuit, it means "do nothing". You don't need to program it in. The global phase doesn't make a difference to this either.

+",1837,,,,,9/16/2020 14:48,,,,3,,,,CC BY-SA 4.0 +13773,1,13783,,9/16/2020 17:45,,0,47,"

I'm studying quantum error correction on Nielsen's Quantum Computation and Quantum Information, but I don't understand how it identifies the number of places where an error may occur.

+

It uses approximations and does not show how to identify those places.

+

I'm referencing pages 479 and 480, how does he know the values of the c and c0, c1, etc.

+",5065,,55,,9/21/2020 16:57,9/21/2020 16:57,Where do errors occur during error syndrome and recovery?,,1,0,,,,CC BY-SA 4.0 +13774,1,13775,,9/16/2020 18:39,,2,576,"

I am running a very simple script just to learn how to use IBMQ, but my job will hang indefinitely and I am forced to terminate it.

+
from qiskit import *
+from qiskit.compiler import transpile, assemble
+from qiskit import IBMQ
+from qiskit import QuantumCircuit, execute, BasicAer
+import logging
+
+
+logging.basicConfig(filename='log',level=logging.DEBUG)
+
+IBMQ.load_account()
+provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')
+
+#SELECT A BACKEND
+backend = provider.get_backend('ibmq_qasm_simulator')
+
+#ALGO
+qr = QuantumRegister(3)
+cr = ClassicalRegister(3)
+circuit = QuantumCircuit(qr, cr)
+circuit.x(qr[0])
+circuit.x(qr[1])
+circuit.ccx(qr[0], qr[1], qr[2])
+circuit.cx(qr[0], qr[1])
+circuit.measure(qr, cr)
+
+print('About to run job')   
+job = execute(circuit, backend)
+print('Job Finished')
+result = job.result()
+counts = result.get_counts(circuit)
+print(counts)
+
+

In an attempt to debug, I am using "logging.basicConfig" which stops at:

+
"websocket._connect:DEBUG:2020-09-16 11:26:57,813: Starting new websocket connection: wss://wss.quantum-computing.ibm.com/jobs/5f6258f09234fe0012dbd748/status/v/1"
+
+

When I go to my IBMQ home page it says that the job has run successfully. It is only at the line result = job.result() that it fails.

+

So it seems that the websocket is hanging forever. I'd appreciate any help I can get to fix this issue.

+",13244,,55,,9/21/2020 16:57,9/22/2020 17:35,My IBMQ job hangs forever?,,2,0,,,,CC BY-SA 4.0 +13775,2,,13774,9/16/2020 18:53,,1,,"

The function execute is non-blocking. That means that it will return after sending the job, but not necessarily with the result. In your code, you should wait for the status of the job to be DONE:

+
print('About to run job')   
+job = execute(circuit, backend)
+job.status()
+
+
JobStatus.QUEUED
+
+

After waiting some time:

+
job.status()
+
+
JobStatus.DONE
+
+

Then, job.result() will work.

+",1859,,,,,9/16/2020 18:53,,,,5,,,,CC BY-SA 4.0 +13776,2,,13697,9/16/2020 19:07,,1,,"

Qiskit 0.21 has qiskit-ibmq-provider 0.9. This new provider comes with a connector to the RNG service in IBMQ. From the release notes:

+
+

You can now access the IBMQ random number services, such as the CQC +randomness extractor, using the new package +qiskit.providers.ibmq.random. Note that this feature is still in beta, +and not all accounts have access to it. It is also subject to heavy +modification in both functionality and API without backward +compatibility.

+
+

You can find the documentation here and here.

+",1859,,,,,9/16/2020 19:07,,,,1,,,,CC BY-SA 4.0 +13777,1,,,9/16/2020 22:57,,1,111,"

I am trying to build a large and quite complex three qubit quantum circuit on IBMs quantum computer. I have a specific unitary which I am trying to implement and I am building a circuit following the paper 'Realisation of a general three qubit quantum unitary'. I am checking the unitary at each stage of the circuit on Matlab, just to make sure I fully understand it, but I have come across something which I cannot explain. I have split the circuit into two unitaries, $U_a$ and $U_b$ and for each unitary separately my IBM unitary agrees with my Matlab unitary,however when I combine the two circuits in IBM and multiply the two unitaries in Matlab I get different results. The problem boils down to an issue I am having with the Hadamard gate. Consider the following two IBM circuits

+
#both independently correct
+circuit2 = QuantumCircuit(3);
+circuit2.u3(1,1,1,2);
+job = execute(circuit2, backend)
+job.result().get_unitary(circuit2, decimals=6)
+
+

i.e. a three qubit circuit where a unitary acts on the final qubit (IBM's final qubit is the first qubit in more widely used bra-ket notation), and the second circuit is:

+
#both independently correct
+circuit2 = QuantumCircuit(3);
+circuit2.h(2)
+job = execute(circuit2, backend)
+job.result().get_unitary(circuit2, decimals=6)
+
+

i.e. a three qubit circuit with a Hadamard gate on the final qubit. These produce the following two unitaries

+
   0.8776 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i  -0.2590 - 0.4034i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i
+   0.0000 + 0.0000i   0.8776 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i  -0.2590 - 0.4034i   0.0000 + 0.0000i   0.0000 + 0.0000i
+   0.0000 + 0.0000i   0.0000 + 0.0000i   0.8776 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i  -0.2590 - 0.4034i   0.0000 + 0.0000i
+   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.8776 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i  -0.2590 - 0.4034i
+   0.2590 + 0.4034i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i  -0.3652 + 0.7980i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i
+   0.0000 + 0.0000i   0.2590 + 0.4034i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i  -0.3652 + 0.7980i   0.0000 + 0.0000i   0.0000 + 0.0000i
+   0.0000 + 0.0000i   0.0000 + 0.0000i   0.2590 + 0.4034i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i  -0.3652 + 0.7980i   0.0000 + 0.0000i
+   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.2590 + 0.4034i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i  -0.3652 + 0.7980i
+
+
    0.7071         0         0         0    0.7071         0         0         0
+         0    0.7071         0         0         0    0.7071         0         0
+         0         0    0.7071         0         0         0    0.7071         0
+         0         0         0    0.7071         0         0         0    0.7071
+    0.7071         0         0         0   -0.7071         0         0         0
+         0    0.7071         0         0         0   -0.7071         0         0
+         0         0    0.7071         0         0         0   -0.7071         0
+         0         0         0    0.7071         0         0         0   -0.7071
+
+

I have taken these unitaries from my Matlab code, not the IBM output but they are the same in both softwares. Now the bizarre part is when I multiply these unitaries in Matlab using the following code

+
function test=utottest(x)
+x1=[1,1,1];
+Hadamard=1/sqrt(2)*[1 1;1 -1];
+
+R1=kron(U1IBM(x1),eye(4));
+R12=kron(Hadamard,eye(4));
+
+
+test=R12*R1;
+
+function U1=U1IBM(x)
+% single qubit unitary 
+th=x(1);
+phi=x(2);
+lam=x(3);
+
+U1=[cos(th/2) -exp(i*lam)*sin(th/2); exp(i*phi)*sin(th/2) exp(i*lam+i*phi)*cos(th/2)];
+end
+end
+
+

the unitary produced is different to that produced by the following IBM circuit

+
circuit2 = QuantumCircuit(3);
+circuit2.u3(1,1,1,2);
+circuit2.h(2)
+job = execute(circuit2, backend)
+job.result().get_unitary(circuit2, decimals=6)
+
+

I do not understand what is happening here. Can anyone explain/reconcile this difference?

+",13261,,55,,9/21/2020 16:57,9/21/2020 16:57,Hadamard gate for three qubits; inconsistency between IBM and Matlab,,1,2,,,,CC BY-SA 4.0 +13778,1,,,9/16/2020 23:58,,-1,84,"

Can someone please help me making these gates on CIRQ programming:

+
    +
  1. Decrement Gate (-1)
  2. +
  3. Splitter Gate (If possible)
  4. +
+

I was having trouble implementing these and was not sure if it's possible either.

+

Thanks in advance.

+",12913,,55,,9/21/2020 14:31,1/15/2021 21:02,Implementing Cirq Coding Gates,,1,0,,,,CC BY-SA 4.0 +13779,2,,13777,9/17/2020 4:32,,2,,"

Someone pointed out where I was going wrong. The two unitaries being produced were the same up to a global phase shift

+",13261,,,,,9/17/2020 4:32,,,,0,,,,CC BY-SA 4.0 +13780,2,,13778,9/17/2020 5:19,,0,,"

I'm not sure what a splitter operation is.

+

There is a class cirq.ArithmeticOperation which is a helper class for implementing arithmetic. You can implement an increment gate with it like this:

+
import cirq
+
+class Increment(cirq.ArithmeticOperation):
+    def __init__(self, target_register):
+        self.target_register = target_register
+
+    def registers(self):
+        return [self.target_register]
+
+    def with_registers(self, *new_registers):
+        return Increment(*new_registers)
+
+    def apply(self, target_value):
+        return [target_value + 1]
+
+

The helper class will ensure that several useful methods are implemented, such as a reasonably efficient simulation method. Note that the new register value returned in apply automatically wraps modulo $2^n$ where $n$ is the size of the register. Also it is your responsibility to make sure the arithmetic operation is actually reversible.

+

Then you can use it like this:

+
register = cirq.LineQubit.range(2)
+circuit = cirq.Circuit(Increment(register))
+
+print(circuit)
+# 0: ───<__main__.Increment object at 0x000002594B1F03C8>───
+#       │
+# 1: ───#2──────────────────────────────────────────────────
+
+
+print(cirq.unitary(Increment(register)))
+# [[0.+0.j 0.+0.j 0.+0.j 1.+0.j]
+#  [1.+0.j 0.+0.j 0.+0.j 0.+0.j]
+#  [0.+0.j 1.+0.j 0.+0.j 0.+0.j]
+#  [0.+0.j 0.+0.j 1.+0.j 0.+0.j]]
+
+",119,,119,,9/17/2020 6:23,9/17/2020 6:23,,,,0,,,,CC BY-SA 4.0 +13781,1,13786,,9/17/2020 6:39,,0,494,"

I am trying to implement the partial trace operation on IBMs quantum computer. I am simulating the depolarising channel with the following code

+
#aim here is to build the decoherence channel
+p=0.1;
+z=0.5+0.5*math.sqrt(1-p);
+desiredvec=[
+    math.sqrt(1-z),
+    math.sqrt(z)]
+circuit2 = QuantumCircuit(4,3);
+circuit2.initialize(desiredvec,0)
+circuit2.initialize(desiredvec,1)
+circuit2.initialize(desiredvec,2)
+circuit2.cx(0,3)
+circuit2.h(3)
+circuit2.s(3)
+circuit2.cx(1,3)
+circuit2.h(3)
+circuit2.s(3)
+circuit2.cx(2,3)
+circuit2.h(3)
+circuit2.s(3)
+circuit2.draw()
+
+

I would now like to trace out all but qubit 3 as it is the only qubit I am interested in. I can get around this by just ignoring the other qubits but I would rather not do this. Is there any easy way to trace out unwanted qubits?

+

Or equivalently is there a way to initalise the qubit in a mixed state so that the extra ancillary qubits aren't needed in the first place?

+",13261,,55,,9/20/2020 22:06,9/20/2020 22:06,Implementing Partial Trace in IBMs quantum computer,,2,0,,,,CC BY-SA 4.0 +13782,1,13784,,9/17/2020 6:52,,4,1292,"

From this link:

+

+

Where equation 1 is: +

+

I can probably brute-force this by explicitly calculating this quantum circuit's effective 4x4 matrix and seeing that its equivalent to this teleportation operation - but what does this have to do with X=HZH? Where is x used here? Is X somehow equivalent to a cNOTgate? X, Z and H are all one-qubit gates...so I don't understand what they mean.

+",2660,,55,,9/21/2020 16:57,9/21/2020 16:57,CNOT expressed with CZ and H gates by taking into account HZH =X,,1,1,,,,CC BY-SA 4.0 +13783,2,,13773,9/17/2020 7:05,,2,,"

Each of the itemized steps specifies the part of a quantum circuit where a single error occurs. So, for that part of the circuit, essentially what you want to do is write out the circuit diagram. Then, you "slice up" the circuit, i.e. put in vertical lines that just subdivide the circuit into distinct slices where all the gates in the slice can be performed simultaneously. So, you know the number of time steps required, $T$ and the number of qubits involved, $Q$. So, the number of places an error can occur is $c_0= QT$.

+",1837,,,,,9/17/2020 7:05,,,,2,,,,CC BY-SA 4.0 +13784,2,,13782,9/17/2020 7:28,,4,,"

Here are three equivalent circuits:

+

+

The second equation can be understood from this related answer about the fact that $CZ_{1 \rightarrow 2} = CZ_{2 \rightarrow 1}$, where first index is the control qubit and the second index is the target qubit. The first equation is similar to this related answer, but let's prove it explicitly where we will use $HZH = X$:

+

\begin{equation*} +I \otimes H \; (CZ_{1 \rightarrow 2}) \; I \otimes H= +\\ = I \otimes H \; (|0\rangle \langle 0 | \otimes I + |1\rangle \langle 1 | \otimes Z) \; I \otimes H =\\ += |0\rangle \langle 0 | \otimes H H + |1\rangle \langle 1 | \otimes HZH = +\\ = |0\rangle \langle 0 | \otimes I + |1\rangle \langle 1 | \otimes X = CNOT_{1 \rightarrow 2} +\end{equation*}

+

because $HH = I$ and $HZH = X$.

+",9459,,9459,,9/17/2020 7:57,9/17/2020 7:57,,,,2,,,,CC BY-SA 4.0 +13785,1,,,9/17/2020 10:54,,7,114,"

This question is two-fold and considers general $n$-qubit operations on a quantum computer.

+

First, can a general $n$-qubit operation be implemented on a quantum computer without the use of ancilla qubits?

+

Second, can ancilla qubits help in reducing the depth of such general $n$-qubit operations and if yes, what is the relation between the two?

+",2005,,55,,9/23/2020 9:31,9/1/2022 17:24,Reducing the depth of quantum circuits with ancilla qubits,,1,3,,,,CC BY-SA 4.0 +13786,2,,13781,9/17/2020 11:21,,1,,"

qiskit.quantum_info has a partial_trace method you can use for this.

+

It takes as input either a Statevector or a DensityMatrix object. Both these classes implement the from_instruction routine that you can use with the QuantumCircuit object you already have. You would have to do something along the lines of:

+
circuit2 = QuantumCircuit(4,3)
+
+...
+# your operations
+...
+
+statevec = Statevector.from_instruction(circuit2)
+trace = partial_trace(statevec, 3)
+
+

Hope this helps!

+",8955,,,,,9/17/2020 11:21,,,,0,,,,CC BY-SA 4.0 +13787,1,13791,,9/17/2020 12:26,,2,281,"

I prepared a quadratic optimization task with binary and integer variables and linear and quadratic constraints. I fed it into QuadraticProgram in Qiskit. After that, I tried to convert the program to binary optimization task with constraints in form of equality only. I used InequalityToEquality and IntegerToBinary converters to do this. However, an error was returned. After some trial and error, I realized that the problem is caused by the quadratic constraint, so I removed it and everything is fine.

+

My questions are:

+
    +
  1. Is the problem really in the quadratic constraint? Or in other words, are such constraints forbidden when I want to use converters?
  2. +
  3. If so, is there any other way how to convert QuadraticProgram to QUBO in Qiskit? +(note that QuadraticProgramToQubo also does not work since IntegerToBinary is part of it)
  4. +
+

Here is my code:

+
%matplotlib inline
+from qiskit.optimization import QuadraticProgram
+from qiskit.optimization.converters import InequalityToEquality, IntegerToBinary, QuadraticProgramToQubo
+
+#create empty optimization task (model)
+mod = QuadraticProgram('Quadratic optimization problem') #string in brackets - user defined name of the task
+
+#adding variables
+mod.binary_var(name = 'x') #bin
+mod.integer_var(name = 'y', lowerbound = 0, upperbound = 5) 
+mod.integer_var(name = 'z', lowerbound = 0, upperbound = 5) 
+#setting objective function
+mod.minimize(constant = 3, linear = [1,0,1], quadratic = [[1, 0, 2],[0,1,0],[2,0,1]])
+#adding constraints
+mod.linear_constraint(linear = {'x': 1, 'y': 1, 'z':1}, sense = '==', rhs = 1, name = 'L1')
+mod.linear_constraint(linear = {'x': -1, 'y': -1, 'z':2}, sense = '>=', rhs = 0, name = 'L2')
+mod.linear_constraint(linear = {'x': 10, 'y': 20, 'z':30}, sense = '<=', rhs = 100, name = 'L3')
+
+#PROBLEMATIC QUADRATIC CONSTAINT
+mod.quadratic_constraint(linear = {'x':1, 'y':1}, quadratic = {('x','y'):1, ('x','z'):-1}, sense = '<=', rhs = 2, name = 'Q1')
+
+modConverted = InequalityToEquality().convert(mod)
+modConverted = IntegerToBinary().convert(modConverted)
+print(modConverted.export_as_lp_string())
+
+

And here is the returned error:

+
---------------------------------------------------------------------------
+KeyError                                  Traceback (most recent call last)
+<ipython-input-13-f345029f5fa8> in <module>
+     20 
+     21 modConverted = InequalityToEquality().convert(mod)
+---> 22 modConverted = IntegerToBinary().convert(modConverted)
+     23 print(modConverted.export_as_lp_string())
+
+/opt/conda/lib/python3.7/site-packages/qiskit/optimization/converters/integer_to_binary.py in convert(self, problem)
+     96                         )
+     97 
+---> 98             self._substitute_int_var()
+     99 
+    100         else:
+
+/opt/conda/lib/python3.7/site-packages/qiskit/optimization/converters/integer_to_binary.py in _substitute_int_var(self)
+    199             )
+    200             quadratic, q_linear, q_constant = self._convert_quadratic_coefficients_dict(
+--> 201                 constraint.quadratic.to_dict()
+    202             )
+    203 
+
+/opt/conda/lib/python3.7/site-packages/qiskit/optimization/converters/integer_to_binary.py in _convert_quadratic_coefficients_dict(self, coefficients)
+    137         quadratic = {}
+    138         for (name_i, name_j), v in coefficients.items():
+--> 139             x = self._src.get_variable(name_i)
+    140             y = self._src.get_variable(name_j)
+    141 
+
+/opt/conda/lib/python3.7/site-packages/qiskit/optimization/problems/quadratic_program.py in get_variable(self, i)
+    243             return self.variables[i]
+    244         else:
+--> 245             return self.variables[self._variables_index[i]]
+    246 
+    247     def get_num_vars(self, vartype: Optional[VarType] = None) -> int:
+
+KeyError: 0
+```
+
+",9006,,55,,9/21/2020 16:58,9/21/2020 16:58,Quadratic optimization in Qiskit: Error when QuadraticProgram with quadratic constraint converted to QUBO,,1,0,,,,CC BY-SA 4.0 +13788,1,,,9/17/2020 12:55,,0,336,"

I read about Hadamard gate H and found it's matrix representation as follows:

+

$$H_1=\frac{1}{\sqrt 2}\begin{pmatrix}1 & 1 \\1 & -1\end{pmatrix}$$

+

I wanted to know what will be the matrix representation of H in computational basis.

+",13266,,55,,9/21/2020 17:00,9/21/2020 19:42,What is the matrix representation of the Hadamard gate in the computational basis?,,1,1,,,,CC BY-SA 4.0 +13790,2,,13788,9/17/2020 14:26,,4,,"

This is the matrix representation of $H$ in the computational basis. The first column is the image of $|0\rangle$ and the second column is the image of $|1\rangle$.

+

The reason that $H$ looks the same in both the computational and the "plus/minus" basis is that $H$ is a self-adjoint (or hermitian) unitary, this makes it very special as it means that its self-inverse since we have that $$H^{−1}=H^\dagger=H\,.$$

+",11793,,11793,,9/21/2020 19:42,9/21/2020 19:42,,,,2,,,,CC BY-SA 4.0 +13791,2,,13787,9/17/2020 14:44,,3,,"

Thank you for your report. +I investigated the details and fixed the bug with this pull request.

+",13268,,45,,9/18/2020 0:17,9/18/2020 0:17,,,,3,,,,CC BY-SA 4.0 +13793,2,,12068,9/17/2020 15:22,,1,,"

I haven't tried, but probably you can create your own type which extends ParameterExpression type(class) and define your custom function (in this case sqrt) so that it can be applied on the Parameter obj during the training/testing phase. Paramter objects can only evaluate basic arithmetic operations, which probably you might have already observed.

+

May be I will try and let you know if it works. But looks possible.

+",13102,,,,,9/17/2020 15:22,,,,1,,,,CC BY-SA 4.0 +13794,1,,,9/17/2020 16:42,,6,552,"

I was watching some lectures on qubits. They were talking about how to generate a Bell state. They described it as follows:

+
+
    +
  1. Prepare state 00: +$$\left |0 \right> \otimes \left |0 \right>$$
  2. +
  3. Apply the Hadamard: +$$ (H \otimes I)(\left |0 \right> \otimes \left |0 \right> ) = \left |+0 \right> = \frac{\left|00 \right> + \left |10 \right>}{\sqrt{2}}$$
  4. +
  5. Apply CNOT to go from state 00 + 10 to state 00 + 11, +$$ CNOT = \left |0 \right> \left <0 \right| \otimes I + \left |1 \right> \left<1 \right| \otimes X $$ +such that: +$$CNOT\times\frac{\left|00 \right> + \left |10 \right>}{\sqrt{2}}=\frac{\left |0 \right> \left <0|0 \right> \otimes I \left |0 \right> + \left |0 \right> \left <0|1 \right> \otimes I\left |1 \right> + \left |1 \right> \left <1|0 \right> \otimes X \left |0 \right> + \left |1 \right> \left <1|1 \right> \otimes X \left |0 \right> }{\sqrt{2}} = \left | \Omega \right >$$
  6. +
+
+

I am not sure I can follow how the product of the CNOT and the state $\left|00 \right> + \left |10 \right>$ can be expanded out as written above. Hope you guys can help me out.

+",13243,,9006,,9/18/2020 7:11,12/23/2020 14:39,Bell state preparation,,4,0,,,,CC BY-SA 4.0 +13795,2,,13794,9/17/2020 16:58,,3,,"

As you wrote at point 3, $CNOT$ is the sum of two tensor products, each one involving two matrices. Consider the first tensor product and apply the two matrices respectively to $|0\rangle$ and to $|0\rangle$ (the $|00\rangle$ pair in your state obtained at 2.) and perform the tensor product, so you get the first quarter of the final expansion. Apply the same two matrices respectively to $|0\rangle$ and to $|1\rangle$ (the $|01\rangle$ pair in your state obtained at 2.) and perform the tensor product, so you get the second quarter of the final expansion. Then repeat using the second tensor product of the CNOT expansion, and you get the third and fourth quarters of the final expansion. Shortly, use the distributive property of multiplication.

+",5551,,,,,9/17/2020 16:58,,,,0,,,,CC BY-SA 4.0 +13796,1,,,9/17/2020 18:54,,2,60,"

I am designing an experiment which involves solving a linear system of equations of the form $Ax=b$. To do this, I am using the HHL algorithm on the IBMQ system. My experiment is scalable such that the size of matrix $A$ can be as large or small as I choose it to be. I would like to tailor the size of my matrix $A$ to be as large as possible but still within the computation limit of the quantum computer that I use. My suspicion is that to determine this I need to account for the quantum volume of the IBMQ machine that I use, but I do not understand exactly how.

+

Here is a little more information that may be useful. My experiment is adapted from the code in this HHL tutorial describing the general method to run the algorithm (section 4A). This means that I have not optimized the algorithm in any way. That being said, an example of the resource requirements for a modestly sized matrix $A$ for my experiment are as follows:

+
circuit_width:   11
+circuit_depth:   101
+CNOT gates:      54
+
+

My question is, how can I use these numbers to determine the quantum volume required to run my experiment?

+",13244,,55,,9/21/2020 14:05,9/21/2020 14:05,How can I use the quantum volume to design the scale of my experiment?,,1,0,,,,CC BY-SA 4.0 +13797,2,,13725,9/17/2020 19:19,,2,,"

So, there actually is a method called to_operator() for the class Statevector which takes a statevector and converts it into a projector operator. Here is the code to write your specific projector operator:

+
from qiskit.quantum_info import Statevector
+zero = Statevector([1,0])
+zero_state = zero.tensor(zero) # or zero_state = Statevector([1,0,0,0])
+projector = zero_state.to_operator()
+
+

As you can see, you can input a state as a python list, or as a numpy array. If you print this projector, you will get the following output:

+

Then, after making your operator, you can use the method evolve() to apply the projector operator on a statevector:

+
statevector.evolve(projector)
+
+",13117,,,,,9/17/2020 19:19,,,,0,,,,CC BY-SA 4.0 +13798,1,,,9/17/2020 22:59,,1,741,"

In Qiskit, I need to define a custom gate or instruction that, once decomposed, turns into a series of basis gates, including measurements and classically controlled gates (this is the part that I can't get around).

+

I already tried using QuantumCircuit.to_gate(), but it does not work, maybe there is a way to it with the Instruction class?

+

Edit 1

+

I tried to do something like this:

+
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
+
+def mygate():
+    qr = QuantumRegister(4)
+    cr1 = ClassicalRegister(1)
+    cr2 = ClassicalRegister(1)
+    qc = QuantumCircuit(qr, cr1, cr2, name='mygate')
+    qc.measure(qr[0], cr1[0])
+    qc.measure(qr[1], cr2[0])
+    qc.x(qr[-2]).c_if(cr1, 1)
+    qc.x(qr[-1]).c_if(cr2, 1)
+
+    return qc.to_instruction()
+
+
+big = QuantumCircuit(5, 4)
+big.append(mygate(), range(4), range(2))
+
+

But it does not work.

+
qiskit.exceptions.QiskitError: 'Cannot convert condition in circuit with multiple classical registers to instruction'
+
+",9200,,55,,9/21/2020 14:05,2/18/2021 17:05,Custom Gate/Instruction with classical bits in Qiskit,,2,1,,,,CC BY-SA 4.0 +13800,1,,,9/17/2020 23:31,,3,93,"

I am interested in solving a time dependent linear partial differential equation of the form $Ax=b$ which, in classical computing, would amount to looping over solutions of $Ax=b$ where $b$ is updated each step.

+

My question is, is there a quantum analog to the looping procedure that I have described? If not, does that imply that to solve this one would need to write a loop on the classical system which calls the quantum solver each step? In case it is relevant, I am using the IBMQ system.

+

This question is related to this post.

+",13244,,55,,9/21/2020 16:55,9/21/2020 16:55,What is the best way to use loop statements on a quantum computer?,,0,5,,,,CC BY-SA 4.0 +13801,2,,13798,9/17/2020 23:31,,1,,"

You need to convert a circuit into an instruction, not a gate. A gate is assumed to be invertible, which is not the case if you have measurements and classical conditionals. Therefore, you need to create a custom instruction. Here is a short tutorial for that:

+

First, create a circuit will all your gates and instructions, with measurements and conditionals. This will be the custom instruction:

+
from qiskit import *
+from qiskit.circuit.library import *
+
+qr = QuantumRegister(2)
+cr = ClassicalRegister(2)
+circuit = QuantumCircuit(qr, cr, name='my_inst')
+circuit.h(qr[0])
+circuit.cx(qr[0], qr[1])
+circuit.measure(qr[1], cr[0])
+circuit.append(XGate(), [qr[0]]).c_if(cr,2)
+circuit.draw('text')
+
+
      ┌───┐         ┌───┐ 
+q4_0: ┤ H ├──■──────┤ X ├─
+      └───┘┌─┴─┐┌─┐ └─┬─┘ 
+q4_1: ─────┤ X ├┤M├───┼───
+           └───┘└╥┘┌──┴──┐
+c4: 2/═══════════╩═╡ = 2 ╞
+                 0 └─────┘
+
+

Then, you need to convert this circuit into an instruction:

+
my_inst = circuit.to_instruction()
+
+

This instruction can be append to another super circuit:

+
big_circuit = QuantumCircuit(5, 2)
+big_circuit.h(range(5))
+big_circuit.append(my_inst, range(2), range(2))
+big_circuit.h(range(5))
+big_circuit.draw('text')
+
+
     ┌───┐┌──────────┐┌───┐
+q_0: ┤ H ├┤0         ├┤ H ├
+     ├───┤│          │├───┤
+q_1: ┤ H ├┤1         ├┤ H ├
+     ├───┤│          │├───┤
+q_2: ┤ H ├┤          ├┤ H ├
+     ├───┤│          │├───┤
+q_3: ┤ H ├┤  my_inst ├┤ H ├
+     ├───┤│          │├───┤
+q_4: ┤ H ├┤          ├┤ H ├
+     └───┘│          │└───┘
+c_0: ═════╡0         ╞═════
+          │          │     
+c_1: ═════╡1         ╞═════
+          └──────────┘     
+
+

There it is. If you decompose the instructions in this circuit, you will see the internal operations:

+
big_circuit.decompose().draw('text')
+
+
     ┌──────────┐   ┌───┐                         ┌───┐ ┌──────────┐
+q_0: ┤ U2(0,pi) ├───┤ H ├──────■──────────────────┤ X ├─┤ U2(0,pi) ├
+     ├─��────────┤   └───┘    ┌─┴─┐┌─┐┌──────────┐ └─┬─┘ └──────────┘
+q_1: ┤ U2(0,pi) ├────────────┤ X ├┤M├┤ U2(0,pi) ├───┼───────────────
+     ├──────────┤┌──────────┐└───┘└╥┘└──────────┘   │               
+q_2: ┤ U2(0,pi) ├┤ U2(0,pi) ├──────╫────────────────┼───────────────
+     ├──────────┤├──────────┤      ║                │               
+q_3: ┤ U2(0,pi) ├┤ U2(0,pi) ├──────╫────────────────┼───────────────
+     ├──────────┤├──────────┤      ║                │               
+q_4: ┤ U2(0,pi) ├┤ U2(0,pi) ├──────╫────────────────┼───────────────
+     └──────────┘└──────────┘      ║             ┌──┴──┐            
+c: 2/══════════════════════════════╩═════════════╡ = 2 ╞════════════
+                                   0             └─────┘            
+
+

If you want to decompose the circuit to a particular base, you can use the transpiler for that:

+
decomposed = transpile(big_circuit, basis_gates=['cx', 'u3'], optimization_level=0)
+decomposed.draw('text', fold=-1)
+
+
     ┌───────────────┐┌───────────────┐                         ┌─────────────┐┌───────────────┐
+q_0: ┤ U3(pi/2,0,pi) ├┤ U3(pi/2,0,pi) ├──■──────────────────────┤ U3(pi,0,pi) ├┤ U3(pi/2,0,pi) ├
+     ├───────────────┤└───────────────┘┌─┴─┐┌─┐┌───────────────┐└──────┬──────┘└───────────────┘
+q_1: ┤ U3(pi/2,0,pi) ├─────────────────┤ X ├┤M├┤ U3(pi/2,0,pi) ├───────┼────────────────────────
+     ├───────────────┤┌───────────────┐└───┘└╥┘└───────────────┘       │                        
+q_2: ┤ U3(pi/2,0,pi) ├┤ U3(pi/2,0,pi) ├──────╫─────────────────────────┼────────────────────────
+     ├───────────────┤├───────────────┤      ║                         │                        
+q_3: ┤ U3(pi/2,0,pi) ├┤ U3(pi/2,0,pi) ├──────╫─────────────────────────┼────────────────────────
+     ├───────────────┤├───────────────┤      ║                         │                        
+q_4: ┤ U3(pi/2,0,pi) ├┤ U3(pi/2,0,pi) ├──────╫─────────────────────────┼────────────────────────
+     └───────────────┘└───────────────┘      ║                      ┌──┴──┐                     
+c: 2/════════════════════════════════════════╩══════════════════════╡ = 2 ╞═════════════════════
+                                             0                      └─────┘                     
+
+",1859,,1859,,9/17/2020 23:46,9/17/2020 23:46,,,,4,,,,CC BY-SA 4.0 +13802,2,,13728,9/17/2020 23:53,,1,,"

use %matplotlin inline before executing draw('mpl') here is the link for more info

+",8527,,,,,9/17/2020 23:53,,,,3,,,,CC BY-SA 4.0 +13803,1,,,9/18/2020 0:56,,3,169,"

I was able to calculate the one and two-body integrals for the H2 with the following code

+
from qiskit.chemistry.drivers import PySCFDriver, UnitsType
+
+atom = 'H .0 .0 .0; H .0 .0 0.74' 
+distance_unit = UnitsType.ANGSTROM
+basis = 'sto3g'
+
+driver = PySCFDriver(atom, unit=distance_unit, basis=basis)
+
+molecule = driver.run()
+
+h1 = molecule.one_body_integrals
+h2 = molecule.two_body_integrals
+print( h1 ) 
+print( h2 ) 
+
+

and the results is

+
[[-1.25330979  0.          0.          0.        ]
+ [ 0.         -0.47506885  0.          0.        ]
+ [ 0.          0.         -1.25330979  0.        ]
+ [ 0.          0.          0.         -0.47506885]]
+[[[[-0.33737796  0.          0.          0.        ]
+   [ 0.         -0.09060523  0.          0.        ]
+   [ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]]
+
+  [[ 0.         -0.09060523  0.          0.        ]
+   [-0.3318557   0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]]
+
+  [[ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]
+   [-0.33737796  0.          0.          0.        ]
+   [ 0.         -0.09060523  0.          0.        ]]
+
+  [[ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]
+   [ 0.         -0.09060523  0.          0.        ]
+   [-0.3318557   0.          0.          0.        ]]]
+
+
+ [[[ 0.         -0.3318557   0.          0.        ]
+   [-0.09060523  0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]]
+
+  [[-0.09060523  0.          0.          0.        ]
+   [ 0.         -0.34882575  0.          0.        ]
+   [ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]]
+
+  [[ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]
+   [ 0.         -0.3318557   0.          0.        ]
+   [-0.09060523  0.          0.          0.        ]]
+
+  [[ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]
+   [-0.09060523  0.          0.          0.        ]
+   [ 0.         -0.34882575  0.          0.        ]]]
+
+
+ [[[ 0.          0.         -0.33737796  0.        ]
+   [ 0.          0.          0.         -0.09060523]
+   [ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]]
+
+  [[ 0.          0.          0.         -0.09060523]
+   [ 0.          0.         -0.3318557   0.        ]
+   [ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]]
+
+  [[ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]
+   [ 0.          0.         -0.33737796  0.        ]
+   [ 0.          0.          0.         -0.09060523]]
+
+  [[ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.         -0.09060523]
+   [ 0.          0.         -0.3318557   0.        ]]]
+
+
+ [[[ 0.          0.          0.         -0.3318557 ]
+   [ 0.          0.         -0.09060523  0.        ]
+   [ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]]
+
+  [[ 0.          0.         -0.09060523  0.        ]
+   [ 0.          0.          0.         -0.34882575]
+   [ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]]
+
+  [[ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.         -0.3318557 ]
+   [ 0.          0.         -0.09060523  0.        ]]
+
+  [[ 0.          0.          0.          0.        ]
+   [ 0.          0.          0.          0.        ]
+   [ 0.          0.         -0.09060523  0.        ]
+   [ 0.          0.          0.         -0.34882575]]]]
+
+

This immediately raises the question of how qiskit labels the two-body integrals. If we look at the definition of second quantized Hamiltonian

+

$ +H = \sum_{i,j}h_{ij}a^\dagger_i a_j + \frac{1}{2}\sum_{i,j,k,l}h_{ijkl}a^\dagger_ia^\dagger_ja_ka_l +$

+

then we realize that $h_{0000}=0$, whereas qiskit gives -0.33737796. The answer for the integrals is given in the following table. Any helps are really appreciated.

+

+",9816,,55,,9/21/2020 14:07,10/11/2022 18:04,What is the convention of indices for the one and two-body integrals in qiskit,,1,0,,,,CC BY-SA 4.0 +13804,2,,13803,9/18/2020 4:02,,0,,"

Something to keep in mind is that integrals often hold two forms of symmetries - not only the symmetries enumerated in that table between the indices, but also the spins of the orbitals. I think this is explained well in Microsoft's documents. For example, if the input file notes $a^\dagger_0 a^\dagger_1 a_1 a_0$, we need to consider the potential permutations and the potential spins. So, we'd consider $a^\dagger_{0, \sigma} a^\dagger_{1, \rho} a_{1, \rho} a_{0, \sigma} $, and all of the permutations of the numbers, and all combinations of $\sigma, \rho \in \{ \uparrow, \downarrow \}$, where $\{ \uparrow, \downarrow \}$ are the spins.

+

So, while the $a^\dagger_0 a^\dagger_0 a_0 a_0$ may be invalid, $a^\dagger_{0, \uparrow}, a^\dagger_{0, \downarrow} a_{0, \downarrow} a_{0, \uparrow} $ is totally valid after indexing.

+

Admittedly, I have not dived into the PySCF documents, but my assumption is that programs like NWChem and PySCF all use the minimal integral representations and reconstruct from there.

+",8343,,,,,9/18/2020 4:02,,,,2,,,,CC BY-SA 4.0 +13805,2,,13697,9/18/2020 6:50,,1,,"

I suppose you want to generate uniformly distributed sequence of bits. In such case you can apply a Hadamard gates on $n$ qubits, where $n$ is number of bits you want to have in your sequence.

+

Application of Hadamard gates on $n$ qubits in state $|0\rangle$ will lead to state +$$ +H^{\otimes n}|0\rangle ^{\otimes n} = \frac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n-1}|i\rangle, +$$ +i.e. you get equally distributed superposition of all bit strings of length $n$.

+

After measurement you will get a random sequence of $n$ bits.

+",9006,,,,,9/18/2020 6:50,,,,2,,,,CC BY-SA 4.0 +13806,2,,13794,9/18/2020 7:06,,1,,"

I would recommend to use a direct matrix representation.

+
    +
  1. An input state $|00\rangle$ can be writen as vector +$$x= +\begin{pmatrix} +1\\0\\0\\0 +\end{pmatrix} +$$

    +
  2. +
  3. First step, i.e. Hadamard gate on first qubit and "nothing" on second qubit is described by operation +$$ +H \otimes I = \frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 1 \\ +1 & -1 +\end{pmatrix} +\otimes +\begin{pmatrix} +1 & 0 \\ +0 & 1 +\end{pmatrix} += +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 & 0 & 1 & 0 \\ +0 & 1 & 0 & 1 \\ +1 & 0 & -1 & 0 \\ +0 & 1 & 0 & -1 \\ +\end{pmatrix} +$$

    +
  4. +
  5. Multiplying vector $x$ with matrix $H \otimes I$ gives vector +$$ +y=\ +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 \\ 0 \\ 1 \\0 +\end{pmatrix}, +$$ +which is a first column of the matrix.

    +
  6. +
  7. Now, you can apply CNOT gate described by matrix +$$ +\text{CNOT}= +\begin{pmatrix} +1 & 0 & 0 & 0\\ +0 & 1 & 0 & 0\\ +0 & 0 & 0 & 1\\ +0 & 0 & 1 & 0\\ +\end{pmatrix}, +$$ +so +$$ +z=\text{CNOT}\, y= +\frac{1}{\sqrt{2}} +\begin{pmatrix} +1 \\ 0 \\ 0 \\ 1 +\end{pmatrix} +$$

    +
  8. +
+

In computational basis, vector $z$ is +$$ +z = \frac{1}{\sqrt{2}}(|00\rangle+|11\rangle), +$$ +which is a desired Bell state.

+",9006,,,,,9/18/2020 7:06,,,,0,,,,CC BY-SA 4.0 +13807,2,,13796,9/18/2020 7:28,,3,,"

You can't. The quantum volume is supposed to be an average measure of the quality of the quantum computer - it doesn't tell you anything on how good it will perform on solving a certain problem. (It is even questionable whether it is telling you anything meaningful, see also Is the "Quantum Volume" a fair metric for future, elaborate, high value quantum computations?) A quantum volume of 64 tells you that circuits of random 2-qubit gates of width and depth 6 can be done more or less reliably on that device. Compare that to your depth of 101. Running any kind of half-way realistic algorithm on a quantum computer these days is basically an expensive way of rolling dice.

+",2305,,,,,9/18/2020 7:28,,,,0,,,,CC BY-SA 4.0 +13808,2,,13798,9/18/2020 7:48,,0,,"

I don't see a way to avoid the error you are getting as an Instruction can't handle multiple classical registers but here is a workaround.

+
def mygate():
+
+  qr = QuantumRegister(4)
+  cr1 = ClassicalRegister(1)
+  cr2 = ClassicalRegister(1)
+
+  qc = QuantumCircuit(qr, cr1, cr2, 
+                      name='mygate')
+
+  qc.measure(qr[0], cr1[0])
+  qc.measure(qr[1], cr2[0])
+
+  qc.x(qr[-2]).c_if(cr1, 1)
+  qc.x(qr[-1]).c_if(cr2, 1)
+
+  return qc
+
+
+
+big = QuantumCircuit(5, 4)
+big.compose(mygate(), 
+            qubits=range(4), clbits=range(2), 
+            inplace=True)
+
+",13109,,,,,9/18/2020 7:48,,,,1,,,,CC BY-SA 4.0 +13809,1,,,9/18/2020 8:57,,1,61,"

Is there a method to correct an error of the form of $e^{ix}$, acted on a two-qubit state without knowing the nature (the value of x) of the error?

+

For example, +$$\alpha|00\rangle +\beta|01\rangle+\gamma|10\rangle+e^{ix}\delta|11\rangle.$$

+

Also, can I rephrase the above question to:

+

Is there a method to correct an error that results an orthogonal state to deform into a non-orthogonal state?

+",6297,,55,,9/21/2020 14:07,9/21/2020 14:07,How to correct a phase error of the form $e^{ix}$,,0,3,,,,CC BY-SA 4.0 +13810,2,,13728,9/18/2020 10:24,,2,,"

It's an issue with latest Qiskit I've noticed. Use following command to downgrade it to previous version(0.16.1 specifically) for the time being.

+
+

!pip install +qiskit==0.16.1

+
+",7889,,,,,9/18/2020 10:24,,,,1,,,,CC BY-SA 4.0 +13811,2,,12068,9/18/2020 10:55,,2,,"

You basically have to construct:

+
    +
  1. A parametrized circuit
  2. +
  3. Objective function which returns the cost
  4. +
  5. Minimize the cost with the classical optimizer eg. COBYLA
  6. +
+

Example: +https://qiskit.org/textbook/ch-applications/vqe-molecules.html#Example-with-a-Single-Qubit-Variational-Form

+",13277,,,,,9/18/2020 10:55,,,,0,,,,CC BY-SA 4.0 +13812,1,,,9/18/2020 11:13,,1,68,"

Suppose I have a portfolio optimization problem where I have to minimize, +$$qx^T\sum x - \mu^Tx$$

+

where q is the maximum risk and x is {0,1}^n and $\mu$ are the expected returns.

+

Now I have to convert this problem into Hamiltonian and subsequently find the Pauli Basis for it. How can I do so?

+",13277,,,,,9/18/2020 11:13,How to construct Hamiltonian for combinatorial optimization problems and then convert into Pauli basis?,,0,3,,,,CC BY-SA 4.0 +13813,2,,11463,9/18/2020 11:29,,2,,"

Hamiltonian is the basic building block for VQE algorithm. Basically, we try to minimize the expectation of the Hamiltonian to find the lowest eigenvalue of the Hamiltonian matrix which is apparently very useful for many problems ranging from chemistry to finance.

+

Find more details on: +https://arxiv.org/pdf/1907.04769.pdf

+",13277,,,,,9/18/2020 11:29,,,,0,,,,CC BY-SA 4.0 +13814,2,,5769,9/18/2020 12:03,,-3,,"

You can also use Qiskit, as described here:

+
+

The depth of a circuit is a metric that calculates the longest path between the data input and the output. Each gate counts as a unit.

+
+

That is, it's not just the longest sequence of gates on one qubit, but the number of gates that qubit relies upon (which includes gates of other qubits it interacts with).

+

In Qiskit, it can be calculated using QuantumCircuit.depth.

+",13278,,23,,9/18/2020 20:32,9/18/2020 20:32,,,,1,,,,CC BY-SA 4.0 +13815,2,,9571,9/18/2020 16:30,,1,,"

$\newcommand{\bra}[1]{\left<#1\right|} +\newcommand{\ket}[1]{\left|#1\right>} +\newcommand{\sch}[1]{\operatorname{Sch}\left( #1 \right)} +\newcommand{\cases}[3]{ +#1 = +\begin{cases} +#2 \hspace{1em} \text{if} \hspace{1em} i \le \sch{\gamma} \\ +#3 \hspace{1em} \text{otherwise} +\end{cases}} +$If $\sch{\phi} = \sch{\gamma}$ then we are done because $\sch{\psi} \ge 0$ always holds for a pure state.

+

If $\sch{\phi} \ne \sch{\gamma}$ then let's assume that the statement of the problem does not hold, so we have: +$$ +\sch{\psi} \lt | \sch{\phi} - \sch{\gamma}| \tag{1}\label{1} +$$ +Without loss of generality we can assume that $\sch{\phi} > \sch{\gamma}$. From this we have: +$$ +\sch{\phi} > \sch{\gamma} + \sch{\psi} \tag{2}\label{2} +$$ +We can write: +$$ +\ket{\phi} = \frac{\beta}{\alpha} \ket{\gamma} - +\frac{1}{\alpha} \ket{\psi} \tag{3}\label{3} +$$ +We can write the Schmidt decomposition of $\ket{\gamma}$ and $\ket{\psi}$ as: +$$ +\ket{\gamma} = \sum_{i=1}^{\sch{\gamma}} \gamma_i \ket{a_i^{\gamma}} \ket{b_i^{\gamma}} \\ +\ket{\psi} = \sum_{i=1}^{\sch{\psi}} \psi_i \ket{a_i^{\psi}} \ket{b_i^{\psi}} +$$ +Plugging these into $\eqref{3}$, we have: +$$ +\ket{\phi} = \sum_{i=1}^{\sch{\gamma} + \sch{\psi}} \delta_i \ket{a_i^{\delta}} \ket{b_i^{\delta}} \tag{4}\label{4} +$$ +where +$$ +\cases{\delta_i }{\frac{\beta}{\alpha} \gamma_i}{-\frac{1}{\alpha} \psi_i}\\ +\cases{a_i^{\delta}}{a_i^{\gamma}}{a_i^{\psi}}\\ +\cases{b_i^{\delta}}{b_i^{\gamma}}{b_i^{\psi}} +$$ +Now we can invoke the result of Problem 2.2 (2) from Nielsen and Chuang. This says:

+
+

Suppose $\ket{\psi} = \sum_j \ket{\alpha_j}\ket{\beta_j}$ is a representation for $\ket{\psi}$, where $\ket{\alpha_j}$ and $\ket{\beta_j}$ are (un-normalized) states for systems $A$ and $B$, respectively. Prove that the number of terms in such a decomposition is greater than or equal to the Schmidt number of $\psi$, $\sch{\psi}$.

+
+

Applying this to \eqref{4}, we obtain: +$$ +\sch{\phi} \le \sch{\gamma} + \sch{\psi} \tag{5}\label{5} +$$ +This contradicts $\eqref{2}$ which is derived from $\eqref{1}$, so we must have $\sch{\psi} \ge | \sch{\phi} - \sch{\gamma}|$.

+",12643,,,,,9/18/2020 16:30,,,,0,,,,CC BY-SA 4.0 +13816,1,,,9/18/2020 17:37,,3,45,"

I've been searching about quantum amplitude estimation techniques and read that it is customary to use an extra qubit to separate good and bad states using algorithm $A$ as

+

$$ A|{0} \rangle^{\otimes^{n+1}} = |0\rangle |\psi_0\rangle + |1\rangle |\psi_1\rangle $$

+

I was wondering the following:

+

a) If we don't have a guarantee that a solution $|\psi_1\rangle$ exists, what happens if we perform amplitude estimation/amplification?.

+

b) Is quantum amplitude estimation bounded by the initial probability of $|{\psi_1}\rangle$ or is it bounded with the size of the hillbert space? With the assumption that all $2^n$ possible states are initialized with the same amplitude, we would need $\sqrt{2^n}$ steps to boost the amplitude of $|{\psi_1}\rangle$, but wouldnt it be possible to perform quantum amplitude amplification if the inversion about the mean would be performed directly on the additional qubit? I was wondering this because if we look at the n qubits from our problem, initially, we would see the same amplitude for every state, but if we only focused on the additional qubit we only have two states and the inversion about the mean would be around $\sqrt{\frac{1}{2}}$ rather than $\sqrt{\frac{1}{2^n}}$ (using $\mathbf{Q} = -AS_oA^{-1}S_x$ but $S_o$ and $S_1$ only in the additional qubit). If this is not possible, could you give me some insight as to why it cant be done? I would really appreciate it.

+",12302,,55,,9/23/2020 9:28,9/23/2020 9:28,Amplitude estimation over subspace of problem,,0,0,,,,CC BY-SA 4.0 +13817,2,,13794,9/18/2020 20:54,,1,,"

I will answer the question in a different way. Let's assume your two qubits are represented as below.

+

+

Consider your $|00\rangle$, represented by $|q_1q_0\rangle$, is the state of above circuit before applying any gates, this is same as your original state $|0\rangle \otimes |0\rangle$.

+

Now applying hadamard in your step 2 is same as applying hadamard on $q_0$. We know $q_0$ is $|0\rangle$. So if apply hadamard gate on $|0\rangle$ it will be transformed to $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$. (check this by doing simple matrix multiplication if you are in doubt).

+

Let's see $q_1$ now, no gate is applied to it so it remains as $|0\rangle$.

+

So now, the combined state is $\frac{1}{\sqrt{2}}(|00\rangle + |01\rangle)$ after applying the hadamard gate. +Now apply the CNOT gate (same as your step 3) on the 2 qubits. Classical CNOT gate simply means if control bit is 1 the target bit is flipped, so same logic can be applied for a CNOT gate applied on the qubit. In our case control qubit is $q_0$ and target qubit is $q_1$. So let's apply CNOT on $|q_1q_0\rangle$

+

$CNOT(\frac{1}{\sqrt{2}}(|00\rangle + |01\rangle))$ when you apply from rightmost, $|01\rangle$ transforms to $|11\rangle$ as control qubit ($q_0$) is contributing $|1\rangle$ here so the target qubit $q_1$ which is contributing $|0\rangle$ flips to $|1\rangle$. Similarly if you move left, $|00\rangle$ will remain $|00\rangle$ as control qubit $q_0$ is contributing $|0\rangle$ to this part, so flipping is not required, hence target qubit($q_1$) remains same($|0\rangle$). So putting both together you get following

+
+

CNOT($\frac{1}{\sqrt{2}}(|00\rangle + |01\rangle)$) = $\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$

+
+

This way of thinking would be helpful when you are dealing with bigger transformations and more qubits. Hope it is helpful.

+",13102,,,,,9/18/2020 20:54,,,,0,,,,CC BY-SA 4.0 +13818,1,,,9/18/2020 21:25,,2,33,"

I'm following the IBM Quantum roadmap and really excited to see what the next 3 years bring. As part of the unveiling, they mentioned that the 1000 Qubit machine goal will really stabilize things with error correction and general stability in place. The advances from that point onwards switches to a software problem rather than a hardware one (notwithstanding lots of work will continue!).

+

I'm playing around with Qiskit and my limited understanding. In entanglement, due to the current fragility we don't want to hold that data any longer than is necessary for fear of losing it. In Classical we like to hold onto data in memory until we need it. Assuming the hardware gives us the stability to maintain a longer lived Quantum state, what benefits or scenarios could that unlock? I'm trying to think of use cases to explore in Qiskit and simulate a long lived state but my fundamental lack of knowledge here is holding me back. I'd love an insight into what you folks think we could do if we had that stability.

+",4210,,55,,9/20/2020 17:30,9/20/2020 17:30,Keeping data around in an entangled state: use cases,,0,1,,,,CC BY-SA 4.0 +13819,2,,13781,9/18/2020 22:16,,1,,"

On a quantum computer, there is no point in implementing a partial trace. Just ignore the qubits which you want to trace.

+",491,,,,,9/18/2020 22:16,,,,3,,,,CC BY-SA 4.0 +13820,1,13858,,9/18/2020 23:18,,1,277,"

I am following this HHL tutorial to solve the $Ax=b$ problem and have been using the general (inefficient) approach with the BasicAer simulator that they describe in section 4a. I would now like to run on the actual IBMQ machines but I am finding that my circuit depth and CNOT counts are quite high. To solve this issue, I would like to optimize my circuit. In section 4b of the tutorial they outline a method of optimizing their specific problem which substantially reduces the qubit count, circuit depth, and CNOT count. The problem I am having is figuring out how to extend this to larger matrices $A$ than the $2$x$2$ that they use. Is there a general approach to optimizing an HHL circuit?

+",13244,,55,,9/21/2020 14:12,9/21/2020 14:12,How to optimize my HHL algorithm on qiskit?,,1,0,,,,CC BY-SA 4.0 +13821,1,13823,,9/19/2020 11:15,,4,349,"

I wish to generate the following unitary

+
[1,0,0,0,0,0,0,0;
+0,1,0,0,0,0,0,0;
+0,0,1,0,0,0,0,0;
+0,0,0,0,1,0,0,0;
+0,0,0,1,0,0,0,0;
+0,0,0,0,0,1,0,0;
+0,0,0,0,0,0,1,0;
+0,0,0,0,0,0,0,1;]
+
+

However the three qubit Toffoli and Fredkin gates do not appear to generate this. Does anyone know a simple way to generate this unitary? It seems to me that it should not be hard to produce as it is so close to the identity.

+",13261,,55,,9/21/2020 14:13,9/21/2020 15:40,Generate a 3-qubit SWAP unitary in terms of elementary gates,,2,1,,,,CC BY-SA 4.0 +13822,1,13832,,9/19/2020 12:02,,1,83,"

I have this program derived from Microsoft Quantum Kata for quantum search (Grover algorithm) (see here)

+
namespace Quantum.Search {
+
+
+open Microsoft.Quantum.Intrinsic;
+open Microsoft.Quantum.Canon;
+open Microsoft.Quantum.Convert;
+open Microsoft.Quantum.Math;
+open Microsoft.Quantum.Oracles;
+open Microsoft.Quantum.Arithmetic;
+open Microsoft.Quantum.Characterization;
+open Microsoft.Quantum.Arrays;
+open Microsoft.Quantum.Measurement;
+
+
+operation SprinklerAnc (queryRegister:  Qubit[],  target : Qubit) : Unit is Adj+Ctl 
+{
+    using (ancilla=Qubit[3 ])
+    {
+        X(queryRegister[2]);
+        X(ancilla[0]);
+        X(ancilla[1]);
+        X(ancilla[2]);
+    
+        CCNOT(queryRegister[0],queryRegister[1],ancilla[0]);
+        CCNOT(queryRegister[1],queryRegister[2],ancilla[1]);
+        CCNOT(queryRegister[0],queryRegister[2],ancilla[2]);
+        (Controlled X)([ancilla[0],ancilla[1],ancilla[2],queryRegister[3]],target);
+        CCNOT(queryRegister[0],queryRegister[2],ancilla[2]);
+        CCNOT(queryRegister[1],queryRegister[2],ancilla[1]);
+        CCNOT(queryRegister[0],queryRegister[1],ancilla[0]);
+
+        X(ancilla[2]);
+        X(ancilla[1]);
+        X(ancilla[0]);
+        X(queryRegister[2]);
+
+    }
+}
+
+operation ApplyMarkingOracleAsPhaseOracle (markingOracle : ((Qubit[], Qubit) => Unit is Adj+Ctl),  register : Qubit[] ) :  Unit is Adj+Ctl 
+{
+    
+    using (target = Qubit()) 
+    {
+        // Put the target into the |-⟩ state
+        X(target);
+        H(target);
+            
+        // Apply the marking oracle; since the target is in the |-⟩ state,
+        // flipping the target if the register satisfies the oracle condition will apply a -1 factor to the state
+        markingOracle(register, target);
+            
+        // Put the target back into |0⟩ so we can return it
+        H(target);
+        X(target);
+    }
+}
+
+
+// The Grover iteration
+operation GroverIteration (register : Qubit[], oracle : ((Qubit[],Qubit) => Unit is Adj+Ctl)) : Unit is Ctl+Adj
+{
+    
+    ApplyMarkingOracleAsPhaseOracle(oracle,register);
+    ApplyToEachCA(H, register);
+    using (ancilla = Qubit()){
+            (ControlledOnInt(0, X))(register, ancilla); // Bit flips the ancilla to |1⟩ if register is |0...0⟩   
+            Z(ancilla);                                 // Ancilla phase (and therefore whole register phase) becomes -1 if above condition is satisfied
+            
+            (ControlledOnInt(0, X))(register, ancilla); // Puts ancilla back in |0⟩  
+    } 
+    Ry(2.0 * PI(), register[0]);
+    ApplyToEachCA(H, register);
+}    
+
+
+operation Search() : Result[] 
+{
+    
+    using (reg=Qubit[4 ])
+    {
+
+
+  H(reg[0]);
+  H(reg[1]);
+  H(reg[2]);
+  H(reg[3]);
+  for (i in 1 ..2) {
+  GroverIteration(reg, SprinklerAnc);
+  }
+  let state = MultiM(reg);
+
+  ResetAll(reg);
+  return state;
+  }
+
+}
+}
+
+

with driver

+
using System;
+using Microsoft.Quantum.Simulation.Core;
+using Microsoft.Quantum.Simulation.Simulators;
+using System.Collections.Generic;
+
+namespace Quantum.Search
+{
+class Driver
+{
+    static void Main(string[] args)
+    {
+
+        using (var qsim = new QuantumSimulator())
+        {
+            IDictionary<string, int> dict = new Dictionary<string, int>();
+            for (int i = 0; i < 1000; i++)
+            {
+                IQArray<Result> res = QMPE.Run(qsim).Result;
+                string s = Convert.ToString(res);
+                int result;
+                if (dict.TryGetValue(s, out result))
+                {
+                    dict.Remove(s);
+                    dict.Add(s, result + 1);
+                }
+                else
+                {
+
+                    dict.Add(s, 1);
+                }
+                System.Console.WriteLine($"Res:{s}");
+
+            }
+            foreach (KeyValuePair<string, int> item in dict)
+            {
+                Console.WriteLine("Key: {0}, Value: {1}", item.Key, item.Value);
+            }
+        }
+    }
+}
+}
+
+

It should search for the solutions of the 3 bits formula (not reg[0] or reg[2]) and (not reg1 or reg[2]) and (not reg[0] or not reg1) and reg[3]. This formula has 4 solutions: 0001, 0011, 0111 and 1011. However, the distribution over the solutions that I get in 1000 execution is

+
Key: [One,One,One,Zero], Value: 57
+Key: [One,One,Zero,Zero], Value: 63
+Key: [Zero,One,One,One], Value: 58
+Key: [Zero,One,One,Zero], Value: 74
+Key: [One,Zero,One,One], Value: 70
+Key: [One,Zero,One,Zero], Value: 70
+Key: [Zero,Zero,One,Zero], Value: 76
+Key: [One,Zero,Zero,One], Value: 47
+Key: [Zero,Zero,Zero,Zero], Value: 79
+Key: [Zero,One,Zero,Zero], Value: 66
+Key: [One,One,One,One], Value: 52
+Key: [Zero,Zero,Zero,One], Value: 55
+Key: [One,Zero,Zero,Zero], Value: 58
+Key: [Zero,One,Zero,One], Value: 58
+Key: [Zero,Zero,One,One], Value: 63
+Key: [One,One,Zero,One], Value: 54
+
+

so basically a uniform distribution over the whole set of 16 configurations. I don't understand why the solution of the equations are not getting higher frequencies.

+",7318,,2879,,9/20/2020 2:28,9/20/2020 2:51,Grover algorithm in Q#,,1,0,,,,CC BY-SA 4.0 +13823,2,,13821,9/19/2020 14:10,,4,,"

By using similar ideas from this answer I have found this circuit:

+ +

Thought process:

+

The unitary is a permutation matrix that doesn't change bitstrings except $U |100\rangle \rightarrow |011\rangle$ and $U |011\rangle \rightarrow |100\rangle$ (identity action on the rest of the bitstrings). Here I am going to use Qiskit's indexing convention (qubit indexing in Qiskit $|q_2 q_1 q_0 \rangle$). Note that the Toffoli gate and $2$ CNOT's after it will do the job for $U |011\rangle \rightarrow |100\rangle$ and the same Tofalli with $2$ CNOTs before it will do the job for $U |100\rangle \rightarrow |011\rangle$. How I came to this solution? I tried to write down a circuit only for these two bitstring transformations not worrying about the rest, then I have tried to correct the rest transformations by adding additional gates. Although this sounds good, actually this strategy didn't work perfectly but gave me a draft circuit...then I just started to play with that circuit and obtained this solution.

+

Qiskit code for prove:

+
from qiskit import *
+import qiskit.quantum_info as qi
+
+circuit = QuantumCircuit(3)
+
+circuit.cx(2, 1)
+circuit.cx(2, 0)
+circuit.ccx(0, 1, 2)
+circuit.cx(2, 1)
+circuit.cx(2, 0)
+
+matrix = qi.Operator(circuit)
+print(matrix.data)
+
+

The output (the matrix that corresponds to the circuit):

+
[[1 0 0 0 0 0 0 0]
+ [0 1 0 0 0 0 0 0]
+ [0 0 1 0 0 0 0 0]
+ [0 0 0 0 1 0 0 0]
+ [0 0 0 1 0 0 0 0]
+ [0 0 0 0 0 1 0 0]
+ [0 0 0 0 0 0 1 0]
+ [0 0 0 0 0 0 0 1]]
+
+",9459,,9459,,9/21/2020 15:40,9/21/2020 15:40,,,,0,,,,CC BY-SA 4.0 +13824,2,,13651,9/19/2020 17:02,,1,,"

Please notice that the previous answer may unnecessarily remove gates. +It depends on the order you insert them in your circuit.

+

For example, constructing the circuit you provided with the following code

+
qc = QuantumCircuit(2)
+
+qc.sdg(0)
+qc.h(0)
+
+qc.y(1)
+qc.h(1)
+qc.s(1)
+
+qc.cx(0, 1)
+qc.cx(1, 0)
+
+qc.h(0)
+qc.s(0)
+qc.h(0)
+
+qc.h(1)
+qc.s(1)
+qc.h(1)
+
+print(qc)
+---
+     ┌─────┐┌───┐          ┌───┐┌───┐┌───┐┌───┐
+q_0: ┤ SDG ├┤ H ├───────■──┤ X ├┤ H ├┤ S ├┤ H ├
+     └┬───┬┘├───┤┌───┐┌─┴─┐└─┬─┘├───┤├───┤├───┤
+q_1: ─┤ Y ├─┤ H ├┤ S ├┤ X ├──■──┤ H ├┤ S ├┤ H ├
+      └───┘ └───┘└───┘└───┘     └───┘└───┘└───┘
+
+

and after removing the last 2 layers with your method we get

+
     ┌─────┐┌───┐          ┌───┐┌───┐
+q_0: ┤ SDG ├┤ H ├───────■──┤ X ├┤ H ├
+     └┬───┬┘├───┤┌───┐┌─┴─┐└─┬─┘└───┘
+q_1: ─┤ Y ├─┤ H ├┤ S ├┤ X ├──■───────
+      └───┘ └───┘└───┘└───┘          
+
+

Notice how the last 3 gates acting on qubit 1 disappear although we should keep one extra Hadamard.

+

For a more robust solution, we should work with a representation of the circuit that captures the topological dependencies present, i.e DAGCircuit.

+
from qiskit.converters import circuit_to_dag, dag_to_circuit
+
+dag = circuit_to_dag(qc)
+layers = list(dag.multigraph_layers())
+
+n_remove = 2
+
+# the extra minus 1 since the last layer consists of output nodes (qubits and clbits).
+for layer in layers[- n_remove - 1:]:
+
+    for node in layer:
+        if node.type == 'op':
+            dag.remove_op_node(node)
+                   
+new_qc = dag_to_circuit(dag)
+
+print(new_qc)
+---
+     ┌─────┐┌───┐          ┌───┐┌───┐
+q_0: ┤ SDG ├┤ H ├───────■──┤ X ├┤ H ├
+     └┬───┬┘├───┤┌───┐┌─┴─┐└─┬─┘├───┤
+q_1: ─┤ Y ├─┤ H ├┤ S ├┤ X ├──■──┤ H ├
+      └───┘ └───┘└───┘└───┘     └───┘
+
+",13109,,,,,9/19/2020 17:02,,,,0,,,,CC BY-SA 4.0 +13825,2,,9432,9/19/2020 17:48,,3,,"

For doing that in Qiskit, first create a multi qubit gate as a custom gate:

+
from qiskit import *
+x_circuit = QuantumCircuit(3, name='Xs')
+x_circuit.x(range(3))
+
+xs_gate = x_circuit.to_gate()
+
+

Then create a controlled version of that custom gate:

+
cxs_gate = xs_gate.control()
+
+

Finally, use that controlled custom gate in a circuit:

+
circuit = QuantumCircuit(8)
+circuit.append(cxs_gate, [0,2,6,4])
+print(circuit)
+
+
q_0: ───■───
+        │
+q_1: ───┼───
+     ┌──┴──┐
+q_2: ┤0    ├
+     │     │
+q_3: ┤     ├
+     │     │
+q_4: ┤2 Xs ├
+     │     │
+q_5: ┤     ├
+     │     │
+q_6: ┤1    ├
+     └─────┘
+q_7: ───────
+
+

You can decompose one level to see how it works internally:

+
print(circuit.decompose())
+
+
q_0: ──■────■────■──
+       │    │    │
+q_1: ──┼────┼────┼──
+     ┌─┴─┐  │    │
+q_2: ┤ X ├──┼────┼──
+     └───┘  │    │
+q_3: ───────┼────┼──
+            │  ┌─┴─┐
+q_4: ───────┼──┤ X ├
+            │  └───┘
+q_5: ───────┼───────
+          ┌─┴─┐
+q_6: ─────┤ X ├─────
+          └───┘
+q_7: ───────────────
+
+",1859,,,,,9/19/2020 17:48,,,,1,,,,CC BY-SA 4.0 +13826,2,,13821,9/19/2020 18:15,,2,,"

Qiskit supports gates defined by arbitrary unitary matrices and unitary synthesis.

+

First, define the matrix as a Numpy array, convert it into a gate and add it to a circuit:

+
import numpy as np
+from qiskit import QuantumCircuit
+from qiskit.extensions import UnitaryGate
+
+matrix = np.array([[1,0,0,0,0,0,0,0],
+                   [0,1,0,0,0,0,0,0],
+                   [0,0,1,0,0,0,0,0],
+                   [0,0,0,0,1,0,0,0],
+                   [0,0,0,1,0,0,0,0],
+                   [0,0,0,0,0,1,0,0],
+                   [0,0,0,0,0,0,1,0],
+                   [0,0,0,0,0,0,0,1]], dtype=np.complex)
+
+circuit = QuantumCircuit(3)
+circuit.append(UnitaryGate(matrix), [0,1,2])
+
+

Then, transpile it into your desired basis (the current synthesizer only supports 1q- and 2q-gates basis):

+
from qiskit import transpile
+
+new_circuit = transpile(circuit, basis_gates=['cx', 'u1', 'u2', 'u3'])
+new_circuit.draw('mpl')
+
+

+

You can check the equivalence with Operator

+
from qiskit.quantum_info import Operator
+Operator(new_circuit).equiv(circuit)
+
+
True
+
+",1859,,1859,,9/20/2020 13:10,9/20/2020 13:10,,,,0,,,,CC BY-SA 4.0 +13827,1,,,9/19/2020 19:10,,0,37,"

Where do I see the diffusion in the Grovers operator?

+

I would think there should be an analogy to classical diffusion but I am not able to see the correspondence.

+",13285,,55,,9/20/2020 22:08,9/20/2020 22:08,"Why does Grover's Diffusion Operator have the word ""diffusion"" in its name?",,0,2,,9/20/2020 9:24,,CC BY-SA 4.0 +13828,1,13831,,9/19/2020 20:51,,1,119,"

I fail to understand Deutsch-Jozsa algorithm. +As wikipedia suggests: ${\displaystyle f\colon \{0,1\}^{n}\rightarrow \{0,1\}}$. The function takes n-digit binary values as input and produces either a 0 or a 1 as output for each such value. We are promised that the function is either constant (0 on all outputs or 1 on all outputs) or balanced (returns 1 for half of the input domain and 0 for the other half). The task then is to determine if {\displaystyle f}f is constant or balanced by using the oracle.

+

Question 1: If I use probabilistic algorithm on a normal computer, can't I just input once a single 0 in the oracle, then input once a single 1. And I am done.

+

I also read here: http://www.diva-portal.org/smash/get/diva2:840938/FULLTEXT01.pdf: +Consider that Bob generates a list of arbitrary length from a balanced function. Then the list will contain equally many zeros and +ones, thus if Alice draws a random element in the list it will be a +zero or one with a probability of 1/2. If she draws two elements. then she can obtain the outcomes ”00”, ”01”, ”10” and ”11”, each with +an equal probability of 1/4. If Alice now has to guess whether the +function was constant or balanced, she will guess correctly half of +the times. If she instead draws a third element the outcome will +be a uniform probability distribution over the following possible outcomes ”000”, ”001”, ”010”, ”011”, ”100”, ”101”, ”110” and ”111”. Alice +will now guess correctly six out of eight times.

+

Qurstion 2: So if she has ”001” (or eve "01"/"10") isn't that already a balanced function?

+",13286,,55,,9/17/2021 7:06,9/17/2021 7:06,"If I use probabilistic algorithm on a normal computer, can't I just input once a single $0$ in the oracle, then input once a single $1$?",,2,1,,,,CC BY-SA 4.0 +13830,1,13867,,9/19/2020 21:42,,0,93,"

I have run a batch of a few thousand random 2-qubit QuantumCircuits on multiple different IBMQ Backends, and the execution times seem to significantly vary across the backends (obviously excluding time in queue). The general trend seems to be that increased:

+
    +
  1. Qubits or
  2. +
  3. Quantum Volume(QV)
  4. +
+

results in faster execution. As per my knowledge, this could be explained either by

+
    +
  1. increased parallel execution of the batch with more qubits or
  2. +
  3. systems with higher QV operate at proportionately higher clock speeds (I am more inclined to this explanation as the fastest job executed on ibmq_montreal despite having fewer qubits than ibmq_rochester)
  4. +
+

Are any of these explanations correct or is there an entirely different explanation for this observation?

+

I have used the following backends:

+
    +
  • ibmq_montreal - 27 qubits with QV 32
  • +
  • ibmq_vigo - 5 qubits with QV 16
  • +
  • ibmq_rochester - 53 qubits QV 8
  • +
+",12248,,55,,9/21/2020 14:18,9/21/2020 19:08,Why does job execution time vary significantly across different IBMQ Backends?,,1,0,,,,CC BY-SA 4.0 +13831,2,,13828,9/20/2020 1:42,,2,,"

Regarding your first question, there are $n$ inputs to $f$ and the task is to determine if $f$ is constant or balanced (under the promise that it is one or the other); you can do this on a quantum computer with a single query to $f$. If $n=1$, then classically you can do as you suggest, input $0$ for one query, and input $1$ for another query, for a total of two queries, but the quantum computer still wins with only one query.

+

Regarding your second question, yes you are correct; if you ever classically get two outputs that differ, then (under the promise) you can be sure that the function is balanced. However, Deutsch-Josza notes that you can guarantee it's balanced with only a single query.

+

Classically you need at least two, and up to $2^{n-1}+1$, queries, but quantum-mechanically a single query suffices.

+",2927,,,,,9/20/2020 1:42,,,,0,,,,CC BY-SA 4.0 +13832,2,,13822,9/20/2020 2:51,,2,,"

Short answer: for this problem the optimal number of iterations is 1 - change the loop range to do just one iteration and the output will switch to showing only the solutions to the problem:

+
Key: [Zero,Zero,One,One], Value: 255
+Key: [Zero,Zero,Zero,One], Value: 251
+Key: [Zero,One,One,One], Value: 233
+Key: [One,Zero,One,One], Value: 261
+
+
+

The general formula for the number of solutions is $\frac{\pi}{4}\sqrt{\frac{N}{M}}$, where $N = 16$ and $M = 4$, gives us $\frac{\pi}{2} \approx 1.5$, which can be rounded either up or down.

+

If we look at the derivation of the formula, however, we'll see that the square root is an approximation made assuming that $M << N$, and the optimal number of iterations is $>> 1$. The exact formula is $\frac12 \big( \frac{\pi}{2\arcsin \sqrt{\frac{M}{N}}}-1\big)$, which will give us $\arcsin \sqrt{\frac{M}{N}} = \arcsin 0.5 = \frac{\pi}{6}$ and the optimal number of iterations equal to 1.

+

You can see the visual derivation of the formula in this slide deck - it shows where these assumptions come from and how they affect the result.

+",2879,,,,,9/20/2020 2:51,,,,0,,,,CC BY-SA 4.0 +13833,1,,,9/20/2020 3:47,,4,56,"

The road towards quantum computers have so many obstacles, which are deeply different and more challenging than the problems that we had with the development of classical computers. There are reasons to believe that quantum computers with a "large enough" number of qubits and low decoherence to be actually useful.

+

Yet, there are so many investments and there's so much research around that to suggest that the whole community believes that it's certain that we will have quantum computers sooner or later.

+

Where does this belief come from? Are there factual, scientific arguments to support that?

+",13287,,55,,9/21/2020 14:25,9/21/2020 14:25,Why is there so much hope around quantum computers?,,0,3,0,9/29/2020 9:05,,CC BY-SA 4.0 +13834,1,,,9/20/2020 4:50,,0,204,"

How can I generate a random bit sequence of 512 bits on IBM Q experience using 3 or 5 qubits? Putting a hadammard gate and measuring would only give me smaller bit sequence due to limitation in number of qubits.

+

How to solve this problem?

+",13172,,9006,,9/20/2020 6:41,9/20/2020 13:21,Generate a random bit sequence of 512 bits,,2,1,,9/20/2020 22:36,,CC BY-SA 4.0 +13835,1,,,9/20/2020 8:31,,0,214,"

Now, I'm implementing Matrix product state method with QasmSimulation in Qiskit. +following code

+

+

+

The problem arise when I set number of qubits. When running it with 27qubits is very fast +but, for 24, 25, 26qubits it take too much time. Why it happens?

+",10028,,55,,9/20/2020 22:09,9/20/2020 22:09,Qiskit implementation for MPS,,1,4,,,,CC BY-SA 4.0 +13836,2,,13834,9/20/2020 8:48,,1,,"

Here is a code that will generate random bitstring. Althoug in the code, I have used qasm_simulator, it can be replaced with any available quantum hardware from IBM.

+
from qiskit import *
+
+
+def random_bitstring_generator(bit_number, backend):
+    """
+    Generate a bitstring with one qubit
+    :param bit_number: number of bits that we want to generate
+    :param backend: Qiskit hardware or simulator
+    :return: string object with random bits
+    """
+
+    bitstring = ""
+
+    one_qubit_random_bit_generator_circuit = QuantumCircuit(1, 1)
+    one_qubit_random_bit_generator_circuit.h(0)
+    one_qubit_random_bit_generator_circuit.measure(0, 0)
+
+    for _ in range(bit_number):
+        counts = execute(one_qubit_random_bit_generator_circuit, backend, shots=1).result().get_counts()
+        bit = list(counts.keys())[0]  # we have only one key because shots=1
+        bitstring += bit
+
+    return bitstring
+
+
+backend = BasicAer.get_backend('qasm_simulator')
+
+print(random_bitstring_generator(512, backend))
+
+

The output:

+
00000000000000000000000000000000000000000000000011111111111111111111111100000000111111111111111111111111000000000000000000000000000000001111111111111111000000000000000011111111000000000000000011111111111111111111111111111111111111111111111111111111111111111111111100000000000000001111111111111111111111111111111100000000111111110000000000000000000000000000000000000000111111110000000000000000000000001111111111111111000000001111111111111111000000001111111111111111111111111111111111111111000000001111111100000000
+
+

As one can see the generated bitstring doesn't look random. Maybe it is because of qasm_simulator. I think on real hardware this problem will not exist. Also the code uses only one qubit of the hardware that is not optimal if we have multiqubit hardware. We can use all available qubits in order to decrease the number of iterations in the for loop.

+",9459,,,,,9/20/2020 8:48,,,,1,,,,CC BY-SA 4.0 +13837,1,,,9/20/2020 9:53,,0,182,"

I'm running a search program with custom initial state. I wrote a program in Q# and one in Qiskit but I get different results even if the code seems to be peforming the same operations. The Q# result is correct according to my calculations while the Qiskit one is not. Can you tell what I'm doing wrong in Qiskit? +The Boolean function is (not reg[0] or reg[2]) and (not reg[1] or reg[2]) and (not reg[0] or not reg[1]) and reg[3] and I'm measuring only the first 3 bits (reg[0] to reg[2]). +Here is the Q# code https://gist.github.com/friguzzi/833ded93a640ed97a3b281c5542e90ea +and Qiskit python notebook https://gist.github.com/friguzzi/6293793de3d53914dac9e1cb768f9817 +The correct result should be 101 but the output of Qiskit over 1000 runs is

+
 {'000': 179,
+ '001': 135,
+ '010': 36,
+ '011': 41,
+ '100': 152,
+ '101': 167,
+ '110': 165,
+ '111': 125}
+
+",7318,,,,,9/20/2020 9:53,Different result between Q# and Qiskit,,0,6,,,,CC BY-SA 4.0 +13838,1,13845,,9/20/2020 11:50,,2,70,"

Quantum computers promise that they will simulate complex quantum systems, and I keep hearing that finding the ground state of that system (using for example Variational quantum eigensolver) is important to simulate it.

+

I don't know why is this true, could you please explain that, and perhaps give some examples?

+",8009,,55,,9/21/2020 14:27,9/21/2020 14:27,Why is the lowest energy important to simulate a quantum system?,,1,0,,,,CC BY-SA 4.0 +13839,2,,13834,9/20/2020 13:21,,1,,"

Qiskit 0.21 has qiskit-ibmq-provider 0.9. This new provider comes with a connector to the RNG service in IBMQ. From the release notes:

+
+

You can now access the IBMQ random number services, such as the CQC +randomness extractor, using the new package +qiskit.providers.ibmq.random. Note that this feature is still in beta, +and not all accounts have access to it. It is also subject to heavy +modification in both functionality and API without backward +compatibility.

+
+

You can find the documentation here and here.

+",1859,,,,,9/20/2020 13:21,,,,0,,,,CC BY-SA 4.0 +13840,2,,13828,9/20/2020 13:28,,1,,"

If you did not already, start by having a look to the Deutsch's algorithm, which is the single-qubit version of the Deutsch-Jozsa algorithm you are looking at.

+

Here you have some quick resources:

+ +

It is simpler than Deutsch-Jozsa and a good stepping stone.

+",1859,,,,,9/20/2020 13:28,,,,0,,,,CC BY-SA 4.0 +13842,1,,,9/20/2020 14:45,,2,129,"

When executing a batch of circuits using the IBMQJobManager and attempting to combine all the results of all jobs with combine_results I get the IBMQManagedResultDataNotAvailable exception as some of the jobs in the set have failed. Is it possible to re-execute only the failed jobs and then combine all the results?

+
job_set = IBMQJobManager().run(batch_of_circuits, backend=ibmq_foo)
+job_set_results = job_set.results() 
+job_set_counts = job_set_results.combine_results() # exception thrown on this line
+
+",12248,,55,,9/21/2020 14:29,10/11/2022 17:03,How to re-execute failed jobs in qiskit?,,1,0,,,,CC BY-SA 4.0 +13843,2,,13835,9/20/2020 14:57,,1,,"

This has to do with a parameter that switches between algorithms for measurement. Try changing your backend_opts as follows:

+
backend_opts = {'method':"matrix_product_state", 'mps_sample_measure_qubits_opt':20}
+
+

Perhaps we need to change the threshold in the code. I will check this.

+",13288,,,,,9/20/2020 14:57,,,,5,,,,CC BY-SA 4.0 +13844,1,13847,,9/20/2020 17:28,,4,151,"

Consider a generic bipartite pure state $\newcommand{\ket}[1]{\lvert #1\rangle}\ket\Psi\equiv \sum_k \sqrt{p_k}\ket{u_k}\otimes\ket{v_k}\in\mathcal X\otimes\mathcal Y$, +where $p_k\ge0$ are the Schmidt coefficients, and $\{\ket{u_k}\}_k\subset\mathcal X,\{\ket{v_k}\}_k\subset\mathcal Y$ are orthonormal sets of states.

+

We known that, for any pair of unitary operations $U,V$, the state $(U\otimes V)\ket{\Psi}$ has the same amount of entanglement as $\ket\Psi$, as reflected by the invariance of the Schmidt coefficients under such operation.

+

Consider now a local projection operation. More precisely, suppose $\mathcal X$ also has a bipartite structure, $\mathcal X=\mathcal X_1\otimes\mathcal X_2$, take some state $\ket\gamma\in\mathcal X_1$, and consider the postselected state $\ket{\Psi'}\equiv \langle \gamma\rvert\Psi\rangle/\|\langle \gamma\rvert\Psi\rangle\|\in\mathcal X_2\otimes\mathcal Y$. +If I were to describe this as an operation, I guess this would amount to applying some non-unitary linear operator $A$ to $\ket\Psi$.

+

Can the amount of entanglement of $\ket{\Psi'}$ in the "residual bipartition" $\mathcal X_1\otimes\mathcal Y$ be larger than the initial entanglement in $\ket\Psi$? +If so, is there some kind of known characterisation of when this is possible?

+

Intuitively, this would mean that an initially low amount of entanglement can be "enhanced", or somehow "activated", conditionally to some observation (i.e. finding $\ket\gamma$) of one party. Such a situation seems strange to me but I'm not sure how to rule out the possibility.

+",55,,55,,9/23/2020 12:23,9/23/2020 12:23,Can local projections increase entanglement?,,1,1,,,,CC BY-SA 4.0 +13845,2,,13838,9/20/2020 17:56,,2,,"

Variational Quantum Eigensolver is an algorithm that allow you to find the lowest eigenvalue of an Hermitian matrix, whatever it might be. This Hermitian matrix in the case of quantum chemistry is the Hamiltonian of a molecular system. In fact, it is the electronic Hamiltonian since quantum chemists usually make an approximation known as the Born-Oppenheimer approximation.

+

A fundamental goal and equation of quantum chemistry is the time-independent, non-relativistic Schrodinger equation: +$$ H|\psi\rangle = E|\psi\rangle $$ +where $H$ is the molecular Hamiltonian as mentioned above. This is an eigenvalue problem. It has been a great challenge for many years, mainly because of the exponential growth of the problem dimension, exponential growth of the size of the wave function with the particle number. Therefore, for most of the time, quantum chemist have to perform some sort of approximation, like Mean-field theory. But this leads to inaccurate solution. Able to calculate ground state energy at various geometry configuration of the molecular system allow you to build a Potential Energy Surface if you will. This allows you to predict many interesting chemical properties. Also ground state are natural state of a system, so a system will naturally settle in its ground state if it is not being perturb.

+",9858,,,,,9/20/2020 17:56,,,,1,,,,CC BY-SA 4.0 +13846,1,,,9/20/2020 19:09,,1,169,"

I want to give a list of Quantum gates in a .txt file from user an apply them to a Quantum circuit but the gates in notepad .txt file have 'string' type while in Qiskit I need functions/methods. For example: +In .txt file: +'h(0)' +In Qiskit: +qc=QuantumCircuit(2) +qc.h(0) +Which is a method. +What can I do?

+",10371,,55,,9/21/2020 17:45,10/21/2020 18:01,Converting 'string' to a function/gate in QisKit,,1,0,,,,CC BY-SA 4.0 +13847,2,,13844,9/20/2020 20:02,,3,,"

Of course this is possible. By LOCC you can probabilistically convert any (pure) state to a maximally entangled state with the same Schmidt rank, using a "filtering" POVM.

+

When this can be done, and at which optimal rate, is covered by the theory of majorization. This is covered very well in e.g. Nielsen and Chuang, or there is a review by Nielsen and Vidal.

+

(I realize you don't talk about POVMs but projections, but Stinespring/Naimark tells us that this is equivalent.)

+",491,,,,,9/20/2020 20:02,,,,2,,,,CC BY-SA 4.0 +13848,2,,8504,9/20/2020 20:24,,4,,"

Computing the exchange-correlation functional to sufficiently high accuracy is QMA-hard, where QMA is the quantum version of NP. In particular, this means that in all likelihood, it will be hard even for a quantum computer.

+",491,,491,,12/23/2022 8:54,12/23/2022 8:54,,,,2,,,,CC BY-SA 4.0 +13849,1,13854,,9/21/2020 2:35,,1,83,"

I am aware of a SDP formulation for smooth min-entropy: question link. That program for smooth min-entropy was found in this book by Tomachiel: page 91. However, I am yet to come across a semi-definite formulation for smooth max-entropy. There is however, a formulation for the non-smoothed version of max-entropy, found in this link: page 4, lemma 8. Here is the detailed program for a bipartite density operator $\rho_{AB}$, $2^{H_{\text{max}}(A|B)_\rho}$ =
+$$ +\text{minimize }\lambda \\ +\text{subject to} \\ +Z_{AB} \otimes \mathbb{I} \ge \rho_{ABC} \\ +\lambda \mathbb{I}_B \ge \text{tr}_A [Z_{AB}] \\ +Z_{AB} \ge 0 \\ +\lambda \ge 0 +$$

+

Where $Z_{AB}$ runs over all positive semi-definite operators in $\mathcal{H}_{AB}$, $\lambda$ is a real number. The smooth max-entropy is then: +$$ +H^{\epsilon}_{\text{max}}(A|B)ρ := \underset{\rho'_{AB} \in \mathcal{B}^\epsilon (\rho_{AB})}{\min}H_{\text{max}}(A|B)_{\rho'} +$$ +i.e., just the minimum over all bipartite operators which are at most $\epsilon$ distance away from $\rho_{AB}$. But the primal or dual SDP formulation for the smooth version of max-entropy was not found anywhere. Is there one? How could I transform it into a smooth version? TIA.

+",2403,,55,,9/23/2020 9:29,9/23/2020 9:29,Semi-definite program for conditional smooth max-entropy,,1,0,,,,CC BY-SA 4.0 +13851,1,13868,,9/21/2020 7:12,,5,1007,"

Lets have two quantum states (single qubits ones for simplicity) $|\psi\rangle$ and $|\phi\rangle$:

+

$$ +|\psi\rangle = \alpha_\psi|0\rangle+\mathrm{e^{i\varphi_\psi}}\beta_\psi|1\rangle +$$

+

$$ +|\phi\rangle = \alpha_\phi|0\rangle+\mathrm{e^{i\varphi_\phi}}\beta_\phi|1\rangle +$$

+

These states are equal in case

+

$$ +\alpha_\psi = \alpha_\phi +$$ +$$ +\beta_\psi = \beta_\phi +$$ +$$ +\varphi_\psi = \varphi_\phi, +$$ +i.e. they have same complex amplitudes or same amplitudes expressed by real parameters $\alpha$ and $\beta$ and same phase $\varphi$.

+

One way how to compare two state is to do a quantum tomography, however, to do so we would need many copies of the states and moreover, the quantum tomography complexity is exponential in number of qubits in case of multiqubit states.

+

So my question: Is there a circuit allowing to compare two quantum states? A result should be some ancilla qubit in state $|0\rangle$ if states are different and $|1\rangle$ if states are the same (in sense described above).

+",9006,,55,,9/21/2020 17:46,9/21/2020 22:22,Is there a circuit to compare two quantum states?,,2,2,,,,CC BY-SA 4.0 +13852,2,,13851,9/21/2020 8:15,,4,,"

The technical term is "quantum state discrimination". One has to carefully formulate the problem, because it is generally hard to identify an arbitrary state (tomography) as you noticed.

+

However, given the promise that two states are prepared at random, there's an upper bound on the probability of correctly identifying the state via a single measurement (Holevo-Helstrom theorem): +$$ + \mathrm{Pr}_\mathrm{success} \leq \frac 1 2 \left( 1 + \big\| \lambda \rho_0 - (1-\lambda) \rho_1 \big\|_1 \right) +$$ +Here, $\rho_0$, $\rho_1$ are the states which are prepared with (known) propability $\lambda$ and $(1-\lambda)$. Moreover, this bound is tight, i.e. there is always a projective measurement achieving that bound which can be computed from the states. Note that perfect discrimination can only be achieved for orthogonal pure states. Then, the optimal strategy would be to measure that basis.

+

The answer is: There is no circuit, but a protocol which discriminates correctly between two known states with optimal probability. This is the best you can get since the states could be arbitrarily close.

+

There's e.g. a chapter on this in John Watrous' lecture notes / his book and there is a review by Joonwoo Bae and Leong-Chuan Kwek: https://arxiv.org/abs/1707.02571

+

Edit: Ok, I might have misunderstood the question. If you have access to two pure states at once, you can do the SWAP test.

+",2305,,2305,,9/21/2020 8:36,9/21/2020 8:36,,,,0,,,,CC BY-SA 4.0 +13853,1,,,9/21/2020 8:34,,0,211,"

When I run IBMQ.load_account(). I have the error information:

+
C:\application\python\anaconda\lib\site-packages\qiskit\providers\ibmq\ibmqfactory.py:192: UserWarning: Timestamps in IBMQ backend properties, jobs, and job results are all now in local time instead of UTC.
+
+
warnings.warn('Timestamps in IBMQ backend properties, jobs, and job results '
+ibmqfactory._initialize_providers:WARNING:2020-09-21 15:33:39,682: Unable to instantiate provider for {'hub': 'ibm-q-research', 'group': 'Cheng-Guo', 'project': 'main'}: string indices must be integers.
+
+

I want to ask about the second warning: Unable to instantiate provider for {'hub': 'ibm-q-research', 'group': 'Cheng-Guo', 'project': 'main'}: string indices must be integers.

+

My account have two provider: +(hub='ibm-q', group='open', project='main') +{hub: 'ibm-q-research', group: 'Cheng-Guo', project: 'main'}

+

I can only use the first provider locally. Because of these two questions: "https://quantumcomputing.stackexchange.com/questions/12183/ibmqfactory-initialize-providers-error" and "https://quantumcomputing.stackexchange.com/questions/13350/qiskit-ibmq-load-account-fails-on-version-0-20-0".

+

I have tried to delete my account then save it. But it didn't work. +I have tried to use qiskit 0.21.0, the newest version in Github. But it didn't work. +I have tried to use qiskit 0.20.1, the version in Quantum Lab(https://quantum-computing.ibm.com/jupyter). But it didn't work.

+

The same version of qiskit (0.20.1) cannot be used locally but can be used in the quantum lab, so I can only use the quantum lab to program now. But quantum lab requires a network connection, which is not very convenient.

+

I have tried to change a PC and install qiskit(version 0.21.0 in default), it didn't work.

+

I have read the source code and I still can't understand why only the research provider doesn't work, and only don't work locally.

+

Thank you very much if you can help me.

+",8901,,13968,,7/27/2021 14:00,12/19/2022 15:05,Unable to instantiate provider for research account locally,,1,6,,,,CC BY-SA 4.0 +13854,2,,13849,9/21/2020 9:05,,4,,"

Yes, you can formulate the smooth max-entropy as an SDP. The author of the book you linked notes this when they explain how to derive the SDP for the smooth min-entropy that you reference on page 91.

+

In particular they say that the smoothing constraint $\tilde{\rho}_{AB} \in B^\epsilon(\rho_{AB})$ can be reformulated as the triple of constraints +$$ +\mathrm{Tr}[\tilde\rho_{ABC} \rho_{ABC}] \geq 1- \epsilon^2~\\ +\mathrm{Tr}[\tilde\rho_{ABC}] \leq 1 ~\\ +\tilde \rho_{ABC} \geq 0 +$$ +where $\rho_{ABC}$ is any purification of $\rho_{AB}$.

+

Now we can incorporate these extra constraints with the SDP formulation of $H_{\max}(A|B)$. In particular +$$ +\begin{aligned} +2^{H^\epsilon_{\max}(A|B)_\rho} &= \min_{\tilde{\rho}_{AB} \in B^\epsilon(\rho_{AB})} 2^{H_{\max}(A|B)_{\tilde\rho}} \\ +&= \min_{\tilde{\rho}_{AB} \in B^\epsilon(\rho_{AB})}\min \lambda \\ +&\qquad\mathrm{s.t.} \quad Z_{AB} \otimes I_C \geq \tilde\rho_{ABC} \\ +&\qquad \qquad \lambda I_B \geq \mathrm{Tr}_A[Z_{AB}] \\ +&\qquad\qquad Z_{AB} \geq 0, \quad \lambda \geq 0 \\ +&= \,\,\,\min \quad\lambda \\ +&\qquad\mathrm{s.t.} \quad Z_{AB} \otimes I_C \geq \tilde\rho_{ABC} \\ +&\qquad \qquad \lambda I_B \geq \mathrm{Tr}_A[Z_{AB}] \\ +&\qquad \qquad \mathrm{Tr}[\tilde\rho_{ABC} \rho_{ABC}] \geq 1- \epsilon^2~\\ +&\qquad \qquad \mathrm{Tr}[\tilde\rho_{ABC}] \leq 1 ~\\ +&\qquad\qquad \rho_{ABC} \geq 0, \quad Z_{AB} \geq 0, \quad \lambda \geq 0 \\ +\end{aligned} +$$

+",9854,,,,,9/21/2020 9:05,,,,1,,,,CC BY-SA 4.0 +13855,2,,13846,9/21/2020 12:08,,1,,"

You could try mapping the string input to the function using a dictionary somewhat like what is given here.

+

So considering that your text file has : h(0) as text, you could declare a dictionary in python as : my_functions = {"h(0)":qc.h(0)} to map string input to function

+

And in the python script, suppose variable x stores the text h[0] which is retrieved from the text file, to apply the h gate on the quantum circuit, you will just need to do:

+
my_functions[x]
+
+

In a nutshell, the code should be:

+
qc = QuantumCircuit(2, 2) # makes a quantum circuit with 2 qubits
+my_functions = {"h(0)":qc.h(0)} # maps the string input to function call
+x = "h(0)"
+my_functions[x]  ## this will implement h gate on the first qubit
+
+",11868,,,,,9/21/2020 12:08,,,,0,,,,CC BY-SA 4.0 +13857,2,,13842,9/21/2020 12:32,,0,,"

IBMQJobManager finds the jobs in a set by their tags and names. So yes, if you re-submit the same job with the same tags/job name, it'll be picked up by the job manager. Something like

+
failed_job = backend.retrieve_job(FAILED_JOB_ID)
+qobj = failed_job.qobj()
+backend.run(qobj, job_name=failed_job.name(), job_tags=failed_job.tags())
+jm = IBMQJobManager()
+job_set = jm.retrieve_job_set(JOB_SET_ID, provider)
+
+

There's also an issue open on automatically retrying job submit if it fails.

+",12195,,,,,9/21/2020 12:32,,,,0,,,,CC BY-SA 4.0 +13858,2,,13820,9/21/2020 12:34,,2,,"

There isn't any specific method to optimise HHL other than using the PassManager from Qiskit, but this is a more general circuit optimisation. +With the newest devices it might be possible to run larger circuits due to the reduced error, otherwise you will have to manually find circuit reductions.

+

In the last page of https://arxiv.org/abs/2009.04484 you can find the circuits for the example mentioned in the textbook and for the case of a $4\times 4$ matrix, maybe this helps to run your circuit.

+",4223,,,,,9/21/2020 12:34,,,,3,,,,CC BY-SA 4.0 +13859,1,13873,,9/21/2020 13:18,,1,190,"

I have been looking into the great! video lecture of "CSHS Inequality" by Prof. Umesh V. Vazirani. +There are a few things I have to clarify, hope someone will answer me.

+

Suppose Alice and Bob have measured some outcomes in their bases. I am not quite clear how this is linked to the statement $xy = a + b \pmod 2$. How are the outputs $a$ and $b$ of Alice and Bobs related to the basis of measurement output?

+",13294,,23,,9/25/2020 21:53,9/25/2020 21:53,Where does $xy = a + b \pmod 2$ come from in the context of CHSH inequalities?,,1,1,,,,CC BY-SA 4.0 +13860,1,13870,,9/21/2020 14:46,,2,124,"

I am reading through the Phase Kickback chapter of the IBM online textbook about quantum computation. It is stated that, when applying any controlled Z-rotation, the concept of test and control qubit is lost. To show this phenomenon, the effect of a Controlled-T gate (Z-rotation of $\pi/4$) on the state $|1+ \rangle$ is demonstrated mathematically. The formal control qubit would be $|+\rangle$ while the target qubit would be $|1\rangle$. As I show in the image, the "target" qubit stays unchanged, while the "control" qubit has got rotated (it has now a relative phase).

+

I then wanted to prove myself that the same result would be delivered when applying the Controlled-T gate on the state $|+1 \rangle$, which physically would mean to swap the two qubits with respect to the former situation. I would then expect the same result as above, but with the two qubits "flipped" on opposite sides of the tensor product. In this case, however, I get a different result (a global phase). I think that I cannot commutate the tensor product, because this would mean physically swapping the two qubits, right? Can somebody explain to me the conceptual mistake that I am doing?

+

+",13295,,9459,,9/22/2020 8:45,9/22/2020 15:47,Phase Kickback and Controlled Rotation - Problem in proving symmetry,,1,4,,,,CC BY-SA 4.0 +13861,1,,,9/21/2020 15:19,,5,260,"

I recently encountered the statement that

+
+

any CSS code [that encodes single-qubit logical states] has a property that measurements can be performed qubit-wise, but the measurement outcome of every qubit must be communicated classically to obtain the result of the logical measurement.

+
+

Can someone point me to some references about why that is and what kind of classical communication is used?

+",11977,,10480,,12/31/2020 8:33,5/30/2021 10:02,(Why) does every CSS code allow for transversal measurement?,,1,6,,,,CC BY-SA 4.0 +13862,1,,,9/21/2020 15:20,,0,347,"

I'm trying to implement a vqe in cirq and I have sort of a brain knot.

+

I have a 4 qubit chain with periodic boundary condition. +So in fact a 2x2 qubit grid.

+

Now 2 of them each are coupled.

+

How do I get the correct measurements for the expectation value?

+",13297,,55,,9/21/2020 17:47,9/21/2020 18:46,XX and YY and ZZ Hamiltonians in vqe,,1,11,0,,,CC BY-SA 4.0 +13864,1,13865,,9/21/2020 18:11,,1,552,"

How can the CNOT gate error between 2 qubits as shown on visual qubit coupling map on the IBMQ Dashboard be retrieved in Qiskit using the BackendProperties.gate_error method ?

+

I have been able to retrieve the U2 error rates as follows:

+
properties = backend.properties()
+properties.gate_error('u2', 0) # u2 error rate for qubit-0
+
+",12248,,55,,9/22/2020 18:09,4/24/2021 0:32,How to get the CNOT error rate between 2 qubits on a given IBMQ Backend?,,2,0,,,,CC BY-SA 4.0 +13865,2,,13864,9/21/2020 18:40,,2,,"

You can type the following:

+
provider = IBMQ.get_provider(hub='YOUR-HUB-NAME', group='YOUR-GROUP-NAME', project='YOUR-PROJECT_NAME')
+provider.backends.backend
+
+

You should see an interactive widget with 5 tabs. Under the Multi-Qubit Gates tab, you can see the CNOT error rate between any two connected qubits on that given backend.

+

If you don't see the widget, import qiskit.tools.jupyter and then try to run the commands again.

+",13117,,,,,9/21/2020 18:40,,,,0,,,,CC BY-SA 4.0 +13866,2,,13862,9/21/2020 18:46,,2,,"

There is a type cirq.PauliSum created when you add together products of Pauli operations. This type has a method expectation_from_state_vector and expectation_from_density_matrix. This is the easiest way to get the expectation values, if you're just calculating them instead of estimating them from samples taken from hardware.

+

Note that both methods require you to specify an index for each qubit. This is because the state vector is just a numpy array, with no information about which axes (or which bits of the index) correspond to which qubits..

+
import cirq
+
+qubits = cirq.LineQubit.range(4)
+pauli = cirq.Z
+
+operator: cirq.PauliSum = sum(pauli(qubits[k - 1]) * pauli(qubits[k]) for k in range(4))
+print("operator", operator)
+# operator 1.000*Z(0)*Z(3)+1.000*Z(0)*Z(1)+1.000*Z(1)*Z(2)+1.000*Z(2)*Z(3)
+
+a, b, c, d = qubits
+circuit = cirq.Circuit(
+    cirq.H(a),
+    cirq.CNOT(a, b),
+    cirq.CNOT(a, c),
+    cirq.CNOT(a, d),
+)
+final_state = cirq.final_state_vector(circuit, qubit_order=qubits)
+
+expectation = operator.expectation_from_state_vector(
+    final_state,
+    qubit_map={q: q.x for q in qubits})
+print("z_expectation", expectation)
+# z_expectation (3.999999761581421+0j)
+
+

If you instead want to estimate the operators based on samples, the process is more manual. For example, you could make three separate variations of the circuit. One where you measure all the qubits in the X basis, one where you measure all the qubits in the Y basis, and one where you measure all the qubits in the Z basis. You can then multiply (or xor) the individual measurement results together to get the paired measurement results and compute the average.

+
sampler = cirq.Simulator()  # or a hardware sampler
+
+circuit_x = circuit + [[cirq.H(q), cirq.measure(q)] for q in qubits]
+circuit_y = circuit + [[cirq.X(q)**0.5, cirq.measure(q)] for q in qubits]
+circuit_z = circuit + [cirq.measure(q) for q in qubits]
+
+import numpy as np
+import pandas as pd
+x_samples: pd.DataFrame = sampler.sample(circuit_x, repetitions=1000)
+x_cols = [x_samples[str(q)] for q in qubits]
+x_parity_bits = np.array([x_cols[k-1] ^ x_cols[k] for k in range(4)], dtype=np.int8)
+x_parity_signs = 1 - 2 * x_parity_bits
+x_expectation = np.mean(x_parity_signs)
+print("x_expectation", x_expectation)
+# x_expectation -0.011
+
+",119,,,,,9/21/2020 18:46,,,,5,,,,CC BY-SA 4.0 +13867,2,,13830,9/21/2020 19:08,,0,,"

With a higher Quantum Volume, your circuits will run faster, partly because a backend with a higher quantum volume can run complex circuits with a greater width and depth than backends with lower quantum volume. However, the number of qubits on a backend does not affect the speed of a circuit, because each logical qubit in your circuit is mapped to one physical qubit on the backend, so having more physical qubits than needed does not affect your running time, since they are not involved in the circuit. There are a lot of factors that go into determining the quantum volume of a backend, so if you are interested I would read more about it at the following links: https://qiskit.org/textbook/ch-quantum-hardware/measuring-quantum-volume.html and https://qiskit.org/documentation/tutorials/noise/5_quantum_volume.html

+",13117,,,,,9/21/2020 19:08,,,,0,,,,CC BY-SA 4.0 +13868,2,,13851,9/21/2020 22:05,,7,,"

The task that you describe in your question — a circuit which flips a single qubit, if and only if the two input states are different — is not possible. We can show this as follows.

+

First, there is no way to distinguish two states which differ only by a global phase, because no quantum operations can distinguish between two state-vectors which only differ in a global phase. (In fact, for two such states as input, there is no real way to describe which of the two states has that phase: the global phase applies to the total state, including all tensor factors.)

+

Setting that aside, however, there is a more significant obstacle: the linearity of quantum mechanics.

+

Suppose that you had a unitary circuit $U$, which performed the following transformation for inputs $\lvert x \rangle$ and $\lvert y \rangle$ in the states $\lvert 0 \rangle$ and $\lvert 1 \rangle$:

+

$$\begin{align} + \lvert 0 \rangle \;\lvert x \rangle\; \lvert y \rangle\; \lvert \text{work space} \rangle +\;\mapsto\; + \lvert \delta_{x,y} \rangle \;\lvert \psi_{x,y} \rangle, +\end{align}$$ +where $\delta_{x,y}$ is the Kronecker delta, "$\text{work space}$" is some fixed initial state of auxiliary qubits provided as work space, and $\lvert \psi_{x,y} \rangle$ is some (possibly complicated) quantum state that depends on $x$ and $y$. +We take the first qubit to be the answer qubit. +Note that the states $\lvert \psi_{x,y} \rangle$ will be orthogonal to one another for different values of $x$ and $y$. Then, what happens if we introduce a state which is not in the standard basis? +$$ \lvert 0 \rangle \; \lvert 1 \rangle \; \lvert + \rangle \; \lvert \text{work space} \rangle \mapsto +\tfrac{1}{\sqrt 2} \Bigl( + \lvert 0 \rangle \; \lvert \psi_{1,0} \rangle \;+\; \lvert 1 \rangle \; \lvert \psi_{1,1} \rangle +\Bigr) $$ +so that the answer qubit is entangled (and in fact maximally entangled) with the rest of the qubits. In particular, it does not give you $\lvert 0 \rangle$, which is what you wanted for your procedure.

+

As @MicheleAmoretti and @MarkusHeinrich indicate, the best that you can do is to use the controlled-SWAP test, which will succeed with probability 1/2 if the two input states are orthogonal, and which will have a worse and worse success probability (as a means of distinguishing distinct states) for distinct states which have larger and larger fidelities.

+",124,,124,,9/21/2020 22:22,9/21/2020 22:22,,,,0,,,,CC BY-SA 4.0 +13869,2,,13864,9/22/2020 1:11,,0,,"

Try this:

+
provider = IBMQ.get_provider(hub='YOUR-HUB-NAME', group='YOUR-GROUP-NAME', project='YOUR-PROJECT_NAME')
+backend = provider.get_backend('ibmq_**your_device**') 
+for gate_i in backend.properties().gates:
+    print("{} gate on qubits {} error rate is {}{}".format(gate_i.name, gate_i.qubits, gate_i.parameters[0].value, gate_i.parameters[0].unit))
+
+

It should print out the list that you got from the Widget.

+

For instance, if you chose ibmq_quito then you have something like:

+
id0 gate on qubits [0] error rate is 0.00028412406225121944
+id1 gate on qubits [1] error rate is 0.0005023912176917563
+id2 gate on qubits [2] error rate is 0.000588676520188442
+id3 gate on qubits [3] error rate is 0.000441966521247226
+id4 gate on qubits [4] error rate is 0.0015240218468028444
+rz0 gate on qubits [0] error rate is 0
+rz1 gate on qubits [1] error rate is 0
+rz2 gate on qubits [2] error rate is 0
+rz3 gate on qubits [3] error rate is 0
+rz4 gate on qubits [4] error rate is 0
+sx0 gate on qubits [0] error rate is 0.00028412406225121944
+sx1 gate on qubits [1] error rate is 0.0005023912176917563
+sx2 gate on qubits [2] error rate is 0.000588676520188442
+sx3 gate on qubits [3] error rate is 0.000441966521247226
+sx4 gate on qubits [4] error rate is 0.0015240218468028444
+x0 gate on qubits [0] error rate is 0.00028412406225121944
+x1 gate on qubits [1] error rate is 0.0005023912176917563
+x2 gate on qubits [2] error rate is 0.000588676520188442
+x3 gate on qubits [3] error rate is 0.000441966521247226
+x4 gate on qubits [4] error rate is 0.0015240218468028444
+cx3_4 gate on qubits [3, 4] error rate is 0.02203610851266083
+cx4_3 gate on qubits [4, 3] error rate is 0.02203610851266083
+cx1_3 gate on qubits [1, 3] error rate is 0.009826995281347145
+cx3_1 gate on qubits [3, 1] error rate is 0.009826995281347145
+cx1_2 gate on qubits [1, 2] error rate is 0.01104062453060986
+cx2_1 gate on qubits [2, 1] error rate is 0.01104062453060986
+cx0_1 gate on qubits [0, 1] error rate is 0.009345544597316624
+cx1_0 gate on qubits [1, 0] error rate is 0.009345544597316624
+reset0 gate on qubits [0] error rate is 5920ns
+reset1 gate on qubits [1] error rate is 5920ns
+reset2 gate on qubits [2] error rate is 5920ns
+reset3 gate on qubits [3] error rate is 5920ns
+reset4 gate on qubits [4] error rate is 5920ns
+
+",9858,,9858,,4/24/2021 0:32,4/24/2021 0:32,,,,0,,,,CC BY-SA 4.0 +13870,2,,13860,9/22/2020 6:01,,0,,"

When we apply a phase gate, a relative phase is added (this is the definition that I will use in this answer for the phase gate). In the Qiskit's textbook (and in the textbook by M. Nielsen and I. Chuang) $T$ is defined as a phase gate $P(\frac{\pi}{4})$:

+

$$ +P |\psi \rangle = P (\alpha |0\rangle + \beta |1\rangle) = \alpha |0\rangle + e^{i\varphi}\beta |1\rangle \\ +P(\varphi) = +\begin{pmatrix} +1&0 \\ +0&e^{i \phi} +\end{pmatrix} +\qquad +T = P(\frac{\pi}{4}) = +\begin{pmatrix} +1&0 \\ +0&e^{i \frac{\pi}{4}} +\end{pmatrix} +$$

+

where $P$ is the phase gate, $\alpha$ and $\beta$ are some initial amplitudes, $\varphi$ is the phase defined by the $P$ gate. Note that only $|1\rangle$ in the superposition state has obtained the phase. The same works for the controlled phase gate: only $|11\rangle$ obtains a phase because the control qubit should be $|1\rangle$ and the target qubit also should be $|1\rangle$:

+

$$CP_{2 \rightarrow 1} |+1 \rangle = CP_{2 \rightarrow 1} \frac{1}{\sqrt{2}} (|01\rangle + |11\rangle) = \\ += \frac{1}{\sqrt{2}} (|01\rangle + e^{i \varphi}|11\rangle) = \frac{1}{\sqrt{2}} (|0\rangle + e^{i \varphi}|1\rangle) \otimes |1\rangle$$

+

where $CP$ is the controlled phase gate, $2 \rightarrow 1$ subscript denotes that the $CP$ gate is controlled by the second qubit. More general proof for $CP_{1 \rightarrow 2} = CP_{2 \rightarrow 1}$ can be derived by using matrix representation of the $CP$ gate. This proof is similar to the proof for $CZ_{1 \rightarrow 2} = CZ_{2 \rightarrow 1}$ that can be found in this answer.

+

$$CP_{1 \rightarrow 2} = |0\rangle \langle 0| +\otimes I + |1\rangle \langle 1| \otimes P = \\ += +\begin{pmatrix} +1&0&0&0 \\ +0&1&0&0 \\ +0&0&1&0 \\ +0&0&0&e^{i \varphi} \\ +\end{pmatrix} = \\ +=I \otimes |0\rangle \langle 0| + + P \otimes |1\rangle \langle 1| = CP_{2 \rightarrow 1}$$

+
+

Side note about why the "symmetry" is not true for controlled $R_z$ gate in contrast to controlled $P$ gate:

+

If for the general case instead of $P(\varphi)$ we will use $R_z(\varphi)$ gate then we will have a different result:

+

$$CRZ_{1 \rightarrow 2} = |0\rangle \langle 0| +\otimes I + |1\rangle \langle 1| \otimes R_z += +\begin{pmatrix} +1&0&0&0 \\ +0&1&0&0 \\ +0&0&e^{-i \frac{\varphi}{2}}&0 \\ +0&0&0&e^{i \frac{\varphi}{2}} \\ +\end{pmatrix}\\ +CRZ_{2 \rightarrow 1} = I \otimes |0\rangle \langle 0| + R_z \otimes |1\rangle \langle 1| = +\begin{pmatrix} +1&0&0&0 \\ +0&e^{-i \frac{\varphi}{2}}&0&0 \\ +0&0&1&0 \\ +0&0&0&e^{i \frac{\varphi}{2}} \\ +\end{pmatrix}$$

+

where $R_z(\varphi) = \begin{pmatrix} +e^{-i \frac{\varphi}{2}}&0 \\ +0&e^{i \frac{\varphi}{2}} +\end{pmatrix}$. So $CRZ_{1 \rightarrow 2} \ne CRZ_{2 \rightarrow 1}$. +This answer also might be relevant where the difference between the controlled versions of $R_z$ and $U1 = P$ is discussed.

+",9459,,9459,,9/22/2020 15:47,9/22/2020 15:47,,,,0,,,,CC BY-SA 4.0 +13872,1,,,9/22/2020 8:13,,5,286,"

Let's say I am given a permutation $\sigma$ that maps $n$ bit strings to $n$ bit strings. I want to output $1$ if $\sigma^{-1}(000\cdots1)$ is even and $0$ if $\sigma^{-1}(000\cdots1)$ is odd. It can be proven that this problem requires an exponential number of queries, given access to just $\sigma$ and $000\cdots1$ (but, crucially, not $\sigma^{-1}$ or any oracle that calculates the parity of $\sigma^{-1}$). There are many ways to prove this lower bound, like using the hybrid argument, or the adversary method, or showing this problem is equivalent to Grover's search. I am specifically looking for a hybrid argument.

+

I found one here (Theorem $3.6$), but it deals with random permutation oracles instead of a fixed oracle. I don't think that condition should be necessary. Also, the proof seems very complicated. Can someone provide a simplified treatment?

+",1351,,1351,,9/25/2020 18:40,9/25/2020 20:09,Proof using hybrid method that inverting a permutation requires exponential queries for BQP machines,,1,5,,,,CC BY-SA 4.0 +13873,2,,13859,9/22/2020 8:46,,2,,"

Alice has a choice of two bases in which to measure, we call her choice $x$. Bob also has a choice of two bases in which to measure, we call his choice $y$. When they measure we call Alice's measurement outcome $a$ and Bob's measurement outcome $b$. All $a,b,x,y \in \{0,1\}$.

+

Then Alice and Bob win if $xy = a + b \mod 2$. For example if Alice chooses to measure in her basis $x=0$ and Bob chooses to measure in his basis $y=1$ then they will win if their outcomes are the same, i.e. if $a=b=0$ or $a=b=1$. Conversely, they will lose if $a\neq b \mod 2$.

+

Note that the CHSH game is defined irrespective of quantum theory -- Alice and Bob can just choose their outputs $a$ and $b$ however they wish. However, if they do not* use a quantum strategy (and cannot communicate) they can never expect to win with probability greater than 0.75.

+

*Assuming quantum theory is a correct and complete description of reality.

+

Calculating the winning probability

+

Suppose Alice and Bob choose their inputs uniformly at random, i.e., $p(x,y) = 1/4$ for all $x,y \in \{0,1\}$. Also let $V:\{0,1\}^4 \rightarrow \{0,1\}$ be the function +$$ +V(a,b,x,y) = \begin{cases} +1 & \quad \text{if }\,\,xy = a+b \!\!\mod 2 \\ +0 & \quad \text{otherwise} +\end{cases}. +$$ +That is the function outputs $1$ if Alice and Bob win and $0$ if they lose.

+

Now you should try to convince yourself that the probability they win the CHSH game is +$$ +p_{\mathrm{win}} = \sum_{abxy} p(x,y) p(a,b|x,y) V(a,b,x,y). +$$ +More explicitly we get +$$ +\begin{aligned} +p_{\mathrm{win}} &= \frac{1}{4}[p(0,0|0,0) + p(1,1|0,0) + p(0,0|0,1) + p(1,1|0,1) \\ +& \quad \,\, + p(0,0|1,0) + p(1,1|1,0) + p(0,1|1,1) + p(1,0|1,1)]. +\end{aligned} +$$

+

So in order to calculate the probability they win we must compute the conditional probability distribution $p(a,b|x,y)$.

+

An optimal quantum strategy

+

Now in the Lecture you watched it looks like they presented a quantum system that can achieve the best winning probability $\cos^2(\pi/8)$. We use the states and measurements described in the video in order to compute the conditional probability distribution $p(a,b|x,y)$ for that particular quantum system. The state used is the maximally entangled state $|\psi\rangle = \tfrac{1}{\sqrt{2}}|00\rangle + \tfrac{1}{\sqrt{2}} |11\rangle$. The measurements may be represented by a collection of matrices $A_{a|x}$ and $B_{b|y}$. As measurement operators sum to the identity we have that for all $x,y \in \{0,1\}$, $A_{1|x} = \mathbb{1} - A_{0|x}$ and $B_{1|y} = \mathbb{1} - B_{0|y}$. Thus we only need to specify the operators for outcome $0$. For the strategy discussed in the lecture the operators are (in the computational basis) represented by the matrices +$$ +A_{0|0} = \begin{pmatrix} 1&0 \\ +0&0 +\end{pmatrix}, \quad +A_{0|1} = \begin{pmatrix} 1/2&1/2 \\ +1/2&1/2 +\end{pmatrix}, \\ +B_{0|0} = \begin{pmatrix} \cos(\pi/8)^2 &\sin(\pi/4)/2 \\ +\sin(\pi/4)/2& \sin(\pi/8)^2 +\end{pmatrix}, \quad +B_{0|1} = \begin{pmatrix} \cos(\pi/8)^2 & -\sin(\pi/4)/2 \\ +-\sin(\pi/4)/2& \sin(\pi/8)^2 +\end{pmatrix}. +$$

+

Now we can calculate, using the Born rule, the conditional probabilities as +$$ +p(a,b|x,y) = \langle \psi, (A_{a|x} \otimes B_{b|y}) \psi \rangle. +$$ +To demonstrate, +$$ +\begin{aligned} +p(0,0|0,0) &= \begin{pmatrix} +\frac{1}{\sqrt2} & 0 & 0 & \frac{1}{\sqrt2} +\end{pmatrix} +\begin{pmatrix} +\cos(\pi/8)^2 & \sin(\pi/4)/2 &0 &0 \\ +\sin(\pi/4)/2 & \sin(\pi/8)^2 & 0 & 0 \\ +0 &0&0&0 \\ +0&0&0&0 +\end{pmatrix} +\begin{pmatrix} +\frac{1}{\sqrt{2}} \\ +0\\ +0\\ +\frac{1}{\sqrt2} +\end{pmatrix} \\ +&= \begin{pmatrix} +\frac{1}{\sqrt2} & 0 & 0 & \frac{1}{\sqrt2} +\end{pmatrix} +\begin{pmatrix} +\frac{\cos(\pi/8)^2}{\sqrt{2}} \\ +\frac{\sin(\pi/4)}{2\sqrt{2}} \\ +0 \\ +0 +\end{pmatrix} \\ +&= \frac{\cos(\pi/8)^2}{2}. +\end{aligned} +$$

+

I'll leave the rest but after computing the remaining $p(a,b|x,y)$ you should find that $p_{\mathrm{win}} = \cos(\pi/8)^2$.

+",9854,,9854,,9/22/2020 21:11,9/22/2020 21:11,,,,5,,,,CC BY-SA 4.0 +13874,1,13888,,9/22/2020 16:32,,0,134,"

I am trying to wrap my head around Qiskit Aqua Operators and I stumbled upon this:

+

My code

+
t=0.5
+hamiltonian=get_hamiltonian(1,1) #a four 4 qubit hamiltonian (Transverse field Ising model)
+evo_time=Parameter("t")
+
+evo_op=(evo_time*hamiltonian).exp_i()
+evo_op1 = evo_op @ (Zero^4)
+
+trotter_op=PauliTrotterEvolution(trotter_mode=Suzuki(reps=10,order=1)).convert(evo_op1)
+trotter_op_values=trotter_op.bind_parameters({evo_time: t})
+
+circuit1=trotter_op_values.to_circuit()
+backend=Aer.get_backend("qasm_simulator")
+circuit1.measure_all()
+
+counts1=execute(circuit1, backend=backend, shots=10024).result().get_counts()
+
+for key in counts1.keys():
+    counts1[key]=counts1[key]/10024
+
+a=0
+# I had to instantiate again the trotter_op because trotter_op_values.to_circuit()
+#didn't create a new circuit and instead, by having done circuit1.measure_all()
+# trotter_op was modified as well.
+
+trotter_op=PauliTrotterEvolution(trotter_mode=Suzuki(reps=10,order=1)).convert(evo_op1)
+trotter_op_values=trotter_op.bind_parameters({evo_time: t})
+sampler=CircuitSampler(backend=Aer.get_backend("qasm_simulator"))
+sampler.quantum_instance.shots=10024
+results1=sampler.convert(trotter_op_values).primitive
+
+#normalize the results from the circuitsampler
+for key in results1.keys():
+    a+=results1[key]
+for key in results1.keys():
+    results1[key]=results1[key]/a
+
+# assert counts1.keys()==results1.keys()
+assert sum(counts1.values()) #check normalization
+assert sum(results1.values()) #check normalization
+
+for key in results1.keys():
+    print("state: {} | Counts1: {} | Results1: {}".format(key,counts1[key], results1[key]))
+
+    
+plot_histogram([counts1, results1], legend=["Running the circuit","CircuitSampler from aqua"])
+
+

What I expected +Since the evo_op1 is just a CircuitStateFn whose initialization was the zero state for the 4 qubits then, passing this into CircuitSampler the CircuitStateFn would be replaced by a DictStateFn whose amplitudes would be the same as measuring all 4 qubits in the trotterization circuit with a zero state initialization (my circuit1).

+

What I got +The histograms never match, for any value of t except t=0. However, there is always a clear similarity between the plots (for small t the probability for 0000 is always the biggest for example and all other states have similiar probabilities, but never exactly equal)

+

+

What am I missing? Was it a bad interpretation of the Operator Flow?

+",5620,,55,,9/22/2020 17:24,9/23/2020 11:01,Inconsistency in Qiskit Aqua CircuitSampler from Operator Flow,,1,0,,,,CC BY-SA 4.0 +13875,2,,13774,9/22/2020 17:35,,2,,"

To add on to the previous answer, if you want to see the progress of your job in real time, you can try the following:

+
from qiskit.tools.monitor import job_monitor
+job_monitor(job)
+
+

job_monitor shows you ever step, including job initialization, validation, being queued, to running and completion.

+",13117,,,,,9/22/2020 17:35,,,,0,,,,CC BY-SA 4.0 +13877,2,,12564,9/22/2020 17:55,,1,,"

I have a partial answer. The create_eigs function uses the Quantum Phase Estimation (QPE) algorithm to estimate the eigenvalues of your matrix. Here is what I can say about the input paramters:

+

num_ancilla: The number of ancillary qubits to use in the QPE algorithm. More qubits results in better precision for eigenvalue estimation but also greater depth for your circuit. See section 3 of this tutorial to learn more about how it will increase your precision.

+

num_time_slices: I actually have no idea what this is and I stumbled across this question because I was looking for an answer.

+

negative_evals: This is a simple boolean response indicating if you have or expect negative eigenvalues. An input of "True" will increase the number of ancillary qubits by 1 and therefore lead to a circuit of greater depth.

+

If anyone could elaborate on what num_time_slices is exactly than I would appreciate it.

+",13244,,,,,9/22/2020 17:55,,,,0,,,,CC BY-SA 4.0 +13878,1,13881,,9/22/2020 19:27,,1,429,"

I have submitted a batch of circuits to ibmq_vigo using the IBMQJobManager and the batch is correctly split properly into multiple jobs(as viewed on the dashboard), however the job at the front of the queue appears stuck at the front for multiple hours. The backend does not appear to be in reserve mode and I did not have this issue when I successfully executed the same batch of circuits on ibmq_rochester.

+

Does anyone know what might be the issue? +Also this is my second unsuccessful attempt at executing on ibmq_vigo.

+",12248,,55,,9/25/2020 11:50,9/25/2020 11:50,Why does job appear to be stuck in queue on IBMQ backend?,,1,6,,,,CC BY-SA 4.0 +13879,2,,4275,9/22/2020 19:29,,1,,"

I give working python code to compute the inverse of a Clifford tableau in this blog post.

+

The xz Pauli terms in the inverse table are computed by transposing the xz Pauli terms in the original table and then substituting:

+
II -> II
+IX -> IX
+IY -> XX
+IZ -> XI
+XI -> IZ
+XX -> IY
+XY -> XY
+XZ -> XZ
+YI -> ZZ
+YX -> ZY
+YY -> YY
+YZ -> YZ
+ZI -> ZI
+ZX -> ZX
+ZY -> YX
+ZZ -> YI
+
+

The signs in the transposed table are computed in a naive way. Sending a generator through the inverse table and then through the original table should return it unchanged. If it instead gets negated, the sign of column corresponding to that generator in the inverse table is flipped. So...

+
for generator, output in list(columns.items()):
+    columns[generator] *= original_operation(output).coefficient
+
+

For example, this tableau:

+
      | 0  1  2  3
+------+-xz-xz-xz-xz-
+ 0    | ZY ZY XZ _X
+ 1    | _Y ZY Z_ ZZ
+ 2    | Y_ YX XX XX
+ 3    | ZZ ZZ _X XZ
+ sign | -- -- -+ +-
+
+

inverts into this tableau:

+
      | 0  1  2  3
+------+-xz-xz-xz-xz-
+ 0    | YX XX ZZ Y_
+ 1    | YX YX ZY Y_
+ 2    | XZ Z_ _Y _X
+ 3    | _X Y_ _Y XZ
+ sign | ++ -+ +- -+
+
+",119,,,,,9/22/2020 19:29,,,,0,,,,CC BY-SA 4.0 +13880,1,,,9/22/2020 19:56,,5,365,"

I am interested in the smallest nonzero eigenvalue of a quantum state.

+
    +
  1. Does this eigenvalue always increasing after a partial trace i.e. +the smallest nonzero eigenvalue of $\rho_A$ is always larger than +that of $\rho_{AB}$? +Intuitively, this seems like it must be true since the reduced state has fewer eigenvalues but its trace is still 1. On average, +the eigenvalues must be larger. How can one prove this statement (or +perhaps a more refined version of it)?
  2. +
  3. Is there any bound on how much larger this eigenvalue can get? A +trivial bound is that it cannot increase by more than 1 but is there +anything better that can be said?
  4. +
+",13303,,55,,9/25/2020 11:50,12/24/2020 22:21,Eigenvalues of a quantum state after partial tracing,,1,4,,,,CC BY-SA 4.0 +13881,2,,13878,9/22/2020 22:54,,1,,"

Sometime that happens. The controlled electronic might got a reboot during while your jobs were in queue or something of that sort... You can try to cancel your jobs and resubmitted them to see if that fixes it. Note that if you running jobs through Aqua, like performing QAOA or VQE, you can cancel the current jobs and they will create a replacement job automatically.

+",9858,,,,,9/22/2020 22:54,,,,0,,,,CC BY-SA 4.0 +13882,1,,,9/23/2020 7:55,,1,61,"

In quantum computers the following two effects should be seen:

+
    +
  1. If an operator acts on an arbitrary qubit $Q_n$ of a quantum system $S$ consisting of several qubits than we get a new quantum system $S'$ where the amplitudes of all qubits have changed.

    +
  2. +
  3. If an operator acts on one qubit of a quantum system $T$ consisting of two entangled QuBits than both qubits are affected.

    +
  4. +
+

So which one of these is the reason for the exponential speed-up expected from quantum computers?

+",13307,,55,,9/23/2020 9:31,9/23/2020 10:39,What is the reason for the exponential speed-up of quantum computers?,,0,1,,9/24/2020 8:54,,CC BY-SA 4.0 +13883,1,13885,,9/23/2020 8:21,,1,282,"

Suppose I run the following code:

+

job = execute(qc, backend = backend, shots = 1024, optimization_level = 0)

+

Then the job takes a long time to run. We know that job_id (from job.job_id()) is a unique identifier for a job. Can I just save job_id and then turn it off and restore the job variable with job_id the next day?

+

Or what information can I save that will allow me to get the job.result() after I drop the line?

+

The motivation for this problem is that I don't want to increase the workload due to network reasons when I am waiting for many tasks to run. It will be much easier to handle data when there is job.result(). Otherwise, I can only go to https://quantum-computing.ibm.com/ to download the result data, and the data format is not easy to use.

+

thank you for your help!

+",8901,,,,,9/23/2020 15:53,Can I get the job variable from the job_id?,,2,0,,,,CC BY-SA 4.0 +13884,1,,,9/23/2020 8:37,,3,916,"

How can we perform a time evolution of a quantum state for a given Hamiltonian with qiskit Aqua operator flow? I'm interested in it due to its higher efficiency.

+",5620,,9006,,9/24/2020 6:36,9/25/2020 6:54,How to perform a time evolution of a quantum state with Qiskit Aqua?,,1,0,,,,CC BY-SA 4.0 +13885,2,,13883,9/23/2020 10:26,,2,,"

I take it you're running the jobs on an IBMQ backend and not one of the local simulators.
+If so, just keep track of job_id, then use the retrieve_job function to retrieve the job at a later point in time and get its result.

+",8955,,,,,9/23/2020 10:26,,,,0,,,,CC BY-SA 4.0 +13888,2,,13874,9/23/2020 11:01,,1,,"

Well, you are right. After CircuitSampler you are getting a DictStateFn with phase information lost (see the docs) in the amplitudes and you have to take the square of them for your histogram plot (not normalize).

+

Besides that, just keep in mind that the number of shots are not stored in the QuantumInstance of CircuitSampler (in the way you are setting them). You should rather do

+
qinstance = QuantumInstance(backend, shots=10024)
+sampler = CircuitSampler(qinstance)
+
+",13109,,,,,9/23/2020 11:01,,,,1,,,,CC BY-SA 4.0 +13889,2,,13883,9/23/2020 15:53,,1,,"

In order to fully recover your Job object from IBMQ, you need two things:

+
    +
  • the backend name
  • +
  • the job id
  • +
+

Once you sent your job, you can save those like this:

+
job_id = job.job_id()
+backend_name = job.backend().name()
+
+

Later, when the job is done, you can recover the Job object like this:

+
provider = IBMQ.load_account()
+job = provider.get_backend(backend_name).retrieve_job(job_id)
+
+",1859,,,,,9/23/2020 15:53,,,,0,,,,CC BY-SA 4.0 +13890,1,,,9/23/2020 15:57,,0,60,"

I want to test an error model of the convex form +$$t \times \text{ideal_state} + (1-t)\times \text{noisy_circuit}.$$ +In terms of density matrices, this would look like +$$t\rho_{\text{idealState}}+(1-t)\times\text{Identity}.$$ +However, I can only implement circuits on the simulator where I want to test and no density matrices.

+",5705,,55,,9/23/2020 19:23,9/23/2020 19:23,How can I implement a circuit that simulates white noise on $n$ qubits?,,0,5,,,,CC BY-SA 4.0 +13891,1,13896,,9/23/2020 16:43,,4,74,"

Lockability and non-lockability are explained in this paper. A real valued function of a quantum state is called non-lockable if its value does not change by too much after discarding a subsystem. The max-entropy of a quantum state is defined as

+

$$H_{\max }(A)_{\rho}= \log \operatorname{tr}(\rho_{A}^{1 / 2})$$

+

For a bipartite quantum state $\rho_{AB}$, I would like to know if the max-entropy is non-lockable i.e. is there any relationship of the form

+

$$\text{tr}(\rho_{AB}^{1/2}) \leq \text{tr}(\rho_{A}^{1/2})\cdot|B|$$

+

which, after taking logs on both sides, would yield

+

$$H_{\max}(AB)\leq H_{\max}(A) + \log|B|$$

+

A couple of easy numerical examples suggests this might be true but I have not been able to prove it.

+",4831,,55,,9/23/2020 17:06,9/24/2020 14:18,Non-lockability of quantum max-entropy,,1,0,,,,CC BY-SA 4.0 +13892,2,,13853,9/23/2020 20:25,,0,,"

Please contact your hub Group Admin to confirm that the email address of the IBM Quantum Experience account you are using has access to this Group.

+",13312,,1859,,10/27/2020 8:13,10/27/2020 8:13,,,,1,,,,CC BY-SA 4.0 +13893,1,13954,,9/23/2020 21:10,,2,158,"

I am trying to evolve a quantum state through a PauliTrotterEvolution in aqua and I'm trying to do so by initializing a random state, by using random_statevector from qiskit.quantum_info.

+

My code:

+
op=get_hamiltonian(-1,h) # a 4 qubit operator
+evo_op=(t*op).exp_i()
+evo_op=evo_op 
+
+trotter_op=PauliTrotterEvolution(trotter_mode=Suzuki(reps=10,order=1)).convert(evo_op)
+qinstance=QuantumInstance(backend=Aer.get_backend("qasm_simulator"), shots=2048)
+sampler=CircuitSampler(qinstance)
+
+trotter_op=trotter_op @ StateFn(state)
+results1=sampler.convert(trotter_op).primitive
+
+

The error

+

this returns the following error: ValueError: Qiskit circuit Initializer cannot handle non-positive statevectors. however, by the source code, the Initializer comes from qiskit.extensions which I believe is from this .py file (file) whose docstring states:

+
"""Complex amplitude initialization.
+    Class that implements the (complex amplitude) initialization of some
+    flexible collection of qubit registers (assuming the qubits are in the
+    zero state).
+    Note that Initialize is an Instruction and not a Gate since it contains a reset instruction,
+    which is not unitary.
+    """
+
+

what am I missing?

+",5620,,,,,9/29/2020 17:52,Simulate a random quantum state time evolution in Qiskit Aqua,,1,0,,,,CC BY-SA 4.0 +13894,1,13897,,9/24/2020 11:43,,1,111,"

I would like to try and ADMM optimizer as shown in Qiskit Tutorial in Quantum Lab. Firstly, I imported necessary libraries (copy/paste from the Tutorial):

+
import time
+from typing import List, Optional, Any
+import numpy as np
+import matplotlib.pyplot as plt 
+
+from docplex.mp.model import Model
+
+from qiskit import BasicAer
+from qiskit.aqua.algorithms import QAOA, NumPyMinimumEigensolver
+from qiskit.optimization.algorithms import CobylaOptimizer, MinimumEigenOptimizer
+from qiskit.optimization.problems import QuadraticProgram
+from qiskit.optimization.algorithms.admm_optimizer import ADMMParameters, ADMMOptimizer
+
+

When I started the import this error appeared:

+
---------------------------------------------------------------------------
+AttributeError                            Traceback (most recent call last)
+<ipython-input-32-c32e151d13df> in <module>
+     11 
+     12 from qiskit import BasicAer
+---> 13 from qiskit.aqua.algorithms import QAOA, NumPyMinimumEigensolver
+     14 from qiskit.optimization.algorithms import CobylaOptimizer, MinimumEigenOptimizer
+     15 from qiskit.optimization.problems import QuadraticProgram
+
+/opt/conda/lib/python3.7/site-packages/qiskit/aqua/__init__.py in <module>
+     75 from .aqua_globals import aqua_globals
+     76 from .quantum_instance import QuantumInstance
+---> 77 from .algorithms import QuantumAlgorithm
+     78 from ._logging import (QiskitLogDomains,
+     79                        get_logging_level,
+
+/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/__init__.py in <module>
+    190 from .eigen_solvers import NumPyEigensolver, ExactEigensolver, EigensolverResult
+    191 from .factorizers import Shor
+--> 192 from .linear_solvers import HHL, NumPyLSsolver, ExactLSsolver
+    193 from .minimum_eigen_solvers import (VQE, VQEResult, QAOA, IQPE, IQPEResult, QPE, QPEResult,
+    194                                     ClassicalCPLEX, CPLEX_Ising, NumPyMinimumEigensolver,
+
+/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/linear_solvers/__init__.py in <module>
+     15 """ Linear Solvers Package """
+     16 
+---> 17 from .hhl import HHL
+     18 from .numpy_ls_solver import NumPyLSsolver, ExactLSsolver
+     19 
+
+/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/linear_solvers/hhl.py in <module>
+     24 from qiskit.aqua import QuantumInstance
+     25 from qiskit.aqua.algorithms import QuantumAlgorithm
+---> 26 from qiskit.ignis.verification.tomography import state_tomography_circuits, \
+     27     StateTomographyFitter
+     28 from qiskit.converters import circuit_to_dag
+
+/opt/conda/lib/python3.7/site-packages/qiskit/ignis/verification/__init__.py in <module>
+     98 """
+     99 from .quantum_volume import qv_circuits, QVFitter
+--> 100 from .randomized_benchmarking import (CNOTDihedral,
+    101                                       randomized_benchmarking_seq,
+    102                                       RBFitter, InterleavedRBFitter,
+
+/opt/conda/lib/python3.7/site-packages/qiskit/ignis/verification/randomized_benchmarking/__init__.py in <module>
+     19 
+     20 # Randomized Benchmarking functions
+---> 21 from .circuits import randomized_benchmarking_seq
+     22 from .dihedral import (CNOTDihedral, decompose_cnotdihedral, random_cnotdihedral)
+     23 from .fitters import (RBFitter, InterleavedRBFitter, PurityRBFitter,
+
+/opt/conda/lib/python3.7/site-packages/qiskit/ignis/verification/randomized_benchmarking/circuits.py in <module>
+    204                                 is_purity: bool = False,
+    205                                 group_gates: Optional[str] = None,
+--> 206                                 rand_seed: Optional[Union[int, RandomState]] = None) -> \
+    207         (List[List[qiskit.QuantumCircuit]], List[List[int]],
+    208          Optional[List[List[qiskit.QuantumCircuit]]],
+
+AttributeError: module 'qiskit' has no attribute 'quantum_info'
+
+

Since I only copied the code, it seems there is some bug. Does anybody know how to solve this?

+

Note: I work in Quantum Lab in IBM Q Experience interface

+",9006,,55,,9/25/2020 12:03,9/25/2020 12:03,Qiskit: Error when importing libraries for ADMM optimizer,,1,0,,,,CC BY-SA 4.0 +13895,1,,,9/24/2020 12:21,,3,92,"

What is the reason for high variation in measurement probability results of a simple 3/4 qubit measurement circuit on IBM Melbourne machine in comparison with the same circuit being run on IBM Vigo/Santiago.

+

Variation in Vigo: approx. 0.7

+

Variation in Melbourne: approx. 2.6

+",13172,,9006,,9/25/2020 6:50,9/25/2020 6:50,IBM Melbourne quantum computer performance and errors,,1,1,,,,CC BY-SA 4.0 +13896,2,,13891,9/24/2020 14:18,,4,,"

Let $D_{\alpha}(\rho\|\sigma):= \frac{1}{\alpha - 1} \log \mathrm{Tr}[\rho^\alpha \sigma^{1-\alpha}]$ be the Petz-Rényi divergence for $\alpha \in (0,1)\cup(1,\infty)$. Note that for $\alpha \in (0,1)\cup(1,2]$ this quantity satisfies the data processing inequality +$$ +D_{\alpha}(\rho\|\sigma) \geq D_{\alpha}(\mathcal{E}(\rho) \| \mathcal{E}(\sigma)), +$$ +where $\mathcal{E}$ is any CPTP map.

+

Now let $\rho_{AB}$ be any state and take $\mathcal{E}$ to be the partial trace over the $B$ system. Then for $\alpha = 1/2$ we have +$$ +\begin{aligned} +-2 \log \mathrm{Tr}[\rho^{1/2}_{AB}] &= D_{1/2}(\rho_{AB}\|I_{AB}) \\ +&\geq D_{1/2}(\mathrm{Tr}_{B}[\rho_{AB}]\|\mathrm{Tr}_{B}[I_{AB}]) \\ +&= D_{1/2}(\rho_{A}\||B|I_{A}) \\ +&= -2 \log \mathrm{Tr}[\rho^{1/2}_{A} |B|^{1/2}] +\end{aligned} +$$

+

Rearranging you get +$$ +\log \mathrm{Tr}[\rho^{1/2}_{AB}] \leq \log \mathrm{Tr}[\rho^{1/2}_{A}] + \log|B|^{1/2} +$$ +which is actually a slightly stronger inequality with the exponent of $|B|$ being only $1/2$.

+",9854,,,,,9/24/2020 14:18,,,,1,,,,CC BY-SA 4.0 +13897,2,,13894,9/24/2020 15:01,,1,,"

Looks like a glitch. It is not reproducible under my account. I've seen similar errors when there's mismatch in versions between Qiskit Aqua and Terra installed locally, but I don't think it is the case in Quantum Lab. +Try to restart the kernel or create a new notebook and run the same imports.

+",13318,,,,,9/24/2020 15:01,,,,1,,,,CC BY-SA 4.0 +13898,2,,13895,9/24/2020 15:27,,3,,"

There are many factors that going into this, but most of them are boiled down together into a metric that IBM called Quantum Volume (QV).

+

ibmq_vigo has a QV of 16:

+

+

Where as ibmq_16_melbourne as QV of 8:

+

+

You can read more about QV here: https://qiskit.org/textbook/ch-quantum-hardware/measuring-quantum-volume.html

+",9858,,,,,9/24/2020 15:27,,,,0,,,,CC BY-SA 4.0 +13899,1,,,9/24/2020 15:46,,1,72,"

Is there a quantum gate that can do the following?

+

Given a first set of N qbits, mutually entangled in such a way that each state in the superposition meets a given condition, generate a second set of N qbits entangled in such a way that NO superimposed state in the second set of qbits meets that condition, and ALL states that do not meet that condition ARE included in the superimposed states in the second set of qbits.

+

It seems that a combination of quantum NOT gates might do the trick, but I can't quite wrap my head around it. My apologies if the terminology is wrong: this is not my field.

+",13320,,,,,9/24/2020 15:46,Is there a quantum gate that can do this?,,0,5,,,,CC BY-SA 4.0 +13900,2,,13884,9/24/2020 17:05,,2,,"

This is a very general question, and I myself am only beginning to learn how to implement Hamiltonian simulations on Qiskit, but here are some resources which may be useful.

+

This Stack Exchange thread details basic theory of Hamiltonian simulation.

+

This tutorial on Hamiltonian simulations outlines how to implement a basic one assuming you have already decomposed your matrix into component Pauli matrices. I myself am looking to learn how to automatically decompose a Hermitian matrix into its Pauli matrices using qiskit if possible.

+

Additionally, I am linking a similar thread here.

+",13244,,9006,,9/25/2020 6:54,9/25/2020 6:54,,,,0,,,,CC BY-SA 4.0 +13901,1,,,9/24/2020 18:58,,3,89,"

I am currently reading this paper about Quantum Key Distribution Protocols which use Franson Interferometers to secure against eavesdroppers. I am having trouble understanding how the interferometers implement the CHSH game in order to show the correlation between the photons in the experiment has not been tampered with.

+

I do not come from an experimentalist background and understanding the workings of the Franson interferometer vs other interferometers is proving difficult. I know that in the CHSH game both parties (Alice and Bob) will choose between two measurements to maximize the violation of Bells Inequality. With Franson interferometers what is the analog for these measurements? Is it just the counts of how many photons choose the long branch vs the short? I know some experiments use phase differences in the branch paths and Alice and Bob choose their own phase delays. Does this not destroy the temporal correlation between the two photons?

+

I know this is a long slew of questions so any help is greatly appreciated!

+",13313,,,,,7/12/2021 13:55,How are Franson Interferometers used to prove security in Photonic QKD Experiments?,,1,0,,,,CC BY-SA 4.0 +13904,1,13905,,9/25/2020 2:25,,3,121,"

Exercise 2.63 of Nielsen & Chuang asks one to show that if a measurement is described by measurement operators $M_m$, there exists unitary $U_m$ such that $M_m = U_m \sqrt{E_m}$ where $E_m$ are the POVM associated to the measurement (that is, $E_m = M^{\dagger}_m M_m$).

+

I can see that, if $\sqrt{E_m}$ is invertible, then $U_m = M_m \sqrt{E_m}^{-1}$ is unitary; indeed, we have (dropping the needless subscript for simplicity) $U^{\dagger} U = (\sqrt{E}^{-1})^\dagger M^\dagger M \sqrt{E}^{-1} = (\sqrt{E}^{-1})^\dagger E \sqrt{E}^{-1} = (\sqrt{E}^{-1})^\dagger \sqrt{E} = (\sqrt{E}^{-1})^\dagger \sqrt{E}^\dagger = (\sqrt{E} \sqrt{E}^{-1})^\dagger = I^\dagger = I$ +where I used that $\sqrt{E}$ is Hermitian (since it is positive).

+

But what if it's not invertible? Perhaps some continuity argument would work?

+",9168,,55,,9/25/2020 11:38,9/25/2020 11:38,Show that for any measurement operator $M_m$ there exists unitary $U_m$ such that $M_m=U_m\sqrt{E_m}$ with $E_m$ POVM,,1,0,,,,CC BY-SA 4.0 +13905,2,,13904,9/25/2020 5:07,,2,,"

It is just a polar decomposition of $M_m$.
+If $M_m = U P$ then $M^{\dagger}_m M_m = P^2$, hence $P = \sqrt{E_m}$.

+

Limiting argument, similar to this, also can work.

+",5870,,,,,9/25/2020 5:07,,,,0,,,,CC BY-SA 4.0 +13906,1,13908,,9/25/2020 6:59,,3,400,"

This is a simple circuit introduced in Moran's book "Mastering Quantum Computing with IBM QX" to demonstrate how if works in OpenQASM:

+
OPENQASM 2.0;
+include "qelib1.inc";
+
+qreg q[5]; // Quantum Register
+creg c[5]; // Classical Register
+ 
+x q[0];
+measure q[0] -> c[0];
+if (c==1) x q[1];
+measure q[1] -> c[1];
+
+

And this is how the circuit visually looks in IBM QX Circuit Composer:

+

+

The book states that at the end of the circuit, the classical register should read 00011 because after the first measurement it holds a value 1 (as a decimal number), thus satisfying the if condition. However, when I test this exact circuit in IBM QX's Circuit Composer, the result shows 00001 with 100% probability.

+

Interestingly enough, when if (c==1) is changed to if (c==0), the result is now 00011 with 100% probability, which I don't think is logically right.

+

What should be an explanation for this discrepancy? The book argues that the if statement is not supported by IBM QX (as of Jan 2019), so could this be a sort of bug?

+

Any help would be appreciated.

+",4204,,55,,9/27/2020 15:47,9/28/2020 15:43,IF statement in OpenQASM on IBM Quantum Experience,,1,0,,,,CC BY-SA 4.0 +13907,2,,13749,9/25/2020 11:41,,1,,"

A highly skillful analysis in Mathematica of the problem has been given by the user "JimB" in his answer to

+

MathematicaFormulation .

+

That analysis was based on a transformation by Nicolas Tessore of the original 3D constrained integration problem to an unconstrained one.

+

The answer given by JimB +\begin{equation} +\frac{29902415923}{497664}-\frac{50274109}{512 \sqrt{2}}-\frac{3072529845 \pi }{32768 + \sqrt{2}}+\frac{1024176615 \cos ^{-1}\left(\frac{1}{3}\right)}{4096 \sqrt{2}} +\end{equation} +or in Mathematica notation,

+
29902415923/497664 - 50274109/(512 Sqrt[2]) - (3072529845 π)/(32768 Sqrt[2]) +(1024176615 ArcCos[1/3])/(4096 Sqrt[2])
+
+

fully agrees with the earlier set of results-shown in the question statement.

+",3089,,3089,,9/26/2020 15:53,9/26/2020 15:53,,,,0,,,,CC BY-SA 4.0 +13908,2,,13906,9/25/2020 12:12,,2,,"

I think is, indeed, a bug in IQX. There is an explanation for this, but it is a bit obscure. It will be explained later.

+

Your code is correct:

+

Here is the result in Qiskit.

+

With c==1:

+
from qiskit import *
+qc = QuantumCircuit.from_qasm_str("""
+OPENQASM 2.0;
+include "qelib1.inc";
+
+qreg q[5]; // Quantum Register
+creg c[5]; // Classical Register
+ 
+x q[0];
+measure q[0] -> c[0];
+if (c==1) x q[1];
+measure q[1] -> c[1];
+""")
+qc.draw('mpl')
+
+backend = BasicAer.get_backend('qasm_simulator')
+execute(qc,backend).result().get_counts()
+
+
{'00011': 1024}
+
+

With c==0:

+
from qiskit import *
+qc = QuantumCircuit.from_qasm_str("""
+OPENQASM 2.0;
+include "qelib1.inc";
+
+qreg q[5]; // Quantum Register
+creg c[5]; // Classical Register
+ 
+x q[0];
+measure q[0] -> c[0];
+if (c==0) x q[1];
+measure q[1] -> c[1];
+""")
+qc.draw('mpl')
+
+backend = BasicAer.get_backend('qasm_simulator')
+execute(qc,backend).result().get_counts()
+
+
{'00001': 1024}
+
+

Why this does not work on IQX visualizations

+

There is note in the IQX documentation for visualizations: +

+

The key part is:

+
+

The visualizations do not reflect any measurement operations in your circuit.

+
+

That means that your measure statement is ignored, leaving your code like this:

+
x q[0];
+if (c==1) x q[1];
+
+

The initial state of c is 0. Therefore, just x q[0]; resulting in 00001.

+

When you changed to c==0, then the circuit is x q[0]; x q[1];, resulting in 00011.

+

I talked with the IQX developers and they are working in a better solution to avoid skipping measurements silently. You can still run your program in IQX using a simulator backend and the result will be the correct one. This issue only pops up in the client-side visualizations, since they are statevector based.

+",1859,,1859,,9/28/2020 15:43,9/28/2020 15:43,,,,0,,,,CC BY-SA 4.0 +13909,1,,,9/25/2020 12:51,,1,52,"

I was wondering if there is a possibility to report measurement components when reporting the final expectation values of a qubit operator. For example, if we look at a simple Hydrogen molecule Hamiltonian (parity mapping, minimal basis, $0.7414$ Å) as follows:

+

$$H_{op} = -1.052\, II + 0.397\, IZ -0.397\, ZI -0.011 \, ZZ + 0.180 \,XX$$

+

To obtain the ground state energy, we need to calculate the expectation value of the above expression. To my understanding, this can be done using PauliExpectation() function from aqua. For this problem, I assume expectation values are computed for each component ($II$, $IZ$, $ZI$, $ZZ$, $XX$) of the above Hamiltonian (multiplied by the pre-factors: $-1.05, 0.39, 0.39, -0.01, 0.18$) and then summed up.

+

I am wondering if it's possible to report the expectation values for each component, ie just for the $IZ$, $ZI$, $ZZ$ and $XX$ terms, for example. I could very easily then multiply the pre-factors and compute the total expectation value classically.

+",13328,,23,,9/25/2020 21:33,9/25/2020 21:33,Report measurement components for a given Hamiltonian measurement,,0,1,,,,CC BY-SA 4.0 +13910,1,,,9/25/2020 13:09,,2,32,"

Many quantum processes are formulated in a resource theoretic approach like entanglement, athermality, asymmetry, coherence, etc.

+

Some of its topics have obvious applications, like distillation where you asymptotically convert resources to their maximal form, which is connected to the resource measure of von-Neumann entropy. However, I am not familiar with applications for single-shot (deterministic) conversion where a finite system is converted with exactness.

+

The center focus for single-shot conversion is which state can be converted to which state given some physical limitation. However, in quantum computing I do not see how this knowledge can be used, you apply quantum gates without having to figure out its state transformations beforehand. I also do not find catalysts to be very useful, since each transformation uses different catalysts, and you have to calculate which one to use so it does not get spent. Moreover, from an experimental perspective it is not very achievable.

+

So, the question is what are some applications for single-shot state conversion? (The most likely application I can think of is in one-way quantum processing.)

+",13204,,45,,9/25/2020 21:26,9/25/2020 21:26,What applications does single-shot state conversion have?,,0,0,,,,CC BY-SA 4.0 +13911,2,,13872,9/25/2020 15:15,,1,,"

The link to the paper in the question is by Bennett, Bernstein, Brassard, and Vazirani (BBBV).

+

The standard BBBV oracular problem to which the OP refers may be recast as, given the value $y$ of a permutation $y=f(x)$ acting on $n$ inputs, find a full preimage $x=x_1x_2\cdots x_n$ of the permutation which evaluates to $y$. BBBV provided a lower bound, noting that it may take at least $\mathcal{O}(\sqrt{2^n})$ calls to the oracle. Somewhat famously, the same upper bound was found, almost simultaneously with BBBV, by Grover.

+

However, as the OP suggests, such a proof initially presented in the BBBV paper may be challenging to understand (I think they called it the "polynomial method"); there have been a number of improvements such as the as-mentioned "hybrid method" and culminating in the "adversarial method" of Ambainis. I like O'Donnell's lecture on ways to prove the BBBV bound.

+

The question of the OP seems not ask for a lower bound not for the full preimage $x_1 x_2\cdots x_n$, but only for the least significant bit (LSB) $x_n$ of the preimage. But if one has a quick oracle to know the LSB $x_n$, I think one can rinse and repeat to find the full preimage $x_1x_2\cdots x_n$ quickly as well, with only $n$ calls to the parity oracle. For example, one could define a series of $n$ permutations as in:

+
    +
  • $f=f_n(x_1x_2\cdots x_n)=y_1y_2\cdots y_n$; given $f$ and $y=00\cdots 01$, the parity oracle would determine $x_n$;

    +
  • +
  • $f_{n-1}(x_1x_2\cdots x_{n-1})=y_1y_2\cdots y_{n-1}$;

    +
  • +
  • $\ldots$

    +
  • +
  • $f_2(x_1x_2)=y_1y_2$;

    +
  • +
  • $f_1(x_1)=y_1$

    +
  • +
+

and use the oracle for each of the $f$ functions so-defined.

+

Thus, if one were to use the hybrid method to prove a lower bound on a parity oracle for the preimage of $f_n$, then the proof would carry through to each of the subsequent $f$, by simply using the results of this parity oracle to redefine new functions $f_i$.

+

Because the BBBV theorem, no matter how it's proved, tells us that we can't have a quick way to determine the full preimage in $\mathcal{O}(\mathrm{poly\:} n)$ time, we must not have an oracle to determine the individual parity of the preimage, because if we did, we could leverage the parity oracle with only an $\mathcal{O}(n)$-overhead.

+

ADDED IN AN ATTEMPT TO CLARIFY

+

If you can prove the BBBV theorem to show that you need an exponential number of calls to a generic oracle to fully invert a permutation, using whichever method you like (such as the hybrid method), then it also follows that there is an exponential lower bound on the number of queries to solve the problem of determining only the parity of the inverse of a function; if not, then you can still use your oracle to fully invert a function/permutation in polynomial time, which contradicts exactly what the BBBV theorem proved.

+

For example, assume that you can use a polynomial number of calls, say $n^3$ calls, to an oracle so that you can determine the parity $x_n$ of the preimage $x$ of a permutation function $\sigma=f$ which evaluates to a particular value $y=00\cdots01$. You can then repeat such a test to determine each of the bits of $x$, but you are doing this in polynomial time, say $n^4$ time. But this is exactly what BBBV proved you cannot do.

+

Thus we have a way to use the hybrid method, which proved the BBBV theorem for all bits of $x$, to show that we require an exponential number of calls to an oracle to determine the parity of only one of the bits of $x$ (e.g. $x_n$).

+

(This is just an answer to show that determining the parity of a preimage is just as difficult as determining the preimage itself. I'm not sure if the OP's interest is about the details of the hybrid method itself, which I am not knowledgeable to speak to.)

+",2927,,2927,,9/25/2020 20:09,9/25/2020 20:09,,,,8,,,,CC BY-SA 4.0 +13912,1,,,9/25/2020 23:35,,3,165,"

My question might be similar to Hidden subgroup problem. However, I'm not exactly sure though. In addition, that question doesn't have an answer.

+

I'm trying to create some simple instances of the general abelian hidden subgroup problem to experiment with for learning purposes. This requires solving the following simpler (for small groups) 'reverse' problem:

+
+

Suppose we have a finite abelian group $G$. In addition, we +have an arbitrary subgroup $H$. Find a function, $f_H : G \to S$, for some set $S$. In addition, $f_H$ +is constant, and for simplicity distinct on the cosets of $H$.

+
+

I know that WLOG, we can assume $G \ge H$ is such that $G \cong \mathbb{Z}_{p^{k_1}} \oplus \mathbb{Z}_{p^{k_2}} \dots \oplus \mathbb{Z}_{p^{k_n}}$, for the same $p$. Since the abelian HSP, and thus the problem I mentioned above, can be solved separately for the relatively prime components.

+

My question is about when $p$ is not a power of $2$. In which can we need to instead look at $G' \cong \mathbb{Z}_{2^{r_1}} \oplus \mathbb{Z}_{2^{r_2}} \dots \oplus \mathbb{Z}_{2^{r_n}}$ where for each $k_i$, $p^{2k_{i}} \le 2^{r_i} \le 2p^{2k_{i}}$, and use the continued fractions algorithm. Given, $f_H$ for $G$ ($G \ge H$), how do we extend the support of $f_H$ to $G'$ such that we can still sample from the dual of $H$?

+

In the case of the order-finding/Shor's function with support $\mathbb{Z}_{\phi(N)}$ ($\phi$ is Euler's totient function), the support of $f(x) = a^k mod N$ can be naturally extended from $\mathbb{Z}_{\phi(N)}$ to $\mathbb{Z}_N$ and then $\mathbb{Z}_{2^k}$, $N^2 \le 2^k \le 2N^2$. Also Shor proved the extension is valid for this function. But what about an arbitrary $f_H$?

+

The set of functions I'm looking at are ones that simply assign a distinct natural number to each coset.

+

I was thinking something like given $f_H$ as above extend to $f'_H$:

+

$\quad f'_H((x_1, x_2, \dots, x_n)) = f_H((x_1 mod \mathbb{Z}_{p^{k_1}}, x_2 mod \mathbb{Z}_{p^{k_2}}, \dots, x_n mod \mathbb{Z}_{p^{k_n}}))$, $(x_1, x_2, \dots, x_n) \in \mathbb{Z}_{2^{r_1}} \oplus \mathbb{Z}_{2^{r_2}} \dots \oplus \mathbb{Z}_{2^{r_n}}$.

+

This doesn't seem to work; I'm not sure it actually makes sense.

+

Any ideas?

+

Update +I realized I might be misunderstanding something. It seems like the setup is supposed to be the following: create a uniform superposition of the states of $G$, not $G'$, as I stated above. In which case we can apply $f_H$, as is. However, we still utilized the QFT of $G'$, which can be efficiently implemented. This seems to work for small groups, but it doesn't seem to be feasible to construct an arbitrary uniform superposition of a subset of all basis states, which is what we would need. To do this exactly, would require, to my knowledge, implementing the QFT for $G$ (or QFT for $\mathbb{Z}_r$ for arbirary $r$), which we can't do. I assume for small groups, this could be done through multiple applications of Grover to get an approximate uniform superposition.

+

Since, as mentioned here https://arxiv.org/pdf/quant-ph/0603140.pdf, the order-finding/Shor's function is somewhat of a special case. Since in Shor's we are actually dealing with free-abelian groups of finite rank (not finite), as the paper mentions.

+

I'm still not sure if this is correct. If it is, I'm not sure of an efficient way of implementing such superpositions.

+

Please let me know if anything isn't clear with my question.

+",8765,,8765,,9/28/2020 18:00,2/22/2022 20:07,Constructing arbitrary functions for the Abelian HSP,,1,15,,,,CC BY-SA 4.0 +13913,2,,13168,9/26/2020 0:05,,3,,"

UPDATE: Qiskit Terra 0.16 (release Oct 2020) fixes this issue.

+

I just merged PR 4893, fixing this issue in coming Qiskit Terra 0.16. This closes 4905 and 4893 (reporting this very same problem) by setting the correct aspecting ration when Matplotlib installed is 3.3.0 or above. This issue was introduced by Matplotlib 3.3 as part of a fix.

+

TL;DR: Problem introduce by MPL 3.3.0 that will be fixed in Qiskit Terra 0.16. In the meanwhile, you can downgrade to MPL 3.2 as a workaround.

+",1859,,1859,,4/23/2021 19:17,4/23/2021 19:17,,,,0,,,,CC BY-SA 4.0 +13914,2,,9940,9/26/2020 0:15,,1,,"

If I understand your question correctly, you are looking for a way to create custom gates.

+

For that, first create a circuit that it will be converted to a gate:

+
from qiskit import *
+my_circuit = QuantumCircuit(3, name='mygate')
+my_circuit.x(range(3))
+....
+my_gate = my_circuit.to_gate()
+
+

Then, you can use your gate in a bigger circuit:

+
circuit = QuantumCircuit(5)
+circuit.append(my_gate, [0,2,3])
+print(circuit)
+
+
     ┌──────────┐
+q_0: ┤0         ├
+     │          │
+q_1: ┤          ├
+     │  my_gate │
+q_2: ┤1         ├
+     │          │
+q_3: ┤2         ├
+     └──────────┘
+q_4: ────────────
+
+

You can see your custom gate "content" with circuit.decompose().

+",1859,,,,,9/26/2020 0:15,,,,0,,,,CC BY-SA 4.0 +13915,2,,10212,9/26/2020 7:43,,4,,"

In this paper they talk primarily about ibmqx4.

+
+

The gates listed in Eq. (26) are provided by IBM for the user’s convenience. However these are +not the gates that are physically implemented by their quantum computer. IBM has a compiler that +translates the gates in (26) into products of gates from a physical gate set. The physical gate set +employed by IBM is essentially composed of three gates [1]: +{U1(λ), RX (π/2), CNOT} .

+
+

It seems that the link [1] from the paper is broken but I was able to find this, which is device information of IBM Q 16 Rueschlikon ibmxq5 (formerly ibmqx3)
+They mention:

+
+

A frame change (FC) is equivalent to applying a virtual Z-gate in software, where Z(θ)=FC(-θ). Gaussian derivative (GD) and Gaussian flattop (GF) pulses are defined with amplitude and angle parameters.

+
+ +

Summary:

+
    +
  1. I believe in the IBM Q Experience platform, the term "basis gates", +which you can find in each backend's specification, refers to the +implemented physical gates on that specific device.
    So for Melbourne we'll have id, u1, u2, u3, cx.
    This should be confirmed by someone from IBM Q team though, but I think physical gates, native gates and basis gates are interchangeable terms.
  2. +
  3. The above image should explain your second question.
  4. +
+",9318,,9318,,9/26/2020 10:11,9/26/2020 10:11,,,,0,,,,CC BY-SA 4.0 +13916,2,,13202,9/26/2020 9:20,,6,,"

qiskit-terra 0.16 or lower

+

As answered, probably the most canonical way to do this is with Statevector.from_label and initialize.

+

Here is the full example:

+
from qiskit import *
+from qiskit.quantum_info import Statevector
+
+n = 2
+qc = QuantumCircuit(n)
+
+qc.initialize(Statevector.from_label('1'*n).data, range(n))
+qc.draw()
+
+
     ┌──────────────────────┐
+q_0: ┤0                     ├
+     │  initialize(0,0,0,1) │
+q_1: ┤1                     ├
+     └──────────────────────┘
+
+

You could confirm the result like this:

+
qc.measure_all()
+execute(qc, backend=BasicAer.get_backend('qasm_simulator')).result().get_counts()
+
+

qiskit-terra 0.17 or higher

+

This questions inspired a new way to initialize a qubits in the basis states of the Pauli eigenstates Z, X, Y (à la Statevector.from_label).

+
from qiskit import QuantumCircuit
+from qiskit.extensions.quantum_initializer.initializer import Initialize
+
+circuit = QuantumCircuit(6)
+circuit.append(Initialize("10+-lr"), range(6))
+circuit.draw()
+
+
     ┌──────────────────────────┐
+q_0: ┤0                         ├
+     │                          │
+q_1: ┤1                         ├
+     │                          │
+q_2: ┤2                         ├
+     │  initialize(1,0,+,-,l,r) │
+q_3: ┤3                         ├
+     │                          │
+q_4: ┤4                         ├
+     │                          │
+q_5: ┤5                         ├
+     └──────────────────────────┘
+
+

The decomposition of this gate is the following:

+
circuit.decompose().draw()
+
+
          ┌───┐ ┌───┐ 
+q_0: ─|0>─┤ H ├─┤ S ├─
+          ├───┤┌┴───┴┐
+q_1: ─|0>─┤ H ├┤ SDG ├
+          ├───┤└┬───┬┘
+q_2: ─|0>─┤ X ├─┤ H ├─
+          ├───┤ └───┘ 
+q_3: ─|0>─┤ H ├───────
+          └───┘       
+q_4: ─|0>─────────────
+          ┌───┐       
+q_5: ─|0>─┤ X ├───────
+          └───┘       
+
+",1859,,1859,,10/21/2020 18:46,10/21/2020 18:46,,,,3,,,,CC BY-SA 4.0 +13917,2,,11436,9/26/2020 10:35,,2,,"

In general, it's not true that you can always write the Hamiltonian for a particular system in the Pauli matrices basis using only polynomial terms. If you think about it, decomposing a matrix is the same as when you decompose a vector in a basis: it can happen that that vector has only a few components along that basis but in the most general case, its decomposition will have $N$ terms. Similarly, a $N\times N$ matrix has $N^2$ independent entries, so in the most general case, you will need $N^2$ terms in your decomposition.

+

I don't know why that's true for electronic structure Hamiltonian, it probably has to do with the role the Pauli matrices have in chemistry and how they were used to assemble that matrix in the first place.

+

I suggest you check this answer: Can arbitrary matrices be decomposed using the Pauli basis?. Using that formula you can write a simple code that decomposes any arbitrary matrix of your choice, and you can see how many terms it takes. Obviously, a random matrix will take $N^2$, but in general, you might have fewer terms.

+

Note that this poses a serious limitation on the applicability of VQE outside chemistry: every matrix that has an exponential number of terms in its decomposition will not yield a substantial quantum advantage.

+",11551,,,,,9/26/2020 10:35,,,,0,,,,CC BY-SA 4.0 +13918,1,13922,,9/26/2020 14:05,,1,237,"

Shor's 9 Qubit code. Imagine that we encode the state $| \psi \rangle = \alpha | 0 \rangle + \beta | 1 \rangle$ using Shor's 9 qubit code, then an X error occurs on the 8th qubit of the encoded state $| E ( \psi ) \rangle$.

+

a) Write down the state following the error.

+

Apparently the answer is

+

$$\frac{1}{2 \sqrt2}( \alpha (| 000 \rangle + | 111 \rangle) ( | 000 \rangle + | 111 \rangle) ( | 010 \rangle + | 101 \rangle) \\ + \beta ( | 000 \rangle - | 111 \rangle)( | 000 \rangle - | 111 \rangle)( | 010 \rangle - | 101 \rangle))$$

+

How has this been derived? I cant see how you do this with an error.

+

b) We now decode the encoded state, starting by applying the bit flip code decoding algorithm. What are the syndromes returned by the measurements in the algorithm?

+

Apparently the syndromes are $00, 00, 10$. How do I know what measurements to do?

+

c) Now imagine that $| E( \psi ) \rangle$ is affected by two $X$ errors, on the 7th and 8th qubits. What are the syndromes returned this time? What state does the decoding algorithm output?

+

Now the syndromes are $00, 00, 01$. The decoding algorithm thus thinks there has been an X error on the 9th qubit. So it "corrects" this by applying an X operation on this qubit, to give the state

+

$$\frac{1}{2 \sqrt2}( \alpha (| 000 \rangle + | 111 \rangle)( | 000 \rangle + | 111 \rangle)( | 000 \rangle + | 111 \rangle)\\ - \beta ( | 000 \rangle - | 111 \rangle)( | 000 \rangle - | 111 \rangle)( | 000 \rangle - | 111 \rangle))$$

+

Note that $\beta$ now has a minus sign in front of it. After the bit decoding, we are left with $\alpha | {+++} \rangle - \beta | {---} \rangle$, which is then decoded to $\alpha | 0 \rangle - \beta | 1 \rangle$.

+

Again how would I know what measurements to take? Also how could I know a priori that I have errors on the 7th and 8th qubits? Why do we apply a $X$ operation to the 9th qubit?

+",4336,,15391,,4/6/2021 9:49,4/6/2021 9:49,Example of Quantum Error Correction,,1,7,,9/29/2020 9:06,,CC BY-SA 4.0 +13919,1,13927,,9/26/2020 15:45,,3,140,"

Quantum computing is not my field, so answers understandable to a layman will be most useful. Please forgive any incorrect terminology in my question!

+

Assume that a set of the states of N qubits exists as a superposition of M entangled qubit states, such that the possible states in the superposition comprise a subset B of the universal set comprising all possible states of N unentangled qubits.

+

If a quantum NOT operation is applied to each of the N qubits in B to obtain a new superposition R, what is the result? Is it the set complementary to B? I suspect it should be the set $R=B^C$, containing a superposition of 2^N - M different possible states.

+",13320,,55,,9/27/2020 11:39,9/27/2020 21:16,What does a quantum NOT operation do to an entangled set of qubits?,,1,6,,,,CC BY-SA 4.0 +13920,1,13923,,9/26/2020 18:15,,2,231,"

I'm using Qiskit to demonstrate some circuits, and I want to change the position of some gates for better representation.

+

For example, look at this circuit:

+

I'd like for the last $R_x(\frac{-\pi}{2})$ to align with the last Hadamard gate. Is there a way to do this without using barriers?

+",13215,,55,,9/26/2020 22:21,9/26/2020 22:21,Change the position of a gate in Qiskit for better representation,,1,0,,,,CC BY-SA 4.0 +13921,1,13924,,9/26/2020 19:29,,2,158,"

In this paper (nature version), the authors state

+
+

We group the Pauli operators into tensor product basis sets that require the same post-rotations.

+
+

As a result, they have the table S2 in the suppl. I don’t understand this statement, could anyone please explain it, say for H2?

+",9816,,55,,9/26/2020 22:19,9/26/2020 22:19,"In Variational Quantum Eigensolvers, what does ""grouping Pauli operators into tensor products requiring the same post-rotations"" mean?",,1,0,,,,CC BY-SA 4.0 +13922,2,,13918,9/26/2020 20:03,,3,,"

Answer to a)

+

Initial encoded state with qubit indexes (I will omit $\frac{1}{2\sqrt{2}}$ for simplicity):

+

\begin{align}|\psi\rangle = &\alpha (|0_1 0_2 0_3\rangle + |1_1 1_2 1_3\rangle)(|0_4 0_5 0_6\rangle + |1_4 1_5 1_6\rangle)(|0_7 0_8 0_9\rangle + |1_7 1_8 1_9\rangle) + \\ &\beta (|0_1 0_2 0_3\rangle - |1_1 1_2 1_3\rangle)(|0_4 0_5 0_6\rangle - |1_4 1_5 1_6\rangle)(|0_7 0_8 0_9\rangle - |1_7 1_8 1_9\rangle) +\end{align}

+

After applying $X$ gate on $8$th qubit (and after removing indexes):

+

\begin{align}|\psi\rangle = &\alpha (|0 0 0\rangle + |1 1 1\rangle)(|0 0 0\rangle + |1 1 1\rangle)(|0 1 0\rangle + |1 0 1\rangle) + \\ &\beta (|0 0 0\rangle - |1 1 1\rangle)(|0 0 0\rangle - |1 1 1\rangle)(|0 1 0\rangle - |1 0 1\rangle) +\end{align}

+

Answer to b)

+

One should always do the same operator measurements no matter what error have been acquired. The operators for detecting $X$ error are $Z_1 Z_2$, $Z_2 Z_3$, $Z_4 Z_5$, $Z_5 Z_6$, $Z_7 Z_8$, $Z_8 Z_9$. After measuring all these $6$ operators one obtains for each of them either $0$ or $1$. $00,00,10$ syndrome measurement is wrong (I guess there is a typo in the exercise). The true syndrome is $00,00,11$ and that means only $Z_7 Z_8$ and $Z_8 Z_9$ operator measurements yielded $1$ indicating that the $X$ error has been acquired on $8$ qubit. One can apply a $X$ gate to the same (errored) $8$th qubit in order to correct the error. Here is the circuit for all mentioned $6$ operator measurements (note that there are $6$ measurements).

+

Answer to c)

+

With this error-correcting code, we always assume that we have only one qubit error. If there are two qubit errors then this technique with its syndrome may indicate to do something that will not correct the error. In this example, $00, 00, 01$ indicates (wrongly, because our assumption of one qubit error is not true for this error example) that $9$th qubit has got an error.

+
+

I think the main question here is how to do operator measurement for the syndrome. If I am correct then I suggest asking separately a question with a focus on this matter (with maybe this title "How to do $ZZ$ operator measurement for Shor's 9 qubit code?").

+",9459,,9459,,9/26/2020 21:04,9/26/2020 21:04,,,,4,,,,CC BY-SA 4.0 +13923,2,,13920,9/26/2020 20:30,,2,,"

The justify= parameter might help.

+
qc.draw('mpl', reverse_bits=True, justify='right')
+
+

+

Other option is to add the barrier and then remove them from the plot (though that will skip all the barriers)

+
...
+qc.barrier(range(4))
+qc.h(3)
+qc.rx(-pi/2, 0)
+qc.draw('mpl', reverse_bits=True, plot_barriers=False)
+
+

+",1859,,1859,,9/26/2020 20:37,9/26/2020 20:37,,,,1,,,,CC BY-SA 4.0 +13924,2,,13921,9/26/2020 20:58,,1,,"

Let me show an example for grouping for this Hamiltonian:

+

$$H = 5 \cdot XI + 3 \cdot XZ - 2 \cdot YI + 1.5 \cdot IY$$

+

The expectation value:

+

$$\langle H \rangle = 5 \cdot \langle XI \rangle + 3 \cdot \langle XZ \rangle - 2 \cdot \langle YI \rangle + 1.5 \cdot \langle IY \rangle$$

+

Here I will group them in this way: the first group $XI$ and $XZ$, the second group $YI$ and $IY$. Note that (it is important) the members of the same group should commute with each other. Also, I should mention that this is not the only way of grouping.

+

+

For the first circuit:

+

\begin{align} +&\langle X I \rangle = p(\text{00 or 01 measurements}) - p(\text{10 or 11 measurement}) +\\ +&\langle X Z \rangle = p(\text{00 or 11 measurements}) - p(\text{10 or 01 measurement}) +\end{align}

+

For the second circuit:

+

\begin{align} +&\langle Y I \rangle = p(\text{00 or 01 measurements}) - p(\text{10 or 11 measurement}) +\\ +&\langle I Y \rangle = p(\text{00 or 10 measurements}) - p(\text{01 or 11 measurement}) +\end{align}

+

where $p$ denotes a probability of a measurement outcome described in parenthesis. The main idea here is: For a given Pauli term $P$ the expectation value is equal to:

+

$$\langle P \rangle = p_+ - p_-$$

+

where $p_+$ ($p_-$) is the probability of having an eigenstate that has eigenvalue $+1$ ($-1$). More details about this can be found in this answer about expectation value estimation. About why $HS^{\dagger}$ is applied in the second circuit can be understood from this answer.

+",9459,,9459,,9/26/2020 21:17,9/26/2020 21:17,,,,2,,,,CC BY-SA 4.0 +13925,1,13926,,9/27/2020 15:11,,2,436,"

In the Simulating Molecules using VQE section of the Qiskit textbook it states an accuracy of $0.0016$ Hartree between the exact and VQE results with Hartree energy values of $-1.86712098$ and $-1.80040360007339$ for the ground state of $H_2$, respectively.

+

How is $0.0016$ computed? and is it an error metric similar to absolute error?

+",12248,,,,,9/27/2020 15:29,How is the Hartree accuracy calculated between the exact and VQE results?,,1,0,,,,CC BY-SA 4.0 +13926,2,,13925,9/27/2020 15:29,,3,,"

I think you may have misread the section - the document says:

+
+

When noise mitigation is enabled, even though the result does not fall within chemical accuracy (defined as being within 0.0016 Hartree of the exact result), it is fairly close to the exact solution.

+
+

So, the VQE result is not within chemical accuracy, but it is fairly close to chemical accuracy.

+

How is this number derived? As stated on Wikipedia:

+
+

Chemical accuracy is the accuracy required to make realistic chemical predictions and is generally considered to be 1 kcal/mol or 4 kJ/mol. To reach that accuracy in an economic way it is necessary to use a series of post-Hartree–Fock methods and combine the results.

+
+

So, if you convert kcals to Hartrees and mols to molecules, you yield about 0.00159 hartrees/molecule, exactly what IBM says.

+",8343,,,,,9/27/2020 15:29,,,,0,,,,CC BY-SA 4.0 +13927,2,,13919,9/27/2020 21:16,,1,,"

To roll up some of the comments thread, initially we can consider letting our state have $N=2$ qubits entangled in one of the Bell states corresponding to a uniform superposition of the positive sum of $M=2$ of the four "universal set" basis states on $2$ qubits, say:

+

$$\vert\Phi^+\rangle=\frac{1}{\sqrt{2}}(\vert 00\rangle+\vert 11\rangle).$$

+

Flipping both qubits together brings us to:

+

$$\frac{1}{\sqrt{2}}(\vert 11\rangle+\vert 00\rangle);$$

+

i.e. the same state.

+

Alternatively we could consider acting on another Bell state, say:

+

$$\vert\Phi^-\rangle=\frac{1}{\sqrt{2}}(\vert 00\rangle-\vert 11\rangle).$$

+

However, such a mapping provides:

+

$$\frac{1}{\sqrt{2}}(\vert 11\rangle-\vert 00\rangle)=-\vert\Phi^-\rangle,$$

+

which is the same up to a global phase.

+

Thus, the bit-flip/$\mathsf{CNOT}$ operation does not simply move from a superposition of a subset of the basis states to the corresponding complementary subset of basis states; indeed, the states may already be in an eigenstate of the $\mathsf{CNOT}$ operation(s).

+

The OP's idea of partitioning a superposition into two sets and "flipping between" them runs against the BBBV theorem, which limits how easy it can be to find quick solutions to blackbox problems; it also might run against the no cloning theorem, which limits the ability to copy unknown states.

+

Another quick way to see the same is to consider a state such as the uniform superposition over all basis states - there the "complementary" set is null; thus, it would not make sense to flip between two complimentary sets.

+",2927,,,,,9/27/2020 21:16,,,,3,,,,CC BY-SA 4.0 +13928,1,13931,,9/27/2020 22:25,,1,152,"

I've successfully run the $LiH$ VQE simulation detailed in Simulating Molecules using VQE using the statevector_simulator, however when attempting to run the same simulation on the quantum_instance(detailed in the same section) using the NoiseModel for ibmq_manhattan the simulation seems to run indefinitely without yielding results.

+

Is it expected that the quantum_instance simulation would be significantly longer ($>100\times$) than the statevector_simulator simulation?

+

Note: I'm using the following optimizer and variational form:

+
optimizer = SPSA(maxiter=100)
+var_form = EfficientSU2(qubitOp.num_qubits, entanglement="linear")
+
+",12248,,55,,10/5/2020 13:39,10/5/2020 13:39,Why is local qasm simulation taking so long for VQE?,,1,0,,,,CC BY-SA 4.0 +13929,1,,,9/27/2020 22:27,,2,110,"

Given a superposition of states "B" which is a subset of the suoerposition "A" of all possible states of a set of qbits, is there a quantum operation that produces superposition $R= B^C$, the complementary subset of "A", and in the process necessarily destroys "B", to avoid violating the no cloning theorem? If not, is there an operation that can produce an approximate complement ${B^C}(Approx)$?

+

Edit 1: @tsgeorgios has demonstrated in a comment that the proposed operation is not unitary in the general case, so wouldn't be possible in general. However, this challenge may be analogous to the challenge of cloning a superposition, which can't be done in general, but can be closely approximated if the set A of states are linearly independent. That means if there are N qbits, there can only be N states in the superposition A. Though cumbersome, any method for approximating the complement of information encoded in B would be potentially useful.

+",13320,,13320,,9/28/2020 1:17,9/28/2020 1:17,Is there a quantum operation that can transform a superposition of states into its complement?,,0,6,,,,CC BY-SA 4.0 +13930,1,13939,,9/27/2020 22:56,,2,57,"

I was reading a textbook and I encountered this question. I was wondering why we don't consider $M^\dagger$ instead of $M^{T}$, so I didn't show this relation, could you please help me to show below relation?

+

Let $M: \mathcal{H}^{\tilde{A}} \rightarrow \mathcal{H}^{B}$ be a linear map and denote its transpose map by $M^{T}: \mathcal{H}^{\tilde{B}} \rightarrow \mathcal{H}^{A}$. Show that +$$ +I \otimes M\left|\phi_{+}^{A \tilde{A}}\right\rangle=M^{T} \otimes I\left|\phi_{+}^{\tilde{B} B}\right\rangle +$$ +where $\left|\phi_{+}^{\tilde{A} A}\right\rangle:=\sum_{y=1}^{|A|}|y y\rangle^{\tilde{A} A}$ and $\left|\phi_{+}^{\tilde{B} B}\right\rangle:=\sum_{y=1}^{|B|}|y y\rangle^{\tilde{B} B}$ and these are maximally entangled states.

+",13340,,55,,9/28/2020 17:27,9/28/2020 17:27,What linear map is needed for acting on a maximally entangled state?,,1,0,,,,CC BY-SA 4.0 +13931,2,,13928,9/27/2020 22:57,,1,,"

statevector simulator is a perfect/ideal simulation. It basically just manipulate the quantum state according to linear algebra. qasm_simulator with or without noise model is a shot based simulation that mimic the behavior of the device.

+

In other words, you can think of statevector simulator as performing a 1 shot experiment, whereas qasm_simulator is performing multiple shots simulation, hence it will take longer.

+

Note that as you go up in size, statevector simulation is not ideal... as you will run into memory problem... since you have to generate the entire Hamiltonian matrix and manipulate it. Whereas qasm simulator allows you to do this faster by not generating the entire Hamiltonian matrix.

+",9858,,,,,9/27/2020 22:57,,,,1,,,,CC BY-SA 4.0 +13932,1,13935,,9/28/2020 4:09,,4,348,"

I am looking for a proof that any unitary matrix can be written as:

+

$$U = e^{-iH}$$

+

where $H$ is some Hamiltonian with bounded norm. That is $$||H||_{2} = O(1).$$

+",1351,,55,,10/5/2020 13:40,10/5/2020 13:40,Proof that any unitary can be written as $U=e^{-iH}$ with $H$ Hamiltonian with bounded norm,,1,0,,,,CC BY-SA 4.0 +13933,1,13934,,9/28/2020 5:14,,2,331,"

I have two questions on UCCSD in qiskit, please see the code below.

+
import numpy as np
+from qiskit.chemistry.components.variational_forms import UCCSD
+from qiskit.chemistry.drivers import PySCFDriver, UnitsType
+from qiskit.chemistry import FermionicOperator
+from qiskit.aqua import QuantumInstance
+def get_qubit_op( atom , basis , map_type ):
+    driver = PySCFDriver(atom=atom, unit=UnitsType.ANGSTROM, 
+                         charge=0, spin=0, basis=basis)
+    molecule = driver.run()
+    repulsion_energy = molecule.nuclear_repulsion_energy
+    num_particles = molecule.num_alpha + molecule.num_beta
+    num_spin_orbitals = molecule.num_orbitals * 2
+    ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)
+    qubitOp = ferOp.mapping(map_type=map_type, threshold=0.00000001)
+#     qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)
+    shift = repulsion_energy
+    return qubitOp, num_particles, num_spin_orbitals, shift
+atom='H .0 .0 .0; H .0 .0 0.74'
+qubitOp, num_particles, num_spin_orbitals, shift = get_qubit_op( atom , basis = 'sto3g' , map_type = 'parity' )
+num_qubits = qubitOp.num_qubits
+print( 'num_qubits = ' , num_qubits ) 
+from qiskit.chemistry.components.initial_states import HartreeFock    
+init_state = HartreeFock( num_spin_orbitals , num_particles , 'parity' , two_qubit_reduction=False )
+# setup the variational form for VQE
+from qiskit.chemistry.components.variational_forms import UCCSD
+var_form_vqe = UCCSD(
+        num_orbitals=num_spin_orbitals,
+        num_particles=num_particles,
+        initial_state=init_state,
+        qubit_mapping='parity' , 
+        two_qubit_reduction = False
+    )
+print( 'var_form_vqe.num_parameters = ' , var_form_vqe.num_parameters )
+var_form_vqe.construct_circuit([1,1,1]).draw() # Give some random para
+
+

The outputs are (without the plot of the circuit)

+
num_qubits =  4
+var_form_vqe.num_parameters =  3
+
+

My questions are

+

1.
+Why there are only 3 free parameters in UCCSD? Since I have 4 spin-orbs, I should expect there are at least 4^4 free parameters from the double excitation operators?

+

2. +Is there a way to see which operators are involved in UCCSD? I plot out the circuit, but there are “Evolution^1” block involved. If I use “decompose().“, it shows all the 1 and 2 qubit operations? Would it be possible to show something in between, by which I mean for example adding barrier for the decomposed circuit, or showing which fermionic excitation operators are involved? +Many thanks!

+",9816,,55,,10/5/2020 13:40,10/5/2020 13:40,On number of parameters and operators in UCCSD in qiskit,,1,0,,,,CC BY-SA 4.0 +13934,2,,13933,9/28/2020 6:14,,1,,"

Since UCCSD is a particle- and spin-conserving variational form, the number of parameters does not only depend on the number of spin orbitals but also their "nature". What I mean by that is that you also need to consider these conservation rules which leads to the following scenario in your case:

+

H2 has 2 electrons in 2 molecular orbitals, which correspond to 4 spin orbitals (and, thus, 4 qubits since you do not apply any reductions, here). Taking into account the spin-conservation you have the following possible single excitations:

+
0 -> 1
+2 -> 3
+
+

where I use Qiskit's notation in which spin orbitals are ordered block-wise (i.e. first all alpha orbitals, then all beta ones). If the spin was not conserved, then you would also see excitations such as 0 -> 3 and 1 -> 2.

+

The double excitations are a little bit simpler in this case because there is only one possibility regardless:

+
0, 1 -> 2, 3
+
+

However, if the example was more complex, the same reasoning would apply here, too.

+

Regarding your second question: if you would like to see the excitation lists as I have written them above you can take a look at the single_excitations and double_excitations attributes of the UCCSD class. +I am not aware of any "partial" decompose() functionality which could otherwise provide that you describe above.

+",13342,,,,,9/28/2020 6:14,,,,6,,,,CC BY-SA 4.0 +13935,2,,13932,9/28/2020 6:53,,11,,"

Since $U$ is a normal matrix, the spectral theorem applies, i.e. we can write +$$ +U=\sum_n\lambda_n|\lambda_n\rangle\langle\lambda_n|, +$$ +where $\lambda_n$ are the eigenvalues, and $|\lambda_n\rangle$ are the eigenvectors. Moreover, since $UU^\dagger=I$, we know that $|\lambda_n|^2=1$, and thus we can write $\lambda_n=e^{-i\theta_n}$ for $\theta_n$ in the range 0 to $2\pi$.

+

Now, let +$$ +H=\sum_n\theta_n|\lambda_n\rangle\langle\lambda_n|. +$$ +Clearly, +$$ +e^{-iH}=U. +$$ +Also, $\|H\|_2$ is the maximum singular value of $H$. Since all eigenvalues $\theta_i$ are positive, this is just the largest of the $\theta_i$, which, being less than $2\pi$, is $O(1)$.

+",1837,,,,,9/28/2020 6:53,,,,2,,,,CC BY-SA 4.0 +13936,1,13940,,9/28/2020 6:59,,0,61,"

In qiskit backends, there is Matrix_product_state. +With this backend, I can simulate circuit for several qubits. And I found some mysterious problem about MPS. With 25,26,27 qubits, the simulating time takes really really much. So, I asked here why it happened, and I got some answer here. But I want to know more detail about this MPS part. Where can I found the information about two algorithm of MPS? Please help.

+",10028,,,,,9/28/2020 13:00,Information about two algorithms of Matrix product state,,1,0,,,,CC BY-SA 4.0 +13937,1,13938,,9/28/2020 8:38,,1,144,"

For some reason I get the following error when attempting to find the inverse of the EfficientSU2 VQE variational form:

+
+

TypeError: 'NoneType' object is not reversible

+
+

My code is as follows:

+
var_form = EfficientSU2(6, entanglement="linear")
+var_form_inv = var_form.inverse() # error thrown of this line
+
+

Is there a bug in the implementation of the inverse method? and if so how can I implement a working inverse function?

+

Note qiskit.__qiskit_version__:

+
{'qiskit-terra': '0.15.2',
+ 'qiskit-aer': '0.6.1',
+ 'qiskit-ignis': '0.4.0',
+ 'qiskit-ibmq-provider': '0.9.0',
+ 'qiskit-aqua': '0.7.5',
+ 'qiskit': '0.21.0'}
+
+",12248,,55,,10/5/2020 13:40,10/5/2020 13:40,Why is circuit inverse not working for EfficientSU2?,,1,1,,,,CC BY-SA 4.0 +13938,2,,13937,9/28/2020 9:31,,2,,"

EfficientSU2 is a BlueprintCircuit and does not populates its internal data field until you try to access them.

+

In this case, when you are calling the inverse function the data are still empty (None) and this is the error you are getting. It is probably a bug and should be fixed.

+

Nevertheless, as a workaround for now you can try:

+
var_form = EfficientSU2(6, entanglement="linear")
+# build the circuit
+var_form._build() 
+# or just print it
+print(var_form)
+var_form_inv = var_form.inverse() 
+
+",13109,,,,,9/28/2020 9:31,,,,1,,,,CC BY-SA 4.0 +13939,2,,13930,9/28/2020 12:04,,2,,"

Both states live in $ H_A \otimes H_B $. We will compute their inner product with the basis states $ |i \rangle_A | j \rangle_B $ and show that they are equal. +Indeed:

+
    +
  • $$ +\big(I \otimes M\big) |\phi_+^{AA} \rangle = \sum_{y=1}^{|A|} |y \rangle_A M|y\rangle_A \implies \\ +\langle i|_A \langle j|_B \big(I \otimes M\big) |\phi_+^{AA} \rangle = \sum_{y=1}^{|A|}\langle i|y \rangle_A \langle j|_BM|y\rangle_A = \langle j|_BM|i\rangle_A = M_{ji} $$

    +
  • +
  • $$ +\big(M^T \otimes I\big) |\phi_+^{BB} \rangle = \sum_{y=1}^{|B|} M^T|y \rangle_B |y\rangle_B \implies \\ +\langle i|_A \langle j|_B \big(M^T \otimes I\big) |\phi_+^{BB} \rangle = \sum_{y=1}^{|B|}\langle i|_A M^T |y\rangle_B \langle j|y \rangle_B = \langle i|_A M^T |j\rangle_B = \big(M^T\big)_{ij} = M_{ji} $$

    +
  • +
+",13109,,,,,9/28/2020 12:04,,,,0,,,,CC BY-SA 4.0 +13940,2,,13936,9/28/2020 13:00,,1,,"

The performance issue that you see occurs in the measurements at the end of your circuit. Until then there is only one algorithm.

+

The statevector simulator (note - statevector - not MPS) has an optimization, that is applied when all measurement gates are at the end, and the simulation is not noisy. With this optimization, we perform only 1 shot, even if the user asked say for 1000 shots. We generate counts for 1000 shots from the probabilities at the end.

+

The MPS simulator cannot have this optimization, therefore for 1000 shots you'll have to apply the measurement gates 1000 times. Therefore, when there are many shots, it is preferable to convert from MPS to statevector for the measurement part. Note that this conversion is expensive, so should not happen for a small number of shots.

+

Here is a link to the closed pull request that introduced this conversion: https://github.com/Qiskit/qiskit-aer/pull/808

+

There is also an issue that you can track, following your query: https://github.com/Qiskit/qiskit-aer/issues/944

+",7659,,,,,9/28/2020 13:00,,,,0,,,,CC BY-SA 4.0 +13941,2,,8923,9/28/2020 16:39,,2,,"
+

So is there any way to implement a circuit which has a parameter which varies from shot to shot?

+
+

Short answer is "no".

+

The shots are there to allow probabilistic results. They are not meant to have different parameters.

+

As suggested, you could send a job with several circuits (one circuit per parameter selection) in a single experiment.

+",1859,,,,,9/28/2020 16:39,,,,0,,,,CC BY-SA 4.0 +13942,1,13947,,9/28/2020 17:59,,1,169,"

When running the VQE simulation for $H_2$ over a range of distances as detailed in the Simulating Molecules using VQE section of the Qiskit Textbook, the VQE energy deviation from the exact energy increases with distance as shown in the figure below: +

+

How is this relation($Error \propto distance$) explained and how can it's effects be minimized?

+

My VQE code is as follows:

+
distances = np.arange(0.2, 5, 0.5) # for a finer exact_energies plot run with step of 0.1
+exact_energies = []
+vqe_energies = []
+
+optimizer = SPSA(maxiter=1000)
+
+for dist in distances:
+    molecule = "H .0 .0 -" + str(dist) + "; H .0 .0 " + str(dist)
+    driver = PySCFDriver(atom = molecule, unit=UnitsType.ANGSTROM, charge=0, spin=0, basis='sto3g')
+    qmolecule = driver.run()
+    num_particles = qmolecule.num_alpha + qmolecule.num_beta
+    qubitOp = FermionicOperator(h1=qmolecule.one_body_integrals, h2=qmolecule.two_body_integrals).mapping(map_type='parity')
+    qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)
+    
+    result = NumPyEigensolver(qubitOp).run()
+    exact_energies.append(np.real(result.eigenvalues))
+    
+    var_form = EfficientSU2(qubitOp.num_qubits, entanglement="linear")
+    vqe = VQE(qubitOp, var_form, optimizer)
+    vqe_result = np.real(vqe.run(backend)['eigenvalue'])
+    vqe_energies.append(vqe_result)
+
+

I expected the error to be very low as maxiter = 1000. Also note the backend is a statevector_simulator.

+",12248,,55,,10/5/2020 13:40,10/5/2020 13:40,Why is there a significant variation between the exact and VQE energy results?,,2,1,,,,CC BY-SA 4.0 +13943,1,14716,,9/28/2020 20:48,,4,108,"

I am trying to ascertain a precise understanding of the relationship between the quantum query model of complexity and the quantum circuit model of complexity. Specifically, is there an established mapping between these two models of complexity?

+

I have yet to find a precise account of their relationship, but my reading of work by Yao (1993) is that they are polynomially related. Is this the extent of our understanding? Is it even sensible for a mapping between these two models of complexity to exist or should we be satisfied in the notion that they address two separate sets of questions (i.e. different tools for different jobs)?

+

I've considered that perhaps we may view the quantum circuit complexity as a component of the query complexity in that it might be used to establish the complexity of an quantum oracle as implemented in practice. While not a mapping, is that a plausible way of connecting the two or are there additional considerations?

+

P.S. I was not able to find a non-paywalled version of Yao's paper, if anyone has one they could link for the purpose of this question that would be excellent.

+",1937,,1937,,10/6/2020 16:43,11/19/2020 7:17,What is the relationship between quantum circuit and quantum query complexities?,,1,0,,,,CC BY-SA 4.0 +13944,1,,,9/28/2020 22:38,,1,157,"

Consider an unrealistic 2-qubit plus 1 ancilla bit-flip error correction code (images generated by quirk), where I know by some means or other that an error may have happen on qubit0 (represented by the octagon)

+

+

First, qubit1 is entangled with q0, then after the potential error, calculate the parity on q2 (the ancilla), and then apply a CNOT to q0.

+

Now I know that my ancilla MUST be either |0> or |1> because of how it has been prepared, independent of the initial state of q0. Does that mean I can perform the parity measurement classically, and get the same result? i.e.:

+

+

Are these two circuits completely equivalent? Or is there some subtlety of collapsing the entangled state that I am missing? Does the initial state of q0 matter? What if q0 is already entangled with some other qubit (not shown)?

+",13347,,55,,10/6/2020 4:52,10/6/2020 4:52,Is there any difference between a quantum- and classically-controlled gate if I know my basis?,,1,0,,,,CC BY-SA 4.0 +13945,2,,13942,9/28/2020 23:12,,1,,"

I managed to resolve the issue; I'm not sure if this applies to the other VQE optimizers(e.g. SLSQP) but by placing optimizer = SPSA(maxiter=1000) inside the loop in order to re-initialize for each iteration of distance the issue(i.e. $Error∝distance$) is resolved.

+",12248,,,,,9/28/2020 23:12,,,,0,,,,CC BY-SA 4.0 +13946,2,,13944,9/29/2020 1:26,,1,,"

Be cautious using logic like "it must be A or B, both of which imply C, therefore C" when dealing with quantum circuits. It can fail if A, B, or C don't commute (e.g. Hardy's paradox).

+

Personally, I would say the reason the circuit works is because of the no communication theorem and the deferred measurement principle. By the no communication theorem, operations you apply to the third qubit at the end of the circuit cannot affect measurement statistic over other qubits (note that I'm assuming you're not going to do any other multiqubit operations with the third qubit that you're not showing). So you can introduce a measurement operation on the third qubit at the end of the circuit. Then, by the deferred measurement principle, this measurement commutes with controls, so you can measure before the controlled operation instead of after.

+",119,,,,,9/29/2020 1:26,,,,2,,,,CC BY-SA 4.0 +13947,2,,13942,9/29/2020 6:55,,1,,"

The reason why you don't have the concave curve is because you are not taken into account of the nuclear repulsion (energy shift) term.

+

Note that the electronic Hamiltonian (using Born-Oppenheimer approximation) is:

+

$$ H = -\sum_i \dfrac{\nabla^2_{r_i}}{2} - \sum \dfrac{Z_i}{|R_i - r_j|} + \sum \dfrac{1}{|r_i - r_j|} + \sum \dfrac{Z_iZ_j}{|R_i - R_j|} $$

+

Since the nuclei are fixed, the last term is a constant. This term is the nuclear repulsion. You must add it in at the end to get the electronic ground state energy.

+
+

As to why you get better result at some distance compare to other is because of the structure of your var_form. You used the same var_form for every geometric configuration here. But in reality, a var_form might be good at one geometry configuration and bad at a different geometry configuration. +This is because you don't expect that single circuit structure can prepare an arbitrary quantum state... At some distance, the state might be more entangled, and the var_form you picked might not be suffice to generate that state.

+",9858,,,,,9/29/2020 6:55,,,,2,,,,CC BY-SA 4.0 +13948,1,13965,,9/29/2020 11:17,,4,316,"

I have been trying to implement QAOA with classical optimization of the angles $\gamma$ and $\beta$, but I I'm failing at the classical part.

+

In paper Quantum Approximate Optimization Algorithm: Performance, Mechanism, and Implementation on Near-Term Devices QAOA works with variational parameters $\gamma$ and $\beta$ which are first chosen randomely and afer thar is in a loop of 3 steps.

+

Step1. Simulating $\langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$ with the Quantum Computer.

+

Step2. Measure in the Z basis. And getting $\langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$.

+

Step3. Use a classical optimizesers to calculate new angles $\gamma$ and $\beta$. +In the paper it says that $F_p(\vec{\gamma},\vec{\beta}) = \langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$ is maximized.
+My Questions are:

+
    +
  1. How does the measured expectiaon Value from step 2 is involved in the classical optimization?
  2. +
  3. Are the old $\gamma$ and $\beta$ involved in the classical optimization?
  4. +
  5. Are step 1 and step 2 only done once? Becuase then the measurement in step 2 will be very unreliable.
  6. +
  7. How is the function $F_p(\vec{\gamma},\vec{\beta}) = \langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$ written classicaly so that a classical optimizer can work with is?
  8. +
  9. Is there a paper where this is explained or programmed?
  10. +
+",11646,,12643,,10/2/2020 10:02,10/2/2020 10:02,How does the classical optimization of the angles $\gamma$ and $\beta$ in QAOA work?,,1,1,,,,CC BY-SA 4.0 +13949,1,,,9/29/2020 12:54,,3,93,"

Now I'm focusing on quantum simulation (especially on classical supercomputers), but I saw there exist so many simulators. Is there any criteria to judge which is the best? +https://www.quantiki.org/wiki/list-qc-simulators

+

Also, I'm doing some research on simulation approaches and read some papers, including: +https://arxiv.org/abs/1805.01450, +https://arxiv.org/abs/1802.06952, +and some others. I found that in these papers, they do not use the simulator toolkit in https://www.quantiki.org/wiki/list-qc-simulators, so I'm wondering which simulator should I follow now?

+",11765,,55,,10/8/2020 17:54,10/8/2020 17:54,What is the best approach for classically simulating quantum devices?,,2,0,,,,CC BY-SA 4.0 +13950,2,,13949,9/29/2020 14:30,,2,,"

I think it really depends on what you want from your program and in which language you want to work and if you might want to run it on real quantum hardware. +The latter I would go for qiskit or cirq.

+

But if you just want to go for a fast simulation there might be an advantage in C or C++. +In general you can test the runtimes quite good by for example simulating the Q-FT in the different simulators.

+",13353,,,,,9/29/2020 14:30,,,,0,,,,CC BY-SA 4.0 +13951,1,,,9/29/2020 15:43,,0,239,"

I've been running VQE experiments locally using both the statevector_simulator and qasm_simulator, however I've noticed that the runtimes for the qasm_simulator are significantly longer than that of statevector_simulator. According to this answer the statevector_simulator produces ideal/deterministic results, whereas qasm_simulator produces non-ideal/probabilistic results. However I don't see why the simulation times should differ significantly($>\times 100$) if the number of shots=1 for the qasm_simulator even if a NoiseModel or measurement_error_mitigation_cls=CompleteMeasFitter is used.

+

Is this in fact expected and how is it explained?

+",12248,,,,,2/26/2021 17:08,Why is the local qasm_simulator significantly slower than the statevector_simulator?,,1,0,,,,CC BY-SA 4.0 +13952,2,,13949,9/29/2020 16:19,,3,,"

The best simulator depends heavily on the structure of the circuit you are working with.

+

In the supremacy experiment we used qsim for state vector simulation. It has hand-rolled vectorized assembly to make applying arbitrary two qubit gates very fast. But it uses space exponential in the number of qubits, so circuits covering the entire chip were too large to store in memory.

+

We also used qsimh, which is a tensor network simulator. It can cut the circuit into pieces and solve each piece separately. It has cost exponential in the number of operations crossing the cut. It can scale out to a large number of qubits... as long as you can find good cuts. In practice this means the two qubit operations need some form of locality and the circuit depth needs to be low. When testing we would purposefully weaken circuits by removing a few key operations crossing cuts, so they could be simulated.

+

Another extremely useful form of simulator is a stabilizer circuit simulator. These simulators scale to hundreds of thousands of qubits with no limits on depth, but only support stabilizer operations (yes H, yes S, yes CNOT, no T, no Toffoli). Or, to be more accurate, their time cost increases exponentially for each non-Clifford operation you use.

+",119,,,,,9/29/2020 16:19,,,,0,,,,CC BY-SA 4.0 +13953,2,,13951,9/29/2020 17:03,,1,,"

Note that if you use qasm_simulator with shots=1, this doesn't tell you anything! Unless IBM automatically switch your simulator to statevector_simulator if you specify the shots =1 when calling qasm_simulator.

+

Now in term of add noise model and doing measurement_error_mitigation. To be able to do this, you need to generate $2^n$ basis states and measure each of them to create a calibration matrix. It is an expensive procedure since you have many more quantum circuits to execute. Each circuit requires a certain amount of shots, up to 8192 shots. In statevector_simulator, you don't need to do this as there is no noise.

+",9858,,,,,9/29/2020 17:03,,,,0,,,,CC BY-SA 4.0 +13954,2,,13893,9/29/2020 17:52,,1,,"

This seems to be a bug on the Circuit_state_fn. I added a Issue on the aqua github repo: https://github.com/Qiskit/qiskit-aqua/issues/1276, thus in order to solve the problem you should pass the if statement on circuit_state_fn.py:

+
if not np.all(np.abs(statevector) == statevector):
+            # TODO maybe switch to Isometry?
+            raise ValueError('Qiskit circuit Initializer cannot handle non-positive statevectors.')   
+
+",12095,,,,,9/29/2020 17:52,,,,0,,,,CC BY-SA 4.0 +13955,1,,,9/29/2020 20:06,,3,368,"

The VQE.run method only takes a quantum_instance of type QuantumInstance or BaseBackend and NOT IBMQBackend. How then can I run VQE experiments on actual IBMQ Backends rather than just locally using a qasm_simulator with the NoiseModel of an IBMQBackend.

+",12248,,55,,10/2/2020 14:10,10/2/2020 14:10,How to run VQE experiments on IBMQ Backends?,,2,0,,,,CC BY-SA 4.0 +13956,1,,,9/29/2020 20:45,,1,257,"

I have been running VQE experiments locally using the qasm_simulator with actual IBMQBackend NoiseModels as shown in the Qiskit Textbook. I have noticed that the simulation runtimes for certain backends(e.g. ibmq_vigo - 5 qubits/ibmq_rome - 5 qubits) are significantly faster than others which in fact seem to run indefinitely and do not finish executing(e.g. ibmq_manhattan - 65 qubits/ibmq_montreal - 27 qubits).

+

Noting that I am running the same VQE experiments on all 4 NoiseModels I do not understand why this extreme simulation runtime variation exists.

+

How is this explained? and if not immediately resolvable would using the NoiseModel for ibmq_vigo in tandem with the coupling map of say ibmq_manhattan in the case that the desired VQE variational form exceeds 5 qubits(i.e. the number of qubit on ibmq_vigo) - e.g. VQE on $BeH_2$ - result in faster execution?

+",12248,,12248,,10/3/2020 11:51,10/28/2022 5:06,Why do the qasm_simulator runtimes vary significantly for different IBMQ CouplingMap/NoiseModels?,,1,0,,,,CC BY-SA 4.0 +13957,2,,13955,9/29/2020 22:04,,1,,"

BaseBackend is the abstract base class all backend classes inherit from, so IBMQBackend is actually a BaseBackend.

+",12195,,,,,9/29/2020 22:04,,,,1,,,,CC BY-SA 4.0 +13958,1,13964,,9/30/2020 0:19,,6,232,"

Let $\newcommand{\ket}[1]{\lvert#1\rangle}\{\ket{u_k}\}_k,\{\ket{v_k}\}_k\subset\mathcal H$ be orthonormal bases in an $N$-dimensional space. It then follows that the state +$$\ket\Psi = C\sum_{k=1}^N \ket{u_k}\otimes\ket{v_k}\tag1$$ +is maximally entangled (where $C$ is a normalisation constant). +Or more generally, it means that $|\Psi\rangle$ has rank $N$ (which if the embedding space is larger does not correspond to a maximally entangled state).

+

Does the opposite direction hold? In other words, if we know that a state $\ket\Psi$ is maximally entangled and can be written as (1), can we conclude that $\langle u_j|u_k\rangle=\langle v_j|v_k\rangle=\delta_{jk}$? +Equivalently, suppose $\ket\Psi$ has the form in (1) with $\{\ket{u_k}\}_k,\{\ket{v_k}\}_k$ not orthogonal. Can $\ket\Psi$ then be maximally entangled?

+

More generally, suppose $\dim\mathcal H=M$ with $M>N$ (the vectors are not a basis). If $|\Psi\rangle$ is as in (1), can it have rank $N$ even if $\{\ket{u_k}\}_k,\{\ket{v_k}\}_k$ are not orthogonal?

+

For example, in the simplest case with $M=2$ and $N>M$, the question is whether a state of the form +$$\frac{1}{\sqrt{2(1+\Re[\langle u_1|u_2\rangle\langle v_1|v_2\rangle])}} \left(\ket{u_1}\otimes\ket{v_1}+\ket{u_2}\otimes\ket{v_2}\right)$$ +can be maximally entangled (or more precisely, have Schmidt coefficients $(1/\sqrt2,1/\sqrt2,0,...,0)$) even if $\langle u_1|u_2\rangle,\langle v_1|v_2\rangle\neq0$.

+
+

I'll show here that it is crucial that both bases are non-orthogonal for this to be possible.

+

If only one of the two sets, say $\{\ket{v_k}\}_k$, is orthonormal, then the matrix of coefficients of $\ket\Psi$, write it with $\Psi$, has the form $\Psi = U \sqrt D V^T$, where $U,V$ are the matrices whose columns equal $\ket{u_k}$ and $\ket{v_k}$, respectively, and $D$ is diagonal. The orthonormality of $\{\ket{v_k}\}_k$ (and thus of $\{\ket{\bar v_k}\}_k$) then implies that +$$\Psi\Psi^\dagger = UDU^\dagger,$$ +which tells us that the Schmidt coefficients of $\ket\Psi$ majorize the diagonal of $\sqrt{D}$. E.g. if $D$ is a multiple of the identity then $\Psi\Psi^\dagger \simeq UU^\dagger\neq I$, and thus $\ket\Psi$ is not maximally entangled.

+

This would seem to suggest that, if at least one of the bases is orthonormal, then indeed $\ket\Psi$ is maximally entangled only if the other basis is also orthonormal. +But this still leaves open the possibility of it being possible when both bases are not orthonormal.

+
+

Here is an example of a pair of non-orthogonal states $|\psi\rangle$ and $|\phi\rangle$ such that $|\psi\psi\rangle+|\phi\phi\rangle$ has rank 2. Define +\begin{align} +2\sqrt2 \ket\psi &= \ket1 + (2+i)\ket2 - \ket3 + i \ket4, \\ +2\sqrt2 \ket\phi &= \ket1 + i\ket2 + (1-2i)\ket3 - i \ket4. +\end{align} +Let $\ket\Psi\equiv (\ket{\psi\psi}+\ket{\phi\phi})/\sqrt{3/2}$. +You can then verify that the corresponding matrix of coefficients is +$$C = \frac{1}{2\sqrt{6}}\begin{pmatrix} + 1 & 1+i & -i & 0 \\ + 1+i & 1+2 i & 0 & i \\ + -i & 0 & -1-2 i & -1-i \\ + 0 & i & -1-i & -1 +\end{pmatrix}.$$ +As can be readily checked, the only non-vanishing eigenvalue of $C^\dagger C$ is a two-fold degenerate $+1/2$, hence $\ket\Psi$ has rank $2$.

+

It's possible that this is only possible because the states live in a larger space, i.e. $M=4$ but $N=2$. I'm wondering if there is a good way to understand why this can happen, and if it possible also when $N=M$.

+",55,,55,,10/1/2020 14:00,10/2/2020 11:00,"Can $|\Psi\rangle\simeq\sum_k |u_k\rangle|v_k\rangle$ be maximally entangled even if $\{|u_k\rangle\}_k,\{|v_k\rangle\}_k$ are not orthonormal?",,2,0,,,,CC BY-SA 4.0 +13959,2,,13955,9/30/2020 5:06,,0,,"

Please find here a code for using IBM Q backend for VQE.

+

Note that the code was tested in IBM Quatum Lab at IBM Q website.

+
provider = IBMQ.load_account() #your IBM Q account
+backend = provider.backends(name = 'ibmq_ourense')[0] #getting IBM Q Backend
+
+#connect IBM backend to VQE
+vqe_solver = MinimumEigenOptimizer(VQE(quantum_instance = backend))
+
+#solve a problem (qubo is variable with QUBO problem which construction is not a part of this code)
+vqe_results = vqe_solver.solve(qubo) 
+
+",9006,,,,,9/30/2020 5:06,,,,5,,,,CC BY-SA 4.0 +13961,1,,,9/30/2020 7:57,,1,199,"

I wish to initalise the state $\rho=(1-\frac{p}{2})|0\rangle \langle0|+\frac{p}{2}|1\rangle\langle1|$, where p is some measure of decoherence. This is a mixed state. There are some suggestions on here for how to implement this with ancilla qubits and extra gates. However I am now trying to run a quantum circuit with this as my initial state on the actual IBM quantum computers. The problem is that to intialise two qubits in this state requires 6 ancilla qubits using my current approach, meaning I have to use the Melbourne quantum computer which has moderately high gate error rates. It also increases my circuit depth. In order to simplify my circuit I tried something like this

+
r=random.choices([0,1],weights=(1-p/2,p/2),k=1)
+    r.append((r[0]+1)%2)
+    circuit2 = QuantumCircuit(3,3);
+    circuit2.initialize(r,0)
+    circuit2.initialize(r,1)
+
+

Although this is statistically correct over many runs it does not give what I want. In each run of the quantum circuit (say 1000 shots), the same intial state is used for all 1000 shots. Is there any way I can make it so that the circuit reevaluates what the initial state should be for each shot?

+

I do not wish to have to set the number of shots to 1 and evaluate the circuit thousands of times, as the queue time to get my circuit evaluated would be huge.

+",13261,,55,,10/2/2020 14:11,10/2/2020 14:11,Initialising impure density matrices,,1,1,,,,CC BY-SA 4.0 +13962,2,,13961,9/30/2020 8:04,,2,,"

Why do you need 6 ancilla qubits? Surely you'd just produce the two-qubit state +$$ +\sqrt{1-p/2}|00\rangle+\sqrt{p/2}|11\rangle +$$ +by starting with two qubits in $|00\rangle$, performing a single qubit unitary that maps $|0\rangle\rightarrow \sqrt{1-p/2}|0\rangle+\sqrt{p/2}|1\rangle$ (this is a $Y$ rotation of a suitable angle), and then perform a controlled-not controlled from that qubit, targeting the other. The reduced density matrix of either qubit is then what you want (but you should only use one of the two qubits in subsequent measurements etc).

+",1837,,1837,,9/30/2020 8:21,9/30/2020 8:21,,,,8,,,,CC BY-SA 4.0 +13963,2,,13958,9/30/2020 8:47,,3,,"

Some thoughts; I am not $100\%$ sure yet and will revisit:

+

A bi-partite (pure) state $|\Psi\rangle \in \mathcal{H}_{A} \otimes \mathcal{H}_{B}$ is maximally entangled if the reduced state in either $\mathcal{H}_{A}$ or $\mathcal{H}_{B}$ is the maximally mixed state.

+

Suppose we have a state +\begin{equation} +|\hat{\Psi}\rangle = C \sum_{k=1}^{N}|u_{k}\rangle \otimes |v_{k}\rangle, +\end{equation} +where $\{|u_{k}\rangle\}$ and $\{|v_{k}\rangle\}$ may or may not be orthonormal. Lets assume that they are at least normalized.

+

Furthermore, let $\{|a_{j}\rangle\}$ be an orthonormal basis for $\mathcal{H}_{A}$. +The reduced state $\rho_{B} = \mathrm{tr}_{A}\big[|\hat{\Psi}\rangle\langle \hat{\Psi}|\big]$ on $\mathcal{H}_{B}$ is: +\begin{equation} +\begin{split} +\rho_{B} &= \sum_{j} \big(\langle{a_{j}}|\otimes I \big) |\hat{\Psi}\rangle\langle \hat{\Psi}| \big(|{a_{j}}\rangle\otimes I \big) \\ +&= |C|^{2}\sum_{j}\sum_{k}\sum_{k'} \langle a_{j}|u_{k}\rangle \langle u_{k'}|a_{j}\rangle \otimes |v_{k}\rangle\langle v_{k'}| \\ +&= |C|^{2}\sum_{k}\sum_{k'} \langle u_{k'}| \Big( \sum_{j}| a_{j}\rangle\langle a_{j} |\Big) |u_{k}\rangle |v_{k}\rangle\langle v_{k'}| \\ +&= |C|^{2}\sum_{k}\sum_{k'} \langle u_{k'}| I |u_{k}\rangle |v_{k}\rangle\langle v_{k'}|. \\ +\end{split} +\end{equation} +If we put the $\{|u_{k}\rangle\}$ and $\{|v_{k}\rangle\}$ in matrices $U$ and $V$: +\begin{equation} +\begin{split} +U &= \begin{bmatrix}|u_{1}\rangle & |u_{2}\rangle \cdots |u_{n}\rangle\end{bmatrix} \\ +V &= \begin{bmatrix}|v_{1}\rangle & |v_{2}\rangle \cdots |v_{n}\rangle\end{bmatrix} +\end{split} +\end{equation} +we get for: +\begin{equation} +U^{\dagger}U = \begin{bmatrix} \langle u_{1}|u_{1}\rangle & \cdots & \langle u_{1}|u_{n}\rangle \\ . & \ddots & . \\ +\langle u_{n}|u_{1}\rangle & \cdots & \langle u_{n}|u_{n}\rangle \\\end{bmatrix} = I + \hat{D}_{U} +\end{equation} +for some off-diagonal (Hermitian, likely sparse) matrix $\hat{D}_{U}$. We can do the same for $V$, getting $\hat{D}_{V}$

+

That allows us to write for $\rho_{B}$:

+

\begin{split} +\rho_{B} &= |C|^{2}\sum_{k}\sum_{k'} \langle u_{k'} |u_{k}\rangle |v_{k}\rangle\langle v_{k'}|\\ +&= |C|^{2}\sum_{k}\sum_{k'} |v_{k}\rangle \langle u_{k'} |u_{k}\rangle \langle v_{k'}|\\ +&= |C|^{2}VU^{\dagger}UV^{\dagger} \\ +\end{split}

+

The question is now when this is or is not equal to the maximally mixed state i.e. $|C|I$ (note that the normalisation factor is different because we're in a smaller space!). We know, since $\{|u_{k}\rangle\}$ and $\{|v_{k}\rangle\}$ are in fact bases, both $U$ and $V$ are invertible, such that $\rho_{B} = |C|^{2}VU^{\dagger}UV^{\dagger}= |C|I$ implies that: +\begin{equation} +U^{\dagger} U = V^{-1} (V^{\dagger})^{-1} = (V^{\dagger}V)^{-1} +\end{equation} +up to some normalisation factor. +Lets investigate the three (without loss of generality) options:

+
    +
  • The bases $\{|u_{k}\rangle\}$ and $\{|v_{k}\rangle\}$ are orthonormal. +Then, $U^{\dagger}U = V^{\dagger}V = I$ and the state is maximally entangled, as expected.

    +
  • +
  • $\{|u_{k}\rangle\}$ is, but $\{|v_{k}\rangle\}$ isn't orthonormal. +Then, $U^{\dagger}U = I \not = V^{\dagger}V$. This shows that if only one of the bases is orthonormal, the state cannot be maximally entangled.

    +
  • +
  • Both $\{|u_{k}\rangle\}$ and $\{|v_{k}\rangle\}$ aren't orthonormal. Then, $U^{\dagger}U,V^{\dagger}V \not = I $. The state might still be maximally entangled, as long as $U^{\dagger}U$ is the inverse of $V^{\dagger}V$, or in other words: $|C|U^{\dagger}UV^{\dagger}V = I$. +We can say a little more: +\begin{equation} +\begin{split} +I &= |C|U^{\dagger}UV^{\dagger}V\\ +&= |C|(I + \hat{D}_{U})(I + \hat{D}_{V}) \\ +&= |C|I + |C|\hat{D}_{U} + |C|\hat{D}_{V} + |C|\hat{D}_{U}\hat{D}_{V} \\ +\end{split} +\end{equation} +Both $\hat{D}_{U}$ and $\hat{D}_{V}$ are purely anti-diagonal, which means that their product $\hat{D}_{U}\hat{D}_{V}$ has diagonal elements that are equal to $1-|C|$. The off-diagonal terms need to cancel out; in higher dimensions this could get messy.

    +
  • +
+

Some extra thoughts about the bi-partite case

+

For a bi-partite state (and thus $\hat{D}_{U}\hat{D}_{V}$ purely diagonal) we get that $\hat{D}_{U} = -\hat{D}_{V}$, which means that

+

$$\langle u_{1}|u_{2}\rangle = - \langle v_{1}|v_{2}\rangle.$$

+

Moreover, for the bi-partite state we also get $\frac{1}{2}I = I + \hat{D}_{U}\hat{D}_{V}$ so that

+

$\hat{D}_{U}\hat{D}_{V} = -\frac{1}{2}I$ which leads to +$$\langle u_{1}|u_{2}\rangle \langle v_{2}|v_{1}\rangle = \langle u_{2}|u_{1}\rangle \langle v_{1}|v_{2}\rangle = -\frac{1}{2}.$$

+

You can combine this to say that $\langle v_{1}|v_{2}\rangle\langle v_{2}|v_{1}\rangle = \langle u_{1}|u_{2}\rangle\langle u_{2}|u_{1}\rangle = \frac{1}{2}$. This puts quite strong constraints on the bases. +Essentially, the bases provided by Daftwullies answer seem to be (up to permutations and some extra phases) the only ones.

+

An example after Daftwullies answer

+

The relation $U^{\dagger}UV^{\dagger}V = I$ can very well be met even if $U$ and $V$ are not unitary; we have (for the bases Daftwullie came up with):

+

\begin{equation} +\begin{split} +U &= \begin{bmatrix} \sqrt{2} & 1 \\ 0 & 1 +\end{bmatrix} \\ +V &= \begin{bmatrix} \sqrt{2} & -1 \\ 0 & -1 +\end{bmatrix} \\ +\end{split} +\end{equation}

+

which can be readily checked to obey $U^{\dagger}U V^{\dagger}V = I$:

+

\begin{equation} +\begin{split} +U^{\dagger}UV^{\dagger}V &= \begin{bmatrix} \sqrt{2} & 0 \\ 1 & 1 +\end{bmatrix} \begin{bmatrix} \sqrt{2} & 1 \\ 0 & 1 +\end{bmatrix} \begin{bmatrix} \sqrt{2} & 0 \\ -1 & -1 +\end{bmatrix} \begin{bmatrix} \sqrt{2} & -1 \\ 0 & -1 +\end{bmatrix} \\ +&= \begin{bmatrix} 2 & \sqrt{2} \\ \sqrt{2} & 2 +\end{bmatrix} \begin{bmatrix} 2 & -\sqrt{2} \\ -\sqrt{2} & 2 +\end{bmatrix} \\ +&\sim I +\end{split} +\end{equation}

+

The states also obey the above equations for the inner products in the bi-partite case.

+

Old incorrect analysis

+

Now I first wrote the text below, but this is actually incorrect. After the answer of DaftWullie it became clear that there actually are examples of this. My error in the below derivation is that the Frobenius inner product $2\langle VV^{\dagger}, V\hat{D}_{U}V^{\dagger}\rangle$ does not bear a square, and can therefore be negative. That means that the inequality actually does not hold.

+
+

I don't actually think that this is possible under the assumption that +all states need to be normalized. (which means, if you recall, that +$U^{\dagger}U = I + \hat{D}_{U}$ with that identity being, well, the +identity).

+

We already had $U^{\dagger}U = I + \hat{D}_{U}$, so that (using the +Frobenius norm): $$||U^{\dagger}U||^{2} = ||I + \hat{D}_{U}||^{2} =||I||^{2} + ||\hat{D}_{U}||^{2} + 2\langle I,\hat{D}_{U}\rangle_{F} = ||I||^{2} + ||\hat{D}_{U}||^{2} \geq ||I||^{2},$$ where $\langle I, \hat{D}_{U}\rangle_{F}$ is the Frobenius inner product, which is zero +here because $\hat{D}_{U}$ is by definition traceless. Moreover, the +inequality becomes strict when $\hat{D}_{U}$ is non-empty and +therefore $||\hat{D}_{U}|| > 0$ (the Frobenius norm is a norm). This +is only true if the basis encoded in $U$ is non-orthogonal.

+

For our relation $\rho_{B} = I = VU^{\dagger}UV^{\dagger} = V(I + +> \hat{D}_{U})V^{\dagger} = VV^{\dagger} + V\hat{D}_{U}V^{\dagger}$, we +get:

+

\begin{equation} \begin{split} ||I||^{2} &= ||VU^{\dagger}UV^{\dagger}||^{2} = ||VV^{\dagger} + V\hat{D}_{U}V^{\dagger}||^{2} \\ &= ||VV^{\dagger}||^{2} + ||V\hat{D}_{U}V^{\dagger}||^{2} + 2\langle VV^{\dagger},V\hat{D}_{U}V^{\dagger}\rangle \\ &\geq ||VV^{\dagger}||^{2} + + ||V\hat{D}_{U}V^{\dagger}||^{2} \\ & = ||I ||^{2} + || + \hat{D}_{V}||^{2} + ||V\hat{D}_{U}V^{\dagger}||^{2} \\ & \geq ||I + ||^{2} + ||V\hat{D}_{U}V^{\dagger}||^{2} \\ \end{split} \end{equation}

+

with the second bound only an equality if $||\hat{D}_{V}|| = 0$, which +is not the case if the basis encoded in $V$ is not orthogonal. So +in that case we have $||I||^{2} \geq ||I||^{2} + || \hat{D}_{V}||^{2} +> + ||V\hat{D}_{U}V^{\dagger}||^{2} > ||I||^{2}$, which is a contradiction. We have to conclude that $\hat{D}_{V}$, and conversely +$\hat{D}_{U}$ are zero, which means that the bases must be orthogonal.

+
+",8141,,8141,,10/2/2020 11:00,10/2/2020 11:00,,,,10,,,,CC BY-SA 4.0 +13964,2,,13958,9/30/2020 9:42,,6,,"

To my surprise, your statement is not true. Consider the qubit example: +$$ +|\Psi\rangle=|00\rangle-|++\rangle. +$$ +This is clearly of the correct form but with non-orthogonal states (in case you're worrying about the negative sign, we put $|u_2\rangle=|+\rangle$ and $|v_2\rangle=-|+\rangle$). However, it is maximally entangled. To see this, we expand it out: +$$ +|\Psi\rangle=\frac12\left(|00\rangle-|01\rangle-|10\rangle-|11\rangle\right)=\frac{1}{\sqrt{2}}(|0-\rangle+|1+\rangle), +$$ +which is equivalent under local unitaries (Hadamard on the second qubit) to the Bell state, and hence maximally entangled.

+",1837,,1837,,10/2/2020 8:33,10/2/2020 8:33,,,,1,,,,CC BY-SA 4.0 +13965,2,,13948,9/30/2020 10:54,,4,,"
    +
  1. $\langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$ is basically the function evaluation step during the optimization. If you use a gradient-free optimizer, then it uses this information to drive its search.

    +
  2. +
  3. Depending on the optimizer if it needs them to update the parameters.

    +
  4. +
  5. You seem confused between the simulation and measurement part. $\langle \psi_p(\gamma,\beta)|H|\psi_p(\gamma,\beta)\rangle$ is the expression you want to optimize. But with a real quantum computer, you can only estimate it by doing many measurements (you get bitstrings which serve as candidates) and averaging the corresponding energies. So you need many measurements if you want a higher precision for that estimate.

    +
  6. +
  7. It is not written. As said in 3, you estimate it. The optimizer uses that information in its optimization process.

    +
  8. +
  9. There are many tutorials on many platforms such as Cirq or Pennylane.

    +
  10. +
+",4127,,,,,9/30/2020 10:54,,,,1,,,,CC BY-SA 4.0 +13966,2,,13912,9/30/2020 13:06,,1,,"

I am not sure if this anwers your question but I think this all boils down to whether one can we efficiently implement $QFT_{\mathbb{Z}_N}$ when $N$ is not a power of $2$. In this case we can no longer implement the $QFT$ using the standard gate construction one sees often. However, for any $N$ we can approximately implement $QFT_{\mathbb{Z}_N}$ using the following trick (from section 4.4 of Andrew Childs notes).

+

Recall that $$F_N:=\frac{1}{\sqrt{N}}\sum_{x,y\in Z_N}\omega_N^{xy} |y\rangle \langle x|$$ is the QFT for $\mathbb{Z}_N$. Now, introduce the cyclic shift operator $$U:=\sum_{x\in Z_n} |{x+1}\rangle\langle x|,$$ and note that the eigenstates of $U$ are the basis for the the $QFT$, since $$F^*_NUF_N=\sum_{x\in \mathbb{Z}_N} (\omega^{x}_N)^{-1}|x\rangle\langle x|.$$ Then running phase estimation with on the unitary operator $U$ with $n=O(\log N)$ qubits performs the transformation $$|\tilde{x}\rangle |0\rangle \mapsto |\tilde{x}\rangle |\widetilde{(\omega^{x}_N)^{-1}}\rangle,$$ where $|\tilde{x}\rangle$ is an eigenstate of $U$, and $\widetilde{(\omega^{x}_N)^{-1}}$ is an $n$-bit approximation of the eigenvalue corresponding to $|\tilde{x}\rangle$. Now observe that if we run the circuit in reverse, we can effectively remove the undesired phase from the eigenstates of $U$, leaving us with the same states that would be output by the transformation $F_N$. Because the phase estimation algorithm is efficient i.e. $O(poly(n))$, it follows that this method is efficient with complexity $O(poly(\log N))$.

+

With this method in hand one can decompose any abelian group into a product of such cyclic groups and use this approach on each factor (see section 6 of Childs notes). This is the essence of how one could use a quantum computer to solve the discrete log problem (a variant of hidden subgroup) for a general abelian group.

+",11793,,11793,,9/30/2020 17:06,9/30/2020 17:06,,,,0,,,,CC BY-SA 4.0 +13967,1,,,9/30/2020 13:24,,1,285,"

I am bit confused with calculating the overall state of a quantum gate and the individual wire states.

+

For example, lets say there are two Qubits, where Q1 is in $\frac{1}{\sqrt{2}}(\vert 0\rangle + \vert 1\rangle)$ state and Q2 is in $\vert 0\rangle$ state. Then we have CNOT gate controlled by Q1 on Q2 followed by a Hadamard gate at the Q1 gate.

+

Just after the CNOT gate the total state of the system is $\frac{1}{\sqrt{2}}(\vert 00\rangle+\vert 11\rangle)$.

+

Then applying the Hadamard gate gives us: $\frac{1}{2}(\vert 00\rangle+\vert 10\rangle+ \vert 01\rangle - \vert 11\rangle)$. As you can see, we get four possibilities of states.

+

What if I perform the calculations on individual wires? i.e.

+
    +
  1. We perform Hadamard on the first Q1 bit, $\frac{1}{\sqrt{2}}(\vert 0\rangle + \vert 1\rangle)$ state which gives us $\vert 0\rangle$ state
  2. +
  3. Then for the Q2, apply CNOT which gives $\vert 0\rangle$
  4. +
  5. Then we calculate the overall state which is $\vert 00\rangle$
  6. +
+

But then we do not get the same answer as before. Are we allowed to calculate like this or am I doing something wrong here?

+

Thanks!

+",13294,,5669,,10/1/2020 8:15,10/1/2020 8:15,Calculation of the system states and the individual wire states in a quantum circuit,,2,3,,,,CC BY-SA 4.0 +13968,2,,13967,9/30/2020 13:43,,1,,"

You cannot do this. I don't quite understand how you think step 1 reduces from $(|0\rangle+|1\rangle)/\sqrt{2}$ to $|0\rangle$. Perhaps you're assuming some statistical sampling of measurement outcomes. But the whole point of a quantum computation is to get interesting interference between different components, so you cannot just drop components. You need them.

+",1837,,,,,9/30/2020 13:43,,,,3,,,,CC BY-SA 4.0 +13969,1,,,9/30/2020 14:15,,2,118,"

I tried to implement an extended Heisenberg-Hamiltonian as an extra exercise further than my homework.

+

My Hamiltonian is the following: $H = \sum_{NN} \sigma_x\sigma_x + \sigma_z\sigma_z$

+

I try to implement this in Cirq on a GridQubit-square with 4 qubits.

+

Following problem: +I calculated the ground state via the matrices analytically and tried to implement the problem in a circuit:

+
    +
  1. I used cirq.XXPow- Gates and cirq.ZZPow Gates and cirq.XPow, cirq.ZPow.
  2. +
  3. I used an if condition to determine if I measure in Z,Y or X basis. In Z, I append just the measurement, In Y I append X**0.5 to the circuit and in X, I append a Hadamard-Gate.
  4. +
  5. Now I let the simulator run and get the probabilities and signs from the histograms. I sum the probabilities times the sign.
  6. +
  7. Now I sum the expectation values in X-, Y- and Z-basis and use a classical optimizer.
  8. +
+

My problem is that this does not work properly. Either the expectation value is way too big or way too small.

+

Where is my error in reasoning?

+

I think I did something wrong with the mechanism.

+",13353,,23,,10/2/2020 22:35,10/2/2020 22:35,Wrong Expectation value when implementing a VQE for the Heisenberg Hamiltonian,,0,3,,,,CC BY-SA 4.0 +13970,2,,13967,9/30/2020 14:39,,1,,"

The point is that the CNOT gate with qubit 1 as control and qubit 2 as target and the Hadamard gate on qubit 1 (and identity gate on qubit 2) do not commute. The order you do them in does matter! In your second circuit, you are doing the Hadamard before the CNOT.

+

This non-commutativity can be explicitly verified by showing that the matrices

+

$$CNOT = \begin{pmatrix} 1& 0& 0 & 0 \\ +0& 1& 0 & 0 \\ +0& 0& 0 & 1 \\ +0& 0& 1 & 0 \end{pmatrix}$$

+

and

+

$$H\otimes I = \begin{pmatrix} 1& 0& 1 & 0 \\ +0& 1& 0 &1 \\ +1& 0& -1 & 0 \\ +0& 1& 0 & -1 \end{pmatrix}$$

+

do not commute.

+",5669,,,,,9/30/2020 14:39,,,,4,,,,CC BY-SA 4.0 +13972,2,,1385,9/30/2020 16:44,,1,,"

Grover's Algorithm uses 2 simple tricks to search an unordered database (like a phonebook that contains names and phone numbers but not in alphabetical order). It inputs an equal superposition of all possible entries and searches the database in one operation. When it finds the matching entry, it marks it by flipping the sign of the wavefunction of this entry. At this point you have a wavefunction that's an equal superposition of all but one entry with a positive sign and one entry with a negative sign. +Even though you've marked the entry, you haven't accomplished anything at this point, because you have to measure something to see your answer. Since the probability of picking any particular answer is determined by the square of it's wavefunction, the fact that one particular part of the wavefunction does you know good. i.e., if the wave function contains 9 entries with wavefunction 1/10 and one entry with wavefunction -1/10, you're probability for picking the correct entry (the one marked with the minus sign) is no better than the probability of picking one of the incorrect answers. +So you need to do something to increase the wavefunction value for the correct answer. The trick you use is a simple mathematical operation called "inversion about the mean". If you have 9 values of 1/10 and 1 value of -1/10 and you calculate the mean, it will be just a little less than 1/10. If you calculate the difference between each individual entry and the mean, it will be a very small number for 9 of the entries and a larger difference from the mean for the one entry. Inversion about the mean allows you to create an new wavefunction where 9 of the entries have small values and 1 entry's value is larger. It turns out that inversion about the mean can be written as a unitary matrix (i.e., it's an operation that can be implemented on a quantum computer). Since a large database has many wrong answers and only one correct answer, most likely one pass through the "inversion about the mean" operation will not magnify the wavefunction of your desired answer enough to outweigh the total value of the probabilities of all the undesired answers. Therefore, rather than just going through this inversion posses once, you create a loop that takes it through the inversion several times, each time increasing the wavefunction amplitude of the correct answer and descreasing the amplitude of the undesired answers. It turns out if you go through the loop too many times, it starts to backfire on you, therefore, there's an optimal number of times through the loop to get the greatest chance of measuring the correct answer.

+",13359,,,,,9/30/2020 16:44,,,,0,,,,CC BY-SA 4.0 +13973,1,13975,,9/30/2020 18:49,,-1,90,"

My understanding of the inner product is that it multiplies a vector by the conjugate transpose, but I don't understand why the conjugate transpose of $|+\rangle$ is $\frac{1}{\sqrt2}(\langle0| + \langle1|)$.

+",12442,,9006,,10/1/2020 8:18,10/1/2020 8:18,Why is a conjugate transpose of $|+\rangle$ a vector $1/\sqrt{2} (\langle0| + \langle1|)$?,,1,5,,,,CC BY-SA 4.0 +13975,2,,13973,9/30/2020 20:52,,3,,"

The complex conjugation flips the sign of the imaginary part of a complex number. Transposition exchanges the row and column co-ordinates of a value in a matrix. A vector can be thought of as a matrix with 1 column and a certain amount of rows. The conjugation of this takes it to it's row form, which for a vector $|\psi\rangle$, becomes $\langle\psi|$.

+

Now you have $\frac{1}{\sqrt{2}}|0\rangle+|1\rangle$.$\frac{1}{\sqrt{2}}$ is real, so complex conjugation does nothing. However, $|0\rangle+|1\rangle$ become $\langle0|+\langle1|$.

+

So overall, you get $\frac{1}{\sqrt{2}}(\langle0|+\langle1|)$

+",4991,,,,,9/30/2020 20:52,,,,0,,,,CC BY-SA 4.0 +13976,1,,,10/1/2020 6:45,,1,52,"

+

Why do we have just one line here in c0 and not 2?

+",13363,,55,,10/6/2020 4:55,10/6/2020 4:55,ClassicalRegister gives out just one line instead of two,,1,1,,,,CC BY-SA 4.0 +13978,2,,11966,10/1/2020 8:05,,0,,"

Most probably IBMQ.load_account() was missing in your code!
+I was able to reproduce the same error message by removing IBMQ.load_account() from my code.

+

A working example would be something like this:

+
IBMQ.load_account()
+
+provider = IBMQ.get_provider('ibm-q')
+qdevice = provider.get_backend('ibmq_16_melbourne')
+job = execute(qc, backend= qdevice)
+result = job.result()
+
+",9318,,,,,10/1/2020 8:05,,,,0,,,,CC BY-SA 4.0 +13979,2,,13976,10/1/2020 8:07,,1,,"

By default, Qiskit visualization bundles together classical bits of the same register. If you would like to draw them separately, do

+
qr = QuantumRegister(2)
+cr = ClassicalRegister(2)
+
+circ = QuantumCircuit(qr, cr)
+circ.draw('mpl', 
+          cregbundle=False)
+
+

+",13109,,,,,10/1/2020 8:07,,,,0,,,,CC BY-SA 4.0 +13980,2,,12901,10/1/2020 13:11,,3,,"

Since it hasn't been mentioned so far, and I think it's an interesting aspect: A weighted ensemble $(p_i,U_i)$ of unitaries in $U(d)$ such that +$$ +\sum_i p_i U_i X U_i^\dagger = \operatorname{tr}(X) \mathbb{I}/d, +$$ +is called a weighted unitary 1-design. If the weights can be chosen uniformly, i.e. $p_i \equiv 1/N$ where $N$ is the size of the ensemble, this reduces to the definition of a "normal" unitary 1-design.

+

There are many examples for unitary 1-designs:

+
    +
  1. Unitary 1-designs are exactly tight operator frames with frame constant $N/d$
  2. +
  3. In particular, any orthogonal operator basis of unitaries is a unitary 1-design, e.g. the Weyl operators
  4. +
  5. In fact any irreducible unitary representation of a group is a unitary 1-design, e.g. the Heisenberg-Weyl (=generalised Pauli) and Clifford group.
  6. +
  7. For any large enough Haar-random ensemble of unitaries there are weights such that the above equation holds with high probability.
  8. +
+",2305,,2305,,10/2/2020 9:27,10/2/2020 9:27,,,,0,,,,CC BY-SA 4.0 +13981,1,,,10/1/2020 15:03,,1,75,"

I found this example code in Qiskit documentation.

+

Does this code signify that it is simulating noise as per the IBM Valencia quantum chip. If yes, what kinds of noise does it simulate? I executed the code below in the quantum lab and analyzed noise in qubit measurement in various quantum machines.

+
from qiskit import QuantumCircuit, execute
+from qiskit import IBMQ, Aer
+from qiskit.visualization import plot_histogram
+from qiskit.providers.aer.noise import NoiseModel
+provider = IBMQ.load_account()
+backend = provider.get_backend('ibmq_valencia')
+noise_model = NoiseModel.from_backend(backend)
+
+coupling_map = backend.configuration().coupling_map
+
+basis_gates = noise_model.basis_gates
+
+circ = QuantumCircuit(3, 3)
+circ.h(0)
+circ.cx(0, 1)
+circ.cx(1, 2)
+circ.measure([0, 1, 2], [0, 1, 2])
+
+result = execute(circ, Aer.get_backend('qasm_simulator'),
+                 coupling_map=coupling_map,
+                 basis_gates=basis_gates,
+                 noise_model=noise_model).result()
+counts = result.get_counts(0)
+plot_histogram(counts)
+
+",13172,,55,,12/30/2021 18:43,12/30/2021 18:43,Noise model for 3 Qubit $|GHZ \rangle$ state measurement circuit,,1,0,,,,CC BY-SA 4.0 +13982,2,,11943,10/1/2020 17:09,,3,,"

Below you'll find a brief and simple example. I also recommend that you read A Tutorial on Formulating and Using QUBO Models as it covers the topic in more detail.

+
+

Example using switches

+

So your idiot sibling fancies themselves an electrician, and rewired your house's climate control system while you were out. Lucky for you, there are only two switches and three devices, so you don't actually have to use a quantum computer to figure it out. However, the principle is the same for any number of switches and devices.

+

Problem: Which switches do you need to flip to produce the maximum amount of heat?

+

You traced the wiring and found that one switch is wired to a heater producing 2W of heat, the other to a heater producing 3W, and both switches are wired to a cooler that drains 8W of heat when both switches are on.

+

To solve this problem using a QUBO, first you set it up as a polynomial: +$$ +h = 2x_1 + 3x_2 - 8x_1x_2 +$$

+

Our switches are represented as binary variables $x_1$and $x_2$, and $h$ is the total heat in watts.

+

Next you put the factors into a matrix. The multiplier of each term is placed at the coordinate in the matrix corresponding to its index in $x$, where the origin is top left.

+
    +
  • $2x_1 = 2x_1x_1$, so the $2$ it goes in the top left corner at $(1,1)$. Note that $x_a = x_ax_a$ becuase $x_a$ is in $\{0, 1\}$.
  • +
  • Similarly, $3x_2 = 3x_2x_2$ so the $3$ goes in the bottom right corner at $(2,2)$.
  • +
  • For $-8x_1x_2 = -8x_2x_1$ you get the two coordinates $(1,2)$ and $(2,1)$. Divide the $-8$ by two, then put each half at a coordinate. This produces a symmetric QUBO matrix.
  • +
+

This is what our final matrix looks like: +$$ +\begin{bmatrix} +2 & -4\\ +-4 & 3 +\end{bmatrix} +$$

+

Now you can find your answer by maximizing $y$ in +$$ +y = x^tQx +$$ +where $x^t$ is $x$ transposed and $Q$ is the QUBO matrix.

+

Answer: $x_1 = 0, x_2 = 1$, i.e. the first switch should be off and the second switch should be on.

+

We can put these values into the calculation: +$$ +\begin{bmatrix} +0 & 1 +\end{bmatrix} +\begin{bmatrix} +2 & -4\\ +-4 & 3 +\end{bmatrix} +\begin{bmatrix} +0\\ +1 +\end{bmatrix} += 3 +$$

+

You can try other combinations of $x$, but you will find that $3$ is indeed the maximum possible value. Obviously this trial and error would be much more time-consuming for larger matrices.

+

Note that $h = y$ here since we didn't separate out any common factors or offsets when we created our QUBO matrix, but in general you should feed the answer into the polynomial we created instead to obtain the maximal value.

+",2903,,,,,10/1/2020 17:09,,,,0,,,,CC BY-SA 4.0 +13985,1,,,10/1/2020 20:31,,4,285,"

There are a few people who ask how to calculate IBM's "quantum volume", but it's not clear what the actual mathematical definition of this is. In the answers here, people just point to running some program, which is not helpful for understanding or comparing with other technologies.

+

Is there a straightforward way of calculating this for a simple system?

+

For example, if I have n-1qubit gates with efficiency of 1, m-2qubit gates with efficiency B, and complete connectivity between qubits - what would my quantum volume be?

+",2660,,55,,10/6/2020 4:56,10/6/2020 4:56,Is there a straightforward way to calculate the quantum volume for simple systems?,,2,0,,,,CC BY-SA 4.0 +13986,2,,13985,10/1/2020 21:32,,2,,"

I believe the calculation steps are quite complex to give a simple formula or even to follow it by hand.

+

Maybe this medium article and the cited paper gives you a better general understanding.
+As you can see in the article and paper, QV takes into account various factors other than error rates e.g. calibration and circuit optimization.

+
+

IBM successfully ran this exact test to achieve a Quantum Volume of 64 on its 27 qubit “Montreal” system — and the test didn’t even require building a new device. Instead, the team incorporated improvements to the Qiskit compiler, refined the calibration of the two-qubit gates, and issued upgrades to the noise handling and readout based on tweaks to the microwave pulses and gates before they’re applied in the circuit.

+
+

Other paper

+
+

This +metric takes into account all relevant hardware parameters. This includes the performance parameters (coherence, calibration errors, crosstalk, spectator errors, gate +fidelity, measurement fidelity, initialization fidelity) as +well as the design parameters such as connectivity and +gate set. It also includes the software behind the circuit optimization.

+
+

The simplest explanation from medium article would be:
2 to the power of the depth of the largest square circuit (width=depth), which you were able to run on your device successfully with greater than two-thirds probability and confidence interval greater than 97.725%, gives you QV.

+",9318,,9318,,10/1/2020 21:42,10/1/2020 21:42,,,,4,,,,CC BY-SA 4.0 +13987,1,13991,,10/1/2020 23:41,,4,230,"

This is a very specific question, which I try to implement a simple dimerized tight-binding Hamiltonian on qiskit. The model is one dimensional, and defined as

+

$$ +H = \sum_{\langle i,j\rangle} t_{ij} c^\dagger_i c_j +$$

+

where $\langle i,j\rangle$ denotes the nearest neighbor coupling with strength $t_{ij}$. The important aspect of the model is that the coupling is dimerized in the following sense. If we label the sites as 1,2,3,4...., then the nearest neighbor coupling $t_{ij}$ reads, for example,

+

$$ +t_{1,2} = 1, t_{2,3} = 2 , t_{3,4} = 1 , t_{4,5} = 2, etc +$$

+

which is alternating.

+

I try to pretend this is a molecular Hamiltonian and realize it in the same way with "FermionicOperator". However, I am not sure how to properly index the "one-body" integral here, which is the nearest neighbor coupling $t_{ij}$ here.

+",9816,,55,,10/6/2020 4:57,10/6/2020 4:57,How to realize Su-Schrieffer-Heeger model in Qiskit,,2,0,,,,CC BY-SA 4.0 +13988,1,,,10/2/2020 0:31,,1,41,"

I wish to run a very simple circuit on the qasm_simulator backend. My circuit is

+
    circuit2 = QuantumCircuit(2,2);
+    circuit2.u3(pi/2,pi,3*pi/4,1)
+    circuit2.u3(pi/2,pi,7*pi/4,0)
+    #u2
+    circuit2.cx(0,1)
+    #u3
+    circuit2.rz(3*pi/4,1)
+    #u4
+    circuit2.cx(1,0)
+    #u5
+    circuit2.ry(pi/2,0)
+    #u6
+    circuit2.cx(0,1)
+    #u7
+    circuit2.u3(0,pi*0.8252172,-pi*0.4247820,1)
+    circuit2.u3(pi/2,0,pi/2,0)
+    circuit2.measure(0,0);
+    circuit2.measure(1,1);
+
+

The circuit works as I expect and generates the output I expect but I have a question about the workings of the simulator. When I run the following code:

+
backend = BasicAer.get_backend('qasm_simulator')
+
+for x in range(10):
+    Cfin=circuit2;
+    job = execute(Cfin, backend, shots=1000)
+    res=job.result().get_counts(Cfin)
+    print(res)
+
+

I get a series of results that look something like this

+
{'11': 274, '10': 256, '01': 229, '00': 241}
+{'11': 274, '10': 256, '01': 229, '00': 241}
+{'11': 274, '10': 256, '01': 229, '00': 241}
+{'11': 274, '10': 256, '01': 229, '00': 241}
+{'11': 274, '10': 256, '01': 229, '00': 241}
+{'11': 274, '10': 256, '01': 229, '00': 241}
+{'10': 241, '01': 224, '00': 286, '11': 249}
+{'11': 240, '01': 246, '10': 233, '00': 281}
+{'11': 240, '01': 246, '10': 233, '00': 281}
+{'11': 240, '01': 246, '10': 233, '00': 281}
+
+

I am curious as to why the simulator returns identical results for a few runs in a row. This happens regularly. The simulator appears to get stuck on one particular result for a while. Does anyone know what is the cause of this? Will there be a similar issue if I try to run this code on one of the real quantum computers?

+",13261,,55,,10/6/2020 4:57,10/6/2020 4:57,qasm_simulator generating identical results repeatedly,,0,3,0,,,CC BY-SA 4.0 +13989,1,,,10/2/2020 4:45,,6,1811,"

I'm trying to profile qiskit backends and I use randomized_benchmarking provided by qiskit.ignis.

+

Initially I ran a circuit with 20 qubits 100 length on statevector_simulator, which takes around 180s and qubits can go up to 32 and then it runs out of memory. Then I tried qasm_simulator and it only takes 2s to finish and can run up to 54+ qubits.

+

Why does qasm_simulator perform so much better than statevector_simulator? Does this happen because the circuit only contains simple gates?

+",13374,,55,,10/6/2020 4:57,10/6/2020 4:57,Qiskit - difference between qasm_simulator and statevector_simulator in terms of memory and speed?,,1,0,,,,CC BY-SA 4.0 +13990,2,,13985,10/2/2020 10:08,,1,,"

To put in simple words, the quantum volume tells a maximal dimension of state space (Hilbert space) you can simulate on a quantum computer sucessfully. For example, quantum volume 64 means that you can simulate systems with 64 states, i.e. represened by 6 qubits ($6 = \log_2 64$). Moreover, maximal depth of your simulation (circuit) has to be less or equal 6.

+

Note that this is relatively rough description what the quantum volume is, however, I think it is sufficient for basic understanding what that means.

+",9006,,,,,10/2/2020 10:08,,,,1,,,,CC BY-SA 4.0 +13991,2,,13987,10/2/2020 12:58,,1,,"

I don't think it really matter how you index your $t_{ij}$. As you mentioned you can use FermionicOperator all you need to do is define the one body integral. This of course can be done in many ways. Here is a convenient way.

+
def ssh_ham(gamma, lamda, n): 
+    sigmax = np.array([[0,1],[1,0]], dtype=np.complex_)
+    sigmay = np.array([[0,-1j],[1j,0]], dtype=np.complex_)
+
+    op_eye_x = np.eye(n)
+    op_cos_x = 1/2*(np.eye(n, k=1) + np.eye(n,k=-1))
+    op_sin_x = 1j/2*(np.eye(n, k=1) - np.eye(n,k=-1))
+
+    h = np.kron(gamma*op_eye_x + lamda*op_cos_x, sigmax) + np.kron(lamda*op_sin_x, sigmay)
+
+    return h 
+
+

This function would return the one-body integral for you. In this function, the $\sigma$ degree of freedom represents the two atoms in the unit cell, and $n$ represents how many unit cells you have in the SSH chain, and for the dimmerized limit you asked for you can take $\gamma = 1,\ \lambda = 2 $. You can use the output of this function fer_op = FermionicOperator(h1 = ssh_ham(1,2,10))

+

That being said, I'm not sure what the benefit would be. Trying to solve this Hamiltonian using VQE for example is an over-kill since this Hamiltonian can be readily diagonalized from its one-body Hamiltonian. Putting this on a quantum computer would give you $2n$ qubits, this is a Hilbert space of $2^n$ dimensions, whereas you can diagonalize the the Hamiltonian by diagonalizing the $2n \times 2n$ matrix $t_{ij}$.

+",13215,,13215,,10/2/2020 18:37,10/2/2020 18:37,,,,8,,,,CC BY-SA 4.0 +13992,1,13993,,10/2/2020 13:15,,0,505,"

I like to use as custom Mixer Hamiltonian for solving the TSP using QAOA. +The mixer and cost hamiltonians are described here: https://arxiv.org/pdf/1709.03489.pdf - Chapter 5.1.

+

Therefore I need to write the custom mixer hamiltonian from equations 54 -58.

+

Here is the code:

+
import numpy as np
+from qiskit import Aer
+from qiskit.aqua import QuantumInstance
+from qiskit.quantum_info.operators import Operator, Pauli
+from qiskit.aqua.operators.list_ops import SummedOp
+from qiskit.aqua.algorithms import QAOA
+from qiskit.aqua.components.optimizers import SPSA
+from qiskit.optimization.applications.ising importtsp
+
+
+def pauli(pos, num_qubits, label):
+    label = 'I'*(pos) + label + 'I'*(num_qubits-pos-1)
+    assert(len(label) == num_qubits)
+    return Operator(Pauli(label=label))
+
+def s_plus(number_of_nodes, city, time):
+    num_qubits = number_of_nodes**2
+    qubit = time * number_of_nodes + city
+    return pauli(qubit, num_qubits, "X") + pauli(qubit, num_qubits, "Y")
+
+def s_minus(number_of_nodes, city, time):
+    num_qubits = number_of_nodes**2
+    qubit = time * number_of_nodes + city
+    return pauli(qubit, num_qubits, "X") - pauli(qubit, num_qubits, "Y")
+
+def create_mixer_operators(n):
+    """
+    Creates mixer operators for the QAOA.
+    It's based on equations 54 - 58 from https://arxiv.org/pdf/1709.03489.pdf
+    Indexing here comes directly from section 4.1.2 from paper 1709.03489, equations 54 - 58.
+    """
+    mixer_operators = []
+    for t in range(n - 1):
+        for city_1 in range(n):
+            for city_2 in range(n):
+                i = t
+                u = city_1
+                v = city_2
+                first_part = 1
+                first_part *= s_plus(n, u, i)
+                first_part *= s_plus(n, v, i+1)
+                first_part *= s_minus(n, u, i+1)
+                first_part *= s_minus(n, v, i)
+
+                second_part = 1
+                second_part *= s_minus(n, u, i)
+                second_part *= s_minus(n, v, i+1)
+                second_part *= s_plus(n, u, i+1)
+                second_part *= s_plus(n, v, i)
+                mixer_operators.append(first_part + second_part)
+    return mixer_operators
+
+seed = 10598
+n = 3
+p = 2
+num_qubits = n ** 2
+
+# Generate random tsp
+ins = tsp.random_tsp(n, seed=seed)
+
+qubitOp, offset = tsp.get_operator(ins)
+
+# Running in quantum simulation
+aqua_globals.random_seed = np.random.default_rng(seed)
+backend = Aer.get_backend('qasm_simulator')
+quantum_instance = QuantumInstance(backend, seed_simulator=seed, seed_transpiler=seed)
+mixer = create_mixer_operators(n)
+mixer_op = SummedOp(mixer)
+
+spsa = SPSA(maxiter=300)
+qaoa = QAOA(operator=qubitOp, mixer=mixer_op, p=p, optimizer=spsa, quantum_instance=quantum_instance)
+
+circuits = qaoa.construct_circuit([0]*(2*p))
+
+

When runnning it I get:

+
    ---------------------------------------------------------------------------
+AttributeError                            Traceback (most recent call last)
+<ipython-input-113-bd68aaa30bfc> in <module>
+----> 1 circuits = qaoa.construct_circuit([0]*(2*p))
+
+~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py in construct_circuit(self, parameter)
+    358             A list of the circuits used to compute the expectation value.
+    359         """
+--> 360         expect_op = self.construct_expectation(parameter).to_circuit_op()
+    361 
+    362         circuits = []
+
+~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py in construct_expectation(self, parameter)
+    331             wave_function = self.var_form.assign_parameters(param_dict)
+    332         else:
+--> 333             wave_function = self.var_form.construct_circuit(parameter)
+    334 
+    335         # Expectation was never created, try to create one
+
+~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/algorithms/minimum_eigen_solvers/qaoa/var_form.py in construct_circuit(self, parameters, q)
+     96 
+     97         evolution = EvolutionFactory.build(self._cost_operator)
+---> 98         circuit = evolution.convert(circuit)
+     99         return circuit.to_circuit()
+    100 
+
+~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/evolutions/pauli_trotter_evolution.py in convert(self, operator)
+    100         #     # Sort into commuting groups
+    101         #     operator = self._grouper.convert(operator).reduce()
+--> 102         return self._recursive_convert(operator)
+    103 
+    104     def _recursive_convert(self, operator: OperatorBase) -> OperatorBase:
+
+~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/evolutions/pauli_trotter_evolution.py in _recursive_convert(self, operator)
+    127                 return operator.primitive.__class__(converted_ops, coeff=operator.coeff)
+    128         elif isinstance(operator, ListOp):
+--> 129             return operator.traverse(self.convert).reduce()
+    130 
+    131         return operator
+
+~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/list_ops/list_op.py in traverse(self, convert_fn, coeff)
+    161             return ListOp([convert_fn(op) for op in self.oplist],  # type: ignore
+    162                           combo_fn=self.combo_fn, coeff=coeff, abelian=self.abelian)
+--> 163         return self.__class__([convert_fn(op) for op in self.oplist],  # type: ignore
+    164                               coeff=coeff, abelian=self.abelian)
+    165 
+
+~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/list_ops/list_op.py in <listcomp>(.0)
+    161             return ListOp([convert_fn(op) for op in self.oplist],  # type: ignore
+    162                           combo_fn=self.combo_fn, coeff=coeff, abelian=self.abelian)
+--> 163         return self.__class__([convert_fn(op) for op in self.oplist],  # type: ignore
+    164                               coeff=coeff, abelian=self.abelian)
+    165 
+
+~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/evolutions/pauli_trotter_evolution.py in convert(self, operator)
+    100         #     # Sort into commuting groups
+    101         #     operator = self._grouper.convert(operator).reduce()
+--> 102         return self._recursive_convert(operator)
+    103 
+    104     def _recursive_convert(self, operator: OperatorBase) -> OperatorBase:
+
+~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/evolutions/pauli_trotter_evolution.py in _recursive_convert(self, operator)
+    104     def _recursive_convert(self, operator: OperatorBase) -> OperatorBase:
+    105         if isinstance(operator, EvolvedOp):
+--> 106             if not {'Pauli'} == operator.primitive_strings():
+    107                 logger.warning('Evolved Hamiltonian is not composed of only Paulis, converting to '
+    108                                'Pauli representation, which can be expensive.')
+
+~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/evolutions/evolved_op.py in primitive_strings(self)
+     53 
+     54     def primitive_strings(self) -> Set[str]:
+---> 55         return self.primitive.primitive_strings()  # type: ignore
+     56 
+     57     @property
+
+~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/list_ops/list_op.py in primitive_strings(self)
+    126 
+    127     def primitive_strings(self) -> Set[str]:
+--> 128         return reduce(set.union, [op.primitive_strings() for op in self.oplist])
+    129 
+    130     @property
+
+~/masterarbeit/code/venv/lib/python3.6/site-packages/qiskit/aqua/operators/list_ops/list_op.py in <listcomp>(.0)
+    126 
+    127     def primitive_strings(self) -> Set[str]:
+--> 128         return reduce(set.union, [op.primitive_strings() for op in self.oplist])
+    129 
+    130     @property
+
+AttributeError: 'Operator' object has no attribute 'primitive_strings'
+
+

How do I resolve the error? This is my first project with qiskit and I am not sure where to start.

+",13376,,55,,10/6/2020 4:57,10/6/2020 4:57,Custom Mixer for QAOA: Error 'Operator' object has no attribute 'primitive_strings',,1,2,,,,CC BY-SA 4.0 +13993,2,,13992,10/2/2020 13:48,,2,,"

Operator is part of Qiskit-Terra's module quantum-info. You should use PrimitiveOp from Qiskit-Aqua.

+
from qiskit.aqua.operators import PrimitiveOp
+
+def pauli(pos, num_qubits, label):
+    label = 'I'*(pos) + label + 'I'*(num_qubits-pos-1)
+    assert(len(label) == num_qubits)
+    return PrimitiveOp(Pauli(label=label))
+
+

Note however that for composing an Operator in Aqua with another you should use @ and * for multiplying with a scalar.

+

Edit: Trying to explain the new error you are getting, i think the following is happening: At some point, the QAOA algorithm tries to build the parameterized circuit corresponding to your variatonal form as specified by the cost Hamiltonian and the mixer operator. However, the mixer is composite (defined with sums and compositions) and tries to reduce it. This causes the coeff (all Operators in Aqua have a coefficient) field to be a complex number. But then, since multiplication of a Parameter with a complex is not supported, an error is raising.

+

A simpler example may be helpful in order to see what's going wrong. +Let's say, we want to build a parameterized circuit corresponding to the evolution of $ X \otimes X $ operator (i.e $ e^{-i \beta (X \otimes X)} $). We will try two different ways. The second one will fail.

+
from qiskit.circuit import Parameter
+from qiskit.aqua.operators import X, I, EvolutionFactory, EvolvedOp
+
+def evolve(H):
+    beta = Parameter('β')
+    
+    evolution = EvolutionFactory.build(operator=beta * H)
+    eop = EvolvedOp(beta * H)
+    
+    return evolution.convert(eop)
+
+
+H = X ^ X
+print(H.coeff)
+print(type(H.coeff))
+evolve(H)
+---
+1.0
+float
+Works
+
+
+H = (X ^ I) @ (I ^ X)
+print(H.coeff)
+print(type(H.coeff))
+evolve(H)
+---
+1+0j
+complex
+TypeError: unsupported operand type(s) for *: 'complex' and 'Parameter'
+
+

Putting all this aside, as a workaround you could do the calculations on eq.58 (as already briefly explained on the orginal paper) and after eliminating some terms you get: +\begin{align*} +\frac{1}{2}H_{i, u, v} &= X_{u, i} X_{v, i + 1} X_{u, i + 1} X_{v, i} \\ +& - X_{u, i} X_{v, i + 1} Y_{u, i + 1} Y_{v, i} \\ +& + X_{u, i} Y_{v, i + 1} X_{u, i + 1} Y_{v, i} \\ +& + X_{u, i} Y_{v, i + 1} Y_{u, i + 1} X_{v, i} \\ +& + Y_{u, i} X_{v, i + 1} X_{u, i + 1} Y_{v, i} \\ +& + Y_{u, i} X_{v, i + 1} Y_{u, i + 1} X_{v, i} \\ +& - Y_{u, i} Y_{v, i + 1} X_{u, i + 1} X_{v, i} \\ +& + Y_{u, i} Y_{v, i + 1} Y_{u, i + 1} Y_{v, i} +\end{align*} +and implement this operator as your mixer (sum of 8 PauliOps).

+

For convenience, here is my implementation.

+
from itertools import combinations
+
+def mixer_operators(n):
+    
+    mixer = []
+    n_qubits = pow(n, 2)
+    
+    for i in range(n - 1):
+        for u, v in combinations(range(n), 2):
+                
+                qu = i * n + u
+                qv = i * n + v
+                
+                x = [0] * n_qubits
+                x[qu] = x[qv] = x[qu + n] = x[qv + n] = 1
+                
+                Hi = 0
+                
+                # XXXX term
+                z = [0] * n_qubits
+                pauli = Pauli(z, x)
+                pauli = PrimitiveOp(pauli)
+                
+                Hi += pauli
+                
+                
+                # YYYY term
+                z = [0] * n_qubits
+                z[qu] = z[qv] = z[qu + n] = z[qv + n] = 1
+                pauli = Pauli(z, x)
+                pauli = PrimitiveOp(pauli)
+                
+                Hi += pauli
+                
+                
+                # XXYY and similar terms (two Ys)
+                for q0, q1 in combinations([qu, qv, qu + n, qv + n], 2):
+                    z = [0] * n_qubits
+                    z[q0] = z[q1] = 1
+                    pauli = Pauli(z, x)
+                    
+                    coeff = 1
+                    if (q0, q1) in [(qu, qv), (qu + n, qv + n)]:
+                        coeff = -1                
+                    pauli = PrimitiveOp(pauli, coeff)
+                    
+                    Hi += pauli
+                
+                
+                mixer.append(2 * Hi)
+                
+    return SummedOp(mixer)
+
+",13109,,13109,,10/4/2020 11:18,10/4/2020 11:18,,,,4,,,,CC BY-SA 4.0 +13994,1,14882,,10/2/2020 15:28,,1,63,"

Are there any good resources (online courses, books, websites, etc) to study randomized algorithms that would help with an specific scope on the analysis and design of quantum algorithms?

+",12302,,55,,11/28/2020 12:26,11/28/2020 12:26,Resources on randomized algorithms for analysis and design of quantum algorithms,,1,3,,,,CC BY-SA 4.0 +13995,1,14022,,10/2/2020 18:02,,2,47,"

I would like to learn a bit on the physics and details of manufacture of a qubits based on quantum dots. Can anyone recommend some papers?

+",5620,,55,,10/6/2020 4:59,10/6/2020 4:59,What are some resources on qubits based on quantum dots?,,1,0,,,,CC BY-SA 4.0 +13996,2,,13987,10/2/2020 18:13,,1,,"

This is the code I wrote, and I do feel that the index of the single particle integral is important. Below, h1 is the single particle integral in the basis ABABAB, where A,B are the sublattices (similar to spin), and I use "unitary_matrix" to change it AAA...BBB... which is the basis for h1_qubit. The construction of "unitary_matrix" can be found in the qiskit function "FermionicOperator".

+

Now, one important checking is that the ground state energy of two Hamiltonians, one is the fermionic single particle Hamiltonian (which is h1), and one is the Hamiltonian in the qubit basis (which is qubitOp), are identical. For the latter, it is a many-body Hamiltonian, and the ground state is the many-body ground state. If we naively compare this to the "lowest energy" of h1, then we will find that they are different, for h1 is the single-particle Hamiltonian. To properly obtain the many-body ground state from h1, we need to fill all the states below the Fermi-level of the spectrum of h1. Once we have done that, we found that the two Hamiltonians give the same many-body ground state energy.

+
import numpy as np
+from scipy.linalg import eig
+from qiskit.aqua.algorithms import VQE, NumPyEigensolver
+from qiskit.chemistry import FermionicOperator
+from qiskit.aqua.operators import Z2Symmetries
+
+
+t1 = np.random.rand() # intra
+t2 = np.random.rand() # inter
+t0 = np.random.rand() # onsite energy 
+
+
+N = 4 # number of unit cell
+
+BC = 1 # BC=1 is PBC, BC=0 is OBC
+
+h1 = np.zeros( (2*N , 2*N ) )
+
+
+for i in range(0,(2*N-1)):
+    if i % 2==1:
+        h1[ i , i ] = t0
+        h1[ i , i+1 ] = t2       
+        h1[ i+1 , i ] = t2        
+    else:
+        h1[ i , i ] = -t0        
+        h1[ i , i+1 ] = t1
+        h1[ i+1 , i ] = t1        
+
+h1[2*N-1,2*N-1] = t0
+
+if BC==1:
+    h1[ 0 , 2*N-1 ] = t2
+    h1[ 2*N-1 , 0 ] = t2    
+        
+        
+print( 'The fermionic Hamiltonian is\n' , h1 ) 
+
+eigh1 = eig(h1)[0]
+
+idx = np.argsort(eigh1)
+eigh1 = eigh1[idx]
+
+print( 'The *single* particle spectrum is \n' , eigh1 )
+
+unitary_matrix = np.zeros((h1.shape), h1.dtype)
+n = unitary_matrix.shape[0]
+j = np.arange(n // 2)
+unitary_matrix[j, 2 * j] = 1.0
+unitary_matrix[j + n // 2, 2 * j + 1] = 1.0
+
+h1_qubit = unitary_matrix.dot(h1.dot(unitary_matrix.T.conj()))
+
+
+ferOp = FermionicOperator(h1=h1_qubit )
+
+qubitOp = ferOp.mapping(map_type='parity' , threshold=0.00000001)
+
+numEigenvalue = 1
+result = NumPyEigensolver( qubitOp ,  k = numEigenvalue ).run()
+eigvals = result['eigenvalues']
+eigvecs = result['eigenstates']
+print( 'The *many-body* grond state energy is \n ' , eigvals[0] )
+
+print( 'We check the *many-body* ground state energy is the same as the sum of the energy below the fermi level of the *single* particle spectrum')
+
+print( eigvals[0] - sum( eigh1[0:int(len(eigh1)/2)]))
+
+      
+
+",9816,,,,,10/2/2020 18:13,,,,0,,,,CC BY-SA 4.0 +13997,1,14005,,10/3/2020 14:05,,1,300,"

I want to run a quantum circuit many times on real hardware so that this circuit has some of the parameters that I must change them each time (some of the angles of gates must change each time). how can I run a circuit with these features on quantum experience?. can I use the "for" statement and the hardware can compile it? generally, How can I write the code for doing this work?. I would be very grateful if anyone helps me.

+",5217,,1859,,10/5/2020 12:53,10/5/2020 12:53,How can i run a quantum circuit with parameterized gates many times on quantum experience?,,2,3,,,,CC BY-SA 4.0 +13998,2,,13997,10/3/2020 16:05,,-1,,"

A simple example:

+
from qiskit import QuantumCircuit
+variable = [0.2, 0.5, 1.2, -0.4, -1.5, 1.7 ]  
+for i in range(len(variable)):
+    qc = QuantumCircuit(2,2)
+    qc.ry(variable[i],0) 
+    qc.cx([0],[1]) 
+    qc.measure([0,1], [0,1])
+    print( qc ) 
+
+",9858,,,,,10/3/2020 16:05,,,,2,,,,CC BY-SA 4.0 +13999,1,,,10/3/2020 18:23,,2,37,"

In Brassard's et al. work, the $Q$ operator is defined as

+

$$ Q =-\mathcal{A}\mathcal{S_0}\mathcal{A}^{-1}\mathcal{S_\chi}$$

+

I was wondering how is the negative sign at the leftmost side implemented within the operators in a quantum circuit? I already have a realization for $S_\chi$, $S_0$ and $\mathcal{A}$. I can think of it as a basic sign flip using a one qubit operator with -1 in the diagonals but I am not sure if that's a correct implementation.

+",12302,,1859,,10/6/2020 5:16,10/6/2020 5:16,Qiskit implementation of Brassard Amplitude implementaion's Q operator,,2,0,,,,CC BY-SA 4.0 +14000,1,14008,,10/3/2020 21:25,,4,605,"

Shor's $9$ Qubit code. Imagine that we encode the state $|\psi \rangle =α|0\rangle+β|1\rangle$ using Shor's $9$ qubit code, then an $X$ error occurs on the 8th qubit of the encoded state $|E(\psi) \rangle$

+

This is

+

$$\frac{1}{2 \sqrt2}( \alpha (| 000 \rangle + | 111 \rangle) ( | 000 \rangle + | 111 \rangle) ( | 010 \rangle + | 101 \rangle) \\ + \beta ( | 000 \rangle - | 111 \rangle)( | 000 \rangle - | 111 \rangle)( | 010 \rangle - | 101 \rangle))$$

+

We now decode the encoded state, starting by applying the bit-flip code decoding algorithm.

+

How do you find the syndromes measured by the algorithm, see https://people.maths.bris.ac.uk/~csxam/teaching/qc2020/lecturenotes.pdf?

+",4336,,55,,10/5/2020 13:41,10/5/2020 13:41,How to measure syndromes in QEC,,1,1,,,,CC BY-SA 4.0 +14001,1,14003,,10/3/2020 21:30,,1,65,"

for a student report about solving graph coloring with Grover's Algorithm, I have to talk about the performance of simulated Grover's Algorithm to solve graph coloring. I don't really know how to approach some of the points I have to talk about. I have many things to talk about :

+
    +
  • The execution time : this is hard to measure for "big" graphs like 7/8 node graphs, as the runtime can take more than half an hour and I cannot average running the same program many times. I can still do something less rigorous but do you have any tips ?
  • +
  • The resources used : this is something I really don't know how to take on. I can guess the complexity can be calculated using Big-O notation, but how do I get this on a simulated problem ?
  • +
  • Testing operations : this is something I don't know how to do, but I know there is a method for. I know my program works, but is there any rigorous testing for operations in Q# ?
  • +
  • Estimate for a quantum computer. I know there is the quantum trace simulator, however I cannot see how to provide measurement probabilities for the graph coloring problem. +This is pretty packed in big questions. This is new terrain for me so I hope someone can help. If you have more suggestions about how to test the program, I am open :).
  • +
+",8746,,,,,10/4/2020 0:15,Best way to test the performance of a simulated quantum algorithm in Q#,,1,0,,,,CC BY-SA 4.0 +14002,2,,13981,10/4/2020 0:03,,1,,"

Yes. It seems like it is indeed adding noise to mimic the noise of Valencia. As to what kind of noise, I assuming that it takes the latest calibrated data, and incorporated the T1 errors and T2 errors along with the measurement errors too. The result will be different than the hardware run since the noise occur in the hardware is much more complicated than just these indicated parameters. But it should still give us a good, comparable result.

+",9858,,,,,10/4/2020 0:03,,,,0,,,,CC BY-SA 4.0 +14003,2,,14001,10/4/2020 0:15,,2,,"
    +
  1. Validating your solution.
  2. +
+

Q# offers a variety of methods to test your code, depending on what exactly you want to test. In this case, the main part seems to be validating the oracle you implemented for graph coloring problem. In the GraphColoring kata and other oracle-focused katas we usually rely on comparison of the quantum computation result with the classically computed result for all possible basis vectors. (That's how the oracles are defined - implement them using reversible operations only so that they act properly on the basis vectors, and you're guaranteed that they'll act properly on linear combinations of those.)

+

More specifically, in the test that covers graph coloring oracle we:

+
    +
  • iterate over all possible classical inputs,
  • +
  • encode each of them as a basis state on the input qubits,
  • +
  • apply the oracle to the qubits to perform the computation,
  • +
  • read out the result,
  • +
  • and compare it to the result of the same computation done classically (i.e., validating the graph coloring classically).
  • +
  • You can also verify that the oracle application doesn't modify the input states by measuring the input qubits and verifying that their state is the same state you've encoded in the input, like we do in the RippleCarryAdder kata.
  • +
+

This doesn't guarantee that you haven't done something odd like introduce a phase or use a gate other than X and controlled-X; if you want to check for that as well, you can use Toffoli simulator instead of the typical full-state simulator: it will limit the pool of gates you can use, and give you an extra benefit of speeding up the oracle simulation.

+
+
    +
  1. Resource estimation.
  2. +
+

The other three questions are all tied to resource estimation of a quantum algorithm, so I'll bundle them together.

+

You probably don't really care about the actual runtime of a simulation on a classical computer that much, since it's not an indication of the runtime of the algorithm on a quantum computer. Small tweaks to the order in which you allocate qubits, for example, can reduce your simulation time quite dramatically without having impact on the quantum runtime, as I explored in this blog post. If you find a tweak like this, you'll probably want to report it, since it highlights interesting differences between simulation and actual quantum runtime, but otherwise I wouldn't aim for a very precise simulation runtime estimate - saying "around 35 minutes" would be fine.

+

Resource estimation is the best way to estimate the resources used without counting the gates manually. A neat way to work around the need to provide probabilities is to implement an operation that performs Grover's search loop alone (without the measurements) and to resource-estimate it, since the measurements will not add extra qubits or gates to the algorithm. Then you'll get values like the circuit depth in terms of 2-qubit gates, which will allow you to estimate the algorithm runtime on a quantum computer, once you make some assumptions about single gate speed.

+",2879,,,,,10/4/2020 0:15,,,,4,,,,CC BY-SA 4.0 +14004,1,14013,,10/4/2020 2:24,,0,88,"

Broadly speaking, can we say that quantum circuits are like Fourier Transform/Decomposition?
We use qbit like waves, tune it with quantum gates, to find answer.

https://ars.els-cdn.com/content/image/3-s2.0-B978075067444750042X-f05-16-9780750674447.gif

https://www.sciencedirect.com/topics/engineering/fourier-decomposition

https://youtu.be/spUNpyF58BY?t=106

+",8491,,55,,10/8/2020 17:49,10/8/2020 17:49,"Quantum circuit, Fourier Transform/Decomposition?",,1,2,,,,CC BY-SA 4.0 +14005,2,,13997,10/4/2020 3:08,,1,,"

You first need to pip install qiskit and get your API Token from https://quantum-computing.ibm.com/account

+

+

Then, save your token in your configuration:

+
from qiskit import IBMQ
+IBMQ.save_account('MY_API_TOKEN')
+
+

In this way, your Qiskit installation now is connected with your IBM Quantum Experience account (aka, a provider). You can list all your devices like this:

+
from qiskit import IBMQ
+
+IBMQ.load_account()
+provider = IBMQ.get_provider()
+print(provider.backends())
+
+

Choose a device in which your circuit fits and set it as backend. For example, ibmq_16_melbourne:

+
backend = provider.get_backend('ibmq_16_melbourne')
+
+

Then, create your circuit with qiskit.circuit.Parameter for the parametric part. For example, take this dummy scenario:

+
from qiskit import *
+from qiskit.circuit import Parameter 
+parameter = Parameter('x')
+
+circuit = QuantumCircuit(1)
+circuit.ry(parameter, 0)
+circuit.measure_all()
+print(circuit)
+
+
        ┌───────┐ ░ ┌─┐
+   q_0: ┤ RY(x) ├─░─┤M├
+        └───────┘ ░ └╥┘
+meas: 1/═════════════╩═
+                     0 
+
+

You can create a set of circuits using different parameters with bind_parameters:

+
from numpy import pi
+
+circuits = []
+for param in [pi/2, pi/3, pi/5]:
+    circuits.append(circuit.bind_parameters({parameter: param}))
+
+

Finally, you are ready to send the job:

+
job = execute(circuits, backend=backend)
+
+

For checking the results, you have to wait until the job is done:

+
job.wait_for_final_state()
+
+for idx, param in enumerate([pi/2, pi/3, pi/5]):
+    print(param, job.result().get_counts(idx))
+
+
1.5707963267948966 {'1': 504, '0': 520}
+1.0471975511965976 {'0': 770, '1': 254}
+0.6283185307179586 {'0': 918, '1': 106}
+
+",1859,,1859,,10/4/2020 3:20,10/4/2020 3:20,,,,3,,,,CC BY-SA 4.0 +14006,2,,13999,10/4/2020 6:30,,1,,"

The minus sign is a global phase. It can be ommited in case of operator $Q$ itself, however, it has to be included in controlled version of the operator.

+

Controlled global phase is implemented by gate (I assume IBM Q environment) $U1 \otimes I$, where $U1$ gate acts on control qubit and identity operator on target qubit.

+

$U1$ gate is given by matrix +$$ +\begin{pmatrix} +1 & 0 \\ +0 & \mathrm{e}^{i\varphi} +\end{pmatrix} +$$

+

In your case $\varphi = \pi$ which leads to gate +$$ +\begin{pmatrix} +1 & 0 \\ +0 & -1 +\end{pmatrix}, +$$ +which is actually $Z$ gate.

+

To sum up: you do not have bother about sign in case of operator $Q$ itself, in case of controlled operator $Q$, simply put $Z$ gate on control qubit.

+",9006,,,,,10/4/2020 6:30,,,,2,,,,CC BY-SA 4.0 +14008,2,,14000,10/4/2020 8:23,,4,,"

Is it clear how the syndrome measurement for $3$ qubit bit-flip code is done that is described in the same source with this circuit? If yes then is it clear how this can be done for $9$ qubit code with this circuit for bit-flip error? If no here are some ideas that might help.

+
+

A toy model example about what is happening in these codes. Imagine we have a Bell state $|\psi \rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$. Imagine there is a probability that we will have an $X$ error (bit-flip error) on one of the qubits and we want to know if we had an error. Here is the circuit constructed with help of IBM quantum experience:

+

+

This is not an error-correcting code, this is a toy model on which one can see how syndrome measurement can be done. In the error detection part if we will not have an error (we assume the possibility of only one error) then the measurement will yield $0$, otherwise, if we will have an error then we will measure $1$. If we had an error, then applying an $X$ gate on one of the qubits will recreate the initial $|\psi \rangle = \frac{1}{\sqrt{2}}(|00\rangle + |11\rangle)$.

+

The bit-flip error detecting part here (and in $3$ qubit bit-flip code or $9$ qubit code) is a parity check: checks if there are even number of $1$s in the $2$ controlling qubits. So if we have $|00 \rangle$ or $|11\rangle$ (or $\frac{1}{\sqrt{2}}(|00\rangle + |11\rangle$)) the parity is even and the output qubit will be in $|0\rangle$ state. If we have $|01 \rangle$ or $|01\rangle$ (or $\frac{1}{\sqrt{2}}(|01\rangle + |01\rangle$)) the parity is odd and the output qubit will be in $|1\rangle$ state. If this part is clear I suggest looking at two circuit links (created with quirk) provided at the beginning of the answer.

+
+

For the error on the $8$th qubit. For $9$ qubit code there are $6$ parity check measurements for $6$ pairs of qubits that can be seen in the mentioned circuit. The parity between all $6$ pairs of qubits is even when we don't have an error and the measured syndrome is $00,00,00$. If an $X$ error is acquired, one or two parities will be odd and we will notice it in sydrome measurement procedure. For the example mentioned in the question ($8$th qubit got an error) the parity is odd for last two pairs of qubits that is why we will measure $00,00,11$ syndrome. If $9$th qubit has an error the parity will be odd only for the last pair of qubits (last two qubits) and the syndrome will be $00,00,01$. If the error has acquired on the $7$th qubit then the syndrome will be $00,00,10$, because the parity is odd only for the penultimate pair of qubits (pair that consists of $6$th and $7$th qubits). If we know on which qubit an $X$ error has acquired we can apply on that qubit an $X$ gate that will correct the acquired error.

+

The parity checks for Shore's $9$ qubit code can also be done with this circuit by using an operator measurement technique.

+",9459,,9459,,10/4/2020 14:13,10/4/2020 14:13,,,,2,,,,CC BY-SA 4.0 +14010,1,,,10/4/2020 19:02,,1,83,"

I am currently reading this paper by Xin et al. (2020) in which they perform a measurement in a particular subspace. In the caption of Figure 6 (last sentence) they say " At the end of the circuit, we measure the state of the work system in the subspace where all ancilla registers are $|0⟩|0⟩_k |0⟩_{kL}$." What I am having trouble understanding is how they ensure that the ancilla qubits are in the state $|0\rangle$. How do I design my circuit to transform them into this state?

+",13390,,13968,,9/8/2022 8:34,9/8/2022 8:34,How to make a measurement in a subspace?,,0,3,,,,CC BY-SA 4.0 +14011,1,14012,,10/4/2020 19:35,,3,1790,"

Hadamard gate matrix is:

+ +

$$\frac{1}{\sqrt 2}\begin{bmatrix}1 && 1 \\ 1 && -1\end{bmatrix}$$

+

The Dirac notation for it is:

+ +

$$\frac{|0\rangle+|1\rangle}{\sqrt 2}\langle0|+\frac{|0\rangle-|1\rangle}{\sqrt 2}\langle1|$$

+

I am unable to understand, how this gate matrix is translated into dirac notation?

+",13392,,55,,10/9/2020 7:00,10/9/2020 7:00,How to translate the Hadamard gate matrix into Dirac notation?,,1,0,,,,CC BY-SA 4.0 +14012,2,,14011,10/4/2020 19:52,,7,,"

First remember that each matrix element can be written as outer products in Dirac notation:

+

$$|0\rangle\langle 0| = \begin{bmatrix}1 & 0 \\ 0 & 0 \end{bmatrix},|1\rangle\langle 1| = \begin{bmatrix}0 & 0 \\ 0 & 1 \end{bmatrix},|1\rangle\langle 0| = \begin{bmatrix}0 & 1 \\ 0 & 0 \end{bmatrix}, |0\rangle\langle 1| = \begin{bmatrix}0 & 0 \\ 1 & 0 \end{bmatrix}\tag{1}.$$

+

This can be verified easily, for example:

+
zero=[0 ; 1], one=[1; 0]
+one*zero'
+
+

gives:

+
ans =
+   0   1
+   0   0
+
+

So now let's write the matrix as a linear combination of outer products in Dirac notation:

+

$$ +\tag{2} +\frac{1}{\sqrt{2}}|0\rangle\langle 0 | + \frac{1}{\sqrt{2}}|0\rangle\langle 1 | + \frac{1}{\sqrt{2}}|1\rangle\langle 0 | - \frac{1}{\sqrt{2}}|1\rangle\langle 1 |. +$$

+

This is what you have in your question, especially if you factor out the $|0\rangle$ from two terms and $|1\rangle$ from the other two terms 😊

+",2293,,,,,10/4/2020 19:52,,,,0,,,,CC BY-SA 4.0 +14013,2,,14004,10/4/2020 20:06,,1,,"

A quantum circuit is a sequence of initialization, resets, and quantum gates - typically a quantum circuit ends in measurements. When you reuse a quantum circuit - it precedes another quantum circuit.

+

So in this case of QFT the implementation is over the amplitudes of a wavefunction. (Note this is different in many ways when compared to FFT that transforms a signal - input is time domain and the output is frequency domain). There are quantum circuit with no semblance of QFT - it could be energy levels when used to produce the maximized value of the objective function and so on.

+

Here is a good textbook to start with https://qiskit.org/textbook/ch-algorithms/defining-quantum-circuits.html

+",5175,,,,,10/4/2020 20:06,,,,0,,,,CC BY-SA 4.0 +14014,1,14015,,10/4/2020 20:45,,4,337,"

$ +\newcommand{\coefcos}[0]{c_1 c_2 - s_1 s_2 \hat{n}_1 \cdot \hat{n}_2} +\newcommand{\coefsin}[0]{s_1 c_2 \hat{n}_1 + c_1 s_2 \hat{n}_2 - s_1 s_2 \hat{n}_2 \times \hat{n}_1}$This question relates to Exercise 4.15 from Nielsen & Chuang:

+
+

(Composition of single qubit operations) The Bloch +representation gives a nice way to visualize the effect of composing two rotations.

+

(1) Prove that if a rotation through an angle $\beta_1$ about the axis $\hat{n}_1$ is followed by a rotation through an angle $\beta_2$ about an axis $\hat{n}_2$, then the overall rotation is +through an angle $\beta_{12}$ about an axis $\hat{n}_{12}$ given by

+

$$c_{12} = \coefcos \tag{4.19}\label{4.19}$$ +$$ +s_{12} \hat{n}_{12} = \coefsin, \tag{4.20}\label{4.20} +$$ +where $c_i = \cos \left( \beta_i/2 \right), s_i = \sin \left( \beta_i/2 \right), c_{12} = \cos \left( \beta_{12}/2 \right),$ and $s_{12}= \sin \left( \beta_{12}/2 \right)$.

+
+

Note that $\hat{n}_1$ and $\hat{n}_2$ are real unit vectors in three dimensions (as stated earlier in the book).

+

I managed to get the expressions on the RHS of \eqref{4.19} and \eqref{4.20} by expanding the rotation matrices into the form $R_{\hat{n}_i} \left( \beta_i \right) = \cos \left( \beta_i/2 \right) I - i \sin \left( \beta_i/2 \right) \hat{n}_i \cdot \vec{\sigma}$ (where $\vec{\sigma}$ denotes the three component vector $(X, Y, Z)$ of Pauli matrices) and taking the product.

+

Now, assume that $c_{12} \ne 1$. Then I'd expect to recover the unit vector $\hat{n}_{12}$ if I divide \eqref{4.20} through by $s_{12} = \pm \sqrt{1 - c_{12}^2}$:

+

$$ +\hat{n}_{12} = \frac{\coefsin}{ \pm \sqrt{1 - c_{12}^2} } \tag{1} +$$

+

To check that $\hat{n}_{12}$ is of unit length, I take the dot product with itself:

+

$$ +\hat{n}_{12} \cdot \hat{n}_{12} = +\frac{s_1^2 c_2^2 + c_1^2 s_2^2 + s_1^2 s_2^2 + 2 c_1 c_2 s_1 s_2 \cos (\theta) }{1 - c_{12}^2} \tag{2} +$$

+

where $\cos (\theta) = \hat{n}_1 \cdot \hat{n}_2 $. Expanding $c_{12}$ in the denominator, I get:

+

$$ +\hat{n}_{12} \cdot \hat{n}_{12} = +\frac{s_1^2 c_2^2 + c_1^2 s_2^2 + s_1^2 s_2^2 + 2 c_1 c_2 s_1 s_2 \cos (\theta) }{1 - c_1^2 c_2^2 - s_1^2 s_2^2 \cos^2 (\theta) + 2 c_1 c_2 s_1 s_2 \cos (\theta) } \tag{3} +$$

+

which tells me that the following equation should hold in order for the numerator and denominator to balance to 1:

+

$$ +s_1^2 c_2^2 + c_1^2 s_2^2 + s_1^2 s_2^2 \stackrel{?}{=} 1 - c_1^2 c_2^2 - s_1^2 s_2^2 \cos^2 (\theta) \tag{4}\label{4} +$$

+

However, I don't think \eqref{4} holds in general: $c_i$ and $s_i$ are functions of $\beta_i$. $\theta$ however is a function of $\hat{n}_i$ which I'm free to tune independently of $\beta_i$. So I should be able to conjure up values that violate \eqref{4} easily, which tells me that $\hat{n}_{12}$ is not a unit vector. This seems implausible to me. Where am I making a mistake?

+",12643,,12643,,10/4/2020 20:50,10/4/2020 21:02,Does composition of two single qubit rotations yield a single rotation around a unit vector?,,1,1,,,,CC BY-SA 4.0 +14015,2,,14014,10/4/2020 21:02,,3,,"

You just missed the fact that $ \hspace{0.3em}||n_1 \times n_2|| = |\text{sin}(\theta)| $.

+",13109,,,,,10/4/2020 21:02,,,,2,,,,CC BY-SA 4.0 +14016,2,,13999,10/5/2020 1:44,,1,,"

As per the description in Brassard paper page 5 " ... Operator Sx conditionally changes the sign of the amplitudes of the good states ....while the S0 operator changes the sign of the amplitude if and only if the state is the zero state |0>. ..."

+

The amplitude is multiplied by e -> Sx(Ɵ=φ) and S0 (Ɵ=ϕ) .. as given in Theorem 4 further considered in Lemma 5, to pick φ = ϕ = π which leads to Z gate

+

This is well explained in https://qiskit.org/textbook/ch-algorithms/grover.html +Brassard is a generalized version of Grover.

+",5175,,,,,10/5/2020 1:44,,,,0,,,,CC BY-SA 4.0 +14017,1,14021,,10/5/2020 4:32,,1,181,"

I visualize Pauli Gates making rotations by π radians about the x, y, and z axes on the Bloch sphere.

+

If this is the case, then how Pauli-X and Pauli-Y gates applied to $|0\rangle$ differ? As both should rotate the $|0\rangle$ state to same location.

+",13392,,2879,,10/5/2020 20:52,10/5/2020 20:52,How do I visualize the action of Pauli $X$ and $Y$ gates on $|0\rangle$?,,1,0,,,,CC BY-SA 4.0 +14018,1,14019,,10/5/2020 5:08,,1,381,"

Hadamard gate matrix is:

+

$$\frac{1}{\sqrt2}\begin{bmatrix}1 & 1 \\ 1 & -1\end{bmatrix}$$

+

The matrix for $|0\rangle$ is:

+

$$\begin{bmatrix}1 \\ 0\end{bmatrix}$$

+

I am unable to understand, how can I apply Hadamard gate on $|0\rangle$? The matrix representing $|0\rangle$ is of dimension 2 * 1 and the matrix representing Hadamard gate is of dimension 2 * 2 (so the matrix multiplication is not possible)

+",13392,,55,,10/8/2020 17:52,10/18/2020 17:27,"How do I apply a Hadamard gate on a given qubit, in matrix formalism?",,3,1,,,,CC BY-SA 4.0 +14019,2,,14018,10/5/2020 5:17,,4,,"

Applying quantum gates to quantum states is indeed represented as matrix multiplication. To multiply two matrices, you need only one dimension to match:

+

$$\frac{1}{\sqrt2}\begin{bmatrix}1 & 1 \\ 1 & -1\end{bmatrix} \begin{bmatrix}1 \\ 0\end{bmatrix} = \frac{1}{\sqrt2}\begin{bmatrix}1 \cdot 1 + 1 \cdot 0 \\ 1 \cdot 1 + (-1) \cdot 0 \end{bmatrix} = \frac{1}{\sqrt2}\begin{bmatrix}1 \\ 1\end{bmatrix}$$

+",2879,,,,,10/5/2020 5:17,,,,2,,,,CC BY-SA 4.0 +14020,2,,14018,10/5/2020 5:17,,4,,"

|0> is actually a vector, not a matrix. Applying the Hadamard gate (shortly, H) to |0> means computing a matrix vector multiplication:

+

$H|0\rangle = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1\\ 1 & -1 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} = \frac{|0\rangle + |1\rangle}{\sqrt{2}}$

+",5551,,,,,10/5/2020 5:17,,,,1,,,,CC BY-SA 4.0 +14021,2,,14017,10/5/2020 5:22,,2,,"

Applying X gate to the $|0\rangle$ state gives you $|1\rangle$, and applying Y gate to the $|0\rangle$ state gives you $i|1\rangle$. These states differ only by a global phase (the $i$ scalar multiplier in the second case), so they are not physically distinguishable (you cannot set up an experiment to observe the difference between them). Bloch sphere represents all states that differ by a global phase as one point on it, so you won't be able to see the difference using it.

+

X and Y gates differ in their effect on most other states, though (except $|1\rangle$, which will give you the same issue).

+",2879,,,,,10/5/2020 5:22,,,,0,,,,CC BY-SA 4.0 +14022,2,,13995,10/5/2020 7:04,,1,,"

You can find a bibliography in the book Quantum Computing: An Applied Approach (ISBN: 9783030239213) or try directly google scholar.

+",13366,,,,,10/5/2020 7:04,,,,1,,,,CC BY-SA 4.0 +14025,1,14031,,10/5/2020 15:54,,10,276,"

Coming more from a computer science background, I never really studied tensor products, covariant/contravariant tensors etc. So until now, I was seeing the "tensor product" operation mostly as (what appears to be) a Kronecker product between the matrix representation (in some fixed basis) of my vector/linear operator, i.e. if I have two vectors/matrices

+

$$A = \begin{pmatrix}a_{11} & a_{12} & \cdots \\ a_{21} & a_{22} & \cdots \\ \vdots\end{pmatrix}$$ +$$B = \begin{pmatrix}b_{11} & b_{12} & \cdots \\ b_{21} & b_{22} & \cdots \\ \vdots\end{pmatrix}$$

+

Then: +$$A \otimes B = \begin{pmatrix}a_{11}B & a_{12}B & \cdots \\ a_{21}B & a_{22}B & \cdots \\ \vdots\end{pmatrix} $$ +i.e. +$$A \otimes B = \begin{pmatrix} +a_{11}b_{11} & a_{11} b_{12} & \cdots & a_{12}b_{11} & a_{12}b_{12} & \cdots \\ a_{11} b_{21} & a_{11} b_{22} & \cdots & a_{12}b_{21} & a_{12}b_{22} & \cdots \\ +\vdots & \vdots & & \vdots & \vdots \\ +a_{21}b_{11} & a_{21} b_{12} & \cdots & a_{22}b_{11} & a_{22}b_{12} & \cdots \\ a_{21} b_{21} & a_{21} b_{22} & \cdots & a_{22}b_{21} & a_{22}b_{22} & \cdots \\ +\vdots & \vdots & & \vdots & \vdots \end{pmatrix} +$$

+

In particular, if we consider $|0\rangle = \begin{pmatrix}1\\0\end{pmatrix}$ and $|1\rangle = \begin{pmatrix}0\\1\end{pmatrix}$, then $|0\rangle \otimes |1\rangle = \begin{pmatrix}0\\0\\0\\1\end{pmatrix}$, i.e. $|0\rangle \otimes |1\rangle$ is a vector.

+

Now, if I look at the tensor product webpage of wikipedia, they seem to define $v \otimes w \colon= v w^T$, i.e. $v \otimes w$ is a matrix (ok, the matrix is just a reshape of the vector obtained by the Kronecher product so both of them are isomorphic, but in term of "type" isn't it a bit strange to define it like that?). But on the other hand, when $v$ and $w$ are matrices, we are back to the Kronecher product.

+

So here is my question: why do they define the tensor product like that for vector? Is there different "kinds" of tensors? How are they linked with tensors used in physics?

+",5969,,9006,,10/6/2020 6:58,1/28/2022 2:21,Quantum tensor product closer to Kronecker product?,,3,0,,,,CC BY-SA 4.0 +14026,1,,,10/5/2020 19:55,,0,21,"

I have been trying to run simple circuits from the Circuit Composer, both on a real quantum comp and on a simulator. Every time I get this error message:

+
Could not run circuit ""
+Cannot read property 'idCode' of null
+
+

Could you please clarify what this means? I tried logging out and in, but nothing seems to work.

+",13407,,55,,10/6/2020 5:16,10/6/2020 5:16,Issue with running a circuit: Cannot read property 'idCode' of null,,0,3,,,,CC BY-SA 4.0 +14027,1,14050,,10/5/2020 21:03,,2,105,"

While reading an answer in Cryptography.SE I saw this

+
+

As for security, that's one possible way to perform Quantum Key Distribution, another real thing. However, most current QKD systems sold today do not exchange entangled qubits (and hence can't be used for Quantum Teleportation), instead, they rely on Heisenberg's principle for security; this may change in the future.

+
+
    +
  1. Is there any product that really uses quantum teleportation?
  2. +
  3. Are there any other methods/principles commercially used other than Heisenberg's principle?
  4. +
+",4866,,55,,10/8/2020 17:23,10/8/2020 17:23,The Methodology of Quantum Key Distributions Systems,,1,1,,,,CC BY-SA 4.0 +14028,2,,13989,10/5/2020 21:14,,5,,"

Well, first off you can check the properties of the statevector simulator and the qasm simulator by doing the following:

+
from qiskit.providers.aer import StatevectorSimulator, QasmSimulator
+StatevectorSimulator.DEFAULT_CONFIGURATION
+QasmSimulator.DEFAULT_CONFIGURATION
+
+

From the outputs of these calls, you can see that both simulator backends have the same default number of maximum qubits and maximum number of shots. Also, they both accept circuits with all gates, not just the basis gates.

+

The reason why using the statevector simulator will take longer and then eventually run out of memory as you increase the number of qubits is because the statevector simulator has to return a block of data the size of 2^N (where N is the number of qubits, and 2^N is the size of the statevector). As the number of qubits increases, the size of the statevector increases exponentially. On the other hand, the qasm simulator returns counts, which is a sampling of the statevector of the circuit, way smaller in size and won't increase in size exponentially as the number of qubits increases. Though they return different things, the qasm and statevector simulator are both part of the same simulator.

+

You can also customize the qasm simulator to act like the statevector simulator by adding the parameter backend_options to your call to execute() or run() your circuit with the value backend_options = {"method": "statevector"}, and the qasm simulator will return a statevector.

+",13117,,,,,10/5/2020 21:14,,,,1,,,,CC BY-SA 4.0 +14029,1,14030,,10/5/2020 21:21,,1,185,"

I am running a simple 3 qubit circuit which produces the following results:

+
{'000': 5, '001': 3, '010': 10, '100': 5, '101': 7, '110': 7, '111': 4}
+
+

There are no counts of 011. Is there a simple way within qiskit to also return the result '011': 0? So the final results would be

+
{'000': 5, '001': 3, '010': 10,'011': 0, '100': 5, '101': 7, '110': 7, '111': 4}
+
+

Currently when I run this circuit I get an error as I am trying to call res['011'], where res is the list of results. I cannot just increase the number of shots unfortunately I am constrained to this number of qubits.

+",13261,,55,,10/8/2020 17:29,10/8/2020 17:29,Return outputs with zero counts,,1,0,,,,CC BY-SA 4.0 +14030,2,,14029,10/5/2020 21:55,,2,,"

You can use .get() and return zero as the default value.

+

res.get('011', 0)

+",13109,,,,,10/5/2020 21:55,,,,0,,,,CC BY-SA 4.0 +14031,2,,14025,10/5/2020 23:18,,6,,"

The tensor product of two objects with $m$ and $n$ components is an object with $mn$ components that consists of the pairwise products of the components of the inputs. The Kronecker product and the $v w^T$ product (vector outer product) are both tensor products by that definition.

+

The reason for first defining a tensor product by matrix multiplication in the Wikipedia article is probably pedagogical: most readers will be familiar with matrix multiplication, and with that example under their belt they might have an easier time with the Kronecker product.

+

The tensor product of objects with $k$ and $\ell$ indices should naturally have $k+\ell$ indices. The vector outer product combines two 1-index vectors into a 2-index matrix, but the Kronecker product has to encode its 2+2 input indices into 2 output indices because matrices only support two indices. For that reason I'd say that the outer product is the more natural tensor product on vectors.

+

In the explicit-index tensor notation used in general relativity and particle physics, there is no operation of "matrix multiplication" and you instead always write it out explicitly. Instead of $M=NP$ you write $M_{ac} = \sum_b N_{ab} P_{bc}$, or just $M_{ac} = N_{ab} P_{bc}$ where the doubling of $b$ signals that it should be summed over. There's also no Kronecker product; you instead just generalize the outer product and use $k+\ell$ indices. Instead of $|ψ'\rangle = (I\otimes H\otimes I)|ψ\rangle$ you'd write $ψ'_{ab'c} = H_{b'b} ψ_{abc}$. Of course, the disadvantage of this system is you have to write out a lot of indices. (And, in quantum computing, the fact that you'd be the only one using it.)

+",3030,,,,,10/5/2020 23:18,,,,3,,,,CC BY-SA 4.0 +14032,1,,,10/6/2020 6:13,,2,156,"
    +
  1. Is it correct that the following circuit can produce any two-qubit state with real amplitudes? (Meaning that for any set of the four real amplitudes there exists a set of angles...)
  2. +
+

+
    +
  1. If so, should I generally expect that arbitrary state preparation algorithms (such as this one) can be adapted to preparing real-amplitude states by replacing all the single-qubit rotations with $R_y$'s?
  2. +
+",6313,,,,,10/6/2020 6:13,Preparing arbitrary two- and multi-qubit states with real amplitudes,,0,2,,,,CC BY-SA 4.0 +14033,1,14036,,10/6/2020 6:21,,1,135,"

Let $|\psi\rangle \in \mathbb{C}^{2n}$ be a random quantum state such that $ |\langle z| \psi \rangle|^{2} $ is distributed according to a $\text{Dirichlet}(1, 1, \ldots, 1)$ distribution, for $z \in \{0, 1\}^{n}$.

+

Let $z_{1}, z_{2}, \ldots, z_{k}$ be $k$ samples from this distribution (not all unique). Choose a $z^{*}$ that appears most frequently.

+
    +
  1. I am trying to prove:
  2. +
+

$$\underset{|\psi\rangle}{\mathbb{E}}\big[|\langle z^{*}| \psi \rangle|^{2}\big] = \underset{|\psi\rangle}{\mathbb{E}}\bigg[\underset{m}{\mathbb{E}}\big[|\langle z^{*}| \psi \rangle|^{2} ~| ~m\big]\bigg] = \mathbb{E}\bigg[\frac{1+m}{2^{n}+k}\bigg],$$ +where $m$ is a random variable that denotes the frequency of $z^{*}$.

+
    +
  1. I am also trying to prove that for the collection $z_{1}, z_{2}, \ldots, z_{k}$ +$$\sum_{i \neq j}\mathrm{Pr}[z_{i} = z_{j}] = {n \choose k}\frac{2}{2^{n} + 1}. $$
  2. +
+

Basically, I am trying to trace the steps of Lemma $13$ (page 10) of this quantum paper. I realize that my questions have to deal with posteriors and priors of the chosen distribution (though I do not understand how they have been explicitly derived or used here. An explicit derivation will be helpful). Is there any resource where I can find quick formulas for calculating these for other distributions, like the Binomial distribution?

+",1351,,55,,10/8/2020 15:44,10/8/2020 15:44,Dirichlet distribution: posteriors and priors of distribution,,1,0,,,,CC BY-SA 4.0 +14034,2,,14025,10/6/2020 7:26,,1,,"

In quantum computing, we compute the tensor product exactly as you specify. This includes the case of taking a tensor product with two vectors.

+

Now, it is also true that $|\psi\rangle\langle\phi|$ can be thought of as a tensor product between $|\psi\rangle$ and $\langle\phi|$. But in QC we would never define the tensor product between $|\psi\rangle$ and $|\phi\rangle$ to be that.

+",1837,,,,,10/6/2020 7:26,,,,0,,,,CC BY-SA 4.0 +14035,1,,,10/6/2020 8:54,,0,348,"

I wish to simulate the gate errors from IBM's various quantum computers. However I am not sure what the gate error rate physically means. An error rate of say 0.01 for a particular means one in every 100 trials the gate will not return the desired outcome. But if I wish to simulate this myself I need to know what outcome is produced. Is it simply a random outcome? For example if I am implementing a CNOT gate on the state |11>, what happens when the gate fails? What is the state after this?

+",13261,,55,,10/8/2020 15:12,10/8/2020 15:12,"What do the ""gate errors rates"" mean physically for IBM's quantum computers?",,1,3,,,,CC BY-SA 4.0 +14036,2,,14033,10/6/2020 8:55,,2,,"

Let $ p_i = |\langle i | \phi \rangle|^2 \sim Dir(a_1, .., a_{2^n}) = Dir(1, .., 1) $ and $ m_i $ the occurences of outcome $ |i\rangle $ on samples $z_1, .. z_k$.

+

Since the Dirichlet distribution is the conjugate prior of the categorical (see here), meaning

+

$ \bf{p} $ $| Z, (1, .. 1), $ $\bf{m} $ $ \sim Dir(2^n, $ $\bf{m} + 1$)

+

and using the formula for the mean value of Dirichlet we get

+

$ \mathbb{E}[p_{z*} | m] = \frac{m+1}{\sum_{j=1}^{2^n} (m_j + 1)} = \frac{m+1}{2^n + k} $

+

For the second claim, take $ i \neq j $ and compute +\begin{align*} +\mathbb{P}[z_i = z_j] +&= \int \mathbb{P}[z_i = z_j | (p_1, .. p_{2^n})] \cdot f(p_1, .. p_{2^n}) \\ +&= \int \sum_{k=0}^{2^n} p_k^2 \cdot f(p_1, .. p_{2^n}) \\ +&= \sum_{k=0}^{2^n} \mathbb{E}[p_k^2] \\ +&= \sum_{k=0}^{2^n} \frac{2}{2^n(2^n + 1)} = \frac{2}{2^n + 1} +\end{align*}

+

(the last equality holds since $ \bf{x} $ $ \sim Dir($$\bf{a}$) $ \implies \mathbb{E}[x_i^2] = \frac{a_i(a_i + 1)}{a_0(a_0 + 1)} $, $ a_0 = \sum_{i=1}^{N} a_i $.

+

This means that $ \sum_{i \neq j} \mathbb{P}[z_i = z_j] = {k \choose 2} \frac{2}{2^n + 1} $.

+",13109,,13109,,10/6/2020 9:38,10/6/2020 9:38,,,,11,,,,CC BY-SA 4.0 +14037,1,,,10/6/2020 13:29,,6,215,"

Let $\rho,\sigma\in\text{L}(\mathcal{H}_{XAB})$ be given by +$$ \rho = \sum_x |x\rangle\langle x|\otimes p_x\rho_x, \quad \sigma = \sum_x |x\rangle\langle x|\otimes q_x\sigma_x, $$ +and consider operators $M$ be given by +$$ M = \sum_x |x\rangle\langle x|\otimes M_x, \quad\quad M_x\geq 0, \quad \sum_x M_x = id, $$ +that is $\{M_x\}$ is a POVM measurement. Now suppose +$$ \lVert M(\rho-\sigma)\rVert_1 = \sum_x \left|\operatorname{Tr}M_x(p_x\rho_x - q_x\sigma_x)\right| = 0 $$ +for all measurement operators $M$ given as above, where $\{M_x\}$ is implementable by LOCC. Do we necessarily have $\rho = \sigma$?

+

Using $M_x = id/|X|$ yields $p_x = q_x$, and I have shown it is true for $\rho,\sigma$ pure using Schmidt decomposition, so I do believe it should be possible to prove $\rho_x = \sigma_x$ for all $x$, but I have not managed to do so.

+

Any help is appreciated!

+",12421,,12421,,10/13/2020 14:15,7/10/2021 15:07,Are perfectly LOCC-indistinguishable states necessarily identical?,,1,1,0,,,CC BY-SA 4.0 +14038,1,14039,,10/6/2020 14:04,,4,363,"

Quantum annealers are single purpose machines allowing to solve quadratic unconstrained binary optimization (QUBO) problems. QUBO problems have following objective function: +$$ +F=-\sum_{i<j}J_{ij}x_ix_j-\sum_{i=1}^N h_ix_i, +$$ +where $x_i$ is a binary varibale and $h_i$ and $J_{ij}$ are coefficients. +Such objective function is equivalent to Ising Hamiltonian +$$ +H_{\text{ISING}}=-\sum_{i<j}J_{ij}(\sigma^z_i\otimes\sigma^z_j)-\sum_{i=1}^N h_i\sigma^z_i, +$$ +where $\sigma^z_i$ is Pauli Z gate acting on $i$th qubit and there are identity operators on other qubits, tensor product $\sigma^z_i\otimes\sigma^z_j$ means that Z gates act on $i$th and $j$th qubits and there are identity operators on other qubits.

+

Quantum annealers physically implements simulation of Hamiltonian +$$ +H(t)=\Big(1-\frac{t}{T}\Big)\sum_{i=1}^N h_i\sigma^x_i+\frac{t}{T}H_{\text{ISING}}, +$$ +where $t$ is a time, $T$ total time of simulation and $\sigma^x_i$ is Pauli X gate acting on $i$th qubit. +Initial state of a quantum annealer is equal superposition of all qubits which is ground state of the Hamiltonian $H(0)$.

+

Quantum Approximate Optimization Algorithm (QAOA) is described by an operator +$$ +U(\beta, \gamma) = \prod_{i=1}^{p}U_B(\beta_i)U_C(\gamma_i), +$$ +where $p$ is number of iteration of QAOA, +$$ +U_B(\beta) = \mathrm{e}^{-i\beta\sum_{i=1}^N \sigma^x_i}, +$$ +and +$$ +U_C(\gamma) = \mathrm{e}^{-i\gamma(\sum_{i,j=1}J_{ij}(\sigma^z_i\otimes\sigma^z_j)+\sum_{i=1}^N h_i\sigma^z_i)}. +$$ +Initial state for QAOA is $H^{\otimes n}|0\rangle ^{\otimes n}$, i.e. equally distributed superposition as in case of the quantum annealer.

+

Since time evolution of quantum system described by Hamiltonian $H$ from state $|\psi(0)\rangle$ to state $|\psi(t)\rangle$ is expressed by +$$ +|\psi(t)\rangle = \mathrm{e}^{-iHt}|\psi(0)\rangle, +$$ +it seems that operator $U(\beta, \gamma)$ from QAOA is simply simulation of Hamiltonian $H(t)$ describing quantum annealer beacause exponents of $\mathrm{e}$ are sums in Hamiltonian $H(t)$.

+

However, $H(t)$ is composed of two term containing Pauli matrices X and Z and $\mathrm{e}^{A+B}=\mathrm{e}^A\mathrm{e}^B$ is valid only for commuting matrices $[A,B]=O$. But Pauli matrices X and Z fulfil anti-commutation relation $\{X,Z\}=O$, not the commutation one.

+

So my questions are these:

+
    +
  1. Can QAOA be realy considered as a simulation of quantum annealer on gate-based universal quantum computer?
  2. +
  3. What I am missing in discussion above concerning commutation of Pauli matrices? Or is there any condition for matrices $A$ and $B$ allowing equality $\mathrm{e}^{A+B}=\mathrm{e}^A\mathrm{e}^B$?
  4. +
+",9006,,9006,,10/7/2020 9:00,10/7/2020 9:00,Can QAOA be considered as simulation of a quantum annealer on a gate-based quantum computer?,,1,0,,,,CC BY-SA 4.0 +14039,2,,14038,10/6/2020 16:11,,3,,"
    +
  1. If you use infinite depth then QAOA can be consider as quantum annealer on gate-based. The authors of QAOA original paper probably deduce it from quantum annealing. What I mean by infinite depth is you take $p \to \infty$ in the operator
  2. +
+

$$U(\beta, \gamma) = \Pi_{i=1}^p U_B(\beta_i)U_C(\gamma_i) $$

+
    +
  1. Your are right about the commutation problem. However, remember that
  2. +
+

$$ \lim_{p \to \infty} \big(e^{A/p}e^{B/p} \big)^p = e^{A+B} $$

+

so in a sense, at infinite limit depth, it is not a problem. So you recover the quantum annealing approach.

+",9858,,9006,,10/7/2020 8:59,10/7/2020 8:59,,,,1,,,,CC BY-SA 4.0 +14040,1,,,10/6/2020 17:58,,2,313,"

I am a bit hesitant to ask this very specific question, as I feel other people need not benefit from it. But since I have struggled for a while, and I think I should get some help.

+

So I am using VQE in qiskit to calculate the ground sate energy of a chain of hydrogen atoms, but it appears that the result is in-consistent with the result from exact diagonalization. The code works well for other molecules like H2, LiH, so this is confusing. I guess the question boils down to how to set the threshold for the VQE. I have attached the code below, and many thanks for the help!

+
from qiskit import BasicAer
+import logging
+from qiskit.chemistry import set_qiskit_chemistry_logging
+set_qiskit_chemistry_logging(logging.ERROR) 
+
+# chemistry related modules
+from qiskit.chemistry import FermionicOperator
+from qiskit.chemistry.drivers import PySCFDriver, UnitsType
+
+
+from qiskit.aqua.algorithms import VQE, NumPyEigensolver
+import numpy as np
+from qiskit.chemistry.components.variational_forms import UCCSD
+from qiskit.chemistry.components.initial_states import HartreeFock
+from qiskit.aqua.components.optimizers import L_BFGS_B
+from qiskit.aqua.operators import Z2Symmetries
+
+
+def get_qubit_op(atom,basis,map_type ):
+    driver = PySCFDriver(atom=atom, unit=UnitsType.ANGSTROM, 
+                         charge=0, spin=0, basis=basis)
+    molecule = driver.run()
+    num_particles = molecule.num_alpha + molecule.num_beta    
+    num_spin_orbitals = molecule.num_orbitals * 2    
+    ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)
+    
+    qubitOp = ferOp.mapping(map_type=map_type, threshold=0.00000001)
+    qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)        
+    
+    return qubitOp, num_particles, num_spin_orbitals
+
+import timeit
+
+start = timeit.default_timer()
+
+
+atom = 'H .0 .0 .0; H .0 .0 1.5 ; H .0 .0 3.0 ; H .0 .0 4.5 '
+
+basis='sto3g'
+
+map_type = 'parity'
+
+qubitOp, num_particles, num_spin_orbitals = get_qubit_op(atom,basis,map_type )
+
+print('Ground state energy is' , NumPyEigensolver( qubitOp ).run().eigenvalues )
+
+    
+init_state = HartreeFock( num_spin_orbitals , num_particles , map_type )
+
+# set the backend for the quantum computation=
+backend = BasicAer.get_backend('statevector_simulator')
+
+# setup a classical optimizer for VQE
+optimizer = L_BFGS_B()
+print( init_state.bitstr )
+
+var_form_vqe = UCCSD(
+        num_orbitals=num_spin_orbitals,
+        num_particles=num_particles,
+        initial_state=init_state,
+        qubit_mapping=map_type 
+    )
+
+algorithm_vqe = VQE(qubitOp, var_form_vqe, optimizer  )
+
+result_vqe = algorithm_vqe.run(backend)
+
+print( 'eigenvalue = ' , result_vqe['eigenvalue' ] )
+
+stop = timeit.default_timer()
+
+print('The run time of this part: ', stop - start)  
+
+

The output is below, and as you can see, they differ quite significantly.

+
Ground state energy is [-3.52488449+5.88070795e-18j]
+[False False  True False False  True]
+eigenvalue =  (-3.523526951494827+0j)
+The run time of this part:  57.303660957000034
+
+",9816,,55,,10/8/2020 15:07,10/8/2020 15:07,Why VQE gives an incorrect ground state energy for a chain of 4 hydrogen atoms?,,1,5,,,,CC BY-SA 4.0 +14041,2,,14040,10/6/2020 19:59,,1,,"

I think this has to do with the fact that the var_form that you picked, UCCSD, is not expressible enough. What I mean by that is UCCSD doesn't have the sufficient complexity to generate the ground state wavefunction.

+

Maybe you should try UCCSDT or some other var_form that have greater expressibility.

+",9858,,9006,,10/7/2020 9:03,10/7/2020 9:03,,,,8,,,,CC BY-SA 4.0 +14042,2,,14035,10/7/2020 7:08,,1,,"

Different quantum channels can cause the same gate error. One option is to assume that the gate error is caused by a depolarizing channel, followed by thermal relaxation. This is the assumption made in NoiseModel.from_backend, whose documentation can help you: https://qiskit.org/documentation/stubs/qiskit.providers.aer.noise.NoiseModel.from_backend.html#qiskit.providers.aer.noise.NoiseModel.from_backend.

+",7659,,,,,10/7/2020 7:08,,,,0,,,,CC BY-SA 4.0 +14043,1,14047,,10/7/2020 17:58,,3,485,"

I am new to quantum computing.

+

I compare Pauli-X gate and Pauli-Y gate as equivalent to NOT gate in classical computers. Though I am not very sure when to use Pauli-X and Pauli-Y gates as the result only differ in global phase.

+

As per my understanding phase shift gates (like Pauli-Z gate) doesn't change the amplitude of the qubit but only changes the relative phase of the qubit on the bloch sphere.

+

I am unable to understand the benefit of phase change (global - like in Pauli-Y and relative - like in Pauli-Z gate) in quantum computer? I assume it is only the amplitude which determines the observed state during measurement of qubit.

+",13392,,13392,,10/7/2020 18:23,10/8/2020 11:42,Benefit of phase shift in quantum computing,,2,0,,,,CC BY-SA 4.0 +14044,1,14045,,10/7/2020 19:34,,2,172,"

Can I run circuits on real hardware as offline? I mean that a job with 100 circuits may take a long time and I want to shot down my laptop in running time. In the meantime, can the real hardware run all of the circuits in the job, and in another time I can obtain my results? Or is it necessary my laptop to be turned on till I receive the last result? If I need any code for this issue, I would be very grateful anyone can provide it.

+",5217,,55,,10/9/2020 7:44,10/9/2020 7:44,How can I run a job as offline on real hardware?,,2,0,,,,CC BY-SA 4.0 +14045,2,,14044,10/7/2020 20:46,,2,,"

All jobs sent to IBMQ backends are asynchronous. You just need to save the job ID and use the ID retrieve it later. For example:

+
provider = IBMQ.load_account()
+backend = provider.get_backend('ibmq_vigo')
+job = execute(circuits, backend)
+print(job.job_id())
+
+

Once the job is submitted, you can turn off your laptop. Then when you're ready to get the results, do

+
result = backend.retrieve_job(job_id).result()
+
+

If you forget to write down the job ID, you can always find it on the IQX dashboard or use backend.jobs() to query for it.

+",12195,,,,,10/7/2020 20:46,,,,1,,,,CC BY-SA 4.0 +14046,2,,14044,10/7/2020 20:55,,1,,"

To answer your question, you do not have to be on online the whole time in order for your job to run on the real hardware. If you create a job with 100 circuits and get the job_id with the command

+
job.job_id()
+
+

you can leave the IBM Quantum Experience website or shut down your computer and when you come back, you can do the following in the same or different notebook:

+
from qiskit import *
+provider = IBMQ.load_account() #or you can specify the provider with IBMQ.get_provider(hub=..., group=..., project=...)
+backend = provider.backends.<backend_name>
+job = backend.retrieve_job(<job_id>)
+job.status()
+
+

And you will have your job stored in the variable job. The command job.status() helps you see what stage your job is in. If the output is DONE, then you can retrieve your results.

+",13117,,,,,10/7/2020 20:55,,,,1,,,,CC BY-SA 4.0 +14047,2,,14043,10/7/2020 21:05,,4,,"

Note that:

+

$$ X |0\rangle = |1\rangle \hspace{1 cm} X|1\rangle = |0\rangle $$

+

but

+

$$ Y |0\rangle = i|1\rangle \hspace{1 cm} Y|1\rangle = -i|0\rangle $$

+

So $X \neq iY$. In fact, the set $\{I, X, Y, Z\}$ is an orthogonal basis set for $2 \times 2$ matrices. They are not just some factor off from each other. They are independent from one another.

+
+

As for overall phase on quantum gate, $U$ v.s $e^{i\theta}U$ , these two are indistinguishable as long as you don't do any control operation. That is, controlled-$U$ is not the same as controlled-$e^{i\theta }U$ . This is because the phase of the target qubit can be kicked back to the controlled-qubit and it is essentially how quantum phase estimation algorithm works.

+",9858,,,,,10/7/2020 21:05,,,,0,,,,CC BY-SA 4.0 +14048,2,,13956,10/7/2020 21:24,,0,,"

It could be that the qubits are not neighbors and the circuit require a lot of intermediate qubits to execute certain operations. This could means that you are trying to simulate a very large problem. I would suggest that you transpiled the circuit onto those device qubit's layout and see what the circuit might looks like.

+
+

On the side note, by looking at the code from the linked you provided, I see this:

+
IBMQ.load_account()
+provider = IBMQ.get_provider(hub='ibm-q')
+backend = Aer.get_backend("qasm_simulator")
+device = provider.get_backend("ibmq_vigo")
+coupling_map = device.configuration().coupling_map
+noise_model = NoiseModel.from_backend(device.properties())
+quantum_instance = QuantumInstance(backend=backend, 
+                                   shots=1000, 
+                                   noise_model=noise_model, 
+                                   coupling_map=coupling_map,
+                                   measurement_error_mitigation_cls=CompleteMeasFitter,
+                                   cals_matrix_refresh_period=30)
+
+
+

I just want to point out that by performing measurement_error_mitigation with CompleteMeasFitter can be costly and could slow down your simulation if you are using a lot of qubits. This is because Qiskit is trying to calibrated a $2^n \times 2^n$ ($n$ is the number of qubit you are using) matrix to mitigate the measurement error.

+

For the case of Manhattan, assuming that you are using all of the qubit then this is $2^{65} \times 2^{65}$ matrix! It would takes years (maybe?).

+

As for why do we need to we need to create $2^n \times 2^n$ matrix, this is because you are creating $2^n$ eigenstate and measure each of them. Says you have $3$-qubit, and you want to understand how much error is happening in your measurement, what you do is then to prepare the $2^3$ eigenstates:

+

$$|000\rangle, |001\rangle, \cdots, |111\rangle $$

+

and make measurement on them. Measuring the first eigenstate will give you some probability distribution like:

+

$$\begin{pmatrix} +0.80\\ +0.02\\ +0.04\\ +0.01\\ +0.03\\ +0.05\\ +0.04\\ +0.01\\ +\end{pmatrix} \hspace{1 cm} $$ +You do this for the other 7 eigenstates, and hence you formed an $2^3 \times 2^3$ matrix, says $M$. Then by operate $M^{-1}$ to the probability vector you generated by measuring some state $|\psi \rangle$, you will be able to recover (to some extent) the result that doesn't have the read out error.

+

As you can see, this is a very expensive process. And that is why your simulation is taking forever.

+",9858,,9858,,10/7/2020 22:45,10/7/2020 22:45,,,,0,,,,CC BY-SA 4.0 +14049,1,14052,,10/7/2020 21:47,,3,192,"

Often in quantum computing the idea of quantum superposition is introduced well before the concept of entanglement. I suspect this may be because our conception of (classical) computing privileges bits, and hence we also privilege qubits in a Hilbert space of dimension $d=2$. It's easy enough to consider a single qubit in superposition, but transitioning to entanglement requires a plurality of such particles.

+

Or does it?

+

For example, suppose we lived in a world that privileged qudits, with $d=4$; e.g. four-level quantum systems as opposed to two-level qubits. We can think of our system (say, a particle-in-a-box or a harmonic-oscillator or what-have-you); our qudit could be in any superposition of $\{\vert 0\rangle,\vert 1\rangle,\vert 2\rangle,\vert 3\rangle\}$.

+

We can think of a particle in a superposition of $\vert \Psi\rangle=\frac{1}{\sqrt{2}}\vert 0\rangle\pm\vert 3\rangle$, or $\vert\Phi\rangle=\frac{1}{\sqrt{2}}\vert 1\rangle\pm\vert 2\rangle$.

+

Now if we envision our (single) qudit instead as two virtual qubits, with a mapping/isomorphism such as:

+

$$\vert 0\rangle_{qudit}=\vert 00\rangle_{qubit}$$ +$$\vert 1\rangle_{qudit}=\vert 01\rangle_{qubit}$$ +$$\vert 2\rangle_{qudit}=\vert 10\rangle_{qubit}$$ +$$\vert 3\rangle_{qudit}=\vert 11\rangle_{qubit},$$

+

then we can see that both $\vert \Psi\rangle$ and $\vert \Phi\rangle$ are the Bell states, e.g. are entangled.

+

This works nicely for $d=4$ or any other power of $2$. But would it work for any other dimension, such as $d=3$?

+
+

Can we decompose a qutrit that is in superposition into smaller components, and ask whether the qutrit thusly is in some sense entangled?

+
+",2927,,,,,10/8/2020 7:59,Can a single qutrit in superposition be considered entangled?,,1,0,,,,CC BY-SA 4.0 +14050,2,,14027,10/8/2020 4:57,,3,,"

1. Existing Products

+

I've not yet come across commercial systems using entanglement based schemes. The commercial products I've seen, like ID Quantique and MagiQ seem to be using BB84/B92 type protocols. It may be relevant to the question to note that I'm only aware of these particular companies because their commercial QKD systems got hacked.

+

The infrastructure for long distance entanglement on a commercial scale doesn't exist yet. There's a lot of money going into it, but the no cloning theorem makes quantum repeater design highly non-trivial, and a robust solution has not yet emerged.

+

If you're willing to consider government activity (which will certainly have a commercial aspect), China has accomplished satellite-based QKD that utilizes entanglement. The last I checked, data rates were still in the 10's of kbit/s and operation was dependent on favorable atmospheric conditions. It's a remarkable achievement, but it's still early stage.

+

2. Methods

+

Based on the information I've seen, the high-level scheme used in the satellite-based QKD with entanglement noted above is as follows:

+
    +
  1. The satellite generates entangled photon pairs and directs half of each pair to two geographically separated parties.
  2. +
  3. The two parties use incoming entangled photon pairs to perform a CHSH test.
  4. +
  5. The parties classically/publicly communicate regarding measurement bases used during the test (critically there is no public discussion of measurement outcomes).
  6. +
  7. Based on each party's private measurement outcome data and collective basis information, the parties determine whether the CHSH inequality was violated.
  8. +
  9. In the case of CHSH inequality violation, entanglement is validated and the parties have private data sets that are correlated beyond classical limits. The parties then use these correlated data sets to generate a set of one-time pads.
  10. +
+

Note that this scheme relies on entanglement, but not teleportation. Entanglement is, independently, a very valuable resource in QKD. Teleportation schemes pose some additional technical challenges, and may be bit further out.

+",8623,,,,,10/8/2020 4:57,,,,2,,,,CC BY-SA 4.0 +14051,1,14053,,10/8/2020 7:08,,4,308,"

I have two questions regarding the exercise 9.2.8 of Quantum information by Wilde, which is as follows:

+

Let $\rho,\sigma \in \mathcal{D}(\mathcal{H}_A)$ and let $\mathcal{N: L(H}_A)\rightarrow \mathcal{L(H}_B)$ be a quantum channel. Show that the fidelity is monotone w.r.t. the channel $\mathcal{N}$: +$$F(\rho,\sigma)\leq F(\mathcal{N}(\rho),\mathcal{N}(\sigma))$$

+
    +
  1. The first question is how to prove this inequality. So my approach was to use the Uhlmann theorem by defining a purification of the states and using $\max_{U} <\phi^\rho|_{RA}(U_R\otimes I_A)|\phi^\sigma> $ and compare it with the same for the output of channel. But the problem is I don't know how to decompose the purification of the channel $\mathcal{N}(\rho)$. Even if using the canonical purification, it needs the square root of $\mathcal{N}(\rho)$ which I don't know how to obtain.

    +
  2. +
  3. The second question is about the meaning of this theorem. It actually seems counter-intuitive to me. Because, as I expect it, the channel is a form of noise-increasing operation on the states. So if two density operators go through a channel, their fidelity must have reduced due to the random noise that has been added to them. Not increased! Can you explain it for me?

    +
  4. +
+

Thanks a lot. I appreciate any help or comment.

+",13426,,55,,10/8/2020 17:53,10/8/2020 17:53,The proof of monotonicity of fidelity for channels and its meaning,,1,0,,,,CC BY-SA 4.0 +14052,2,,14049,10/8/2020 7:59,,6,,"

To talk about entanglement, you have to first identify subsystems. In your $d=4$ example, you defined an isomorphism $\mathbb{C}^4\simeq \mathbb{C}^2\otimes\mathbb{C}^2$ via the identification of basis states. Whether this is meaningful, depends on the context/the physical scenario you have in mind. But it definitely can be.

+

For $d=3$, this is never possible. Why? Because you have to single out subsystems i.e. you have to define a tensor product structure. But necessarily, if your Hilbert space is $\mathcal H \simeq \mathcal H_1 \otimes \mathcal H_2$, then $\dim\mathcal H = \dim \mathcal H_1 \times \dim\mathcal H_2$. So if $\mathcal H$ has prime dimension, it cannot be factored (non-trivially). The trivial factorisation is of course always possible, this is $\mathcal H \simeq \mathcal H \otimes \mathbb C$. But you can easily see that in this case, no entanglement is possible.

+

(Maybe unrelated) note: I have observed multiple times that people confuse subsystems with subspaces. Subspace give rise to a direct sum decomposition, most commonly $\mathcal H = U\oplus U^\perp$. This is vastly different from a tensor product structure!

+",2305,,,,,10/8/2020 7:59,,,,2,,,,CC BY-SA 4.0 +14053,2,,14051,10/8/2020 9:19,,4,,"

Part 1

+

Monotonicity under channels is sometimes also referred to as satisfying a data-processing inequality. One way to prove this is to use a variational formula for the fidelity function, see Theorem 3.17 and the subsequent discussions in TQI - Watrous. This is slightly cheating as you first need to prove the variational formula is correct but in my experience data-processing follows quite quickly once you have a variational formula. So the fidelity can be rewritten as the semidefinite programming problem

+

\begin{equation} +\begin{aligned} +F(\rho, \sigma) = \,&\max_{X} \quad\mathrm{Tr}[X + X^*]/2 \\ +&\,\,\mathrm{s.t.} \quad \begin{pmatrix} \rho & X \\ X^* & \sigma \end{pmatrix}\geq 0 +\end{aligned} +\end{equation} +where the maximization is over all linear operators $X$ on the Hibert space which $\rho$ and $\sigma$ act on.

+

Now take any quantum channel $\mathcal{N}$ and take any feasible point $X$ for the SDP characterization of $F(\rho, \sigma)$. As $\mathcal{N}$ is a completely positive map we have +$$ +\begin{pmatrix} \rho & X \\ X^* & \sigma \end{pmatrix}\geq 0 \implies \begin{pmatrix} \mathcal{N}(\rho) & \mathcal{N}(X) \\ \mathcal{N}(X)^* & \mathcal{N}(\sigma) \end{pmatrix}\geq 0. +$$ +Furthermore we have $\mathrm{Tr}[X + X^*]/2 = \mathrm{Tr}[\mathcal{N}(X) + \mathcal{N}(X)^*]/2$ as $\mathcal{N}$ is trace-preserving. Thus we have shown that for each feasible point $X$ of the SDP for $F(\rho, \sigma)$ we can define a feasible point $\mathcal{N}(X)$ of the SDP for $F(\mathcal{N}(\rho), \mathcal{N}(\sigma))$ which has the same objective value. As we are taking a maximization over all feasible points it follows that we must have $F(\rho, \sigma) \leq F(\mathcal{N}(\rho), \mathcal{N}(\sigma))$.

+

Part 2

+

First note that it is the same channel that is being applied to the two states $\rho$ and $\sigma$. So if for example $\rho = \sigma$ and they have perfect fidelity then $\mathcal{N}(\rho) = \mathcal{N}(\sigma)$ and the `noisy' outputs also have perfect fidelity. On the opposite end of the spectrum if we take a channel which produces white noise i.e., $\mathcal{N}(\rho) = \mathrm{Tr}[\rho] I/d$ then $\mathcal{N}(\rho) = \mathcal{N}(\sigma)$ for any two states $\rho$ and $\sigma$. Thus even those that previously had fidelity $0$ will have, after sending them through this maximally noisy channel, perfect fidelity.

+

A better way to think of this result is to think of the fidelity as a measure of how well we can distinguish two quantum states (where values closer to $0$ are more distinguishable). This interpretation is justified by the Fuchs-van de Graaf inequalities that relate the fidelity and the trace distance and the trace distance's operational characterization as a distinguishability measure that comes from Holevo-Helstrom theorem. Taking a step back, if we were to have any hope that the fidelity is a good measure of distinguishability then it would have to be the case that the fidelity satisfies a data processing inequality. For if we are to think that $F(\rho, \sigma)$ really characterizes our ability to distinguish $\rho$ from $\sigma$ then it shouldn't be the case that we can send the unknown states through some quantum channel and then distinguish them better, i.e. $F(\rho, \sigma) \not\geq F(\mathcal{N}(\rho), \mathcal{N}(\sigma))$.

+",9854,,,,,10/8/2020 9:19,,,,4,,,,CC BY-SA 4.0 +14054,2,,14043,10/8/2020 11:42,,2,,"

You can consider X and Z gates as "inversion" in computational basis and circular and Hadamard bases, respectively.

+

Lets start with X. It holds that +$$ +X|0\rangle = |1\rangle\,\,\,\,\,\,\ X|1\rangle = |0\rangle, +$$ +so X is analogical to classical negation, i.e. it converts 0 to 1 and conversely.

+

Instead of computational basis $\{|0\rangle, |1\rangle\}$, you can express qubits as combination of members of Hadamard basis $\{|+\rangle, |-\rangle\}$, where +$$ +|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle+|1\rangle) +\\ +|-\rangle = \frac{1}{\sqrt{2}}(|0\rangle-|1\rangle) +$$

+

You can verify that +$$ +Z|+\rangle = |-\rangle\,\,\,\,\,\,\ Z|-\rangle = |+\rangle, +$$

+

Circular basis is composed of $\{|\uparrow\rangle, |\downarrow\rangle\}$ (note that I was not able to find proper symbol for circular arrows), where +$$ +|\uparrow\rangle = \frac{1}{\sqrt{2}}(|0\rangle+i|1\rangle) +\\ +|\downarrow\rangle = \frac{1}{\sqrt{2}}(|0\rangle-i|1\rangle) +$$

+

You can again verify that +$$ +Z|\uparrow\rangle = |\downarrow\rangle\,\,\,\,\,\,\ Z|\downarrow\rangle = |\uparrow\rangle, +$$

+

All Pauli gates also define rotation around axes x, y and z. Consider $A \in \{X,Y,Z\}$ then rotation by angle $\theta$ around axis $a \in \{x,y,z\}$ is defined as +$$ +R_a(\theta) = \mathrm{e}^{-i\frac{\theta}{2}A} +$$ +Note that the exponential is so-called matrix exponential.

+",9006,,,,,10/8/2020 11:42,,,,0,,,,CC BY-SA 4.0 +14056,1,14057,,10/8/2020 13:22,,0,274,"

I've read that in standard randomized benchmarking implementations the random quantum circuits are generated through random gate selection from a uniformly distributed Clifford set of either 1 or 2-qubit gates i.e. {H, X, Y, Z, S, T} and {iSWAP, CZ}, however the circuits generated using randomized_benchmarking_seq do not seem to follow this for the following reasons:

+
    +
  1. Random circuits do NOT contain T, iSWAP and CZ gates
  2. +
  3. Random circuits do contain CX gates
  4. +
  5. There does not appear to be a uniform distribution in gate selection, for example gates H and S gates appear more frequently than X, Y, Z and CX gates
  6. +
+

Is this observation correct? and if so what is the actual distribution for randomized_benchmarking_seq? and how can uniformly distributed random circuits be generated?

+",12248,,55,,10/9/2020 7:42,10/9/2020 8:16,What is the Clifford gates selection probability distribution used in the generation of randomized benchmarking circuits?,,1,0,,,,CC BY-SA 4.0 +14057,2,,14056,10/8/2020 13:49,,0,,"

Random Clifford elements are generated using the following function:

+

https://qiskit.org/documentation/stubs/qiskit.quantum_info.random_clifford.html

+

Then they are synthesized into basic gates (CX, S, Sdg, H, Paulis) using the following function:

+

https://qiskit.org/documentation/stubs/qiskit.quantum_info.Clifford.to_circuit.html#qiskit.quantum_info.Clifford.to_circuit

+

This is based on the following paper:

+

S. Bravyi and D. Maslov, Hadamard-free circuits expose the structure of the Clifford group. https://arxiv.org/abs/2003.09412

+

For a simpler explanation on the structure of the 1-qubit and 2-qubit Clifford groups see the following tutorial:

+

https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/terra/qis_adv/Clifford_Group.ipynb

+",13433,,13433,,10/9/2020 8:16,10/9/2020 8:16,,,,0,,,,CC BY-SA 4.0 +14058,1,14060,,10/8/2020 15:48,,4,1078,"

I want to use the Qiskit transpile function to decompose an arbitrary unitary matrix/ quantum circuit into a special kind of basis gates. +(from qiskit.compiler import transpile)

+

But for me it seems the only accepted basis gates are 'u1', 'u2', 'u3' and 'cx'. +Is there a way to use for example 'rx', 'ry' and 'cx' as basis gates instead of 'u1', 'u2', 'u3' and 'cx'?

+

The following error

+

Exception has occurred: QiskitError +"Cannot unroll the circuit to the given basis, ['id', 'ry', 'rx', 'cx']. No rule to expand instruction h."

+

for example is obtained from the code:

+
from qiskit.quantum_info import Operator
+from qiskit.compiler import transpile
+import matplotlib.pyplot as plt
+from qiskit.compiler.transpile import CouplingMap
+
+coupling_string = [[0, 1], [0,2], [1,2]]
+
+CM = CouplingMap(coupling_string)
+
+qc = QuantumCircuit(3)
+
+qc.h(0)
+qc.h(1)
+qc.h(2)
+
+result = transpile(qc, coupling_map=CM, basis_gates=['id', 'ry', 'rx', 'cx'], optimization_level=1, seed_transpiler=1) 
+result.draw(output='mpl')
+plt.show()
+
+",13436,,55,,10/9/2020 7:42,10/9/2020 7:42,Qiskit transpile with different set of basis gates,,1,0,,,,CC BY-SA 4.0 +14059,1,,,10/8/2020 16:00,,1,119,"

Let $\mathcal{H}$ be a $d$ -dimensional Hilbert space, and let $|\psi\rangle,|\phi\rangle \in \mathcal{H}$ be two quantum states.

+
    +
  1. Show that if $|\psi\rangle$ and $|\phi\rangle$ are orthogonal, then there exists a projective measurement that distinguishes them. That is, there exists a two-outcome projective measurement $\left\{P_{0}, P_{1}\right\}$ such that +$$ +p_{\psi}\left(P_{0}\right)=1 \quad \text { and } \quad p_{\phi}\left(P_{1}\right)=1 +$$
  2. +
  3. Show that if $|\psi\rangle$ and $|\phi\rangle$ are not orthogonal, then there is no projective measurement that distinguishes them.
  4. +
+

Attemps: +I form a general Projective operator an two General states, I tried it for a $2*2$ dimension and then I was wondering why do we say that $|\psi\rangle$ and $|\phi\rangle$ should be orthogonal?

+",13403,,55,,10/9/2020 16:05,10/9/2020 16:07,How does a projective measurement distinguish between two states in a $d$-dimensional Hilbert space?,,1,1,,,,CC BY-SA 4.0 +14060,2,,14058,10/8/2020 16:05,,2,,"

Which version of Qiskit are you running? Support for arbitrary basis translation was added very recently in Qiskit 0.20.0/Qiskit-Terra 0.15.0. 1 If you're running an older version of Qiskit then the transpiler will fail like this because the unroller didn't know how to use that basis set. However, when using the latest Qiskit release it will output display a circuit image like:

+

+

It's worth noting that the transpilation isn't great because the 1 qubit optimization pass doesn't understand arbitrary basis sets yet and still only works for u1, u2, u3, which is why that output is so large. There is work pending on fixing this https://github.com/Qiskit/qiskit-terra/pull/3658

+

1 https://qiskit.org/documentation/release_notes.html#qiskit-0-20-0

+",5529,,,,,10/8/2020 16:05,,,,9,,,,CC BY-SA 4.0 +14062,1,14064,,10/8/2020 17:18,,4,2625,"

For example:

+ +

$$\rm{X=\sigma_x=NOT=|0\rangle\langle 1|+|1\rangle\langle 0|=\begin{bmatrix}0 & 1 \\ 1 & 0\end{bmatrix}}$$

+

$$\rm{Z=\sigma_Z=signflip=|0\rangle\langle 0|-|1\rangle\langle 1|=\begin{bmatrix}1 & 0 \\ 0 & -1\end{bmatrix}}$$

+

I do no understand how the matrix can be expressed in bra-ket and the way around. I could not find any good teachings on this.

+",13440,,27,,10/10/2020 7:13,10/10/2020 7:13,How are the Pauli $X$ and $Z$ matrices expressed in bra-ket notation?,,1,2,,10/18/2020 19:11,,CC BY-SA 4.0 +14064,2,,14062,10/8/2020 18:34,,5,,"

Recall that kets $|\cdot\rangle$ represent column vectors; a bra $\langle\cdot|$ is a ket's row vector counterpart. For any ket $|\psi\rangle$, the corresponding bra is its adjoint (conjugate transpose): $\langle\psi| = |\psi\rangle^\dagger$. (For a refresher on this, see this question).

+

Kets and bras give us a neat way to express inner and outer products. The outer product of two vectors of the same size produces a square matrix. We can use a linear combination of several outer products of simple vectors (such as basis vectors) to express any square matrix. For example, the $X$ gate can be expressed as follows:

+

$$X = |0\rangle\langle1| + |1\rangle\langle0| = +\begin{bmatrix} 1 \\ 0 \end{bmatrix}\begin{bmatrix} 0 & 1 \end{bmatrix} + +\begin{bmatrix} 0 \\ 1 \end{bmatrix}\begin{bmatrix} 1 & 0 \end{bmatrix} = +\begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} + \begin{bmatrix} 0 & 0 \\ 1 & 0 \end{bmatrix} = +\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}$$

+",2879,,,,,10/8/2020 18:34,,,,2,,,,CC BY-SA 4.0 +14066,1,14068,,10/8/2020 20:32,,3,1708,"

So in lectures I see lots of these:

+

+

+

And somehow I intuitively understand it (at least for the 1 qubit case), but I don't understand the math – especially for 2 qubits.

+",13440,,45,,10/9/2020 18:26,10/10/2020 7:13,How do I apply the Hadamard gate to one qubit in a two-qubit pure state?,,2,2,,,,CC BY-SA 4.0 +14067,2,,14066,10/8/2020 20:42,,1,,"

What don't you understand about the Hadamard? You did the math correctly.

+

For the two qubit states, you can ignore the qubit that the Hadamard is not modifying and factor that in the end. Notably:

+

$$ (H \otimes I) | \psi_A \rangle |\psi_B \rangle = H |\psi_A \rangle \otimes I| \psi_B \rangle $$

+

Last, $|+\rangle = \frac{1}{\sqrt{2}} (|0\rangle + |1\rangle) $ as a notational shorthand.

+

Explicit description

+

Let's say we want to apply the Hadamard to the first qubit of $|00\rangle$. Then, That's just $H|0\rangle \otimes |0\rangle = |+\rangle |0\rangle = \frac{1}{\sqrt{2}} (|0\rangle + |1\rangle) |0\rangle = \frac{1}{\sqrt{2}} (|00\rangle + |10\rangle)$

+",8343,,8343,,10/8/2020 20:56,10/8/2020 20:56,,,,2,,,,CC BY-SA 4.0 +14068,2,,14066,10/8/2020 23:09,,7,,"

First, you should note that the Hadamaard gate is nothing more than a $2 \times 2$ Discrete Fourier Transform matrix (two-point DFT). That is the reason why, $H \bigg( \dfrac{|0\rangle + |1\rangle}{2}\bigg) = |0\rangle $, and $H \bigg( \dfrac{|0\rangle - |1\rangle}{2}\bigg) = |1\rangle $. Think "periodicity"...

+
+

Now, the Hadamard gate, which is again just a two-point DFT, can be written out explicitly as:

+

$$ H = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1& 1\\ 1 & -1\\ \end{pmatrix} $$

+

and $|0\rangle = \begin{pmatrix} 1 \\ + 0 \end{pmatrix} $ and $|1\rangle = \begin{pmatrix} 0 \\ + 1 \end{pmatrix} $. These are the standard euclidean basis. So naturally we take them as the computational basis for quantum computation. Now, you can work out the linear algebra (and it seems like you already did, as you mentioned in the question):

+

$$ H|0\rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1& 1\\ 1 & -1\\ \end{pmatrix} \begin{pmatrix} 1 \\ + 0 \end{pmatrix} = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1\\ 1 \\ \end{pmatrix} = \dfrac{1}{\sqrt{2}}\bigg[ \begin{pmatrix} 1\\ 0 \\ \end{pmatrix} + \begin{pmatrix} 0\\ 1 \\ \end{pmatrix} \bigg] = \dfrac{1}{\sqrt{2}}\bigg[ |0\rangle + |1\rangle\bigg] $$

+

For the two-qubit or more generally n-qubit case, where you apply the Hadamard gate to $j$-qubit, then you can think of this operator as: $I_1 \otimes I_2 \otimes \cdots \otimes H_j \otimes \cdots \otimes I_n $.

+

For instance, if you have a two qubit state $|\psi \rangle = |00\rangle = |0\rangle \otimes |0\rangle $ and you want to apply the Hadamard to the second qubit, then this is simply:

+

\begin{align} +(I \otimes H) |00\rangle &= \bigg[ \begin{pmatrix} 1& 0\\ 0 & 1\\ \end{pmatrix} \otimes \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1& 1\\ 1 & -1\\ \end{pmatrix} \bigg] \bigg[|0\rangle \otimes |0\rangle \bigg] \\ +&= \begin{pmatrix} 1 \cdot\dfrac{1}{\sqrt{2}}\begin{pmatrix} 1& 1\\ 1 & -1\\ \end{pmatrix} & 0\cdot \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1& 1\\ 1 & -1\\ \end{pmatrix} \\ 0\cdot \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1& 1\\ 1 & -1\\ \end{pmatrix} & -1\cdot \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1& 1\\ 1 & -1\\ \end{pmatrix} \end{pmatrix} \cdot \begin{pmatrix} 1 \\ 0\\ 0 \\ 0 \\ \end{pmatrix} \\ +&= \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 & 0 & 0\\ 1 & -1 & 0 & 0\\ 0 & 0 & -1 & -1\\ 0 & 0 & -1 & 1 \end{pmatrix}\begin{pmatrix} 1 \\ 0\\ 0 \\ 0 \\ \end{pmatrix} \\ +&= \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1\\ 0 \\ 0 \\ \end{pmatrix} \\ +&= \dfrac{1}{\sqrt{2}} \bigg[ \begin{pmatrix} 1 \\ 0\\ 0 \\ 0 \\ \end{pmatrix} + \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \\ \end{pmatrix} \bigg]\\ +&= \dfrac{1}{\sqrt{2}}\big( |00\rangle + |01\rangle \big)\\ +\end{align}

+

where the last equality is because

+

$$ +|00\rangle = |0\rangle \otimes |0\rangle = \begin{pmatrix} 1 \\ + 0 \end{pmatrix} \otimes \begin{pmatrix} 1 \\ + 0 \end{pmatrix}= \begin{pmatrix} 1 \cdot \begin{pmatrix} 1 \\ + 0 \end{pmatrix} \\ + 0 \cdot \begin{pmatrix} 1 \\ + 0 \end{pmatrix} \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} +$$

+

and similarly

+

$$ +|01\rangle = |0\rangle \otimes |1\rangle = \begin{pmatrix} 1 \\ + 0 \end{pmatrix} \otimes \begin{pmatrix} 0 \\ + 1 \end{pmatrix}= \begin{pmatrix} 1 \cdot \begin{pmatrix} 0 \\ + 1 \end{pmatrix} \\ + 0 \cdot \begin{pmatrix} 1 \\ + 0 \end{pmatrix} \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \end{pmatrix} +$$

+

and therefore you have the equality

+

$$ +\dfrac{1}{2}\bigg[ \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} + \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \end{pmatrix} \bigg] =\dfrac{1}{2}\bigg[ |00\rangle + |01\rangle \bigg] +$$

+
+

Now also note that

+

\begin{align} +(I \otimes H) |00\rangle &= (I \otimes H) \big(|0\rangle \otimes |0\rangle \big) = I|0\rangle \otimes H|0\rangle \ \textrm{[by tensor product properties][1]} \\ +&= |0\rangle \otimes \dfrac{1}{\sqrt{2}} \big( |0\rangle + |1\rangle \big) \\ +&= \dfrac{1}{\sqrt{2}}|0\rangle \otimes 0\rangle + \dfrac{1}{\sqrt{2}}|0 \rangle \otimes |1\rangle = \dfrac{1}{\sqrt{2}} \bigg(|00\rangle + |01\rangle \bigg) +\end{align}

+

This is more convenient

+

1 https://en.wikipedia.org/wiki/Tensor_product#Tensor_product_of_linear_maps

+
+
+

Now, if we want to apply the Hadamard gate to the first qubit instead of the second qubit as your lecture note indicated, we can do it too.

+

\begin{align} +(H \otimes I) |00\rangle &= \bigg[ \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1& 1\\ 1 & -1\\ \end{pmatrix} \otimes \begin{pmatrix} 1& 0\\ 0 & 1\\ \end{pmatrix} \bigg] \bigg[|0\rangle \otimes |0\rangle \bigg] \\ +&= \begin{pmatrix} \dfrac{1}{\sqrt{2}} \cdot \begin{pmatrix} 1& 0\\ 0 & 1\\ \end{pmatrix} & \dfrac{1}{\sqrt{2}} \cdot \begin{pmatrix} 1& 0\\ 0 & 1\\ \end{pmatrix} \\ \dfrac{1}{\sqrt{2}} \cdot \begin{pmatrix} 1& 0\\ 0 & 1\\ \end{pmatrix} & -\dfrac{1}{\sqrt{2}}\cdot \begin{pmatrix} 1& 0\\ 0 & 1\\ \end{pmatrix} \end{pmatrix} \cdot \begin{pmatrix} 1 \\ 0\\ 0 \\ 0 \\ \end{pmatrix} \\ +&= \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\\ 1 & 0 & -1 & 0\\ 0 & 1 & 0 & -1 \end{pmatrix}\begin{pmatrix} 1 \\ 0\\ 0 \\ 0 \\ \end{pmatrix} \\ +&= \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 0\\ 1 \\ 0 \\ \end{pmatrix} \\ +&= \dfrac{1}{\sqrt{2}} \bigg[ \begin{pmatrix} 1 \\ 0\\ 0 \\ 0 \\ \end{pmatrix} + \begin{pmatrix} 0 \\ 0 \\ 1 \\ 0 \\ \end{pmatrix} \bigg]\\ +&= \dfrac{1}{\sqrt{2}}\big( |00\rangle + |10\rangle \big)\\ +\end{align}

+

This is again, because

+

$$ +|10\rangle = |1\rangle \otimes |0\rangle = \begin{pmatrix} 0 \\ + 1 \end{pmatrix} \otimes \begin{pmatrix} 1 \\ + 0 \end{pmatrix}= \begin{pmatrix} 0 \cdot \begin{pmatrix} 1 \\ + 0 \end{pmatrix} \\ + 1 \cdot \begin{pmatrix} 1 \\ + 0 \end{pmatrix} \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\ 1 \\ 0 \end{pmatrix} +$$

+

and we already know from earlier that

+

$$ +|00\rangle = \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} +$$

+

so therefore,

+

$$ +\dfrac{1}{2}\bigg[ \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} + \begin{pmatrix} 0 \\ 0 \\ 1 \\ 0 \end{pmatrix} \bigg] =\dfrac{1}{2}\bigg[ |00\rangle + |10\rangle \bigg] +$$

+
+

I think the problem is people tend to drop off tensor notation... They assume that you know what they mean.

+
+

Going a little further: Since we are already at this point, I thought I should add this extra bit in here too. Suppose you see the following circuit:

+

+

This is quantum circuit, starting with the initial state $|\psi_0\rangle = |00\rangle = |0 \rangle \otimes |0\rangle$. Then it apply the Hadamard gate to the first qubit. This is similar to the question you asked. So based on what we did above, we have that

+

\begin{align} +|\psi_1 \rangle &= (H \otimes I) \big( |0\rangle \otimes |0\rangle= \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 0\\ 1 \\ 0 \\ \end{pmatrix} = \dfrac{1}{\sqrt{2}}\big( |00\rangle + |10\rangle \big)\\ +\end{align}

+

Now, we apply a gate known as the CNOT gate to both of the qubit. CNOT gate is a two-qubit gate as so you cannot think of it as tensor product from one-qubit gate. The function of CNOT (controlled-NOT) is to apply the $X$ gate to the target-qubit when the controlled-qubit is $|1\rangle$. It is therefore can be written in matrix form explicitly as

+

\begin{equation}\label{CNOT matrix} + CNOT = \begin{pmatrix} + 1 & 0 & 0 & 0\\ + 0 & 1 & 0 & 0 \\ + 0 & 0 & 0 & 1 \\ + 0 & 0 & 1 & 0 \\ + \end{pmatrix} +\end{equation}

+

Now, we apply the CNOT gate to $|\psi_1\rangle$, which will give us $|\psi_2\rangle$. That is

+

$$CNOT|\psi_1\rangle = |\psi_2\rangle $$

+

And explicitly writing this out as matrix and vector multiplication, we have

+

$$ +|\psi_2 \rangle = \begin{pmatrix} + 1 & 0 & 0 & 0\\ + 0 & 1 & 0 & 0 \\ + 0 & 0 & 0 & 1 \\ + 0 & 0 & 1 & 0 \\ + \end{pmatrix} \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 0\\ 1 \\ 0 \\ \end{pmatrix} = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 0\\ 0 \\ 1 \\ \end{pmatrix} = \dfrac{1}{\sqrt{2}} \big( |00\rangle + |11 \rangle \big) +$$

+

This quantum circuit generate the state $\dfrac{1}{\sqrt{2}} \big( |00\rangle + |11 \rangle \big)$ which is one of the four Bell states, which are maximal entangled state for two qubit.

+",9858,,9858,,10/10/2020 7:13,10/10/2020 7:13,,,,12,,,,CC BY-SA 4.0 +14069,2,,14059,10/9/2020 7:37,,1,,"

Let $P_0=|\psi\rangle\!\langle\psi|$ and $P_1=I-P_0$. This is a projective measurement which deterministically distinguishes the two orthogonal states.

+

More generally, consider a projective measurement with operators $\newcommand{\ket}[1]{\lvert#1\rangle}\{P_i\}_{i=1}^d$ and $\newcommand{\braket}[2]{\langle #1\rvert #2\rangle}\newcommand{\ketbra}[1]{\lvert #1\rangle\!\langle #1\rvert} P_i\equiv\ketbra{\eta_i}$ where $\braket{\eta_i}{\eta_j}=\delta_{ij}$, and a set of (not necessarily orthogonal) states $\{\ket{\psi_i}\}_{i=1}^\ell$ with $\ell\le d$. +To distinguish the states deterministically we need +$$\operatorname{Tr}(P_i \ketbra{\psi_j})=|\braket{\eta_i}{\psi_j}|^2=\delta_{ij}.\tag2$$ +Define the matrices $\Pi\equiv\sum_{i=1}^d |\eta_i\rangle\!\langle i|$ and $\Psi\equiv\sum_{i=1}^\ell|\psi_i\rangle\!\langle i|$. Note that $\Pi$ is $d\times d$ and $\Psi$ is $d\times\ell$. +Eq. (1) is thus equivalent to $\Pi^\dagger \Psi=I_{d\times \ell}$ (we can tune the definitions of the states $\ket{\eta_i}$ to have $\braket{\eta_i}{\psi_i}\in\mathbb R$ without any loss in generality). +This is only possible if $\Psi$ is "maximally entangled", i.e. has rank $\ell$ and all its (nonzero) singular values equal $1$ (equivalently, iff $\Psi^\dagger\Psi=I_{\ell}$). This is true iff the states $\ket{\psi_i}$ are orthonormal.

+

The last statement follows from observing that $\Psi^\dagger\Psi$ has the same nonzero singular values/eigenvalues as $\Psi\Psi^\dagger=\sum_{i=1}^\ell \ketbra{\psi_i}$. The latter having an $\ell$-fold degenerate eigenvalue $+1$ means +$$\Psi\Psi^\dagger = \sum_i\ketbra{\psi_i}=\sum_i\ketbra{\phi_i}$$ +for some orthonormal set $\{\ket{\phi_i}\}_{i=1}^\ell$. This in turns implies that for some unitary $U$ we have $\ket{\psi_i}=\sum_j U_{ij}\ket{\phi_j}$, and thus $\braket{\psi_i}{\psi_j}=\delta_{ij}$.

+

This shows that non-orthogonal states cannot be distinguished deterministically via projective measurements (in fact, they cannot be distinguished deterministically by any measurement, but that's not what we are showing here).

+",55,,55,,10/9/2020 16:07,10/9/2020 16:07,,,,2,,,,CC BY-SA 4.0 +14070,1,,,10/9/2020 8:41,,1,154,"

I found Quantum Fourier Transform in the Qiskit textbook, but I'm looking specifically for how to solve Poisson's equation with the Quantum Fourier transform.

+

Are there any references that talk about how to do this?

+",13300,,13117,,10/10/2020 7:13,10/10/2020 7:13,Solving Poisson's equation with Quantum Fourier Transform,,0,3,,,,CC BY-SA 4.0 +14071,1,14072,,10/9/2020 11:00,,2,62,"

From this question, gls states that given $\Pi\equiv\sum_i |\eta_i\rangle\!\langle i|$ and $\Psi\equiv\sum_i|\psi_i\rangle\!\langle i|$, if $\Pi^\dagger\Psi=I_{d\times\ell}$, then $\Psi$ is "maximally entangled", ie has rank $\ell$ and all singular values are equal to 1. By maximal entanglement, what does that mean exactly, in the context used for matrices here? Is it referring to the inability to decompose it to a product of matrices on subsystems, or something else? Because if I recall correctly, CNOT, which is non-decomposable, doesn't have 1 for all it's singular values, yet it fits the criteria of non-decomposable, but then wouldn't be maximally entangled?

+

Edit: I am assuming "maximally entangled" means in this context it is diagonal up to a certain dimension $\ell$

+",4991,,55,,10/9/2020 16:45,10/9/2020 16:45,How does a $d\times\ell$ matrix of rank $\ell$ and with singular values all equal to 1 imply it is maximally entangled,,2,0,,,,CC BY-SA 4.0 +14072,2,,14071,10/9/2020 12:06,,2,,"

I think the terminology makes sense if you think the matrix $ \Psi $, via the linear bijection $ vec\big( |b \rangle \langle a|\big) = |b \rangle |a \rangle$, as a pure bipartite state $ vec(\Psi) = |\psi \rangle_{AB} = \frac{1}{\sqrt{l}} \sum_{i=1}^{l} | \psi_i \rangle_A | i \rangle_B $ and observe that the reduced density matrix is +$$ \rho_B = \text{Tr}_A[\rho_{AB}] = \frac{1}{l} \sum_{i,j} \langle \psi_j | \psi_i \rangle \cdot | i \rangle \langle j| = \frac{1}{l} \cdot \big(\Psi^\dagger \Psi\big)^T $$

+

So if $ \Psi^\dagger \Psi = I_l $, then $ \rho_{AB} = |\psi \rangle \langle \psi |_{AB} $ is "maximally entagled".

+",13109,,13109,,10/9/2020 14:02,10/9/2020 14:02,,,,4,,,,CC BY-SA 4.0 +14073,1,14079,,10/9/2020 12:12,,0,81,"

What is the best way to get the circuit run time in Q# ?

+

More precisely, I run a circuit using dotnet -run command and I would like to know how many time it took for running my circuit. Actually I compute the delay between the moment I start the command and the return, but I suppose it includes building time, I really just need the circuit running time.

+

Thank you.

+

Best regards.

+",12910,,,,,10/9/2020 20:42,How to get circuit run time in Q#,,2,0,,,,CC BY-SA 4.0 +14074,2,,14073,10/9/2020 16:13,,0,,"

Note: This was suppose to be a comment but it got too long so I just put it here as an answer.

+
+

I don't think Microsoft has successfully built their quantum machine, and therefore it would not be be possible to do that, without having to run your program through actual quantum gate. The run time you get by seeing seeing how fast you can execute the simulation is heavily depend on your classical computer resources. The run time on the quantum circuits depend on the number of gates and depth of the circuit, and how fast you can implement those gates. For IBM's devices, the sampling time of single qubit gate is around 100-150 ns (not sure, but you can look it up and they are different for different qubits), and the CNOT gate time is around 1000 ns (again, they are different on which two qubit you operate on). Then you can work out the math of how long it takes to execute your ciruit. You probably can write small script to do this. Between the gates, you may want to add some buffer time as well, maybe 20ns or so.

+",9858,,,,,10/9/2020 16:13,,,,0,,,,CC BY-SA 4.0 +14075,2,,14071,10/9/2020 16:24,,0,,"

The other answer is already pretty on point with what I meant, but just to restate the same thing in different words:

+

Given a matrix $\Psi\in\mathrm{Lin}(\mathcal X,\mathcal Y)$, whose singular value decomposition reads $\Psi=\sum_i \sqrt{p_i}|u_i\rangle\!\langle v_i|$, we can define the corresponding vectorization as the vector +$$\operatorname{vec}(\Psi)=\sum_i\sqrt{p_i}|u_i\rangle\otimes|v_i\rangle\in\mathcal Y\otimes\mathcal X,$$ +(conventions may vary as to the order of the spaces after the vectorization). +Notice that $\operatorname{vec}(\Psi)$ is a proper state (i.e. it's normalised) iff $\|\Psi\|_2^2=\sum_i p_i=1$.

+

The entanglement of $\operatorname{vec}(\Psi)$ as a pure bipartite state (if it is a state) is encoded in its Schmidt coefficients, which are the singular values of $\Psi$. More generally, $\Psi$ might not correspond to a state upon vectorization, in which case calling it "maximally entangled" is just abuse of notation to refer to a specific feature of its singular values. I should note that this is not by any means standard notation, it just came natural to use the term in the context because formally a state being maximally entangled is really the same thing as the singular values of a matrix being equal.

+",55,,,,,10/9/2020 16:24,,,,0,,,,CC BY-SA 4.0 +14076,1,14086,,10/9/2020 17:56,,3,883,"

I'm confused as to how a classical computer can simulate quantum mechanical properties through the use of classical bits. Why do we need quantum computers if a quantum simulator can do it's job on a classical computer?

+",13449,,13449,,10/12/2020 0:59,7/7/2022 14:29,How is a quantum simulator able to simulate a quantum mechanical properties on a classical computer?,,2,4,,,,CC BY-SA 4.0 +14077,1,,,10/9/2020 19:22,,1,212,"

In Qiskit, I am solving a VRP for 5 nodes and it creates 20 variables for a QUBO. It runs in a 65 qubit machines (any machine below that many fails). Now, in such a typical solvers for optimization (VQE, QAOA etc.) more than 100 circuits are run in a machine. With max_evals we can run a bunch of these in the IBMQ machines to gain on wait time. I am wondering if there is pros/cons of using 1 circuit at a time or max_evals set to max_iter or is there a thumb-rule to select the optimum max_evals? One pro is obviously we can avoid the wait-time in queue. But is there any other cons?

+

Also, what is the most effective way to run such a QUBO, so that all the jobs cann be submitted at a time to the machine, so that there is no wait time?

+",9201,,55,,10/12/2020 7:22,10/12/2020 7:22,An effective way to submit all the jobs for VQE/QAOA at a time to an IBMQ machine?,,1,0,,,,CC BY-SA 4.0 +14078,2,,14077,10/9/2020 19:33,,3,,"

If you decomposed your Hamiltonian into Pauli strings, and it has 100 different terms, then yes you can use one machine to do the quantum subroutine to evaluate the expectation for each of the term.

+

$$ \langle H \rangle = \sum_{i} h_i \langle P_i \rangle $$

+

So you can evaluate $\langle P_1 \rangle$ on one machine and $\langle P_2 \rangle$ on another machine...

+

The problem is there is only one 65 qubit machine as far as I know. So even if you submit 100 circuits, they will be executed one by one. This is not going to save you any time.

+

Also, you have to remember that not all qubits are created equal and hence not all machines will have the same quality. This could be a problem if one of the many machines that you want to run in parallel is not of good quality. Your result will be heavily affected.

+",9858,,,,,10/9/2020 19:33,,,,4,,,,CC BY-SA 4.0 +14079,2,,14073,10/9/2020 20:42,,1,,"

Here is what I did when I was exploring optimizing the code to run as fast as possible in simulation (here is the blog post describing the things I looked into).

+
    +
  1. Add a classical driver to your project that calls your Q# code.
    +I used C# (you can also use Python if you prefer it) and the code you'll use is going to be something like this:
  2. +
+
using QuantumSimulator qsim = new QuantumSimulator();
+bool[] result = GroversSearch.Run(qsim).Result.ToArray();
+
+
    +
  1. In this classical driver, wrap the call to quantum operation's Run in classical code that tracks the start and the end time. Here is C# code for it:
  2. +
+
Stopwatch stopWatch = new Stopwatch();
+stopWatch.Start();
+// ... call quantum operation here ...
+stopWatch.Stop();
+TimeSpan ts = stopWatch.Elapsed;
+string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
+    ts.Hours, ts.Minutes, ts.Seconds,
+    ts.Milliseconds / 10);
+Console.WriteLine("RunTime " + elapsedTime);
+
+

You can do any pre-processing before the call to quantum code and any post-processing afterwards, and they won't count towards the execution time.

+

You can see the full example here.

+",2879,,,,,10/9/2020 20:42,,,,0,,,,CC BY-SA 4.0 +14081,2,,14076,10/10/2020 7:22,,1,,"

A system composed of $n$ qubits is described by $2^n$ parameters (complex numbers). So simulation of quantum computer has generally exponential complexity in size of simulated problem. As a result only small quantum circuits can be simulated on a classical computer in reasonable time.

+

However, there is a special familly of quantum cirucits composed only from so-called Clifford gates $H$, $S$ and $CNOT$ which can be simulated efficiently on a classical computer. But to have a quantum computer universal, you also need $T$ gate which is non-Clifford one and cannot be simulated efficiently. This causes that a quantum computer cannot be generally simulated efficiently. See Gottesman-Knill theorem for more information.

+",9006,,45,,7/7/2022 14:29,7/7/2022 14:29,,,,6,,,,CC BY-SA 4.0 +14082,1,,,10/10/2020 10:08,,1,152,"

In QuantumInstance there are max_parallel_threads, max_parallel_experiments in BACKEND_OPTIONS - Wondering whether the backend I am using supports parallel-threads or experiments and how to use this features? How do I find out whether my backend supports this?

+",9201,,55,,10/12/2020 7:22,10/12/2020 7:22,"How to set 'max_parallel_threads', 'max_parallel_experiments' for BACKEND_OPTIONS in QuantumInstance",,1,0,,,,CC BY-SA 4.0 +14083,2,,14082,10/10/2020 11:53,,1,,"

I don't think there is a programmatically way to know the backend_options supported by each backend. I always check the documentation on each backend to see what are the options. For example for UnitarySimulator, these are the backend options https://qiskit.org/documentation/stubs/qiskit.providers.aer.UnitarySimulator.html?highlight=backend_options

+",1859,,,,,10/10/2020 11:53,,,,3,,,,CC BY-SA 4.0 +14085,1,,,10/10/2020 17:45,,3,217,"

I used to think that CNOT flips amplitudes of the target qubit with the chance of $b^2$ where $b$ is the $|1\rangle$ amplitude of the control qubit. This yields that the final(after CNOT) state of the target qubit will be : +$$ +\sqrt{a_1^2 a_2^2 + b_1^2 b_2^2} \big|0 \big\rangle + \sqrt{a_1^2 b_2^2 + b_1^2 a_2^2} \big|1 \big\rangle +$$ +(the intuition is that with probability $a^2$ there is no flip, and with probability $b^2$ flip occurs) +But in fact, after two sequential applies of such a formula on the target qubit, such a qubit will not end up at the initial state. So either the upper interpretation is wrong or I've blundered the math somewhere. +If my interpretation is incorrect, could you please provide a correct one? If it is correct, help me please to derive it in probability terms and to understand how CNOT unitary matrix makes it work.

+",13459,,9006,,10/11/2020 6:29,10/11/2020 7:46,Mathematical CNOT interpretation,,1,0,,,,CC BY-SA 4.0 +14086,2,,14076,10/10/2020 18:20,,4,,"

If you mean to ask about how a classical computer can simulate how a quantum computer would compute, think about it as follows. The theory of quantum computation gives us a framework to express these computations in a mathematical form. These, of course, are equations. For example, suppose that a quantum algorithm requires the action of a particular quantum gate on a quantum state. In the context of pure quantum states, this means that the quantum state is expressed as a unit-norm vector belonging to the complex Hilbert space. The action of the quantum gate would then be expressed as a matrix multiplication of the unitary matrix representing the quantum gate and the said state vector. Thus, once these quantum computations have been reduced to matrix-vector calculations, it becomes straightforward to implement those calculations on your (classical) framework of choice, such as Matlab or Numpy. Since entangled states would just be be non-separable multi-qubit states, it follows that the state vectors can represent entangled states as well. Even measurements can be simulated classically by generating random outcomes based on the probability distribution resulting from the state amplitudes.

+

However, these classical simulations of quantum computations would not be efficient for all cases. For example, for representing the state of 1 qubit, you need a 2 dimensional vector; for 2 qubits, 4 dimensions; for 4 qubits, 16 dimensional vectors - the growth is exponential. So, if you need to represent a 32 qubit state classically, you need a complex vector of $2^{32}$ dimensions. If each entry of the vector is a complex number, with the real and imaginary parts each being expressed in 16 bits (for instance), we are already talking about a memory requirement of $2^{32} * 2 * 16 \text{bits} = 17.2 \text{GB}$. Meaningful quantum calculations which would require at least ~100 qubits would become highly inefficient on classical computers. Thus, we would require true quantum computers, even though simulators might be helpful in rapid prototyping for small circuits.

+",13461,,9006,,10/11/2020 6:25,10/11/2020 6:25,,,,3,,,,CC BY-SA 4.0 +14087,1,14093,,10/10/2020 19:32,,3,97,"

Let $A \cong \mathbb{C}^{n}$ be a Hilbert space $A,$ and let $\operatorname{Herm}(A)$ be the Hilbert space consisting of all Hermitian matrices on $A$. Give an example of a basis (not necessarily orthogonal) of Herm (A) consisting of pure density matrices in $\mathfrak{D}(A)$.

+

$\mathbf A\mathbf t\mathbf t\mathbf e\mathbf m\mathbf p\mathbf t$:

+

I Started with the case $n=2$ and considered the vectors $|0\rangle,|1\rangle,|+\rangle$ and $|+i\rangle$ , Because I think $\left|0\right\rangle\left\langle 0\right|$, $\left|1\right\rangle\left\langle 1\right|$, $\left|+\right\rangle\left\langle +\right|$, and $\left|+i\right\rangle\left\langle +i\right|$ are a non-orthogonal basis and all of them are pure density matrices. And as you know,

+

$|+\rangle=\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$

+

$|+i\rangle=\frac{1}{\sqrt{2}}(|0\rangle+i|1\rangle)$.

+

But my question is how can I prove or show that they are form a basis for $\operatorname{Herm}(A)$, in this case $A \cong \mathbb{C}^{2}$ and how can I expand it to $A \cong \mathbb{C}^{n}$? I mean how can I determine a basis for $A \cong \mathbb{C}^{n}$ which are pure density matrices and how can I show that it is a basis?

+",13403,,55,,10/12/2020 7:23,10/12/2020 7:23,What is a basis (not necessarily orthogonal) of Herm(A) consisting of pure density matrices in D(A)?($A \cong \mathbb{C}^{n}$),,2,0,,,,CC BY-SA 4.0 +14088,2,,14087,10/10/2020 22:51,,1,,"

I will try to take a stab at it from my understanding of your question:

+

The basis for the space of $2 \times 2$ Hermitian matrices over $\mathbb{R}$ is:

+

\begin{equation} +\begin{pmatrix} 1 & 0\\ 0 & 0 \end{pmatrix} \ \ \begin{pmatrix} 0 & 0\\ 0 & 1 \end{pmatrix} \ \ \begin{pmatrix} 0 & 1\\ 1 & 0 \end{pmatrix} \ \ \begin{pmatrix} 0 & i\\ -i & 0 \end{pmatrix} +\end{equation}

+

But from my understanding, you want to restrict the basis set to consist of only rank 1 matrices. Is that right? You are considering the basis set

+

\begin{equation} +|0\rangle\langle 0| = \begin{pmatrix} 1 & 0\\ 0 & 0 \end{pmatrix} \ \ \ \ |1\rangle\langle 1| = \begin{pmatrix} 0 & 0\\ 0 & 1 \end{pmatrix} \ \ \ \ |+\rangle\langle +| =\dfrac{1}{2}\begin{pmatrix} 1 & 1\\ 1 & 1 \end{pmatrix} \ \ \ \ |i\rangle\langle i| =\dfrac{1}{2}\begin{pmatrix} 1 & i\\ i & 1 \end{pmatrix} +\end{equation}

+
+

Well, if we take $H$ to be the Hermitian matrix

+

$$ H = \dfrac{1}{2}\begin{pmatrix} 1 & i\\ -i & 1 \end{pmatrix}$$

+

Can you form this Hermitian matrix $H$ from your supposedly basis set?

+
+

update: As commented, I made a wrong calculation, as $|i\rangle \langle i|$ should be

+

$$ +|i\rangle\langle i| =\dfrac{1}{2}\begin{pmatrix} 1 & -i\\ i & 1 \end{pmatrix} +$$ +and therefore it can be written as $H = \dfrac{1}{2}|0\rangle\langle 0| + \dfrac{1}{2}|1\rangle\langle 1| - |i\rangle\langle i | $

+

And it turns out that the basis set in consideration is actually correct as now pointed out by the other answer! Thanks for bringing up this problem though.

+",9858,,9858,,10/11/2020 16:36,10/11/2020 16:36,,,,2,,,,CC BY-SA 4.0 +14089,2,,14085,10/10/2020 23:49,,3,,"

For a single CNOT operation, the simplest approach is to think in terms of Boolean logic. Mathematically, this is usually represented by modular addition, which gives the action of CNOT as +$$\vert A, B \rangle \rightarrow \vert A, A \oplus B \rangle,$$ +where $\vert A, B \rangle$ is the tensor product of $\vert A \rangle$ and $\vert B \rangle$, and $\oplus$ is addition mod 2. If this seems foreign to you, just write out the $2 \times 2$ truth table and you'll see that there's nothing complicated going on here (except possibly some unfamiliar notation). It's also easy to see that $A \oplus A \oplus B = B$, giving the expected outcome after sequential application.

+

Another approach is to use the tools from linear algebra and represent CNOT as a unitary transformation. Since CNOT is a two-qubit operation, the dimension of the transformation is $2^2=4$, giving +$$\vert A, B \rangle \rightarrow U_{CNOT}\vert A,B \rangle, \;\;\; U_{CNOT}=\begin{bmatrix} 1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0 \end{bmatrix}.$$ +This is also well worth working this out by hand if there's any confusion as to why it works, noting that $U_{CNOT}{}^2=I$.

+

One of the problematic assumptions implicit in the OP equation is that $\vert A \rangle$ and $\vert B \rangle$ are separable after CNOT, which is not generally true. In other words, if $\vert A \rangle$ and $\vert B \rangle$ are entangled after CNOT, they can no longer be represented as a linear combination of pure states. At this point density matrices become relevant to avoid dealing with exponentially large vectors after a series of multi-qubit gates.

+

Edit in response to comment:

+

Taken to its logical end, your interpretation leads to a classical correlation between measurement outcomes of the two qubit states. Bell and CHSH experiments have shown beyond doubt that entangled qubit states are not classically correlated.

+

So at least in cases when CNOT creates entanglement, your interpretation is inconsistent with experiment. Unfortunately, after a century of debate on the subject, it's still not clear what the correct interpretation is (or even if such an interpretation exists). Even more unfortunately there are numerous plausible interpretations that are consistent with experiment.

+",8623,,8623,,10/11/2020 7:46,10/11/2020 7:46,,,,5,,,,CC BY-SA 4.0 +14090,1,14110,,10/11/2020 6:24,,3,947,"

Let's say I am given a Hamiltonian

+

\begin{equation} +H = \sum_{i = 1}^{m} H_{i}, +\end{equation}

+

where $H$ acts on $n$-qubits, and each $H_{i}$ acts non-trivially on at most $k$ qubits. The eigenvalues of $H$ are between $0$ and $1$. As can be seen, $H$ is a $k$-local Hamiltonian. Now, let's say I am given any quantum state $|\psi\rangle$ over $n$ qubits. I want to implement the POVM

+

\begin{equation} +\{H_{i}, \mathbb{1} - H_{i}\}. +\end{equation}

+
    +
  1. How do I implement this POVM using a fixed universal gate set and the ability to measure in the standard basis? What is the unitary that I have to apply before measuring in the standard basis and how much error can I tolerate?
  2. +
  3. What is the guarantee this implementation is efficient?
  4. +
  5. Is there any rule regarding when implementing such POVMs is efficient?
  6. +
+",1351,,55,,10/12/2020 21:03,10/12/2020 21:03,How do I efficiently implement a POVM using a fixed universal gate set and the ability to measure in the standard basis?,,1,0,,,,CC BY-SA 4.0 +14091,1,14097,,10/11/2020 8:34,,2,70,"

I'm new to quantum computing, I'm learning how to use Qiskit. I'm trying to understand better how exactly the quantum characteristics of quantum computer help to increase its computational power. I thought about the following example: If I'm writing a backtracking algorithm, writing this algorithm using quantum algorithms on a quantum computer allows me to check many paths in parallel, instead of checking all the possibilities in a row as would happen on classical computer. Is it correct to say that?

+",13419,,55,,10/12/2020 21:20,10/12/2020 21:20,How do quantum bits increase computational power?,,1,0,,,,CC BY-SA 4.0 +14093,2,,14087,10/11/2020 11:13,,3,,"

For $ n = 2 $, it is known that the Pauli matrices together with the identity matrix $ I $ form a basis. +Now observe that we can write:

+
    +
  • $ I = |0 \rangle \langle 0| + |1 \rangle \langle 1| $
  • +
  • $ \sigma_z = 2 \cdot |0 \rangle \langle 0| - I $
  • +
  • $ \sigma_x = 2 \cdot |+ \rangle \langle +| - I $
  • +
  • $ \sigma_y = 2 \cdot |+i \rangle \langle +i| - I $
  • +
+

This means that also the pure density matrices +$|0 \rangle \langle 0|, \hspace{0.3em} + |1 \rangle \langle 1|, \hspace{0.3em} + |+ \rangle \langle +|, \hspace{0.3em} + |+i \rangle \langle +i| $ are a basis (not orthogonal).

+

For the general case, the matrices $ H_{a,b} $, with $ 1 \leq a,b \leq n $, form an orthogonal basis for Herm$(A)$ (see section 1.4.2) +$$ +\ + H_{a,b} = + \begin{cases} + E_{a,a} & \text{if $a = b $} \\ + E_{a,b} + E_{b,a} & \text{if $a < b$} \\ + i (E_{a,b} - E_{b,a}) & \text{if $a > b$} + \end{cases} +\ +$$ +where $ E_{a,b} = |e_a \rangle \langle e_b| $ and $ |e_a \rangle $ a state with 1 in the $a$-th entry and all other entries zeros.

+

Now define the states: +$$ +\ + |\psi_{a,b} \rangle = + \begin{cases} + |e_a \rangle & \text{if $a = b $} \\ + \frac{1}{\sqrt{2}} (|e_a \rangle + |e_b \rangle) & \text{if $a < b$} \\ + \frac{1}{\sqrt{2}} (i|e_a \rangle + |e_b \rangle) & \text{if $a > b$} + \end{cases} +\ +$$ +and the pure density matrices $ \rho_{a,b} = |\psi_{a,b} \rangle \langle \psi_{a,b}| $. After some calculations we get

+
    +
  • $ H_{a, a} = \rho_{a,a} $
  • +
  • $ H_{a, b} = 2 \rho_{a,b} - \rho_{a,a} - \rho_{b,b} $
  • +
+

so $ \rho_{a,b} $ form a basis.

+",13109,,,,,10/11/2020 11:13,,,,2,,,,CC BY-SA 4.0 +14094,2,,4989,10/11/2020 12:44,,3,,"

Quantum teleportation actually works with any unitary basis.

+

Let $H$ be Hilbert space of dimension $d$.
+Suppose the set of unitaries $\{ W_{i}, i=1,2,..,d^2 \}$ is a unitary basis in $\mathcal{L}(H)$, that is +$$ +\text{Tr}(W_{i}^\dagger W_j) = d \cdot \delta_{ij}. +$$ +Then +$$ +|\Psi_i \rangle = \frac{1}{\sqrt{d}} \sum_{j=0}^{d-1} W_i |j\rangle \otimes |j\rangle +$$

+

is an orthonormal basis in $H \otimes H$.

+

Suppose Alice wants to teleport a state $|\phi \rangle_C \in H_C$, while with Bob they share an entangled state +$$ +|\Psi_{00}\rangle_{AB} = \frac{1}{\sqrt{d}} \sum_{j=0}^{d-1} |j\rangle_A \otimes |j\rangle_B +$$ +in the space $H_A \otimes H_B$, so the total state is +$$ +|\phi\rangle_C \otimes |\Psi_{00}\rangle_{AB}. +$$ +It's not hard to show that this total state equals to +$$ +\frac{1}{d} \sum_{i=1}^{d^2} | \Psi_{i} \rangle_{CA} \otimes W_{i}^{-1} | \phi \rangle_B . +$$ +So, Alice just needs to perform a measurement in the basis $\{ |\Psi_{i} \rangle_{CA} \}$ and transmit the result $i$ to Bob. Then Bob applies $W_{i}$ to his state to obtain $| \phi \rangle_B$.

+",5870,,,,,10/11/2020 12:44,,,,0,,,,CC BY-SA 4.0 +14096,1,14123,,10/11/2020 15:33,,1,880,"

I've installed the qiskit_textbook package in Anaconda on Windows 10 using

+
pip install git+https://github.com/qiskit-community/qiskit-textbook.git#subdirectory=qiskit-textbook-src
+
+

based on the instructions at https://qiskit.org/textbook/ch-prerequisites/setting-the-environment.html .

+

But I don't see any jupyter notebooks to open. How do you begin working with the qiskit tutorial notebooks? Thanks for any guidance.

+",13467,,55,,10/12/2020 21:20,10/12/2020 21:20,Using the qiskit_textbook Package,,1,0,,,,CC BY-SA 4.0 +14097,2,,14091,10/11/2020 17:10,,3,,"

This is a misconception. For example, people tends to say the Shor's factoring algorithm help us to do prime factor exponential faster than classical computer because the quantum computer will try out all the possible factors simultaneously then it will tells us the right answer at the end. In reality, the power of shor's algorithm is more subtle than that. It taking into the fact that quantum computer can perform certain tasks very efficient. It turn out that "factoring" can be broken down into the question of "period finding" of a certain function. And when you think of period finding, one mathematical tool that might comes to mind is the Fourier Transform, or Discrete Fourier Transform (DFT). It turns out that DFT can be perform much more efficient on a quantum computer than classical computer, this is known as the Quantum Fourier Transform. This is the key behind many quantum algorithms, and not just Shor's factoring algorithm.

+

I should mention that performing Fourier Transform more efficiently on a quantum computer does not mean you can just use it like you do classically. That is, you can't just use QFT on any classical algorithms that require a Fourier Transform and expect a speed-up. This is because we can't access the quantum state directly. +$$QFT |\psi \rangle = |\phi \rangle$$ +You can't read-out what $|\phi\rangle$ is directly as postulate by quantum mechanics. That is part of the private world of the quantum state. Also, preparing an arbitrary state $|\psi\rangle$ on a quantum computer is hard. All qubit state initialize at $|0\rangle^{\otimes n}$. So you must do some operation to get it to $|\psi \rangle$. There is not a way to do this very efficient yet.

+",9858,,,,,10/11/2020 17:10,,,,0,,,,CC BY-SA 4.0 +14098,1,14114,,10/11/2020 17:36,,7,1085,"

I understand that usually the combinatorial optimisation problems are turned into QUBO, which has a very simple mapping to Ising Hamiltonians. Ising Hamiltonians in turn have the desired properties of being diagonal in computational basis and the ground state is one of the computational basis vectors. It is thus easy to measure the state in the computational basis and obtain the bit string solution.

+

The problem is that Ising Hamiltonian and QUBO are quadratic in its terms and allows at most 2 body interactions. I recently came across a paper about integer factoring expressed as optimization problem (Quantum factorization of 56153 with only 4 qubits), where the cost function is a third degree polynomial. I was able to reduce this to 2 body interactions and thus make the problem QUBO, map it to Ising Hamiltonian and solve it on IBM machines using QAOA. However, this conversion between polynomial of degree 3 to degree 2 costs me extra qubits.

+

What is then the general approach when you have 3/4 body interactions, for example as in this paper I linked? The authors of this, as well as the authors of previous works they cite, are not concerned with the fact that this is not QUBO. Are there alternatives to Ising Hamiltonians and QUBOs in such cases? Is it correct that we could use any form of Hamiltonian (not necessarily Ising) for QAOA/VQE as long as it is decomposable into tensor products of Pauli Z operators (which makes it diagonal in computational basis)?

+",13468,,55,,10/12/2020 21:19,10/26/2022 10:24,"QUBO, Ising Hamiltonians and VQA",,1,0,,,,CC BY-SA 4.0 +14099,1,14111,,10/11/2020 18:08,,2,63,"

In brassard et al. Amplitude Amplification work, they define the Q operator as

+

$$\mathbf{Q} = -AS_{o}A^{-1}S_{\chi}$$

+

where $S_{o}$ is an operator which flips the sign of the $|0 \rangle$ state.

+

Which is basically a diagonal unitary matrix (in the computational basis) with -1 on the first diagonal element.

+

I was wondering, isn't Quantum amplification's quantum speedup hindered by the realization of $S_o$ when the number of qubits in the circuit is too big? Based on Barenco's et al work (Elementary gates for quantum computation), isn´t the number of gates required for a $n$-qubit controlled gate exponential in $n$?

+",12302,,55,,10/12/2020 21:19,10/12/2020 21:19,"In amplitude amplification, isn't the speedup hindered by the realization of $S_o$?",,1,0,,,,CC BY-SA 4.0 +14100,1,14108,,10/11/2020 21:10,,2,160,"

I'm studying the Shor algorithm as part of my thesis and have a question about the "measured" phases after the QPE.

+

So, I take the controlled-U operations on the second register and in cause of phase kickback the relative phase of the controll qubit in register one will change with a multiple of the eigenvalue of $U$. I understand, that $cU$ has multiple eigenvalues with a factor $s$. How can be guaranteed that each of the controlled-Us will kickback the same eigenvalue? Or, why it is not important?

+

Second, if I run the controlled-U operations and make the QPE, why it is possible to get different results? I thought that the transformation between the bases is unique. So, if my controlled-U makes a specific "change" on the quibit, how it is possible that the QPE generates a superposition with specific probabilities? (e.g. in Nielsen/Chuang Box 5.4 the final measurement will give 0, 512, 1024, 1536)

+

Thank you for your help.

+",13469,,55,,10/12/2020 21:18,10/12/2020 21:18,"In Shor's algorithm, how can we guarantee that each controlled-U will kickback to the same eigenvalue?",,2,0,,,,CC BY-SA 4.0 +14102,2,,14100,10/11/2020 23:55,,1,,"

Have you seen this document? https://qiskit.org/textbook/ch-algorithms/shor.html

+

Note that in Shor's algorithm, we use the quantum computer as a subroutine to essentially find the period of the function

+

$$ f(x) = a^x mod N$$

+

where $a$ is a guessed value between $1$ and $N-1$. So you have to create different circuit to implement each of the guessed $a$.

+
+

As for the QPE step, this is essentially as follow:

+

Let's suppose that

+

$$ U|\psi\rangle = e^{2\pi i \phi} |\psi\rangle$$

+

then

+

$$U^{2^j}|\psi \rangle = U^{2^j -1}\bigg(U|\psi\rangle\bigg) = U^{2^j -1}\bigg( e^{2\pi i \phi} |\psi\rangle\bigg) = \cdots = e^{2\pi i 2^j \phi} |\psi \rangle$$

+

The phase-kickback turn each of the ancilla qubit (after going through Hadamard gate) from the state $\dfrac{|0\rangle + |1 \rangle}{\sqrt{2}}$ to the state $\dfrac{ |0\rangle + e^{2\pi i 2^j \phi}|1 \rangle}{\sqrt{2}}$ under $CU^{2^j}$ operator. To be mathematical precise,

+

$$CU^{2^j}: \bigg( \dfrac{1}{\sqrt{2}} \big( |0\rangle + |1\rangle \big) \bigg)|\psi\rangle \to \dfrac{1}{\sqrt{2}} \bigg( |0\rangle |\psi \rangle + |1\rangle e^{2\pi i 2^j \phi} |\psi\rangle \bigg) = \dfrac{1}{\sqrt{2}} \bigg( |0\rangle + e^{2\pi i 2^j \phi} |1\rangle \bigg)|\psi\rangle $$

+

Now if you apply the inverse QFT to all the ancilla qubit then you will get the binary expression of $\phi$.

+
+",9858,,,,,10/11/2020 23:55,,,,1,,,,CC BY-SA 4.0 +14103,1,14109,,10/12/2020 0:03,,3,75,"

Let $\rho \in \mathfrak{D}(A)$ be a density matrix. +Show that $\left|\psi^{A B}\right\rangle \in A B$ and $\left|\phi^{A C}\right\rangle \in A C$ (assuming $\left.|B| \leqslant|C|\right)$ are two purifications of $\rho \in \mathfrak{D}(A)$ if and only if there exists an isometry matrix $V: B \rightarrow C$ such that +$$ +\left|\phi^{A C}\right\rangle=I^{A} \otimes V^{B \rightarrow C}\left|\psi^{A B}\right\rangle +$$

+

$\mathbf{attempt}$:

+

I first prove $\rightarrow$ side of this theorem. So I assume that $\left|\psi^{A B}\right\rangle \in A B$ and $\left|\phi^{A C}\right\rangle \in A C$ (assuming $\left.|B| \leqslant|C|\right)$ are two purifications of $\rho \in \mathfrak{D}(A)$. We can write $\left|\psi^{A B}\right\rangle $ and $\left|\phi^{A C}\right\rangle $ as follows

+

\begin{equation} +\begin{aligned} +&|\psi\rangle^{A B}=\sum_{x=1}^{|A|}|x\rangle^{A}\left(\sum_{y=1}^{|B|} m_{x y}|y\rangle^{B}\right)\\ +&|\psi\rangle^{A C}=\sum_{z=1}^{|A|}|z\rangle^{A}\left(\sum_{w=1}^{|C|} m^{\prime}_{z w}|w\rangle^{C}\right) +\end{aligned} +\end{equation}

+

So then we can right them as follows

+

\begin{equation} +\begin{aligned} +&|\psi\rangle^{A B}=I \otimes M\left|\phi_{+}^{A \tilde{A}}\right\rangle\\ +&|\psi\rangle^{A C}=I \otimes M^{\prime}\left|\phi_{+}^{A \tilde{A}}\right\rangle\\ +\end{aligned} +\end{equation}

+

Which $M: H^{\tilde{A}} \rightarrow H^{B}$ and $M^{\prime}: H^{\tilde{A}} \rightarrow H^{C}$ and

+

\begin{equation} +\begin{aligned} +&M|x\rangle^{\tilde{A}}:=\sum_{y=1}^{|B|} m_{xy}|y\rangle^{B} \quad and \quad M^{\prime}|z\rangle^{\tilde{A}}:=\sum_{w=1}^{|c|} m^{\prime}_{zw}|y\rangle^{C} \\ +&\left|\phi_{+}^{\tilde{A} A}\right\rangle:=\sum_{x=1}^{|A|} |xx\rangle^{\tilde{A} A}\\ +\end{aligned} +\end{equation}

+

Now we want $|\psi\rangle^{A B}$ and $|\psi\rangle^{A c}$ to be purification of $\rho \in \mathfrak{D}(A)$. So according to the definition, we should have

+

\begin{equation} +\begin{aligned} +&\psi^{A}=MM^{*}=M^{\prime}(M^{\prime})^{*}=\rho \\ +\end{aligned} +\end{equation}

+

And we assume $M^{\prime}=VM$, So +So we can write

+

\begin{equation} +\begin{aligned} +&M^{\prime}(M^{\prime})^{*}=VMM^{*}V^{*}=V\rho V^{*} +\end{aligned} +\end{equation}

+

Now, what should I do? Is my procedure correct?

+

$\mathbf{Note}$:

+

We know that $\left|\phi^{A B}\right\rangle=I^{A} \otimes M \left|\Phi^{A \tilde{A}}\right\rangle$ is called a purification of $\rho$ if reduced density matrix $\psi^A$

+

\begin{equation} +\begin{aligned} +&\psi^A := M M^* \in Pos(A) +\end{aligned} +\end{equation}

+

is equal to our density matrix $\rho$. And

+

\begin{equation} +\begin{aligned} +&\left|\phi_{+}^{\tilde{A} A}\right\rangle:=\sum_{x=1}^{|A|} |xx\rangle^{\tilde{A} A} +\end{aligned} +\end{equation}

+

at the end I should mention that $\tilde{A}$ is the same as $A$.

+",13403,,55,,10/12/2020 21:17,10/12/2020 21:17,Prove that different purifications of a state can be mapped into one another via local unitaries,,3,0,,,,CC BY-SA 4.0 +14104,1,,,10/12/2020 3:19,,0,46,"

+
+def random_bitstring_generator(bit_number, backend):
+    """
+    Generate a bitstring with one qubit
+    :param bit_number: number of bits that we want to generate
+    :param backend: Qiskit hardware or simulator
+    :return: string object with random bits
+    """
+
+    bitstring = ""
+
+    one_qubit_random_bit_generator_circuit = QuantumCircuit(1,1)
+    one_qubit_random_bit_generator_circuit.h(0)
+    one_qubit_random_bit_generator_circuit.measure(0,0)
+
+    for _ in range(bit_number):
+        counts = execute(one_qubit_random_bit_generator_circuit, backend, shots=1000).result().get_counts()
+        bit = list(counts.keys())[0]  # we have only one key because shots=1
+        bitstring += bit
+
+    return bitstring
+
+
+backend = BasicAer.get_backend('qasm_simulator')
+
+print(random_bitstring_generator(512, backend))
+
+

Executed the above code for QRNG using 1 qubit and received a 512 bit sequence

+

Executing the same circuit for 3 qubit code as given in image received an output of increased length as shown in image

+

+

Also how can i change the backend from qasm_simulator to vigo/melbourne/any other quantum machine

+",13172,,55,,12/30/2021 18:43,12/30/2021 18:43,Difference in length of RNG implementation using same circuit structure but different sizes,,2,0,,,,CC BY-SA 4.0 +14105,2,,14104,10/12/2020 5:28,,0,,"

To execute on hardware backend:

+
provider = IBMQ.load_account()
+backend = provider.get_backend('ibmq_vigo') 
+
+",9858,,,,,10/12/2020 5:28,,,,0,,,,CC BY-SA 4.0 +14106,2,,14104,10/12/2020 6:41,,2,,"

The number of bits in the counts dictionary equals the number of qubits in the circuit. So in your first example, you have a 1-qubit circuit, therefore you're dictionary looks something like

+
counts = {'0': 400, '1': 600}  # for for 1000 shots
+counts = {'0': 1} # for 1 shot
+
+

In the second example, the Jupyter notebook screenshot, you have three qubits. Therefore

+
counts = {'000': 70, '010': 80, '110': 70, ... }  # for for 1000 shots
+counts = {'101': 1} # for 1 shot
+
+

Since you add these bitstrings together, the resulting bitstring will be three times longer in the second case.

+
+

Side note: +You are actually running a 1000 shots, not one, you should change the argument shots=1000 to shots=1.

+

You might also want to have a look at the get_memory method of the job, which allows you to run e.g. 512 shots and get all single measurements, which should be more efficient than running a 1-shot experiment 512 times.

+",9800,,,,,10/12/2020 6:41,,,,0,,,,CC BY-SA 4.0 +14107,2,,14103,10/12/2020 6:51,,2,,"

You seem to have got, pretty successfully (I won't claim to have checked all the fine details), to the point of showing that you need +$$ +MM^\star=M'(M')^\star=\rho. +$$ +However, you then assume $M'=VM$. You cannot do this as what you're trying to prove is that the only option is for $M'=VM$.

+

What you could do is assume a singular value decomposition of both $M$ and $M'$. For example, +$$ +M=UDV, +$$ +where $D$ is diagonal (with non-negative entries) and $U$ and $V$ are unitaries. Similarly, +$$ +M'=U'D'V'. +$$ +We calculate $MM^\star=UD^2U^\star$, so $D^2$ must correspond to the eigenvalues of $\rho$, the $U$ transforms the computational basis to the eigenbasis of $\rho$.

+

Compare this to the same calculation for $M'$. We see that $D=D'$ and $U'=e^{i\theta}U$ (I suppose you could get super fussy about degeneracies/multiplicities in the eigenvalues. These won't affect the final outcome because they'll commute with $D^2$, and hence we can absorb into the $V$ instead).

+

This then proves that the only difference between $M$ and $M'$ is a unitary $e^{i\theta}V^\star V'$.

+",1837,,,,,10/12/2020 6:51,,,,0,,,,CC BY-SA 4.0 +14108,2,,14100,10/12/2020 7:02,,2,,"
+

I understand, that cU has multiple eigenvalues with a factor s. How +can be guaranteed that each of the controlled-Us will kickback the +same eigenvalue? Or, why it is not important?

+
+

All the $U$s in the various controlled-$U$ are the same $U$, with the same eigenvectors and the same eigenvalues. This is part of the construction of the circuit, and provides the guarantee that you are seeking.

+
+

Second, if I run the controlled-U operations and make the QPE, why it +is possible to get different results?

+
+

Remember that, for QPE, if you input an eigenvector of $U$ (and if that eigenvalue has an exact $t$-bit representation) then a $t$-bit QPE will give exactly the eigenvalue, no probabilities.

+

However, for Shor's algorithm, we cannot create an eigenvector - it requires knowledge of the value $s/r$, which is exactly what we're trying to find out! So, instead of inputting an eigenvector, we input $|1\rangle$, which is a superposition of several different eigenvectors. By linearity, the end result is a superposition of several different possible eigenvalues, and when we measure, the measurement just finds one of those values at random.

+",1837,,,,,10/12/2020 7:02,,,,2,,,,CC BY-SA 4.0 +14109,2,,14103,10/12/2020 7:16,,2,,"

I guess that part of the confusion is that you defined the matrix

+

$$ M = [m_{x,y}] ,\quad 1 \leq x \leq |A|, 1 \leq y \leq |B| $$

+

which is actually the transpose of the common matrix representation of a linear operator. This later on means that composition of the linear operators $ V M $ is not the usual matrix multiplication. All this to say, that you should have defined

+

$$ M|x\rangle^A = \sum_{y=1}^{|B|}m_{yx} |y\rangle^B $$

+

However, with the above definition we have that $ \hspace{0.2em}|\phi \rangle^{AB} = (I^A \otimes M) \big|\Phi_+^{AA} \big\rangle $ is a purification of $ \rho $ if +$$ \rho = \text{Tr}_B\Big[|\phi^{AB} \rangle \langle \phi^{AB}| \Big] = \big( M^{\dagger} M \big)^T $$

+

After this clarification, let us first prove the reverse direction of the theorem, meaning if $ V^{B\rightarrow C} $ is an isometry and

+

$$ |\phi^{AC} \rangle = (I^A \otimes V^{B\rightarrow C}) |\phi^{AB} \rangle = (I^A \otimes V^{B\rightarrow C} M ) \big|\Phi_+^{AA} \big\rangle $$

+

then the reduced density matrices of $ |\phi^{AC} \rangle, |\phi^{AB} \rangle $ are equal. +Indeed: +$$ +\text{Tr}_C\Big[|\phi^{AC} \rangle \langle \phi^{AC}| \Big] = +\text{Tr}_C\Big[ (I^A \otimes V^{B\rightarrow C} M ) \big|\Phi_+^{AA} \big\rangle \Big] = +\Big( \big(VM \big)^{\dagger} VM \Big)^T = \Big( M^{\dagger} V^{\dagger}V M \Big)^T = \Big( M^{\dagger} M \Big)^T = +\text{Tr}_B\Big[|\phi^{AB} \rangle \langle \phi^{AB}| \Big] +$$ +since $ V $ is an isometry so $ V^{\dagger} V = I_B $.

+

For the other direction, if $ \hspace{0.2em}|\phi \rangle^{AB} = (I^A \otimes M) \big|\Phi_+^{AA} \big\rangle $ and $ \hspace{0.2em}|\phi \rangle^{AC} = (I^A \otimes M') \big|\Phi_+^{AA} \big\rangle $ are two purifications of $ \rho $, it must hold that +$$ \rho^T = M^{\dagger} M = M'^{\dagger} M' $$ +So if $ \rho^T = \sum_{j=1}^{r} \lambda_j |x_j \rangle \langle x_j| $ is the eigendecomposition of $ \rho^T $, by the singular value theorem it must hold that

+

$$ M = \sum_{j=1}^{r} \sqrt{\lambda_j} \cdot |y_j \rangle \langle x_j| $$ +$$ M' = \sum_{j=1}^{r} \sqrt{\lambda_j} \cdot |z_j \rangle \langle x_j| $$

+

for two orthonormal sets $\{ |y_j \rangle \} \in H^B $ and $ \{ |z_j \rangle \} \in H^C $.

+

Now we can define $ V: H^B \rightarrow H^C $ with $ V |y_j \rangle = |z_j \rangle $ and extend this matrix, if needed, to an isometry (we can always do this). This means that

+

$$ M' = V M \implies |\phi^{AC} \rangle = (I^A \otimes V) |\phi^{AB} \rangle$$

+",13109,,,,,10/12/2020 7:16,,,,0,,,,CC BY-SA 4.0 +14110,2,,14090,10/12/2020 7:18,,3,,"
+

What is the guarantee this implementation is efficient? Is there any +rule regarding when implementing such POVMs is efficient?

+
+

The implementation of such a gate will only depend on the parameter $k$ (which I assume you mean to be fixed), not $n$. Since efficiency is generally phrased in terms of scaling with $n$, and you have no dependence on that, it is efficient.

+
+

How do I implement this POVM using a fixed universal gate set and the +ability to measure in the standard basis? What is the unitary that I +have to apply before measuring in the standard basis

+
+

Let $H_i=UDU^\dagger$, where $D$ is diagonal (with entries between 0 and 1 on the diagonal) and $U$ is a unitary. Apply $U^\dagger$ to the appropriate set of qubits. This now reduces you to the problem of performing the measurement $\{D,1-D\}$.

+

You'll need to introduce a single ancilla qubit, prepared in the $|0\rangle$ state. It is this ancilla that you will measure in the computational basis, with the two outcomes corresponding to the two different measurement operators. But before that, we need to construct a unitary between the original system (S) and the ancilla (A). Let $D=\sum_id_i|i\rangle\langle i|$, and let $V|i\rangle_S|0\rangle_A=\sqrt{d_i}|i\rangle|0\rangle+\sqrt{1-d_i}|i\rangle|1\rangle$. You can decompose this unitary via standard techniques. Apply $V$, and measure the ancilla.

+

To see that this works, let your input state be $|\psi\rangle=U\sum_i\alpha_i|i\rangle$. You sould get the measurement outcome with probaility +$$ +\langle\psi|H_i|\psi\rangle=\sum_i|\alpha_i|^2d_i. +$$ +This is what we need to check that we get. So, our simulation first applies $U^\dagger$, so we have +$$ +\sum_i\alpha_i|i\rangle_S|0\rangle_A. +$$ +We apply $V$ to prepare +$$ +|\Psi\rangle=\sum_i\alpha_i|i\rangle_S(\sqrt{d_i}|0\rangle_A+\sqrt{1-d_i}|1\rangle_A). +$$ +We calculate the probability of the 0 outcome: +$$ +\langle\Psi| 1_S\otimes|0\rangle\langle 0|_A|\Psi\rangle=\sum_i|\alpha_i|^2d_i, +$$ +as required.

+

Note that I've not worried about the state after the measurement because you've only specified a POVM, which immediately implies you're only interested in the measurement probability, not the output state.

+
+

and how much error can I tolerate?

+
+

This depends on what you mean, and is probably an entirely separate question to do justice to.

+",1837,,1837,,10/12/2020 9:09,10/12/2020 9:09,,,,6,,,,CC BY-SA 4.0 +14111,2,,14099,10/12/2020 8:59,,1,,"

No, not at all. Barenco et al.'s work is primarily saying that for certain specific gates (the multi-controlled phase gate, as required for $S_0$, being one), you can construct them in a time that is polynomial in $n$. Yes, the general case might require exponentially many, but not for every case, and it's the small number of non-exponential cases that we do our best to use.

+",1837,,,,,10/12/2020 8:59,,,,0,,,,CC BY-SA 4.0 +14112,1,,,10/12/2020 11:34,,2,265,"

Short version:

+

I'm trying to solve a traveling salesman problem very similar to the traveling Santa example here: http://quantumalgorithmzoo.org/traveling_santa/, which is also included in the samples of the Microsoft Quantum samples here: https://github.com/microsoft/Quantum/tree/main/samples/simulation. +In that example, they assume some parameters beta and gamma that yield favorable odds of finding the optimal route. The problem is: how do you get these parameters? But a more general question that I have is: How would you solve a QUBO problem (with a Hamiltonian of the form +$H = -\sum_i h_i \sigma_i^z -\sum_{i,j} J_{i,j} \sigma_i^z \sigma_j^z$) in qsharp?

+

What I've tried:

+
    +
  1. Building upon the QAOA sample, the first thing I did was cheat: I used a classical optimizer to solve for optimal values for beta and gamma, minimizing the energy. And I calculated the energy by dumping the quantum registry to a file. With the probabilities for each state, the estimated value for the energy is simply $\sum_{states} p_{state} E_{state}$.

    +
  2. +
  3. Of course, on Azure Quantum / on real quantum hardware you don't have access to the probabilities. So I tried to find ways to get precise estimates of the energy. This is where I'm struggling given the samples and documentation. I have a registry of qubits and a Hamiltonian equation that I would like to plug in, but the EstimateEnergy function in Q# either takes JordanWignerEncodingData or a statePrepUnitary and qpeUnitary. In both cases I don't really understand how I would construct them and what they do/why I need them. Efforts to estimate the energy from the phase estimation failed, but that might be due to my lack of understanding. If this is indeed a good way to solve optimization problems, are there any good resources to understand this better?

    +
  4. +
  5. The final thing I tried was the principal of slowly changing the Hamiltonian from one that has an easy to prepare groundstate, to the Hamiltonian corresponding to the optimization problem you want to solve. The example and explanation are here: https://github.com/microsoft/Quantum/blob/main/samples/simulation/ising/adiabatic/AdiabaticIsing.qs#L14. Unfortunately, I seem to get stuck in different local minima depending on the rate, and none of them actually come close to the real solution. So I found this method to be not very reliable either.

    +
  6. +
+

I understand the question is very similar to this one, but even after reading the answer there, I'm still not sure if what I'm trying makes sense, and how to make it work in Q#. So I am hoping for more concrete answer, or literature suited for developers who followed a quantum physics course many many years ago.

+",13478,,55,,10/12/2020 21:22,10/30/2020 21:20,How to solve QUBO problems in Q#?,,1,0,,,,CC BY-SA 4.0 +14113,1,,,10/12/2020 11:42,,3,320,"

I'm trying to figure out the Shor's factoring algorithm. References i've been using wikipedia page, the book Quantum Computer Science by David Mermin and the orignal paper(1996) By Peter Shor. I understand the basics of this algorithm, but wanted to know the details about the math working behind it. Now While reading through the paper i was unable to understand few things, they are:-

+
    +
  • In page 17, the probability[equation 5.7 & 5.8] was changed from summation to integral by introducing a error term in big-O notation and stating that $\{rc\}_q$ is small enough. Now my question is how it is done? I know that O(.) can be used to quantify algorithmic complexities. +$$ \Biggl|\frac{1}{q} \sum_{b=0}^{\left \lfloor \frac{ q-k-1}{r}\right \rfloor}\exp{(2i\pi b \{rc\}_q/q})\Biggr|^2$$ +$$ \frac{1}{q} \int_0^{\left \lfloor \frac{ q-k-1}{r}\right \rfloor} \exp{(2i\pi b \{rc\}_q/q})db + O\Biggl(\frac{\left \lfloor \frac{ q-k-1}{r}\right \rfloor}{q}(\exp{(2i\pi b \{rc\}_q/q})-1) \Biggr)$$ +Also it said
  • +
+
+

If $|\{rc\}_q| ≤ \frac{r}{2}$, the error term in the above expression +is easily seen to be bounded by O(1/q).

+
+

I could not understand how the above statement is true?

+
    +
  • In page 18
  • +
+
+

this probability is thus asymptotically bounded below by $\frac{4}{\pi^2r^2}$, and so is at least $\frac{1}{3r^2}$ +for sufficiently large n.

+
+

I get the $\frac{4}{\pi^2r^2}$ part and how it is coming into picture, but what i dont get is $\frac{1}{3r^2}$,
+How it is at least $\frac{1}{3r^2}$ for large n?

+
    +
  • Also i was wondering if it is possible to get the condition $|\frac{c}{q} - \frac{d}{r}| \le \frac{1}{2q}$ from the probability calculated from the actual summation that is +$$P(c) = \frac{1}{q^2} \frac{\sin^2{(\frac{\pi mrc}{q})}}{\sin^2{(\frac{\pi rc}{q})}}$$ Where $m\approx \frac{Q}{r}$.
  • +
+

It would be really helpful if anybody can help me clear my doubts. Thanks in advance!!

+",12154,,,,,10/12/2020 18:16,Problem with Shor's factoring algorithm,,1,4,,10/18/2020 19:09,,CC BY-SA 4.0 +14114,2,,14098,10/12/2020 11:44,,0,,"

In the definition from this paper [1] the cost Hamiltonian is not restricted to the Ising Hamiltonian case. The paper also has an answer for the mentioned "general approach for $3/4$ ($n$) body interactions".

+

A direct quote from [1]:

+
+

From a classical cost function that is a polynomial in binary variables $x_1 , . . . , x_n $, we can construct a Hamiltonian $H_C$ on $n$ qubits by first rewriting the cost function in terms of variables $z_i \in \{−1, 1 \}$, where $x_i = (1 − z_i )/2$ to obtain a polynomial $f (z) = \sum_{C \subset \{1,...n\}} \alpha_C \prod_{j \in C} z_j$ and then replacing each occurrence of $z_i$ with the Pauli operator $\sigma_i^z$ . Thus, $H_C$ is diagonal in the $\sigma_z$-basis and takes the form

+

$$H_C = \sum_{C \subset \{1,...,n\}} \alpha_C \bigotimes_{j \in C} \sigma_i^z \tag{2}$$

+

where $C$ is a subset of all qubits, and $\alpha_C$ is a real coefficient for the many-body coupling between qubits in the subset $C$.

+
+

This means that if we have a classical cost function $f(x) = 4 x_1 +6x_1 x_2 - 2x_2 x_3 x_4$, we should replace $x$s with $z$s and obtain:

+

$$f(z) = 2(1 - z_1) + 3 (1 - z_1) (1 - z_2) - (1 - z_2) (1 - z_3) (1 - z_4)$$

+

After simplifying replace $z$s with $\sigma_z$s:

+

$$H_C = 4 I - 5 \sigma_1^z - 2 \sigma_2^z + \sigma_3^z + \sigma_4^z + 3 \sigma_1^z \sigma_2^z -\sigma_2^z \sigma_3^z -\sigma_3^z \sigma_4^z -\sigma_2^z \sigma_4^z + \sigma_2^z \sigma_3^z \sigma_4^z$$

+

and done. Note that this procedure will work also for QUBO$\rightarrow$Ising Hamiltonian (see this answer). This way we will be able to construct the cost Hamiltonian with the desired (in QAOA) property:

+

$$H_C |x\rangle = f(x)|x\rangle$$

+

where $x = x_1 x_2 x_3 x_4$ is a bitstring.

+

An example of the cost Hamiltonian with $3$-body coupling between qubits can be found in this paper [2] for the E3LIN2 problem ([2] Eq. $6$ with slightly changed notations):

+

$$ H_C = \frac{1}{2} \sum_{a < b < c} d_{abc} \sigma_a^z \sigma_b^z \sigma_c^z \tag{6}$$

+

where $d_{abc}$ is $0$ or $+1$ or $-1$, $a$, $b$ and $c$ are qubit indexes.

+
+

[1] Z. Wang, S. Hadfield, Z. Jiang, E. G. Rieffel, "The Quantum Approximation Optimization Algorithm for MaxCut: A Fermionic View"

+

[2] E. Farhi, J. Goldstone, S. Gutmann, "A Quantum Approximate Optimization Algorithm Applied to a Bounded Occurrence Constraint Problem"

+",9459,,1768,,10/26/2022 10:24,10/26/2022 10:24,,,,2,,,,CC BY-SA 4.0 +14115,1,14116,,10/12/2020 12:55,,3,390,"

I'm following the YouTube tutorials for Programming on Quantum Computers and I've completed everything until I reach circuit.draw() since I don't get $|0\rangle$ or 0 next to q or c. Here's my code:

+
from qiskit import *
+
+qr = QuantumRegister(2)
+cr = ClassicalRegister(2)
+circuit = QuantumCircuit(qr, cr)
+
+%matplotlib inline
+
+circuit.draw()
+
+[
+q0_0:
+q0_1:
+c0: 2/
+]
+
+

and so when I attempt an H gate, I receive the error 'QuantumRegister' object is not callable:

+
circuit.h(qr(0))
+
+
---------------------------------------------------------------------------
+TypeError                                 Traceback (most recent call last)
+<ipython-input-55-c8b4318b743b> in <module>
+----> 1 circuit.h(qr(0))
+
+TypeError: 'QuantumRegister' object is not callable
+
+",13480,,45,,12/19/2020 14:41,12/19/2020 14:41,I don't get anything when calling circuit.draw(),,2,0,,,,CC BY-SA 4.0 +14116,2,,14115,10/12/2020 13:07,,5,,"

There is probably a change on the default arguments of draw() function. To reproduce the same visualization as on the youtube video, try:

+
circuit.draw(initial_state=True, 
+             cregbundle=False)
+
+

and add a Hadamard gate like:

+
circuit.h(qr[0])
+
+",13109,,,,,10/12/2020 13:07,,,,2,,,,CC BY-SA 4.0 +14117,1,14271,,10/12/2020 13:39,,2,340,"

I tried to solve a simple system of two simultaneous linear equations in with HHL algorithm in Qiskit. In particular the system is $Ax=b$, where +$$ +A = \begin{pmatrix} +1.5 & 0.5 \\ +0.5 & 1.5 +\end{pmatrix} +$$ +and +$$ +b = \begin{pmatrix} +0.9010 \\ +-0.4339 +\end{pmatrix} +$$ +The matrix $A$ is Hermitian, so HHL should cope with it without any problems.

+

I wrote following code

+
%matplotlib inline
+# Importing standard Qiskit libraries and configuring account
+from qiskit import QuantumCircuit, execute, Aer, IBMQ
+import numpy as np
+from qiskit.compiler import transpile, assemble
+from qiskit.tools.jupyter import *
+from qiskit.visualization import *
+#HHL in Qiskit
+from qiskit.aqua.algorithms import HHL
+
+matrix_A = np.array([[1.5, 0.5],[0.5, 1.5]])
+vector_b = [0.9010, -0.4339]
+#x = [0.8184, -0.5747] #expected result
+
+backend = Aer.get_backend('statevector_simulator')
+#num_q – Number of qubits required for the matrix Operator instance
+#num_a – Number of ancillary qubits for Eigenvalues instance
+
+hhlObject = HHL(matrix = matrix_A, vector = vector_b, quantum_instance = backend, num_q = 2, num_a = 1)
+
+res = hhlObject.run(quantum_instance = backend)
+print(res)
+
+

However, this error occured

+
---------------------------------------------------------------------------
+AttributeError                            Traceback (most recent call last)
+<ipython-input-4-071684a21c97> in <module>
+      9 hhlObject = HHL(matrix = matrix_A, vector = vector_b, quantum_instance = backend, num_q = 2, num_a = 1)
+     10 
+---> 11 res = hhlObject.run(quantum_instance = backend)
+     12 print(res)
+
+/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/quantum_algorithm.py in run(self, quantum_instance, **kwargs)
+     68                 self.quantum_instance = quantum_instance
+     69 
+---> 70         return self._run()
+     71 
+     72     @abstractmethod
+
+/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/linear_solvers/hhl.py in _run(self)
+    399     def _run(self):
+    400         if self._quantum_instance.is_statevector:
+--> 401             self.construct_circuit(measurement=False)
+    402             self._statevector_simulation()
+    403         else:
+
+/opt/conda/lib/python3.7/site-packages/qiskit/aqua/algorithms/linear_solvers/hhl.py in construct_circuit(self, measurement)
+    204 
+    205         # InitialState
+--> 206         qc += self._init_state.construct_circuit("circuit", q)
+    207 
+    208         # EigenvalueEstimation (QPE)
+
+AttributeError: 'NoneType' object has no attribute 'construct_circuit'
+
+

I also tried to run construct_circuit method before run method, however, same error was returned.

+

Could you please tell me how to set parameters of HHL algorithm to run it correctly?

+",9006,,55,,10/12/2020 21:21,6/30/2021 22:42,Error when running HHL algorithm in Qiskit,,1,2,,,,CC BY-SA 4.0 +14118,2,,14115,10/12/2020 14:05,,2,,"

The following also work for me if it is interest to you:

+
from qiskit import *
+%matplotlib inline
+
+circuit = QuantumCircuit(2,2)
+circuit.h(0)
+circuit.draw()
+
+

+",9858,,1859,,10/12/2020 15:13,10/12/2020 15:13,,,,0,,,,CC BY-SA 4.0 +14119,1,,,10/12/2020 14:41,,2,205,"

I try to launch QSVM algorithm (from Qiskit example ) on all real quantum devices (that is IBM Q) and get running time 5-30 seconds on one job. But if I use ibmq_qasm_simulator, I get 5-20 ms (not always) on one job. I want to show comparison of time by QSVM and SVM for Big Data and I must use only real quantum devices (for QSVM). My friend did similar work and he got little running time on quantum device (ibmq_16_melbourne) in september (but It doesn't work today - the same longrunning time). What is changed?

+",13482,,9006,,10/13/2020 14:00,7/22/2022 1:03,Long running time at job,,1,0,,,,CC BY-SA 4.0 +14120,2,,14119,10/12/2020 14:55,,1,,"

The number of shots is also a factor in the running time of the circuit.

+

If you run a circuit with just one shot (shots = 1) then you will find that it uses less time than if you use 1000 shots.

+

Theoretically, you can extract the gate sampling time (the time to execute the particular gate) in your circuit and calculate the time you expect to run a circuit. Then multiply that by the number of shots.

+",9858,,,,,10/12/2020 14:55,,,,4,,,,CC BY-SA 4.0 +14121,2,,14113,10/12/2020 18:16,,2,,"
    +
  1. The Big-O notation $O(\cdot)$ is commonly used to describe algorithmic complexity classes, but it is a general notation used in math to denote asymptotic behavior of functions and sequences. It is convenient to use when you don't want / don't care to keep track of constants. In this context, what the big-O notation means in that equation, is that the value of the sum and the value of the integral are equal, up to an error which depends linearly on what it is inside the $O(\cdot)$. There is nothing special going on here, this is the usual approximation of an integral by Riemann sums. (Reading the paper, I believe that the author is only approximating the sum with the integral, so he is not considering the absolute-value-squared yet. He will do it later in the proof).

    +
  2. +
  3. This is again a statement about asymptotic behavior of functions. $4/\pi^2$ is roughly $0.4...$, which is larger than $1/3$. The probability is bounded from below by this quantity, but only asymptotically: it could be smaller at first, but sufficiently large $n$ is cannot go below that threshold, and therefore it cannot also go below $1/3r^2$.

    +
  4. +
  5. I am not quite sure what your third question is.

    +
  6. +
+",13486,,,,,10/12/2020 18:16,,,,1,,,,CC BY-SA 4.0 +14122,1,,,10/12/2020 19:40,,0,94,"

I have used the encoding procedure mentioned on page 35 of https://arxiv.org/pdf/quant-ph/9705052.pdf for the [5,1,3] code and then built the circuit for measuring the stabilizers (XZZXI, IXZZX, XIXZZ, ZXIXZ). I have used the respective Hadamard transformations to convert the X measurements to the Z measurements and by connecting it with the ancilla qubits through the respective gates I constructed the circuit to measure the syndrome. But instead of showing '0000' as the syndrome(since I have included no errors), it is showing results like,

+

{'1111 00000': 628, '1011 00000': 659, '0100 00000': 616, '1001 00000': 626, '0000 00000': 648, '1101 00000': 653, '0001 00000': 657, '1010 00000': 641, '0011 00000': 598, '0101 00000': 624, '0010 00000': 649, '0110 00000': 601, '1100 00000': 643, '0111 00000': 694, '1110 00000': 637, '1000 00000': 666}

+

where the first four qubits are the ancilla qubits. To make matters simple I have used the encoded state directly(so that there is no fault in encoding). Could there be a problem in the syndrome measurement circuit or it has something to do with the way qiskit's qasm_simulator?

+

I have attached my code below,

+
from qiskit import *
+import numpy as np
+from sympy.physics.quantum.tensorproduct import  TensorProduct
+
+es=list(range(0,32))
+
+import math
+a=1/math.sqrt(2)
+es[0]=es[18]=es[9]=es[20]=es[10]=a/4
+es[27]=es[6]=es[24]=es[29]=es[3]=es[30]=es[15]=es[17]=es[12]=es[23]=-a/4
+es[5]=a/4
+
+    
+
+b=1/math.sqrt(2)
+es[31]=es[13]=es[22]=es[11]=es[21]=b/4
+es[4]=es[25]=es[7]=es[2]=es[28]=es[1]=es[16]=es[14]=es[19]=es[8]=-b/4
+es[26]=b/4
+
+ph_qr=QuantumRegister(5,"physical_qubits")
+ph_cr=ClassicalRegister(5,"measured_physical_bits")
+an_qr=QuantumRegister(4,"ancilla_qubits")
+an_cr=ClassicalRegister(4,"measured_ancilla_bits")
+syndrome=QuantumCircuit(ph_qr, an_qr, ph_cr, an_cr)
+syndrome.initialize(es, ph_qr)
+
+syndrome_nf=syndrome.copy()
+syndrome_nf.h(ph_qr[2])
+syndrome_nf.h(ph_qr[3])
+syndrome_nf.h(an_qr[0])
+syndrome_nf.h(an_qr[1])
+syndrome_nf.h(an_qr[2])
+syndrome_nf.h(an_qr[3])
+syndrome_nf.cz(ph_qr[4], an_qr[0])
+syndrome_nf.cz(ph_qr[3], an_qr[0])
+syndrome_nf.h(ph_qr[3])
+syndrome_nf.cz(ph_qr[2], an_qr[0])
+syndrome_nf.h(ph_qr[2])
+syndrome_nf.cz(ph_qr[1], an_qr[0])
+syndrome_nf.h(ph_qr[4])
+syndrome_nf.cz(ph_qr[4], an_qr[1])
+syndrome_nf.h(ph_qr[4])
+syndrome_nf.h(ph_qr[3])
+syndrome_nf.cz(ph_qr[3], an_qr[1])
+syndrome_nf.h(ph_qr[3])
+syndrome_nf.cz(ph_qr[2], an_qr[1])
+syndrome_nf.cz(ph_qr[0], an_qr[1])
+syndrome_nf.h(ph_qr[4])
+syndrome_nf.cz(ph_qr[4], an_qr[2])
+syndrome_nf.h(ph_qr[4])
+syndrome_nf.cz(ph_qr[3], an_qr[2])
+syndrome_nf.cz(ph_qr[1], an_qr[2])
+syndrome_nf.h(ph_qr[0])
+syndrome_nf.cz(ph_qr[0] ,an_qr[2])
+syndrome_nf.cz(ph_qr[4], an_qr[3])
+syndrome_nf.cz(ph_qr[2], an_qr[3])
+syndrome_nf.h(ph_qr[1])
+syndrome_nf.cz(ph_qr[1], an_qr[3])
+syndrome_nf.h(ph_qr[1])
+
+syndrome_nf.cz(ph_qr[0], an_qr[3])
+syndrome_nf.h(ph_qr[0])
+syndrome_nf.h(an_qr[0])
+syndrome_nf.h(an_qr[1])
+syndrome_nf.h(an_qr[2])
+syndrome_nf.h(an_qr[3])
+syndrome_nf.draw()
+
+syndrome_nf.measure(an_qr, an_cr)
+
+simulator=qiskit.Aer.get_backend('qasm_simulator')
+result=execute(syndrome_nf, backend=simulator, shots=10240).result()
+count=result.get_counts()
+
+print(count)
+
+",13060,,10480,,3/10/2021 4:00,3/10/2021 4:11,"Syndrome showing unexpected results for the [5,1,3] QEC code in qiskit",,1,0,,,,CC BY-SA 4.0 +14123,2,,14096,10/12/2020 20:30,,0,,"

I would recommend trying the other way that they suggest, which is

+
git clone https://github.com/qiskit-community/qiskit-textbook.git
+cd qiskit-textbook
+pip install ./qiskit-textbook-src
+
+

You can find the juptyer notebooks with the content of the qiskit textbook in qiskit-textbook/content. There, you will find many different folders, each corresponding to a given chapter in the qiskit textbook.

+

If you would rather have access to the qiskit tutorials, you can access them on qiskit.org/documentation under the tab Tutorials, or download them locally with the command

+
git clone https://github.com/Qiskit/qiskit-tutorials.git
+
+

and in the tutorials folder you will find a folder corresponding to each category of tutorials.

+",13117,,,,,10/12/2020 20:30,,,,2,,,,CC BY-SA 4.0 +14124,2,,14103,10/12/2020 21:12,,0,,"

This is a special case of the following more general statement:

+

Let $A,B$ be matrices such that $AA^\dagger=BB^\dagger$. Then $A=BU$ for some unitary $U$.

+

That this is true follows easily looking at the singular value decomposition of the matrices: $AA^\dagger=BB^\dagger$ implies that $A$ and $B$ have the same singular values and same left singular vectors, therefore their SVDs have the form +$$A=\sum_k s_k |u_k\rangle\!\langle v_k|, +\qquad B = \sum_k s_k |u_k\rangle\!\langle w_k|.$$ +We then get the conclusion by simply choosing $U\equiv\sum_k |w_k\rangle\!\langle v_k|$.

+

To see why this statement is relevant to the original statement about states, notice that if $(\psi_{ij})_{ij}$ is the matrix of coefficients of a bipartite state $|\psi\rangle$, then $\operatorname{Tr}_2(|\psi\rangle\!\langle\psi|)=\psi\psi^\dagger$. +Therefore $\operatorname{Tr}_2(|\psi\rangle\!\langle\psi|)=\operatorname{Tr}_2(|\phi\rangle\!\langle\phi|)$ implies $\psi=\phi U$, which is equivalent to $|\psi\rangle=(I\otimes U^T)|\phi\rangle$.

+",55,,,,,10/12/2020 21:12,,,,0,,,,CC BY-SA 4.0 +14125,2,,14122,10/13/2020 0:52,,1,,"

Look at the start of the multiqubit section in this tutorial. In particular the section on basis vector ordering. I found the ordering of qubits to be very strange in qiskit possibly this is your error as well? For example the state $|10\rangle$ corresponds to qubit 0 being in state $|0\rangle$ and qubit 1 in state $|1\rangle$, contrary to what you might expect.

+",13261,,10480,,3/10/2021 4:11,3/10/2021 4:11,,,,2,,,,CC BY-SA 4.0 +14128,1,,,10/13/2020 10:22,,2,259,"

Question

+

Does the below calculation conclusively show the idea of conditional time evolution (if state measured is $x$ I do $y$ else I do $z$ ) increases the Von Neumann entropy? Has this already been established in the literature?

+

Calculation

+

Let's say I have an isolated system containing a measuring apparatus, an experimenter and a Hamiltonian system:

+

Let the Hamiltonian be:

+

$$ H_{sys}= H = \begin{pmatrix} +E_0 + \mu \cdot E & - \Delta \\ +- \Delta & E_0 - \mu \cdot E +\end{pmatrix}$$

+

where $\mu$ is the dipole moment , $E$ is the electric field and $E_0$ is the ground state energy and $\Delta$ is the tunnelling element.

+

Let the energy eigenstates be represented by:

+

$$ H | - \rangle = (E_0 - \sqrt{(\mu \cdot E)^2 + \Delta^2 }) | - \rangle $$ +$$ H | + \rangle = (E_0 + \sqrt{(\mu \cdot E)^2 + \Delta^2 }) | + \rangle $$

+

Now, the experimenter play the following game, if he measures the energy and finds the energy in the lower of the $2$ energy states he will double the electric field else he will half the electric field. Hence,

+

$$ H'(\pm) = H + \lambda_{\pm} I(\mu \cdot E) $$

+

where $I$ is the identity matrix and $ \lambda_+ = - 1/2$ and $\lambda_- = 1$

+

Let the energy eigenstates of $H'(\pm)$ be represented by:

+

$$ H' (-) | 0 \rangle = (E_0 - \sqrt{(1+ \lambda_{-})^2(\mu \cdot E)^2 + \Delta^2 }) | 0 \rangle $$

+

$$ H' (-) | 1 \rangle = (E_0 + \sqrt{(1+ \lambda_{-})^2(\mu \cdot E)^2 + \Delta^2 }) | 1 \rangle $$

+

$$ H' (+) | \tilde 0 \rangle = (E_0- \sqrt{(1+ \lambda_{+})^2(\mu \cdot E)^2 + \Delta^2 }) | \tilde 0 \rangle $$

+

$$ H' (+) | \tilde 1 \rangle = (E_0 + \sqrt{(1+ \lambda_{+})^2(\mu \cdot E)^2 + \Delta^2 }) | \tilde 1 \rangle $$

+

Let use the density matrix formalism for a pure state $|+\rangle + |- \rangle $:

+

$$ \rho = \frac{1}{2} \Big (|- \rangle \langle -| + |- \rangle \langle +| + |+ \rangle \langle -| + |+ \rangle \langle +| \Big) $$

+

OR:

+

$$ + \rho = \frac{1}{2} +\begin{bmatrix} +1 & 1 \\ +1 & 1 \\ +\end{bmatrix} +$$

+

Now lets say I measure the state and find it in $|- \rangle$ and the field is changed. Then using the sudden approximation:

+

$$ \rho' (-) = \Big (|0 \rangle \langle 0| \Big (|\langle -|0 \rangle |^2 \Big) + |1 \rangle \langle 0| \Big (|\langle -|0 \rangle ||\langle -|1 \rangle | \Big) + |0 \rangle \langle 1| \Big (|\langle -|0 \rangle ||\langle -|1 \rangle | \Big) + |1 \rangle \langle 1| \Big (\langle -|1 \rangle |^2 \Big) \Big) $$

+

OR:

+

$$ \rho' (-) = +\begin{bmatrix} +|\langle -|0 \rangle |^2 & |\langle -|0 \rangle \langle -|1 \rangle | \\ +|\langle -|0 \rangle \langle -|1 \rangle | & \langle -|1 \rangle |^2 \\ +\end{bmatrix} +$$

+

Similarly:

+

$$ \rho' (+) = \Big (| \tilde 0 \rangle \langle \tilde 0| \Big (|\langle -| \tilde + 0 \rangle |^2 \Big) + | \tilde 1 \rangle \langle \tilde 0| \Big (|\langle -|\tilde 0 \rangle ||\langle -| \tilde 1 \rangle | \Big) + | \tilde 0 \rangle \langle \tilde 1| \Big (| \langle -| \tilde 0 \rangle ||\langle -|\tilde 1 \rangle | \Big) + | \tilde 1 \rangle \langle \tilde 1| \Big (\langle -| \tilde 1 \rangle |^2 \Big) \Big) $$

+

OR:

+

$$ \rho ' (+)= +\begin{bmatrix} +|\langle +|0 \rangle |^2 & |\langle -|0 \rangle \langle +|1 \rangle | \\ +|\langle +|0 \rangle \langle -|1 \rangle | & \langle +|1 \rangle |^2 \\ +\end{bmatrix}$$

+

Hence, the new density matrix is given by:

+

$$ \rho ' = \rho '(+)\Big ( \frac{| \langle - | + \rangle + \langle + | + \rangle |^2}{2} \Big) + \rho '(-)\Big ( \frac{ | \langle - | - \rangle + \langle + | - \rangle |^2}{2} \Big) = p_+ \rho '(+) + p_- \rho '(-)$$

+

Now, let write down the explicit Hamiltonian of the isolated system:

+

$$ H_{iso} = H \otimes I_{\text{experimenter + apparatus}} + I \otimes H_{\text{experimenter + apparatus}} + H_{\text{int}}$$

+

Since, we suddenly change the electric field $H$ is time dependent and since this energy is supplied by the apparatus and experimenter (since he will expend energy to "calculate" how much to change the energy field by) along with the interaction between the systems. Note: $H_{iso}$ is time independent (as it is an isolated system)

+

$$ \rho_{iso} = \rho(t) \otimes \rho_R(t) $$

+

Where $R$ is the rest of the isolated system excluding the Hamiltonian system. Since the $H_{iso}$ is time independent so is $S(\rho_{iso})$. Comparing before ($t_-$) and after ($t_+$) the field is turned on:

+

$$ S(\rho_{iso}) = S(\rho \otimes \rho_R(t_-)) = S(\rho ' \otimes \rho_R(t_+) ) $$

+

Where $S$ is the Von Neumann entropy of both sides:

+

$$ S(\rho ' \otimes \rho_R(t_+) ) = S(\rho \otimes \rho_R(t_-) ) $$

+

Hence,

+

$$ S(\rho ') + S( \rho_R(t_+) ) = S(\rho ) + S( \rho_R(t_-) ) $$

+

Substituting $\rho '$ and using $\Delta S_R = S( \rho_R(t_+) ) - S( \rho_R(t_-) ) $

+

$$ S(p_+ \rho '(+) + p_- \rho '(-)) + \Delta S_R - S(\rho ) = 0 $$

+

Using an entropy bound :

+

$$ p_+ S( \rho '(+)) + p_- S(\rho '(-)) + \Delta S_R - p_+ \ln p_+ - p_- \ln p_- - S(\rho ) \leq 0 $$

+

Hence,

+

$$ \Delta S_R \leq p_+ \ln p_+ + p_- \ln p_- + S(\rho ) - p_+ S( \rho '(+)) - p_- S(\rho '(-)) $$

+

Note the $p_+ \ln p_+ + p_- \ln p_- = -S_m $ is nothing but the entropy of the Hamiltonian system when measurement is done but the electric field is not changed. We define $\Delta S_m = S_m - S(\rho )$ and $\rho '(-)$ and $\rho '(+)$ are pure states:

+

$$ \Delta S_R \leq - \Delta S_m $$

+",5045,,5045,,12/26/2020 8:14,12/26/2020 8:14,Conditional Time Evolution increases entropy?,,0,0,0,,,CC BY-SA 4.0 +14130,2,,14037,10/13/2020 14:16,,1,,"

We can take, for example, $ M = |0 \rangle \langle 0| \otimes I $, right? But then:

+

$$ +\Big|\Big| M(\rho - \sigma) \Big|\Big|_1 += \Big|\Big| |0 \rangle \langle 0| \otimes (p_0 \rho_0 - q_0 \sigma_0) \Big|\Big|_1 = \Big|\Big| p_0 \rho_0 - q_0 \sigma_0 \Big|\Big|_1 = 0 \implies +p_0 \rho_0 = q_0 \sigma_0 +$$

+

Similary, taking $ M = |x \rangle \langle x| \otimes I $, we get $ p_x \rho_x = q_x \sigma_x, \forall x $. We conclude that $ \rho = \sigma $.

+",13109,,,,,10/13/2020 14:16,,,,5,,,,CC BY-SA 4.0 +14131,1,,,10/13/2020 14:17,,5,34,"

Suppose we have two quantum channels $\mathcal{E}_{A\rightarrow B}, \mathcal{F}_{A\rightarrow B}$ that satisfy

+

$$D(\mathcal{E}(\rho_A)\|\mathcal{E}(\sigma_A))\geq D(\mathcal{F}(\rho_A)\|\mathcal{F}(\sigma_A)) \quad \forall \rho_A,\sigma_A\in \mathcal{H}_A,$$

+

where $D(\rho\|\sigma) = Tr(\rho\log\rho) - Tr(\rho\log\sigma)$. Is it then true that

+

$$D\left(\mathcal{E}^{\otimes n}(\rho_{A^n})\|\mathcal{E}^{\otimes n}(\sigma_{A^n})\right)\geq D\left(\mathcal{F}^{\otimes n}(\rho_{A^n})\|\mathcal{F}^{\otimes n}(\sigma_{A^n})\right) \quad \forall \rho_{A^n},\sigma_{A^n}\in \mathcal{H}_{A^n}$$

+

The question is due to a claim made in https://arxiv.org/abs/1110.5746. Proposition 4 is shown to hold for $n=1$ but on Page 3 (after Eq (8)), the claim is made for all $n$. I am not sure why. I understand it for the case where $\rho_{A^n}, \sigma_{A^n}$ are also $n$-fold tensor products i.e. $\rho_A^{\otimes n}$ but the statement here is for any pair of states in $\mathcal{H}_{A^n}$.

+",13493,,13493,,10/13/2020 14:24,10/13/2020 14:24,Relative entropy inequality for many copies of a channel,,0,1,,,,CC BY-SA 4.0 +14133,1,14134,,10/13/2020 17:17,,1,105,"

The superdense coding protocol requires that A and B share an entangled state. Why is that? +That is, why does the shared state have to be entangled? Does the protocol (implicitly) use the fact that the state is entangled?

+

Thank you

+",13495,,,,,10/13/2020 18:26,Significance of sharing an entangled state in Superdense Coding,,1,0,,,,CC BY-SA 4.0 +14134,2,,14133,10/13/2020 18:20,,1,,"

Superdense coding is a protocol used to transmit two classical bits of information from one party to the other by using only a single qubit and no classical communication between them. +It is a corollary of Holevo's theorem that 1 qubit can not hold more than 1 bit of information. A communication protocol which demonstrates the transmission of 1 classical bit from (say) Alice to Bob via a quantum channel would be that Alice prepares a qubit in either of the states |0> or |1> and transmits it to Bob. Bob then measures it in the computational basis to recover tha classical bit. This protocol only conveys 1 classical bit while transmitting 1 quantum bit (so no entanglement is involved). However, if the two parties already have a shared nonlocal resource (the 1 ebit), then it is possible to transmit 2 classical bits via superdense coding, at the cost of consuming 1 ebit resource. (The shared classical information would be private as well due to maximum entanglement in shared qubits). Once they have a shared ebit, Alice only needs to transmit her (single) qubit to transmit 2 classical bits (apart from applying local operations). The distinguishability of the Bell states upon a measurement in the Bell basis by Bob is where the entanglement is being used to achieve this. The increase in the number of bits conveyed per number of qubits transmitted is increased, but only at the cost of Alice and Bob having shared an entangled resource in the past.

+",13461,,13461,,10/13/2020 18:26,10/13/2020 18:26,,,,5,,,,CC BY-SA 4.0 +14135,1,,,10/13/2020 19:27,,1,90,"

I was going through the Grove documentation on the Variational Quantum Eigensolver. In one of the demonstrations with noisy gates, it is seen that resulting eigenvalue is quite close to the expected result, at least until the noise level exceeds a threshold. Is there a mathematical calculation which shows why the VQE is relatively insensitive to the low-level noise, and can the "threshold" (if it is indeed a threshold) be calculated for different ansätze?

+",13461,,,,,10/13/2020 19:48,Why is the VQE insensitive to noise?,,1,0,,,,CC BY-SA 4.0 +14136,2,,14135,10/13/2020 19:48,,1,,"

I think it is similar to how Neural Networks are also good at handling noise (up to a certain threshold).

+

VQE uses parameterized quantum circuit and hence it has the ability to adjust its parameters to absorb some of the noise. This is like how neural networks adjust their weights to absorb noise in the training data.

+",9858,,,,,10/13/2020 19:48,,,,0,,,,CC BY-SA 4.0 +14138,1,14140,,10/14/2020 4:34,,1,34,"

Let's say I am given a Hamiltonian $H$, whose ground state is efficiently preparable. We know that $||H|| \leq 1$. Let that ground state be $|\psi_{0}\rangle$, with energy $E_{0}$. We also know that the unitary $U$ such that +\begin{equation} +U |\psi_{0}\rangle |00\cdots0\rangle = |\psi_{0}\rangle |E_{0}\rangle, +\end{equation} +is efficiently preparable.

+

Consider the promise problem. For the yes instances, +\begin{equation} +E_{0} \geq c, +\end{equation} +and for the no instances, +\begin{equation} +E_{0} \leq s, +\end{equation} +where $c - s \geq \frac{1}{O\big(2^{poly(n)}\big)}$. Would this promise problem be in $BQP$?

+",1351,,,,,10/14/2020 6:37,How precise are BQP measurements?,,1,0,,,,CC BY-SA 4.0 +14139,1,15146,,10/14/2020 4:35,,3,112,"

I am a computer science undergraduate working on a project in simplifying quantum circuits (using the ZX-calculus). I was hoping to try to simplify some circuits of interest rather than randomly generated circuits. I am uninitiated in the physics/chemistry. Where can I find ready-to-go circuits of interest or how can I easily generate circuits like this to try to simplify them?

+",13497,,,,,12/15/2020 10:01,Where can I get circuits of interest to quantum chemistry to try and simplify?,,4,0,,,,CC BY-SA 4.0 +14140,2,,14138,10/14/2020 6:37,,2,,"

As you've written it, yes. The implication of what you've written is that $|E_0\rangle$ is prepared exactly. Since it has been done efficiently, we know that you must have used only a number of qubits that's polynomial in $n$. Thus, I can measure those poly($n$) qubits and exactly determine the value of $E_0$. Once I have an exact classical value, it's no problem to compare it to $c$ and $s$, again each expressed using poly($n$) bits.

+

However, I feel that this problem is not generally a good reflection of what one would have to do in practice. But I'm rather rusty on this sort of thing, and wouldn't want to commit myself further!

+",1837,,,,,10/14/2020 6:37,,,,0,,,,CC BY-SA 4.0 +14141,1,14145,,10/14/2020 6:52,,0,208,"

How do I output a Cirq gate as a Numpy array? For example, I would like to print a Pauli X gate cirq.X as

+
numpy.array([[0,1],[1,0]])
+
+

Thank you.

+",9903,,55,,10/26/2020 15:27,10/26/2020 15:27,Output a Cirq gate as a Numpy array?,,1,0,,,,CC BY-SA 4.0 +14142,2,,14139,10/14/2020 7:43,,0,,"

You can create an account at IBM Q Experience for free here. After logging, go to Quantum Lab (incons on left-hand side, it is a fifth icon from top). Here you can find tutorials to quantum computing and Qiskit. There is also part called Chemistry. So, you can use example circuits presented here.

+",9006,,,,,10/14/2020 7:43,,,,0,,,,CC BY-SA 4.0 +14143,1,,,10/14/2020 9:58,,1,38,"

We know that $T$ gate is as follows

+

$T=\left(\begin{array}{cc}1 & 0 \\ 0 & e^{i \pi / 4}\end{array}\right)$

+

And on the other resultant spin-resonance hamiltonian is

+

$\frac{H}{\hbar}=\frac{1}{2} \omega_{0} Z+g(X \cos \omega t+Y \sin \omega t)$

+

And if we go into the rotating frame we will have

+

$\mathrm{i} \frac{\partial}{\partial t}|\varphi(t)\rangle=\underbrace{\left[\mathrm{e}^{\mathrm{i} \omega t Z / 2} \frac{H}{\hbar} \mathrm{e}^{-\mathrm{i} \omega t Z / 2}-\frac{\omega_{0}}{2} Z\right]}_{\left[\frac{\omega_{0}-\omega}{2} Z+g X\right]|\varphi(t)\rangle}|\varphi(t)\rangle$.

+

So for example we can construct NOT operation, if the frequency of the AC magnetic field ($\omega$) is equal to the larmor frequncy ($\omega_0$), and then we have only $X$ gate.

+

Notice that $\omega$ is adjustable and using that we want to achieve $T$ gate. What do you think about that?

+",13403,,,,,10/14/2020 9:58,How can I achieve single-qubit $T$ operation using spin resonance?,,0,0,,,,CC BY-SA 4.0 +14144,1,,,10/14/2020 10:59,,2,71,"

This is in a similar spirit to another question I asked here.

+

Let's say I am given a $k$-local Hamiltonian $H$. We know that $||H|| \leq 1$. Let the ground state be $|\psi_{0}\rangle$, with energy $E_{0}$. Let $U$ be an $n$-qubit unitary such that +\begin{equation} +U |\psi_{0}\rangle |00\cdots0\rangle = |\psi_{0}\rangle |E_{0}\rangle. +\end{equation}

+

Let $V$ be an $n$-qubit unitary such that +\begin{equation} +V |00\cdots0\rangle = |\psi_{0}\rangle, +\end{equation}

+

Can we implement both $U$ and $V$ in polynomial space (ie, with polynomially many qubits), with exponentially many gates from a universal gate set, upto an inverse exponential (in the number of qubits) precision? In other words, let $U'$ and $V'$ be what we can actually implement with exponentially many gates, and let $|\psi_{0}'\rangle$ and $E_{0}'$ be the ground state and the ground energy we get by applying $V'$ and $U'$ respectively. What is the relation between $|\psi_{0}\rangle$ and $|\psi_{0}'\rangle$, and $E_{0}$ and $E_{0}'$? Are they also within an inverse exponential additive error to each other?

+

If so, is this an alternative proof that the $k$-local Hamiltonian problem, which is complete for QMA, can be solved in BQPSPACE (the quantum analogue of PSPACE)?

+

Is this also why we do not know if QMA is contained in BQP? In other words, we do not know if there is a description of $U$ and $V$ which requires only polynomially many gates.

+",1351,,,,,10/14/2020 10:59,How precise are BQPSPACE measurements?,,0,7,,,,CC BY-SA 4.0 +14145,2,,14141,10/14/2020 14:28,,2,,"

This can be done by calling cirq.unitary.

+
>>> import cirq
+>>> cirq.unitary(cirq.X)
+array([[0.+0.j, 1.+0.j],
+       [1.+0.j, 0.+0.j]])
+
+",362,,,,,10/14/2020 14:28,,,,3,,,,CC BY-SA 4.0 +14146,1,14153,,10/14/2020 14:58,,2,166,"

I am using QETLAB, a package for working with quantum information theory in Matlab and I have some doubts. I am trying to calculate diamond norms using such for some quantum channels. However, when doing so, it is said that a superoperator must be the input to the function. I know the Kraus representation of the channels I am testing, so I am not sure how to get the superoperator form of such. In the example they put in their wiki for their diamond norm they use a function called ChoiMatrix that calculates the Choi matrix of a supeorperator, but I am not sure if inputing the Kraus operators there will give me what I need.

+

An insight about the usage of the functions would be helpful, so as the relationship between superoperators, Kraus operators and Choi matrices.

+",2371,,55,,4/14/2021 8:39,4/14/2021 8:39,Choi matrix in QETLAB,,1,0,,,,CC BY-SA 4.0 +14147,1,14157,,10/14/2020 16:41,,0,116,"

I was creating a simple implementation of the Hadamard test when I came across the following, what seems like, strange behavior.

+

Consider the following snippet, which is part of the computating the expected value of the Pauli-$X$ operator with respect to the state $|\psi\rangle = \frac{1}{2}|0\rangle + \frac{\sqrt{3}}{2}|1\rangle$. After measuring the ancillary, we compute $Prob(|0\rangle) - Prob(|1\rangle) = Re(\langle \psi |X|\psi\rangle)$ (see https://en.wikipedia.org/wiki/Hadamard_test_(quantum_computation))

+

Circuit 1:

+
reg = QuantumRegister(2)
+classical = ClassicalRegister(1)
+qc = QuantumCircuit(reg, classical)
+
+def op():
+    r = QuantumRegister(1)
+    gate = QuantumCircuit(r)
+    gate.append(Operator(Pauli(label='X')), [*r])
+    return gate.to_gate()
+
+qc.initialize([1/2, np.sqrt(3)/2], [reg[1]])
+qc.barrier()
+qc.h(reg[0])
+qc.append(op().control(),[*reg])
+qc.h(reg[0])
+qc.barrier()
+qc.measure(reg[0], classical)
+job = execute(qc, Aer.get_backend('qasm_simulator'), shots=1024)
+print(job.result().get_counts())
+
+

The result from QASM is $\{'0': 499, '1': 525\}$, which is not correct. I verified with Qiskit's snapshot expectation that expected value is $\frac{\sqrt{3}}{2}$. This was also verified through density matrix computation with numpy.

+

However, if I replace this with the $CX$ as opposed to the Pauli-$X$ from the quantum info package of qiskit.

+

Circuit 2

+
reg = QuantumRegister(2)
+classical = ClassicalRegister(1)
+qc = QuantumCircuit(reg, classical)
+
+qc.initialize([1/2, np.sqrt(3)/2], [reg[1]])
+qc.barrier()
+qc.h(reg[0])
+qc.cx(reg[0], reg[1])
+qc.h(reg[0])
+qc.barrier()
+qc.measure(reg[0], classical)
+job = execute(qc, Aer.get_backend('qasm_simulator'), shots=1024)
+print(job.result().get_counts())
+
+

I got the following: $\{'0': 962, '1': 62\}$, which taking $(962-62)/1024$ produces an approximation to the correct result.

+

Next I printed out the transpilation of Circui1

+
t = transpile(qc, Aer.get_backend('qasm_simulator'), basis_gates=['u1','u2','u3','cx'])
+t.draw(output='mpl')
+
+

+

I verified that this circuit does in fact produce the same result as Circuit 1. However, I then did a density matrix computation using numpy, which also produced the same result. However, this revealed that there is an incorrect phase difference, not a global phase difference. +If we view the bipartite system as $reg[0] \otimes reg[1]$ where $reg[0]$ is the ancillary control bit, we get a unitary matrix for the gates in between the second set of barriers above (not including the Hadamards) like the following: +$\begin{bmatrix} +-1 & 0 &0 & 0 \\ + 0 & -1 &0 & 0 \\ + 0 & 0 &0 & -i \\ + 0 & 0 &-i & 0 \\ +\end{bmatrix}$

+

I verified that my computation in numpy was correct through multiple test; as a sanity check I compared my the matrices in the numpy simulation against those printed out by qiskit in the transpilation. +So this circuit is not the same as $CX$.

+

Any ideas as to why I am seeing this?

+

I thought this might be a Qiskit issue, but I posted it here in case I am missing something, which most likely the case.

+",8765,,55,,10/26/2020 15:20,10/26/2020 15:20,Odd behavior with Qiskit Pauli operators,,1,0,,,,CC BY-SA 4.0 +14148,1,14151,,10/14/2020 16:50,,5,675,"

I can understand the intuition behind a two dimensional bloch circle, as it represents the probability distribution of a certain state vector. However, I fail to grasp what the third dimension adds to the visualization when it comes to probabilities. How does it help? What is it supposed to add to the model that the Bloch circle didn't?

+

Since length is always 1, then what's the point of adding a z axis?

+",13449,,55,,6/10/2021 7:17,6/10/2021 7:17,Why is the Bloch sphere three-dimensional?,,3,0,,,,CC BY-SA 4.0 +14149,2,,14148,10/14/2020 17:11,,4,,"

You're not trying to visualise probabilities. You're trying to visualise the much richer structure afforded by probability amplitudes. For a single qubit, the probability amplitudes require 3 real parameters, hence three dimensional space.

+",1837,,,,,10/14/2020 17:11,,,,0,,,,CC BY-SA 4.0 +14150,1,14158,,10/14/2020 17:32,,7,438,"

I want to evalualte the quantum relative entropy $S(\rho|| \sigma)=-{\rm tr}(\rho {\rm log}(\sigma))-S(\rho)$, where $\sigma=|\Psi\rangle\langle\Psi|$ is a density matrix corresponding to a pure state and $\rho$ is a density matrix corresponding to an arbitrary mixed state. Here, $S(\rho)$ simply denotes the Von Neumann entropy of $\rho$. Given that $\sigma$ is diagonal, with eigenvalues $0$ and $1$ it seems that the first term in the quantum relative entropy will in general be infinite. As $S(\rho)\leq {\rm log}(d)$, where $\rho \in L({\mathcal H}^{d})$, the first term dominates and the quantum relative entropy is also infinite. Is this correct? And if so, what's the intuition behind this fact?

+",9082,,55,,10/22/2020 10:50,10/22/2020 10:50,Quantum relative entropy with respect to a pure state,,2,0,,,,CC BY-SA 4.0 +14151,2,,14148,10/14/2020 18:35,,6,,"

A qubit is a two-level quantum system and hence it can be written as:

+

$$ |\psi \rangle = \alpha |0\rangle + \beta|1\rangle $$

+

where $|0 \rangle$ and $|1\rangle$ are the computational basis and they defined as +$$ |0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} \ \ \ \ |1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix} $$

+

and $\alpha, \beta \in \mathbb{C}$. So we have that $|\psi \rangle \in \mathbb{C}^2 $ and you can think of $\mathbb{C}^2$ as $\mathbb{R}^4$. However, the overall phase in the quantum state doesn't matter, that is, $|\psi\rangle $ is equivalent to $e^{i\phi} |\psi \rangle$. Thus, you can factor this overall phase out of $|\psi\rangle$ and have only 3 parameters left. Essentially now you are considering the space $\mathbb{R}^3$. Along with the normalization requirement, that a quantum state must have unit norm, this forces it to be a unit-sphere, which we call the Bloch-Sphere.

+",9858,,,,,10/14/2020 18:35,,,,5,,,,CC BY-SA 4.0 +14153,2,,14146,10/14/2020 19:30,,4,,"

QETLAB usually deals with channels as Choi operators. You can convert your Kraus operators to the Choi matrix by providing the Kraus operators as a cell array. Example with the amplitude damping channel below.

+
>> damp = 0.3;
+>> K = { diag([1,sqrt(1-damp)]); [0,sqrt(damp);0,0] };
+>> ChoiMatrix(K)
+
+ans =
+
+    1.0000         0         0    0.8367
+         0         0         0         0
+         0         0    0.3000         0
+    0.8367         0         0    0.7000
+
+
+",13507,,13507,,10/15/2020 12:34,10/15/2020 12:34,,,,0,,,,CC BY-SA 4.0 +14155,1,,,10/14/2020 20:17,,0,98,"

Has qiskit already realised(solved) mathematical physics equations? For example, Laplace's equation,Poisson's equation or other? if it is yes, where can i find it?

+",13300,,,,,10/14/2020 22:45,Solving mathematical physics equations with Quantum Fourier Transform,,1,0,,,,CC BY-SA 4.0 +14156,1,,,10/14/2020 20:19,,3,217,"

As part of a project I'm working on, I want to use VQE algorithm to calculate the minimal eigenvalue for given Hamiltonian. I use Qiskit on IBM UI online.

+

The Hamiltonian is given as a sum of tensor products

+

$H = Z\otimes Z + Z \otimes X + ...$

+

I don't understand two main points:

+
    +
  1. How should I pass the Hamiltonian to the VQE? should I pass it as a list? i.e. $ H = [Z\^Z, X\^Z]$?
  2. +
  3. I understand that I need to create N circuits, where N is the number of tensor products which constitute the Hamiltonian, so that each circuit will handle another part of the Hamiltonian. Do I understand this correctly?
  4. +
+

Thank you.

+",13419,,13419,,10/14/2020 20:54,3/9/2022 16:55,How to use VQE function in Qiskit,,2,0,,,,CC BY-SA 4.0 +14157,2,,14147,10/14/2020 20:38,,1,,"

It is an issue. Adding control() to the gate introduces a phase difference. +You can verify that:

+
from qiskit.quantum_info import Operator, Pauli
+
+gate = QuantumCircuit(1)
+gate.append(Operator(Pauli(label='X')), [0])
+gate = gate.control() 
+
+print(Operator(gate).data)
+
+----
+Output:
+
+[[ 1   0   0   0]
+ [ 0   0   0  1j]
+ [ 0   0   1   0]
+ [ 0  1j   0   0]]
+
+

So circuit 1 actually computes $ \text{Re}\big(\text{i} \cdot\langle \psi| X |\psi \rangle \big) = 0 $

+",13109,,,,,10/14/2020 20:38,,,,1,,,,CC BY-SA 4.0 +14158,2,,14150,10/14/2020 22:02,,3,,"

If $\sigma$ is not full rank, then the correct way to interpret the quantum relative entropy formula you wrote is to assign it the value of $+\infty$ when the support of $\rho$ is not included in the support of $\sigma$. Wikipedia has a nice explanation of how to interpret this, but you can think that the reason for which the quantum relative entropy is finite in that case is that $\lim_{x\to 0} x \log(x) = 0$.

+

In your case, the support of $\sigma$ is simply the one-dimensional subspace spanned by $|\Psi\rangle$. For $\rho$ to be supported on this subspace, it must hold that $\rho$ is also pure, so it must be also equal to $|\Psi\rangle\!\langle\Psi|$, and so $\rho=\sigma$. In this case, the quantum relative entropy vanishes.

+

So in summary, if $\sigma$ is pure, than $S(\rho||\sigma)$ is either $0$ (when $\rho=\sigma$) or $+\infty$ (in the other cases).

+",13486,,,,,10/14/2020 22:02,,,,5,,,,CC BY-SA 4.0 +14159,2,,14156,10/14/2020 22:13,,0,,"

Try this:

+
from qiskit.aqua.operators import WeightedPauliOperator
+dict = {
+    'paulis': [{"coeff": {"imag": 0.00, "real": 1 }, "label": "ZZ" },
+              {"coeff": {"imag": 0.00, "real": 1 }, "label": "XX" }
+              ]
+}
+Operator = WeightedPauliOperator.from_dict(dict)
+
+

Now you can pass this operator to your VQE call:

+
VQE(operator= Operator, var_form= ... )
+
+",9858,,9858,,10/14/2020 22:23,10/14/2020 22:23,,,,1,,,,CC BY-SA 4.0 +14160,2,,14155,10/14/2020 22:45,,1,,"

I don't think Qiskit have what you are asking for. They have this community tutorial page that can be useful if you don't know about it already: https://github.com/qiskit-community/qiskit-community-tutorials

+
+

On the side note about QFT:

+

Although Quantum Fourier Transform, which is exactly identical to Discrete Fourier Transform, can be implemented efficiently on a quantum computer. An exponential speed up comparing to the classical Fast Fourier Transform even. It doesn't mean that it will be useful by running it on a quantum computer!

+

Quantum computing gives us an exponential scaling and a way to do this so efficient, but it also limits us from reading out the output state directly. That is,

+

$$QFT: |\psi \rangle \to |\phi \rangle$$

+

This doesn't mean we can see what $|\phi \rangle$ is since a quantum measurement collapse a wavefunction into one of the eigenstate.

+

That is why designing quantum algorithm to take advantage of the efficiency of QFT for hard classical problems is no easy task.

+",9858,,,,,10/14/2020 22:45,,,,1,,,,CC BY-SA 4.0 +14161,1,14169,,10/14/2020 23:47,,1,159,"

Given an arbitrary density matrix $\rho \in L({\mathcal H_{A}})$, can one always find a subspace ${\mathcal H_{B}}$ of ${\mathcal H_{A}}$ such that ${\mathcal H_{A}}={\mathcal H_{B}}\otimes{\mathcal H_{C}}$ and ${\rm tr}_{C}(\rho)=\sigma$ for a fixed density matrix $\sigma \in L({\mathcal H_{B}})$?

+

While a purification of $\sigma$ yields a pure state $| \Psi \rangle \langle \Psi |$ with the property ${\rm tr}_{C}(| \Psi \rangle \langle \Psi |)=\sigma$, I am wondering whether one can do the same given a fixed (possibly mixed) state $\rho$.

+

If this is possible, what would be the restrictions on the dimension of ${\mathcal H_{A}}$ (in relation to the size of ${\mathcal H_{C}}$)?

+",9082,,55,,1/22/2022 16:17,1/22/2022 16:17,"Given $\rho\in L(\mathcal H_A)$, can we find $\mathcal H_B\le \mathcal H_A$ such that ${\rm tr}_C(\rho)=\sigma$, for fixed $\sigma$?",,2,0,,,,CC BY-SA 4.0 +14164,1,14205,,10/15/2020 5:21,,2,694,"

Google's quantum computer is not yet available for the public. Is it possible to run Cirq on IBM's quantum computers, instead of Qiskit? And if so, how can I do it?

+

Thank you!

+",9903,,55,,10/26/2020 15:29,3/3/2021 15:04,Can I run Cirq on IBMQ?,,2,0,,,,CC BY-SA 4.0 +14165,1,14166,,10/15/2020 6:27,,2,205,"

I am learning to do QPE on qiskit. I wanted to choose a simple example to learn, and hence began with the state $|+\rangle$ and operator $X$.

+

I initialized $|+\rangle$ this way:

+
circ = QuantumCircuit(1)
+
+circ.h(0)
+
+a = Custom(num_qubits=1, state='zero', state_vector=None, circuit=circ) 
+
+blah = a.construct_circuit(mode='circuit', register=None) 
+
+statevec = Statevector.from_instruction(circ).data 
+
+

I then defined $X$ this way:

+
b = MatrixOperator(np.array([[0,1],[1,0]]), basis=None, 
+                   z2_symmetries=None, atol=1e-12, name=None) 
+
+

Finally, I gave the QPE commands:

+
backend = Aer.get_backend('statevector_simulator')
+
+qpe = QPE(operator=b, state_in=statevec, iqft=None, 
+          num_time_slices=1, num_ancillae=1, 
+          expansion_mode='trotter', expansion_order=1, 
+          shallow_circuit_concat=False)
+
+quantum_instance = QuantumInstance(backend=backend)
+
+results = qpe.run(quantum_instance)
+
+

However, when I try running QPE, I run into this error:

+
AttributeError: 'numpy.ndarray' object has no attribute 'construct_circuit'
+
+

If I define my operator instead this way:

+
b = Operator([[0,1],[1,0]])
+
+

I get the error:

+
AquaError: "Unsupported type to convert to WeightedPauliOperator: <class 'qiskit.quantum_info.operators.operator.Operator'>"
+
+

I also tried:

+
b = Pauli.x
+
+

but ran into:

+
AttributeError: 'property' object has no attribute 'copy'
+
+

Can someone help me with defining the state and operator correctly?

+",11697,,55,,10/26/2020 15:29,10/26/2020 15:29,QPE example on Qiskit,,1,0,,,,CC BY-SA 4.0 +14166,2,,14165,10/15/2020 7:20,,0,,"

You should try to insert your code so that it is more readable. Take the code in your notebook, and entered it in with the Preformatted text option. This way it is easier to produce the errors you get and make it easier for people to help you to find a solution

+
+

In regard to your issue of defining the operator, as I mentioned in another answer sometime earlier, you can define the operator as:

+

+from qiskit.aqua.operators import WeightedPauliOperator
+
+dict = {
+
+    'paulis': [{"coeff": {"imag": 0.00, "real": 1 }, "label": "X" }}]
+}
+
+b = WeightedPauliOperator.from_dict(dict)
+
+
+

Now you can try to pass b in the QPE(operator = b, , …)

+
+

UPDATE:

+

Try to run this:

+
import qiskit 
+from qiskit import __qiskit_version__
+from qiskit.aqua.algorithms import QPE
+from qiskit.aqua.operators import WeightedPauliOperator
+from qiskit.aqua.components.initial_states import Custom
+from qiskit import IBMQ, BasicAer, Aer
+from qiskit import QuantumCircuit
+from qiskit.aqua import QuantumInstance
+from qiskit.circuit.library import QFT
+
+print(qiskit.__qiskit_version__)
+
+a = Custom(1,state = 'uniform')  #Initial state as you wanted. 
+dict = {
+    'paulis': [{"coeff": {"imag": 0.00, "real": 1 }, "label": "X" }]
+}
+
+b = WeightedPauliOperator.from_dict(dict) #Operator for input into QPE 
+
+#-------- Setting up Backend --------#
+provider = IBMQ.load_account()
+quantum_instance = QuantumInstance(backend=Aer.get_backend("statevector_simulator"), shots=1)
+#------------------------------------#
+
+n_ancillae = 3
+iqft = QFT(n_ancillae).inverse()
+qpe = QPE(b, a, iqft, num_time_slices=1, num_ancillae=n_ancillae,
+          expansion_mode='trotter', expansion_order=1, shallow_circuit_concat=False)
+qpe_result = qpe.run(quantum_instance)
+
+qc = qpe.construct_circuit(measurement = True)
+qc.draw( ) 
+
+
+

Running the above code I get the following:

+

+",9858,,9858,,10/15/2020 18:27,10/15/2020 18:27,,,,4,,,,CC BY-SA 4.0 +14167,2,,14161,10/15/2020 7:36,,1,,"

If i understand your question correctly, no, it's not possible. Take for example +$$ \rho = | 0 \rangle \langle 0|^{\otimes |A|} +\hspace{0.2em} \in D(\mathcal{H_A}) $$ +For every choice $ \mathcal{H_B}, \mathcal{H_C} $ such that $ \mathcal{H_A} = \mathcal{H_B} \otimes \mathcal{H_C} $ we have +$$ \text{Tr}_C [ \rho ] = | 0 \rangle \langle 0|^{\otimes |B|} $$ +so it can not be the case that $ \text{Tr}_C [ \rho ] = \sigma $ for an arbitary fixed $ \sigma \in D(\mathcal{H_B}) $.

+",13109,,,,,10/15/2020 7:36,,,,5,,,,CC BY-SA 4.0 +14168,2,,14164,10/15/2020 7:49,,3,,"

Good question. I tried to figure this out as well since I saw your question without much success.

+

However, I just wanted to point out that you can use Pennylane since it offers many external plugins so it allows you to run on many external hardware. See here: https://pennylane.ai/plugins.html

+

You can use Qiskit and aim at multiple external devices outside of IBM's QC. For instance, you can use Qiskit and run your code on Honeywell Trapped-ion backend given that you have an API token. See here: https://github.com/qiskit-community/qiskit-honeywell-provider
+There are a few other external backends that you can use through Qiskit.

+

So even though I wasn't able to find the solution to your question, I hope this helps.

+",9858,,,,,10/15/2020 7:49,,,,0,,,,CC BY-SA 4.0 +14169,2,,14161,10/15/2020 8:40,,3,,"

First of all, your question should be more carefully formulated, since it is not even possible to always find a non-trivial subsystem (not subspace) of $\mathcal H_A$, see also my comment here Can a single qutrit in superposition be considered entangled?

+

Thus, let us assume that $\mathcal H_A$ does not have prime dimension, $d_A=\dim\mathcal H_A$. The question should then be the following: +Given a Hilbert space $\mathcal H_B$ where $d_B=\dim\mathcal H_B$ divides $d_A$, and a density matrices $\rho\in\mathcal H_A$ and $\sigma\in\mathcal H_B$, is there a choice of tensor product $\mathcal H_A \simeq \mathcal H_B\otimes\mathcal H_C$, such that $\mathrm{tr}_C(\rho)=\sigma$.

+

I'm not so sure why you would call this a "purification", though.

+

This can sometimes be true. For example, take for simplicity $\mathcal H_B=\mathcal H_C=\mathbb C^d\otimes\mathbb C^d$ and define $\mathcal H_A := \mathcal H_B\otimes \mathcal H_C$. +Let $\phi^+$ be the standard maximally entangled state with respect to the bipartition of $\mathcal H_C=\mathcal H_B$. +Consider the product state $\rho=|\phi^+\rangle\langle\phi^+|\otimes|\phi^+\rangle\langle\phi^+|$, and $\sigma = \mathbb{I}/d^2$. Then there is always a different bipartition $A=B'|C'$ of $A$, such that $\mathrm{tr}_{C'}(\rho) = \sigma$. You can explicitly verify this by writing down the state and swapping the second tensor factors of $B$ and $C$.

+

Update: +However, in general, this is false since the partial trace make the state $\rho$ "more mixed". As pointed put by Danylo, the to states should fulfill some majorisation condition about their spectrum.

+

Here's a counter-example. Take $\rho = \mathbb{I}/d_A$. Then, for any choice of bipartition, $\mathrm{tr}_C(\rho) = \mathbb{I}/d_B$. Take $\sigma$ to be any other state, e.g. a pure one.

+",2305,,2305,,10/15/2020 9:10,10/15/2020 9:10,,,,4,,,,CC BY-SA 4.0 +14170,1,14171,,10/15/2020 11:04,,7,714,"

I'm learning about the VQE algorithm. When I looked at the declaration in Qiskit I saw you need to pass an ansatz which prepares the state. I looked at some commonly used ansatz functions, e.g. EfficientSU2 of Qiskit, and I saw many of them use $R_y$ and $X$ gates.

+

I was wondering why exactly was this structure chosen? What's the physical logic behind it that makes it so convenient to use for many different Hamiltonians? How can the structure of the Hamiltonian affect the construction of the ansatz?

+

Thank you

+",13419,,55,,10/26/2020 15:28,4/20/2021 6:24,Intuition behind the construction of an ansatz circuit,,1,0,,,,CC BY-SA 4.0 +14171,2,,14170,10/15/2020 11:26,,8,,"

Interesting question!

+

An ansatz circuit is a parameterized circuit, say $V(\theta)$ where $\theta$ are a set of parameters, used to prepare a trial state for your problem: +$$ +|\Psi(\theta)\rangle = V(\theta)|0\rangle +$$ +In a variational algorithm, such as VQE, the trial state encodes your solution and is iteratively updated until some termination criterion is met. +$$ +|\Psi(\theta_0)\rangle \rightarrow |\Psi(\theta_1)\rangle \rightarrow \dots \rightarrow |\Psi(\theta_n)\rangle +$$ +Therefore the first question you must ask when looking for an ansatz is: Can the trial state prepared by my ansatz circuit encode my solution? +For example: Does your solution contain complex amplitudes? If yes, you need a circuit that contains complex amplitudes (such as EfficientSU2). If no, you could use one that has only real amplitudes (such as RealAmplitudes).

+

Apart from that, I think we can distinguish in two different categories of ansatz circuits: physically motivated ones and heuristic ones.

+

Physically motivated ansatz circuits are based on some knowledge of the problem we want to solve. For example the UCCSD ansatz prepares a state where tuning the parameters turns excitations on and off. A potential drawback here is that the circuits can get massive! Go ahead and check out the size of a UCCSD ansatz. For the order of 10 parameters your circuit can already have 1000s of gates. That's not in reach of today's hardware and cannot be run meaningfully on an actual quantum computer.

+

Heuristically motivated ansatz circuits, are essentially circuit that we tested and they turned out to work well. An interesting class are hardware efficient circuits (which usually are circuits with 1- and 2-qubit gates) which we can implement efficiently on hardware. EfficientSU2 also falls into this category.

+

Then there are mixtures between these circuits. For instance, Qiskit's ExcitationPreserving circuit prepares a trial wave function, that preserves the particle numbers of you solve a molecular ground state calculation and used a Jordan-Wigner mapping to get the qubit operator.

+

This notebook, among other things, discusses this topic.

+",9800,,9800,,4/20/2021 6:24,4/20/2021 6:24,,,,0,,,,CC BY-SA 4.0 +14172,1,,,10/15/2020 11:55,,0,105,"

I'm trying to understand, given a specific Hamiltonian, for example $H = Z\otimes Z+X\otimes Z$, does the VQE algorithm calculates the expectation value of $Z\otimes Z$ first or does it calculates the expectation value of $X\otimes Z$ first? couldn't understand it from the source code.

+

Thank you very much!

+",13419,,,,,11/14/2020 19:05,How does VQE performs the measurement on a given Hamiltonian?,,2,2,,,,CC BY-SA 4.0 +14174,1,14175,,10/15/2020 14:26,,3,241,"

I was reading the Quanta article here which shows that there exists a problem which achieves "oracle separation between BQP and PH". In simple terms, there exists a problem which a quantum computer can solve with far fewer calls to an oracle than a classical computer could (even in the realm where P=NP).

+

Why is this a stronger result than the well-known Deutsch-Jozsa algorithm to decide if a function is constant or balanced? In that case too, a classical computer had to make $O(n)$ calls to an oracle (the function) while a quantum computer could do so with a single query. Does this not prove that quantum computers are distinct from any possible classical computer, even if P=NP?

+",4831,,2927,,10/15/2020 15:22,10/16/2020 16:04,BQP and PH separation,,1,0,,,,CC BY-SA 4.0 +14175,2,,14174,10/15/2020 15:34,,4,,"

The Deutsch-Josza problem provides an oracle separation between $\mathsf{EQP}$ (exact quantum-polynomial time) and $\mathsf{P}$, but there's no preclusion against adding randomization to get an efficient classical algorithm.

+

For example, the Deutsch-Josza problem is trivially in $\mathsf{BPP}$. One could just make a small number of calls to the oracle; if you ever see two different outputs you know the oracle is balanced, but if you always see the same outcome then you can conclude that the oracle is constant with high-probability.

+

Further there is a reasonable derandomization conjecture that $\mathsf{BPP}$ is equal to $\mathsf{P}$. Thus the Deutsch-Josza problem is in $\mathsf{P}$, modulo such a derandomization conjecture.

+

However, the "forrelation problem" considered in the Raz-Tal paper and discussed in the Quanta article provides an oracle separation between $\mathsf{BQP}$ and $\mathsf{PH}$. This forrelation problem is not likely in $\mathsf{BPP}$.

+

For example, you can't, with high probability, run your oracle with a classical computer in polynomial time, and then use something akin to Chernoff's bound on the outputs to determine whether the given distribution is the uniform distribution or the forrelation distribution.

+",2927,,2927,,10/16/2020 16:04,10/16/2020 16:04,,,,2,,,,CC BY-SA 4.0 +14176,1,14181,,10/15/2020 15:35,,1,113,"

Is there any algorithm that implements wavelet (like there is Quantum Fourier Transform)? I've tried looking online, but couldn't find any, I wonder if something like this exists.

+

Thank you.

+",13419,,55,,10/26/2020 15:19,10/26/2020 15:19,Is there any algorithm that implements wavelet?,,1,0,,,,CC BY-SA 4.0 +14177,1,,,10/15/2020 15:55,,3,64,"

I have asked two similar questions 1, 2 but have not received a definite answer, so here I have narrowed the issue down to one hopefully more easily addressed aspect of the big question. Unfortunately I do not have a quantum computation background, and don't yet understand the usual notation used in the field. A link to an article that provides an answer that I can gradually decipher would be sufficient.

+

Given an elementary entangled state of N qubits, is there a quantum operation that produces the complement of the entangled state?

+

By "elementary entangled state of N qubits", I mean a state in which all of the N qubits are entangled with each other such that measuring the value of any one qbit will determine the values of all the other qubits.

+

By "complement", I mean a superposition of all states that are orthogonal to the elementary entangled state, where the "weights" of all the independent components of the superposition are the same.

+

The closest I've been able to come on my own to answering the question is to see that the hypothetical operation would not lose any information and would be reversible. And, it seems that simply adding an ancillary bit to identify a state as the complement of another state would almost be good enough (except that the components of that state wouldn't be very easily accessible for downstream operations).

+",13320,,55,,10/17/2020 20:29,10/17/2020 20:29,"A quantum operation to form the complement of an ""elementary"" entanglement of N qbits?",,0,8,,,,CC BY-SA 4.0 +14178,1,,,10/15/2020 17:09,,-1,75,"

Please, help me understand this statement. +The outer product notation for matrices also gives an intuitive input-output relation for them. +For instance, the matrix |0⟩ ⟨1| + |1⟩ ⟨0| can be read as "output 0 when given a 1 and output 1 when +given a 0".

+",13517,,55,,10/26/2020 15:20,10/26/2020 15:20,Outer Product Intution,,1,1,,10/19/2020 9:44,,CC BY-SA 4.0 +14179,2,,14178,10/15/2020 17:23,,4,,"

Note that

+

$$ +|0\rangle\langle 1| = \begin{pmatrix} 1 \\ 0 \end{pmatrix} \begin{pmatrix} 0 & 1 \end{pmatrix}= \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix} +$$ +and similarly

+

$$ +|1\rangle\langle 0| = \begin{pmatrix} 0 \\ 1 \end{pmatrix} \begin{pmatrix} 1 & 0 \end{pmatrix}= \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix} +$$ +and therefore +$$ X = |0\rangle\langle 1| + |1\rangle\langle 0| = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} $$

+

Thus you can see that $X|0\rangle = |1\rangle$ and $X|1\rangle = |0\rangle$. So giving the input is the state $|0\rangle$ then the output is the state $|1\rangle$ and vice versa.

+",9858,,,,,10/15/2020 17:23,,,,2,,,,CC BY-SA 4.0 +14180,2,,14172,10/15/2020 17:52,,0,,"

Thank you for your answers. After a check it appears that the VQE algorithm processes first the rightmost expression and only then the leftmost. i.e. it first processes $X\otimes Z$ and then $Z\otimes Z$

+",13419,,,,,10/15/2020 17:52,,,,0,,,,CC BY-SA 4.0 +14181,2,,14176,10/15/2020 18:10,,1,,"

Could you be looking for this: Quantum Wavelet Transforms: Fast Algorithms and Complete Circuits? (this links to arxiv.) In particular, this paper presents efficient circuits for the Haar and Daubechies wavelet transforms.

+",13461,,,,,10/15/2020 18:10,,,,0,,,,CC BY-SA 4.0 +14182,2,,14148,10/15/2020 19:00,,4,,"

The Bloch sphere represents state with the following probability amplitudes: +$$|\psi\rangle = \cos(\theta/2)\ |0\rangle +e^{i\phi} \sin(\theta/2)\ |1 \rangle, $$ +where $\theta$ and $\phi$ are the angles on the Bloch sphere. Each point on the sphere represents a different state. As mentioned by other answers these $\cos(\theta/2) $ and $e^{i\phi} \sin(\theta/2) $ are not probabilities of the state being in the state $0$ or $1$, rather they represents the probability amplitudes. To get a probability form a probability amplitude, we square the probability amplitudes. That is, $\cos^2(\theta/2) $ and $\sin^2(\theta/2) $ are the probabilities, and you see they add up to $1$.

+

You also notice that the angle $\phi$ does not show up in the expressions for probabilities. Does this mean that we can just ignore $\phi$ all together? No. If we could then indeed we wouldn't need a 2-dimensional sphere to represents the states.

+

The reason we cannot ignore the angle $\phi$ from our considerations is because of +the superposition principle of quantum mechanics. Suppose we have, +$$|\psi_1\rangle = \frac{1}{\sqrt{2}}( |0\rangle + |1 \rangle), \ \ \ \ \ \ \ \ \ |\psi_2\rangle = \frac{1}{\sqrt{2}}( |0\rangle +e^{i\phi} \ |1 \rangle.$$ +Then the superposition principle tells us that we can make a third state out of their superposition, +$$|\psi_3\rangle = N(|\psi_1\rangle + |\psi_2\rangle) = \sqrt{\frac{2}{3+\cos(\phi)}}\left(|0\rangle + \frac{1+e^{i\phi}}{2} |1\rangle \right) ,$$ +where $N$ is some normalization factor written down explicitly in the second equality. Anyway, the point here is now $\phi$ is very important. For example the probability of the state $|\psi_3 \rangle$ being in the $|1\rangle$ state is, $$P(1) = \frac{1+\cos(\phi)}{3+\cos(\phi)}$$ +which very much depends on $\phi$. In fact this probability ranges from $0.5$ when $\phi = 0$ to $0$ when $\phi = \pi$.

+",13215,,,,,10/15/2020 19:00,,,,0,,,,CC BY-SA 4.0 +14183,1,14184,,10/15/2020 19:56,,3,81,"

Are there any papers on the classical optimization part of QAOA? +What is the most efficient method now?

+

And how is the classical optimization classified?

+",11646,,55,,10/17/2020 20:22,10/17/2020 20:22,Papers on classical optimization in QAOA,,1,0,,,,CC BY-SA 4.0 +14184,2,,14183,10/15/2020 20:03,,6,,"

These papers might help:

+
    +
  1. Classical Optimizers for Noisy Intermediate-Scale Quantum Devices

    +
  2. +
  3. Collective optimization for variational quantum eigensolvers

    +
  4. +
+

Also look at these optimizers from Pennylane.

+",9858,,9006,,10/16/2020 10:34,10/16/2020 10:34,,,,0,,,,CC BY-SA 4.0 +14185,1,14197,,10/15/2020 20:14,,12,649,"

Given a quantum circuit $C_1$ that generates a state $\vert\psi\rangle$ and another circuit $C_2$ that generates $\vert\phi\rangle$, is there a way to construct a circuit that outputs

+

$$\frac{1}{\sqrt{2}}(\vert \psi\rangle +\vert\phi\rangle)$$

+

using $C_1$ and $C_2$ as black boxes?

+",13521,,,,,10/17/2020 9:54,Superposition of quantum circuits,,3,9,,,,CC BY-SA 4.0 +14187,1,14188,,10/15/2020 23:49,,0,137,"

I am working with a matrix of the following form:

+

$$ +A =\begin{pmatrix} +a_{11} & Q & \ldots & Q\\ +a_{21} & Q & \ldots & Q\\ +\vdots & \vdots & \ddots & \vdots\\ +a_{n1} & Q &\ldots & Q +\end{pmatrix} +$$

+

where the $a_{ij}$ elements are real and predetermined, the $Q$'s are placeholders and not necessarily equal to one another, and $A$ is square of size $n$x$n$. I am looking to find values for all $Q$'s such that $A$ is unitary. To do this I have attempted to set up a system of nonlinear equations of the form $AA^\dagger=I$ which yields a system of $n^2-n$ unknown $Q$'s, but only $n^2/2 +n/2$ equations after removing any duplicate equations. Therefore, for $n=2$ the system is over-determined and for $n>3$ the system is under-determined.

+

My question is, is there a method in which I can solve for $Q$'s to force $A$ to be unitary given these constraints for any size n?

+",13244,,,,,10/16/2020 5:31,How to force a matrix to be unitary given constraints on some of the elements?,,1,0,,10/18/2020 23:18,,CC BY-SA 4.0 +14188,2,,14187,10/16/2020 0:25,,3,,"

How about just performing the Gram-Schmidt Process?

+

Pick the other $n-1$ arbitrary linear independent vectors and perform Gram_schmidt process.

+

Caveat: This requires that the vector of the first column is already normalized. Otherwise we will have $AA^* = cI $ instead.

+
+

Update: I found another related/exact same question. Here is the link:

+

How can I fill a unitary knowing only its first column?

+",9858,,9858,,10/16/2020 5:31,10/16/2020 5:31,,,,4,,,,CC BY-SA 4.0 +14190,2,,11349,10/16/2020 4:35,,-2,,"

For 32 bit you only need 5 qubits not 32 qubits. $2^n=N$, where $n$ stands for number of qubits, and $N$ stands for number of bits.

+",12484,,27,,10/16/2020 21:29,10/16/2020 21:29,,,,1,,,,CC BY-SA 4.0 +14191,1,,,10/16/2020 7:32,,6,99,"

I understand that a quantum computer is universal if it can compute anything that a quantum Turing machine can. Another way to think about universality is that any unitary transformation on, e.g., a registry of qubits or their continuous-variable counterparts, qumodes, can be approximated. One may also consider ways to decompose unitary transformations into circuits of quantum gates and then introduce the concept of a universal gate set, that is to say a set of gates that can be combined into a finite circuit that can approximate any given unitary transformation as accurately as one desires. These topics have already been discussed in this SE for example here and here.

+

Is it the case that the universalities of a discrete-variable quantum computer and a continuous-variable quantum computer are in fact different? Different in the sense that what we consider to be the set of all unitary transformations appear at least to me to be different in the two cases? Or am I missing something and they both can be shown to be equivalent to the same quantum Turing machine?

+",144,,55,,10/24/2020 14:35,10/24/2020 14:35,Is the universality of a qubit based quantum computer different from the universality of a continuous-variable quantum computer?,,0,2,,,,CC BY-SA 4.0 +14192,2,,14150,10/16/2020 8:18,,3,,"

I'd like to add to Angelo Lucia's answer slightly. It is not very surprising that $S(\rho \| \sigma)$ can take the value $+\infty$ once we realise that the relative entropy is a generalization of the Kullback-Liebler divergence $D(p \| q)$ between probability distributions $p$ and $q$. Formally, given two distributions $p,q$ over some finite set $\mathcal{X}$ the KL-divergence is defined as +$$ +D(p\| q) = \begin{cases} +\sum_{x \in \mathcal{x}} p(x) \log \frac{p(x)}{q(x)} \quad & \text{if } \mathrm{supp}(p) \subseteq \mathrm{supp}(q) \\ ++ \infty & \text{otherwise} +\end{cases} +$$ +where $\mathrm{supp}(p) = \{x \in \mathcal{X} : p(x)> 0\}$. Note that if we fix a basis and consider only diagonal states in that basis, i.e. $\rho = \sum_{x} p(x) |x\rangle \langle x |$ and $\sigma = \sum_x q(x) |x\rangle \langle x |$, then computing $S(\rho \| \sigma)$ we recover exactly the KL-divergence $D(p \| q)$. The analogous situation to taking $\sigma$ to be a pure state is taking $q$ to be some point distribution (delta-distribution). In this case we see that $D(p\| q)$ is finite iff $p=q$, which is exactly what we observe in the quantum case for pure states.

+",9854,,,,,10/16/2020 8:18,,,,0,,,,CC BY-SA 4.0 +14193,1,,,10/16/2020 10:12,,-1,83,"

I'm trying to follow tutorial on pulse simulation described in qiskit.org. +The generated PulseQobj is well executed with AER simulator, but it throws JSONDecodeError when using real backends (ex. ibmq-armonk). The PulseQobj passed the validation (validate_qobj_against_schema), so I'm struggling to find the reason. Qobj, generated by QuantumCircuit command, does not raise this error.

+

I connected to real device with APItoken, and qiskit version is up to date (qiskit 0.22.0). +Below is the trial code with real device, and log after backend.run(PulseQobj)

+
%matplotlib inline
+
+import numpy as np
+from qiskit.ignis.characterization.calibrations import rabi_schedules, RabiFitter
+from qiskit.pulse import DriveChannel
+from qiskit.compiler import assemble
+from qiskit.qobj.utils import MeasLevel, MeasReturnType
+from qiskit import IBMQ
+
+IBMQ.enable_account(APItoken, proxies = ProxyConfig, verify = certPath)
+provider = IBMQ.get_provider(hub=hub, group=group, project=project)
+backend = provider.get_backend(device)
+
+# qubit list
+qubits = [0]
+
+# drive amplitudes to use
+num_exps = 64
+drive_amps = np.linspace(0, 1.0, num_exps)
+
+# drive shape parameters
+drive_duration = 2048
+drive_sigma = 256
+
+# list of drive channels
+drive_channels = [DriveChannel(0)]
+
+# construct the schedules
+rabi_schedules, xdata = rabi_schedules(amp_list=drive_amps, 
+                                       qubits=qubits, 
+                                       pulse_width=drive_duration, 
+                                       pulse_sigma=drive_sigma,
+                                       drives=drive_channels, 
+                                       inst_map=backend.defaults().instruction_schedule_map, 
+                                       meas_map=backend.configuration().meas_map)
+
+rabi_qobj = assemble(rabi_schedules, 
+                     backend=backend,
+                     meas_level=1, 
+                     meas_return='avg',
+                     shots=512)
+
+result = backend.run(rabi_qobj).result()
+
+
+
---------------------------------------------------------------------------
+JSONDecodeError                           Traceback (most recent call last)
+<ipython-input-17-16f293a93614> in <module>
+----> 1 result = backend.run(rabi_qobj).result()
+
+JSONDecodeError: Expecting value: line 1 column 1 (char 0)
+
+",13527,,13527,,10/18/2020 23:38,3/13/2022 0:09,JSONDecodeError with backend.run,,1,2,,,,CC BY-SA 4.0 +14194,2,,14193,10/16/2020 12:08,,0,,"

It's actually a networking error. Long story short, in some cases the server gives back a 200 ok code but an empty response that JSON fails to decode. There is an issue open to mask this. The good news is it usually goes away if you retry.

+",12195,,,,,10/16/2020 12:08,,,,6,,,,CC BY-SA 4.0 +14195,2,,14185,10/16/2020 13:18,,5,,"

A counterexample that shows that this is not possible in the general case (here I am neglecting post-selection possibility discussed in the comments of the question and in the accepted answer):

+

$$ C_1 = X \qquad C_2 = -X$$

+

Or one can take $C_2 = R_y(- \pi)$ and all mentioned below equations will reamin true. So:

+

$$C_1 |0\rangle = |1\rangle = |\psi \rangle \qquad C_2 |0\rangle = -|1\rangle = |\phi \rangle$$

+

But we want to construct a circuit $C_3$:

+

$$C_3|0\rangle = \frac{|\psi \rangle + |\phi \rangle}{\sqrt{2}} = \frac{|1 \rangle - |1 \rangle}{\sqrt{2}} = 0$$

+

So $C_3$ is not unitary ($C_3$ doesn't preserve the length of the vector) and this shows that for general $C_1$ and $C_2$ this kind of circuit cannot be created.

+
+

Another counterexample without global phase ambiguity between $C_1$ and $C_2$:

+

$$C_1 = R_y(\frac{\pi}{3}) \qquad C_2 = R_y(-\frac{\pi}{3})$$

+

For this case;

+

$$C_1 |0\rangle = R_y(\frac{\pi}{3}) |0\rangle= \cos{\frac{\pi}{6}}|0\rangle + \sin{\frac{\pi}{6}}|1\rangle |\psi \rangle \\ +C_2 |0\rangle = R_y(-\frac{\pi}{3}) |0\rangle = \cos{\frac{\pi}{6}}|0\rangle - \sin{\frac{\pi}{6}}|1\rangle = |\phi \rangle$$

+

We want to construct $C_3$:

+

$$C_3 |0\rangle = \frac{|\phi \rangle + |\psi\rangle}{\sqrt{2}} = \frac{\sqrt{3}}{\sqrt{2}} |0\rangle$$

+

And because $\frac{\sqrt{3}}{\sqrt{2}} \ne 1$, $C_3$ is not a unitary and cannot be constructed.

+
+

In some cases $C_3$ unitary exist: e.g. for $C_1 = X$ and $C_2 = Z$ we can have $C_3 = H = \frac{X + Z}{\sqrt{2}}$.

+",9459,,9459,,10/16/2020 18:51,10/16/2020 18:51,,,,5,,,,CC BY-SA 4.0 +14196,1,,,10/16/2020 13:56,,3,314,"

How exactly does Grovers algorithm "crack" symmetric key encryption? I searched around on the internet, and found that it could make the key length effectively half as long, meaning you only needed to double the lenth of your key for the encryption to be viable again. But how exactly could it brute force the password?

+",13534,,,,,10/16/2020 17:19,"How exactly does Grovers algorithm ""crack"" symmetric key encryption?",,1,1,,,,CC BY-SA 4.0 +14197,2,,14185,10/16/2020 13:56,,2,,"

Here's one way to do it. Let's start with some assumptions: here, I'm assuming your circuits $C_1$ and $C_2$ use the same number of qubits. In the drawing, I have used four qubits to illustrate the concept, but that doesn't matter. The answer below does not care about the number of qubits (which I call $n$), just that the two circuits have the same number of qubits.

+

I also assume that since we have these two circuits $C_1$ and $C_2$, we can create controlled versions of them. This is not hard to do. [edit after @DaftWullie's comment: the question above starts, "Given a quantum circuit..." so I am assuming here that I know what the circuits are. In the general case of completely unknown circuits, this may not be as easy.]

+

In addition to the number of qubits needed for your circuits, I also need one more qubit to do this work. It's called ctrl$_0$ in the figure.

+

+

Start with all the qubits reset to the state $\vert0\rangle$. Then, apply a Hadamard gate to ctrl$_0$, and you have the combined state

+

$$ +\frac{1}{\sqrt{2}}\left(\vert0\rangle + \vert1\rangle\right)\otimes \vert0\rangle_n +$$ +where the ordering is apparent from above.

+

Next, apply the controlled-$U_1$ box, which really just contains the circuit $C_1$ that you have given me. The combined state is now

+

$$ +\frac{1}{\sqrt{2}}\left(\vert0\rangle\vert0\rangle_n + \vert1\rangle\right\vert\psi_1\rangle_n) +$$

+

After applying the $X$ gate, we have

+

$$ +\frac{1}{\sqrt{2}}\left(\vert1\rangle\vert0\rangle_n + \vert0\rangle\right\vert\psi_1\rangle_n) +$$

+

And so, after applying the controlled-$U_2$ box, which really just contains the circuit $C_2$ that you have given me

+

$$ +\frac{1}{\sqrt{2}}\left(\vert1\rangle\vert\psi_2\rangle_n + \vert0\rangle\right\vert\psi_1\rangle_n) +$$

+

After applying the Hadamard gate again on ctrl$_0$, this becomes

+

$$ +\left[\frac{1}{\sqrt{2}}\vert0\rangle\otimes\frac{1}{\sqrt{2}}\left(\vert\psi_1\rangle_n + \vert\psi_2\rangle_n\right)\right] + +\left[\frac{1}{\sqrt{2}}\vert1\rangle\otimes\frac{1}{\sqrt{2}}\left(\vert\psi_1\rangle_n - \vert\psi_2\rangle_n\right)\right] +$$

+

Now, if you measured the qubit ctrl$_0$, you will either get 0 or 1. If you measured 0, then you know that the $n$ qubits are now in the state

+

$$\frac{1}{\sqrt{2}}\left(\vert\psi_1\rangle_n + \vert\psi_2\rangle_n\right)$$

+

If you measured 1, then you know that the $n$ qubits are now in the state

+

$$\frac{1}{\sqrt{2}}\left(\vert\psi_1\rangle_n - \vert\psi_2\rangle_n\right)$$

+

Each of these two outcomes has a probability of 1/2. That means if you really only want the state

+

$$\frac{1}{\sqrt{2}}\left(\vert\psi_1\rangle_n + \vert\psi_2\rangle_n\right)$$

+

then this circuit will give it to you half the time. The other half the time, you know (because you measured 1) that you need to restart the circuit in hopes of getting the outcome that you'd like. Since the probability is 1/2, sooner or later this ought to happen.

+

This method is probabilistic, of course, but has the nice benefit of giving you a measurement outcome (0 or 1) that tells you if you've done what you wanted or not.

+",5119,,5119,,10/16/2020 15:33,10/16/2020 15:33,,,,8,,,,CC BY-SA 4.0 +14198,1,14200,,10/16/2020 14:01,,2,78,"

Is there a good book or paper where they describe how to get the ansatz and gates from a Hamiltonian?

+",13353,,55,,10/17/2020 20:24,10/17/2020 20:24,Good book/paper for finding an ansatz via Trotterization?,,1,0,,,,CC BY-SA 4.0 +14199,1,,,10/16/2020 14:52,,-1,235,"
def SSGSM(im):
+   log_image=np.log(1+np.float32(im))                                                           
+   gx=cv2.Sobel(log_image,cv2.CV_64F,1,0,ksize=3)
+   gy=cv2.Sobel(log_image,cv2.CV_64F,1,0,ksize=3)
+   ex=np.exp(-1*abs(gx))
+   ey=np.exp(-1*abs(gy))
+   vx=np.multiply(gx,ex)
+   vy=np.multiply(gy,ey)
+   vx=np.multiply(vx,vx)
+   vy=np.multiply(vy,vy)
+   v_=vx+vy
+   v=np.sqrt(v_)
+   return v
+
+

I need to convert this code into a quantum format..could anyone help me please?

+",13399,,55,,10/17/2020 20:27,10/19/2020 15:53,How can I convert arithmetic operations in a code to quantum format?,,1,0,,,,CC BY-SA 4.0 +14200,2,,14198,10/16/2020 14:57,,2,,"

I will do my best to answer from my understanding of your question:

+

I am assuming you mean something like Unitary Coupled Cluster variational form where it is implemented the exponential to the initial state $|\psi \rangle$ +$$ e^{T - T^\dagger} $$ +here $T$ is the cluster operator, which, when acting on $|\psi$, produces a linear combination of excited determinants from the reference state. It can be written as +$$ T = \sum T_i$$ +where $T_1$ is the operator for all single excitation, $T_2$ is the operator for all double excitation, and so forth.

+

$$T_1 = \sum_{i \in occupied} \sum_{\alpha \in Virtual} t_{\alpha}^i a^\dagger_{\alpha} a_i $$

+

$$T_2 = \dfrac{1}{4}\sum_{i,j \in occupied} \sum_{\alpha,\beta \in Virtual} t_{\alpha \beta}^{ij} a^\dagger_{\alpha} a^\dagger_{\beta} a_ia_j $$ +$$ \vdots $$ +$$T_n = \dfrac{1}{(n!)^2}\sum_{i_1, i_2 \cdots ,i_n \in occupied} \sum_{\alpha_1, \alpha_2 \cdots ,\alpha_n \in Virtual} t_{\alpha_1 \alpha_2, \cdots, \alpha_n}^{i_1, i_2, \cdots, i_n} a^\dagger_{\alpha_1} a^\dagger_{\alpha_2} \cdots a^\dagger_{\alpha_n} a_{i_1}a_{i_2}\cdots a_{i_n} $$

+

If you only pick $T_1$ and $T_2$ then you have what called as UCCSD variational form, which can be implemented very easily through Qiskit.

+
+

To understand how to convert exponential of matrix into quantum gates through Trotter, I would suggest you to look at this answer. In that answer, there are two very good references that you should look into.

+

I also suggest this paper:

+

Strategies for quantum computing molecular energies using the unitary +coupled cluster ansatz.

+
+

If this is not what you are looking for then edit your question or leave a comment so I understand what you are looking for. This way I might be able to give you some better references.

+",9858,,,,,10/16/2020 14:57,,,,0,,,,CC BY-SA 4.0 +14201,1,,,10/16/2020 15:37,,2,114,"

In a paper that I have recently read, a protocol was given that required a CSS code with certain properties for which all logical Clifford gates and standard measurements have a transversal implementation (the 7-qubit would be an example). Later in that same paper a procedure was required that required the controlled $XP^{\dagger}$ ($C-XP^{\dagger}$) gate to be transversal for that specific code.

+

Now my question is, is that even possible? As far as I know, the set {Clifford group + a single non-Clifford} gate is universal, and that no stabilizer code allows for transversal implementation of a universal set of gates without any further assumptions. The controlled phase gate $C-P$ is a non-Clifford gate and $C-XP^{\dagger} = CNOT*(C-P^{\dagger})$, so that $C-XP^{\dagger}$ also is a non-Clifford gate. Doesn't this make the requirement that the ($C-XP^{\dagger}$) gate be transversal impossible in the first place?

+",11977,,11977,,10/16/2020 18:05,10/16/2020 18:05,Is there a CSS code for which the controlled phase gate and all Clifford gates are transversal?,,0,6,,,,CC BY-SA 4.0 +14202,1,14204,,10/16/2020 16:34,,4,76,"

Let's say I have 2 density operators $A$ and $B$. Now, here is what I am trying to calculate: +$$\newcommand{\tr}{\operatorname{trace}} +\tr(A \sqrt{B} A \sqrt{B}). +$$ +I saw that this trace can be rewritten as: +$$ +\tr(A \sqrt{B} A \sqrt{B}) = \tr\Bigg(\Big(\sqrt{\sqrt{B}} A \sqrt{\sqrt{B}}\Big)^2\Bigg). +$$

+

I was wondering, which property of trace is being used here. I do not think the cyclic property would help, would it?

+",2403,,55,,10/17/2020 20:25,10/17/2020 20:25,How do I prove that $\newcommand{\tr}{\operatorname{Tr}}\tr(A \sqrt{B} A \sqrt{B}) = \tr\Big[\Big(\sqrt{\sqrt{B}} A \sqrt{\sqrt{B}}\Big)^2\Big]$?,,1,0,,,,CC BY-SA 4.0 +14203,2,,14196,10/16/2020 17:19,,2,,"

Grover's algorithm is a Circuit SAT solver that finds a satisfying assignment in around $2^{n/2}$ evaluations of the circuit, where $n$ is the number of inputs. You can build a circuit that takes a key as input and checks whether it can successfully decrypt a ciphertext with that key (perhaps by verifying an authenticator), returning 1 if it can. Grover's algorithm then gives you a working key in around $2^{n/2}$ decryptions where $n$ is the key length.

+",3030,,,,,10/16/2020 17:19,,,,0,,,,CC BY-SA 4.0 +14204,2,,14202,10/16/2020 17:32,,3,,"

This follows from the cyclicity of trace.

+

\begin{align} +\text{tr}\left(\left(\sqrt{\sqrt{B}}A\sqrt{\sqrt{B}}\right)^2\right) &= +\text{tr}\left(\sqrt{\sqrt{B}}A\sqrt{\sqrt{B}}\sqrt{\sqrt{B}}A\sqrt{\sqrt{B}}\right)\\ +&= \text{tr}\left(\sqrt{\sqrt{B}}A\sqrt{B}A\sqrt{\sqrt{B}}\right)\\ +&= \text{tr}\left(A\sqrt{B}A\sqrt{\sqrt{B}}\sqrt{\sqrt{B}}\right)\\ +&= \text{tr}\left(A\sqrt{B}A\sqrt{B}\right) +\end{align}

+",5669,,,,,10/16/2020 17:32,,,,1,,,,CC BY-SA 4.0 +14205,2,,14164,10/16/2020 18:24,,2,,"

This task can be accomplished via cirq.QasmOutput. I've attached an example of how to use the aforementioned functionality to run Cirq circuits on Qiskit's backends.

+
import cirq 
+from typing import Tuple
+from qiskit import QuantumCircuit, execute, Aer
+
+def main():
+    q0 = cirq.LineQubit(1)  
+    cirq_circuit = cirq.Circuit(
+        cirq.H(q0),  
+        cirq.measure(q0)
+    )
+    results, qasm_circuit = run_cirq_circuit_on_qiskit(cirq_circuit, (q0,), 'qasm_simulator')
+    
+    # Returns counts
+    counts = results.get_counts(qasm_circuit)
+    print("Total count for 00 and 11 are:", counts)
+    
+def run_cirq_circuit_on_qiskit(circuit: 'cirq.Circuit', qubits: Tuple['cirq.Qid', ...], backend: str):
+    qasm_output = cirq.QasmOutput((circuit.all_operations()), qubits)
+    qasm_circuit = QuantumCircuit().from_qasm_str(str(qasm_output))
+    # Execute the circuit qiskit backend
+    job = execute(qasm_circuit, Aer.get_backend(backend), shots=1000)
+    # Grab results from the job
+    return job.result(), qasm_circuit
+
+if __name__ == '__main__':
+    main()
+
+",362,,362,,3/3/2021 15:04,3/3/2021 15:04,,,,0,,,,CC BY-SA 4.0 +14206,1,,,10/16/2020 22:32,,0,377,"

In MS presentation, they describe the process CNOT gate working with state machine diagram. At first they drew CNOT gate in black bock as following:

+

+

This implies, that Input qbit is not affected, since it is always $|x\rangle$. This also corresponds with what they drew earlier for any irreversible operation made reversible.

+

Nevertheless, on next slide they drew, that "Input" qubit (left circle on slide, green state change arrow) is affected

+

+

Why?

+

I checked myself of applying CNOT matrix to depicted state and found that input state changes, while output does not.

+

So this was just error on slides, implying "Input" is not changes?

+",13005,,55,,10/22/2020 10:46,10/22/2020 10:46,"Should C-NOT gate affect ""input"" qubit or not?",,2,0,,,,CC BY-SA 4.0 +14207,2,,14206,10/16/2020 23:31,,3,,"

Short answer: both can be correct, depending on the state to which the CNOT gate is applied.

+
+

At the first slide the presentation talks about the effect of CNOT gate on basis states. And indeed, if the input to the CNOT gate is a basis state, it only changes the state of the target qubit.

+

At the second slide, the CNOT gate is applied to a superposition of states. If the input state is $|-\rangle \otimes |-\rangle$, as the circles seem to imply, the effect of the CNOT gate on it will be:

+

$$|-\rangle \otimes |-\rangle = \frac12(|00\rangle - |10\rangle - |01\rangle + |11\rangle) \rightarrow \\ +\rightarrow \frac12(|00\rangle - |1\color{red}1\rangle - |01\rangle + |1\color{red}0\rangle) = \frac12 (|0\rangle + |1\rangle) \otimes (|0\rangle - |1\rangle) = |\color{red}+\rangle \otimes |-\rangle$$

+

You see that while the effect on each of the basis states doesn't change the input qubit, the aggregate effect changes the input qubit and doesn't change the output qubit. This is known as phase kickback effect.

+

It is also possible to have the CNOT gate change the state of both input and output qubits. For example, $\textrm{CNOT}|0\rangle \frac{1}{\sqrt2}(|0\rangle + |1\rangle) = \textrm{CNOT}\frac{1}{\sqrt2}(|00\rangle + |11\rangle)$ - now the input and output qubits don't have individual states of their own, but rather are entangled.

+",2879,,,,,10/16/2020 23:31,,,,0,,,,CC BY-SA 4.0 +14208,2,,14206,10/16/2020 23:32,,3,,"

This is known as "Phase Kickback" in quantum computing. It is a trick that uses in a many quantum algorithms.

+

The phase of the target qubit can kickback to the control-qubit and changes the phase of it.

+

Take a look here: Phase Kickback

+
+

+",9858,,,,,10/16/2020 23:32,,,,0,,,,CC BY-SA 4.0 +14210,1,14219,,10/17/2020 7:07,,6,795,"

I'm sure I don't fully understand support, but I am having trouble seeing how it connects to things like density operators. I have an idea that it means, according to Wikipedia:

+
+

"In mathematics, the support of a real-valued function f is the subset of the domain containing those elements which are not mapped to zero."

+
+

First of all, what would support be used for in quantum theory? What is the meaning of the support of a density operator or quantum state? Perhaps someone could explain what "states with support on orthogonal subspaces means" and what implications it has.

+",13538,,,,,10/17/2020 16:47,"What is the intuition behind ""states with support on orthogonal subspaces""?",,1,0,,,,CC BY-SA 4.0 +14212,1,14251,,10/17/2020 7:22,,5,217,"

I understand the basic definitions. Locality means Alice's measurements do not affect Bob's and system and that no-signalling means a party can't send information faster than light. I also know that locality is defined at the ontological level but no-signalling is at the operational level. What I do not understand is why it is so. Can this be understood with physical intuition?

+",13539,,55,,10/17/2020 20:28,10/19/2020 9:24,What is the difference between no signaling and non locality at operational and ontological level?,,2,2,,,,CC BY-SA 4.0 +14214,2,,14185,10/17/2020 9:54,,8,,"

As Davit Khachatryan's answer points out, the task is impossible / ill-defined, since the desired target state is generally not normalized and it depends on the relative global phases of the two initial states. However, it is possible to rephrase the question so that is meaningful and has an interesting answer.

+

The two problems -- sensitivity to the global phase and normalization -- can be simultaneously dealt with by rephrasing the problem in terms of density matrices instead of pure states. Indeed, the density matrix $|\psi\rangle\langle\psi|$ is not sensitive to the arbitrary global phase of $|\psi\rangle$.

+

To make sense of addition, note that the desired target state $\alpha |\psi\rangle + \beta |\phi\rangle$, for any choice of $\alpha, \beta \in \mathbb C$, lies in the 2-dimensional subspace spanned by $|\psi\rangle$ and $|\phi\rangle$. Hence, without loss of generality, we can restrict the problem to this subspace and think of $|\psi\rangle$ and $|\phi\rangle$ as qubit states regardless of their original dimension.

+

Now, consider a more general problem where you want to somehow continuously interpolate between $|\psi\rangle$ and $|\phi\rangle$. That is, you want the desired target state to lie on a path (on the Bloch sphere) connecting the two original states. Say, you could choose something like $\sin(t) |\psi\rangle + \cos(t) |\phi\rangle$, appropriately normalized. While this seems like a reasonable choice, the path can vary wildly depending on the global phase of $|\psi\rangle$ and $|\phi\rangle$ as they amount to relative phases in the sum.

+

Given such abundance of possible paths, what would be the most natural choice of a path between $|\psi\rangle$ and $|\phi\rangle$? From a geometric perspective, the shortest (or geodesic) path along a great circle is a great choice.

+

If $\vec{r}, \vec{s} \in \mathbb R^3$ are the Bloch vectors of the two states, the line segment in $\mathbb R^3$ between them is described by $p \vec{r} + (1-p) \vec{s}$ where $p \in [0,1]$. Normalizing this Bloch vector to a unit vector gives you a geodesic path on the surface of the Bloch sphere.

+

To describe this in terms of density matrices, recall that the density matrix associated to Bloch vector $\vec{r} = (x,y,z)$ is given by +$$ +\rho(\vec{r}) += \frac{1}{2} (I + x X +y Y + z Z) += \frac{1}{2} \begin{pmatrix} 1+z & x-iy \\ x+iy & 1-z \end{pmatrix}. +$$ +You can check that +$$ +\operatorname{Tr}\rho(\vec{r})^2 += \frac{1}{2} (1 + \vec{r} \cdot \vec{r}) += \frac{1}{2} (1 + x^2 + y^2 + z^2), +$$ +meaning that +$$ +\|\vec{r}\| += \sqrt{x^2 + y^2 + z^2} += \sqrt{2\operatorname{Tr}\bigr(\rho(\vec{r})^2\bigl)-1}. +$$ +For any non-zero vector $\vec{r} \in \mathbb R^3$, the density matrix of a normalized pure state in direction $\vec{r}$ can be obtained as follows: +$$ +\rho\biggl(\frac{\vec{r}}{\|\vec{r}\|}\biggr) += \frac{1}{2} \Biggl( + I + \frac{2\rho(\vec{r})-I} + {\sqrt{2\operatorname{Tr}\bigr(\rho(\vec{r})^2\bigl)-1}} + \Biggr). +$$ +Thus, given two arbitrary density matrices $\rho$ and $\sigma$ of pure qubit states, the geodesic between them is given by +$$ +\frac{1}{2} \Biggl( + I + \frac{2(p\rho+(1-p)\sigma)-I} + {\sqrt{2\operatorname{Tr}\bigl((p\rho+(1-p)\sigma)^2\bigr)-1}} +\Biggr). +$$ +where $p \in [0,1]$. This gives you an unambiguous (while somewhat lengthy) way to interpolate between two pure qubit states.

+

You can also express this in terms of pure states. The key here is to note that the expression +$$ +a |\psi\rangle + b \frac{\langle\phi|\psi\rangle}{|\langle\phi|\psi\rangle|} |\phi\rangle +$$ +describes the same state regardless of the global phases of $|\psi\rangle$ and $|\phi\rangle$. By appropriately choosing $a$ and $b$ and normalizing the resulting state, you can also unambiguously interpolate between them.

+

Regarding your original question, the problem you are interested in is known as coherent state addition. You can look up Theorem 14 in my paper to see how it can be achieved, given enough copies of both states.

+

+

The main idea is to make one of the states evolve according to the Hamiltonian given by the commutator $i[|\phi\rangle\langle\phi|,|\psi\rangle\langle\psi|]$ of the two states. This can be achieved by repeatedly combining the two states using the swap test (this is reminiscent to what eqb proposed in their answer). The intuition for why this works is similar to Grover's algorithm -- you are trying to implement a rotation in the 2-dimensional subspace spanned by the two states and rotate one of them somewhere in between the two.

+",4477,,,,,10/17/2020 9:54,,,,0,,,,CC BY-SA 4.0 +14215,1,,,10/17/2020 10:02,,1,318,"

I wish to be able to model a quantum computer with all the noise sources of an IBM quantum computer. For a given set of T1, T2, readout_errors, U2_errors and CNOT errors I want to know how to include all these errors. I can run a quantum circuit using the expected noise from a particular computer through the following code

+
backend = provider.get_backend('ibmqx2')
+    noise_model = NoiseModel.from_backend(backend)
+# Get coupling map from backend
+    coupling_map = backend.configuration().coupling_map
+# Get basis gates from noise model
+    basis_gates = noise_model.basis_gates
+
+

This runs my code with the noise from ibmqx2. I then try to implement each noise source. For example if the single qubit U2 error rate is er1, I implement this as follows:

+
 error_1 = noise.depolarizing_error(er1, 1)
+noise_model.add_quantum_error(error_1, ['u1', 'u2', 'u3','h'],[0])
+
+

I implement the two qubit and readout errors in the same way. Is this correct? Also how do I implement the errors associated with the T1 and T2 values? I am asking because my current model when I add each noise source myself does not match when I simply import the noise model. I wish to reconcile this.

+",13261,,55,,10/22/2020 10:47,7/14/2021 20:08,Simulation of Noise in a particular quantum computer,,2,0,,,,CC BY-SA 4.0 +14216,1,,,10/17/2020 10:30,,2,156,"
from qiskit import *
+
+def random_bitstring_generator(bit_number, backend):
+    """
+    Generate a bitstring with one qubit
+    :param bit_number: number of bits that we want to generate
+    :param backend: Qiskit hardware or simulator
+    :return: string object with random bits
+    """
+
+    bitstring = ""
+
+    one_qubit_random_bit_generator_circuit = QuantumCircuit(1,1)
+    one_qubit_random_bit_generator_circuit.h(0)
+    one_qubit_random_bit_generator_circuit.measure(0,0)
+
+    for _ in range(bit_number):
+        counts = execute(one_qubit_random_bit_generator_circuit, backend, shots=1).result().get_counts()
+        bit = list(counts.keys())[0]  # we have only one key because shots=1
+        bitstring += bit
+
+    return bitstring
+
+provider = IBMQ.load_account()
+backend = BasicAer.get_backend('ibmq_santiago')
+
+print(random_bitstring_generator(512, backend)
+
+

Running the above code in jupyter notebook in quantum lab gives me error as shown is photo. I am also unable to run the program for a backend other than simuator like melboune, vigo, ourense.

+",13172,,55,,12/30/2021 18:43,12/30/2021 18:43,Unable to run program on different backends,,2,0,,,,CC BY-SA 4.0 +14217,1,,,10/17/2020 13:44,,2,194,"

I try to design the circuit for $b = 11$ and succeeded in running. Therefore, I start to think of the circuit for different secret string $b = 01$. The circuit I made is down below: +

+

Here is the problem: After the first Hadamard operator, if the input $x = \left|10\right\rangle$, the $f(x)$ result (That is the measurement of $q2$, $q3$, which is the last two bits of $\left|y_1y_2y_3y_4\right\rangle$ in Computational basis states) according to my circuit, should be $\left|11\right\rangle$, the same as the input $x = \left|11\right\rangle$. And the output of $y1, y2$ should match the condition:$$b\cdot{y} = 0\,(\,mod\,2\,)$$Hence, one of the output I believe is $\left|1011\right\rangle$, but the calculator gives me a wired (at least I think it is wired) result. What are the issues?

+",13500,,16606,,5/24/2022 15:43,10/21/2022 16:08,"A Simon's algorithm with secret string b = 01, IBM Quantum experience gives a different result from what I calculate",,1,0,,,,CC BY-SA 4.0 +14218,1,14220,,10/17/2020 15:48,,5,591,"

Consider a quantity +\begin{equation} +\mathbb{E}\big[\langle z|\rho|z\rangle\big], +\end{equation} +where $\rho = |\psi \rangle \langle \psi|$ is a Haar-random state $n$-qubit quantum state and $z$ is the label of a fixed $n$-qubit basis vector. Now, consider +\begin{equation} +\sigma = \underset{\text{diagonal}~U}{\mathbb{E}}\big[U\rho U^{*}\big], +\end{equation} +where $\rho$ is as defined before, and $U$ is a diagonal unitary matrix such that the diagonal entries are uniformly random complex phases. I am trying to prove that +\begin{equation} +\mathbb{E}\big[\langle z|\rho|z\rangle\big] = \mathbb{E}\big[\langle z|\sigma|z\rangle\big] +\end{equation}

+

Intuitively, the result is clear as the Haar measure is invariant under left and right multiplication by a unitary. But, the RHS has two expectations - one nested inside the other - and I do not know how to simplify that.

+",1351,,1351,,10/17/2020 15:54,11/8/2020 10:51,Expected value of a Haar random quantum state multiplied by a unitary,,2,0,,,,CC BY-SA 4.0 +14219,2,,14210,10/17/2020 16:47,,3,,"

Consider a vector space $V$ with an inner product and a linear operator $A:V\rightarrow V$.

+

The definition of support that you have posted from Wikipedia can be a bit confusing. It says $\text{supp}(A) = \{u\in V|Au\neq 0\}$. This is the complement of the kernel where the kernel of $A$ is $\text{ker}(A) = \{v\in V| Av = 0\}$. However, this definition of the support leaves you with a set that is not a vector space (for example, the zero vector is not in $\text{supp}(A)$).

+

The definition of the support of $A$ which is used in quantum information is the orthogonal complement of the kernel i.e. $\text{supp}(A) = \{u\in V| \langle u, v\rangle = 0, v\in \text{ker}(A)\}$. See for example page 14 of this textbook where it is introduced. Some useful properties are

+
    +
  1. For self-adjoint $A$, the image of $A$ is the same as the support of $A$. To see this, pick any $u\in \ker(A)$ and $v\in V$. Then you have $$0 = \langle Au, v \rangle = \langle u, Av \rangle \implies Av \in \text{supp}(A)$$
  2. +
  3. In finite dimensional space, taking the orthogonal complement twice brings you back to the original subspace. So the kernel is also the orthogonal complement of the support.
  4. +
+

If $\rho$ and $\sigma$ have support on orthogonal subspaces, then it means that the $\text{supp}(\sigma)\subseteq \ker{(\rho)}$ and $\text{supp}(\rho)\subseteq \ker{(\sigma)}$. You can then construct a projective measurement $\{P_{\text{supp}(\rho)}, I - P_{\text{supp}(\rho)}\}$ or $\{P_{\text{supp}(\sigma)}, I - P_{\text{supp}(\sigma)}\}$ and this is guaranteed to distinguish perfectly between $\rho$ and $\sigma$.

+

TL;DR: The main reason why we care about states with support on orthogonal subspaces is because there exists a measurement that can distinguish between those states perfectly.

+",5669,,,,,10/17/2020 16:47,,,,0,,,,CC BY-SA 4.0 +14220,2,,14218,10/17/2020 17:07,,5,,"

With the chosen structure of $ U $, i think it's even possible to prove the stronger statement: +$$ \langle z| \rho|z \rangle = \langle z| \sigma_\rho|z \rangle, \hspace{0.2em} \text{where} \hspace{0.2em} +\sigma_\rho = \mathbb{E}_U \big[U\rho U^\dagger\big] +\text{and} \hspace{0.3em} +|z\rangle \hspace{0.3em} \text{a computational basis vector.}$$ +You may write $ U = \sum_{k \in \{0, 1\}^n} e^{i \phi_k} |k\rangle \langle k| $, for uniform $ \phi_k \in_R [0, 2\pi] $ and calculate +\begin{align*} + U\rho U^\dagger &= +\sum_{k, m} e^{i (\phi_k - \phi_m)} \langle k|\rho|m \rangle \cdot |k\rangle \langle m| \implies \\ +\mathbb{E}_U \big[U\rho U^\dagger\big] &= +\sum_{k, m} \mathbb{E}_\phi \big[e^{i (\phi_k - \phi_m)}\big] \cdot \langle k|\rho|m \rangle \cdot |k\rangle \langle m| \implies\\ +\langle z |\sigma_\rho| z \rangle &= \sum_{k, m} \mathbb{E}_\phi \big[e^{i (\phi_k - \phi_m)}\big] \cdot \langle k|\rho|m \rangle \cdot \langle z|k\rangle \langle m|z \rangle \implies\\ +\langle z |\sigma_\rho| z \rangle &= \sum_{k, m} \mathbb{E}_\phi \big[e^{i (\phi_k - \phi_m)}\big] \cdot \langle k|\rho|m \rangle \cdot \delta_{z,k} \delta_{z,m} = \langle z|\rho|z \rangle +\end{align*}

+",13109,,13109,,10/17/2020 17:42,10/17/2020 17:42,,,,0,,,,CC BY-SA 4.0 +14221,2,,14216,10/17/2020 17:27,,0,,"

I don't know what do you mean, the error specifically says that:

+

QiskitBackendNotFoundError: "The 'ibmq_santiago' backend is not installed in your system."

+

This means you don't have access to this machine from your account. This machine is either dedicated to only privilege users.

+",9858,,,,,10/17/2020 17:27,,,,4,,,,CC BY-SA 4.0 +14222,2,,14215,10/17/2020 17:51,,1,,"

If you are intending to add noise to the specific qubit (qubit [0] in this case) then this seems to be correct. At least from looking at this document: Building Noise Models

+",9858,,,,,10/17/2020 17:51,,,,2,,,,CC BY-SA 4.0 +14223,2,,14217,10/17/2020 18:26,,0,,"

Measurements are only allowed at the end of the quantum circuit for current machines like those of IBM. Also for Simon's algorithm we don't care about the output of the second register. Thus only first register is measured.

+

+

So you have the possibility of observing the state $|00\rangle$ or $|01\rangle$. But we know that $|00\rangle$ is trivial so without much checking $|01\rangle$ is what you are looking for...

+

Here is the code to generate the above circuit and histogram plot in Qiskit:

+
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+from numpy import pi
+from qiskit import QuantumCircuit, BasicAer, execute
+from qiskit.visualization import plot_histogram
+%matplotlib inline
+
+qreg_q = QuantumRegister(4, 'q')
+creg_c = ClassicalRegister(2, 'c')
+circuit = QuantumCircuit(qreg_q, creg_c)
+
+circuit.h(qreg_q[0])
+circuit.h(qreg_q[1])
+circuit.cx(qreg_q[0], qreg_q[2])
+circuit.cx(qreg_q[0], qreg_q[3])
+circuit.barrier(range(4))
+circuit.h(qreg_q[0])
+circuit.h(qreg_q[1])
+circuit.barrier(range(4))
+circuit.measure(qreg_q[0], creg_c[0])
+circuit.measure(qreg_q[1], creg_c[1])
+circuit.draw( 'mpl',style={'name': 'bw'}, scale = 1.5, plot_barriers = False)
+
+backend = BasicAer.get_backend('qasm_simulator')
+job = execute(circuit, backend, shots = 20000)
+plot_histogram(job.result().get_counts(), color='black', title="Result")
+
+

A quick note: If I use the statevector_simulator option then I will either get $|00\rangle$ or $|11\rangle$ as it just a one-shot simulator.

+",9858,,9858,,11/13/2020 16:49,11/13/2020 16:49,,,,3,,,,CC BY-SA 4.0 +14224,1,,,10/18/2020 6:00,,5,638,"

While I'm simulating grover's algorithm, I found that with BasicAer backend it works well but with Aer it is not. What is the difference between qiskit.providers.BasicAer and qiskit.providers.Aer ?

+",10028,,9006,,10/18/2020 7:00,11/12/2021 9:05,Qiskit BasicAer & Aer,,1,0,,,,CC BY-SA 4.0 +14225,2,,14224,10/18/2020 6:35,,1,,"

Regarding to the difference between BasicAer and Aer, take a look at this answer: https://quantumcomputing.stackexchange.com/a/4996/9858

+

And in term of BasicAer returns incorrect result, take a look here: https://github.com/Qiskit/qiskit-terra/issues/1838

+

Hope this helps.

+",9858,,,,,10/18/2020 6:35,,,,7,,,,CC BY-SA 4.0 +14226,1,14243,,10/18/2020 6:47,,0,277,"

I wish to know how to suppress the following warning obtained on qiskit when I try to add two different types of noise to a qubit

+
WARNING: quantum error already exists for instruction "u2" on qubits [0] , appending additional error.
+
+

I know that some warnings can be suppressed with

+
import warnings
+warnings.filterwarnings('ignore', category=DeprecationWarning)
+
+

but I do not know what category my warning is contained in. I would also like to know if I can access somewhere all the different warning categories. Additionally trying

+
import warnings
+warnings.filterwarnings('ignore')
+
+

to suppress all warnings does not help.

+",13261,,55,,10/22/2020 10:48,10/22/2020 10:48,Suppress Warnings,,3,1,,,,CC BY-SA 4.0 +14227,2,,14216,10/18/2020 6:52,,4,,"

Try to replace

+
backend = BasicAer.get_backend('ibmq_santiago')
+
+

with

+
backend = provider.get_backend('ibmq_santiago')
+
+

Alternativetly, you can also use this code:

+
backend = provider.backends(name = 'ibmq_santiago')[0]
+
+

You have to use backends available under you account. There are only simulators in BasicAer while the real quantum machines are under the account.

+",9006,,9006,,10/18/2020 6:57,10/18/2020 6:57,,,,2,,,,CC BY-SA 4.0 +14228,2,,14226,10/18/2020 7:27,,0,,"

I don't know if this help at all but in term of warning categories, I used ?? warnings and found a few other types:

+
category=PendingDeprecationWarning
+category=ImportWarning
+category=ResourceWarning
+
+
+

I also see a question related to warning to Qiskit here. It is not the same as what you are asking but hopefully it will help somehow.

+
+",9858,,9858,,10/18/2020 16:58,10/18/2020 16:58,,,,0,,,,CC BY-SA 4.0 +14229,1,14234,,10/18/2020 7:59,,1,156,"

I usually use Qiskit "Aer" to simulate quantum circuit with several methods such as statevector, density_matrix, stabilizer, extended_stabilizer, and matrix_product_state. Recenlty I came across another simulator called "BasicAer" and I wonder if the qiskit BasicAer supports above methods.

+",10028,,1859,,10/25/2020 17:12,10/25/2020 17:12,Qiskit BasicAer simulator options,,1,0,,,,CC BY-SA 4.0 +14230,2,,14212,10/18/2020 8:01,,4,,"

No signaling means can't be used for communication. Can't be used to move messages from a sender to a receiver.

+

Local means doesn't require communication to implement.

+

Some processes, such as phenomena violating bell inequalities, don't enable communication but also can't be emulated classically without communication. They take without giving back. They are not local but not in a useful way that would allow you to embed messages into that non locality.

+",119,,,,,10/18/2020 8:01,,,,2,,,,CC BY-SA 4.0 +14231,1,14238,,10/18/2020 8:59,,4,128,"

Let us consider +\begin{equation} +|T\rangle = |\psi \rangle^{\otimes m} +\end{equation} +for an $n$-qubit quantum state $|\psi\rangle$. Let $\mathcal{V}$ be the space of all $(m + 1)$-partite states that are invariant under permutations. Consider $|\psi\rangle|T\rangle$, which belongs to the space $\mathcal{V}$. I am trying to prove:

+
    +
  1. For $|\phi\rangle$ orthogonal to $|\psi\rangle$, $|\phi\rangle |T\rangle$ is almost orthogonal to $\mathcal{V}$, upto an error $\mathcal{O}\big(\frac{1}{m}\big)$.
  2. +
  3. There exists a measurement to determine whether $|\phi\rangle |T\rangle$ is in $\mathcal{V}$, upto an error $\mathcal{O}\big(\frac{1}{m}\big)$, and when doing so, the state $|T\rangle$ is only disturbed by $\mathcal{O}\big(\frac{1}{m}\big)$.
  4. +
+

(For reference, these statements are in this paper, in the last paragraph of page 13).

+",1351,,55,,10/22/2020 10:49,10/22/2020 10:49,Checking whether a state is almost orthogonal to permutation invariant states,,2,1,,,,CC BY-SA 4.0 +14232,2,,14231,10/18/2020 13:04,,1,,"

Hope this helps you get started, If two vectors are orthogonal, then their inner product is zero. The inner product is a measure of how similar two vectors are; or, the degree to which the first vector lies along the second. So you know that |𝜙⟩|𝑇⟩~ 0

+",13081,,,,,10/18/2020 13:04,,,,0,,,,CC BY-SA 4.0 +14233,1,14235,,10/18/2020 13:44,,3,695,"

I'm trying to get setup with https://qiskit.org, but I'm having a problem.

+

I have dug around the internet for a bit and haven't been able to find anything.

+

When I try to run IBMQ.save_account('api_token') it says that I already have credentials present, and to set overwrite to true in order to overwrite the current ones.

+

How do I do with that?

+",13547,,55,,10/22/2020 10:49,10/22/2020 10:49,How to set overwrite to true with IBMQ?,,1,0,,,,CC BY-SA 4.0 +14234,2,,14229,10/18/2020 13:45,,0,,"

For any provider, you can check the backends with backends():

+
from qiskit import BasicAer
+BasicAer.backends()
+
+
[<QasmSimulatorPy('qasm_simulator') from BasicAer()>,
+ <StatevectorSimulatorPy('statevector_simulator') from BasicAer()>,
+ <UnitarySimulatorPy('unitary_simulator') from BasicAer()>]
+
+

Check the doc for each of them:

+
for backend in BasicAer.backends():
+    print("%s: %s" % (backend.name(), backend.__doc__))
+
+
qasm_simulator: Python implementation of a qasm simulator.
+statevector_simulator: Python statevector simulator.
+unitary_simulator: Python implementation of a unitary simulator.
+
+",1859,,,,,10/18/2020 13:45,,,,0,,,,CC BY-SA 4.0 +14235,2,,14233,10/18/2020 13:57,,1,,"

It is in the method documentation, overwrite: Overwrite existing credentials.:

+
IBMQ.save_account('api_token', overwrite=True)
+
+",1859,,,,,10/18/2020 13:57,,,,0,,,,CC BY-SA 4.0 +14236,1,,,10/18/2020 14:07,,2,129,"

I implemented Grover algorithm with matrix_product_state method in qiskit. But I found something strange. I designed the oracle part come out $|1111\rangle$ but, real output was $0011\rangle$. I check out my code, but there is nothing wrong with it. Even simulating with the other simulation method (such as statevector, density_matrix etc.) I got correct output. I really don't understand why only matrix_product_state method's output is strange. My code is below. +

+

+

+",10028,,55,,10/22/2020 10:49,11/14/2022 16:07,Grover's algorithm with matrix_product_state method,,1,1,,,,CC BY-SA 4.0 +14237,2,,14226,10/18/2020 14:09,,0,,"

You don't need to provide a category to silence all of the warnings:

+
import warnings
+warnings.filterwarnings('ignore')
+
+",1859,,,,,10/18/2020 14:09,,,,1,,,,CC BY-SA 4.0 +14238,2,,14231,10/18/2020 15:31,,2,,"

Let $P$ be the projector onto the symmetric subspace. We want to find +$$ +\max|\langle\gamma|\phi,T\rangle| +$$ +for $|\gamma\rangle\in \mathcal{V}$. This is equivalent to +$$ +\max|\langle\gamma|P|\phi,T\rangle|, +$$ +so if we calculate $P|\phi\rangle|T\rangle$, then $|\gamma\rangle$ will be the normalised state parallel to that.

+

Now, if we project $|\phi\rangle|T\rangle$ onto the fully symmetric subspace, we get +$$ +|\gamma\rangle=\frac{1}{\sqrt{m+1}}\sum_{i=1}^{m+1}|\psi\rangle^{\otimes (i-1)}|\phi\rangle|\psi\rangle^{\otimes(m+1-i)}. +$$ +Hence, the maximum value of the overlap is $1/\sqrt{m+1}$. If you're talking about an error, you'r probably talking about a measurement, and hence need the mod-square, so the probability of finding the state in the symmetric subspace is $1/(m+1)$.

+

How to perform the measurement? I could just specify measurement projectors $\{P,I-P\}$. However, you may subsequently ask how you perform that measurement using standard gate elements. I've never looked at this in great detail, but assume it is related to topics such as this. Equally, for this specific form of state, I imagine you could do something generalising the swap-test (which projects two systems onto their symmetric subspace).

+
+

Further explanation of the claimed result:

+

Let +$$ +|\omega_j\rangle=\frac{1}{\sqrt{m+1}}\sum_{k=1}^{m+1}\omega^{kj}|\psi\rangle^{\otimes (k-1)}|\phi\rangle|\psi\rangle^{\otimes(m+1-k)} +$$ +where $\omega=e^{2\pi i/(m+1)}$. Each of the $|\omega_j\rangle$ is an eigenvector, eigenvalue $\omega^j$, of the cyclic permutation operator. The cyclic permutation operator and the projector onto the symmetric subspace commute (because the symmetric subspace is invariant under permutations), and hence they share a common eigenbasis and, in particular, only $|\omega_0\rangle$ is in the symmetric subspace.

+

We have +$$ +|\phi\rangle|T\rangle=\frac{1}{\sqrt{m+1}}\sum_{j=0}^m|\omega_j\rangle. +$$ +Thus, +$$ +P|\phi\rangle|T\rangle=\frac{1}{\sqrt{m+1}}|\omega_0\rangle. +$$ +The normalised version of this is hence +$$ +|\gamma\rangle=|\omega_0\rangle. +$$

+",1837,,1837,,10/19/2020 6:18,10/19/2020 6:18,,,,1,,,,CC BY-SA 4.0 +14239,2,,14018,10/18/2020 17:27,,0,,"

Here's a link to a great matrix multiplier tool:

+

https://matrixcalc.org/en/

+",13081,,,,,10/18/2020 17:27,,,,0,,,,CC BY-SA 4.0 +14240,1,14242,,10/18/2020 18:31,,0,58,"

question: "A spin right $\frac{1}{\sqrt 2}(|0\rangle + |1\rangle)$ is sent through a Hadamard gate, creating the superposition of $|+\rangle$ and $|-\rangle$, given by $\frac{1}{\sqrt 2}(|+\rangle + |-\rangle)$. By making a basis change substitution, show that this is equivalent to producing a $|0\rangle$ state."

+

How do I represent a basis change substitution mathematically?

+",13081,,55,,10/22/2020 10:49,10/22/2020 10:49,Basis Change Substitution,,1,0,,,,CC BY-SA 4.0 +14241,1,14529,,10/18/2020 18:33,,1,194,"

I could manage to produce 3 qubit ghz state in Cirq. But I don't know how I can produce $|GHZ\rangle\langle GHZ|$ in Cirq +Here is my code for 3 qubit ghz state +Can you help me please for improving my code from $|GHZ\rangle$ to $|GHZ\rangle\langle GHZ|$:

+
n = 3
+qubits = cirq.LineQubit.range ( n )
+
+def circuit ():
+  circuit = cirq.Circuit ()
+  circuit.append (cirq.H(qubits[0]))
+  for i in range (n-1):
+    circuit.append ( cirq.CNOT ( qubits [i] , qubits [i+1]) )
+  circuit.append (cirq.measure (* qubits , key ='x') )
+  print (circuit)
+  return circuit
+
+def simulation (circuit):
+  simulator = cirq.Simulator()
+  results = simulator.run ( circuit , repetitions = 200)
+  counts = cirq.plot_state_histogram (results)
+
+def main():
+  simulation (circuit())
+if __name__ == "__main__ ":
+   main ()
+
+",13548,,2927,,12/11/2022 14:21,12/11/2022 14:21,Producing $|ghz\rangle\langle ghz|$ State in Cirq,,1,9,,,,CC BY-SA 4.0 +14242,2,,14240,10/18/2020 18:38,,2,,"

$|+\rangle$ and $|-\rangle$ represented by $|0\rangle$ and $|1\rangle$ basis vectors:

+

$$|+\rangle = \frac{1}{\sqrt{2}} (|0\rangle + |1\rangle) \qquad |-\rangle = \frac{1}{\sqrt{2}} (|0\rangle - |1\rangle)$$

+

By substituting these expressions that are written in $|0\rangle$ and $|1\rangle$ basis will prove what is wanted:

+

$$\frac{1}{\sqrt{2}} (|+\rangle + |-\rangle) = \frac{1}{2}(|0\rangle + |1\rangle + |0\rangle - |1\rangle) = |0\rangle$$

+",9459,,9459,,10/18/2020 18:44,10/18/2020 18:44,,,,0,,,,CC BY-SA 4.0 +14243,2,,14226,10/19/2020 1:52,,3,,"

Qiskit's NoiseModel class processes warnings through a logger from the logging package, not through the warnings package, so suppressing warnings as in other answers won't help.

+

However, each method in NoiseModel provides a warnings parameter; it defaults to True but you can set it to False to prevent the warnings from being logged.

+

Example: myNoiseModel.add_quantum_error(..., warnings=False)

+",13553,,,,,10/19/2020 1:52,,,,0,,,,CC BY-SA 4.0 +14245,1,,,10/19/2020 3:54,,8,540,"

The figure of a circuit and the state are as follows.

+

The final state before the measurement is $|O_{out}\rangle=\frac{1}{2}|0\rangle(|\phi\rangle|\psi\rangle+|\psi\rangle|\phi\rangle)+\frac{1}{2}|1\rangle(|\phi\rangle|\psi\rangle-|\psi\rangle|\phi\rangle)$.

+

Measuring the first qubit of this state produces outcome 1, how can I get the probability $\frac12(1-|\langle\phi|\psi\rangle|^2)$?

+

+

+",6155,,55,,10/22/2020 7:34,10/22/2020 7:34,How to compute the measurement probability in swap test?,,2,0,,,,CC BY-SA 4.0 +14246,2,,14245,10/19/2020 4:26,,6,,"

It's a fantastic question because the typical measurement intuition we apply no longer is sufficient - it's really necessary to formalize measurement.

+

Specifically, we create a set of nonlinear operators $M_\psi = |\psi \rangle \langle \psi |$, where the probability of measuring $\psi$ on an arbitrary state $|\phi\rangle $ is $\langle \phi | M^\dagger M | \phi \rangle$.

+

In our case, we have a measurement operator $M_1$ we are interested in. However, we can actually apply $M_0$ for simplicity, and then subtract this probability from 1. Thus, where $| \varphi \rangle $ is the state provided above:

+

\begin{align} + \langle \varphi | M^\dagger M | \varphi \rangle &= \langle \varphi |0\rangle \langle 0| 0\rangle \langle 0|\varphi\rangle \\ +&= \langle \varphi|0\rangle\langle 0|\varphi\rangle \\ +&= \frac{1}{4} (\langle \phi|\langle \psi| + \langle \psi|\langle \phi|)( |\phi \rangle |\psi \rangle + |\psi \rangle |\phi \rangle) \\ +&= \frac{1}{4}(2 \langle\phi| \langle\psi|\phi\rangle |\psi\rangle + 2) \\ +&= \frac{1}{2}\Big(|\langle\psi|\phi\rangle|^2 + 1 \Big) +\end{align}

+

Thus, because this is the zero probability, we have:

+

$$ + 1 - \frac{1}{2}\Big(|\langle\psi|\phi\rangle|^2 + 1 \Big) = \frac{1 - |\langle \psi|\phi \rangle|^2}{2} = \frac{1 - |\langle \phi|\psi \rangle|^2}{2} +$$

+

As desired.

+",8343,,,,,10/19/2020 4:26,,,,6,,,,CC BY-SA 4.0 +14247,2,,14245,10/19/2020 6:27,,2,,"

I assume you're happy with the idea that the state before measurement is +$$|O_{out}\rangle=\frac12|0\rangle(|\phi\rangle|\psi\rangle+|\psi\rangle|\phi\rangle)+\frac{1}{2}|1\rangle(|\phi\rangle|\psi\rangle-|\psi\rangle|\phi\rangle).$$ +Now you want to measure qubit 1 in the 0/1 basis. There's a couple of different ways you might approach this.

+
    +
  1. Define the two measurement projectors to be $P_0=|0\rangle\langle 0|\otimes I\otimes I$ (i.e. measure first qubit in 0, and do nothing to the other two), and $P_1=|1\rangle\langle 1|\otimes I\otimes I$. The probability of getting the 0 answer is $\langle O_{out}|P_0|O_{out}\rangle$.

    +
  2. +
  3. Alternative, rewrite your state as +$$ +|O_{out}\rangle=\gamma_0|0\rangle|\sigma\rangle+\gamma_1|1\rangle|\tau\rangle, +$$ +where $|\sigma\rangle$ and $|\tau\rangle$ are properly normalised vectors, and the coefficients $\gamma_{0/1}$ compensate for that normalisation. The probability of getting the answer 0 when you measure the first qubit is $|\gamma_0|^2$. So, we have +$$ +\gamma_0|\sigma\rangle=\frac12(|\phi\rangle|\psi\rangle+|\psi\rangle|\phi\rangle). +$$ +Take the inner product of that equation with itself and you get +\begin{align*} +|\gamma_0|^2&=\frac14(\langle\phi |\langle\psi |+\langle\psi |\langle\phi|)(|\phi\rangle|\psi\rangle+|\psi\rangle|\phi\rangle) \\ +&=\frac14(2+2|\langle\phi|\psi\rangle|^2). +\end{align*} +The actual question requires the probability of getting answer 1. This is left as an exercise for the reader.

    +
  4. +
+",1837,,1837,,10/19/2020 8:47,10/19/2020 8:47,,,,2,,,,CC BY-SA 4.0 +14249,1,,,10/19/2020 7:13,,1,99,"

Is there a way to simulate the noise of googles quantum computers using circ? In the same way that any of IBM's computers can be simulated using different backends?

+
backend = provider.get_backend('ibmqx2')
+noise_model = NoiseModel.from_backend(backend)
+
+

Ideally I would want something like above which allows me to easily call the noise properties of for example Bristlecone or Sycamore.

+

If this is not possible does anyone know the best way to approach simulating the noise of any of googles quantum computers in qiskit?

+

I am asking because I wish to compare Google and IBMs quantum computers for implementing a simple circuit.

+",13261,,55,,10/22/2020 7:34,10/22/2020 7:34,Simulating noise of googles quantum computers,,1,0,,,,CC BY-SA 4.0 +14250,1,,,10/19/2020 8:25,,2,98,"

Does anyone know any good resource where I can study about how quantum walk is performed on non-regular graph? +Most of the papers I read, talks about only quantum walk on regular graphs containing cycles. For non-regular graph as each node have different degree, the dimensions of coin operator needs to keep changing. No resource talks about this. +If anyone have any source, it will be helpful.

+",13517,,13517,,11/13/2020 17:51,11/13/2020 17:51,Quantum Walk Study Resource for Non-regular Graph,,1,0,0,,,CC BY-SA 4.0 +14251,2,,14212,10/19/2020 9:24,,4,,"

I think the best way to understand this is by showing that one can violate (ontological) locality while respecting (operational) no-signalling.

+

Take the case of Bohmian mechanics. In it the result of Alice's measurement is deterministic, and it will depend Bob's choice of measurement, so it is clearly nonlocal. Nevertheless, the "quantum equilibrium" axiom postulates that the hidden variables are distributed in such a way that they reproduce the statistics of quantum mechanics, so you can't use it to signal, as quantum mechanics cannot. If you violate the "quantum equilibrium" axiom, simply by knowing the value of a hidden variable before the measurement, you can use this knowledge to signal faster than light.

+

I hope this makes it clear that "no-signalling" is really about what you can do with the theory, it's an intrinsically operational definition. As for "locality", it's a bit harder to say because there are several different definitions of locality, but usually it is about what is actually going on behind the scenes, independently of what you can do with it, i.e. it's usually an ontological definition.

+",12541,,,,,10/19/2020 9:24,,,,0,,,,CC BY-SA 4.0 +14252,1,,,10/19/2020 14:21,,3,56,"

In this question of a few days ago, it was raised the question about the similarities or differences between the notion of universality in discrete-variable (DV) quantum computers and continuous-variable (CV) computers. My question is in the same line and I think that the answer would include both questions: Is the continuous-variable quantum computing model a quantum universal Turing machine?

+

This doubt stems from the definition of universality in the CV quantum case (see for example the original article by Lloyd): Universality of the CV model is defined as the ability to approximate arbitrary transformations of the form $U_H = e^{−it H}$, where the generator $H = H (x, p)$ is a polynomial function +of $(x, p)$ with arbitrary but fixed degree. If the CV model is a quantum universal Turing machine, it would mean that it is equivalent to the DV model, and therefore I can represent any unitary transformation as $e^{−it H(x,p)}$, but I'm not sure about this last point.

+",13528,,,,,10/19/2020 14:21,Is continuous-variable quantum computing a model of a quantum universal Turing machine?,,0,0,,,,CC BY-SA 4.0 +14253,2,,14249,10/19/2020 14:27,,1,,"

It is possible from looing at here: +https://github.com/quantumlib/Cirq/tree/master/cirq/devices +and +https://cirq.readthedocs.io/en/stable/generated/cirq.NoiseModel.html

+
+

Also look at these answers on how to implement noise:

+
    +
  1. How to add noise to existing gates in Cirq?

    +
  2. +
  3. https://github.com/quantumlib/Cirq/issues/1704

    +
  4. +
+",9858,,,,,10/19/2020 14:27,,,,2,,,,CC BY-SA 4.0 +14254,2,,14199,10/19/2020 15:53,,1,,"

The code I'll be referencing here is Qiskit, IBM's Quantum SDK (Software Development Kit).

+

First, you would have to make a circuit, so a good place to start is with the following code:

+
import qiskit
+from qiskit import *
+qc = Quantum Circuit (n, m)
+
+

where n is the number of qubits, or inputs (each the size of 1 bit) you need to do arithmetic operations on. m is the number of classical bits, or the number of 1-bit outputs you need. Unfortunately, it is more cumbersome to do arithmetic operations in quantum computing than other operations, but you can find an adder gate (an operation in qiskit) in qiskit-aqua, which you can use with the following code:

+
from qiskit.circuit.library import WeightedAdder
+adder = WeightedAdder(num_state_qubits, weights, name)
+
+

where num_state_qubits are your input qubits, there are no weights, and name is 'adder' or whatever you want to name it.

+

The other arithmetic operation that's built into Qiskit is the IntegerComparison, but otherwise you have to build them yourself.

+

Here is a link to how to build a multiplication gate in Qiskit : https://medium.com/@sashwat.anagolum/arithmetic-on-quantum-computers-multiplication-4482cdc2d83b

+

For more information on how to make a Quantum Circuit in Qiskit and how to manipulate it and run it to get results, you can refer to the Qiskit Textbook and the Qiskit Documentation

+",13117,,,,,10/19/2020 15:53,,,,0,,,,CC BY-SA 4.0 +14255,2,,12483,10/19/2020 16:28,,4,,"

Answering your precise question: mixing the four scenarios is not particular to Hardy's argument, it is done in all nonlocality proofs. The fundamental assumption is that the distribution of the hidden variables doesn't depend on the measurement setting, i.e., whether BS2$^+$ or BS2$^-$ are there, so that we can actually use the different measurements to probe the state of the hidden variables. This assumption is known as "no superdeterminism" or "no conspiracy".

+

More generally, keep in mind that Hardy wrote his paper in 1992. The language and mentality at this time were very different. Nowadays this kind of proof is known as "possibilistic nonlocality". I find this paper about it quite clear.

+

Don't worry, though, Hardy's proof is completely kosher, and can be rephrased in the usual language. The idea of a proof of nonlocality is to show that a correlation $p(ab|xy)$, obtainable from quantum mechanics, cannot be reproduced with local hidden variable models (LHVs). One can always do that via Bell inequalities, as they completely delimitate the polytope of correlations that can be produced via LHVs. Hardy's insight was that in some cases you don't need to know all the probabilities, and in fact not even the precise values, but only that for some $a,b,x,y$ we have $p(ab|xy) > 0$ and for some other $p(ab|xy) = 0$.

+

For convenience, let's rename the settings: if BS2$^+$ is there Alice has setting 1, and if it's not there it has setting 0. Same for Bob. The quantum correlations are then +\begin{align*} +p(cc|00) = 0 \\ +p(dd|01) = 0 \\ +p(dd|10) = 0 \\ +p(dd|11) > 0 +\end{align*} +Hardy's argument implies that there is no LHV model that can reproduce them (and in particular they violate the CHSH inequality). If you find it unpersuasive, perhaps it's more enlightening to try to build a LHV model for these correlations via brute force. It will be a mixture of all 16 possible deterministic assignments for the results of Alice and Bob when they use or not BS2. Writing it in the order Alice-0, Alice-1, Bob-0, and Bob-1, one possible assignment is $(c,d,c,d)$, which means that Alice gets result $c$ when she doesn't use BS2, result $d$ when she does use it, and the same for Bob.

+

Now, from the condition $p(dd|11) > 0$, we see that the LHV model must have nonzero weight in one of the four assignments $(c,d,c,d)$, $(c,d,d,d)$, $(d,d,c,d)$, and $(d,d,d,d)$, as these are the only ones with output $d,d$ for settings $1,1$. But the fact that $p(cc|00) = 0$ implies that $(c,d,c,d)$ is forbidden. Likewise, $p(dd|01) = 0$ implies that $(d,d,c,d)$, and $(d,d,d,d)$ are forbidden, and $p(dd|10) = 0$ implies that $(c,d,d,d)$ and $(d,d,d,d)$ are forbidden. Therefore, all four possibilities must have zero weight, and no LHV can reproduce those four characteristics of the quantum correlation.

+",12541,,,,,10/19/2020 16:28,,,,0,,,,CC BY-SA 4.0 +14256,1,14273,,10/19/2020 16:35,,5,195,"

For learning purposes, I would like to write a classical version of Shor's algorithm. From what I have read, what makes this algorithm fast is the quantum FFT, which is used to find the period of the function $a^k \bmod N$ with the ultimate goal of finding the k that solves $a^k \bmod N = 1$.

+

Acknowledging that it would be impractically slow, I would like to write a version that uses the classical FFT. Certainly such an algorithm could factor small numbers.

+

What confuses me is that when I calculate the values of $a^k \bmod N$ to feed into the FFT, it is not that much harder skip the FFT and just find $a^k \bmod N = 1$ by brute force (similar to this question).

+

What am I missing here? Alternatively, if I had a black box that could calculate FFTs instantaneously, how would this change Shor's algorithm?

+",13559,,2927,,10/19/2020 18:31,10/20/2020 22:00,How to write a classical version of Shor's algorithm,,1,3,,,,CC BY-SA 4.0 +14257,2,,14250,10/19/2020 18:29,,2,,"

Some important references could be the following: Quantum Walks On Graphs,

+

Quantum walks: a comprehensive review,

+

Quantum random walks - an introductory overview.

+",13461,,,,,10/19/2020 18:29,,,,0,,,,CC BY-SA 4.0 +14258,1,14263,,10/20/2020 0:21,,5,198,"

Can every bipartite quantum state (including entangled ones) be written in the following way

+

$$\rho_{AB} = \sum_{ij} c_{ij}\sigma_A^i\otimes \omega_B^j$$

+

where $\sigma_A^i$ and $\omega_B^j$ are density matrices? And if $\rho_{AB}$ is a quantum state, must it also be the case that $c_{ij}$ are nonnegative? If the answers are yes, how can one show this?

+

I ask this because of a claim that the set of product states $\rho_A\otimes\rho_B$ span the vector space of all operators acting on $H_A\otimes H_B$ in an answer here - https://quantumcomputing.stackexchange.com/a/5066/4831.

+",13561,,55,,10/23/2020 6:21,10/23/2020 6:21,Can every bipartite state be written as $\rho_{AB} = \sum_{ij} c_{ij}\sigma_A^i\otimes \omega_B^j$?,,2,2,,,,CC BY-SA 4.0 +14259,1,14290,,10/20/2020 2:17,,7,174,"

Suppose Alice and Bob share a state $\rho_{AB}$. Let us denote the reduced states as $\rho_A = \text{Tr}_B(\rho_{AB})$ and $\rho_B = \text{Tr}_A(\rho_{AB})$. Bob applies a projector so the new global state is

+

$$\rho'_{AB} = (I_A\otimes \Pi_B)\rho_{AB}(I_A\otimes \Pi_B)$$

+

Let us denote the new (subnormalized) reduced state on Alice's system as $\rho'_{A}$. I am given two facts about Bob's projector

+
    +
  1. $\Pi_B$ is diagonal in the eigenbasis of $\rho_B$.

    +
  2. +
  3. It is gentle i.e. $\text{Tr}(\Pi_B\rho_B) \geq \text{Tr}(\rho_B) - \varepsilon$ for some small $\varepsilon$.

    +
  4. +
+

I would like to know how the eigenvalues of $\rho'_A$ are related to those of $\rho_A$. So far, the only conclusion I have is that $\rho'_A\leq \rho_A$ where $A \leq B$ means that $B-A$ is positive semidefinite.

+

In particular, I am interested in any inequality relating the smallest nonzero eigenvalue of $\rho_A$ and the smallest nonzero eigenvalue of $\rho'_A$.

+",4831,,55,,10/23/2020 6:31,10/23/2020 9:29,Bob applies a projector - what happens to eigenvalues of Alice's reduced state?,,1,2,,,,CC BY-SA 4.0 +14261,1,14262,,10/20/2020 3:28,,-1,175,"

I tried to understand the notion of depth vs Trotter step in a uccsd circuit for the vqe algorithm in qiskit (I use an older version, 0.15). When I tried understanding it for a small system like H2, and started changing depth from 1 through 3, the whole circuit for U (the variational form, which in this case is uccsd) started repeating itself. Physically, this looked very much like increasing Trotter steps (or num_time_slices), for example, e^(A+B) = (e^(A/3)e^(B/3))^3. Indeed, when I set num_time_slices as 2 and depth as 1, I got the same circuit as with the numbers switched. Can someone help me with how the two are different, viz, depth and Trotter step?

+",11697,,,,,10/20/2020 5:12,Depth for UCC ansatz,,1,0,,,,CC BY-SA 4.0 +14262,2,,14261,10/20/2020 5:12,,1,,"

It is a bit strange that they decided to include "depth" as a parameter for UCCSD circuit. As you noted, the depth just means the repetition of the circuit/var_form here. So in fact, we do not need it as we can increase the number of time slices. Also note that in the new Qiskit release, "depth" is not called "reps" which, obviously, stands for repetition .

+

Also note that UCCSD is a chemically motivated Ansatz, so it only makes sense that the starting state, "initial_state" start out as the Hartree-Fock state.

+",9858,,,,,10/20/2020 5:12,,,,1,,,,CC BY-SA 4.0 +14263,2,,14258,10/20/2020 7:14,,3,,"

If all $c_{ij}$ are non-negative, this is the definition of a separable state. But you can argue this by giving a protocol that lets you construct, using LOCC, the state $\rho_{AB}$.

+

You probably could use this description to cover entangled states if you let the $c_{ij}$ be negative. Here's a simple argument for bipartite states of qubits: the Pauli matrices form a basis, meaning that +$$ +\rho_{AB}=\sum q_{ij}\sigma_i\otimes\sigma_j +$$ +(I'm using $\sigma$ here for Pauli matrices, NOT density matrices). Since $\rho_{AB}$ is Hermitian, the $q_{ij}$ are real. Now, I can always rewrite this as +$$ +\rho_{AB}=\left(q_{00}-\sum_{(i,j)\neq (0,0)}|q_{ij}|\right)I+ \sum_{(i,j)\neq (0,0)} |q_{ij}|(I+\text{sgn}(q_{ij})\sigma_i\otimes\sigma_j). +$$ +Now note that every term $I\pm\sigma_i\otimes\sigma_j$ is non-negative, with a separable basis, i.e. is a separable state. Indeed, the coefficient in front of every term is positive except, perhaps, that of the identity term.

+

(I should perhaps clarify that the term in front of the identity being positive is sufficient for the state to be separable, but is not necessary. In some cases there are better separable decompositions than the one I've given.)

+

There's a similar basis of Hermitian matrices for any Hilbert space dimension, so the result holds just as well for any bipartite state, not just qubits.

+",1837,,,,,10/20/2020 7:14,,,,2,,,,CC BY-SA 4.0 +14264,1,14443,,10/20/2020 8:40,,6,966,"

$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$

+

In Nielsen&Chuang on quantum error-correction codes they give a 5 qubit one as follows: +$$\small +\ket{0_L}=\frac14\left( +\color{red}{ ++\ket{00000} +-\ket{00011} ++\ket{00101} +-\ket{00110} +} +% +\color{blue}{ ++\ket{01001} ++\ket{01010} +-\ket{01100} +-\ket{01111}}\\ \hspace{.47in} +% +\color{green}{ +-\ket{10001} ++\ket{10010} ++\ket{10100} +-\ket{10111}} +% +-\ket{11000} +-\ket{11011} +-\ket{11101} +-\ket{11110} +\right) +$$

+

$$\small +\ket{1_L}=\frac14\left( +\color{red}{ ++\ket{11111} +-\ket{11100} ++\ket{11010} +-\ket{11001} +} +% +\color{blue}{ ++\ket{10110} ++\ket{10101} +-\ket{10011} +-\ket{10000}}\\ \hspace{.47in} +% +\color{green}{ +-\ket{01000} ++\ket{01011} ++\ket{01101} +-\ket{01110} +} +% +-\ket{00001} +-\ket{00010} +-\ket{00100} +-\ket{00111} +\right) +$$ +(I reshuffled entries w.r.t. to equal bits of information...colors represents equal patterns of signs, which remind me on a $H\otimes H$ gate)

+
+

How to implement the encoding gate for this?

+
+

I can't find that specific one anywhere in the online available literature...

+

Update: I can take $\ket{00000}$ to $\ket0_L$ by that quirk (modulus some sign errors for the other transfer to $\ket{1_L}$)...

+",5280,,55,,10/23/2020 6:33,8/11/2021 21:32,Nielsen&Chuang 5-qubit quantum error-correction encoding gate,,3,1,,,,CC BY-SA 4.0 +14265,1,,,10/20/2020 8:53,,3,68,"

While reading about Grover's mean estimation algorithm, I came across this post on StackExchange. As an undergrad, there are several points I don't quite understand.

+
    +
  1. What is the role of $f(x)$. Consider I have a list of numbers, such as $0.1, 0.2, 0.3, 0.4$ and I want to calculate the mean. What exactly is $f(x)$ mapping? What exactly is $x$ here? My wildest guess is that the above numbers are labelled as $00, 01, 10, 11$ and these binary strings are referred to as $x$. In this sense $f(x)$ behaves more like a table to associate $00 \rightarrow 0.1$, $00 \rightarrow 0.2$, etc. Is this the correct understanding?

    +
  2. +
  3. What computation on the ancilla? The aforementioned post also suggest that perform a computation of $f(x)$ on an ancilla register. What does the computation mean?

    +
  4. +
  5. How does this controlled-rotation look like? It appears to me that three registers are needed to implement this algorithm. To achieve this controlled-rotation, which bit is used as control?

    +
  6. +
+",13563,,55,,10/23/2020 6:33,10/23/2020 6:33,How to perform computation on an ancilla register in Grover's mean estimation algorithm?,,0,1,,,,CC BY-SA 4.0 +14266,1,14267,,10/20/2020 10:00,,0,340,"

How do I create an arbitrary unitary gate for an arbitrary number of qubits in Cirq?

+

Note: A solution for creating a single qubit gate is answered by Thomas W from this post. +How do I create my own unitary matrices that I can apply to a circuit in Cirq?

+",9903,,55,,10/23/2020 6:34,10/23/2020 6:34,Cirq: Creating an arbitrary gate for an arbitrary number of qubits,,1,0,,,,CC BY-SA 4.0 +14267,2,,14266,10/20/2020 11:47,,1,,"

You have 2 options depending on what your needs are:

+
    +
  1. Use cirq.MatrixGate.
  2. +
+
    +
  • Pros: you can easily instantiate the gate based on a unitary matrix.
  • +
  • Cons: you can't customize it that easily.
  • +
+
    +
  1. Create your own Gate class.
  2. +
+
    +
  • Pros: full flexibility, you can customize the features, diagram info, etc.
  • +
  • Cons: it's a bit more involved.
  • +
+

Using cirq.MatrixGate

+

cirq.MatrixGate lets you create a gate based on an arbitrary unitary. Nothing else is required. In the example below a 2 qubit QFT gate is created.

+
    QFT2 = np.array([[1, 1, 1, 1],
+                     [1, 1j, -1, -1j],
+                     [1, -1, 1, -1],
+                     [1, -1j, -1, 1j]]) * 0.5
+    my_qft2 = cirq.MatrixGate(QFT2)
+    print(cirq.Circuit(my_qft2(q[0],q[1])))
+
+

Resulting in:

+
      ┌                                       ┐
+      │ 0.5+0.j   0.5+0.j   0.5+0.j   0.5+0.j │
+0: ───│ 0.5+0.j   0. +0.5j -0.5+0.j   0. -0.5j│───
+      │ 0.5+0.j  -0.5+0.j   0.5+0.j  -0.5+0.j │
+      │ 0.5+0.j   0. -0.5j -0.5+0.j   0. +0.5j│
+      └                                       ┘
+      │
+1: ───#2──────────────────────────────────────────
+
+

Creating your own gate class

+

You will have to create a subclass of cirq.Gate and implement one of the following methods mandatorily: _num_qubits_, _qid_shape or num_qubits.

+

Then you can create magic methods to enrich your class with cirq protocols, like cirq.SupportsUnitary (implement the _unitary_ method) or cirq.SupportsCircuitDiagramInfo (implement the _circuit_diagram_info_ method).

+

An example implementing X gates applied to arbitrary number of qubits:

+
    from typing import Union, Iterable
+    
+    import numpy as np
+    
+    import cirq
+    from cirq.type_workarounds import NotImplementedType
+    
+    
+    class MultiXGate(cirq.Gate):
+        def __init__(self, num_qubits):
+            if num_qubits <= 0:
+                raise ValueError("num_qubits should be > 0")
+            self.num_qubits = num_qubits
+    
+        # this is mandatory (or alternatively, _qid_shape_ or num_qubits)
+        def _num_qubits_(self) -> int:
+            return self.num_qubits
+    
+        ## These are not mandatory but pretty important
+    
+        def _circuit_diagram_info_(self, _) -> Union[str, Iterable[str],
+                                                     cirq.CircuitDiagramInfo]:
+            return ["multi-X"] * self.num_qubits
+    
+        def _unitary_(self) -> Union[np.ndarray, NotImplementedType]:
+            x = cirq.unitary(cirq.X)
+            return cirq.kron(*([x] * self.num_qubits))
+    
+    
+    if __name__ == '__main__':
+        q = cirq.LineQubit.range(4)
+        circuit = cirq.Circuit(MultiXGate(len(q))(*q))
+        print(circuit)
+        c2 = cirq.Circuit([cirq.X(qubit) for qubit in q])
+        assert np.allclose(circuit.unitary(), c2.unitary())
+
+

This will print the following:

+
0: ───multi-X───
+      │
+1: ───multi-X───
+      │
+2: ───multi-X───
+      │
+3: ───multi-X───
+
+",4986,,4986,,10/20/2020 12:02,10/20/2020 12:02,,,,0,,,,CC BY-SA 4.0 +14268,1,,,10/20/2020 12:12,,2,53,"

+

I am trying to run the above code on Vigo, Santiago and other backends. However, warning message as shown in the image apppears and no result is displayed even after hours of waiting. However, when I reduce the bitstring size to 4 from 512/256/56 the output appears but that too after very long.

+

Questions:

+
    +
  1. Can anyone guide how to obtain a longer length bitstring (512, 1024, 2048) for one, two, three qubit measurements for backend options other than simulator?

    +
  2. +
  3. What is the reason for results not being obtained as I think there is no error in the code?

    +
  4. +
+",13172,,55,,10/23/2020 6:34,10/23/2020 6:34,Unable to run a QRNG code,,2,1,,,,CC BY-SA 4.0 +14269,2,,14264,10/20/2020 12:19,,5,,"

While there must be unitary ways of doing this, one possible way is to measure the stabilizers. What I mean by this is, say you have a single qubit state $|\phi\rangle=\alpha|0\rangle+\beta|1\rangle$. You take 4 ancilla qubits, +$$ +|\psi\rangle=|\phi\rangle|0000\rangle, +$$ +and you measure the 4 stabilizers $\{K_i\}$ of the code. You're aiming to get the system into the +1 eigenspace of all 4 operators. (So if you get the wrong measurement results, you have to perform an error correction.)

+

The circuit that you need for each stabilizer looks like: +

+

As a slightly more robust preparation procedure, you might simply prepare logical 0 of the code (again by stabilizer measurements) and teleport your unknown state into the system. Here's a suitable circuit for that last step: + +(the $|\psi\rangle$ in this picture actually refers to what I've called $|\phi\rangle$ in this answer.

+",1837,,362,,8/11/2021 21:32,8/11/2021 21:32,,,,5,,,,CC BY-SA 4.0 +14270,2,,14268,10/20/2020 12:42,,2,,"

The warning messages just inform you of interface change and has no impact to your code.

+

You're submitting one job for each bit. The system uses a fair-share algorithm to determine who gets to run next (more details here: https://quantum-computing.ibm.com/docs/manage/backends/queue/). So running hundreds of jobs consecutively would kill your priority very quickly. Which is why it'd take a very long time to finish all the jobs.

+

You can reduce the number of jobs by using more qubits in each circuit, and more circuits/shots for each job.

+",12195,,,,,10/20/2020 12:42,,,,2,,,,CC BY-SA 4.0 +14271,2,,14117,10/20/2020 13:34,,3,,"

Based on tsgeorgios information about Qiskit manual and the manual content, I created the code below which works as expected.

+
#BASED ON: https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#4.-Qiskit-Implementation
+%matplotlib inline
+# Importing standard Qiskit libraries and configuring account
+from qiskit import Aer
+from qiskit.circuit.library import QFT
+from qiskit.aqua.components.eigs import EigsQPE
+from qiskit.aqua.components.reciprocals import LookupRotation
+from qiskit.aqua.operators import MatrixOperator
+from qiskit.aqua.components.initial_states import Custom
+import numpy as np
+#Linear equations solvers
+from qiskit.aqua.algorithms import HHL, NumPyLSsolver #HHL - quantum, NumPyLSolver - classical
+
+def create_eigs(matrix, num_ancillae, num_time_slices, negative_evals):
+    ne_qfts = [None, None]
+    if negative_evals:
+        num_ancillae += 1
+        ne_qfts = [QFT(num_ancillae - 1), QFT(num_ancillae - 1).inverse()]
+    
+    #Construct the eigenvalues estimation using the PhaseEstimationCircuit
+    return EigsQPE(MatrixOperator(matrix=matrix),
+                   QFT(num_ancillae).inverse(),
+                   num_time_slices=num_time_slices,
+                   num_ancillae=num_ancillae,
+                   expansion_mode='suzuki',
+                   expansion_order=2,
+                   evo_time=None,
+                   negative_evals=negative_evals,
+                   ne_qfts=ne_qfts)
+
+def HHLsolver(matrix, vector, backend, no_ancillas, no_time_slices):
+    orig_size = len(vector_b)
+    #adapt the matrix to have dimension 2^k
+    matrix, vector, truncate_powerdim, truncate_hermitian = HHL.matrix_resize(matrix_A, vector_b)
+
+    #find eigenvalues of the matrix wih phase estimation (i.e. calc. exponential of A, apply 
+    #phase estimation) to get exp(lamba) and then inverse QFT to get lambdas themselves
+    eigs = create_eigs(matrix, no_ancillas, no_time_slices, False)
+    #num_q – Number of qubits required for the matrix Operator instance
+    #num_a – Number of ancillary qubits for Eigenvalues instance
+    num_q, num_a = eigs.get_register_sizes()
+
+    #construct circuit for finding reciprocals of eigenvalues
+    reci = LookupRotation(negative_evals=eigs._negative_evals, evo_time=eigs._evo_time)
+
+    #preparing init state for HHL, i.e. the state containing vector b
+    init_state = Custom(num_q, state_vector=vector)
+
+    #construct circuit for HHL based on matrix A, vector B and reciprocals of eigenvalues
+    algo = HHL(matrix, vector, truncate_powerdim, truncate_hermitian, eigs,
+               init_state, reci, num_q, num_a, orig_size)
+    
+    #solution on quantum computer
+    result = algo.run(quantum_instance = backend)
+    print("Solution:\t\t", np.round(result['solution'], 5))
+    print("Probability:\t\t %f" % result['probability_result'])
+
+    #refence solution - NumPyLSsolver = Numpy LinearSystem algorithm (classical).
+    result_ref = NumPyLSsolver(matrix, vector).run()
+    print("Classical Solution:\t", np.round(result_ref['solution'], 5))
+
+matrix_A = np.array([[1.5, 0.5],[0.5, 1.5]])
+vector_b = [0.9010, -0.4339]
+#x = A^(-1)b = [0.78420, -0.55066] #expected result
+
+processor = Aer.get_backend('statevector_simulator')
+
+no_ancillas = 3 #number of ancilla qubits
+no_time_slices = 50 #number of timeslices in exponential of matrix A (exp(i*A*t))
+
+HHLsolver(matrix_A, vector_b, processor, no_ancillas, no_time_slices)
+
+

Acknowledgement: The code is based on Qiskit manual on HHL.

+",9006,,,,,10/20/2020 13:34,,,,1,,,,CC BY-SA 4.0 +14272,2,,14268,10/20/2020 15:28,,1,,"

As the other answer stated, there is nothing wrong. The reason for long time for the job to be completed is coming from the queuing time and not the actual execution time itself.

+

One way to get around this is to use more qubits. This way you don't have to stuck in queue multiple time. That is, you use the maximum number of qubits a particular machine has along with the maximum_circuits (circuits) it allows you to run on a single job. For instance, Ourense has 5 qubits with maximum_circuits of 75, so this means you have 5*75 = 375 bitstrings that you can extract from a single queue.

+

One other way to get around this, you can use build a noise_model that mimics Ourense with qasm_simulator. Look at this documentation here on how to do that: Building Noise-Model

+",9858,,,,,10/20/2020 15:28,,,,2,,,,CC BY-SA 4.0 +14273,2,,14256,10/20/2020 22:00,,2,,"

In Shor's (quantum) algorithm, you compute the modular exponent only a small number of times—far smaller than $N$. The algorithm is probabilistic, and if you're lucky you may compute it only once.

+

After the modular exponentiation step, in principle the qubits encode the value of $a^k\text{ mod }N$ for every $k$, but you can't just search through the wave function for a value of $1$. If you could do that (sometimes called "postselection"), you could do far more impressive things than factoring numbers, such as solving Circuit SAT in linear time by postselecting on the circuit's output being $1$. The problem is that you don't get to choose the outcome of your measurement, and with overwhelming probability you'll get an outcome that you didn't want.

+

When you simulate Shor's algorithm (or my attempt at a Circuit SAT solver) classically, there is probably no dramatically more efficient way to do it than actually computing every term of the wave function in the computational basis. Since you're doing all that work, you can check for the output you wanted at the same time—but if you do that you're no longer simulating a quantum algorithm, since that operation isn't permitted by the rules of quantum computation (and isn't permitted by the laws of physics as far as we can tell).

+",3030,,,,,10/20/2020 22:00,,,,0,,,,CC BY-SA 4.0 +14279,2,,14258,10/21/2020 10:31,,5,,"

I know the question is already answered, but there was some question on my comment and I wanted to elaborate on that.

+

First, let us consider one system only. The $\mathbb{R}$-span of all states $\rho$ is the space of Hermitian operators. Indeed, by the spectral decomposition, already the set of pure states is enough. This also implies that the $\mathbb{C}$-span contains all linear operators, since we can decompose any operator into a Hermitian and anti-Hermitian part and expand those in states.

+

For two (or more) systems, the dimension of $L(H_A\otimes H_B)=L(H_A)\otimes L(H_B)$ is the product of the individual dimensions, $\dim L(H_A) \times \dim L(H_B)$. This implies that taking tensor products of generating sets of $L(H_A)$ and $L(H_B)$ has to yield a generating set, too. Just reduce the generating set to a basis of $L(H_A)$ and $L(H_B)$ and you'll get a product basis which lies in the product of the generating sets.

+

Note that this also shows that this is not as special property of states. Any generating set will do.

+

What is special is that states are Hermitian and trace-one. Thus, they all lie in the according affine space in the real vector space of Hermitian operators. Hence, any other Hermitian trace-one operator is not any arbitrary (real) linear combination of states, but an affine one (take the trace on both sides) +$$ + A = \sum_{i,j} c_{i,j} \rho_i \otimes \rho_{j} \quad \Rightarrow \quad \sum_{ij} c_{ij} = 1. +$$ +As stated before, if we restrict to coefficients to be non-negative, we get the convex hull of product states, which is the set of separable states.

+

BTW, this is the geometric background for the robustness of entanglement which is an entanglement monotone defined as the minimum negativity in an affine decomposition of a state $\rho$ into product states.

+",2305,,2305,,10/21/2020 11:39,10/21/2020 11:39,,,,2,,,,CC BY-SA 4.0 +14280,1,14282,,10/21/2020 12:36,,5,3365,"

I need to draw a quantum circuit in Clifford+T library and obtain automatically its transformation matrix. Is there any feature on Qiskit in this case?

+",5217,,55,,10/23/2020 6:34,10/23/2020 6:34,How can I obtain transformation matrix of a quantum circuit in the Qiskit?,,3,0,,,,CC BY-SA 4.0 +14281,2,,14280,10/21/2020 15:03,,3,,"

In qiskit, you can get the unitary transformation matrix from a quantum circuit by running the following:

+
from qiskit import *
+#circuit already defined
+backend = Aer.get_backend('unitary_simulator')
+job = execute(circuit, backend)
+result = job.result()
+print(result.get_unitary(circ, decimals=3))
+
+

and the matrix will output. As you increase the number of qubits in your circuit, the size of the unitary matrix will increase exponentially.

+",13117,,,,,10/21/2020 15:03,,,,0,,,,CC BY-SA 4.0 +14282,2,,14280,10/21/2020 15:40,,2,,"

The other answer is great.

+

But here is a link that walk you through the process step-by-step: https://medium.com/mdr-inc/checking-the-unitary-matrix-of-the-quantum-circuit-on-qiskit-5968c6019a45

+",9858,,,,,10/21/2020 15:40,,,,0,,,,CC BY-SA 4.0 +14283,2,,14280,10/21/2020 16:04,,17,,"

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 Operator class in the qiskit.quantum_info library.

+
import qiskit.quantum_info as qi
+
+op = qi.Operator(circ)
+
+

If you want the numpy array of the operator, this can be obtained via the data attribute (array = op.data)

+

See the API Documentation and Operator tutorial for additional info on this class.

+",8650,,,,,10/21/2020 16:04,,,,0,,,,CC BY-SA 4.0 +14284,1,,,10/21/2020 19:23,,4,57,"

What are the bounds on quantum speedups under the various models of complexity? How big or small can they be?

+

Under the query model, my understanding is that the lower bound is $\Omega(\sqrt{N})$ as discussed in BBBV97 and established by Grover's algorithm. The upper bound is established by Forrelation, as shown by Aaronson and Ambainis. Using these, we can then define a quantum speedup as:

+

$S={C(N)\over{Q(N)}}$,

+

where $C$ is some appropriately selected classical algorithm, $Q$ our quantum algorithm, and the quantum speedup is bounded by $\Omega(\sqrt{N}) \le S \le {\Omega(\sqrt{N}/ \log N)}$.

+

Do we have similar bounds on quantum speedups under other models of complexity (e.g. gate, sample, space)? If so, references to the papers establishing these bounds would be great.

+",1937,,10480,,1/15/2021 22:05,1/15/2021 22:05,Bound on quantum speedups under various models of complexity,,0,4,,,,CC BY-SA 4.0 +14285,1,15122,,10/21/2020 20:04,,3,152,"

Consider a bipartite state $\rho_{AB}$ with reduced states $\rho_A = \text{Tr}_B(\rho_{AB})$ and $\rho_B = \text{Tr}_A(\rho_{AB})$.

+

Suppose one obtains states $\rho'_{A}$ and $\rho'_{B}$ such that $\|\rho'_A - \rho_A\|_1 \leq \delta$ and $\|\rho'_B - \rho_B\|_1 \leq \delta$. That is, we have perturbed the reduced states slightly. In the specific problem I am looking at $\rho'_A$ commutes with $\rho_A$ and $\rho'_B$ commutes with $\rho_B$ but perhaps this is not relevant.

+

Does there exist a global state $\rho'_{AB}$ with marginals $\rho'_A$ and $\rho'_B$ such that $\|\rho'_{AB} - \rho_{AB}\|_1\leq \varepsilon(\delta)$, where $\lim_{\delta\rightarrow 0}\varepsilon(\delta) = 0$?

+",4831,,55,,10/23/2020 6:44,12/13/2020 0:53,Quantum marginal problem - constructing a global state from reduced states,,1,0,,,,CC BY-SA 4.0 +14286,1,14287,,10/21/2020 20:38,,0,47,"

I am trying to create this state: +rho = = q . rho_{1,2} + r . rho_{2,3} + s . rho{1,3} + (1-q-r-s) . rho_separable

+

And I wrote this code:

+
   import random
+import numpy as np
+import cirq
+
+circuit, circuit2, circuit3   = cirq.Circuit()
+p = 0.2
+q = 0.1
+r = 0.3
+alice, bob, charlie = cirq.LineQubit.range(1, 4)
+rho_12 = circuit.append([cirq.H(alice), cirq.CNOT(alice, bob)]) 
+#circuit.append([cirq.H(alice), cirq.CNOT(alice, bob)]) 
+rho_23 = circuit.append([cirq.H(bob), cirq.CNOT(bob, charlie)]) 
+rho_13 = circuit.append([cirq.H(alice), cirq.CNOT(alice, charlie)]) 
+circuit = rho_12 + rho_23 + rho_13
+print(circuit)
+
+

In here I have 2 problem:

+

1)This line is not working: circuit = rho_12 + rho_23 + rho_13

+

2)I cannot multiply the state with p or q or r. What I mean is that I can't write this line:

+
rho_12 = circuit.append([cirq.H(alice), cirq.CNOT(alice, bob)]) * q 
+
+

Could you please show me how I can write this state?

+",13548,,55,,10/23/2020 6:35,10/23/2020 6:35,Multiple Bipartite Entangled State in Cirq,,1,4,,,,CC BY-SA 4.0 +14287,2,,14286,10/21/2020 21:28,,0,,"

You seem to think append is returning a circuit, instead of modifying the circuit you called it on. circuit.append(op) doesn't return anything, it adds an operation to circuit.

+
alice, bob, charlie = cirq.LineQubit.range(1, 4)
+circuit = cirq.Circuit()
+circuit.append([cirq.H(alice), cirq.CNOT(alice, bob)])
+circuit.append([cirq.H(bob), cirq.CNOT(bob, charlie)]) 
+...
+
+

Alternatively, you can make a new circuit for each of the pieces and then add them together:

+
rho_12 = cirq.Circuit(
+    cirq.H(alice),
+    cirq.CNOT(alice, bob),
+)
+...
+circuit = rho_12 + rho_23 + rho_13
+
+",119,,,,,10/21/2020 21:28,,,,1,,,,CC BY-SA 4.0 +14288,1,14289,,10/21/2020 23:24,,1,101,"

1)I want to use noise model for my state and bit_flip is not defined on cirq.

+
    rho_13 = cirq.Circuit(
+    cirq.H(alice),
+    cirq.CNOT(alice, charlie),
+    #cirq.bit_flip([r]),
+    cirq.measure(alice,charlie),
+) 
+
+

When I wrote this code, I had the error: " bit_flip is not defined" (I used import cirq)

+

2)For ghz state I wrote this part but I didn't understand I have a syntax error which is very weird maybe I am doing something wrong regarding cirq but I get this error. Can you look at it?

+
    ghz = cirq.Circuit(  
+   cirq.H(qubits[0]),
+   for i in range (n-1):
+       cirq.CNOT ( qubits [i] , qubits [i+1]),
+   cirq.final_density_matrix(circuit),
+   cirq.measure (* qubits , key ='x'),. 
+)
+
+

The syntax error is just after the "for" and "Invalid syntax"

+

3)My original state is |GHZ><GHZ|+P*rho. Should I use cirq.final_density_matrix(circuit), in the part of ghz only, or should I use cirq.final_density_matrix(circuit), after defining my all state(I will first define |GHZ><GHZ and then (1-P)rho, and then I will write circuit =|GHZ><GHZ|+(1-P)rho after that cirq.final_density_matrix(circuit)) or should I use cirq.final_density_matrix(circuit) both part for all circuit and |GHZ><GHZ too

+
    +
  1. I can create entangled state with hadamard and cnot gate but I want to create seperable state. How can I create seperable state with cirq
  2. +
+

5)For measurement, Should I measure each part seperately or should I first appending all circuit and then measured together? What I mean is that first I will measure |GHZ><GHZ| and then I will measure P*rho and after that I will add my circuit like circuit =|GHZ><GHZ|+(1-P)rho and simulate or Should I directly add and after that measure the all circuit?

+

Many thanks from now

+",13548,,16606,,5/24/2022 16:21,5/24/2022 16:21,"Bit Flip, Separable state and Several Question about Cirq",,1,0,,,,CC BY-SA 4.0 +14289,2,,14288,10/22/2020 1:29,,0,,"
    +
  1. You are running into basic python issues: trying to call a function with a list [r] instead of a float parameter. Also, the bit_flip channel then needs to be applied on a qubit. A potential fix is here:
  2. +
+
import cirq
+
+alice, bob, charlie = cirq.LineQubit.range(3)
+rho_13 = cirq.Circuit(
+    cirq.H(alice),
+    cirq.CNOT(alice, charlie),
+    # you need a probability to have the channel defined
+    # then you'll need to apply the channel to a qubit
+    cirq.bit_flip(p=0.6)(charlie),
+    cirq.
+measure(alice,charlie),
+) 
+
+
    +
  1. This is also fraught with Python issues. You are trying to create a circuit - but then passing in a for loop as an argument? cirq.final_density_matrix should not be part of the Circuit construction arguments for sure. Measurement can be part of the circuit but let's deal with that later as you have a question about that too.

    +
  2. +
  3. Summing states together only makes sense in the density matrix representation. From your three last questions (Producing |GHZ><GHZ| State in Cirq, Multiple Bipartite Entangled State in Cirq and this one) I'm gathering that you would like to put together a state that represents a mixture between the GHZ state and 4 states. So we'll have to

    +
      +
    1. create the density matrix for each of them,
    2. +
    3. multiply them with the required probabilities
    4. +
    5. sum them together.
    6. +
    +
  4. +
  5. You need to tell us more about what kind of separable state you would like. |000><000| is one of the simplest separable ones - as it is $|0\rangle\langle0| \otimes|0\rangle\langle0|\otimes|0\rangle\langle0|$ - I'm going to assume that that's good enough. But any state that is the result of only local operations (i.e. one qubit operations) should be good enough.

    +
  6. +
  7. Measurement is not required for your state preparation. If you want to measure your final state, I would add that at the end. Let's cover that as well.

    +
  8. +
+

There are two major ways that I can think of to solve this:

+
    +
  1. using density matrices directly
  2. +
  3. using mixtures of unitaries
  4. +
+

Here is an example for both - at the end the final density matrix is exactly the same.

+

+from typing import Union, Sequence, Tuple, Any
+
+import cirq
+import numpy as np
+
+from cirq.type_workarounds import NotImplementedType
+
+
+# ======== Density matrix based method ============
+
+a, b, c = cirq.LineQubit.range(3)
+GHZ_circuit = cirq.Circuit(cirq.H(a),
+                           cirq.CNOT(a, b),
+                           cirq.CNOT(b, c))
+
+GHZ = cirq.final_density_matrix(GHZ_circuit)
+
+
+def density_matrix_bipartite_entangled(i, j, qs):
+    circuit = biparty_entangle_circuit(i, j, qs)
+    return cirq.final_density_matrix(circuit, qubit_order=qs)
+
+
+def biparty_entangle_circuit(i, j, qs):
+    return cirq.Circuit(cirq.H(qs[i]), cirq.CNOT(qs[i], qs[j]))
+
+
+qs = [a, b, c]
+
+rho01 = density_matrix_bipartite_entangled(0, 1, qs)
+rho02 = density_matrix_bipartite_entangled(0, 2, qs)
+rho12 = density_matrix_bipartite_entangled(1, 2, qs)
+
+# creates the |+> ⊗ |1> ⊗ |0> state
+circuit_separable = cirq.Circuit(cirq.H(a), cirq.X(b))
+rho_separable = cirq.final_density_matrix(circuit_separable, qubit_order=qs)
+
+p, q, r, s = 0.5, 0.3, 0.2, 0.1
+assert 0 <= q + r + s <= 1
+assert 0 <= p <= 1
+
+rho = q * rho01 + r * rho02 + s * rho12 + (1 - q - r - s) * rho_separable
+state = p * GHZ + (1 - p) * rho
+
+print(f"final state: \n {state}")
+
+print(cirq.sample_density_matrix(state, indices=[0, 1, 2], repetitions=10))
+
+
+# ======== Mixture based method ============
+
+class MixtureGate(cirq.Gate):
+    def __init__(self, p, q, r, s):
+        self.p = p
+        self.q = q
+        self.r = r
+        self.s = s
+
+    def _num_qubits_(self) -> int:
+        return 3
+
+    def _mixture_(self) -> Union[Sequence[Tuple[float, Any]],
+                                 NotImplementedType]:
+        p, q, r, s = self.p, self.q, self.r, self.s
+        rho01_gate = biparty_entangle_circuit(0, 1, qs).unitary(
+            qubits_that_should_be_present=qs)
+        rho02_gate = biparty_entangle_circuit(0, 2, qs).unitary(
+            qubits_that_should_be_present=qs)
+        rho12_gate = biparty_entangle_circuit(1, 2, qs).unitary(
+            qubits_that_should_be_present=qs)
+        separable_gate = circuit_separable.unitary(
+            qubits_that_should_be_present=qs)
+
+        return [
+            (p, GHZ_circuit.unitary()),
+            ((1 - p) * q, rho01_gate),
+            ((1 - p) * r, rho02_gate),
+            ((1 - p) * s, rho12_gate),
+            ((1 - p) * (1 - q - r - s), separable_gate),
+        ]
+
+
+final_circuit = cirq.Circuit(
+    MixtureGate(p, q, r, s)(a, b, c)
+)
+circuit_based_state = cirq.final_density_matrix(final_circuit)
+
+print(circuit_based_state)
+
+# we can do measurements here as well
+
+final_circuit.append(cirq.measure(a, b, c))
+
+r = cirq.DensityMatrixSimulator().run(program=final_circuit, repetitions=10)
+print("Measurement results: ", r)
+
+## They are the same, yay!
+assert np.allclose(circuit_based_state, state)
+
+
+
+",4986,,4986,,10/22/2020 2:04,10/22/2020 2:04,,,,1,,,,CC BY-SA 4.0 +14290,2,,14259,10/22/2020 9:10,,4,,"

Just notice that +$$ +\text{Tr}(\rho'_{AB}) = \text{Tr}(\Pi_B\rho_{B}). +$$ +One way to see this is to consider any decomposition +$$ +\rho_{AB} = \sum_i A_i \otimes B_i, +$$ +where $A_i, B_i$ just some matrices, not states.
+Then +$$ +\text{Tr}(\rho'_{AB}) = +\text{Tr}\big(\sum_i A_i \otimes \Pi_BB_i\Pi_B\big) = +$$ +$$ += \sum_i \text{Tr}(A_i)\text{Tr}(\Pi_BB_i\Pi_B) = +\sum_i \text{Tr}(A_i)\text{Tr}(\Pi_BB_i) +$$ +and +$$ +\text{Tr}(\Pi_B\rho_{B}) = \text{Tr}(\Pi_B \sum_i \text{Tr}(A_i)B_i) = +$$ +$$ += \sum_i \text{Tr}(A_i)\text{Tr}(\Pi_BB_i). +$$

+

Now we can deduce that +$$ +\text{Tr}(\rho_{AB} - \rho'_{AB}) = 1 - \text{Tr}(\Pi_B\rho_{B}) \le \varepsilon +$$ +and hence +$$ +\text{Tr}(\rho_{A} - \rho'_{A}) \le \varepsilon +$$ +since $\text{Tr}(\rho'_{AB}) = \text{Tr}(\rho'_{A})$.

+

This bounds $\rho'_{A}$ from below (in contrast to $0 \le \rho_{A} - \rho'_{A}$). It can be seen now that $\rho'_{A} \rightarrow \rho_{A}$ if $\varepsilon \rightarrow 0$.

+

Update

+

From trace inequality and positivity of $\rho_A - \rho'_A$ we can deduce +$$ +0 \le \rho_A - \rho'_A \le \varepsilon I, +$$ +so +$$ +\rho'_A \le \rho_A \le \rho'_A + \varepsilon I. +$$ +Hence +$$ +\lambda'_i \le \lambda_i \le \lambda'_i + \varepsilon, +$$ +where $\{ \lambda_i \}, \{ \lambda'_i \}$ are sorted eigenvalues of $\rho_A, \rho'_A$.

+

Now if $\lambda_k$ is the first non-zero eigenvalue and $\varepsilon < \lambda_k$ then $\lambda'_k \ge \lambda_k - \varepsilon > 0$, which means $\lambda'_k$ will be the first non-zero eigenvalue of $\rho'_A$. For it we know that $\lambda_k - \varepsilon \le \lambda'_k \le \lambda_k$.

+",5870,,5870,,10/23/2020 9:29,10/23/2020 9:29,,,,3,,,,CC BY-SA 4.0 +14291,1,,,10/22/2020 10:34,,2,104,"

Say we want to apply CNOT, and the control register "c" is a n-bit string. Given a specific c*, is it possible to change all bits of the register into 1, if and only if the initial c equals to c*?

+

I checked "Classical Concepts in Quantum Programming" in order to get an idea of how to implement something similar to if-else in quantum computing, but it made things more complicated. What is the right direction to figure something like this out?

+",13584,,,,,10/23/2020 12:24,How to apply control on a register if that register is equal to a specific n-bit string c*?,,2,1,,,,CC BY-SA 4.0 +14292,2,,11580,10/22/2020 12:17,,1,,"

For an n-qubit operation it means:

+
    +
  1. Prepare n Bell pairs $a_k, b_k = |00\rangle + |11\rangle$.
  2. +
  3. Take one qubit $a_k$ from each pair, and apply $U$ to those qubits $a_1, a_2, ..., a_n$.
  4. +
  5. The state of all of the qubits $a_1, b_1, ... a_n, b_n$ now encodes the operation $U$.
  6. +
+

Quirk makes this particularly blatant, because the way it displays superpositions results in the final state even looking like the matrix of the operation:

+

+",119,,,,,10/22/2020 12:17,,,,0,,,,CC BY-SA 4.0 +14293,1,,,10/22/2020 15:40,,3,194,"

In this paper by Ambainis, he talks about the applicability of Grover's Search to Schöning's algorithm for solving the 3SAT problem to obtain a runtime of $O(\sqrt{1.329...^n}$.

+

In the original algorithm by Schöning, the algorithm is repeated for $1.329^n$ time to obtain a constant success probability. Ambainis states the following: "To obtain a quantum algorithm, we just use quantum amplitude amplification instead of classical repetition."

+

I don't understand here at what stage we apply Grover's Search. For instance, what is the search space on which we are applying Grover's Search?

+",7986,,,,,10/22/2020 16:04,Grover's Search applied to Schöning's Algorithm,,1,0,,,,CC BY-SA 4.0 +14294,2,,7035,10/22/2020 15:56,,2,,"

I often wonder if the welded trees considered in the Childs et al. paper have any applicability to questions in algorithmic knot theory such as knot identification/knot canonization. For example, I envision labeling vertices of the welded tree with specific knot diagrams/grid diagrams, and labeling edges with various Reidemeister moves that go from one diagram to another.

+

+

Walking along the tree may be somewhat akin to trying to untangle/untie a complicated knot.

+

For example, one could identify the $\mathrm{ENTRANCE}$ node with a given knot diagram, and the target $\mathrm{EXIT}$ node with some canonical labeling of the given knot. Each edge corresponds to a Reidemeister move.

+
    +
  • Walking from the left $\mathrm{ENTRANCE}$ to the middle glued region might correspond to performing Reidemeister Type I/II moves that increase the number of crossings, up to an a-priori given maximum crossing number;
  • +
  • Walking within the middle corresponds to Type III moves that don't change the crossing number but rather just do over/under slides; and
  • +
  • Walking from the middle to the $\mathrm{EXIT}$ node corresponds to performing Type I/II moves that decrease the crossing number.
  • +
+

I think it's the case that a classical walk to simplify a knot by initially making it more complicated with Type I/II moves often gets stuck doing such Type III moves prior to being able to simplify. Perhaps the quantum walk considered by Childs et al. is more likely to find a simpler canonical knot diagram exponentially faster than a classical walk.

+

The oracle would be instantiated by labeling a knot diagram/grid diagram (corresponding to the basis states of the Hamiltonian), and providing a list of Reidemeister moves available to such a labeling (corresponding to the off-diagonal elements of the Hamiltonian). Certainly these are classically computable in polynomial time - given a knot diagram, one can enumerate all of the available Reidemeister moves.

+

As opposed to the tree considered by Childs et al., such a Reidemeister graph is not of degree $2$, nor is it even regular, but I sense that the graph is sufficiently sparse that much of the exponential speedup would carry through.

+",2927,,2927,,1/6/2021 1:27,1/6/2021 1:27,,,,7,,,,CC BY-SA 4.0 +14295,2,,14293,10/22/2020 16:04,,4,,"

The Grover search is applied to the randomness that's fed into Schoning's algorithm. The randomness could be a big list of random bits, or for simplicity just a seed for a PRNG. You're searching over the seeds for one that causes Schoning's algorithm to succeed.

+

Given an oracle (Schoning's algorithm) which accepts $(3/4)^n$ of its possible inputs, you only need $O(\sqrt{(4/3)^n)})$ Grover steps to find one of those satisfying inputs.

+

This general strategy of searching over the randomness will accelerate any algorithm whose runtime is bottlenecked by the need to repeat many times until you get a lucky hit.

+",119,,,,,10/22/2020 16:04,,,,2,,,,CC BY-SA 4.0 +14296,1,,,10/22/2020 16:26,,4,283,"

Reading the quantum phase estimation algorithm on Wikipedia, I am wondering how exactly the measurements are used to obtain the phase $\delta$. I understand that the value of phase is encoded into the binary string that represents a computational state. My question is more about what extra information can be extracted from the probabilities. If I perform the measurement in the computational basis, i.e., $|a\rangle$ in the notation used on Wikipedia, what I obtain is a list of probabilities for each state. (Imagine the case $\delta\neq 0$). How exactly can I get this $\delta$ from these probabilities? Since the probability $\text{Pr}(a)$ is what I get and is expressed in terms of $\delta$, do I have to inverse the following function

+

$\text{Pr}(a) = \frac{1}{2^{2^{n}}}\frac{|\sin(\pi 2^{n}\delta)|^{2}}{|\sin(\pi\delta)|^{2}}$

+

in order to get $\delta$?

+

Meanwhile, how does the algorithm recognise the nearest integer to $2^{n}\theta$? The only way I can imagine is that the probability that corresponds to a certain state is greater than other. Imagine I do not approximate, $\textit{a priori}$, $2^{n}\theta = a + 2^{n}\delta$, then what I obtain is this list of probabilities for each $a$. It appears I can use any of them to estimate the phase. In this case, which probability shall I use?

+",13563,,55,,10/23/2020 6:45,8/12/2021 9:02,How to use the measurement in quantum phase estimation?,,2,0,,,,CC BY-SA 4.0 +14297,2,,11881,10/22/2020 17:36,,3,,"

Cirq has now a DOI published through Zenodo - please refer to https://github.com/quantumlib/Cirq#how-to-cite-cirq for citation.

+",4986,,,,,10/22/2020 17:36,,,,0,,,,CC BY-SA 4.0 +14299,2,,14291,10/22/2020 18:45,,2,,"

Let me consider this example: if we have $|01\rangle$ then the circuit should give us at the output $|11\rangle$. Here I will try to show why I think this is impossible (by assuming that we don't do any measurements). Let's assume that we have the desired gate and we want to apply it to this state $\frac{1}{\sqrt{3}}(|00\rangle +|01\rangle - |11\rangle)$:

+

$$U \frac{1}{\sqrt{3}}(|00\rangle +|01\rangle - |11\rangle) = \frac{1}{\sqrt{3}}(|00\rangle +|11\rangle - |11\rangle) = \frac{1}{\sqrt{3}}|00\rangle$$

+

$U$ must be unitary and that means it should keep the length of the vector, but in this example, the length didn't preserve (was $1$, became $\frac{1}{3}$). This means that we can't construct this kind of circuit at least for this example. Note that I assumed from the beginning that we don't have any kind of measurements in the circuit. Also, I assume that we don't have an ancillary qubit, but I guess (I might be wrong) an ancillary qubit will not help here. Nevertheless, for the mentioned assumptions, this answer shows a prove why this will not work (at least) for the given example.

+

If we assume that there is no superposition of bitstrings by considering qubits as bits, and we allow measurement operations then this can be done easily: measure the qubits and if the qubits will be measured in $|01\rangle$ state then apply $X$ gate on the first qubit in order to obtain $|11\rangle$, otherwise do nothing. One caveat, depending on the Quantum hardware the gates after the measurement on the same qubit theoretically might not work. Or this can be done without measurement, but with ancillary qubit (still assuming no superposition of bitstrings):

+

+

The first part can be understood from this answer, the second part uses ancillary qubit $q_2$ that will be in $|1\rangle$ if only the first two qubits are in $|01 \rangle$ state. In the second part, a CNOT gate is applied to make sure that the first two qubits will be in $|11\rangle$ state at the end.

+

Did I understand the question right?

+",9459,,9459,,10/23/2020 12:24,10/23/2020 12:24,,,,0,,,,CC BY-SA 4.0 +14301,1,14302,,10/22/2020 21:51,,0,87,"

The T Gate is defined as $\begin{bmatrix} 1&0 \\ 0&e^{i\pi/4} \end{bmatrix} = \begin{bmatrix} 1&0 \\ 0&\frac{\sqrt{2}}{2}(1+i) \end{bmatrix}.$

+

So $\begin{bmatrix} 1&0 \\ 0&\frac{\sqrt{2}}{2}(1+i) \end{bmatrix} \vert 1 \rangle = \begin{bmatrix} 1&0 \\ 0&\frac{\sqrt{2}}{2}(1+i) \end{bmatrix} \begin{bmatrix} 0 \\ 1 \end{bmatrix} = \begin{bmatrix} 0 \\ \frac{\sqrt{2}}{2}(1+i) \end{bmatrix}.$

+

But the following code for the T Gate gives a slightly different output:

+
from qiskit import QuantumCircuit, Aer, execute
+from qiskit_textbook.tools import array_to_latex
+
+qc = QuantumCircuit(1)
+qc.initialize([0,1],0)  # initialize to |1>
+qc.t(0)
+display(qc.draw('mpl'))
+backend = Aer.get_backend('statevector_simulator')  # simulate the circuit
+state = execute(qc,backend).result().get_statevector()  # get final state
+array_to_latex(state, pretext="\\text{Output} = ")  # show final state vector
+
+

which is $\begin{bmatrix} 0 \\ \frac{1}{\sqrt{2}}(1+i) \end{bmatrix}.$

+

Why do these two results differ? Thanks for any insights.

+",13467,,55,,10/24/2020 16:59,10/24/2020 16:59,State Vector Output for T$|1\rangle$ in Qiskit differs from manual calculation. Why is this so?,,1,1,,,,CC BY-SA 4.0 +14302,2,,14301,10/22/2020 22:07,,4,,"

$\frac{\sqrt{2}}{2}(1+i) $ = $\frac{1}{\sqrt{2}}(1+i)$. To see how this is the case, multiply the numerator and denominator of $\frac{1}{\sqrt{2}}$ by $\frac{\sqrt{2}}{\sqrt{2}}$ = $1$. $\frac {\sqrt{2}}{\sqrt{2}} \frac{1}{\sqrt{2}} = \frac{\sqrt{2}}{{2}}$ .

+

The result doesn't differ; only how it's displayed in comparison to your manual calculation does.

+",362,,362,,10/22/2020 22:28,10/22/2020 22:28,,,,0,,,,CC BY-SA 4.0 +14303,1,14316,,10/22/2020 23:12,,3,256,"

I have a few questions in understanding the difference between coupling and entanglement in quantum systems: Is there a clear boundary between quantum coupling and quantum entanglement? If two quantum systems are coupled, do they need to be restricted to a certain distance? Is there a difference between 'coupling the two qubits' and 'entangling' them using a Hadamard Gate? In Schrodinger's cat thought experiment, are we saying the cat and radioactive source are 'entangled' or 'coupled'?

+",12334,,55,,10/24/2020 16:58,10/24/2020 16:58,Is there a clear boundary between quantum coupling and quantum entanglement?,,1,0,,,,CC BY-SA 4.0 +14304,1,,,10/23/2020 4:20,,3,129,"

In a paper called On quantum circuits employing roots of the Pauli matrices, I found this figure, where I couldn't understand the equality in the circled circuits. I need an explanation of how the circuits in the circle are equal with any rules used in reduction. Especially the CNOT underlined in red - How it is reduced? +

+",10495,,55,,10/24/2020 14:36,10/24/2020 14:36,Optimizations in quantum circuits,,2,0,,,,CC BY-SA 4.0 +14305,1,,,10/23/2020 7:18,,2,488,"

I want to do partial measurement of quantum circuit containing two qubits in entangled state. I want to first measure one qubit and record the result. Thereafter, record the measurement of second qubit and compare the two. Mathematically, the two should come out to be same.

+

How to do the same on Qiskit using Python?

+",13588,,1859,,10/23/2020 18:57,10/23/2020 18:57,Partial Measurement of Quantum Circuit in Qiskit,,1,2,,,,CC BY-SA 4.0 +14306,2,,14291,10/23/2020 9:20,,2,,"

Currently, I do not know of any quantum processor allowing to condition a quantum operation on results in a classical register. On IBM Q, it is possible to do so in simulator only.

+

However, if you are dealing with quantum circuits like quantum teleportation or superdense coding, where you use such conditioning, you can simply use controlled quantum gates where control qubits are those you would measure and store the results in classical register. See this thread for more information.

+",9006,,,,,10/23/2020 9:20,,,,0,,,,CC BY-SA 4.0 +14308,2,,14305,10/23/2020 16:08,,3,,"

Consider the maximal entangled state

+

$$ |\psi \rangle = \dfrac{1}{\sqrt{2}} \big( |00\rangle + |11\rangle \big) $$

+

If I make a measurement on the first qubit and a zero is returned then this implies my state has collapsed into the eigenvector $|00\rangle$ and so the second qubit measurement will definitely returned a $|0\rangle$ as that the only possibility.

+

However, if you consider the another entangled state +$$ |\phi \rangle = \dfrac{1}{\sqrt{2}} \big( |01\rangle + |10\rangle \big) $$

+

then measuring the first qubit and receiving a $|0\rangle$ means the quantum state has collapsed onto the eigenstate $|01\rangle$, and so measuring the second qubit will now definitely returned a $|1\rangle$ as that the only possibility.

+
+

If you want to extract the quantum state after making measurement on the first qubit before measuring the second qubit in Qiskit, you can use the function get_statevector() in the Aer's statevector_simulator.

+

So for example, suppose I want to do this on the state $|\psi\rangle$ defined above, which can be implemented on the quantum circuit as

+
     ┌───┐     
+q_0: ┤ H ├──■──
+     └───┘┌─┴─┐
+q_1: ─────┤ X ├
+          └───┘
+
+

Now I can will make the measurement on the first qubit and extract out the state after the measurement:

+
from qiskit import Aer, execute, QuantumCircuit
+from qiskit.quantum_info import Statevector
+
+backend = Aer.get_backend("statevector_simulator")
+qc = QuantumCircuit(2, 2)
+qc.h(0)
+qc.cx(0,1)
+qc.measure([0], [0])
+print(qc)
+result = execute(qc, backend=backend, shots=1).result()
+print('State after first measurement:', result.get_statevector() )
+
+
     ┌───┐     ┌─┐
+q_0: ┤ H ├──■──┤M├
+     └───┘┌─┴─┐└╥┘
+q_1: ─────┤ X ├─╫─
+          └───┘ ║ 
+c: 2/═══════════╩═
+                0 
+State after first measurement: [1.+0.j 0.+0.j 0.+0.j 0.+0.j]
+
+",9858,,1859,,10/23/2020 18:57,10/23/2020 18:57,,,,0,,,,CC BY-SA 4.0 +14309,2,,14304,10/23/2020 17:30,,2,,"

For circuit equalities I find using quirk with the state-channel duality super useful where you setup the inverse of a circuit, see the identity in the amplitude display and then play around with the gates then on the left side.

+

In the given equality this is my thinking:

+
    +
  • I'm going to ignore the equivalent prefix of the two circuits

    +
  • +
  • this circuit is CNOT gates, that permute the subspaces and phaser gates (T / S are all just phasing the |1> subspace of the given qubit) - you can think about "commuting" the phase gates over the CNOT gates in two ways: 1) the CNOT control commutes 2) if you have the same CNOT even times then the CNOT permutations even out, so you'll have an equivalent circuit => this explains why the S gate can be commuted over to the end

    +
  • +
  • Now, if we ignore the phaser gates for a second, we get this circuit (see in quirk state-channel duality to play around with)

    +

    +

    And the question becomes why is this equivalent to

    +

    +
  • +
  • We can remove the identities, after which the question becomes: +Why is

    +

    +

    equivalent to

    +

    +
  • +
  • this last one can be understood by the CNOT mirroring rule (rule VI in this paper):

    +

    adding two CNOTs is an identity

    +

    +

    mirroring over the first CNOT results in adding the new CNOT

    +

    +

    after which we can just commute the CNOTs to their places

    +

    +
  • +
+

I'm sure there's simpler explanations :)

+",4986,,,,,10/23/2020 17:30,,,,0,,,,CC BY-SA 4.0 +14310,1,,,10/23/2020 18:50,,4,891,"

I am interested in executing multi-control gates and I have found two methods to do so as explained below.

+
    +
  1. The first is taken from Nielsen and Chuang (2010) from their Figure 4.10. This method requires an additional n-1 ancillary (or work as they call it) qubits along with $2(n-1)$ Toffoli gates and a single $CU$ gate where $n$ is the number of control qubits.
  2. +
+

.

+
    +
  1. The second method from Barenco et al. (1995) (on their page 17) uses a total of $2^{n}-1$ $V$ gates and $2^{n}-2$ CNOT gates where $n$ is the number of control qubits and $V^4=U$ in this example.
  2. +
+

+

It seems to me that the Nielsen method uses fewer gates but has the disadvantage of requiring additional ancillary qubits. So which of these methods is more efficient? Or, are there other method I should consider using? In case it helps, I am looking to use one of these methods on my qiskit circuit to be run on the actual quantum hardware.

+",13244,,,,,10/25/2020 14:09,Which method of executing a multi-control gate is more efficient?,,1,0,,,,CC BY-SA 4.0 +14311,2,,14310,10/23/2020 19:06,,4,,"

As many things in life, the answer is "it depends".

+

If you backend have support of Toffoli gates (that is, in Qiskit language, they are part of their basis gate set), then option 1 is better. If, like in most of the IBM backends at the moment, you only have CXs, then option 2 seems better. Let alone topology considerations like the coupling map.

+

If a method for decomposing a MCU is general enough, then it should be a task for the circuit compiler. The compiler should™ be smart enough for factor in all the elements (the target basis, the backend connectivity map, etc.) and give you the best decomposition (submit an issue if you think the compiler can do a better job). For example:

+
from qiskit import QuantumCircuit, transpile
+from qiskit.circuit.library.standard_gates import C3XGate
+qc = QuantumCircuit(4)
+qc.append(C3XGate(), [0, 1, 2, 3])
+print(qc)
+
+
q_0: ──■──
+       │  
+q_1: ──■──
+       │  
+q_2: ──■──
+     ┌─┴─┐
+q_3: ┤ X ├
+     └───┘
+
+

With optimization_level=3 should give you the best result, considering a ['u', 'cx'] basis:

+
transpiled = transpile(qc, basis_gates=['u', 'cx'], optimization_level=3)
+print('depth:', transpiled.depth())
+print('gates:', sum(transpiled.count_ops().values()))
+
+
depth: 35
+gates: 42
+
+

If you also add a coupling map:

+
transpiled = transpile(qc, basis_gates=['u', 'cx'], coupling_map=[[0,1], [1,2], [2,3]], optimization_level=3)
+print('depth:', transpiled.depth())
+print('gates:', sum(transpiled.count_ops().values()))
+
+
depth: 79
+gates: 127
+
+

If you have a concrete backend:

+
from qiskit import IBMQ
+
+IBMQ.load_account()
+provider = IBMQ.get_provider(hub='ibm-q')
+backend = provider.get_backend('ibmq_16_melbourne')
+transpiled = transpile(qc, backend=backend, optimization_level=3)
+print('depth:', transpiled.depth())
+print('gates:', sum(transpiled.count_ops().values()))
+
+
depth: 48
+gates: 68
+
+",1859,,1859,,10/25/2020 14:09,10/25/2020 14:09,,,,5,,,,CC BY-SA 4.0 +14313,2,,14304,10/23/2020 21:06,,2,,"

The two CNOTs that have gone missing have been moved rightward until they reach the CNOT between the two top qubits. They are then moved through that CNOT, which cancels one of them out. The remaining one was then moved to the right side of the circuit using the fact that its control can travel unmodified through phasing operations (S, T) and paired CNOTs.

+

+

That being said, the decomposition you've relayed is not optimal. Because the two Toffoli operations share a target and a control, they can be merged into one Toffoli operation. Here's what that looks like:

+

+

And this can be decomposed into a circuit using four T gates (instead of eight) by using an ancilla:

+

+",119,,119,,10/24/2020 0:35,10/24/2020 0:35,,,,2,,,,CC BY-SA 4.0 +14314,2,,5432,10/23/2020 23:33,,1,,"

$\newcommand{\bra}[1]{\left<#1\right|} +\newcommand{\ket}[1]{\left|#1\right>}$Consider the following linear operator:

+

$$ +U = \left[ +\begin{matrix} +a & 0 & 0 & 0 & 0 & 0 & 0 & c\\ +0 & 1 & 0 & 0 & 0 & 0 & 0 & 0\\ +0 & 0 & 1 & 0 & 0 & 0 & 0 & 0\\ +0 & 0 & 0 & 1 & 0 & 0 & 0 & 0\\ +0 & 0 & 0 & 0 & 1 & 0 & 0 & 0\\ +0 & 0 & 0 & 0 & 0 & 1 & 0 & 0\\ +0 & 0 & 0 & 0 & 0 & 0 & 1 & 0\\ +b & 0 & 0 & 0 & 0 & 0 & 0 & d\\ +\end{matrix} +\right] \tag{1}\label{1} +$$

+

This is a 2-level matrix, acting non-trivially only on states $\ket{000}$ and $\ket{111}$. You are asking to show that this can be decomposed into the following 3 steps:

+
    +
  • Step 1: Permute the computational basis states such that $\ket{000}$ becomes $\ket{011}$ but $\ket{111}$ remains $\ket{111}$.
  • +
  • Step 2: Apply a single qubit gate on the first qubit if the second and third qubits are 1.
  • +
  • Step 3: Undo step 1.
  • +
+

To prove that this is possible, we can write the unitary operator for each step, multiply them together and see that the result is equal to $U$.

+

Step 1: This can be given the following representation:

+

$$ +S = \underbrace{\ket{011}\bra{000} + \ket{000}\bra{001} + \ket{001}\bra{011}}_{\text{permutation of Gray codes}} + \\ ++ \underbrace{\ket{010}\bra{010} + \ket{100}\bra{100} + \ket{101}\bra{101} + \ket{110}\bra{110} + \ket{111}\bra{111}}_{\text{trivial action}}\tag{2}\label{2}$$

+

This is just a permutation of the computational basis states. Its main purpose is to ensure that $\ket{000}$ becomes $\ket{110}$ but $\ket{111}$ remains $\ket{111}$. There are also the transitions $\ket{001} \rightarrow \ket{000}$ and $\ket{011} \rightarrow \ket{001}$ which I think only serve the purpose of more efficient circuit design because they allow an implementation which uses only CNOT gates without any additional working qubits. This is explained in Nielsen & Chuang 10th edition on pages 192-193.

+

Step 2: We condition the single qubit gate's action on the second and third qubits being 1. There are only 2 states of this form: $\ket{011}$ and $\ket{111}$. Consider how a single qubit operation on the first qubit acts on these states:

+

$$ +\ket{011} \rightarrow \left(a\ket{0} + b\ket{1}\right)\ket{11} = a\ket{011} + b\ket{111}\\ +\ket{111} \rightarrow \left(c\ket{0} + d\ket{1}\right)\ket{11} = c\ket{011} + d\ket{111} \tag{3}\label{3} +$$

+

All other states are left alone. Now we can write the full action of this single qubit gate as:

+

$$ +\bar{U} = \underbrace{\left(a\ket{011} + b\ket{111}\right) \bra{011} + +\left(c\ket{011} + d\ket{111}\right) \bra{111}}_{\text{action of single qubit gate}} + \\ ++ \underbrace{\ket{000}\bra{000} + \ket{001}\bra{001} + \ket{010}\bra{010} + \ket{100}\bra{100} + \ket{101}\bra{101} + \ket{110}\bra{110}}_{\text{trivial action}} \tag{4}\label{4} +$$

+

Step 3: We just need to undo step 1., which means that we need to take the $S$ unitary's inverse, which is its Hermitian conjugate:

+

$$ +S^{\dagger} = \underbrace{\ket{000}\bra{011} + \ket{001}\bra{000} + \ket{011}\bra{001}}_{\text{undoing permutation of Gray codes}} + \\ ++ \underbrace{\ket{010}\bra{010} + \ket{100}\bra{100} + \ket{101}\bra{101} + \ket{110}\bra{110} + \ket{111}\bra{111}}_{\text{trivial action}}\tag{5}\label{5}$$

+

We want to show that $S^{\dagger}\bar{U}S=U$. Calculating $\bar{U}S$, we get:

+

$$ +\bar{U}S = \left(a\ket{011} + b\ket{111}\right) \bra{000} + +\left(c\ket{011} + d\ket{111}\right) \bra{111} + \\ ++ \ket{000}\bra{001} + \ket{001}\bra{011} + \ket{010}\bra{010} + \ket{100}\bra{100} + \ket{101}\bra{101} + \ket{110}\bra{110} \tag{6}\label{6} +$$

+

Left multiplying this by $S^{\dagger}$ yields:

+

$$ +S^{\dagger}\bar{U}S = \underbrace{a \ket{000}\bra{000} + b\ket{111}\bra{000} + c\ket{000}\bra{111} + d\ket{111}\bra{111}}_{\text{non-trivial action}} + \\ ++ \underbrace{\ket{001}\bra{001} + \ket{010}\bra{010} + \ket{011}\bra{011} + \ket{100}\bra{100} + \ket{101}\bra{101} + \ket{110}\bra{110}}_{\textrm{trivial action}} \tag{7}\label{7} +$$

+

Now compare \eqref{7} with \eqref{1}. By inspection we can see that they yield the same result for each computational basis states. In particular, $\ket{000} \rightarrow a\ket{000}+b\ket{111}$ and $\ket{111} \rightarrow c\ket{000}+d\ket{111}$. All other states are left alone. Therefore, \eqref{7} and \eqref{1} are equal.

+",12643,,12643,,10/23/2020 23:38,10/23/2020 23:38,,,,0,,,,CC BY-SA 4.0 +14315,1,14319,,10/24/2020 0:00,,2,47,"

On Wikipedia, the max-entropy for classical systems is defined as

+

$$H_{0}(A)_{\rho}=\log \operatorname{rank}\left(\rho_{A}\right)$$

+

The term max-entropy in quantum information is reserved for the following definition

+

$$H_{\max }(A)_{\rho}=2 \cdot \log \operatorname{tr}\left[\rho_{A}^{1 / 2}\right]$$

+

While these are just definitions, they go by the same name so is there a relationship between them?

+

What I know

+

The only thing I managed to prove was that $H_0(A)_\rho \geq H_{\max}(A)_\rho$. The proof is below. Let $\lambda_i$ be the eigenvalues of $\rho_A$ and $r$ be the rank of $\rho_A$. We have

+

\begin{align} +H_{\max}(A)_\rho &= 2\log(\lambda_1^{1/2} + .. + \lambda_n^{1/2})\\ +&\leq 2\log \left(\frac{1}{r^{1/2}}\cdot r\right)\\ +&=H_0 +\end{align}

+

Is there perhaps a reverse version of this inequality

+

$$H_{\max}(A)_\rho\geq H_0(A)_\rho + \text{something}$$

+

which would justify using the same name for both quantities?

+",4831,,55,,10/26/2020 8:38,10/26/2020 8:38,What is the relationship between these two definitions for the max-entropy?,,1,0,,,,CC BY-SA 4.0 +14316,2,,14303,10/24/2020 6:40,,1,,"
+

Is there a clear boundary between quantum coupling and quantum entanglement?

+
+

If two qubits (or more) are coupled, they can influence each other. This means that they are entangled.

+
+

If two quantum systems are coupled, do they need to be restricted to a certain distance?

+
+

Generally not, but increasing the distance increases probability that the system is influenced by external environment and the entanglement is disrupted. If you be able to perfectly isolate the system, the distance can be arbitrary.

+
+

Is there a difference between 'coupling the two qubits' and 'entangling' them using a Hadamard Gate?

+
+

Hadamard gate does not produce entangled state. It changes qubit in state $|0\rangle$ to $\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$ and state $|1\rangle$ to $\frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)$. This means that it creates equally distributed superposition of two states for one qubit, not the entanglement. Hadamard gate is also inverse gate to itself, i.e. $HH=I$, so if it is applied on qubit in state $\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$, a result is $|0\rangle$.

+
+

In Schrodinger's cat thought experiment, are we saying the cat and radioactive source are 'entangled' or 'coupled'?

+
+

See the answer to the first question.

+",9006,,,,,10/24/2020 6:40,,,,0,,,,CC BY-SA 4.0 +14317,2,,6639,10/24/2020 6:41,,2,,"

For quantum software, all you need is matrix multiplication, complex numbers and basic probability for the base model

+

By "base model" I mean: how a programmer views a quantum computer program, and how outputs are calculated given input.

+

If you know the above, you can understand the base model in one hour with any decent quantum getting started tutorial, many of which are freely available online.

+

I also tried to highlight that in my tutorial for example: https://cirosantilli.com/#programmer-s-model-of-quantum-computers

+

And you can confirm it by playing for an hour with a software simulator like Qiskit (which has many tutorials, see the official page) or even a toy graphical browser based one like Quirk (highly recommended).

+

Of course, then you will need to learn "as much maths and Physics as needed by your specific application".

+

But this will vary widely by application, and it is not even well defined since we don't know what the killer applications would be for sure yet, so I don't think it is fair to call that "quantum computing". Some of the simpler existing algorithms (arguably not killer apps) don't require basically anything extra.

+

A good place to look into is: https://quantumalgorithmzoo.org/ which summarizes known quantum algorithms.

+

It is also worth mentioning that any non theoretical ("proving things about an algorithm") advances will require simulating your algorithm, and at that point money would be needed for a powerful classic computer or a real research quantum computer. But I think it is fair to say that if you have reached that point where you can push the state of the art forward and need the simulation (a possible goal worth pursuing), then you can get a job with someone that is willing to spend that money.

+

For quantum hardware, you will need some theoretical Physics, and a lot of experimental Physics

+

I don't work in the field, so I'm not entirely sure about how much theory is needed.

+

Obviously, the basics of quantum mechanics are a must, but everything beyond that is much less clear, and likely to be highly dependent on the type of QC you are trying to make, e.g. one would expect that a superconducting and a photonic QC will require widely different understandings.

+

And then obviously, to understand things more precisely and be able to do any experiments yourself to advance the field, you would need a laboratory to do the experiments related to the type of computer you are trying to implement. This might be impossible outside of a PhD setting as you won't have the money to do the experiments otherwise.

+

It is however feasible to achieve a basic understanding of the physical principles of how a quantum computer hardware of a given type works with free resources, here are some I've found good:

+ +

I'm also maintaining a resource list at: https://cirosantilli.com/quantum-computing#quantum-computer-type

+

More precise and practical understanding of the implementations will increasingly enter a mixture of journal publications + intellectual property and trade secret territory however.

+

It is also interesting to go through the list of existing quantum hardware companies and try to read as much as possible about their tech, e.g.:

+
    +
  • on their website
  • +
  • papers by the scientific founders, usually from before starting the company
  • +
  • patents by people of the company
  • +
+

Quantum compilation

+

Quantum compilation means mapping some high level circuit description like a Qiskit into actual physical hardware.

+

I'm not sure what is necessary in that area besides understand the hardware.

+

Some people are excited about ZX calculus as a way to efficiently transform circuits. This might be useful to help map them efficiently to hardware.

+

Quantum error correction might need a bit more maths

+

Quantum error correction kind of lies in the middle of hardware and software, so maybe it is worth having a look at it separately. I consider it to be part of quantum compilation, and perhaps the most interesting part.

+

My wife who is a number theory PhD interested in quantum computing was telling me that there is some "relatively deep maths" needed for some of the proposed approaches, but I don't know the details.

+

But I doubt it comes come anywhere near "research level pure mathematics", and I'm pretty confident that it would be possible to understand the required mathematics without working full time on it.

+

There is perhaps one exception: cryptography. One of the major "applications" of quantum computers is to break pre-quantum cryptography. So people now have to come up with cryptography based on different mathematical problems that are not easily solvable by a quantum computer. For this you obviously need more advanced understanding of mathematics. See notably NIST's post-quantum cryptography competition: https://csrc.nist.gov/projects/post-quantum-cryptography

+

What should I study at university to maximize my changes of getting into quantum computing?

+

I would bet on focusing as much as possible on experimental physics areas that are used in the most promising quantum computer approaches:

+
    +
  • condensed matter (for superconducting)
  • +
  • optics
  • +
  • anything related to controlling states of individual atoms (which usually comes down to optics + semiconductors)
  • +
+

I recommend this over mathematics/computer science, because if you don't get into a lab in university then PhD, you will likely never again have that unique chance in your entire life.

+

So unless you are sure that you want to be an algorithm designer (nothing wrong with that), why not also try to keep the hardware side option open? Quantum computing is much more blocked on "we don't have enough qubits" rather than "we don't have enough ideas what to do with the qubits we have" as of 2020.

+

You can always learn algorithms much more easily later on, because the costs involved are much smaller generally: reading articles/books is basically free compared to the costs of running a lab.

+

It should be noted though that even the algorithm development might need some funding to run experiment simulations with larger qubit counts to validate their ideas.

+

Quantum computer benchmarks

+

One important area of research and development is the development of benchmarks that allow us to compare different quantum computers to decide which one is more powerful than the other.

+

Ideally, we would like to be able to have a single number that predicts which computer is more powerful than the other for a wide range of algorithms.

+

However, much like in CPU benchmarking, this is a very complex problem, since different algorithms might perform differently in different architectures, making it very hard to sum up the architecture's capabilities to a single number as we would like.

+

The only thing that is directly comparable across computers is how two machines perform for a single algorithm, but we want a single number that is representative of many algorithms.

+

For example, the number of qubits would be a simple naive choice of such performance predictor number. But it is very imprecise, since other factors are also very important:

+
    +
  • qubit error rate
  • +
  • coherence time, which determines the maximum circuit depth
  • +
  • qubit connectivity. Can you only connect to 4 neighbouring qubits in a 2D plane? Or to every other qubit equally as well?
  • +
+

Quantum volume is another less naive attempt at such metric.

+

Bibliography

+ +",4243,,4243,,7/13/2022 22:23,7/13/2022 22:23,,,,0,,,,CC BY-SA 4.0 +14318,1,14320,,10/24/2020 6:57,,1,485,"

I'm studying - well trudging through - Quantum Computing for Everyone by Bernhardt. Towards the bottom of the book's physical page 41 he states, "spins are given by either," and then shows an up state ket $|\uparrow\rangle$ and then a negative up state ket $-| \uparrow \rangle$. Nowhere did he mention a negative state ket and what it means. He then goes on to use the negative ket on page 42, but I'm lost.

+

I've looked on the Internet, but to no avail.

+

What does a negative ket $-| \uparrow \rangle$, or negative bra (if exists) for that matter, mean/represent within the introductory scope of Bernhardt's book?

+

Much appreciated.

+",13598,,55,,10/26/2020 8:36,10/26/2020 8:36,What does a negative ket state represent?,,1,0,,,,CC BY-SA 4.0 +14319,2,,14315,10/24/2020 7:21,,1,,"
+

The term max-entropy in quantum information is reserved for the following definition

+
+

No it's not, many papers like https://arxiv.org/abs/0803.2770 use the term to refer to the quantity $\log \mathrm{rank}(\rho)$. Your first definition comes from the Rényi entropy of order 0, while the second one comes from the Rényi entropy of order $\frac{1}{2}$, and you should always check which one the authors are referring to.

+",13507,,,,,10/24/2020 7:21,,,,0,,,,CC BY-SA 4.0 +14320,2,,14318,10/24/2020 12:37,,2,,"

At the beginning of $40$ page of the same book an arbitrary spin state is written as:

+

$$c_1| \uparrow \rangle + c_2|\downarrow \rangle$$

+

where $|c_1|^2 + |c_2|^2 = 1$, $c_1$ and $c_2$ are in general complex numbers, but how I understand from the parts of the book the author uses only real $c_1$ and $c_2$ here for some (maybe more pedagogical) reasons. There are infinite combinations of $c_1$ and $c_2$ that will produce different valid quantum states. Nevertheless, there exist some states that are not distinguishable experimentally because of the global phase ambiguity that is nicely explained in this answer.

+

At the $41$ and $42$ pages, the author shows an example of states that are not distinguishable. Both $| \uparrow \rangle$ ($c_1 = 1$ and $c_2 = 0$) and $-| \uparrow \rangle$ ($c_1 = -1$ and $c_2 = 0$) are valid quantum states that cannot be distinguished with some measurement procedure. There is no measurement procidure that will say if we have $| \uparrow \rangle$ or $-| \uparrow \rangle$. Moreover this two (equivalently valid) states are also not distinguishable (similar and more general example is shown in this answer (replace $|0\rangle \rightarrow |\uparrow\rangle$ and $|1\rangle \rightarrow |\downarrow\rangle$ in order to have the same notations):

+

$$|\psi_1 \rangle = c_1| \uparrow \rangle + c_2|\downarrow \rangle \qquad |\psi_2 \rangle = -(c_1| \uparrow \rangle + c_2|\downarrow \rangle)$$

+

A general statement: there is no experiment that will indicate what is the global phase of the state. Let me rephrase this a little bit for this special case (restricted to real numbers $c_1$ and $c_2$ discussed in the book): there is no experiment that will indicate if there is a minus sign before the state or not.

+

Also: ket vectors by definition of allowed values of $c_1$ and $c_2$ can have a minus sign before them and hence their coresponding bra vectors also will have a minus sign: $(\pm |\uparrow \rangle)^\dagger = \pm\langle \uparrow |$. In the vector representation:

+

$|\uparrow \rangle = \begin{pmatrix} 1 \\0 \end{pmatrix} \qquad -|\uparrow \rangle = \begin{pmatrix} -1 \\0 \end{pmatrix} \qquad \langle\uparrow | = \begin{pmatrix} 1 & 0 \end{pmatrix} \qquad -\langle \uparrow | = \begin{pmatrix} -1 & 0 \end{pmatrix}$

+",9459,,9459,,10/24/2020 13:06,10/24/2020 13:06,,,,0,,,,CC BY-SA 4.0 +14321,1,14322,,10/24/2020 16:29,,2,108,"

I am stuck with a question from the book Quantum theory by Asher Peres.

+

Excercise (9.11):

+
+

Three different preparation procedures of a spin 1/2 particle are represented by the vectors $\begin{pmatrix} +1 \\ +0 +\end{pmatrix}$ and $\frac{1}{2} \begin{pmatrix} +-1\\ +\pm \sqrt{3} +\end{pmatrix} $. If they are equally likely, the Shannon entropy is $\log{3}$, and the von Neumann entropy is $\log{2}$. Show that if there are $n$ such particles, all prepared in the same way, the von Neumann entropy asymptotically tends to $\log{3}$ when $n \to \infty$.

+
+
+

Hint: Consider three real unit vectors making equal angles: $\langle u_i,u_j \rangle = c $ if $ i \neq j$ . Show that the eigenvalues of $\sum u_i u_i^\dagger$ are 1-c, 1-c and 1+2c."

+
+

The Shannon entropy can be easily calculated to be $\log{3}$. The density matrix +$ +\hat\rho$ comes out to be +$$\begin{pmatrix} +\frac{1}{2} & 0\\ +0 & \frac{1}{2} +\end{pmatrix}. +$$ +Therefore, the von Neumann entropy also comes out to be $\log{2}$. However, in the second part, I am not able to get von Neumann entropy equal to $\log{3}$.

+",13602,,55,,10/26/2020 8:35,10/26/2020 8:35,von Neumann entropy in a limiting case,,1,0,,,,CC BY-SA 4.0 +14322,2,,14321,10/24/2020 19:11,,3,,"

Let us first prove the hint.

+

Consider three $d$- dimensional unit vectors $u_i$ and define $ A = \sum_{i=1}^{3} u_i u_i^{\dagger} $.

+

A simple calculation shows that +\begin{align*} +A \big(u_1 + u_2 + u_3\big) & = (u_1 + c\cdot u_2 + c\cdot u_3) + (c\cdot u_1 + u_2 + c\cdot u_3) + ( c\cdot u_1 + c\cdot u_2 + u_3) \\ +&= (1 + 2c) \cdot \big(u_1 + u_2 + u_3\big) +\end{align*} +meaning $ \xi = u_1 + u_2 + u_3 $ is an eigenvector of $ A $ with $ 1 + 2c $ eigenvalue.

+

A similar calculation shows that +$$ +A \big(u_1 - u_2\big) = (1 - c) \cdot \big(u_1 - u_2\big), \hspace{1.5em} +A \big(u_1 - u_3\big) = (1 - c) \cdot \big(u_1 - u_3\big) +$$ +Thus we have found 3-linear independent eigenvectors with eigenvalues $ 1-c, 1-c, 1+2c $. +The other $ d - 3 $ eigenvalues are, of course, zero with eigenvectors orthogonal to $ V = \text{span}\{u_1, u_2, u_3\} $.

+

This means that the Von-Neumann entropy of the density matrix $ \rho = \frac{1}{3} \sum_{i=1}^{3} u_i u_i^{\dagger} $ is +\begin{align*} +S_{\rho} = +&- 2 \cdot \frac{1 - c}{3} \cdot \text{log}\big( \frac{1 - c}{3} \big) +- \frac{1 + 2c}{3} \cdot \text{log}\big( \frac{1 + 2c}{3} \big) \\= +&- 2 \cdot \frac{1 - c}{3} \cdot \text{log}\big(1 - c\big) +- \frac{1 + 2c}{3} \cdot \text{log}\big(1 + 2c\big) + \text{log}(3) +\end{align*} +and so $ S_{\rho} \to \text{log}(3) $ if $ c \to 0 $.

+

Why is this enough?

+

Because for n particles the states are +$\begin{pmatrix} +1 \\ +0 +\end{pmatrix}^{\otimes n} $, $\frac{1}{2^n} \begin{pmatrix} +-1\\ +\pm \sqrt{3} +\end{pmatrix}^{\otimes n} $ +with dot product $ v_i^{\dagger} v_j = \big(-\frac{1}{2}\big)^n $ for $ i \neq j $, so $ c \to 0 $ as $ n \to \infty $

+",13109,,,,,10/24/2020 19:11,,,,0,,,,CC BY-SA 4.0 +14323,1,14342,,10/24/2020 19:27,,5,135,"

We often see that classically automorphism group of an error-correcting code plays a crucial role in many computational problems. Are there any important implications that depend on this in quantum case?

+

One I could find was this fault tolerant computing. In that case automorphism group for underlying codes to CSS codes are mainly considered.

+

I am looking for more such applications of automorphism groups of QECC. Also in the case of stabilizer codes, does the automorphisms group have any direct relation to its stabilizer group, and is there a standard definition of "automorphism group" of relavance?

+",8132,,8623,,10/26/2020 15:35,10/26/2020 16:40,Are there any implications of the automorphism group in QECC?,,1,1,,,,CC BY-SA 4.0 +14324,1,14325,,10/24/2020 20:04,,4,123,"

In chapter 1 of Quantum Computation and Quantum Information by Michael A. Nielsen & Isaac L. Chuang, I came across this paragraph on quantum teleportation,

+
+

Intuitively, things look pretty bad for Alice. She doesn’t know the state $\lvert\psi\rangle$ of the +qubit she has to send to Bob, and the laws of quantum mechanics prevent her from +determining the state when she only has a single copy of $\lvert\psi\rangle$ in her possession. What’s +worse, even if she did know the state $\lvert\psi\rangle$, describing it precisely takes an infinite amount +of classical information since $\lvert\psi\rangle$ takes values in a continuous space. So even if she did +know $\lvert\psi\rangle$, it would take forever for Alice to describe the state to Bob.

+
+

So Alice and Bob share a qubit each from an EPR pair created long ago and now Alice wishes to teleport the state $\lvert\psi\rangle$ to Bob by only sending classical information.

+

I do not understand why describing $\lvert\psi\rangle$ takes an infinite amount of classical information, since to my knowledge, only the amplitudes of the basis vectors need to be known($\lvert\psi\rangle=\alpha \lvert 0\rangle+\beta \lvert 1\rangle$). Maybe I did not understand properly what it means for Alice to know a state $\lvert\psi\rangle$. Any guidance would be helpful. Thank you.

+

PS: I'm not from a Quantum mechanics background.

+",13098,,55,,10/25/2020 3:54,10/25/2020 3:54,Why does describing a quantum state take an infinite amount of classical information?,,1,3,,10/27/2020 11:13,,CC BY-SA 4.0 +14325,2,,14324,10/24/2020 21:04,,2,,"

Amplitudes $\alpha$ and $\beta$ in the description of Alice's state are complex numbers; to describe them precisely, you're going to need infinite number of bits of information. If you're only using a finite number of bits, you get an approximation of the state, which can be a very good one but still not an exact representation.

+

(Why? There are uncountably many real numbers with absolute value less than 1, but only countably many finite strings of 1's and 0's that you could use to try and represent them.)

+",2879,,,,,10/24/2020 21:04,,,,3,,,,CC BY-SA 4.0 +14326,1,14328,,10/25/2020 4:44,,1,201,"

I'm trying to create the teleportation circuit in IBM Qiskit Circuit Composer.

+
OPENQASM 2.0;
+include "qelib1.inc";
+
+qreg q[3];
+creg a[3];   // should be crz
+creg b[4];   // should be crx
+
+h q[1];
+cx q[1],q[2];
+barrier q; //[0];
+
+cx q[0],q[1];
+h q[0];
+barrier q;
+
+measure q[0] -> a[0];
+measure q[1] -> b[0];
+barrier q;
+
+
+

This gives me the following circuit till the 3rd measurement barrier. How do I add CRX and CRZ gates - to obtain the circuit as shown in the picture? Also, how to change the names of the classical registers from a3, b4 to crz and crx?

+

+",12667,,55,,10/26/2020 8:19,10/26/2020 8:19,Composing teleportation circuit in Qiskit Circuit Composer,,1,0,,,,CC BY-SA 4.0 +14327,2,,9044,10/25/2020 5:41,,2,,"

Let's say, you've the Qiskit code for the circuit that you want to implement in Circuit Composer as shown below.

+
qr = QuantumRegister(3, name="q")
+crz, crx = ClassicalRegister(1, name="crz"), ClassicalRegister(1, name="crx")
+qc = QuantumCircuit(qr, crz, crx)
+
+qc.h(1) # Put qubit a into state |+>
+qc.cx(1,2) # CNOT with a as control and b as target
+
+
+

Then use print(qc.qasm()) to get the circuit equivalent, which is as follows

+
OPENQASM 2.0;
+include "qelib1.inc";
+
+qreg q[3];
+creg crz[1];
+creg crx[1];
+
+h q[1];
+cx q[1],q[2];
+
+

You can run this code in QASM / Circuit Composer.

+",12667,,,,,10/25/2020 5:41,,,,0,,,,CC BY-SA 4.0 +14328,2,,14326,10/25/2020 6:28,,2,,"

crx and crz are classical register. The gates CRX or CRZ mean that you apply the X gate on qubit 2 if the measurement on the classical register crx is a 1, that is if qubit 1 (q1) is in the $|1\rangle$ state; and you will apply the Z gate on qubit 2 if the classical register crz is 1.

+

This can be done in qiskit with c_if operation. You can see example of the teleportation code in Qiskit here: https://qiskit.org/textbook/ch-algorithms/teleportation.html

+
+
+

Anyway, if you want to use OPENQASM, then you can do it as follow:

+
OPENQASM 2.0;
+include "qelib1.inc";
+
+qreg q[3];
+creg crzz[3];   // since crz is already taken I use crzz instead
+creg crxx[4];   // Again I use crxx instead of crx
+
+h q[1];
+cx q[1],q[2];
+barrier q; //[0];
+
+cx q[0],q[1];
+h q[0];
+barrier q;
+
+measure q[0] -> crzz[0];
+measure q[1] -> crxx[0];
+barrier q;
+
+if(crzz==1) z q[2];
+if(crxx==1) x q[2]; 
+
+

Here is the image of the circuit when using Circuit_Composer option within IBMQ Experience environment.

+

+",9858,,,,,10/25/2020 6:28,,,,3,,,,CC BY-SA 4.0 +14329,1,14333,,10/25/2020 9:34,,2,80,"

In this circuit (link), q0 is Alice's qubit and q1, q2 are entangled qubits given to Alice and Bob respectively. After measuring q2 in this circuit, how can it be verified that the state of q0 and q2 are the same?

+

By default, q0 is in ground state, I assume. So, shouldn't q2 be also in the ground state if the state was teleported.

+

+",12667,,55,,10/26/2020 8:19,10/26/2020 8:19,How to verify teleportation was successful in this circuit?,,2,0,,,,CC BY-SA 4.0 +14330,2,,14329,10/25/2020 13:18,,1,,"

For a 3 qubit system, you might get results like 000, 010, 011 etc. but the leftmost bit of the readout will always be zero. This is how we know that the teleport has worked.

+",13081,,,,,10/25/2020 13:18,,,,0,,,,CC BY-SA 4.0 +14332,2,,14236,10/25/2020 13:33,,0,,"

Lines 22-25 are a bit strange. Why do you use i in both nested loops? Can you point out exactly where you see the error? is it in the oracle part only or in the whole program?

+",13288,,,,,10/25/2020 13:33,,,,0,,,,CC BY-SA 4.0 +14333,2,,14329,10/25/2020 18:07,,1,,"

First, note that the circuit construction using classical condition like you have is not executable on IBM hardware at the moment. Devices like Honewywell Trapped ion allows you to do such thing (I think). However, thanks to principle of deferred measurement, we can push the measurement all the way back to the end of the circuit. See here.

+

Essentially, your circuit becomes

+

+
+

The state of $q2$ will depends on the state of $q0$. If $q0$ starts in the state $|0\rangle$ then measurement in $q2$ will always (assume no noise) be 0. If instead I add the $X$ operation on $q0$ to turn it into the state $|1\rangle$ then measurement on $q2$ will registered a 1.

+

For example: if I initialize $q0$ to the state $|0\rangle$ then I will have

+

+
+
+
+

but if I initialize $q0$ to the state $|1\rangle$ then I will have

+

+",9858,,,,,10/25/2020 18:07,,,,0,,,,CC BY-SA 4.0 +14334,1,,,10/25/2020 19:13,,2,69,"

I am trying to implement the Mixer of the Max-Independent Set from The Quantum Alternating Operator Ansatz. +From this paper: https://arxiv.org/pdf/1709.03489.pdf in Chapter 4.2 page 15 to 17.

+

For every verice $v$ in the Graph this operator $H_{CX,v}$ is definded. ($nbhd(v)$ are all the neighbors of v) +\begin{align*} + H_{CX,v} &= X_{v} H_{NOR(x_{nbhd(v)})} \\ + &= 2^{-D_{v}}X_{v}\prod_{w \in nbhd(v)}(I + Z_{w})\\ +\end{align*}

+

Then the operators for all vertices are summed up. +Are there any rules how to sum up operators? +$$H_{CX} = \sum_{i = 0}^{n-1}H_{CX,v_{i}}$$

+

After that the exponential of the Matrix is calculated. +I have no clue how to do that. +$$U_{sim-CX}(\beta) = e^{-i\beta H_{CX}}$$

+

Should I maybe do a Hamiltonian-simulation or are there other ways for doing this?

+

Thanks for reading :)

+",11646,,,,,10/25/2020 19:13,How to implement the Mixer of Quantum Alternating Operator Ansatz for Max-Independent-Set,,0,5,,,,CC BY-SA 4.0 +14335,1,14373,,10/25/2020 21:56,,1,119,"

Using the Q# resource estimator, I found out that my program, meant to do graph coloring using Grover's algorithm, could be decomposed into ~500-1000*x T gates, where x in the number of iterations, often ranging between 5 and 10. This means I am considering thousands of T gates.

+

I am considering T gates because they can be a universal gate when paired with the Clifford group which is easy to simulate.

+

I am interested to know the average time it would take for a quantum computer (any type) to execute one of these T gates, time which I would then multiply to estimate the runtime of my program.

+

Thanks for reading !

+",8746,,55,,10/28/2020 11:01,10/28/2020 17:15,Average execution time for T gate,,1,7,,,,CC BY-SA 4.0 +14336,1,,,10/26/2020 0:15,,3,84,"

I had asked a question similar to this one here regarding how to handle the HSP for groups whose cyclic decomposition contains factors whose order is not a power of two. I also had some prior misunderstanding that I think I worked out. It was answered that one method for approximating the QFT over arbitrary cyclic groups is from Andrew Child's notes section 4.4 (also mentioned in more detail here section 3.4) .

+

Method 1: +To summarize the approach, this method utilizes the ability to prepare arbitrary uniform super-positions (i.e. algorithm used by Qiskit.initialize) and controlled phase-shifts to produce the operation:

+

$|x, 0\rangle \mapsto |x, y\rangle$, where $|y\rangle = QFT_{p^n}(|x\rangle).$ (1)

+

Then given the phase-estimation applied to the cyclic-shift operator, $U_{p^n}: |x\rangle \mapsto |x + 1 \rangle $, produces the operation $|0,y\rangle \mapsto |\tilde{\frac{x}{p^n}}, y\rangle$ (where $|y\rangle$ = $QFT_{p_n}(|x\rangle)$)). Multiplying the left register by $p^n$ produces:

+

$|0,y\rangle \mapsto |\tilde{x}, y\rangle$ (2)

+

and inverting this allows us to clear out the left +register containing $x$ in (1), and thus approximate $QFT_{p^n}$.

+

However, even in a simulator, with small examples like $p^n = 9$, the multiplication operation, with the required precision, seems to be infeasible (or just takes a really long time). I implemented this, and the algorithm I used for multiplication is the modular multiplication algorithm here

+

Method 2: +However, I found a possible alternative mentioned here (page 9), which states quote:

+
+

If we use $F^{−1}_{p^{m_j}}$we would determine $t_j$ [an element of the dual group/character] exactly,or we could use the simpler $F^{−1}_{2^{k}}$, for some $k >log_2(p^{m_j})$, and obtain $t_j$ with high probability [...] In practice we could use $F^{−1}_{2^{k}}$ for a large enough $k$ so that the probability of error is sufficiently small.

+
+

Thus it seems this is a similar approach to Shor's: apply $QFT_{2^k}$ for large enough $k$, and then apply continued fractions. However, Shor's is for the HSP in $\mathbb{Z}$. So I'm not sure how to properly apply this method to $\mathbb{Z}_{p^n}$; I just tried to use $QFT_{2^k}$, $p^{2n} < 2^k < 2p^{2n}$ like in Shor's, which didn't seem to work. There also seems to be no proof of its validity for $\mathbb{Z}_{p^n}$. The paper mentions it briefly, and there is no reference annotated. I also couldn't find this method referenced anywhere else.

+

So my questions are:

+
    +
  1. What is the correct way to apply 'method 2' (assuming my understanding of it is correct)?
  2. +
  3. Is there any known way to speed up the multiplication required for 'method 1'?
  4. +
+

If there is an entirely other way of going about this, please feel free to mention as well. +I'm trying to implement some small examples for learning purposes that are feasible on simulators.

+",8765,,,,,10/26/2020 0:15,Abelian Hidden Subgroup Problem for arbitrary cyclic p-Groups,,0,0,,,,CC BY-SA 4.0 +14337,1,,,10/26/2020 8:52,,0,137,"

When I use job.result().get_counts I am getting this result:

+
<bound method Result.get_counts of <qiskit.result.result.Result object at ...>>
+
+

but no counts at all. I have tested it both with a new job and with an old one and in both cases the counts are not shown.

+",8388,,55,,10/27/2020 9:08,10/27/2020 9:08,Cannot get the counts of a job in Qiskit with the usual command,,2,0,,,,CC BY-SA 4.0 +14338,2,,14337,10/26/2020 8:55,,2,,"

You are missing the () at the end of job.result().get_counts().

+",332,,1859,,10/27/2020 5:41,10/27/2020 5:41,,,,3,,,,CC BY-SA 4.0 +14339,2,,14337,10/26/2020 8:57,,1,,"

Always in Python you need to put brakcets whenever you call a function:

+
job.result().get_counts(<function parameters>)
+
+

The parameter is a circuit name or index. If you run a single circuit then it should be:

+
job.result().get_counts()
+
+",7659,,1859,,10/26/2020 18:31,10/26/2020 18:31,,,,0,,,,CC BY-SA 4.0 +14340,1,14341,,10/26/2020 12:00,,6,439,"

With reference to a similar question here, I would like to know what is the maximal number which has been factored with Shor's algorithm so far on actual quantum hardware.

+

The reason I am asking a similar question as the link is that this question is from 2018 and I would expect that some progress has taken place since that time, especially in light of introducing a 65 qubits processor by IBM.

+

I also saw some other techniques for factoring integers to primes but these are based on converting the factorization problem to QUBO instead of period finding as in the case of Shor's algorithm:

+ +

These algorithms are able to factor integers in an order of ten or a hundred thousand but according to my knowledge, Shor's algorithm has been demonstrated on very simple cases like factoring 15, 21, and 35.

+

I also found adapted Shor's algorithm described in An Experimental Study of Shor's Factoring Algorithm on IBM Q, which should provide better performance on processors with a limited (small) number of qubits. However, again only numbers 15, 21, and 35 were factored in.

+

I would appreciate it if anyone can me provide a link to the paper(s) discussing progress in Shor's algorithm implementation.

+",9006,,7429,,1/21/2021 17:59,1/21/2021 17:59,What is a maximal number factored by Shor's algorithm so far?,,1,0,,,,CC BY-SA 4.0 +14341,2,,14340,10/26/2020 15:11,,4,,"

For what it is worth, here is a paper by Craig Gidney on how to factor 2048 bit RSA integers in 8 hours using 20 million noisy qubits. +Hopefully others will be able to add more related papers.

+

Correct me if I am wrong but I don't think those other algorithms like the Variational Quantum Factoring actually offers any advantage over classical algorithms.

+",9858,,9858,,10/26/2020 15:18,10/26/2020 15:18,,,,1,,,,CC BY-SA 4.0 +14342,2,,14323,10/26/2020 15:29,,3,,"

In the case of stabilizer codes, one generally starts with the group, $\cal{G}$, of tensor products of basis vectors on $n$ qubits. On one qubit the applicable group is the Pauli Group, which is order 16, call it $\cal{G}_0$. So at the general level $\cal{G} = \bigotimes_{i=1}^n \cal{G}_0$. Simplifying assumptions are made in many treatments that make it difficult (for me at least) to pin down the exact discrete groups, and irreps of those groups, being invoked for different stabilizer code applications.

+

The stabilizer subgroup, $\cal{S} < \cal{G}$, is an Abelian subgroup of $\cal{G}$ that fixes the codespace, $\mathbf{T}$. Note that $\mathbf{T}$ doesn't necessarily have a group structure, so it's a subspace of $\cal{G}$. Since $\mathbf{T}$ is the space of vectors fixed by $\cal{S}$, the action of $\cal{S}$ on $\mathbf{T}$ is the trivial automorphism of $\mathbf{T}$ (i.e. the identity).

+

As indicated by the name, it's generally the structure of $\cal{S}$ and $\text{Aut}(\cal{S})$ that are most interesting and useful. $\text{Aut}(\cal{S})$ determines the set of valid fault-tolerant encoded operations, so codes with large $\text{Aut}(\cal{S})$ are desireable. Since $\cal{S}$ is Abelian there are no non-trivial inner automorphisms of $\cal{S}$, and $\text{Aut}({\cal{S}})=\text{Out}(\cal{S})$.

+

So at least in the general theory, the most interesting automorphisms are the trivial automorphisms of the codespace, which defines the stabilizer subgroup, and the outer automorphisms of the stabilizer subgroup, which enable fault tolerant operations. The best reference for all of this that I have found is Gottesman's Thesis, which reads like a textbook on the subject.

+

As a final note, conventional stabilizer QECC's are a special case of stabilizer operator QECC's. In the context of OQECC's gauge symmetries are exploited to make codes more efficient, so the normalizer of $\cal{S}$ plays an important role. The standard reference for OQECC from Poulin is also very helpful in understanding the group structure of conventional stabilizer codes.

+",8623,,8623,,10/26/2020 16:40,10/26/2020 16:40,,,,0,,,,CC BY-SA 4.0 +14343,1,14344,,10/26/2020 19:12,,2,290,"

I am trying to find the ground state of a Hamiltonian using VQE. I have decomposed the Hamiltonian into a set of Pauli strings. To decrease the number of actual measurements that has to be done, can I just measure the generators of this set of Pauli strings? For example, say if the set is $\{I, Z_1Z_2, Z_2Z_3, Z_1Z_3\}$, can I just measure $Z_1Z_2$, and $Z_2Z_3$, and then find the expectation value of $Z_1Z_3$ from the expectation values of $Z_1Z_2$ and $Z_2Z_3$?

+",12785,,,,,10/26/2020 21:17,Measuring Pauli strings using generators,,1,0,,,,CC BY-SA 4.0 +14344,2,,14343,10/26/2020 20:55,,4,,"

Here I am going to show why $\langle Z_1 Z_3 \rangle$ generally cannot be estimated from $\langle Z_1 Z_2 \rangle$ and $\langle Z_2 Z_3 \rangle$. Let's start with an arbitrary three-qubit state:

+

\begin{align*} +|\psi \rangle = c_{000} &|000\rangle + c_{001} |001\rangle + c_{010} |010\rangle + c_{011} |011\rangle + +\\ ++c_{100} &|100\rangle + c_{101} |101\rangle + c_{110} |110\rangle + c_{111} |111\rangle +\end{align*}

+

And because of this answer the expectation value for $Z_1 Z_2$, $Z_2 Z_3$ and $Z_1 Z_3$ (I am using this convention for qubit indexes $|q_1 q_2 q_3 \rangle$):

+

$$ +\langle Z_1 Z_2 \rangle = |c_{000}|^2 + |c_{001}|^2 - |c_{010}|^2 - |c_{011}|^2 - |c_{100}|^2 - |c_{101}|^2 + |c_{110}|^2 + |c_{111}|^2 +\\ +\langle Z_2 Z_3 \rangle = |c_{000}|^2 - |c_{001}|^2 - |c_{010}|^2 + |c_{011}|^2 + |c_{100}|^2 - |c_{101}|^2 - |c_{110}|^2 + |c_{111}|^2 +\\ +\langle Z_1 Z_3 \rangle = |c_{000}|^2 - |c_{001}|^2 + |c_{010}|^2 - |c_{011}|^2 - |c_{100}|^2 + |c_{101}|^2 - |c_{110}|^2 + |c_{111}|^2 +$$

+

From this expressions one can see that $\langle Z_1 Z_3 \rangle$ generally cannot be estimated from $\langle Z_1 Z_2 \rangle$ and $\langle Z_1 Z_3 \rangle$. For prove let's consider this conterexample when $|c_{000}| = |c_{010}|$, $|c_{001}| = |c_{011}|$:

+

\begin{equation*} +\langle Z_1 Z_2 \rangle = - |c_{100}|^2 - |c_{101}|^2 + |c_{110}|^2 + |c_{111}|^2 +\\ +\langle Z_2 Z_3 \rangle = |c_{100}|^2 - |c_{101}|^2 - |c_{110}|^2 + |c_{111}|^2 +\\ +\langle Z_1 Z_3 \rangle = 2|c_{000}|^2 - 2|c_{001}|^2 - |c_{100}|^2 + |c_{101}|^2 - |c_{110}|^2 + |c_{111}|^2 +\end{equation*}

+

So for the same $\langle Z_1 Z_2 \rangle$ and $\langle Z_2 Z_3 \rangle$ there can be many different possible values for $\langle Z_1 Z_3\rangle$ because by varying the values $|c_{000}| = |c_{010}|$ and $|c_{001}| = |c_{011}|$ the expectations $\langle Z_1 Z_2 \rangle$ and $\langle Z_2 Z_3 \rangle$ will not be changed but $\langle Z_1 Z_3 \rangle$ will be changed. So $\langle Z_1 Z_3 \rangle$ cannot be estimated from $\langle Z_1 Z_2 \rangle$ and $\langle Z_2 Z_3 \rangle$ in this conterexample.

+",9459,,9459,,10/26/2020 21:17,10/26/2020 21:17,,,,11,,,,CC BY-SA 4.0 +14345,1,14346,,10/26/2020 21:27,,4,177,"

I have the following gate (as represented by its matrix) on $4$ qubits which I hope to use in an error-detection code

+

$$M=\left( +\begin{array}{cccccccccccccccc} + 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ +\end{array} +\right)$$

+

Naively, it is possible to make this gate using the following configuration of generalized toffoli gates and $X$ gates:

+

+

However, this is already past what is feasible to do on current machines. My question is: Is there a better way to implement $M$ or has previous research been done to create gates whose matrix representations consist solely of $0$s and $1$s. This is not the only gate that I could implement that would serve my purposes (in fact, there are $(4!)^4=24^4=331176$ matrices that would work), but this is the 'simplest' one (simplest as in it presents the most symmetry).

+",9696,,55,,10/28/2020 9:13,10/29/2020 11:57,Creating a custom gate (given by a matrix) more efficiently,,2,1,,,,CC BY-SA 4.0 +14346,2,,14345,10/26/2020 22:19,,5,,"

If you look carefully, the circuit just flips the least significant qubit if the parity of the two most significant qubits is one. So, using qiskit:

+
from qiskit import QuantumCircuit
+from qiskit.quantum_info import Operator
+
+qc = QuantumCircuit(4)
+
+qc.cx(2, 0)
+qc.cx(3, 0)
+
+print(qc)
+U = Operator(qc).data
+print(U.real)
+---
+Output:
+     ┌───┐┌───┐
+q_0: ┤ X ├┤ X ├
+     └─┬─┘└─┬─┘
+q_1: ──┼────┼──
+       │    │  
+q_2: ──■────┼──
+            │  
+q_3: ───────■──
+               
+array([[1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
+       [0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
+       [0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0., 0.],
+       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.],
+       [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1.]])
+
+",13109,,,,,10/26/2020 22:19,,,,0,,,,CC BY-SA 4.0 +14348,1,14349,,10/27/2020 6:27,,1,253,"

Let's say I have a pair of states among three parties Alice(A), Bob(B) and Eve(E), $\rho_{ABE}$ and $\rho_{UUE}$ where the first two parties hold uniform values U.}

+

I know that the trace distance between them is upper bounded by some small quantity $\epsilon$. Like:

+

$$ +||\rho_{ABE} - \rho_{UUE} ||\le \epsilon . +$$ +Now, I take the partial trace on B's subsystem, leaving only operators $\rho_{AE}, \rho_{UE}$. What can I say about the trace distance of these two operators? Would the same bound be followed? I.e. is it the case that: +$$ +||\rho_{AE} - \rho_{UE} || \le \epsilon. +$$

+",2403,,,,,10/27/2020 8:49,Trace distance bound after partial trace,,1,2,,,,CC BY-SA 4.0 +14349,2,,14348,10/27/2020 8:49,,3,,"

Yes, the trace distance can only decrease under partial trace. One can see this via the variational characterization of the trace norm +$$ +\|\rho\|_1 = \max_{-I \leq M \leq I} \mathrm{Tr}[M\rho] +$$ +where $M$ is some hermitian operator satisfying the two operator inequalities $M \leq I$ and $M \geq - I$. This is sometimes also known as the duality between conjugate norms as $\| M \|_{\infty} \leq 1$.

+

Now if we have a bipartite system $AB$ we find +$$ +\begin{aligned} +\|\rho_{A} - \sigma_A\| &= \max_{-I_A \leq M_A \leq I_A} \mathrm{Tr}[M_A(\rho_A - \sigma_A)] \\ +&= \max_{-I_A \leq M_A \leq I_A} \mathrm{Tr}[(M_A \otimes I_B)(\rho_{AB} - \sigma_{AB})] \\ +&\leq \max_{-I_{AB} \leq M_{AB} \leq I_{AB}} \mathrm{Tr}[M_{AB}(\rho_{AB} - \sigma_{AB})] \\ +&= \| \rho_{AB} - \sigma_{AB} \|_{1}. +\end{aligned} +$$ +The second line follows from the identity $\mathrm{Tr}[\mathrm{Tr}_A[X_{AB}]] = \mathrm{Tr}[X_{AB}]$ and the third line from the fact that $-I_{AB} \leq M_{A} \otimes I_B \leq I_{AB}$ is satisfied for all $-I_A \leq M_A \leq I_A$.

+

Actually you can even prove a stronger result: the trace distance decreases under CPTP maps of which the partial trace is a special case.

+",9854,,,,,10/27/2020 8:49,,,,0,,,,CC BY-SA 4.0 +14350,1,,,10/27/2020 10:26,,4,353,"

For some context, I am trying to assess the capacity that certain two qubit gates have to create entanglement. To do this I am using the idea of "entangling power", where one takes their favorite entanglement measure and takes some distribution over all the possible input states averaging over them to find the resulting concurrence.

+

I want to take a uniform distribution over all my possible inputs which would mean taking a uniform distribution over the tensor product of two Bloch Spheres.

+

I'm struggling to understand how to do this.

+

I feel the approach should be somewhat similar to what one would need to do to solve this Exercise from Preskill's notes + +but the jump of sampling from one to two Bloch Spheres does not seem obvious or simple to me.

+

In this paper, a sample over one Bloch Sphere is taken also.

+

Any ideas of how I should approach this?

+",4373,,10480,,1/27/2021 18:51,1/27/2021 18:51,How to sample from the uniform distribution over the tensor product of two Bloch spheres?,,1,7,,,,CC BY-SA 4.0 +14351,1,,,10/27/2020 10:29,,7,129,"

Google's landmark result last year was to compute a task with a quantum computer that a classical computer could not compute, and they chose random circuit sampling. Part of their justification was complexity-theoretic reasons that, if one can efficiently compute this classically, it collapses the polynomial hierarchy (they cite 1,2,3 for this). Paper 2 in that list says that the hardness result comes from a reduction to computing the permanent of a random matrix.

+

Based on a quick search, computing an approximation to the permanent seems to be easy for many classes of random matrices. So is it possible there is some classical algorithm that could efficiently approximate the random circuit sampling problem?

+

Second, is the quantum computer solving this exactly or approximately? I'm not quite sure what that means to approximately sample (since sampling is inherently noisy anyway). That is: if I had a quantum computer that was (up to some noise) sampling from random circuits, and a classical computer efficiently approximating the same task, could you tell the difference?

+",4517,,,,,10/28/2020 14:50,Could random quantum circuits be efficiently approximately simulated?,,1,3,,,,CC BY-SA 4.0 +14352,2,,12261,10/27/2020 11:04,,1,,"

I have been doing some work on understanding the thermodynamics of quantum algorithms for my undergraduate thesis.

+

Where is the Heat coming from?

+

The first thing you want to think about is, where is the thermodynamics going to come into play? I am choosing to focus on entanglement. Firstly because it's a natural place to build off of from a Landauer's principle point of view and secondly because entanglement is at the heart of so many quantum algorithms.

+

A relationship between entanglement and thermodynamics was explored by Marcus Huber, Marti Perarnau-Llobet and others in this paper. Here, you will find two major results, the first a constraint on how much entanglement you can produce given some heat and the second how much thermodynamic work need one do to produce some entanglement.

+

How do you measure the entanglement of a Quantum Algorithm?

+

With this you'd think we're off to the races and we can quickly use their work to analyse your case with Shor but here is the rub.

+

It is very difficult to determine the amount of entanglement in an algorithm (in fact here's a question I asked about it a year ago) and this is where the majority of the work I'm currently doing lies. Looking for ways around this.

+

You can also take an algorithm independent approach to examining the thermodynamics like some lovely people from Google did here by looking at Quantum Channels in a general sense.

+

Whilst I know that wasn't a direct answer to your question, I hope it was still informative.

+",4373,,,,,10/27/2020 11:04,,,,0,,,,CC BY-SA 4.0 +14353,1,,,10/27/2020 12:25,,4,81,"

Let $T: M_n \to M_n$ be a quantum channel. If I understand Definition 13.5.1 of the book "Quantum information theory" of Wilde, the coherent information $Q(T)=\max_{\phi_{AA'}} I(A \rangle B)_\rho$ of $T$ is given by +\begin{equation} +Q(T) +=\sup_{\rho \textrm{ pure}} \Big\{H\big((\mathrm{tr} \otimes T)(\rho)\big)-H\big((\mathrm{Id} \otimes T)(\rho)\big)\Big\} +\end{equation} +where the supremum is taken over all bipartite pure states $\rho$ on $M_n \otimes M_n$.

+

It is true that we can replace the supremum by a supemum on all states (not necessarily pure) ?

+",13624,,55,,10/28/2020 9:14,10/28/2020 9:14,Alternative definition of the coherent information of a quantum channel,,1,4,,,,CC BY-SA 4.0 +14354,2,,14353,10/27/2020 17:18,,2,,"

I follow Wilde's notation here. The coherent information of a channel $N:A' \rightarrow B$ is given by

+

$$Q(N) \equiv \max_{\phi_{A A^{\prime}}} I(A\rangle B)_{\rho},$$

+

where $\rho_{AB}=N_{A^{\prime} \rightarrow B}\left(\phi_{A A^{\prime}}\right)$. Notice that the channel only acts on the $A'$ register. The $A$ register is used to purify the input to the channel.

+

So yes, you can consider mixed states on $\phi_{AA'}$ but then you can just purify this to some $\phi_{RAA'}$ and relabel the $RA$ register as $A$.

+

Finally, a side point but note that the coherent information is obtained by taking the maximum over all input pure states, not the supremum.

+",5669,,,,,10/27/2020 17:18,,,,2,,,,CC BY-SA 4.0 +14355,1,,,10/27/2020 18:27,,6,273,"

I'm trying to do something similar to this question, where I want to partially measure the system before getting the output. In particular, say I have 4 qubits. I want to measure two of them, and then get the state vector associated with the other two. I know that I can do this the following way:

+
    +
  1. Measure the 2 qubits.
  2. +
  3. Perform a partial trace on those two qubits (so that my output vector only has $2^2$ components instead of $2^4$).
  4. +
  5. Call the statevector function to get the state on my other 2 qubits.
  6. +
+

The problem is that I need to actually get the statevector in Step 2 before performing the partial trace. This means the system has to produce the statevector, taking up a lot of memory and limiting the number of qubits I can scale to.

+

My question is: Is there a way to collapse the wavefunction and then get the statevector out on only the remaining qubits without having the system calculate the whole statevector beforehand?

+

I don't know if this is a reasonable question, but I was wondering if it could be done.

+",1923,,,,,5/4/2022 19:02,Can I partially collapse the wavefunction in Qiskit?,,1,1,,,,CC BY-SA 4.0 +14356,1,,,10/27/2020 20:21,,5,283,"

From what I'm reading, building the constant-1 and constant-0 operations in a quantum computer involves building something like this, where there are two qubits being used. Why do we need two?

+

+

The bottom bit in both examples is not being used at all, so has no impact on the operation. Both operations seemingly only work if the top qubit's initial value is 0 so surely what this is just saying is that this is an operation which either flips a 0 or leaves it alone - in which case what is the second qubit needed for? Wouldn't a set-to-0 function set the input to 0 whatever it is and wouldn't need one of its inputs to be predetermined?

+

Granted, the 'output' qubit is for output, but it's value still needs to be predetermined going into the operation?

+

Image is from this blog but I've seen it come up in other blogs and videos.

+",13628,,55,,11/3/2020 16:47,4/2/2021 17:04,Why do the constant operations in a quantum computer need second qubits?,,1,2,,,,CC BY-SA 4.0 +14357,1,,,10/27/2020 23:51,,8,820,"

Shor's algorithm (for factoring integers) and Grover's algorithm (for searches) are the two most well-known quantum algorithms. I was wondering if there was a similar result in QC that dealt with the Graph Isomorphism problem?

+

I can't seem to find a consensus online. I've found two references:

+
    +
  • This paper published in the Physical Review gives an algorithm for graph isomorphism, but it seems as if the algorithm doesn't give any complexity bound. It seems to explain that doing so is hard in adiabatic QC (I'm not too familiar with this so I don't know if I'm understanding this right; would also appreciate if someone could clear this up for me).

    +
  • +
  • In this paper, the authors claim they have found a poly-time quantum algorithm for the problem, though there is no record of review and this paper remains unpublished. I wasn't sure if people had actually reviewed this and determined whether it was correct or not.

    +
  • +
+",13618,,55,,11/3/2020 16:50,2/10/2021 2:14,What is known about quantum algorithms for graph isomorphism?,,1,2,,,,CC BY-SA 4.0 +14358,1,14368,,10/28/2020 0:01,,3,486,"

Suppose $A\in L(X,Y)$. $||\cdot||$ denotes spectral norm and denotes the largest singular value of a matrix, i.e. the largest eigenvalue of $\sqrt{A^*A}$.

+

$||\cdot||_{tr}$ denotes trace norm. We have that +$$||A||_{tr}=tr\sqrt{A^*A}$$ +So I would like to prove the statement that +$$||A||_{tr}=\max\{|tr(A^*B)|: B\in L(X,Y), ||B||=1 \}$$

+

I know that from Nielsen and Chuang lemma 9.5 that

+

$$|tr(AU)|\le tr |A|$$ and equality is achieved by a unitary.

+

We have by definition that $|A|=\sqrt{A^*A}$. So $||A||_{tr}=tr|A|$.

+

I think my question is if $B$ is not a unitary but has norm 1, can we have that

+

$$|tr(AB)|> tr |A|\ge |tr(AU)|$$ for any unitary? And if yes, why the maximum is still achieved by a unitary?

+",13616,,55,,11/3/2020 17:10,11/3/2020 17:10,Prove that the trace norm is dual to the spectral norm,,2,2,,,,CC BY-SA 4.0 +14359,1,,,10/28/2020 2:50,,2,70,"

does Shannon meet Feynman?

+

Bits underlie classical information measurements in information theory, while qubits underlie quantum information measurements in, what I can only assume to be called, quantum information theory.

+

Information theory is a field attributed to Claude Shannon, who calculates bits as logarithmic probabilities, which are what I mean here by Shannon information.

+
    +
  1. Are Shannon information and what everyone here is calling "classical information" the same?
  2. +
  3. What is the analogue of Shannon's information theory for quantum information? I have more often heard the term "quantum theory of information", but not sure if this exactly corresponds to what I have in mind as to what "quantum information theory" would mean in the Shannon sense.
  4. +
  5. How does quantum information relate to, diverge from or reduce to Shannon information, which used log probabilities?
  6. +
+",9118,,55,,11/3/2020 17:11,11/3/2020 17:11,"Is ""classical information"" the same as ""Shannon information""?",,1,0,,,,CC BY-SA 4.0 +14360,1,14370,,10/28/2020 3:10,,3,96,"

1980s. John Wheeler at the University of Texas would tell his students, “Give an information theoretic derivation of quantum theory!” Information theoretic is an adjective for Claude Shannon's information theory, which used log probabilities to represent bits.

+

With this desperate call to make quantum theory relatable to information theory, or molded in its likeness, is the link between Shannon's information theory unnaturally linked to "quantum theory of information"? In other words, is the connection between them man-made (superficial) and quantitatively contrived? or are classical and quantum information naturally bonded?

+

What did Wheeler's career conclude about the connection between information theory and quantum theory (quantum information)? Was he able to derive it information theoretically, and what exactly is the derivation?

+",9118,,55,,10/28/2020 9:21,10/28/2020 15:41,"Wheeler's ""information theoretic"" derivation of quantum information",,1,0,,,,CC BY-SA 4.0 +14361,1,14365,,10/28/2020 4:07,,2,137,"

The quantum max-relative entropy between two states is defined as

+

$$D_{\max }(\rho \| \sigma):=\log \min \{\lambda: \rho \leq \lambda \sigma\},$$

+

where $\rho\leq \sigma$ should be read as $\sigma - \rho$ is positive semidefinite. In other words, $D_{\max}$ is the logarithm of the smallest positive real number that satisfies $\rho\leq\lambda\sigma$.

+

In classical information theory, the maximum entropy principle designates the Normal distribution as being the best choice distribution amongst other candidates because it maximizes Shannon entropy,

+

$$H(X) = -\int_{-\infty}^{\infty} f(x) \ln f(x) \enspace dx$$ +where $f(x)$ is a probability distribution of random variable $X$.

+

Can the first measure be extended to probability distributions, rather than binary states, to coincide with the second? How are quantum max-relative entropy and maximum entropy related, given that maximum entropy, in the classical sense, represents a highly disordered and unconcentrated state?

+",9118,,,,,10/29/2020 12:38,Relating quantum max-relative entropy to classical maximum entropy,,1,0,,,,CC BY-SA 4.0 +14362,1,,,10/28/2020 7:20,,2,159,"

I need to draw a quantum circuit in Clifford+T library and obtain automatically its transformation matrix. (I received a response to this part of my question before in the link: How can I obtain transformation matrix of a quantum circuit in the Qiskit?) and now I want to do this work as a parametric. For example, I want to define gate T as +$$ +\begin{pmatrix} +1 & 0 \\ +0 & w +\end{pmatrix} +$$ +where $w=\frac{(1+i)}{\sqrt{2}}$, and I want to obtain the transformation matrix of the circuit with parameter $w$ and not as numeric. How can I do this?

+",5217,,55,,10/28/2020 9:28,10/28/2020 9:28,How can I obtain a unitary matrix of quantum circuit with angles as parametric?,,1,0,,,,CC BY-SA 4.0 +14363,2,,14362,10/28/2020 7:43,,1,,"

As of Qiskit 0.23.0 that's not yet supported.

+

The reason is mainly that such a simulator would be very slow as we would have to use SymPy's matrix multiplication for symbolic expressions. This is not really feasible for more than 5 or 6 qubits -- depending on your machine specs. Also, the output can become a gigantic symbolic expression pretty quickly and therefore likely only of limited use.

+

That being said, you can of course write your own script for a symbolic simulator: all you have to do is replace matrix multiplications with SymPy multiplications. A good starting point could be the quantum_info.Operator that uses straightforward NumPy multiplications and could probably be generalized easily.

+",9800,,,,,10/28/2020 7:43,,,,1,,,,CC BY-SA 4.0 +14364,2,,14359,10/28/2020 8:24,,2,,"

I don't think there is a canonical "right" answer to this question as there is no universal formulation of the terminology, so let me try and pick apart a few of the things you mention, and how I understand their use within the field.

+

The term "bit" can mean a couple of slightly different things. It can refer to how data is actually stored. This is where the quantum analogue, the qubit, comes in. Bits can also be used to measure the amount of information in something. Essentially, this is a measure of "if I had to write down this information, how many bits would I need to store the data". However, here, there is no direct quantum analogue. If you have quantum data, the only way we can get information about it is to measure, at which point, the output is classical, i.e. bits. So the measure of information is still essentially the same - bits not qubits. (Perhaps another way of putting it is that information measures your "surprise" of getting a particular outcome, whether that's tossing a coin, rolling a die, or measuring a qubit.)

+
+

Are Shannon information and what everyone here is calling "classical information" the same

+
+

If they're talking about a specific calculation of the information, then yes. "classical information" might instead be referring to the broader theory. It depends on context.

+
+

How does quantum information relate to, diverge from or reduce to Shannon information, which used log probabilities?

+
+

What people are more often interested in are averaged quantities such as entropies, conditional entropies and mutual information. These have direct quantum analogues, calculated based on density matrices of qubits rather than classical probability distributions. The density matrix still represents a probability distribution but, rather than using a single fixed basis (i.e. the "0" and "1" of a bit), there's a continuous range of possibilities, which change the actual calculations a bit.

+
+

What is the analogue of Shannon's information theory for quantum information? I have more often heard the term "quantum theory of information", but not sure if this exactly corresponds to what I have in mind as to what "quantum information theory" would mean in the Shannon sense.

+
+

The term "quantum information theory" tends to get used in two different contexts. One is extremely broad, covering the whole field of quantum information processing, computing etc. The other is much more specific and really does refer to the study of these (quantum) entropies, channel capacities and the like.

+",1837,,,,,10/28/2020 8:24,,,,1,,,,CC BY-SA 4.0 +14365,2,,14361,10/28/2020 9:36,,3,,"

As far as I'm aware there isn't much of a meaningful connection. The corresponding entropy for $D_{\max}$ is the min-entropy (written $H_{\min}$ or $H_{\infty}$). It measures a sort of `worst case' uncertainty whereas the Shannon or von Neumann entropies measure an average uncertainty. To answer your first question: the quantum relative entropies or divergences are defined to be defined as generalizations of divergences from information theory, see the definitions of $D_{\infty}$ for continuous variables or discrete

+

Reply to comment

+

Relative entropies (also called divergences) are not entropies like the standard Shannon entropy. Notice that they take in two arguments $\rho$ and $\sigma$ as opposed to something like the Shannon entropy which only has a single probability distribution as an argument (or von Neumann entropy with quantum states).

+

However, you can define these `standard' entropies from the divergences. You can think of the divergences as being a generalization of entropy. For example, let's take two probability distributions $p$ and $q$. The Kullback-leibler divergence is defined (for discrete distributions) as +$$ +D(p\| q) = \sum_x p(x) \log\frac{p(x)}{q(x)}. +$$ +Now we can define the Shannon entropy in terms of this divergence by setting the second argument to be a uniform distribution. Doing so we get +$$ +\begin{aligned} +D(p\| U) &= \sum_x p(x) \log |X| p(x) \\ +&= \sum_x p(x) (\log p(x) + \log|X|) \\ +&= -H(X) +log|X|. +\end{aligned} +$$ +Rearranging we get $H(X) = \log|X| - D(p\| U)$. We can do a similar thing with the quantum version of the Kullback-leibler divergence to define the von Neumann entropy. Similarly, we can use $D_{\max}$ (quantum or classical) to define a min-entropy $H_{\min}$ (quantum or classical). To summarize the divergences (or relative entropies) are generalizations of standard entropies, from which the standard entropies can be recovered. Note the divergences are extremely useful, they can be used also to define conditional entropies and other things like the mutual information.

+

You can think of a divergence as measuring a distance between its two arguments (Note it is not a metric though). The max divergence is the largest of the divergences and thus gives an overly generous measure of the distance. It's corresponding 'standard' entropy $H_{\min}$ is the smallest of the `standard' entropies as it gives an overly generous measure of how much we know about the argument. To clarify, when I said above $H_{\min}$ gives a worst case uncertainty I was thinking from the perspective of cryptography where it is most commonly used. In cryptography you often want to measure the knowledge an adversary has about some secret and $H_{\min}$ returns the smallest uncertainty for the adversary. For security it's best to overestimate the knowledge of an eavesdropper.

+",9854,,9854,,10/29/2020 12:38,10/29/2020 12:38,,,,2,,,,CC BY-SA 4.0 +14366,2,,14358,10/28/2020 10:14,,3,,"

We still have $ \big| \langle B, A \rangle \big| = \big|\text{Tr}(AB^{\dagger}) \big| \leq \text{Tr}|A| $ for any operator $B$ with operator norm $ ||B|| \leq 1 $.

+

First observe that $ ||B|| \leq 1 $ implies that for any positive semi-definite operator $ Q = \sum_i \lambda_i |\psi_i \rangle\langle \psi_i| \in L(X, X) $: +$$ \text{Tr}(Q) = \sum_i \lambda_i \langle \psi_i|\psi_i \rangle \geq \sum_i \lambda_i \langle \psi_i|B^{\dagger}B|\psi_i \rangle = +\sum_i \lambda_i \text{Tr} \big( B|\psi_i \rangle \langle \psi_i|B^{\dagger} \big) = +\text{Tr}(B Q B^{\dagger}) $$

+

Now a similar proof to Nielsen and Chuang lemma 9.5 is possible: +$$ \text{Tr}(AB^{\dagger}) = \text{Tr}(V|A|B^{\dagger}) = +\text{Tr}(\big(V|A|^{1/2}\big) \big(|A|^{1/2} B^{\dagger}\big)) \leq \sqrt{\text{Tr}(|A|^{1/2} V^{\dagger} V |A|^{1/2}) \cdot \text{Tr}(B |A| B^{\dagger})} \leq +\sqrt{\text{Tr}|A| \cdot \text{Tr}|A|} = \text{Tr}|A| +$$

+

where we wrote $ A = V |A| $ for an isometry $ V \in L(X, Y) $ based on the SVD decomposition, the first inequality is the Cauchy–Schwarz and the second is our previous 'observation' with $ Q = |A| $.

+

Together with equality for $ B = V $ we have that +$$ max\{ \big| \langle B, A \rangle \big|, B\in L(X,Y), ||B|| \leq 1\} = \text{Tr}|A| $$

+",13109,,13109,,10/28/2020 11:18,10/28/2020 11:18,,,,1,,,,CC BY-SA 4.0 +14367,1,,,10/28/2020 13:40,,2,120,"

In QAOA, for the MaxCut problem, one tries to find a good ratio, as close to 1 as possible, of $\epsilon = \frac{C_{approx}}{C_{opt}}$, where $C_{approx}$ is the approximate value of the cost function for some configuration of spins and $C_{opt}$ is the optimum cost value for the given graph. I want to calculate $\epsilon$ for some random instances of the MaxCut problem (with small number of vertices) and test how good the algorithm behaves.

+

In order to do that though, I need the exact solution of a given instance. I was wondering what is the best way to calculate it? Do a brute force in the whole configuration space? Finally, is there any Python library that will help me with my problem of obtaining the optimum solution, given the graph?

+",12408,,,,,11/3/2020 7:27,Optimum Solution calculation for QAOA,,1,0,,,,CC BY-SA 4.0 +14368,2,,14358,10/28/2020 13:54,,5,,"

There are different ways to prove what you want to prove, including the solution tsgeorgios has suggested, but for the sake of gaining greater intuition I would suggest starting with the recognition that the trace norm of any matrix is equal to the sum of its singular values.

+

Once you have this, the inequality you are trying to prove follows pretty easily. In particular, consider a singular value decomposition +$$ +A = \sum_k s_k |\psi_k\rangle \langle \phi_k|. +$$ +For any choice of $B$ we have, by the triangle inequality and a simple property of the spectral norm, that +$$ +|\operatorname{Tr}(A^{\ast} B)| += \biggl| \sum_{k} s_k \langle \psi_k | B | \phi_k\rangle \biggr| \leq \sum_k s_k |\langle \psi_k | B | \phi_k\rangle| +\leq \sum_k s_k \|B\| = \| A \|_{\text{tr}} \| B \|. +$$

+",1764,,,,,10/28/2020 13:54,,,,3,,,,CC BY-SA 4.0 +14369,2,,14351,10/28/2020 14:24,,2,,"

I can't answer all your questions and I certainly am not an expert, but I have something to say about your first point. According to the first paper linked in my comment (by Aaronson and Chen), the hardness assumptions of BosonSampling hinges on the assumption that there is no $\text{BPP}^{\text{NP}}$ (this is BPP relative to an NP oracle) algorithm for estimating the permanent of an $n\times n$ matrix $A$ with entries from an $N(0,1)$ Gaussian distribution. Now, I am not an complexity theorist so I don't know how $\text{BPP}^{\text{NP}}$ relates to $\#\text{P}$ or $\text{NP}$ but anyways onto computing permanents.

+

So it turns out that if your matrix has arbitrary number of negative entries then it is even $\#\text{P}$ hard just to determined the sign of the permanent and this fact rules out multiplicative approximations. This is all according to https://arxiv.org/pdf/1711.09457.pdf in which they state that approximating the permanent is worst case $\#\text{P}$ hard. However, they note that the average case hardness (which is what I think your initial question is asking about) is still open, and in fact the authors give a quasipolynomial time algorithm for approximating the permanent for many types of matrices (including $A$). This result, as they remark goes against the belief that it is still $\#\text{P}$ hard to approximate the permanent of $A$ in the average case. In section 1.6.1 they discuss their result in the context of the BosonSampling hardness conjecture (conjecture 4) and other supremacy claims. So it seems that if one could find a polynomial algorithm for this approximation problem then the quantum supremacy argument may collapse.

+

It also appears that this quasipolynomial time algorithm for approximating permanents of matrices with entries distributed Gaussian $N(0,1)$ has been simplified/improved in https://arxiv.org/pdf/1911.11962.pdf. The authors of this work also show that if their algorithm can be improved from working on matrices with mean at least $1/poly(log(n))$ to mean at least $1/poly(n)$ then this would disprove the hardness conjecture needed for quantum supremacy.

+",11793,,11793,,10/28/2020 14:50,10/28/2020 14:50,,,,2,,,,CC BY-SA 4.0 +14370,2,,14360,10/28/2020 15:33,,3,,"

There is a natural and direct link between information theory and quantum theory in the Quantum Entropic Uncertainty Principle. This area of study stems from a conjecture made by one of Wheeler's PhD students, Hugh Everett III, in 1957 while working on his thesis, which introduced the formalism of MWI.

+

Everett's conjecture was proven in 1975. In the late 70's David Deutsch was a student at UT Austin with Wheeler, and met Everett when he came to give a seminar. In 1985 Deutsch published his landmark paper Quantum theory, the Church-Turing principle and the universal quantum computer. This paper introduced the quantum circuit model that we still use today, and it relies heavily on Everett's formulation of quantum mechanics (MWI).

+

It's a testament to Wheeler's foresight and pedagogy that he saw this as a productive direction to push his students. Whether one views it as natural or not, it was certainly highly productive. Wheeler was both brilliant and highly creative, and he was generally happy to socialize creative theories before he could rigorously support them. According to Feynman${}^\dagger$ (another of Wheeler's PhD students) one the critical insights that led to his path integral formulation resulted from Wheeler informing him of his conclusion that there was only a single electron in the universe.

+

${}^\dagger$ If you don't want to read the whole Nobel Lecture, search "Because, they are all the same electron!"

+",8623,,8623,,10/28/2020 15:41,10/28/2020 15:41,,,,0,,,,CC BY-SA 4.0 +14371,1,,,10/28/2020 16:03,,1,68,"

When I open my account on IBM Quantum Experience, I am shown 9 backends that are assigned to me. But when I open any of my circuits, I get the error that "This account has no backends assigned". This is a rather new problem, as I was able to access backends before but now I am unable to run my circuits anymore.

+",13637,,55,,11/3/2020 17:13,7/26/2022 23:03,No backends assigned to my Account,,1,3,,7/27/2022 21:14,,CC BY-SA 4.0 +14372,2,,14371,10/28/2020 16:58,,0,,"

+

This is my quantum experience screen for past hour. No matter which circuit I open, I get the same error and "Loading" where Run settings and backends should be.

+",13639,,,,,10/28/2020 16:58,,,,2,,,,CC BY-SA 4.0 +14373,2,,14335,10/28/2020 17:10,,2,,"

In the surface code there are two major costs to T gates: the spacetime cost and the reaction time cost.

+

The spacetime cost is due to the need to perform magic state distillation of a T state for each T gate, which takes hundreds of operations. A T gate factory producing a T state every hundred microseconds can easily monopolize a hundred thousand qubits. This isn't technically a limitation on the time of the computation, because you can just add more and more factories until the T gates are coming at any rate you want, but it represents a large cost that forces hard tradeoffs between more space usage and longer runtime. See https://arxiv.org/abs/1812.01238 and https://arxiv.org/abs/1905.06903. For scale:

+

+

The reaction time cost has to do with the fact that when you teleport through a T gate, you instead apply its inverse 50% of the time. You realize that it happened, but it still has to be fixed before the computation can properly progress. Ultimately this means that if you have a series of T gates to apply, you are limited by how fast you can figure out if you did T or inverse T and then correct it. In fact this is the only part of a quantum computation that isn't embarrassingly parallel. There is a technique where this time is minimized by preparing a wordline for each possible correction, and teleporting through the one that matters. With that technique the T depth of your circuit times your control system's reaction time is a lower bound on how fast the computation can finish. See https://arxiv.org/abs/1210.4626 and https://arxiv.org/abs/1905.08916.

+

+",119,,119,,10/28/2020 17:15,10/28/2020 17:15,,,,0,,,,CC BY-SA 4.0 +14375,1,14377,,10/28/2020 21:12,,2,229,"

I am attempting to intentionally add noise to my qiskit circuit by applying n-pairs of CNOT gates. The effect of this should be to yield the same result of my baseline (no pairs of CNOT gates applied) circuit with the addition of some noise. However, the result of my "noisy" circuit looks the same as my baseline even for large n. My best guess is that qiskit automatically removes unnecessary operations (like a pair of CNOTs) in an effort to reduce the number of gates. If this is true, then how can I add a series of gates which will keep the baseline circuit the same but will add gate noise?

+",13244,,55,,11/3/2020 17:20,11/3/2020 17:20,How to intentionally add noise to a Qiskit circuit?,,2,0,,,,CC BY-SA 4.0 +14377,2,,14375,10/28/2020 21:58,,1,,"

Yes, Qiskit's transpiler will optimize the circuit and remove redundant gates automatically. For normal operation this is desired behavior. However for cases like this where you don't want to transpiler to optimize the circuit for you and you want to send the circuit to the backend in a raw form (it will still fit it to the backend based on its constraints) you can use optimization_level=0 kwarg for transpile() and execute(). This disables all the optimization passes and will just run the transforms necessary to run on the device (basis gate transformation, layout, routing) For example, when using execute() it would be: qiskit.execute(circuit, backend, optimization_level=0)

+

If you want to experiment with the transpiler you can just call qiskit.transpile(circuit, backend) which will return a circuit that has been transformed so it is optimized and will be able to run on the backend. This gets internally called by execute() prior to sending a job to the backend so you can see what transforms are happening and tune things for your use case.

+

The documentation on transpiler covers how the transpiler works pretty well: https://qiskit.org/documentation/apidoc/transpiler.html and the tutorial https://qiskit.org/documentation/tutorials/circuits_advanced/4_transpiler_passes_and_passmanager.html has examples on how you can work with it.

+",5529,,,,,10/28/2020 21:58,,,,0,,,,CC BY-SA 4.0 +14378,2,,5311,10/28/2020 22:09,,2,,"

This is an interesting question. I was looking into optimize the number of samples needed in VQE as well.

+

We know that that the number of samples in VQE to get accuracy error of $\epsilon$ scales as $O(1/\epsilon^2)$. To be more precise, if

+

$$ H = \sum_{i=1}^N h_i P_i $$

+

where $P_i$ represent the pauli string then +$$\langle H \rangle = \sum_{i=1}^N h_i \langle P_i \rangle $$ +by linearity and +$$ Var[H] = \sum_{i=1}^N h_i^2 \langle \Delta P_i^2 \rangle \ \ \ \textrm{where} \ \ \ \langle \Delta P_i^2 \rangle = \langle P_i^2 - \langle P_i\rangle^2 \rangle $$ +So the error of $\langle H \rangle$ after taking $S$ samples is +$$ \epsilon^2 = \dfrac{Var[H]}{S} \leq \dfrac{N h}{S} \ \ \ \textrm{where} \ h = max\{|h_1|^2, |h_2|^2, \cdots, |h_N|^2 \} $$

+

So this is a problem since to get a chemical accuracy, especially for large system, we would probably need hundred of thousands of samples. Which give us a big overhead.

+

After looking around, I found this paper: Accelerated Variational Quantum Eigensolver

+

It claims to have up-to-exponential reduction on the number of samples required.

+

Maybe you already know about this but I thought to put this here anyway.

+",9858,,,,,10/28/2020 22:09,,,,0,,,,CC BY-SA 4.0 +14379,2,,14375,10/28/2020 22:21,,1,,"

I am assuming you are probably trying to do error mitigation using extrapolation technique giving in this paper: https://arxiv.org/abs/1801.03897

+

The other answer is great and perfectly fine.

+

I just want to add that, you could also use circuit barrier as a way to tell Qiskit not to optimize the consecutive CNOT gates.

+

For example:

+

+",9858,,,,,10/28/2020 22:21,,,,3,,,,CC BY-SA 4.0 +14380,1,,,10/28/2020 23:19,,2,166,"

When running the attached Bernstein-Vazirani gate on IBM Q, with 1024 shots on ibmq_16_melbourne, I receive the expected result of "00110" with 26.563% success. I notice that there is a lot of noise in the results and am curious about what the cause of this could be? Is there any way to reduce this noise in order to get a higher chance of success for my expected result?

+

+

+",13642,,55,,11/3/2020 17:20,11/3/2020 17:20,Bernstein-Vazirani Gate IBM Q Noise,,1,0,,,,CC BY-SA 4.0 +14381,2,,14380,10/29/2020 0:11,,2,,"

How many shots were you using? and on which device?

+

Theoretically, you only need one shot for this algorithm, but because current devices are noisy, hence the name NISQ (Noisy Intermediate-Scale Quantum), we need to do a lot more experiments here. The maximum number of shots on IBM's machine is 8192 so I would use that.

+

It is important to note that not all devices are the same. Some are more noisy than other.

+

One way to improve your result is through error mitigations. At a higher level, there are two places where errors can occur. The first place is through the gate operations when you run your algorithm, and the second is through the measurement process. You can mitigate the measurement error by creating $2^n$ eigenstates and measure them to create a calibration matrix $M$. In your case, it would be $2^5 = 32$ additional circuits to do this. Look here at this document for more detail and how to do it within Qiskit setting: https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html

+

Here is the code to do this for your circuit:

+
from qiskit import IBMQ , BasicAer, Aer, QuantumCircuit,  ClassicalRegister, QuantumRegister, execute
+from qiskit.compiler import transpile
+from qiskit.transpiler import PassManager
+from qiskit.aqua import QuantumInstance
+from qiskit.ignis.mitigation.measurement import complete_meas_cal, CompleteMeasFitter, MeasurementFilter
+from qiskit.visualization import plot_histogram
+
+provider = IBMQ.load_account()
+backend = provider.get_backend('ibmq_16_melbourne') 
+
+
+quantum_instance = QuantumInstance(backend, shots = 8192,
+                                   pass_manager = None, initial_layout = None, optimization_level = 3,
+                                   measurement_error_mitigation_cls = CompleteMeasFitter, cals_matrix_refresh_period = 0)
+
+qc = QuantumCircuit(6,6)
+qc.x(5)
+qc.barrier(range(6))
+for i in range(6):
+    qc.h(i)
+qc.barrier(range(6))
+qc.cx(2,5)
+qc.cx(1,5)
+qc.barrier(range(6))
+for i in range(6):
+    qc.h(i)
+qc.measure([0,1,2,3,4],[0,1,2,3,4])
+qc.draw('mpl', plot_barriers=False ) 
+Result = quantum_instance.execute(qc)
+counts = Result.get_counts(qc)
+print('This is the counts result of the simulation:' ,counts)
+plot_histogram(counts) 
+
+

Hope this help.

+",9858,,9858,,10/29/2020 0:38,10/29/2020 0:38,,,,2,,,,CC BY-SA 4.0 +14382,1,14384,,10/29/2020 0:16,,1,197,"

I have this state: +$$p |\text{GHZ}\rangle \langle \text{GHZ}| + (1-p)\rho$$ +And after creating this state I have this code lines:

+
state = p * GHZ+(1-p)* rho
+state = p * GHZ + (1 - p) * rho
+print(f"final state: \n {state}")
+print(cirq.sample_density_matrix(state, indices=[0, 1, 2], repetitions=10))
+
+

Now I want to measure this state. I know we have cirq.measure in Cirq But I don't know which kind of measurement is used by this function (and the last line is also doing measurement if I am not wrong??)

+
cirq.measure(a, b, c)
+
+

I have 3 questions

+
    +
  1. I want to use rotation matrix and measure my state. Do we have rotation matrix in Cirq. Can you please show me how can I measure my state with rotation matrix in Cirq?

    +
  2. +
  3. I want to choose x and Y randomly and I want to do measurement

    +
  4. +
  5. Which kind of measurement is used by Cirq.measure() and (cirq.sample_density_matrix(state, indices=[0, 1, 2], repetitions=10))

    +

    cirq.measure(a, b, c) +(cirq.sample_density_matrix(state, indices=[0, 1, 2], repetitions=10))

    +
  6. +
+

Best and thanks

+",13548,,55,,11/3/2020 17:13,11/3/2020 17:13,Cirq-Measuring a State with Rotation Matrix,,1,2,,,,CC BY-SA 4.0 +14383,1,,,10/29/2020 0:56,,2,44,"

Below is a question and an answer.

+
+

How does quantum information relate to, diverge from or reduce to +Shannon information, which used log probabilities?

+

What people are more often interested in are averaged quantities such +as entropies, conditional entropies and mutual information. These have +direct quantum analogues, calculated based on density matrices of +qubits rather than classical probability distributions. The density +matrix still represents a probability distribution but, rather than +using a single fixed basis (i.e. the "0" and "1" of a bit), there's a +continuous range of possibilities, which change the actual +calculations a bit.

+
+

Information theoretic measures are all based on log probabilities. What do log probabilities in classical information theory become in quantum information theory?

+

What are the quantum analogues of entropy, conditional entropy and mutual information? their formulas, and how are they computed from density matrices of qubits (rather than probability distributions)?

+",9118,,,,,10/29/2020 0:56,Quantum analogues of information theoretic measures: are log probabilities replaced with the density matrix?,,0,3,,,,CC BY-SA 4.0 +14384,2,,14382,10/29/2020 1:23,,1,,"
    +
  1. cirq.rx ry, rz exist for rotation around X, Y and Z axes on the Bloch sphere

    +
  2. +
  3. If you have to measure in non-computational bases, you will have to do the rotations yourself. In my answer to previous your question I wrote two versions: one with density matrices the other one with cirq.Circuit.

    +
      +
    • In case of the circuit model you can use circuit.append(cirq.rx(np.pi/3)(a)) for example before the measurement, where a is the first qubit.

      +
    • +
    • in case of the density matrix you'll have to calculate the tensored unitaries with cirq.kron and cirq.unitary and then multiply the density as usual: unitary @ density_matrix @ unitary.conj().T. For example:

      +
    • +
    +
      # this is rx(pi/3) ⊗ I ⊗ I - the first qubit gets rotated, the other
    +  # two remains the same
    +  u = cirq.kron(cirq.unitary(cirq.rx(np.pi/3)), np.eye(2), np.eye(2))
    +  # this applies the unitary evolution on the state density matrix 
    +  rotated_state = u @ state @ u.conj().T
    +
    +
    +
  4. +
  5. cirq.measure measures in the computational basis. cirq.sample_density_matrix samples in the computational basis repeatedly see reference docs - it simulates "preparing the state and measuring it" multiple times. If you want the state after the measurement then probably cirq.measure_density_matrix is better suited.

    +
  6. +
+",4986,,4986,,10/29/2020 4:11,10/29/2020 4:11,,,,11,,,,CC BY-SA 4.0 +14385,1,14390,,10/29/2020 3:29,,4,126,"

$U_{a,b}=\sum^{d-1}_{x=0}\omega^{bx}|x+a\rangle\langle x|$,$\omega=e^{\frac{2\pi i}{d}}$,$a,b\in\{0,1,2,...,d-1\}$ +Can someone please give me the pic of the quantum circuit?

+",13644,,55,,11/3/2020 17:16,11/3/2020 17:16,How to perform this $d$-dimensional unitary operation on IBM Q?,,1,2,,,,CC BY-SA 4.0 +14387,2,,14345,10/29/2020 11:57,,-1,,"

Wikipedia and the book Quantum Information and Quantum Computation have discussed the question of universal quantum gates, say, what kind of sets of small gates can compose any large gates. In both cases, they do not list all possible sets, but all listed sets contain some sort of phase gate, and so the imaginary number 'i' is always contained. So, I do not think just 0 and 1 are enough. +https://en.wikipedia.org/wiki/Quantum_logic_gate#Universal_quantum_gates

+",13647,,,,,10/29/2020 11:57,,,,0,,,,CC BY-SA 4.0 +14388,2,,9895,10/29/2020 12:09,,1,,"

+I think this is the quantum circuit that you want, first produce two pairs of Bell states, then undo the second pair coherently, and finally apply two CNOT two flip the last two qubits.

+",13647,,,,,10/29/2020 12:09,,,,0,,,,CC BY-SA 4.0 +14390,2,,14385,10/29/2020 14:39,,3,,"

Since we are talking about a unitary operation on qubits, i assume $ d = 2^n $ where $ n $ is the number of qubits.

+

We define the unitary operations +$ V_{a} = \sum_{x=0}^{d - 1} | x + a \rangle \langle x| $ +and +$ D_{b} = \sum_{x=0}^{d - 1} \omega_d^{bx} | x \rangle \langle x| $.

+

Notice that we can write $ U_{a, b} = V_a \cdot D_b $.

+

In the Fourier basis (see here) +we have $ QFT^{\dagger} \cdot V_a \cdot QFT = D_{-a} $ since for a basis state $ |x \rangle $ +\begin{align*} +V_a \cdot QFT \cdot |x \rangle &= V_a \cdot \frac{1}{\sqrt{d}} \sum_{k=0}^{d-1} \omega_d^{kx} |k \rangle \\ +& = \frac{1}{\sqrt{d}} \sum_{k=0}^{d-1} \omega_d^{kx} |k + a\rangle \\ +& = \frac{1}{\sqrt{d}} \sum_{k=0}^{d-1} \omega_d^{(k - a)x} |k \rangle \\ +& = \omega_d^{-ax} QFT \cdot |x \rangle +\end{align*} +and so $QFT^{\dagger} \cdot V_a \cdot QFT \cdot |x \rangle = D_{-a} \cdot |x \rangle $ which proves the previous identity.

+

We conclude that is enough to implement $ D_b $ and then $ U_{a, b} = QFT \cdot D_{-a} \cdot QFT^{\dagger} \cdot D_b $

+

But since $ \omega_d^{b x} = \omega_d^{b \sum_{k=0}^{n-1} x_k 2^k} = \prod_{k=0}^{n-1} \omega_d^{b 2^k x_k} $, it holds that

+

$$ D_b |x \rangle = +\omega_d^{b x} |x \rangle = +\Big( \prod_{k=0}^{n-1} \omega_d^{b 2^k x_k} \Big) |x_{n-1} .. x_1 \rangle = +\otimes_{k=0}^{n-1} \Big( \omega_d^{b 2^k x_k} |x_k \rangle \Big) = +\otimes_{k=0}^{n-1} P_k |x_k \rangle +$$

+

where $ P_k $ are the single qubit phase gates +$P_k = +\begin{bmatrix} +1 & 0 \\ +0 & e^{i\frac{2 \pi b \cdot 2^k}{d}} +\end{bmatrix}$

+

If you want to implement this in Qiskit, see +QFT +and +Phase Gate +and be careful with Qiskit convention that $q_0$ is the least significant qubit.

+

Here is the circuit for $ n = 3, a, b = 1 $ made in IBM Q: + +For different values of $a, b$ just multiply then angles of $ U1 $ gates in $ D_{-a}, D_b $ by $a, b$ accordingly.

+",13109,,13109,,10/29/2020 17:50,10/29/2020 17:50,,,,2,,,,CC BY-SA 4.0 +14391,1,14407,,10/29/2020 15:41,,5,197,"

This question is perhaps philosophical but it's been confusing me. Suppose Alice is teleporting some qubit state $|\phi\rangle$ to Bob via the quantum teleportation protocol. After Alice applies the operations necessary to her qubit and her half of the Bell pair, but before she sends that classical information over to Bob, by the no-communication theorem the state of Bob's pair should be the mixed state $1/2 (|0\rangle\langle0| + |1\rangle\langle1|)$. After she transmits her measurement outcome to Bob, however, it seems like Bob's state changes to some pure state, e.g. $|\phi\rangle$ if Alice happened to measure $00$. It's not important what exactly the state is, just that it seems to have changed from a mixed state to a pure state.

+

This seems to favor the thought that quantum states are not "really real" but measures of subjective (dis)information about a system. However that troubles me, because I've thought of quantum states as being literally real aspects of the universe. Perhaps the trouble is that we should not think of Bob's state by itself, since it is entangled -- but then that seems to lead us to a non-manifestly local description of quantum theory, which I also find bothersome. I guess I'd just like to know what do people make of this.

+",9168,,9118,,10/30/2020 20:21,10/30/2020 20:21,Quantum teleportation and the reality of quantum states,,4,0,,,,CC BY-SA 4.0 +14392,2,,14391,10/29/2020 16:26,,0,,"

Yes, you're right. That is why there is no commonly accepted interpretation of the quantum theory.

+

A simpler paradoxes, such as with Wigner's friend, also show that quantum state is not quite objective thing.

+",5870,,,,,10/29/2020 16:26,,,,1,,,,CC BY-SA 4.0 +14393,1,14406,,10/29/2020 19:37,,1,102,"

$\text{PreciseBQP}$ is defined as $\text{BQP}$ with inverse exponentially close completeness and soundness bounds (for a better definition, see Section 3.1 here, in the paper by Gharibian et al). Similarly, $\text{PreciseQMA}$ is $\text{QMA}$ with inverse exponentially close completeness and soundness gaps (for more details, see Remark 5 here, in the paper by Fefferman and Lin). It is known that +\begin{equation} +\text{PreciseBQP} = \text{PP}, \\ +\text{PreciseQMA} = \text{PSPACE}. +\end{equation}

+

For more details, see Figure 1 here (paper by Deshpande et al). However, it seems obvious to me that +\begin{equation} +\text{PreciseQMA} \subseteq \text{PreciseBQP}. +\end{equation} +This is because one can simply replace the quantum witness given by the prover by the maximally mixed state, similar to the trick in Theorem 3.6 here, in the Marriott. We take an inverse exponential hit in the completeness and soundness bounds, but since the completeness and soundness bounds are inverse exponentially close in $\text{PreciseBQP}$, to begin with, we do not care.

+

However, if this is true, then it implies $\text{PP} = \text{PSPACE}$.

+

What am I missing?

+",1351,,1351,,10/30/2020 5:19,10/30/2020 10:34,PreciseQMA = PreciseBQP gives PP = PSPACE,,1,0,,,,CC BY-SA 4.0 +14394,2,,14391,10/29/2020 22:39,,0,,"

The ontology of pure states is tricky, but if you believe in pure states then mixed states are fairly straightforward, I think.

+

Teleportation of a third qubit seems unnecessary in this thought experiment. The same issue arises if Alice and Bob hold halves of a Bell pair and Alice sends an email to Bob stating the outcome of a measurement she performed on her half. The rest of this answer is about that simpler experiment.

+

The no-communication theorem means that if Bob is sure that he'll never have access to Alice's qubit again, then he can assume without loss of predictive power that she has already measured and discarded it, and the wavefunction has collapsed to some pure $|\phi\rangle$, but he doesn't know which.

+

His knowledge can then be represented by a classical Bayesian probability distribution over possible values of $\phi$. This needn't be a uniform distribution—maybe he knows that Alice prefers to measure in the Hadamard basis—but at the very least, unless he thinks that Alice has the power of postselection or might have rigged the qubit creation process, he should believe that $|0\rangle$ and $|1\rangle$ are equally likely, $|-\rangle$ and $|+\rangle$ are equally likely, etc. In that case Bob's beliefs about likely measurement axes have no effect on his prediction of the outcome of any experiment on his qubit. You can conclude this from the no-communication theorem again or by directly calculating the outcomes of measurements on all axes.

+

A mixed state is just a compact way of representing this "classical knowledge about a pure state modulo distinguishability via experiments on the state". It's updated in light of new information in the same way as an ordinary probability distribution because it's just a representation of an aspect of that distribution.

+

A mixed state can't replace the full probability distribution for all purposes, only for the purpose of answering questions about experiments on the state. For example, if someone offers to bet Bob that Alice will measure in the Hadamard basis, whether he should take that bet depends on his beliefs about Alice's basis preferences, and the density matrix doesn't contain that information. If Alice sends an email saying she measured her qubit and the result was $1$, but she doesn't say what gates she applied to it first, then Bob's beliefs about the results of experiments on his qubit after getting the email might be represented by a state like $0.9|+\rangle\langle+|\,+\,0.1|-\rangle\langle-|$. This can't be calculated from the mixed state derived from his beliefs prior to getting the email; you have to update his full set of beliefs and calculate a new mixed state from that.

+",3030,,,,,10/29/2020 22:39,,,,0,,,,CC BY-SA 4.0 +14395,1,,,10/29/2020 23:56,,4,494,"

I'm having a problem in IBM Qiskit with my qubit identities switching places during transpilation. I've been told by developers on the Qiskit slack server that there's currently no built-in way to fix this problem. I'm wondering if anyone has found one themselves.

+

The issue is that I'd like to perform an algorithm like so:

+
    +
  1. Prepare in an initial state
  2. +
  3. Apply a circuit U repeatedly n_iter times
  4. +
  5. Measure
  6. +
+

I also want this algorithm to:

+
    +
  • Be reasonably efficient with gates (specifically noisy CNOTs)
  • +
  • Have the same error for U for each iteration of it
  • +
+

This turns out to be a headche. When U is complicated, it becomes difficult for the transpiler to efficiently decompose it to native gates. This difficulty goes up for U*U and U*U*U since they're longer. So if I were to transpile the whole algorithm at once (with many U's), it certainly won't give an efficient gate decomposition, and won't have the same error for each iteration of U.

+

The solution I thought would be reasonable is to transpile U on its own, then compose it with itself. But this hits a problem. The transpiler likes to switch qubit identities (and add global phase, and maybe more?) while searching for a more efficient circuit. So if I follow my algorithm as stated above, U will not line up correctly with the prep or measurement, and my results will be wrong.

+

I've been told by developers on the slack that there's currently no built-in way to fix this. The transpiler does not report a final_layout of the qubits.

+

I've been trying to determine the final_layout by hand by comparing the transpiler output to my intended circuit plus swap gates (up to a global phase), but I'm even failing at this.

+

Does anyone have either working code to determine the final_layout, or a better approach to implementing this algorithm?

+

EDIT: Code and more info is included in my partial answer below

+

EDIT 2: See further clarification here: Qubit identities get swapped in IBM Qiskit +(This issue is remarkably difficult to communicate clearly)

+",8385,,8385,,10/10/2022 23:45,10/10/2022 23:45,How to repeat circuit efficiently and reliably in IBM Qiskit?,,2,8,,,,CC BY-SA 4.0 +14396,1,14398,,10/30/2020 0:04,,5,748,"

When testing my quantum programs, I wonder how many shots I must take to get a specific accuracy.

+

Are there any papers that you can recommend that analyze this?

+",11646,,9118,,11/5/2020 0:41,11/16/2020 9:59,How many shots should one take to get a reliable estimate in a quantum program?,,2,0,,,,CC BY-SA 4.0 +14397,1,14409,,10/30/2020 0:50,,2,842,"

I am trying to use the statevector_gpu simulation method in Qiskit Aer (see this page). I installed qiskit-aer-gpu according to the instructions on this page. It was working last week and then stopped working. I'm not sure what changed. (It's a shared computer.) I get the error message qiskit.providers.aer.aererror.AerError: "Invalid simulation method statevector_gpu. Available methods are: ['automatic', 'statevector']".

+

Thanks in advance for the help!

+

Here is the relevant system information:

+
    +
  • It is a shared computer running Ubuntu 18.04.4 LTS.
  • +
  • I have qiskit 0.23.0, qiskit-aer 0.7.0, qiskit-aer-gpu 0.7.0 installed in an environment in conda 4.8.5 with python 3.8.5.
  • +
  • nvcc --version gives Cuda compilation tools, release 10.0, V10.0.130
  • +
  • nvidia-smi shows 4 GPUs available and indicates CUDA Version: 10.2.
  • +
+",13653,,55,,11/4/2020 7:47,11/4/2020 7:47,"Qiskit ""statevector_gpu"" method not available",,1,0,,,,CC BY-SA 4.0 +14398,2,,14396,10/30/2020 3:03,,5,,"

This is depends on what algorithm you are executing.

+

For example, if you look at the Bernstein-Vazirani algorithm then theoretically the number of shot you need is 1 if you have a perfect quantum computer. This is because the end result that you are looking for collapsed onto a single eigenstate. However, because of noise, we would like to do more. In term of how many more, this is depends on the device. Not all device have the same noise level. You can, actually, look at the gate fidelity on the machines (at least you can do that for IBM's machines) and work out the probability that your circuit will fail, then from there determine the number of shots you might want to use. However, without doing that analysis, then you can just be on the safe side by using the maximum number of shots giving to you. For IBM's machines this works out to be 8192 shots. However, you can run multiple jobs to collect the statistics if you think you need more shots than this. Now, of course, if your quantum circuit is too long, the errors will built up so much that your circuit will "essentially" guarantee to fails, then additional shots will not help.

+

The above discussion is for quantum algorithms that only need $O(1)$ shots/samples. This is not true for algorithm like VQE. For VQE, we need to do $O(1/\epsilon^2)$ shots to achieve error of $\epsilon$. For chemical accuracy, which is for $\epsilon = 10^{-3}$, you would need to do ~$10^6$ shots at each iteration... which is insane!

+

Now if you just create a random circuit, which output a state that could be in super-position of $2^n$ eigenbasis then you will need $O(2^n)$ shots to able to able to extract the output probabilities. This why, designing a quantum algorithm is like an art. Therefore, You can't just do some operations on a quantum computers, and claim that because you did it on a quantum computer, it must be faster than doing it classically. You do not have access to the state of the qubits! This is also the reason why you can't just perform Quantum Fourier Transform ( essentially doing Discrete Fourier Transform on a quantum computer) and claim that you have a speed-up. Although, QFT does give you an exponential speed-up over DFT or even FFT (Fast Fourier Transform), doing it randomly will output a generic quantum state that in superposition of $2^n$ eigenbasis... Extracting out this state would take exponential amount of samples which then defeat the entire purpose.

+",9858,,,,,10/30/2020 3:03,,,,4,,,,CC BY-SA 4.0 +14399,2,,14396,10/30/2020 7:03,,0,,"

One way of this estimation is to analyze how many states will be there. Suppose there will be $N$ states and the shots are $N$, then the average observation of each should be 1, which is easy to forget some states, while if you change to $N^2$ shots the risk is decreased.

+

For $N$ states, if you take $n$ shots, the probability that a state has not been detected is $n \choose 1$=$(\frac{1}{N})^n$, where degeneracy is ignored.

+

Another way is rather interesting, I think the shots number only influence the running time slightly. Here comes my observation:

+

+

The first case is to search the number 24 from the range [0,31], the second case is to search number 64 from the range [0,127], the last one is printed on the figure (in my code, the number of qubits needed is 3*len(bin(24/64/128)[2:]), three times of the binary length).

+

According to this observation, I think the time-consuming part of computing is to get the state vector, and the role this 'shot' variable plays is to generate output based on the state vector. So, if you just want to save the running time of your script, maybe you do not need to change the number of shots.

+

NOTICE that this test is not sophisticated, loopholes maybe continue hidden.

+",13647,,13647,,11/16/2020 9:59,11/16/2020 9:59,,,,2,,,,CC BY-SA 4.0 +14400,1,14402,,10/30/2020 7:05,,1,416,"

While I'm studying state vector and density matrix. I wonder how to write qubit state as density matrix. qubit state can be represented with state vector form. But how about density matrix?

+",10028,,55,,11/4/2020 7:45,11/4/2020 7:45,How to represent the state vector form of a qubit in density matrix representation?,,2,0,,11/6/2020 12:12,,CC BY-SA 4.0 +14401,2,,14400,10/30/2020 7:54,,3,,"

If we have a pure state:

+

$$|\psi\rangle = \alpha |0 \rangle + \beta |1\rangle$$

+

The corresponding density matrix:

+

$$\rho = |\psi \rangle \langle \psi| = (\alpha |0 \rangle + \beta |1\rangle)(\alpha^* \langle 0 | + \beta^* \langle 1|) = \\= |\alpha|^2|0 \rangle \langle 0| + \alpha \beta^*|0 \rangle \langle 1| + \alpha^* \beta|1 \rangle \langle 0|+ |\beta|^2 |1 \rangle \langle 1| = +\begin{pmatrix} +|\alpha|^2 & \alpha \beta^* \\ +\alpha^* \beta & |\beta|^2 +\end{pmatrix}$$

+

If the state is not pure and we have $p_1$ probability of haveing $\psi_1$ state and with $p_2$ probability of having $\psi_2$ state (and this can be extended to $n$ cases: $p_n$ probability of $\psi_n$ state):

+

$$\rho = p_1 |\psi_1 \rangle \langle \psi_1| + p_2 |\psi_2 \rangle \langle \psi_2| = p_1 +\begin{pmatrix} +|\alpha_1|^2 & \alpha_1 \beta_1^* \\ +\alpha_1^* \beta_1 & |\beta_1|^2 +\end{pmatrix} + p_2 +\begin{pmatrix} +|\alpha_2|^2 & \alpha_2 \beta_2^* \\ +\alpha_2^* \beta_2 & |\beta_2|^2 \end{pmatrix} = +\\ +=\begin{pmatrix} +p_1|\alpha_1|^2 + p_2|\alpha_2|^2 & p_1 \alpha_1 \beta_1^* + p_2 \alpha_2 \beta_2^* \\ +p_1 \alpha_1^* \beta_1 + p_2 \alpha_2^* \beta_2 & p_1|\beta_1|^2 + p_2 |\beta_2|^2 +\end{pmatrix}$$

+",9459,,,,,10/30/2020 7:54,,,,0,,,,CC BY-SA 4.0 +14402,2,,14400,10/30/2020 7:54,,2,,"

A qubit state $|\psi\rangle \in \mathbb{C}^{2^n} \ \ \textrm{for} \ \ n\in\mathbb{N}$ can be represented as a density operator/matrix as $\rho = | \psi \rangle \langle \psi |$.

+

For example: If $|\psi \rangle = |1\rangle$ then $\rho = |\psi \rangle \langle \psi | = \begin{pmatrix} 0 \\ 1 \end{pmatrix} \begin{pmatrix} 0 & 1 \end{pmatrix} = \begin{pmatrix} 0 & 0\\ 0 & 1 \end{pmatrix} $ is the density matrix representation of $|\psi \rangle$.

+

Thus, density matrix representation offers a general way of expressing a quantum state. As you can see, a pure state $|\psi \rangle$ can always be converted into a density matrix representation where the matrix is of rank 1. That is density matrix generalize the idea of state vector. In fact, the pure states (state vectors) are just the extreme points of the state space. In term of 1 qubit, you can think that the 1 qubit state vector $|\psi \rangle = \alpha | 0 \rangle + \beta |1 \rangle $ are just the states on the surface of the Blochsphere. The states inside the Blochsphere are known as mixed states.

+

To go even deeper, states are positive linear functional of unit norm.

+",9858,,,,,10/30/2020 7:54,,,,0,,,,CC BY-SA 4.0 +14403,2,,14391,10/30/2020 8:18,,1,,"

Remember that mixed states can be a subjective description of a quantum state. In a teleportation operation, where Alice has made the measurement, but Bob has not yet received the measurement result, then Alice and Bob have different information, and therefore they have different descriptions. Alice knows exactly the state that Bob holds. Bob has no idea, and describes the state by the maximally mixed state.

+

When Bob learns the same thing as Alice, the new information he has updates his best description of the state so that it is the same as Alice's description.

+

This is no different to the classical world. Imagine a game where there are two doors. Behind one door, Alice places an amazing prize. The game contestant, Bob, gets to pick a door. Since Bob does not know which door the prize is behind, he assigns his subjective probability distribution: it's 50:50. But there's still an objective reality in the background of exactly which door the prize is behind in this particular run of the game.

+

Now, to complicate matters, density matrices can be doing other things as well. In particular if the global state is entangled, then the reduced density matrix is the best possible description anyone can give. It's an objective description (but it is still missing something that you can only capture by describing the entangled state).

+",1837,,,,,10/30/2020 8:18,,,,1,,,,CC BY-SA 4.0 +14404,1,14405,,10/30/2020 8:24,,2,262,"

I'm making a quantum circuit with qubits and quantum gates. While I'm doing it, I have some problem with it. My calculation process is below. +

+

As you can see, start qubit is $|0 \rangle$ and after 'X' gate, the result will be $|1 \rangle$. And I checked if the result of quantum circuit and density matrix form of $|1 \rangle$ are different. As you can see, they are different.

+

Here are my questions.

+
    +
  1. Why it occurs?
  2. +
  3. If they are different, is my calculation wrong?
  4. +
+",10028,,9118,,10/31/2020 7:27,10/31/2020 7:27,Computation of qubits with quantum gates using density matrix form,,1,0,,,,CC BY-SA 4.0 +14405,2,,14404,10/30/2020 8:30,,5,,"

When you evolve a pure state under the action of a gate $U$, it evolves from +$$ +|\psi\rangle\rightarrow U|\psi\rangle. +$$ +However, a density matrix such as $\rho=|\psi\rangle\langle\psi|$ evolves differently. You must calculate +$$ +\rho\rightarrow U\rho U^\dagger. +$$ +So, in this case, you must calculate +$$ +\left(\begin{array}{cc} 0 & 1 \\ 1 & 0 \end{array}\right)\left(\begin{array}{cc} 1 & 0 \\ 0 & 0 \end{array}\right)\left(\begin{array}{cc} 0 & 1 \\ 1 & 0 \end{array}\right)=\left(\begin{array}{cc} 0 & 0 \\ 0 & 1 \end{array}\right). +$$

+",1837,,,,,10/30/2020 8:30,,,,5,,,,CC BY-SA 4.0 +14406,2,,14393,10/30/2020 10:34,,3,,"

I guess a similar argument used

+
    +
  • in $\big[$ Marriot, Watrous $\big] $ [1] +to prove QMA$_{log}$ $\subseteq$ BQP
  • +
+

and

+
    +
  • in $\big[$ Fefferman, Lin $\big]$ [2] +to prove QMA$_{exp}$ $\subseteq$ PSPACE
  • +
+

does not carry over since for L $\in $ QMA$_{exp}$ = PreciseQMA you get

+
    +
  • $ x \in $ L $ \implies \text{tr}[Q_x] \geq c $
  • +
  • $ x \notin $ L $ \implies \text{tr}[Q_x] \leq 2^m s $
  • +
+

for $ c - s = \frac{1}{exp} $ and so using the totally mixed state $2^{-m} \mathbb{I}_m $ you accept with probability $ \text{tr}[2^{-m} Q_x] $ but does not yield any meaningful bound.

+

Both papers essentially apply an amplification procedure before the argument.

+",13109,,,,,10/30/2020 10:34,,,,0,,,,CC BY-SA 4.0 +14407,2,,14391,10/30/2020 10:40,,2,,"

The state of Bob's pair is not $1/2 (|0\rangle\langle0| + |1\rangle\langle1|)$. This is only his reduced density matrix. By definition, it is a representation of the locally accessible information Bob has. It's perfectly natural that it will change when Bob gets some nonlocal information from Alice.

+

The question remains, however, what is Bob's state. The standard answer is that there is no such thing; an entangled state can only be described as a whole. Since what Bob has is a part of an entangled state, we cannot assign a state to him alone. As you notice, this is rather unsatisfactory, as it makes quantum mechanics seem rather nonlocal, even though it is perfectly local in the operational sense.

+

There is, however, a solution: the Deutsch-Hayden model was designed to represent quantum mechanics (and quantum teleportation specifically) in a completely local way. It can assign "really real" states even to parts of entangled systems, and these states are local in the sense that they don't change with respect to what other parties do. The core idea behind it is that Bob's state doesn't encode only the locally accessible information, like the reduced density matrix, but also its correlations with the rest of the entangled system.

+

In quantum teleportation specifically, Bob's state doesn't change to $|\phi\rangle$ when he learns that Alice's measurement result is 00. Instead, $|\phi\rangle$ becomes locally accessible information for Bob when he can make measurements on his part of the entangled system together with Alice's measurement result (which is just another physical system).

+

The Deutsch-Hayden paper uses rather archaic notation, I find this review more intelligible. Appendix A specifically.

+",12541,,,,,10/30/2020 10:40,,,,1,,,,CC BY-SA 4.0 +14408,1,,,10/30/2020 10:44,,2,215,"

According to its tag description, a density matrix is the quantum-mechanical analogue to a phase-space probability measure (probability distribution of position and momentum) in classical statistical mechanics.

+

How can I reconcile the concept and intuition behind a "probability distribution based on both position and momentum" found in statistical mechanics, with that of a matrix ensemble of 1's and 0's found in the quantum density matrix?

+",9118,,9118,,11/4/2020 10:20,11/4/2020 10:20,What is the relation between density matrices and phase-space probability distributions?,,0,11,,,,CC BY-SA 4.0 +14409,2,,14397,10/30/2020 10:57,,3,,"

The qiskit-aer and qiskit-aer-gpu are mutually exclusive packages. They contain the same code except that the qiskit-aer-gpu package built with CUDA support enabled. If you install both packages at the same time the contents of the 2 packages will interfere with each other. I would recommend creating a new conda environment and installing qiskit-terra and qiskit-aer-gpu manually with pip install -U qiskit-terra qiskit-aer-gpu (and add qiskit-ignis, qiskit-aqua, and qiskit-ibmq-provider if they're needed). If you still have issues with only qiskit-aer-gpu installed in the environment please file an issue at https://github.com/Qiskit/qiskit-aer/issues and we can work on debugging it there.

+",5529,,,,,10/30/2020 10:57,,,,1,,,,CC BY-SA 4.0 +14411,1,14414,,10/30/2020 16:29,,2,78,"

The max-relative entropy between two states is defined as $D_{\max}(\rho\|\sigma) = \log\lambda$, where $\lambda$ is the smallest real number that satisfies $\rho\leq \lambda\sigma$, where $A\leq B$ is used to denote that $B-A$ is positive semidefinite.

+

An alternative way to express the max relative entropy is

+

$$D_{\max}(\rho\|\sigma) = \|\sigma^{-1/2}\rho\sigma^{-1/2}\|_{\infty},$$

+

where $\|\cdot\|_\infty$ is the operator norm which essentially picks out the largest eigenvalue. I see that the essential idea is

+

\begin{align} +\rho &\leq \lambda\sigma \\ +\sigma^{-1/2}\rho\sigma^{-1/2}&\leq \lambda I +\end{align}

+

Choosing the smallest possible $\lambda$ results in equality and hence one recovers $D_{\max}(\rho\|\sigma)$ this way.

+
+

I assumed that $\sigma^{-1}$ here is obtained by

+
    +
  1. Diagonalizing $\sigma$
  2. +
  3. Taking the reciprocal of all nonzero eigenvalues and leaving zero eigenvalues as they are
  4. +
  5. Undiagonalizing $\sigma$ again.
  6. +
+

However, this doesn't make sense because to me because when the support of $\rho$ is bigger than the support of $\sigma$, $D_{\max}(\rho\|\sigma) = \infty$. However, it looks like $\|\sigma^{-1/2}\rho\sigma^{1/2}\|_\infty$ can never be infinity.

+

So how does one obtain $\sigma^{-1}$?

+",4831,,55,,7/6/2021 7:18,7/6/2021 7:18,When can the max relative entropy be written as $D_{\max}(\rho\|\sigma) = \|\sigma^{-1/2}\rho\sigma^{-1/2}\|_{\infty}$?,,1,2,,,,CC BY-SA 4.0 +14412,2,,14395,10/30/2020 18:21,,1,,"

I found a partial answer that I'll share to clarify what the problem is, and provide a hacky fix.

+

I finally realized that transpiling a circuit piece (without a measurement) doesn’t seem to execute the circuit on a permuted version of the qubits like I thought, but rather it ends up executing the circuit and then a permutation at the end. Comparing to what happens when measurements are present, it seems like transpile assumes measurements are present even if they aren’t. It then allows the measurement step to “absorb” some cnots in the form of swap gates, just swapping which measurement maps to what. This is smart when measurements are present, but when they aren’t it causes the circuit to just swap qubits at the end of the circuit, incorrectly.

+

I also found a strange partial fix for this: It seems that if I add swaps that undo the error then transpile a second time, the second transpile won’t wrongly delete the swaps. Unsure why this works.

+

EDIT: Here is code demonstrating the problem:

+
qc_foo = QuantumCircuit(n_q, n_q)
+qubit_list = [0,1,2]
+qc_foo.swap(0,1)
+qc_foo.swap(0,2)
+qc_foo.barrier()
+qc_foo.measure(qubit_list, qubit_list)
+qc_foo_trans = transpile(qc_foo, backend=sant, optimization_level=3)
+qc_foo_trans.draw()
+
+

Notice the transpiled circuit has turned the 0-2 swap into a 1-2 swap (or something similar for your random seed), absorbing the difference into the measurement. Now comment out the measurement step and re-run. The 0-2 still becomes a 1-2, despite the lack of measurement, making the transpiled circuit incorrect.

+

A developer has also confirmed for me that this is likely a bug. I reported it through their system early 2021 but have not heard anything.

+",8385,,8385,,12/22/2021 0:16,12/22/2021 0:16,,,,0,,,,CC BY-SA 4.0 +14413,2,,14112,10/30/2020 18:39,,1,,"

To answer your first question, QAOA is an application of a hybrid classical-quantum algorithm, so using a classical optimizer is a perfectly valid solution here. I would suggest using e.g. scipy.optimize any other of your favorite optimization tools.

+

Your second question is regarding measuring the energy of the quantum state. +Indeed, Q# does not allow inspection of the quantum state, because as you noted this is not possible on physical hardware either.

+

However, there are some ways to retrieve this info.

+

In an experiment on real hardware, what you would do is simply measure all qubits over and over again, let's say N times, which gives you a list of N bitstrings. If N is large this will give you a reliable probability distribution of all the qubit states. In simulation this can be done by measuring all the qubits in the qubit register in a for-loop, and counting the occurrences of each possible iteration. This should be straightforward to implement but I will suggest a solution below that uses existing library functionality which you might find helpful.

+

Instead of measuring the results of each qubit, we're going to implement a handy operation that lets us measure the probability of each valid state and the probability of obtaining an invalid state.

+

First of all, as explained in the blog post, there are the probabilities to get one of 3 valid states, and there's the probability of getting an invalid state:

+
// Allowed states
+let state1 = [One, One, One, One, Zero, Zero];
+let state2 = [Zero, One, Zero, One, One, One];
+let state3 = [One, Zero, One, Zero, One, One];
+let states = [state1, state2, state3];
+mutable result = new Double[Length(states) + 1];
+
+

We'll keep track of the probability of getting an invalid state as the results come in by subtracting these values from 1.0.

+
mutable otherProb = 1.0; // Probability of any invalid state
+
+

So what we'll do is loop over all valid states, and then measure the probability of each, and return them and the probability of getting any invalid state in an array result.

+
for ((index, state) in Enumerated(states)) {
+    let prob = MeasureProbabilityForState(state, numSegments, weights, couplings, timeX, timeZ, numMeasurements);
+    set result w/= index <- prob;
+    set otherProb -= prob;
+}
+
+set result w/= Length(states) <- otherProb;
+
+

The energy, or cost that we want to minimize, can then be calculated by multiplying the probabilities by the cost of each state.

+

(Obviously for this example this is a bit silly, as we can simply calculate the cost of each of the above allowed states and then pick the lowest value. However, in other quantum applications the space of valid states could for example be much larger, and in that case we would only need to evaluate the cost function for the states that have a nonzero probability.)

+

So, how to implement MeasureProbabilityForState?

+

We can use the operation EstimateFrequency for this. This operation measures the probability of getting a Zero result for given state prep and measurement operations. +See docs here: +https://docs.microsoft.com/en-us/qsharp/api/qsharp/microsoft.quantum.characterization.estimatefrequency.

+

The implementation can look something like this:

+
    operation MeasureProbabilityForState(
+        state : Result[],
+        numSegments: Int, 
+        weights : Double[], 
+        couplings : Double[], 
+        timeX : Double[], 
+        timeZ : Double[],
+        numMeasurements: Int
+    ) : Double {
+        return EstimateFrequency(
+            ApplyQAOA(_, numSegments, weights, couplings, timeX, timeZ), 
+            MeasureRegisterIsInState(_, state),
+            numSegments, 
+            numMeasurements
+        );
+    }
+
+

where we have to check if the register is in the desired state and return Zero if it is:

+
    operation MeasureRegisterIsInState(register : Qubit[], state : Result[]) : Result {
+        let result = MultiM(register);
+        if (All<(Result, Result)>(EqualR, Zipped(result, state))) {
+            return Zero;
+        } else {
+            return One;
+        }
+    }
+
+

and

+
    operation ApplyQAOA(
+            x: Qubit[],
+            numSegments: Int, 
+            weights : Double[], 
+            couplings : Double[], 
+            timeX : Double[], 
+            timeZ : Double[]
+        ) : Unit {
+        ApplyToEach(H, x); // prepare the uniform distribution
+        for ((tz, tx) in Zipped(timeZ, timeX))
+        {
+            ApplyInstanceHamiltonian(numSegments, tz, weights, couplings, x); // do Exp(-i H_C tz)
+            ApplyDriverHamiltonian(tx, x); // do Exp(-i H_0 tx)
+        }
+    }
+
+

This is just one way of using EstimateFrequency to solve this problem; I hope this example helps you figure out the best way that works for your quantum application.

+",13663,,13663,,10/30/2020 21:20,10/30/2020 21:20,,,,2,,,,CC BY-SA 4.0 +14414,2,,14411,10/30/2020 18:40,,2,,"

There is a problem in the derivation you presented, since $\rho \leq \lambda \sigma$ is only equivalent to $\sigma^{-1/2} \rho \sigma^{-1/2} \leq \lambda I$ when $\sigma$ is invertible (or at least when $\mathrm{supp}(\rho) \subset \mathrm{supp}(\sigma)$, so that you can restrict the space to $\mathrm{supp}(\sigma)$ instead of the whole Hilbert space). The property is not true otherwise: consider e.g. $|+\rangle\langle+| \leq \lambda |0\rangle\langle 0|$ as a counterexample.

+

All in all, only when the condition $\mathrm{supp}(\rho) \subset \mathrm{supp}(\sigma)$ is satisfied can we conclude that $D_{\max}(\rho \| \sigma) = \log \| \sigma^{-1/2} \rho \sigma^{-1/2} \|_\infty$.

+",13507,,,,,10/30/2020 18:40,,,,1,,,,CC BY-SA 4.0 +14415,1,,,10/30/2020 18:59,,3,115,"

Consider a standard circuit to Hamiltonian reduction in QMA. For example, refer here (Vazirani's lecture notes) or page 235 of here (survey by Gharibian et al).

+

The history state of the Kitaev clock Hamiltonian $H$ is given by:

+

\begin{equation} + |\psi_{\text{history}}\rangle = \frac{1}{\sqrt{T + 1}} \sum_{i = 0}^{T} V_{i} V_{i - 1} \cdots V_{1} |00 \cdots 0 \rangle |\psi\rangle |i\rangle_{\text{clock}}, +\end{equation} +where $V = V_{T} V_{T-1}\cdots V_{1}$ is the circuit that the QMA verifier, and $|\psi\rangle$ is the state sent by the prover. Note that $|\psi_{\text{history}}\rangle$ is not the ground state of $H$. But how close is it to the ground state?

+

In other words, if $|\psi_{\text{ground}}\rangle$ is the ground state of the Kitaev clock Hamiltonian $H$, I am trying to find

+

\begin{equation} +|| |\psi_{\text{ground}}\rangle - |\psi_{\text{history}}\rangle ||. +\end{equation}

+",1351,,1351,,10/30/2020 20:21,11/2/2020 5:03,How close is the history state to the ground state in the Kitaev clock construction?,,0,0,,,,CC BY-SA 4.0 +14417,1,14479,,10/31/2020 6:04,,1,174,"

I am submitting a job to ibmq_qasm_simulator and after the validation I repeatedly get the error "Error running job on a simulator. [5204]" The site with error descriptions https://quantum-computing.ibm.com/docs/manage/errors does not have an entry for the error code 5204, so it is impossible to know what causes the error and how to fix it. Can anybody help with this?

+",13667,,55,,11/4/2020 7:41,11/4/2020 10:35,Unknown error code [5204] when running job on IBM's qasm_simulator,,1,5,,,,CC BY-SA 4.0 +14418,1,,,10/31/2020 6:54,,1,219,"

How do I implement the HHL with negative eigenvalues?

+

This paper (https://arxiv.org/abs/1803.01486) says that:

+
+

what if $\lambda<0$? This problem actually does not hard to solve, since we can choose $t$ small enough, such that $|\lambda t| < \pi$. So if $2 \pi y/N > \pi$, then we believe that $\lambda t = 2 \pi y/N − 2\pi=−2\pi (N−y)/N$.

+
+

However, doing so introduces a problem at $\lambda = 0$, where the solution diverges.

+

Note 1: In Cirq, the code only works where eigenvalues of the Hamiltonian is positive. How do I adjust this code so it also works with negative eigenvalues? +https://github.com/quantumlib/Cirq/blob/master/examples/hhl.py

+

Note 2: in Qiskit,the quantum phase estimation EigsQPE has an input negative_evals. It seems this adds one more ancilla qubit. What do that they do here? +https://qiskit.org/documentation/stubs/qiskit.aqua.components.eigs.EigsQPE.html

+",9903,,55,,11/4/2020 7:41,11/4/2020 7:41,Implementing the HHL algorithm with negative eigenvalues (Cirq),,0,0,,,,CC BY-SA 4.0 +14420,2,,9826,10/31/2020 15:31,,2,,"

I had the same issue. Removed Python 3.9 and installed the 3.8 version. That did the trick.

+",13669,,,,,10/31/2020 15:31,,,,1,,,,CC BY-SA 4.0 +14422,1,14423,,10/31/2020 19:40,,1,106,"

I am new to Quantum computing.

+

I see $|\mbox{+}i\rangle$ state maps to y-axis on bloch sphere ($\theta = 90$ degree and $\phi = 90$ degree) while $i|1\rangle$ maps on x-axis, $i|1\rangle$ is stated as $|1\rangle$ with global phase $i$ ($\theta = 180$ degree and $\phi = 90$ degree).

+

But both the notation ie. $i|1\rangle$ and $|\mbox{+}i\rangle$ looks very similar to me. How do we interpret that something is global phase while reading it.

+",13392,,55,,11/4/2020 7:37,11/4/2020 7:37,What is the difference between the states $i|1\rangle$ and $|+i\rangle$?,,1,1,,,,CC BY-SA 4.0 +14423,2,,14422,10/31/2020 19:59,,4,,"

It is just the convention that people use the notation $|1 \rangle $ to represent the vector $\begin{pmatrix} 0 \\ 1 \end{pmatrix}$ and $|0 \rangle$ to represents the matrix $\begin{pmatrix} 1 \\ 0 \end{pmatrix}$. Similarly, people use the notation $|i\rangle $ to represent the vector $\dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ i \end{pmatrix}$ .

+

I could have very much use a different notation, say $|k\rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ i \end{pmatrix}$, instead. Maybe this would lessen the confusion.

+

So by looking at the vector itself, it would be less confusing. That is, if you look at the state $i|1\rangle$ you have

+

$$ i|1\rangle = i \begin{pmatrix} 0 \\ 1 \end{pmatrix}$$

+

which you can see that $i$ here is the global phase. But if you look at the state $|i\rangle$ you have

+

$$|i \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ i \end{pmatrix} = \dfrac{1}{\sqrt{2}} \bigg[ \begin{pmatrix} 1 \\ 0 \end{pmatrix} + i \begin{pmatrix} 0 \\ 1 \end{pmatrix} \bigg] = \dfrac{1}{\sqrt{2}}\bigg[ |0 \rangle + i|1\rangle \bigg]$$

+

as you can see here, $i$ is not a global phase but rather a relative phase.

+",9858,,,,,10/31/2020 19:59,,,,5,,,,CC BY-SA 4.0 +14424,1,14425,,10/31/2020 22:07,,2,47,"

Is it wrong to say in $a$ and $b$ are the square roots of the probability of the qubit being in the state 0 and 1 when measured for a qubit in the state $|\psi \rangle = a|0 \rangle +b|1 \rangle $? And by that definition how can $a$ and $b$ be imaginary numbers?

+",13670,,55,,11/4/2020 16:01,11/4/2020 16:01,Is it wrong to say that $a$ and $b$ are the square roots of the detection probabilities in a qubit state $|\psi \rangle = a|0 \rangle +b|1 \rangle $?,,1,0,,,,CC BY-SA 4.0 +14425,2,,14424,10/31/2020 23:18,,1,,"

A qubit is a two-level quantum system, hence the state of a qubit can be written as $|\psi \rangle = a|0\rangle + b|1\rangle$ with $a, b \in \mathbb{C}$ and $|a|^2 + |b|^2 = 1 $. Note that $|a|^2$ is always a real number even if $a$ is complex because $|a|^2 = a\cdot \bar{a} $. And yes, the probability to observe the qubit in the state $|0\rangle$, $Pr(|0\rangle) = |a|^2$. Similarly the probability to observe the state $|1\rangle$, $Pr(|1\rangle ) = |b|^2$. This should shed some light into why we have the constraint $|a|^2 + |b|^2 = 1$.

+",9858,,,,,10/31/2020 23:18,,,,2,,,,CC BY-SA 4.0 +14427,1,14432,,11/1/2020 1:13,,4,193,"

Let $A, B$ be (finite-dimensional) Hilbert spaces, and $\rho$ some mixed state of $A \otimes B$. I am trying to show that a measurement performed on the '$A$-subsystem' does not affect $\rho^B = \text{Tr}_A(\rho)$.

+

I understand a 'measurement performed on the $A$-subsystem' as given by some observable $X \otimes I$, where $X$ is a self-adjoint operator on $A$ which decomposes as $X = \sum m P_m$ (where $P_m$ is the orthogonal projection on the $m$-eigenspace). If this measurement results in outcome $m$, the resulting state should be

+

$$\rho' = \frac{(P_m \otimes I) \rho (P_m \otimes I)}{\text{Tr}((P_m \otimes I) \rho)}$$ +and I wish to see that $\text{Tr}_A(\rho') = \text{Tr}_A(\rho)$. Now I can use the cyclicity of trace to see that

+

$$\text{Tr}_A(\rho') = \frac{\text{Tr}_A((P_m \otimes I) \rho)}{\text{Tr}((P_m \otimes I) \rho)}$$

+

but why should this be equal to $\text{Tr}_A(\rho)$? I did check this is the case if $\rho = \rho^A \otimes \rho^B$ decomposes as a product. And I know a general $\rho$ will be a linear combination of such cases; but since the equality desired is not linear, it does not seem to follow that it'll hold (in fact, it seems to indicate it will not hold). Hopefully someone can point to the mistake in my thinking.

+",9168,,55,,11/4/2020 16:00,11/4/2020 16:00,Proof of the no-communication theorem,,2,1,,,,CC BY-SA 4.0 +14428,1,14429,,11/1/2020 4:29,,1,69,"

I'm really confused with the interpretation of those equations:

+

$1.$ The evolution of states under unitary operations can be expressed as +$$ +U = \sum_k\exp(i\phi_k)|\psi_k\rangle\langle\psi_k| +$$

+

$2.$ The controlled operation in quantum computing is defined as +$$ +|0\rangle\langle0|\otimes I + |1\rangle\langle1|\otimes e^{i\alpha}I = \begin{bmatrix} +1 & 0\\ +0 & e^{i\alpha} +\end{bmatrix} +\otimes I +$$

+

I'm not pretty sure how to understand them. Also, the outer product is present in both equations, so I'm wondering could those equations be explained in terms of the projection operator? What are the physical meanings of the outer product?

+

Thanks:)

+",12334,,55,,11/4/2020 15:59,11/4/2020 15:59,What are the physical meanings of the outer product when writing expressions for unitary gates?,,1,2,,,,CC BY-SA 4.0 +14429,2,,14428,11/1/2020 5:40,,2,,"
    +
  1. This is simply the spectral decomposition of a unitary operator. The eigenvalues of a unitary operator are phases, i.e., of the form $e^{i \theta}$. And the rank-1 projectors are the eigenprojectors (again from the spectral theorem) and have the form $| \psi_{k} \rangle \langle \psi_{k} |$ for a non-degenerate spectrum (otherwise, their rank is greater than one and they cannot be written as the outer product of a state vector).

    +
  2. +
  3. This is clearly wrong. The action of this is to provide a trivial global phase. I think you mean something like $|0\rangle\langle 0|\otimes I+| 1\rangle\langle 1| \otimes R_z(\alpha)$, where $R_z(\alpha)$ is a phase-shift gate? Or more generally, any two-qubit controlled-$U$ gate can be written as $|0\rangle\langle 0|\otimes I+| 1\rangle\langle 1| \otimes U$.

    +
  4. +
+

Does this help?

+",1108,,,,,11/1/2020 5:40,,,,1,,,,CC BY-SA 4.0 +14430,2,,6840,11/1/2020 6:38,,0,,"

Here comes an illustration code written by myself.

+
from qiskit import QuantumRegister,ClassicalRegister,QuantumCircuit,Aer,execute
+from qiskit.providers.aer import QasmSimulator
+qr=QuantumRegister(1)
+cr0=ClassicalRegister(5)
+circ=QuantumCircuit(qr,cr0)
+circ.measure(qr,cr0[0])
+circ.x(qr)
+circ.measure(qr,cr0[2])
+circ.measure(qr,cr0[3])
+circ.x(qr)
+circ.measure(qr,cr0[3])
+circ.x(qr)
+circ.measure(qr,cr0[4])
+circ.h(qr)
+circ.x(qr)
+print(execute(circ,Aer.get_backend('qasm_simulator')).result().get_counts())
+
+

+

The upper code shows how to get varied values and assign them to different classical registers. Although this method still requires a qubit, at least it can save some time. Maybe you can use the partial trace method to improve this. I think you must be ok with how the c_if() function works.

+",13647,,13647,,11/5/2020 12:51,11/5/2020 12:51,,,,1,,,,CC BY-SA 4.0 +14431,1,14434,,11/1/2020 6:48,,14,4814,"

I'm using Qiskit to create quantum circuits wherein I've this attribute called depth. The documentation states it is the length of the critical path here. What does it represent and how to find it out manually?

+",12667,,45,,11/2/2020 9:53,4/3/2021 15:21,What's meant by the depth of a quantum circuit?,,1,0,,,,CC BY-SA 4.0 +14432,2,,14427,11/1/2020 7:46,,3,,"

What you've denoted as $\rho'$ is just an $m$-th possible outcome. We have to write +$$ +\rho'_m = \frac{(P_m \otimes I) \rho (P_m \otimes I)}{\text{Tr}((P_m \otimes I) \rho)}. +$$ +Now, since Bob doesn't know the value of $m$ he has to assume that the new state is a mixture of $\rho'_m$ with corresponding probabilities $\text{Tr}((P_m \otimes I) \rho)$. So, the actual $\rho'$ is +$$ +\rho' = \sum_m \rho'_m \text{Tr}((P_m \otimes I) \rho) = \sum_m (P_m \otimes I) \rho (P_m \otimes I). +$$ +Finally, you can see that +$$ +\text{Tr}_A(\rho') = +\sum_m \text{Tr}_A((P_m \otimes I) \rho (P_m \otimes I)) = +$$ +$$ += \sum_m \text{Tr}_A(\rho (P_m \otimes I)) = +\text{Tr}_A(\rho \sum_m (P_m \otimes I)) = \text{Tr}_A(\rho). +$$

+",5870,,5870,,11/1/2020 7:53,11/1/2020 7:53,,,,0,,,,CC BY-SA 4.0 +14433,2,,14427,11/1/2020 7:53,,2,,"

Indeed, this equation does not hold. Take for example $\rho = |\phi^+\rangle\langle \phi^+|$, where $|\phi^+\rangle = \frac1{\sqrt2}(|00\rangle+|11\rangle)$. If Alice obtains outcome 0, then $\rho' = |00\rangle\langle 00|$, and $\rho^B = |0\rangle\langle0|$, and if Alice obtains outcome 1, then $\rho' = |11\rangle\langle 11|$, and $\rho^B = |1\rangle\langle1|$. This is the typical example of the nonlocality of wavefunction collapse.

+

The statement of the no-communication theorem is that when you average over Alice's outcomes, then the result does not depend on which measurement she made, or indeed if she made a measurement at all. Let then +$$\rho_m = \frac{(P_m \otimes I) \rho (P_m \otimes I)}{\text{Tr}((P_m \otimes I) \rho)},$$ +the collapsed state after obtaining measurement result $m$, and +$$\rho^B_m = \operatorname{tr}_A (\rho_m).$$ +The theorem is then that $$\sum_m p(m) \rho^B_m = \rho^B = \operatorname{tr}_A\rho,$$ +for all possible projectors $P_m$, or even POVM elements.

+",12541,,,,,11/1/2020 7:53,,,,0,,,,CC BY-SA 4.0 +14434,2,,14431,11/1/2020 8:02,,20,,"

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 circuit has depth 3:

+

+

if you look at the second qubit, there are 3 gates acting upon it. First by the CNOT gate, then by the RZ gate, then by another CNOT gate.

+
+

A depth 3 example could be the following circuit:

+

+

However, the above circuit would have depth of $1$ after optimization. This is because a CNOT gate followed by another CNOT gate is the same as doing nothing. That is, CNOT $\cdot$ CNOT $\cdot$ CNOT = CNOT. So you don't really need to do an additional two CNOTs.

+
+

Another example, consider this other circuit which has depth = 5 (Can you now see why this circuit has a depth of 5? ):

+

+

But let's say you want to run it on a quantum computer, and you choose to run it on one of the IBM machine, in particular ibmq_ourense which has the following qubit layout:

+

+

Because not all the qubits are connected and not all the gates we've defined in our above circuit are actually native gates of ibmq_ourense, your circuit needs to be transpiled to be run on the real hardware. Fortunately, this can be done automatically with Qiskit. And it is a feature that I believe they are still working to improve upon. So when you submit your depth 5 circuit to be run on the hardware, Qiskit will transpile your circuit to the following circuit:

+

+

This circuit has depth 29, instead of depth 5 like the circuit we originally defined.

+
+

The point I wanted to make is that the depth of your circuit might change under the optimization and transpilation process so make sure you keep this in mind.

+
+

There is actually an option within Qiskit that lets you check the depth of your circuit. This can be very useful. Here is an example of how you can do that:

+
provider = IBMQ.load_account()
+qc = QuantumCircuit(1,1)
+qc.x(0)
+qc.y(0)
+qc.rz(1,0)
+print(qc)
+print("The circuit depth is:", qc.depth())
+qc_transpiled = transpile(qc, provider.get_backend('ibmq_ourense') , optimization_level=3)
+print("The TRANSPILED circuit depth is:", qc_transpiled.depth())
+
+
+

I see that there is another similar question here: How to calculate circuit depth properly? +There are a couple of really good answers there as well. So I hope it helps!

+",9858,,4947,,4/3/2021 15:21,4/3/2021 15:21,,,,0,,,,CC BY-SA 4.0 +14436,1,14440,,11/1/2020 11:31,,1,63,"

Hello I am using measure density matrix function like that:

+
for i in range (10):
+    measurement_result = cirq.measure_density_matrix(state,indices=[0, 1, 2])
+    print("measurement",measurement_result)
+
+

And my results are like that:

+

+

As you can see, I have ([0, 0, 0], array([[0.36107099-0.36107099j, 0. +0.j , and I want to extract first part [0, 0, 0] (the qubit part) and then I will count how many [0, 0, 0] , [0, 0, 1] [0, 1, 0] … But I could not extract the first part of array. How can I get the first part [0, 0, 0] ? +Thanks ...

+",13548,,55,,11/4/2020 15:57,11/4/2020 15:57,Cirq - Measure Density Matrix Function Getting First Element,,1,0,,,,CC BY-SA 4.0 +14438,1,,,11/1/2020 13:54,,2,109,"

Can someone please explain rigorously the reasoning behing non-ideal ($\epsilon$-concealing and $\delta$-binding) bit commitment scheme and the impossibility of coin tossing.

+

What is bias in coin tossing? How to use non-ideal bit commitment scheme to come up with non-ideal coin tossing and how to estimate the bias.

+

Lo-Chau paper "Why quantum bit commitment and ideal coin tossing are impossible" has some of the details, but it looks like it omits a lot of details we could add 22 years later.

+

And I could not understand Mayers' work "Trouble with quantum bit commitment".

+

Thank you very much.

+",13616,,,,,12/16/2020 17:37,Non-ideal bit commitment and coin tossing,,1,0,,,,CC BY-SA 4.0 +14439,1,,,11/1/2020 17:45,,1,157,"

I have followed an example that Qiskit provides here. +I tried to increase the matrix size to 16x16 and change num_ancillae and num_time_slices in create_eigs() function.

+
# set the random seed to get the same pseudo-random matrix for every run
+aqua_globals.random_seed = 0
+matrix = random_hermitian(16)
+vector = matrix.dot(np.array([1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1]))
+
+m = np.array(matrix)
+
+orig_size = len(vector)
+matrix, vector, truncate_powerdim, truncate_hermitian = HHL.matrix_resize(matrix, vector)
+
+# Initialize eigenvalue finding module
+eigs = create_eigs(matrix, 2, 2, True)
+num_q, num_a = eigs.get_register_sizes()
+
+# Initialize initial state module
+init_state = Custom(num_q, state_vector=vector)
+
+# Initialize reciprocal rotation module
+reci = LookupRotation(negative_evals=eigs._negative_evals, evo_time=eigs._evo_time)
+
+algo = HHL(matrix, vector, truncate_powerdim, truncate_hermitian, eigs,
+           init_state, reci, num_q, num_a, orig_size)
+result = algo.run(QuantumInstance(Aer.get_backend('statevector_simulator'),
+                                  seed_simulator=aqua_globals.random_seed,
+                                  seed_transpiler=aqua_globals.random_seed))
+print("solution ", np.round(result['solution'], 5))
+
+result_ref = NumPyLSsolver(matrix, vector).run()
+print("classical solution ", np.round(result_ref['solution'], 5))
+
+print("probability %f" % result['probability_result'])
+fidelity(result['solution'], result_ref['solution'])
+
+

The result is

+
solution  [ 0.19079-0.95092j  0.26228+0.11189j -0.30868-0.55258j -0.7612 +1.61692j
+  0.64665-0.26533j  1.20938-0.40916j -0.51564+1.98277j -0.08177-2.63386j
+  1.14807-0.1218j   0.87798+1.39184j  0.8494 +0.00695j -0.0529 -0.11107j
+  0.28287+0.74082j  1.3964 +0.23344j -2.15506+1.25378j  1.07591-0.70505j]
+classical solution  [1.+0.j 2.+0.j 3.-0.j 1.-0.j 1.+0.j 2.-0.j 3.+0.j 1.-0.j 1.-0.j 2.+0.j
+ 3.+0.j 1.-0.j 1.+0.j 2.-0.j 3.-0.j 1.+0.j]
+probability 0.000000
+fidelity 0.040951
+
+

I got very low fidelity when I change num_ancillae to 2, if I increase num_ancillae to 3, my kernel just died without showing any error.

+

My questions are,

+

What cause my kernel died? Is it normal?

+

How does num_ancillae and num_time_slices affect the fidelity?

+",13676,,55,,11/4/2020 15:55,11/4/2020 15:55,How to increase matrix size and getting high fidelity for HHL algorithm in Qiskit?,,1,0,,,,CC BY-SA 4.0 +14440,2,,14436,11/1/2020 17:57,,1,,"

This is more of a basic python usage question. You want

+

first_part = measurement_result[0] or first_part, second_part = measurement_result.

+",119,,,,,11/1/2020 17:57,,,,2,,,,CC BY-SA 4.0 +14441,2,,14439,11/1/2020 19:03,,1,,"

If you are using IBMQ Experience jupyter notebook environment, then there is a max memory of 8 GB that you can use.

+

You can use the command: !free -h to see how much memory you have left.

+

Actually, I just logged into my IBMQ Experience account and noted that they now showing how much memory you are taking and it is updating every 5 seconds. It is located at the top of your Jupyter notebook. See pic below.

+

+

If your notebook is using more than this 8GB allocation memory, the Kernel will dies and restart automatically.

+

I also see that you are using statevector_simulator is can be very expensive. Instead, switched to qasm_simulator or ibmq_qasm_simulator. See if doing that will fix the memory problem.

+",9858,,,,,11/1/2020 19:03,,,,0,,,,CC BY-SA 4.0 +14442,2,,14395,11/1/2020 23:46,,0,,"

If i understand your question correctly, i guess you could get, after transpiling $U$, the final layout from _layout property of a circuit and remap the qubits in initial state preparation circuit $ V $ to enforce this layout. +If you want your measurement results to respect the initial ordering of qubits, you could re-order the classical register, i.e if qubit 0 is qubit 1 in the final circuit, store the measurement of qubit 1 in classical bit 0.

+

Finally, you can execute the circuit. The only catch is that you may need another transpilation step in case the layout is not compatible with $ V $ but if $U$ is much more 'complicated' than $V$, it should be fine.

+

Here is some working code.

+
from qiskit import transpile, execute, Aer, IBMQ
+
+from qiskit.circuit import QuantumCircuit, ClassicalRegister
+from qiskit.circuit.random import random_circuit
+
+from qiskit.transpiler import PassManager
+from qiskit.transpiler.passes.layout import ApplyLayout, SetLayout
+
+from qiskit.quantum_info import Statevector
+from qiskit.quantum_info.random import random_unitary
+
+qasm  = Aer.get_backend('qasm_simulator')
+
+IBMQ.load_account()
+provider = IBMQ.get_provider(hub='ibm-q')
+device = provider.get_backend('ibmq_santiago')
+
+gates = device.configuration().basis_gates
+coupling_map = device.configuration().coupling_map
+
+n = 3
+n_iter = 2
+
+# init state
+V = QuantumCircuit(n)
+V.h(0)
+for i in range(n - 1):
+    V.cx(i, i + 1)
+    
+# random U
+U = random_circuit(n, depth=5)
+
+# full algorithm - no optimization - just for reference
+qc = U.repeat(n_iter)
+qc.compose(V, front=True, inplace=True)
+qc.measure_all()
+
+# transpile U
+Utr = transpile(U, 
+                basis_gates=gates, 
+                coupling_map=coupling_map, 
+                optimization_level=3)
+
+layout = Utr._layout
+mapping = layout.get_virtual_bits() # a map from virtual to physical qubits
+
+# enforce layout in V
+passes_ = [SetLayout(layout), ApplyLayout()]
+pm = PassManager(passes_)
+Vm = pm.run(V)
+
+# full algorithm
+circ = Utr.repeat(n_iter)
+circ.compose(Vm, front=True, inplace=True)
+
+# add measurements
+cr = ClassicalRegister(n)
+circ.add_register(cr)
+
+# re-order classical registers 
+for q in U.qubits:
+    circ.measure(mapping[q], 
+                 cr[q.index])
+
+
+def simulate(qc):
+    return execute(qc, qasm).result().get_counts()
+
+print(simulate(qc))
+---
+{'000': 484, '001': 17, '010': 6, '011': 47, '100': 10, '110': 19, '111': 441}
+
+print(simulate(circ))
+---
+{'000': 496, '001': 23, '010': 7, '011': 37, '100': 12, '101': 1, '110': 14, '111': 434}
+
+",13109,,,,,11/1/2020 23:46,,,,1,,,,CC BY-SA 4.0 +14443,2,,14264,11/2/2020 7:22,,4,,"

To access and edit the quantum circuit and view the Bloch sphere of the quantum state online, click the hyperlink(to run and see the Bloch sphere you have to sign in). The final code is also posted on the git-hub(some self-written script of the project is called in that file). +The circuit is as follows: + +and the quantum circuit from the reference is + +(Chandak, S., Mardia, J., & Tolunay, M. Implementation and analysis of stabilizer codes in pyQuil.).

+

After I completed the construction follows the upper reference, a global phase factor pi shows up for the logical state of |1>, so I appended a controlled-phase flip operation(CU1(pi), CX, CU1(pi), CX). To get the logical state of |0>, just remove the leftmost X gate.

+

Here comes another reference: +Gottesman, Daniel. "Stabilizer codes and quantum error correction." arXiv preprint quant-ph/9705052 (1997).

+

For the detail of the stabilize code encoding, you can read section 4.2(Network for Encoding) of the Gottesman book or section 10.5.8(Quantum circuits for encoding, decoding, and correction) of the Nielson book.

+

Here comes my code, first I generated the physical qubits

+
from qiskit import QuantumRegister,ClassicalRegister,QuantumCircuit,Aer,execute
+from qiskit.providers.aer import QasmSimulator
+from qiskit.circuit.library.standard_gates import CU1Gate
+from numpy import pi
+def physicalQubits(ipt):
+    qr=QuantumRegister(5)
+    circ=QuantumCircuit(qr)
+    if ipt==1:
+        circ.x(qr[0])
+    # controlled phase flip - if the input state is |1>,
+    # then flip the global phase by pi
+    CU1=CU1Gate(pi)
+    circ.append(CU1,[qr[0],qr[1]])
+    circ.cx(qr[0],qr[1])
+    circ.append(CU1,[qr[0],qr[1]])
+    circ.cx(qr[0],qr[1])
+    
+    circ.h(qr[4])
+    circ.s(qr[4])
+    # g1
+    circ.cz(qr[4],qr[3])
+    circ.cz(qr[4],qr[1])
+    circ.cy(qr[4],qr[0])
+    
+    circ.h(qr[3])
+    #g2
+    circ.cz(qr[3],qr[2])
+    circ.cz(qr[3],qr[1])
+    circ.cx(qr[3],qr[0])
+
+    circ.h(qr[2])
+    #g3
+    circ.cz(qr[2],qr[4])
+    circ.cz(qr[2],qr[3])
+    circ.cx(qr[2],qr[0])
+
+    circ.h(qr[1])
+    circ.s(qr[1])
+    #g4
+    circ.cz(qr[1],qr[4])
+    circ.cz(qr[1],qr[2])
+    circ.cy(qr[1],qr[0])
+    return circ.to_gate()
+
+

Then, you can get(in this place, to get the following output, you have to append the classical register and the corresponding measurement and execute instruction by yourself, since the requirement of this question is to not use classical register)

+

+

But until this place, I only showed you that the quantum states are correct, while the phase continues unknown, so what follows is the code to check the phase:

+
from qiskit.aqua.operators import StateFn,I
+def ini(circ,qr,ipt):
+    # Input binary form, and append [0] ahead for qr1 block.
+    for i in range(len(ipt)):
+        if ipt[len(ipt)-i-1]:
+            circ.x(qr[i])
+    return 0
+
+def Dec2Bi(num):
+# Decimal to binary list.
+    res=list(bin(num)[2:])
+    return [int(res[i]) for i in range(len(res))]
+
+def checkPhases():
+    operator=I.tensorpower(5)
+    for i in range(32):
+        qr=QuantumRegister(5)
+        circ=QuantumCircuit(qr)
+        ini(circ,qr,Dec2Bi(i))
+        psi=StateFn(circ)
+        phi1=StateFn(physicalQubits(0))
+        print('expectation value for state '+bin(i)[2:]+' and the physical qubits of 0:')
+        print((~psi@operator@phi1).eval())
+        phi2=StateFn(physicalQubits(1))
+        print('expectation value for state '+bin(i)[2:]+' and the physical qubits of 1:')
+        print((~psi@operator@phi2).eval())
+
+

Then call the function--

+
checkPhases()
+
+

You'll get the result and if the phase is non-zero, the result of the corresponding one should be a negative one.

+

Another way to check that this construction of gate works correctly is to get the state vector(psi0) of the constructed state and the state vector(psi1) after an arbitrary stabilizer is acted on it and see whether <psi0|psi1> equals one. I have checked the result but the code is omitted(you can still access the corresponding on git-hub).

+",13647,,13647,,11/3/2020 1:31,11/3/2020 1:31,,,,7,,,,CC BY-SA 4.0 +14444,2,,2372,11/2/2020 9:14,,1,,"

I suggest you read this article, which discussed the quantum speedup for unsupervised learning like clustering. This paper gathered the progression of the quantum algorithms to accelerate unsupervised learning, and a lot of the algorithms depend on the Grover search.

+

Here comes an example.

+

+

For n points, this algorithm searches the distances(up to n^2 different distances) and it can get the distance_maximum in O(n) expected time with high probability. For proof of this claim, see this article.

+

But there is one thing I myself is also quite confused about, which is how to construct the oracle to compute the distance(and the crucial point are how efficient it is and whether it is asymptotically optimal). I think the building of the oracle is the major problem of Grover search, not how to get more variant applications.

+",13647,,13647,,11/3/2020 13:43,11/3/2020 13:43,,,,0,,,,CC BY-SA 4.0 +14446,1,14447,,11/2/2020 14:54,,3,109,"

Why does applying the following circuit on a $00$ state produce +$|0\rangle \otimes |+\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |01\rangle)$. Shouldn't it produce $ |+\rangle \otimes |0\rangle = \frac{1}{\sqrt{2}}(|00\rangle + |10\rangle)$?

+

+",13688,,1859,,11/3/2020 14:13,11/3/2020 14:13,Confused about the application of Hadamard gate to uncorrelated qubits,,1,1,,11/6/2020 12:29,,CC BY-SA 4.0 +14447,2,,14446,11/2/2020 15:06,,4,,"

Qubit ordering in Qiskit: qubit 0 is the rightmost one, i.e., the least significant bit.

+",7659,,,,,11/2/2020 15:06,,,,0,,,,CC BY-SA 4.0 +14449,2,,14264,11/2/2020 15:43,,2,,"

I think this +is another valid solution.

+

+

Let me try to explain the thought process:

+

$ | 0_L \rangle $ $\big( | 1_L \rangle \big)$ is a superposition of all states with an even (odd) number of 1s. From $ | 0 \rangle^{\otimes 5} $ state, we map the first 4 - qubits in a uniform superposition and we fix the parity with $ CNOT $ gates. This will give even 1s if we begin from $ | 0 \rangle^{\otimes 4} |0 \rangle $ and odd 1s from $ | 0 \rangle^{\otimes 4} |1 \rangle $. Now we should just fix the phases. We observe that a state in $ | 0_L \rangle $ has -1 iff the number of pairs of 'adjacent' (in a ring topology) qubits both in $ |1 \rangle $ state is odd. But we can compute this with a collection of $ CZ $ gates. The only caveat is that $ | 0 \rangle^{\otimes 4} |1 \rangle $ will be mapped to $ - |1_L \rangle $. But we can easily fix this with a $ Z $ gate acting on the last qubit right in the beginning.

+",13109,,13109,,11/6/2020 8:53,11/6/2020 8:53,,,,6,,,,CC BY-SA 4.0 +14450,1,,,11/2/2020 16:20,,2,230,"

In the paper by Stamatopoulos et al., the authors say that it is possible to load a distribution on a three qubit state to obtain:

+

In Qiskit finance this is performed using the uncertainty model function. My question is, how do you encode random numbers on qubit states?

+

Later is their paper they report that you can use controlled-Y rotations to load a random distribution, this way:

+

+

but I don't know how they pick the angle for the controlled rotation in order to obtain the desired number.

+",13418,,,,,11/16/2021 18:10,Loading a random distribution using controlled-Y rotations,,2,1,,,,CC BY-SA 4.0 +14451,2,,14450,11/2/2020 18:50,,1,,"

From this paper: Entanglement types for two-qubit states with real amplitudes +there is a theorem on page 3 that said that:

+
+

If we consider the subsets of two qubits states $RQ_2$ given by +$$\{ |w\rangle = w_1 |00 \rangle + w_2 |01\rangle + w_2|10 \rangle + w_4|11\rangle : w_i \in \mathbb{R} \} $$ +then for any pair of states $|\phi_1 \rangle$ and $|\phi_2 \rangle$ in $RQ_2$ thre exists angleds $\theta_0$, $\theta_1$, $\theta_2$ and $\theta_3$ such that the circuit

+

+send $|\phi_1\rangle$ tp $|\phi_2\rangle$.

+
+

We can decompose the CZ gate into $(I \otimes H) CNOT (I \otimes H)$ and absorbed the Hadamard gate into the RY rotation as well to get to the formed in the paper you posted.

+
+

In term of determine the specific angles to obtain the right amplitude, you can write down the systems of equations and solve for them. But you can use intuition on how to select the right angles too.

+
+

Hopefully other people will provide more in depth answer :)

+",9858,,9858,,11/16/2021 18:10,11/16/2021 18:10,,,,0,,,,CC BY-SA 4.0 +14452,1,,,11/2/2020 19:40,,1,139,"

I was running instances of $3$-regular graphs with small number of vertices on Qiskit, and for $p=1$ the algorithm was giving always the exact solution for the MaxCut problem, after optimizing the parameters. I was wondering though, how do we know if a specific graph can't be solved on $p=1$ ? Do we know the limits of QAOA for $p=1$ in order to decide with certainty that extra layers are required, given the graph?

+",12408,,9118,,11/3/2020 14:13,11/3/2020 14:13,Quantum Approximate Optimization Algorithm for $p=1$,,2,0,,,,CC BY-SA 4.0 +14453,2,,14452,11/2/2020 20:03,,2,,"

We don't in general.

+

There are instances where $p=2,3$ or $4$ might still be not enough. QAOA is an approximate algorithm as the name suggested, so you don't expect it to find the exact answer.

+

You should take a look at this paper: Quantum Approximate Optimization Algorithm: Performance, Mechanism, andImplementation on Near-Term Devices

+",9858,,,,,11/2/2020 20:03,,,,0,,,,CC BY-SA 4.0 +14454,1,,,11/2/2020 22:32,,2,29,"

Can someone please check if the following makes sense?

+

We have a non-ideal coin-tossing scheme as follows. Alice and Bob know what $|0\rangle,|1\rangle$ are. Bob wins when the coin is 1.

+
    +
  1. Honest Alice commits a random bit $a\in \{0,1\}$. The state of their joint system with Bob is $|a\rangle ,$ while Bob has $\rho_a^B=Tr{|a\rangle\langle a|}$
  2. +
  3. Bob chooses a bit $a'\in\{0,1\}$
  4. +
  5. Alice reveals her guess.
  6. +
  7. The coin is $c=a\oplus a'$.
  8. +
+

Probability that $c=0$ is $p_0$ and similarly, the probability that $c=1$ is $p_1$. I need to determine bias Bob can achieve, i.e. bounds on $\max|p_0-p_1|$ if Bob is dishonest.

+

Now suppose, Bob is acting dishonestly and he wants the coin to be 1 in the end. He will try to guess what bit Alice has commited so he can choose the opposite. All he has is his reduced density matrix. He will try to distinguish $\rho_a^B$ from $\rho_0^B$ and from $\rho_1^B$. +By Holevo-Helstrom his probability of guessing correctly is at most $$\frac{1}{2}+\frac{1}{4}||\rho_0^B-\rho_1^B||_1.$$ Suppose, we are given that $F(\rho_0^B,\rho_1^B)\ge 1-\delta.$

+

We have the inequalities:

+

$$2-2F(\rho_0^B,\rho_1^B)\le ||\rho_0-\rho_1||_1\le 2\sqrt{1-F(\rho_0^B,\rho_1^B)^2}$$

+

Therefore,

+

$$1-\frac{F(\rho_0^B,\rho_1^B)}{2}\le \frac{1}{2}+\frac{1}{4}||\rho_0^B-\rho_1^B||_1\le \frac{1}{2}+\frac{\sqrt{2\delta-\delta^2}}{2}$$

+

Any feedback, any additional comments, references and suggestions are greatly appreciated.

+",13616,,13616,,11/3/2020 14:00,11/3/2020 14:00,Non-ideal coin tossing,,0,1,,,,CC BY-SA 4.0 +14455,1,,,11/3/2020 0:12,,3,110,"

The k-state is given by: +$$ |𝐾⟩ = \dfrac{\sqrt{3}|100⟩ − 𝑒^{𝑖π/4}|010⟩ + \sqrt{2}|001⟩}{ \sqrt{6}}$$ +I am fairly new to quantum computing and do not have much background in the field. I understand the amplitudes of the state and the phases, however, how would one go about making a circuit for the same using the different quantum gates. I did refer to entangled states such as the W state, but I am unable to understand the underlying principle behind the combination of the gates used to create the circuit. In what direction should I go about constructing the k-state circuit.

+",13695,,55,,11/4/2020 15:47,11/4/2020 15:47,What is k-state and how to go about creating a circuit?,,1,0,,,,CC BY-SA 4.0 +14456,1,,,11/3/2020 2:35,,2,244,"

Given two arbitrary density matrices $\rho, \sigma\in \mathcal{H}$ (they have unit trace and are positive), how do I go about finding a possible quantum channel $\mathcal{E}$ such that $\mathcal{E}(\rho)=\sigma$? $\mathcal{E}$ is a general CPTP map, as such it is 1) trace preserving, 2) convex-linear, and 3) completely positive. It admits a Kraus operator representation or can be expressed as a unitary operation (gate) on an extended Hilbert space via Stinespring dilation. Can one say something about the remaining degree of freedom in the choice of $\mathcal{E}$?

+

I am simply wondering how one goes about constructing a valid quantum channel (representing the most general form of evolution of a quantum system) which connects two fixed states. This is a very general problem: One can think of a situation where a quantum system is initialized in some fixed state $\rho$ and one would like to manipulate it ( $\leftrightarrow$ subject it to a given quantum channel) such that it ends up in a target state $\sigma$. As such, this question must be addressed in a plethora of quantum experiments... (Maybe someone can also simply point me to some relevant literature?)

+",9082,,55,,11/4/2020 15:49,11/4/2020 15:49,How can I find a quantum channel connecting two arbitrary quantum states?,,2,8,,,,CC BY-SA 4.0 +14457,1,14459,,11/3/2020 5:56,,4,109,"

For the Hadarmard Hamiltonian, $\hat H = (\hat X+\hat Z)/\sqrt 2$, where $\hat X$ and $\hat Z$ are Pauli matrices. The time evolution of a state under this Hamiltonian could be visualized by a rotation on the Bloch sphere with an axis

+

$$ +\hat n = \frac{1}{\sqrt2}\begin{bmatrix} + 1 \\ + 0 \\ + 1 \\ + \end{bmatrix} +$$

+

However, I'm wondering if I have another Hamiltonian defined as

+

$$ +\hat H_1 = \frac{1}{\sqrt3}(\hat X +\hat Z +\hat I) +$$

+

where $\hat I$ is the identity operator. Then what the role $\hat I$ would have on this Hamiltonian? If I still want to visualize the time-evolution rotation on the Bloch sphere, what the 'new' axis would be?

+

Thanks:)

+",12334,,55,,11/4/2020 15:50,11/4/2020 15:50,How does adding an identity to an Hamiltonian affect the corresponding time-evolution in the Bloch sphere?,,1,0,,,,CC BY-SA 4.0 +14458,2,,14367,11/3/2020 7:27,,2,,"

Until a better solution is provided, I hope this suggestion is helpful.

+

Reducing MaxCut to Max-2SAT is straightforward (https://cs.stackexchange.com/a/93492/115012)

+

And there are many free, highly optimized MaxSAT solvers.

+",9474,,,,,11/3/2020 7:27,,,,0,,,,CC BY-SA 4.0 +14459,2,,14457,11/3/2020 7:39,,3,,"

The identity operator does not change the axis of rotation, because it does not change the eigenvectors of your Hamiltonian.

+

The only thing that the identity operator changes is the global phase of your state, but since the global phase does not alter the Bloch sphere picture (because you're looking at $|\psi\rangle\langle\psi|$ not $|\psi\rangle$), nothing changes in the Bloch sphere picture.

+",1837,,,,,11/3/2020 7:39,,,,0,,,,CC BY-SA 4.0 +14460,2,,14455,11/3/2020 7:54,,2,,"

I did the following: let $U$ be the single-qubit unitary +$$ +U=\frac{1}{\sqrt{3}}\left(\begin{array}{cc} \sqrt{2} & 1 \\ -1 & \sqrt{2}\end{array}\right) +$$ +This is a partial rotation about the y axis. We use this definition to construct a circuit

+

Here's the thinking: after the Hadamard, I've got $(|000\rangle+|100\rangle)/\sqrt{2}$, so the $|100\rangle$ term is what I need it to be. So, I need to concentrate on making the other two terms without disturbing the first one. If everything else we do is controlled off the first qubit being $|0\rangle$, we achieve that lack of disturbance. Thus, really what we have to concentrate on is a circuit that converts $|00\rangle$ on the last two qubits into $(\sqrt{2}|01\rangle-e^{i\pi/4}|10\rangle)/\sqrt{3}$. We'll be able to get the phase right with a $T$ gate at the end, so you just needed to convert $|00\rangle$ into $(\sqrt{2}|01\rangle-e^{i\pi/4}|10\rangle)/\sqrt{3}$. The gate $U$ is a large part of doing that.

+",1837,,1837,,11/3/2020 12:47,11/3/2020 12:47,,,,0,,,,CC BY-SA 4.0 +14461,1,14475,,11/3/2020 11:59,,5,66,"

The generalization of probability distributions on density matrices allows to define quantum Jensen–Shannon divergence (QJSD), which uses von Neumann entropy. Does QJSD appear in any quantum algorithms or texts on quantum computing?

+",9118,,55,,11/4/2020 20:37,11/4/2020 20:37,Does the quantum Jensen-Shannon divergence appear in any quantum algorithms or texts on quantum computing?,,1,0,,,,CC BY-SA 4.0 +14462,2,,14452,11/3/2020 12:47,,1,,"

In general, we don't know. It is mostly trial and error, depending on the graph instance. There exist a few examples in the literature where it is pointed out that the probability of getting the optimum is very low such as this paper. One could try to characterize such situations with a few graph properties that can help decide whether or not QAOA at depth 1 is "enough" depending how you define it. For instance by using Machine Learning but this requires finding those graph characteristics but that is likely hard to find. As a Machine Learning methodology reference, there is this article.

+",4127,,,,,11/3/2020 12:47,,,,0,,,,CC BY-SA 4.0 +14463,1,,,11/3/2020 13:39,,4,79,"

I have read in several papers now that information-theoretically secure multi-party quantum computation (MQPC) with a dishonest majority ($t \geq n/2$) is impossible because of the impossibility of unconditionally secure quantum bit commitment. Hence my question, why does MPQC imply the existence of quantum bit commitment? I would in particular be interested in how to combine the different frameworks of MPQC and quantum bit commitment protocols.

+",11977,,11977,,11/4/2020 16:11,11/4/2020 16:49,(Why) does unconditionally secure multi-party quantum computation imply quantum bit commitment?,,1,3,,,,CC BY-SA 4.0 +14464,1,14465,,11/3/2020 14:14,,2,41,"

I am confused about one point in the proof on the lower bounds in Kaye, Laflamme Mosca's lemma 9.3.6.

+

Context: $|\psi_T\rangle$ is the final state of the search algorithm that started on the all-zero string. +$|\psi^x_T\rangle$ is the final state of the search algorithm that started on the non-zero string $x$. We want to distinguish the two states with probability at least 2/3.

+

Need to show that $|||\psi_T\rangle-|\psi^x_T\rangle||\ge c>0.338$.

+

Tools to use:

+

If $|||\psi_T\rangle-|\psi^x_T\rangle||\le d,$ then $|\langle \psi_T | \psi_T^x\rangle|\ge 1-\frac{d^2}{2}$.

+

Any procedure that on input $|\psi_z\rangle$ guesses whether $z=x$ or $z=y$ guesses with the maximum achievable probability $\frac{1}{2}+\frac{1}{2}\sqrt{1-|\langle\psi_x | \psi_y\rangle |^2}$.

+

My reasoning: Suppose instead that $|||\psi_T\rangle-|\psi^x_T\rangle||< c$. Then $\frac{2}{3}=\frac{1}{2}+\frac{1}{2}\sqrt{1-|\langle\psi_T | \psi_t^x \rangle |^2}< \frac{1}{2}+\frac{c}{2\sqrt{2}}$, so we need $c>\frac{\sqrt{2}}{3}\simeq 0.4714$.

+

Question. how did the book get 0.338? Am I misisng something?

+",13616,,13616,,11/3/2020 14:44,11/3/2020 14:44,Hybrid lower bound proof Kaye Laflamme Mosca (lemma 9.3.6),,1,0,,,,CC BY-SA 4.0 +14465,2,,14464,11/3/2020 14:41,,3,,"

$ |\langle \psi_T | \psi_t^x \rangle| \geq 1 - \frac{c^2}{2} \implies + |\langle \psi_T | \psi_t^x \rangle|^2 \geq \big(1 - \frac{c^2}{2} \big)^2 \implies \\ +\frac{2}{3} = \frac{1}{2} + \frac{1}{2} \sqrt{1 - |\langle \psi_T | \psi_t^x \rangle|^2 } \leq +\frac{1}{2} + \frac{1}{2} \sqrt{1 - \big(1 - \frac{c^2}{2} \big)^2 } \implies +c \geq \sqrt{2 - \frac{4\sqrt{2}}{3}} \approx 0.338$

+",13109,,,,,11/3/2020 14:41,,,,1,,,,CC BY-SA 4.0 +14467,1,14468,,11/3/2020 16:24,,2,336,"

I 'm trying to reproduce the code given in the Qiskit summer school here.

+

The code is:

+
# initialization
+
+import numpy as np
+
+# import Qiskit
+
+from qiskit import IBMQ, BasicAer
+from qiskit.providers.ibmq import least_busy
+from qiskit import QuantumCircuit, execute
+from qiskit.tools.jupyter import *
+ provider= iBMQ.load.account()
+
+

but I am getting this error:

+
 NameError                                 Traceback (most recent call last)
+ <ipython-input-9-5e15427b4944> in <module>
+  9 from qiskit import QuantumCircuit, execute
+  10 from qiskit.tools.jupyter import *
+  ---> 11 provider= iBMQ.load.account()
+  12 
+  13 #import basic plot tools
+
+  NameError: name 'iBMQ' is not defined
+
+

The same question was asked so I tried the answer to install IBM Q provider using the command

+
  pip install qiskit-ibmq-provider 
+
+

but still I am getting the same error.

+

My python version is 3.8.3 and qiskit version is '0.16.0'

+
   {'qiskit-terra': '0.16.0',
+   'qiskit-aer': '0.7.0',
+   'qiskit-ignis': '0.5.0',
+   'qiskit-ibmq-provider': '0.11.0',
+   'qiskit-aqua': '0.8.0',
+   'qiskit': '0.23.0'}
+
+",13698,,9006,,11/4/2020 8:03,11/4/2020 8:03,"A problem with IBM Q, NameError: name 'iBMQ' is not defined",,1,0,,,,CC BY-SA 4.0 +14468,2,,14467,11/3/2020 16:26,,3,,"

The error is you have:

+

provider= iBMQ.load.account() instead of provider= IBMQ.load_account() on line 11 of the code.

+",9858,,9858,,11/3/2020 16:30,11/3/2020 16:30,,,,3,,,,CC BY-SA 4.0 +14469,2,,14356,11/3/2020 16:49,,2,,"

Indeed, the second qubit is doing nothing in these circuits, so you can ignore it.

+",55,,,,,11/3/2020 16:49,,,,0,,,,CC BY-SA 4.0 +14470,1,,,11/3/2020 17:39,,0,303,"

To my understanding, the WeightedPauliOperator class in discontinued, and should no longer be used when dealing with Pauli operators. So how should I perform arithmetic with paulis? +$$ +( 3 X_1 Y_3 + 5 Z_2 X_0 ) (Z_3+2X_2X_4) = \ \text{(expanded version)} +$$

+",6313,,55,,11/4/2020 15:55,11/4/2020 15:55,What is the proper way of doing Pauli arithmetic in Qiskit?,,1,0,,,,CC BY-SA 4.0 +14471,2,,14470,11/3/2020 18:13,,1,,"

The legacy operators in Qiskit Aqua (like WeightedPauliOperator) were replaced by +the operator flow function. The documentation for that replacement is here: https://github.com/Qiskit/rfcs/blob/master/0003-Aqua_0.7_operator_redesign.ipynb

+

However, the class is not deprecated and you are free to use it, even when it lives in the legacy module.

+",1859,,1859,,11/3/2020 18:24,11/3/2020 18:24,,,,0,,,,CC BY-SA 4.0 +14472,1,14473,,11/3/2020 20:49,,3,211,"

Can anyone explain me the behaviour of these two circuits? They contain Hadmard and rotation gates before the Toffoli gate.

+

+

Results of simulation: +

+",13137,,13137,,3/14/2022 12:36,3/14/2022 12:36,"Two circuits with Toffoli, Hadamard and Rx gates",,1,3,,11/16/2020 18:54,,CC BY-SA 4.0 +14473,2,,14472,11/3/2020 21:17,,4,,"

In the first circuit after Hadamard gates (I suppose that initial state is $|000\rangle$ and I will use Qiskit's convention for labeling the qubits $|q_2 q_1 q_0 \rangle$):

+

$$|000\rangle \xrightarrow[]{\text{Hadamards}} \frac{1}{2}|0\rangle(|00\rangle + |01\rangle+|10\rangle + |11\rangle)$$

+

The $R_x(0) = I$, so it does noting. Then comes Toffoli gate (apply $X$ gate on the $q_2$ qubit if the other two (control qubits) are in $|1\rangle$ state):

+

$$\xrightarrow[]{\text{Toffoli}} \frac{1}{2}|0\rangle(|00\rangle + |01\rangle+|10\rangle) + \frac{1}{2}|111\rangle$$

+

In the second circuit $R_x(\pi) = -iX$ (we can neglect $-i $ term because it is a global phase here) and the combained action of Hadamards plus $R_x(\pi)$

+

$$|000\rangle \xrightarrow[]{\text{Hadamards + }R_x(\pi)} \frac{1}{2}|1\rangle(|00\rangle + |01\rangle+|10\rangle + |11\rangle)$$

+

Then Toffoli:

+

$$\xrightarrow[]{\text{Toffoli}} \frac{1}{2} |1\rangle (|00\rangle + |01\rangle+|10\rangle) + \frac{1}{2}|011\rangle$$

+",9459,,9459,,11/3/2020 21:35,11/3/2020 21:35,,,,5,,,,CC BY-SA 4.0 +14474,2,,14456,11/3/2020 22:25,,3,,"

Given two states $\rho, \sigma$, consider their spectral decomposition, $$\rho = \sum\limits_{j=1}^{d} p_{j} | \psi_{j} \rangle \langle \psi_{j} | , \sigma = \sum\limits_{j=1}^{d} q_{j} | \phi_{j} \rangle \langle \phi_{j} |. $$ I'm assuming, for simplicity, that $\rho, \sigma$ are have non-degenerate eigenvalues -- this is not a strict requirement for the argument that follows but does simplify the analysis. Then, the problem of $\rho \mapsto \sigma$ breaks down into two steps: (i) transforming their eigenvectors and (ii) transforming their eigenvalues.

+

To transform their eigenvectors, consider the following unitary, $U = \sum\limits_{j=1}^{d} | \phi_{j} \rangle \langle \psi_{j} | $. It is easy to check that the action of the unitary channel is to transform the eigenvectors, $$\mathcal{U}( | \psi_{j} \rangle \langle \psi_{j} | ) := U ( | \psi_{j} \rangle \langle \psi_{j} | ) U^{\dagger} = | \phi_{j} \rangle \langle \phi_{j} | ~~\forall j.$$ +Therefore, $\mathcal{U}(\rho) = \sum\limits_{j=1}^{d} p_{j} | \phi_{j} \rangle \langle \phi_{j} | $, that is, the eigenvectors have been transformed. More generally, any time one wants to transform an orthonormal set of states $\{ |\psi_{j} \rangle \} \mapsto \{ |\phi_{j} \rangle \}$, we construct a unitary of the form above.

+

To transform the eigenvalues, first note that unitary operators cannot change the spectrum of a state, therefore, we need a non-unitary channel. Also, with the action of $\mathcal{U}$ above, both $\mathcal{U}(\rho)$ and $\sigma$ are in the same eigenbasis, so transforming the eigenvalues has a "classical" flavor to it. I can't think of an answer for the most general case (off the top of my head), but if $\{ p_{j} \}$ is ``less disordered'' than $\{ q_{j} \}$ (in the sense of vector majorization), then, one can show that +$$ \operatorname{spec}(\rho) \succ \operatorname{spec}(\sigma) \Longleftrightarrow \exists \mathcal{E}(\rho)=\sigma, $$ +where, $\vec{v} \succ \vec{w}$ is vector majorization, $\mathcal{E}$ is a unital CPTP map, and $\text{spec}(\rho)$ the spectrum of $\rho$. A proof of this can be found in Nielsen's (other!) book (warning: the book is in a .ps format).

+

Therefore, given two states, $\rho, \sigma$, if $\operatorname{spec}(\rho) \succ \operatorname{spec}(\sigma)$ then this transformation can be achieved by using a unitary channel $\mathcal{U}$ to transform the eigenvectors and a non-unitary channel $\mathcal{E}$ to transform the eigenvalues; composing these two, we have, $\mathcal{E} \circ \mathcal{U}$ is the channel that does the transformation.

+

Edit: For $\rho,\sigma$ pure, the above construction tells us that we only need a unitary transformation to connect them, as expected.

+",1108,,1108,,11/4/2020 8:12,11/4/2020 8:12,,,,0,,,,CC BY-SA 4.0 +14475,2,,14461,11/3/2020 22:32,,5,,"

That quantity appears to be identical to Holevo information, which turns out to be the upper bound on how much classical information you can transmit using a quantum channel [1].

+

More generally the Holevo information is an upper bound for a quantity called "accessible information" which is (roughly speaking) the maximum information you can learn from an optimal measurement performed on an ensemble of quantum states.

+
+

[1] Holevo, A. S. (1973). Bounds for the quantity of information transmitted by a quantum communication channel. Problemy Peredachi Informatsii, 9(3), 3-11.

+",1939,,,,,11/3/2020 22:32,,,,3,,,,CC BY-SA 4.0 +14476,1,,,11/4/2020 9:17,,1,253,"

Why 2 $H$ gates in series create a probability of 100% for one value of the qubit and 0% of the second value of the qubit since an $H$ gate acts like a superposition generator?

+",13670,,55,,11/10/2020 17:18,11/10/2020 17:18,Why 2 $H$ gates in series create a probability of 100% for one value of the qubit and 0% of the second value of the qubit?,,3,1,,,,CC BY-SA 4.0 +14477,2,,14476,11/4/2020 9:25,,10,,"

The reason for this is because the inverse of Hadamard gate is itself. That is, giving that

+

$$ H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1& 1\\ 1 & -1 \\ \end{pmatrix}$$

+

then

+

$$ H^{-1} = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1& 1\\ 1 & -1 \\ \end{pmatrix} $$

+

so therefore, $$HH|\psi\rangle = H H^{-1} |\psi \rangle = I |\psi \rangle = |\psi\rangle \ \ \ \textrm{where $I$ is the Identity operator.}$$

+

Now when $|\psi \rangle = |0 \rangle$, which is the starting state of your quantum circuit, then applying two consecutive Hadamard gates is the same as doing nothing... hence the qubit stayed at the state $|0\rangle$. Thus giving you a 100% probability is it the state $|0\rangle$.

+
+

To see this in the geometric sense, applying two consecutive Hadamard gates to the qubit in the state $|0\rangle$ is like doing the following rotations:

+

+

The first Hadamard gate rotate the qubit in the red trajectory to the state $|+\rangle = \dfrac{|0 \rangle + |1 \rangle}{\sqrt{2}} $. Then the second Hadamard gate rotate the qubit in the blue trajectory, back to the state $|0\rangle$ again.

+",9858,,9858,,11/4/2020 9:30,11/4/2020 9:30,,,,0,,,,CC BY-SA 4.0 +14478,2,,14456,11/4/2020 10:09,,4,,"

Given a state $\sigma$, the replacement channel is defined by the action +$$ +\mathcal{E}_{\sigma}(\rho) = \mathrm{Tr}(\rho) \sigma. +$$ +This channel trivially connects any state to $\sigma$. As Norbert pointed out this can be thought of operationally as first throwing away the system you have and then preparing a new system in the state $\sigma$. Indeed, we can view this channel as the composition of the trace channel $\mathrm{Tr}: \mathcal{H}_1 \rightarrow \mathbb{C}$ and a preparation channel $\mathcal{E}_{\mathrm{prep}} : \mathbb{C} \rightarrow \mathcal{H}_2$ where the action of the second channel is defined as $\mathcal{E}_{\mathrm{prep}}(\alpha) \rightarrow \alpha \sigma$.

+

To show the replacement channel is indeed a channel, by the spectral theorem we can define an orthonormal basis $\{|\psi_i\rangle \}_i$ of $\mathcal{H}_2$ such that $\sigma = \sum_i \lambda_i |\psi_i \rangle \langle \psi_i |$. Then take an orthonormal basis $\{|i\rangle\}_i$ of $\mathcal{H}_1$ and define the Kraus operators +$$ +K_{i,j} = \sqrt{\lambda_i} |\psi_i \rangle \langle j |. +$$ +Then we have +$$ +\begin{aligned} +\mathcal{E}(\rho) &= \sum_{i,j} K_{i,j} \rho K_{i,j}^* \\ +&= \sum_{i,j} \lambda_i |\psi_i \rangle \langle j | \rho |j \rangle \langle\psi_i | \\ +&= \sum_i \lambda_i |\psi_i \rangle \langle \psi_i | \sum_j \langle j | \rho | j \rangle \\ +&= \mathrm{Tr}[\rho] \sigma +\end{aligned} +$$ +and also +$$ +\begin{aligned} +\sum_{i,j} K_{i,j}^* K_{i,j} &= \sum_{i,j} \lambda_i |j \rangle \langle \psi_i | \psi_i \rangle \langle j | \\ +&= \sum_{i,j} \lambda_i |j \rangle \langle j | \\ +&= \sum_j |j \rangle \langle j | \\ +&= I +\end{aligned} +$$

+",9854,,,,,11/4/2020 10:09,,,,0,,,,CC BY-SA 4.0 +14479,2,,14417,11/4/2020 10:35,,1,,"

Thank you all for your help tracking this down. For future reference, the culprit was the usage of the function QuantumCircuit.initialize(params, qubits), which triggered an error out of some reason. Not sure why it fails in this case but not in others. The solution was to implement what the initialize function was supposed to do with basis gates.

+",13667,,,,,11/4/2020 10:35,,,,0,,,,CC BY-SA 4.0 +14480,1,,,11/4/2020 13:01,,4,329,"

In matrix notation, say I have the vector $\begin{bmatrix} 1 \\ 0 \end{bmatrix}$. It is currently represented in the computational basis $\{\begin{bmatrix} 1 \\ 0\end{bmatrix}, \begin{bmatrix} 0 \\ 1\end{bmatrix}\}$. I want to now represent it in the basis $\{\begin{bmatrix} \frac{1}{\sqrt 2} \\ \frac{1}{\sqrt 2}\end{bmatrix}, \begin{bmatrix} \frac{1}{\sqrt 2} \\ \frac{-1}{\sqrt 2}\end{bmatrix}\}$. To accomplish this, I use the correct change of basis matrix:

+

$$ +\begin{bmatrix} \frac{1}{\sqrt 2} & \frac{1}{\sqrt 2} \\ \frac{1}{\sqrt 2} &\frac{-1}{\sqrt 2}\end{bmatrix} \begin{bmatrix} 1 \\ 0\end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt 2} \\ \frac{1}{\sqrt 2}\end{bmatrix} +$$

+

When I see that final vector, I know to read it in the latter basis. And I can compute that the RHS in the second basis is in fact the LHS in the first basis.

+

Now, when I do the same thing with bra-ket notation, I have:

+

$$ +\left(|0\rangle \langle + | + |1 \rangle \langle -|\right)|0\rangle = \frac{|0\rangle + |1\rangle}{\sqrt 2} +$$

+

When I see the final result here, do I internally read $|0\rangle$ as $|+\rangle$ and $|1\rangle$ as $|-\rangle$?

+

The explicit writing of bases in the bra-ket notation I find slightly confusing.

+",2832,,55,,2/21/2021 13:19,2/21/2021 13:19,Difference between change of basis in bra-ket notation and matrix notation,,1,1,,,,CC BY-SA 4.0 +14481,2,,14480,11/4/2020 14:24,,3,,"

Expressing your first equality in bra-ket notation is simply $$H \vert 0 \rangle = \vert + \rangle.$$ In the spirit of your second equality, $H$ can be expressed as $$H \equiv \vert + \rangle \langle 0 \vert + \vert - \rangle \langle 1 \vert.$$ The advantage of this more verbose expression of $H$ is that it makes it very clear how $H$ transforms the computational basis states: +$$H \vert 0 \rangle = \vert + \rangle \langle 0 \vert 0 \rangle + \vert - \rangle \langle 1 \vert 0 \rangle = \vert + \rangle,$$ +since the value of the inner products, $\langle 0 \vert 0 \rangle = 1$ and $\langle 1 \vert 0 \rangle = 0$, should be immediately recognized. Note that the RHS of this equation gives the state in terms of the $\lbrace \vert + \rangle, \, \vert - \rangle \rbrace$ basis. In the RHS of your second equality, the state is still represented over the computational basis.

+",8623,,8623,,11/4/2020 15:03,11/4/2020 15:03,,,,0,,,,CC BY-SA 4.0 +14482,2,,14463,11/4/2020 16:49,,5,,"

If one had general information-theoretically secure MQPC, one would have 1-out-of-2 oblivious transfer (OT), as this can be obtained from an MPQC protocol computing the following 2-party function: consider a function $f(a_0,a_1,b_0,b_1)$ that takes as input two private bits $a_0,a_1$ from Alice (the two different messages) and two bits $b_0,b_1$ from Bob (first bit being Bob's choice of message to read and second a private key), and produces $$f(a_0,a_1,b_0,b_1)=a_{b_0}\oplus b_1$$ To get OT out of this, Bob simply has to randomize $b_1$. OT is known to imply bit commitment (in fact, the converse is also true in the quantum setting). As unconditionally secure bit commitment is impossible, so is OT and thus so is general information-theoretically secure MPQC.

+",13715,,,,,11/4/2020 16:49,,,,0,,,,CC BY-SA 4.0 +14483,1,14513,,11/4/2020 16:55,,0,51,"

I have read about the global and nonlocal variable and I know they may solve the problem, but as I'm still naive at this I couldn't figure out how to implement them to solve the UnboundLocalError. Sorry for the long program I put here:

+
 # initialization
+
+import numpy as np
+
+# import Qiskit
+
+from qiskit import IBMQ, BasicAer
+from qiskit.providers.ibmq import least_busy
+from qiskit import QuantumCircuit, execute
+from qiskit.tools.jupyter import *
+#provider= IBMQ.load.account()
+ provider= IBMQ.load_account()
+
+#import basic plot tools
+from qiskit.visualization import plot_histogram
+
+

Here is the Dj function

+
 def dj_oracle(case, n):
+#We need to make a QuantumCircuit object to return
+#This circuit has n+1 qubits: the size of the input,
+#plus one output qubit
+oracle_qc=QuantumCircuit(n+1)
+
+#First, let's deal with the case in which oracle is balanced
+
+if case == "balanced":
+    # We apply controlled-NOT gates for each qubit, using the
+    #output qubit as target
+    
+    for qubit in range(n):
+        oracle_qc.cx(qubit, n)
+        
+ # case in oracle is constant
+if case == "constant":
+
+# First decide what the fixed output of the oracle will be
+# (either always 0 or always 1)
+ 
+    output = np.random.randint(2)
+    
+if output == 1:
+    
+    oracle_qc.x(n)
+    
+oracle_gate = oracle_qc.to_gate()
+oracle_gate.name ="Oracle"
+return oracle_gate
+
+

and Here is the dj_algorithm

+
  def dj_algorithm(n, case='random'):
+dj_circuit=QuantumCircuit(n+1, n)
+# Set up the input register:
+for qubit in range(n):
+    dj_circuit.h(qubit)
+#And set up the output qubit:
+dj_circuit.x(n)
+dj_circuit.h(n)
+#Let's append the oracle gate to our circuit:
+
+if case == 'random':
+    random = np.random.randint(2)
+    if random == 0:
+        case = 'constant'
+else: 
+    case = 'balanced'
+    oracle = dj_oracle(case, n)
+    dj_circuit.append(oracle, range(n+1))
+ # Finally, perform the H-gates again and measure:
+for i in range(n):
+        dj_circuit.h(i)
+        dj_circuit.measure(i,i)
+return dj_circuit
+
+

Now when I want to use the local simulator to get the results, I face the UnboundLocalError, Can anybody help me to solve it?

+

This is the error I get:

+
+
  UnboundLocalError                         Traceback (most recent call last)
+  <ipython-input-112-f0c5e2ae7e9a> in <module>
+  2 backend = BasicAer.get_backend('qasm_simulator')
+  3 shots = 1024
+  ----> 4 dj_circuit = dj_algorithm(n,'constant')
+  5 results = execute(dj_circuit, backend=backend, shots=shots).result()
+  6 answer = results.get_counts()
+
+ <ipython-input-89-6104e1173619> in dj_algorithm(n, case)
+ 15     else:
+ 16         case = 'balanced'
+ ---> 17         oracle = dj_oracle(case, n)
+ 18         dj_circuit.append(oracle, range(n+1))
+ 19      # Finally, perform the H-gates again and measure:
+
+ <ipython-input-110-75bb51aa8b15> in dj_oracle(case, n)
+ 22         output = np.random.randint(2)
+ 23 
+ ---> 24     if output == 1:
+ 25 
+ 26         oracle_qc.x(n)
+
+ UnboundLocalError: local variable 'output' referenced before assignment
+
+",13698,,13698,,11/4/2020 18:51,11/6/2020 17:58,How do I fix the UnboundLocalError?,,1,2,,,,CC BY-SA 4.0 +14484,1,14485,,11/4/2020 18:48,,2,340,"

I have problem with implementation of the circuit below. How can I write down the conditional X-gate in the following circuit?

+

+",13137,,55,,11/10/2020 17:17,11/10/2020 17:17,Applying conditional X-gate in Qiskit,,1,0,,,,CC BY-SA 4.0 +14485,2,,14484,11/4/2020 18:52,,3,,"

This can be done in qiskit with c_if operation.

+

To construct the circuit that you are interested in in OPENQASM, you can do it as follow:

+
OPENQASM 2.0;
+include "qelib1.inc";
+
+qreg q[2];
+creg cw[1];
+creg cw2[1];
+
+
+z q[0];
+h q[1];
+h q[0];
+h q[1];
+z q[0];
+barrier q[0],q[1];
+measure q[0] -> cw[0];
+barrier q[0],q[1];
+if (cw==1) x q[1];
+barrier q[0],q[1];
+measure q[1] -> cw2[0];
+
+

The result circuit is:

+

+
+

Also look at this question and answer: Composing teleportation circuit in Qiskit Circuit Composer

+
+

Update: You can also run this with Qiskit as:

+
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+from numpy import pi
+
+qreg_q = QuantumRegister(2, 'q')
+creg_cw = ClassicalRegister(1, 'cw')
+creg_cw2 = ClassicalRegister(1, 'cw2')
+circuit = QuantumCircuit(qreg_q, creg_cw, creg_cw2)
+
+circuit.z(qreg_q[0])
+circuit.h(qreg_q[1])
+circuit.h(qreg_q[0])
+circuit.h(qreg_q[1])
+circuit.z(qreg_q[0])
+circuit.barrier(qreg_q[0], qreg_q[1])
+circuit.measure(qreg_q[0], creg_cw[0])
+circuit.barrier(qreg_q[0], qreg_q[1])
+circuit.x(qreg_q[1]).c_if(creg_cw, 1)
+circuit.barrier(qreg_q[0], qreg_q[1])
+circuit.measure(qreg_q[1], creg_cw2[0])
+
+circuit.draw('mpl', style={'name': 'iqx'})
+
+

It should be noted that if you compose your circuit in OPENQASM, there is an option that would allow you to convert it to Qiskit code. Look for this tab in circuit composer:

+

+",9858,,9858,,11/4/2020 19:09,11/4/2020 19:09,,,,1,,,,CC BY-SA 4.0 +14486,1,14492,,11/4/2020 21:53,,6,451,"

In this section of the Scholarpedia article on Bell's theorem, the first paragraph comments that Bell's original inequality is not ideal for experimental verification because it requires perfect anti-correlation of the variables, and for that reason the CHSH inequality is better. I don't really understand what this means, since as far as I'm aware experiments with e.g. the CHSH game also involve Bell pairs which are perfectly correlated. They allude to some continuity in the correlations, but I don't know what this means. Could anyone elucidate?

+",9168,,55,,11/10/2020 17:28,11/10/2020 17:28,Difference between Bell's inequality and CHSH,,1,0,,,,CC BY-SA 4.0 +14487,2,,9826,11/4/2020 22:09,,1,,"

I ran in to the same issue, here's the solution. It's because the base env for python is version 3.8.3 while any new env you activate is version 3.9 which isn't compatible with qiskit. So after activating your environment, run the command: +conda install python=3.8.3 +and then run +pip install qiskit

+",13449,,,,,11/4/2020 22:09,,,,0,,,,CC BY-SA 4.0 +14488,2,,14476,11/5/2020 7:39,,1,,"

Simply speaking, $H^2 = HH = I$ which is identity (you can verify this by direct matrix multiplication). As a result, such operator does not change anything in a quantum state.

+",9006,,,,,11/5/2020 7:39,,,,0,,,,CC BY-SA 4.0 +14489,1,14494,,11/5/2020 7:45,,1,100,"

Let's say I have a classical-quantum(cq) state $\rho_{XE}$, where the classical part $(X)$ is orthogonal. It's trace distance from another uniform density operator is defined to be:

+

$$ +\frac{1}{2}||\rho_{XE} - \rho_U \otimes \rho_E||_1. +$$

+

Now I apply a hash function $f$ from $F$ distributed according to probability $p_f$ on the first register and get a new state: +$$ +\rho_{F(X)E}:= \sum_f p_f \; \rho_{f(X)E}. +$$ +Then I notice that its trace distance has the following upper bound:

+

$$ +\frac{1}{2}||\rho_{F(X)E} - \rho_U \otimes \rho_E|| \le \epsilon . +$$ +Now, from this upper bound, what can I infer for the first trace distance, i.e. without the hash function? Would the following be true?

+

$$ +\frac{1}{2}||\rho_{XE} - \rho_U \otimes \rho_E|| \le \epsilon. +$$

+

Thanks!

+",2403,,,,,11/5/2020 9:43,Trace distance of two classical-quantum state with hashing,,1,0,,,,CC BY-SA 4.0 +14491,1,14520,,11/5/2020 7:57,,4,683,"

I am trying to solve Traveling Salesman Problem (TSP) in Qiskit based on Qiskit Tutorial.

+

I used TSP for four cities described by this distance matrix:

+

$$ +D = +\begin{pmatrix} +0 & 207 & 92 & 131 \\ +207 & 0 & 300 & 350 \\ +92 & 300 & 0 & 82\\ +131 & 350 & 82& 0 \\ +\end{pmatrix} +$$

+

With brute force I found two optimal solutions:

+
    +
  1. $0 \rightarrow 1 \rightarrow 2 \rightarrow 3 \rightarrow 0$
  2. +
  3. $0 \rightarrow 3 \rightarrow 2 \rightarrow 1 \rightarrow 0$
  4. +
+

A total distance is 720 for both solutions.

+

However, when I run the problem on qasm_simulator with TSP algorithm in qiskit.optimization.applications.ising library, the returned solution is $0 \rightarrow 2 \rightarrow 3 \rightarrow 1 \rightarrow 0$ with distance 873. But according to matrix $D$, the total distance should be 731.

+

I can understand that the quantum solver cannot reach the optimal solution but I am rather confused by miscalculated total distance for the solution which was found.

+

So my questions is what wrong in my code? Just note that solution for example in Qiskit Tutorial was found correctly.

+

My second question is how to set TSP solver to reach an optimal solution? I would expect that since I use a simulator, there is no noise and in the end I would reach the optimal solution.

+

EDIT: +It seems that if the code is rerun, the results are different. I reached the distance 731, user Egretta Thua even the optimal 720. However, the first city in solution should be the city no. 0 which was not the case both in my or Egretta code rerun.

+
+

Here is my code:

+
%matplotlib inline
+# Importing standard Qiskit libraries and configuring account
+from qiskit import QuantumCircuit, execute, Aer, IBMQ
+from qiskit.compiler import transpile, assemble
+from qiskit.tools.jupyter import *
+from qiskit.visualization import *
+#visualization tools
+import matplotlib.pyplot as plt
+import matplotlib.axes as axes
+#other tool
+import numpy as np
+import networkx as nx
+from itertools import permutations
+#quadratic program
+from qiskit.optimization import QuadraticProgram
+#TSP libraries
+from qiskit.optimization.applications.ising import tsp
+from qiskit.optimization.applications.ising.common import sample_most_likely
+#quantum computing optimization
+from qiskit.optimization.converters import IsingToQuadraticProgram
+from qiskit.aqua.algorithms import VQE, QAOA, NumPyMinimumEigensolver
+from qiskit.optimization.algorithms import MinimumEigenOptimizer
+
+#function for solving the TSP with brute force, i.e. generate all permutations and calc distances
+def brute_force_tsp(w):
+    N = len(w)
+    #generate tuples with all permutation of numbers 1,2...N-1
+    #first index is zero but we want to start our travel in the first city (i.e. with index 0)
+    a = list(permutations(range(1,N)))
+    
+    best_dist = 1e10 #distance at begining
+    
+    for i in a: #for all permutations
+        distance = 0
+        pre_j = 0 #starting in city 0
+        for j in i: #for each element of a permutation
+            distance = distance + w[pre_j,j] #going from one city to another
+            pre_j = j #save previous city
+        distance = distance + w[pre_j,0] #going back to city 0
+        order = (0,) + i #route description (i is permutation, 0 at the begining - the first city)
+        print('Order: ', order, ' Distance: ', distance) #show solutions
+        if distance < best_dist:
+            best_dist = distance
+            best_order = order           
+        
+    print('Route length: ', best_dist)
+    print('Route: ', best_order)    
+    
+    return best_dist, best_order
+
+#showing resulting route in graph
+def show_tsp_graph(route):
+    n = len(route)
+    #showing the route in graph
+    G = nx.Graph() #graph
+    G.add_nodes_from(range(0,n)) #add nodes
+    #adding edges based on solution    
+    for i in range(0,n-1):
+        G.add_edge(route[i], route[i+1])
+    G.add_edge(route[n-1], 0)
+    nx.draw_networkx(G) #show graph
+
+#decoding binary output of QAOA to actual solution
+def decodeQAOAresults(res):
+    n = int(len(res)**0.5)
+    results = np.zeros(n)
+    k = 0
+    for i in range(0,n): #each n elements refers to one time point i
+        for j in range(0,n): #in each time points there are all cities
+            #when x = 1 then the city j is visited in ith time point
+            if res[k] == 1: results[i] = j
+            k = k + 1
+    return results
+
+def tspQuantumSolver(distances, backendName):
+    citiesNumber = len(distances)
+    coordinates = np.zeros([citiesNumber, 2])
+    for i in range(0, citiesNumber): coordinates[i][0] = i + 1
+    
+    tspTask = tsp.TspData(name = 'TSP', dim = citiesNumber, w = distances, coord = coordinates)
+    
+    isingHamiltonian, offset = tsp.get_operator(tspTask)
+    
+    tspQubo = QuadraticProgram()
+    tspQubo.from_ising(isingHamiltonian, offset)
+    
+    quantumProcessor = Aer.backends(name = backendName)[0]
+    qaoa = MinimumEigenOptimizer(QAOA(quantum_instance = quantumProcessor))
+    results = qaoa.solve(tspQubo)
+    print('Route length: ', results.fval)
+    route = decodeQAOAresults(results.x)
+    print('Route: ', route)
+    
+    return results.fval, route
+
+distMatrix = np.array([[0,207,92,131],
+                       [207,0,300,350],
+                       [92,300,0,82],
+                       [131,350,82,0]
+                       ])
+
+#brute force solution
+lengthBrute, routeBrute = brute_force_tsp(distMatrix)
+show_tsp_graph(routeBrute)
+
+#quantum solution
+lengthQuantum, routeQuantum = tspQuantumSolver(distMatrix, 'qasm_simulator')
+show_tsp_graph(routeQuantum)
+
+
+",9006,,55,,11/10/2020 17:17,11/10/2020 17:17,Traveling salesman problem in Qiskit: cannot find a solution on simulator,,2,0,,,,CC BY-SA 4.0 +14492,2,,14486,11/5/2020 9:07,,5,,"

The difference is as follows:

+
    +
  • the original Bell inequality requires that outcomes from the same setting are always perfectly anti-correlated. It says nothing about the case where they are even marginally different.

    +
  • +
  • by contrast, in CHSH, the ideal (giving maximum violation) is that outcomes from the same setting would be anti-correlated, but it is not required.

    +
  • +
+

Thus, in an experiment with imperfections, CHSH still applies, but the original may not.

+",1837,,,,,11/5/2020 9:07,,,,3,,,,CC BY-SA 4.0 +14494,2,,14489,11/5/2020 9:43,,2,,"

No, this is not possible. The existence of such a hash function requires the (smooth) min-entropy of the initial state to be large enough but does not depend on its trace distance from a uniform state. For the simplest example possible let's forget about the side information $E$ and just focus on the $X$ system. The basic idea is that we can always pad $X$ with extra information such that the min-entropy stays constant but the distance from uniform grows.

+

Suppose $X$ is a random bit string of length $n$ such that the first bit $x_1$ is chosen uniformly at random and then $x_2, \dots, x_n$ are all $0$. Now the min-entropy is $- \log \max_{(x_1,\dots,x_n)} p(x_1,\dots, x_n) = 1$. Using, for example, Lemma 1 from [1] there is a hashing procedure such that we can extract 1 bit (i.e. $F(X)$ is a single bit) and +$$ +\frac12 \| F(X) - U_1\|_1 \leq 1/2 +$$ +where $U_k$ denotes a uniformly distributed random variable over $k$ bits. +But now we can calculate +$$ +\begin{aligned} +\frac12 \| X - U_n\|_1 &= \frac12\sum_{(x_1,\dots, x_n) \in \{0,1\}^n} |p(x_1,\dots,x_n) - 2^{-n}| \\ +&= \frac12\left(2 |\frac12 - 2^{-n}| + 2(2^{n-1} - 1)|2^{-n}| \right) \\ +&= 1 - 2^{1-n}. +\end{aligned} +$$ +Thus as $n\rightarrow \infty$ we get $\frac12 \| X - U_n\|_1 \rightarrow 1$ but it can always be hashed down to a single bit that is distance $1/2$ away from uniform. By considering larger uniform sequences at the beginning of $X$ you should be able to make this distance grow even further, i.e. the hashed tends to perfectly uniform but the non-hashed is almost perfectly distinguishable.

+",9854,,,,,11/5/2020 9:43,,,,0,,,,CC BY-SA 4.0 +14495,1,,,11/5/2020 12:05,,3,600,"

I have a problem when attempting to set up a PySCF driver for a hydrogen molecule from the QISKIT Chemistry tutorial: https://qiskit.org/documentation/tutorials/chemistry/01_electronic_structure.html.

+

The code:

+
from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule
+
+molecule = Molecule(geometry = [['H', [0., 0., 0.]],
+                                ['H', [0., 0., 0.735]]],
+                    charge = 0 , multiplicity = 1)
+
+driver = PySCFDriver(molecule = molecule, unit = UnitsType.ANGSTROM, basis = 'sto3g')
+
+

When this is run, I receive: ImportError: cannot import name 'Molecule' from 'qiskit.chemistry.drivers' (C:\Users\louis\anaconda3\lib\site-packages\qiskit\chemistry\drivers_init_.py) +I am not entirely sure what is causing this error and any help would be appreciated.

+",13724,,55,,11/10/2020 17:17,11/30/2022 22:03,ImportError when setting up PySCF driver,,1,0,,,,CC BY-SA 4.0 +14496,2,,14495,11/5/2020 12:28,,0,,"

The molecule was introduced in the latest release. You need qiskit aqua 0.8.0. Can you provide information of your qiskit versions and your operating system? In case you need to update to the latest version to run the tutorials.

+",2000,,,,,11/5/2020 12:28,,,,5,,,,CC BY-SA 4.0 +14497,1,,,11/5/2020 13:45,,2,341,"

I want to get a jordan_wigner_hamiltonians of a molecule-ion by using jordan_wignerget_fermion_operator(molecule.get_molecular_hamiltonian()). But I can only get the molecular Hamiltonians no matter how I set the charge and multiplicity.

+

How I can get a molecular Hamiltonians which have more (or less) electrons for example HeH+?

+",13725,,55,,11/10/2020 17:17,11/10/2020 17:17,How to get a molecular Hamiltonians in OpenFermion,,1,0,,,,CC BY-SA 4.0 +14499,1,14500,,11/5/2020 15:53,,1,66,"

Let us take the initial state with the particle located at the origin $|n=0\rangle$ and the coin state with +spin up $|0\rangle$. So, +$$ +|\psi(0)\rangle = |0\rangle|n=0\rangle, +$$ +where $|\psi(0)\rangle$ denotes the at the initial time and $|\psi(t)\rangle$ denotes the state of the quantum walk at time $t$.

+

Please, help me understand that, if on RHS we have a matrix product of two column vectors?

+",13517,,55,,11/10/2020 17:17,11/10/2020 17:17,What does the notation $|\psi(0)\rangle = |0\rangle|n=0\rangle$ mean?,,1,0,,,,CC BY-SA 4.0 +14500,2,,14499,11/5/2020 15:56,,2,,"

This is common shorthand for the tensor product. That is, you should read it as $|0 \rangle \otimes | n=0\rangle$.

+",9854,,,,,11/5/2020 15:56,,,,4,,,,CC BY-SA 4.0 +14501,1,14502,,11/5/2020 17:07,,2,119,"

When we apply coin step in the quantum walk, for example considering the H gate, we first do it's tensor product with Identity vector of the position Hilbert space. Why is this so? Please see below statement for more details:

+

+",13517,,55,,11/6/2020 8:30,11/6/2020 8:35,"Why, in a discrete-time quantum walk,we first apply the tensor product of the coin operation with the identity?",,3,0,,,,CC BY-SA 4.0 +14502,2,,14501,11/5/2020 17:15,,4,,"

You started with the state $|\psi \rangle = |0\rangle \otimes |0\rangle $ which belongs to the space $\mathbb{C}^2 \otimes \mathbb{C}^2$. To operate state on this space, your operator must also have the same dimension. Thus, you need to have $H \otimes I$ and not just $H$ if you want to operate the Hadamard gate $H$ on the first qubit. Operations on qubits are just matrix multiplication after all so you need to make sure you have the correct dimensionality. In this case, $H \otimes I$ does that. It makes sure you have the right dimension along with doing exactly what you were looking to do, by applying $H$ to the first qubit and leave the second qubit alone.

+
+

To be more explicit, we have the state $|00\rangle = \begin{pmatrix} 1 \\0 \\ 0 \\ 0 \end{pmatrix}$. The Hadamard gate, $H$, can be written in the computational basis as $H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} $. We can't apply $H$ to the state $|00\rangle$ directly, since the there is a mismatched in the dimensionality. However, +$$ H \otimes I = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix} \otimes \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\\ 1 & 0 & -1 & 0\\ 0 & 1 & 0 & -1\end{pmatrix} $$ +Now they have the same dimension, and if you apply this to the state $|00\rangle$, we have

+

\begin{align} (H\otimes I) (|0\rangle \otimes |0\rangle) &= \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\\ 1 & 0 & -1 & 0\\ 0 & 1 & 0 & -1\end{pmatrix} \begin{pmatrix} 1 \\0 \\ 0 \\ 0 \end{pmatrix} = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\0 \\ 1 \\ 0 \end{pmatrix} \\ +&= \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} \otimes \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \dfrac{|0\rangle + |1 \rangle}{\sqrt{2}}\otimes|0\rangle +\end{align}

+

Now, the above is the explicit way of writing out the operation in matrix form but as you can see, it is cumbersome and a lot more work than necessary. So often, we use the linear mapping property of tensor product, which tells us that $$(H\otimes I) (|0\rangle \otimes |0\rangle) = H \big(|0\rangle \big) \otimes I \big( |0\rangle \big) = \dfrac{|0\rangle + |1 \rangle}{\sqrt{2}} \otimes |0\rangle $$

+",9858,,9858,,11/5/2020 19:16,11/5/2020 19:16,,,,3,,,,CC BY-SA 4.0 +14503,2,,13629,11/5/2020 21:05,,9,,"

In addition to the accepted answer and @user1271772's examples, here is a circuit primitive referred to explicitly as a "T-gate gadget" in [1] (originally appearing in [2]):

+

+

where application of the $S$ gate is conditioned on measuring a "1" on the ancilla. The way this works is, for $|A\rangle = \frac{1}{\sqrt{2}} (|0\rangle + e^{i\pi/4} |1\rangle)$, an input state $| \psi \rangle = a|0\rangle + b|1\rangle$ coming in from the left is transformed like:

+

$$ +(a|0\rangle + b|1\rangle)(|0\rangle + e^{i\pi/4} |1\rangle) \rightarrow a|00 \rangle + a e^{i\pi/4} |01 \rangle + b|11\rangle + b e^{i\pi/4}|10 \rangle \\ += (a|0 \rangle + b e^{i\pi/4} |1\rangle )|0\rangle + (a e^{i\pi/4} |0\rangle + b|1\rangle)|1\rangle +$$

+

If the ancilla is measured as "0", the input state is projected onto $(a|0 \rangle + b e^{i\pi/4} |1\rangle ) = T|\psi\rangle$ and the gate succeeds. If the ancilla is measured as "1" you apply an $S$ gate on the input register to get

+

$$ +S(a e^{i\pi/4} |0\rangle + b|1\rangle) = (a e^{i\pi/4} |0\rangle + e^{i\pi/2} b|1\rangle) = e^{i\pi/4} (a |0\rangle + e^{i\pi/4} b|1\rangle) = e^{i\pi/4} T |\psi \rangle +$$

+

which recovers the desired $T$ gate up to a global phase.

+

This process falls under the umbrella of gate teleportation (based on normal quantum teleportation) and basically lets you apply non-clifford gates if you have access to states that contain the essential information about the gate you want to apply - for instance, $|A\rangle = T\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ contains the effects of the $T$ gate that we want to apply.

+
+

[1] Bravyi, S., & Gosset, D. (2016). Improved classical simulation of quantum circuits dominated by Clifford gates. Physical review letters, 116(25), 250501.

+

[2] Zhou, X., Leung, D. W., & Chuang, I. L. (2000). Methodology for quantum logic gate construction. Physical Review A, 62(5), 052316.

+",1939,,,,,11/5/2020 21:05,,,,0,,,,CC BY-SA 4.0 +14504,2,,14497,11/5/2020 21:42,,1,,"

Qiskit allows you to build the customized geometry of the molecule. You can also adjust the charge and multiplicity. For example, to build the Hydrogen molecule with a given equilibrium distance ED, you can write:

+
molecule = Molecule(geometry=[['H', [0., 0., 0.]],
+                              ['H', [0., 0., ed]]],
+                             charge=0, multiplicity=1)
+
+

Next, you can do this to get the Pauli operators:

+
qubit_op, _ = fermionic_transformation.transform(driver)
+
+

Finally this code gives you a dictionary of the weights and the decompositions of the Hamiltonian:

+
    decompositions = {}
+    for el in qubit_op.oplist:
+        ceof, pauli = [x.strip() for x in str(el).split('*')]
+        decompositions[pauli] = ceof
+
+

This tutorial explains every detail. Just make sure you have the latest version of Qiskit installed. +https://qiskit.org/documentation/tutorials/chemistry/01_electronic_structure.html

+",12489,,,,,11/5/2020 21:42,,,,0,,,,CC BY-SA 4.0 +14505,1,,,11/6/2020 2:35,,3,805,"

How do I get the amplitude of each qubit, like plot_bloch_multivector(), but not output the tensor product of all qubits.

+

In this case I need output [0.707, -0.707], [0, 1], [0.707, 0.707], [0.707, 0.707]. How can I get this?

+",13723,,55,,11/10/2020 17:35,11/10/2020 17:35,Qiskit get qubits from statevector,,1,0,,,,CC BY-SA 4.0 +14506,2,,14505,11/6/2020 3:06,,5,,"

You mean something like this?

+
from qiskit import Aer, execute, QuantumCircuit
+from qiskit.quantum_info import Statevector
+
+backend = Aer.get_backend("statevector_simulator")
+qc = QuantumCircuit(1, 1)
+qc.h(0)
+print(qc)
+result = execute(qc, backend=backend, shots=1).result()
+print('State Vector:', result.get_statevector() )
+
+
+

+
+

Update: If you have two qubits or more, then you can also use this function as shown here:

+
from qiskit import Aer, execute, QuantumCircuit
+from qiskit.quantum_info import Statevector
+
+backend = Aer.get_backend("statevector_simulator")
+qc = QuantumCircuit(2, 2)
+qc.h(0)
+qc.h(1)
+print(qc)
+result = execute(qc, backend=backend, shots=1).result()
+print('State Vector:', result.get_statevector() )
+
+

+
+

Now, if you are working with multi-qubit system then one of the thing you have to remember is that they might be entangled together. So you don't expect any two qubit state $|\psi \rangle \in \mathbb{C}^4$ can be written as $|\psi \rangle = |\phi_1 \rangle \otimes |\phi_2 \rangle $ where $|\phi_1\rangle$ and $|\phi_2\rangle$ belongs to $\mathbb{C}^2$. For example, if you look at this circuit:

+

+

You can't write each qubit state individually! That is the state $|\psi \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 0 \\ 0 \\ 1 \end{pmatrix} \neq \begin{pmatrix} a \\ b \end{pmatrix} \otimes \begin{pmatrix} c \\ d \end{pmatrix} $ with $a,b,c,d \in \mathbb{C}$ and $|a|^2 + |b|^2 =1 $ and $|c|^2 + |d|^2 = 1$.

+
+

Now the state is separable and you want to measure on one of them, you can do this:

+
from qiskit import Aer, execute, QuantumCircuit
+from qiskit.quantum_info import Statevector
+
+backend = Aer.get_backend("statevector_simulator")
+qc = QuantumCircuit(2, 1)
+qc.h(0)
+qc.h(1)
+qc.measure([1],[0])
+print(qc)
+result = execute(qc, backend=backend, shots=1).result()
+print('State Vector:', result.get_statevector() )
+
+

+

As you can see, the qubit that got measured will collapsed its state to either the state $|0\rangle$ or $|1\rangle$.... Now, if it collapsed to the state $|0\rangle$ then the State Vector now is $|\psi \rangle \otimes |0\rangle$ . Similarly, if it collapsed to the state $|1 \rangle$ then you get $|\psi \rangle \otimes | 1 \rangle$. Either way, this allow you to observe what $|\psi\rangle$ is now... For instance, the State vector above tells you that $|\psi \rangle$ is the the superposition state $\dfrac{|0\rangle + |1 \rangle}{\sqrt{2}}$, which is what you expected as you applied the Hadamard gate $H$ to it.

+

And I can extend this to higher system as well... Just measured the other states.

+
+

Now having said all that, if your circuit only consist of single qubit gates, then you can just decompose that to multiple circuits consisting of single qubit in each. This will make thing easier to consider!

+",9858,,9858,,11/6/2020 3:54,11/6/2020 3:54,,,,5,,,,CC BY-SA 4.0 +14507,1,14508,,11/6/2020 3:55,,4,1034,"

Suppose I want to perform the time-evolution simulation on the following Hamiltonians:

+

$$ +H_{1} = X_1+ Y_2 + Z_1\otimes Z_2 +\\ +H_{2} = X_1\otimes Y_2 + Z_1\otimes Z_2 +$$

+

Where $X,Y,Z$ are Pauli matrices. Since $[X_1,Y_2] = 0$, I can simultaneously perform the time evolution simulation of $X_1$ and $Y_2$. Thus, it seems like both Hamiltonians could be simulated using the following circuit ($\pi$ is just a random number):

+ +

Is this circuit looks right? If so, how can I tell the difference between these two Hamiltonians just by looking at the circuit?

+",12334,,21152,,10/11/2022 7:37,10/11/2022 7:37,How can I simulate Hamiltonians composed of Pauli matrices?,,1,5,,,,CC BY-SA 4.0 +14508,2,,14507,11/6/2020 5:24,,4,,"

The circuit to simulate the term $e^{i Z \otimes Z t}$ can be construct as

+

+

and the circuit to simulate the term $e^{i X \otimes Y t}$ can be construct as

+

+

Now to simulate $H = X \otimes Y + Z \otimes Z$, we can use Trotter approx with one time slice to get the following circuit to approximate $e^{i (X \otimes Y + Z \otimes Z) t}$ :

+

+

Now as commented by @tsgeorgios, in fact, $X \otimes Y$ and $Z \otimes Z$ are commute. That is,

+

$$ [X\otimes Y, Z \otimes Z] = X\otimes Y \cdot Z \otimes Z - Z \otimes Z \cdot X\otimes Y = \boldsymbol{0}$$

+

you can see this explicitly as follows: +$$ X \otimes Y = +\begin{pmatrix} +0 & 0 & 0 & -i\\ +0 & 0 & i & 0\\ +0 & -i & 0 & 0\\ +i & 0 & 0 & 0\\ +\end{pmatrix} \ \ \ \ \ \ \textrm{and} \ \ \ \ +Z \otimes Z = +\begin{pmatrix} +1 & 0 & 0 & 0\\ +0 & -1 & 0 & 0\\ +0 & 0 & -1 & 0\\ +0 & 0 & 0 & 1\\ +\end{pmatrix} +$$ +hence you can see that $$ X \otimes Y \cdot Z \otimes Z - Z \otimes Z \cdot X \otimes Y = \begin{pmatrix} +0 & 0 & 0 & 0\\ +0 & 0 & 0 & 0\\ +0 & 0 & 0 & 0\\ +0 & 0 & 0 & 0\\ +\end{pmatrix} $$

+

that is they are commute with one another. This is important because if two matrix $A$ and $B$ are commute then we have that (See here. ) +$$e^{A + B} = e^{A}e^{B}$$

+

What this tells us is that the above circuit is the exact representation of the term $e^{i (X \otimes Y + Z \otimes Z) t}$ and not just an approximation!

+
+
+

Now, the circuit to simulate $e^{i X \otimes I t}$ is:

+

+

and the circuit to simulate $e^{i I \otimes Y t}$ is:

+

+

As you can see, the Identity operator doesn't do anything! so you can ignore them out of the circuit.

+

Thus, the trotter approx circuit for $e^{i (X \otimes I + I \otimes Y + Z \otimes Z) t}$ is:

+

+
+

I would like to linked a very good and detail answer by @Davit Khachatryan to a similar question here.

+",9858,,9858,,11/6/2020 16:05,11/6/2020 16:05,,,,13,,,,CC BY-SA 4.0 +14509,2,,14501,11/6/2020 8:35,,1,,"

A (discrete-time) quantum walk can be thought of as the direct "quantization" of a classical random walk.

+

In a classical random walk, at each iteration, you flip a coin and move the walker in a direction conditionally to the result of the coin flip.

+

The quantum generalisation of this is to think of the "coin" as a "coin state", that is, a qubit, and to make the "coin flip" into a similarly unbiased quantum gate (although one can generalises this to allow for arbitrary quantum gates as coin operations).

+

The "coin operation" gate must therefore, by conception, be an operation that only affects the coin space. In your notation, a state such as $|0\rangle\otimes|0\rangle$ lives in the coin+walker space, with the first space being the coin space. It follows that to act locally on the coin space amounts to perform a local operation of the form $U\otimes I$.

+",55,,,,,11/6/2020 8:35,,,,0,,,,CC BY-SA 4.0 +14510,2,,14501,11/6/2020 8:35,,1,,"

The idea is that by applying Hadamard just to the coin and doing nothing to the position state, this is the equivalent of tossing the coin.

+

To see this in a very crude way, imagine applying Hadamard to a qubit in the state $|0\rangle$. You get a state $(|0\rangle+|1\rangle)/\sqrt{2}$ which, if we were to measure it, would be equivalent to a coin giving heads or tails with 50:50 probability.

+

The shift operator then says "depending on whether the coin is in heads or tails, update the position register appropriately".

+",1837,,,,,11/6/2020 8:35,,,,0,,,,CC BY-SA 4.0 +14512,2,,14491,11/6/2020 17:00,,2,,"

May be this should be added as a comment, but I do not have the privilege to add comments. +
Any way, I ran your code as it is and there was no errors:

+
Order:  (0, 1, 2, 3)  Distance:  720
+Order:  (0, 1, 3, 2)  Distance:  731
+Order:  (0, 2, 1, 3)  Distance:  873
+Order:  (0, 2, 3, 1)  Distance:  731
+Order:  (0, 3, 1, 2)  Distance:  873
+Order:  (0, 3, 2, 1)  Distance:  720
+Route length:  720
+Route:  (0, 1, 2, 3)
+Route length:  720.0
+Route:  [1. 2. 3. 0.]
+
+

OS: Windows 10
Qiskit version: 0.23.0

+",9474,,9474,,11/6/2020 17:06,11/6/2020 17:06,,,,1,,,,CC BY-SA 4.0 +14513,2,,14483,11/6/2020 17:58,,1,,"

This is a Python related question. I think it should be asked in stackoverflow

+


This error happens because you try to check the value of the variable output before assigning a value to it. +
As you may know, Python is space sensitive. Hence, the line where you check if output equals 1 will be executed regardless of case value. On the other hand, +the variable output will be initialized only if case equals "constant". +
This means this error will happen whenever case equals "balanced"

+",9474,,,,,11/6/2020 17:58,,,,0,,,,CC BY-SA 4.0 +14514,1,,,11/6/2020 20:40,,2,149,"

In the example on the Qiskit page (https://qiskit.org/textbook/ch-applications/hhl_tutorial.html#A.-Some-mathematical-background) section 3 for the HHL algorithm the author is trying to solve the system of equations written as $A \vec{x}=\vec{b}$, where: +$$ +A=\left(\begin{array}{cc} +1 & -1 / 3 \\ +-1 / 3 & 1 +\end{array}\right), \quad \vec{b}=\left(\begin{array}{c} +1 \\ +0 +\end{array}\right) \quad \text { and } \quad \vec{x}=\left(\begin{array}{c} +x_{1} \\ +x_{2} +\end{array}\right). +$$

+

The final state of the system implementing the algorithm is: +$$ +\frac{\frac{3}{2 \sqrt{2}}\left|u_{1}\right\rangle+\frac{3}{4 \sqrt{2}}\left|u_{2}\right\rangle}{\sqrt{45 / 32}}=\frac{|x\rangle}{\|x\|}. +$$ +Given that: +$$ +|x\rangle={\frac{3}{2 \sqrt{2}}\left|u_{1}\right\rangle+\frac{3}{4 \sqrt{2}}\left|u_{2}\right\rangle} +$$

+

where: +$$ +\left|u_{1}\right\rangle=\left(\begin{array}{c} +1 \\ +-1 +\end{array}\right) \quad \text { and } \quad\left|u_{2}\right\rangle=\left(\begin{array}{l} +1 \\ +1 +\end{array}\right). +$$

+

How do i determine the solution to the system which is $\left[\begin{array}{ll}1.125 & 0.375\end{array}\right]$?

+",13418,,,,,11/6/2020 21:27,HHL example solution on Qiskit,,0,0,,,,CC BY-SA 4.0 +14516,1,,,11/6/2020 22:59,,1,161,"

Newbie here - logged in to IBM Q Experience on a MacBook Air with up-to-date OS (macOS Catalina 10.15.7) and Safari browser (14.0). I can build a circuit in Circuit Composer, select a back-end in Run Settings, run my job on a QPU, and then I see the job appear in the Jobs tab on the right side of the Circuit Composer. I click on the job and it takes me to the results for the job. I see the sequence of steps for the job (created, transpiled, validated, in queue, running, completed). Under that I see Run Details: Back-end, run-mode, shots, status, last update. Under that I see the circuit which can be displayed as an image, Qasm or Qiskit. I do not see the histogram of states anywhere - nor do I see any menu item that would allow me to download this. The only downloads I see give me images of the circuit. How do I get the histogram of states?

+

![screenshot from IBM Q Experience showing circuit but no histogram of results]

+",13734,,55,,11/10/2020 17:33,11/10/2020 17:33,No histogram appears in my job results,,1,0,,,,CC BY-SA 4.0 +14517,2,,14516,11/6/2020 23:23,,1,,"

What is the status of the job? Can you screenshot and upload the image of what you see. +If the job is completed, then you will see the histogram output at the bottom of the page giving that the number of eigenbasis is not too large.

+

If your job is completed running, you will be able to see this:

+

+

Note that the job that you submit don't get run right the way as there is a queue so you might have to wait for a bit. But once it is done, you will see the histogram plot. For instance:

+

+
+

If you want, you can run your circuit through the Jupyter notebook environment in IBMQ Experience. The histogram will returned to you once your job is completed. Look at this notebook tutorial here.

+",9858,,,,,11/6/2020 23:23,,,,0,,,,CC BY-SA 4.0 +14518,2,,14218,11/7/2020 8:01,,9,,"

I'm writing an alternate proof because it uses some interesting tools, computes the value of these expressions, and gives some insights into how we can interpret the quantities in consideration.

+

The first term is $\mathbb{E}_{\mathrm{Haar}} \left[ \left\langle z | \rho | z \right\rangle \right] $, where $\rho := U | \psi_{0} \rangle \langle \psi_{0} | U^{\dagger} $, $U$ distributed Haar-uniformly, and $| \psi_{0} \rangle, | z \rangle$ are some fixed states.

+

Let's start by rewriting, +\begin{align} +\left\langle z | \rho | z \right\rangle &= \operatorname{Tr}\left( \rho | z \rangle \langle z | \right) = \operatorname{Tr}\left( U | \psi_{0} \rangle \langle \psi_{0} | U^{\dagger} | z \rangle \langle z | \right) \\ +&= \operatorname{Tr}\left( \hat{S} \left( U \otimes U^{\dagger} \right) \left( | \psi_{0} \rangle \langle \psi_{0} | \otimes | z \rangle \langle z | \right) \right), +\end{align} +where $\hat{S}$ is the SWAP operator and in the last equality, I've used the lemma, +\begin{align} + \operatorname{Tr}\left( X Y \right) = \operatorname{Tr}\left( \hat{S} X \otimes Y \right). +\end{align}

+

Now, Haar-averaging the expectation value is equivalent to, +\begin{align} + \mathbb{E}_{U \sim \mathrm{Haar}} \left[ \left\langle z | \rho | z \right\rangle \right] &= \mathbb{E}_{U \sim \mathrm{Haar}} \left[ \operatorname{Tr}\left( \hat{S} \left( U \otimes U^{\dagger} \right) \left( | \psi_{0} \rangle \langle \psi_{0} | \otimes | z \rangle \langle z | \right) \right) \right]. +\end{align}

+

Using another (wonderful) lemma, +\begin{align} + \int_{U \sim \mathrm{Haar}} dU U \otimes U^{\dagger} = \frac{\hat{S}}{d}, +\end{align}

+

and noticing that the trace is linear, we can perform the Haar-average above to obtain, +\begin{align} + \mathbb{E}_{U \sim \mathrm{Haar}} \left[ \left\langle z | \rho | z \right\rangle \right] = \frac{1}{d} \operatorname{Tr}\left( \hat{S} \left( \hat{S} \right) \left( | \psi_{0} \rangle \langle \psi_{0} | \otimes | z \rangle \langle z | \right) \right). +\end{align}

+

Moreover $\hat{S}^{2} = I$, that is, swapping twice does nothing, and so we have, +\begin{align} + \mathbb{E}_{U \sim \mathrm{Haar}} \left[ \left\langle z | \rho | z \right\rangle \right] = \frac{1}{d} \operatorname{Tr}\left( \left( | \psi_{0} \rangle \langle \psi_{0} | \otimes | z \rangle \langle z | \right) \right) = \frac{1}{d} \operatorname{Tr}\left( | \psi_{0} \rangle \langle \psi_{0} | \right) \operatorname{Tr}\left( | z \rangle \langle z | \right), +\end{align} +where we've used $\operatorname{Tr}\left( A \otimes B \right) = \operatorname{Tr}\left( A \right) \operatorname{Tr}\left( B \right)$.

+

Since both $| z \rangle, | \psi_{0} \rangle$ are normalized, we have, +\begin{align} + \mathbb{E}_{U \sim \mathrm{Haar}} \left[ \left\langle z | \rho | z \right\rangle \right] = \frac{1}{d}. +\end{align}

+

What does this mean? Note that $\left\langle z | \rho | z \right\rangle = \left| \left\langle z | U | \psi_{0} \right\rangle \right|^{2}$, that is, it measures the probability to find a random state $U | \psi_{0} \rangle$ in the state $| z \rangle$. Since $U| \psi_{0} \rangle$ is (Haar-)uniformly distributed, the probability to find it in some state $| z \rangle$ is also uniformly distributed, i.e., $\frac{1}{d}$. Also, note that, the final result does not depend on either the choice of the initial state $| \psi_{0} \rangle$ or the state $| z \rangle$, reflecting our choice of the uniform measure.

+
+

For the second quantity, we follow a similar calculation. We have, $\sigma = \mathbb{E}_{U \sim \mathrm{diag}} \left[ U \rho U^{\dagger} \right] $, i.e., we average over diagonal unitaries uniformly distributed in some basis, let's call it $\mathbb{B}$.

+

Consider the spectral decomposition $U = \sum\limits_{j=1}^{d} e^{i \phi_{j}} \Pi_{j}$, where $\{ \Pi_{j} \} = \mathbb{B}$. Then, +\begin{align} + \sigma = \mathbb{E}_{U \sim \mathrm{diag}} \left[ U \rho U^{\dagger} \right] = \mathbb{E}_{U \sim \mathrm{diag}} \left[ \sum\limits_{j,k}^{d} e^{i \left( \phi_{j} - \phi_{k} \right)} \Pi_{j} \rho \Pi_{k}^{\dagger} \right] . +\end{align}

+

Now, the uniform distribution over unitaries diagonal in $\mathbb{B}$ is essentially a uniform distribution over the phases $\{ \phi \}$. An average over these phases gives us $\int_{\phi \sim \mathrm{uniform}[0, 2\pi]} d \phi e^{i \left( \phi_{j} - \phi_{k} \right)} = \delta_{j,k}$. Therefore, +\begin{align} + \mathbb{E}_{U \sim \mathrm{diag}} \left[ \sum\limits_{j,k}^{d} e^{i \left( \phi_{j} - \phi_{k} \right)} \Pi_{j} \rho \Pi_{k}^{\dagger} \right] = \sum\limits_{j}^{d} \Pi_{j} \rho \Pi_{j} \equiv \mathcal{D}_{\mathbb{B}} \left( \rho \right), +\end{align} +where $\mathcal{D}_{\mathbb{B}} (\cdot) \equiv \sum\limits_{j=1}^{d} \Pi_{j} \left( \cdot \right) \Pi_{j}$ is the dephasing superoperator. Putting it all together, we have that the action of averaging uniformly over diagonal unitaries in a basis $\mathbb{B}$ is to dephase the state in the basis $\mathbb{B}$, i.e., +\begin{align} + \sigma = \mathbb{E}_{U \sim \mathrm{diag}} \left[ U \rho U^{\dagger} \right] = \mathcal{D}_{\mathbb{B}}(\rho). +\end{align}

+

We're now ready to evaluate +\begin{align} + \mathbb{E}_{U \sim \mathrm{Haar}} \left\langle z | \sigma | z \right\rangle &= \mathbb{E}_{U \sim \mathrm{Haar}} \operatorname{Tr}\left( \sigma | z \rangle \langle z | \right) = \mathbb{E}_{U \sim \mathrm{Haar}} \operatorname{Tr}\left( \mathcal{D}_{\mathbb{B}} (\rho) | z \rangle \langle z | \right) +\\ &= \mathbb{E}_{U \sim \mathrm{Haar}} \operatorname{Tr}\left( \rho \mathcal{D}_{\mathbb{B}} \left( | z \rangle \langle z | \right) \right), +\end{align} +where in the last equality I've used the self-adjointness of the dephasing superoperator -- which can be easily verified using the Kraus form above and the cyclicity of the trace -- which is used to "transfer" its action onto $| z \rangle \langle z | $ instead.

+

Now this quantity is in a form as the first one, namely, +\begin{align} + \mathbb{E}_{U \sim \mathrm{Haar}} \left\langle z | \sigma | z \right\rangle &= \mathbb{E}_{U \sim \mathrm{Haar}} \operatorname{Tr}\left( \rho \mathcal{D}_{\mathbb{B}} \left( | z \rangle \langle z | \right) \right) \\ +&= \mathbb{E}_{U \sim \mathrm{Haar}} \operatorname{Tr}\left( U | \psi_{0} \rangle \langle \psi_{0} | U^{\dagger} \mathcal{D}_{\mathbb{B}} \left( | z \rangle \langle z | \right) \right) \\ +&= \mathbb{E}_{U \sim \mathrm{Haar}} \operatorname{Tr}\left( \hat{S} \left( U \otimes U^{\dagger} \right) \left( | \psi_{0} \rangle \langle \psi_{0} | \otimes \mathcal{D}_{\mathbb{B}} \left( | z \rangle \langle z | \right) \right)\right), +\end{align}

+

where in the last line I've used the SWAP trick as above. Then, performing the Haar average, and using $\hat{S}^{2} = I$, we have, +\begin{align} + \mathbb{E}_{U \sim \mathrm{Haar}} \left\langle z | \sigma | z \right\rangle = \frac{1}{d} \operatorname{Tr}\left( | \psi_{0} \rangle \langle \psi_{0} | \right) \operatorname{Tr}\left( \mathcal{D}_{\mathbb{B}} \left( | z \rangle \langle z | \right) \right) = \frac{1}{d}, +\end{align} +since both traces above are equal to one.

+

What does this quantity mean? Since $\left\langle z | \sigma | z \right\rangle = \left\langle z | \mathcal{D}_{\mathbb{B}} (\rho) | z \right\rangle$, this is equal to the fidelity between a fixed state $| z \rangle$ and a random state $\rho$ dephased in some basis $\mathbb{B}$. Once again, because the state $U | \psi_{0} \rangle$ is uniformly distributed, the fidelity equals that between two random states.

+

In closing, both averages are equal to $1/d$. That is, +\begin{align} + \mathbb{E}_{U \sim \mathrm{Haar}} \left\langle z | \rho | z \right\rangle = \frac{1}{d} = \mathbb{E}_{U \sim \mathrm{Haar}} \left\langle z | \sigma | z \right\rangle +\end{align}

+
+

I'm also listing some references for the "swap trick" used above. It can be used for Measuring polynomial functions of states. In the high-energy literature, this has been dubbed the "replica trick" (since we have many copies of the original space; although the exact correspondence is disguised because of the twist operators in field theory). It has also been used to compute entanglement in a ground-breaking experiment and Monte-Carlo simulations. And finally, it can be used to linearize the measurement of the $\alpha$-Renyi entropies, see this wonderful paper; although there might be earlier (and better) references.

+",1108,,1108,,11/8/2020 10:51,11/8/2020 10:51,,,,9,,,,CC BY-SA 4.0 +14519,1,,,11/7/2020 9:54,,3,411,"

How can I construct the below 2-qubit state using suitable single qubit gates (maximum 3) and one CNOT gate starting with state $|00\rangle$?

+

$$ +|\omega\rangle=\frac{1}{3}(2|00\rangle+|01\rangle+2|11\rangle) +$$

+",13735,,55,,11/10/2020 17:33,11/10/2020 17:33,How can I construct a 2-qubit state using single qubit gates and CNOT gate?,,3,1,,,,CC BY-SA 4.0 +14520,2,,14491,11/7/2020 9:59,,1,,"

Qiskit has a tutorial documentation about TSP, you can find more detail at that site. +As for the problem of your code, I suggest you use the qiskit-built function

+
tsp.random_tsp(3,seed=123) # 3 for three cities
+
+

to generate the route, instead of a single distance matrix you have written. Because tsp.random_tsp(3,seed=123) generates the coordinates and distance matrix correspondingly, while your coordinates are simply a $i$ iteration.

+

To see the difference between the two methods, +

+

you can use the coordinates to calculate your density matrix, while your own method will be problematic at this phase.

+

(A list of coordinates [[1,0],[2,0],[3,0],[4,0]] cannot generate a distance matrix [[0,207,92,131],[207,0,300,350],[92,300,0,82],[131,350,82,0]] unless your tsp space is highly inhomogeneous.)

+

Here ends my investigation, I have not tested further. Discussions are welcomed.

+",13647,,9006,,11/8/2020 6:47,11/8/2020 6:47,,,,2,,,,CC BY-SA 4.0 +14521,2,,14519,11/7/2020 17:20,,2,,"

Below is a circuit that can generate the state $|w\rangle$ that you wanted. However, It is NOT what you are looking for as it is using 2 CNOTs gate.

+

+

and if you look at the state vector output, you can see that it is indeed the correct state:

+

+
+

Hopefully someone will be able give you an answer that you are looking for :)

+",9858,,,,,11/7/2020 17:20,,,,3,,,,CC BY-SA 4.0 +14522,1,,,11/7/2020 17:55,,-1,96,"

To perform quantum walk first we need to define combine hilbert space for the position and coin, which is represented by: $H=H_p\bigotimes H_c$
+Now, my question is what is the use of above representation, if all the operation are defined on initial state. For example here, $| \psi(0)\rangle = |0\rangle\bigotimes\mid n=0\rangle$
+Here, first vector is coin with initial state $0$ and second vector is walker at initial node $0$.

+",13517,,1859,,11/8/2020 6:03,11/10/2020 17:32,Use of Position Hilbert Space in Quantum Walk,,1,6,,,,CC BY-SA 4.0 +14523,1,,,11/7/2020 18:21,,1,64,"

I encountered notions of block length and error rate for quantum error correcting codes, which literature seems to just assume. Can someone please give precise definitions for these?

+

Usually we denote a quantum code by parameters $[[n,k,d]]$. Where $n$ is the number of physcial qubits used, $k$ - number of encoded (or logical) qubits, and $d$ the code distance.

+

Besides the definitions, how are block length and error rate related to those parameters $n,k$ and $d$?

+",13616,,,,,11/13/2020 9:04,Quantum error correction: block length and error rate definitions,,1,0,,,,CC BY-SA 4.0 +14524,2,,14519,11/7/2020 19:20,,3,,"

Using only one CNOT gate and 3 single qubit gates:

+

+

Where: +$$ +\mathrm{U3}(\theta,\phi,\lambda)= +\begin{pmatrix} +\cos(\theta/2) & -\mathrm{e}^{i\lambda}\sin(\theta/2) \\ +\mathrm{e}^{i\phi}\sin(\theta/2) & \mathrm{e}^{i(\phi+\lambda)}\cos(\theta/2) +\end{pmatrix} +$$

+


To prepare a state, you can use Qiskit's QuantumCircuit.initialize. But when I used this method, the constructed circuit contains 2 CNOTs even with maximum optimization_level. +Qiskit provides another method, QuantumCircuit.iso, which yields the circuit shown above. +

Code:

+
# Using QuantumCircuit.initialize
+qc = QuantumCircuit(2)
+qc.initialize([2/3, 1/3, 0, 2/3], [0, 1])
+
+qc_by_initialize = transpile(qc, basis_gates=['u3','cx'], optimization_level = 3)
+qc_by_initialize.draw('mpl')
+
+
+# Using QuantumCircuit.iso
+qc = QuantumCircuit(2)
+qc.iso([2/3, 1/3, 0, 2/3], [0, 1], [])
+
+qc_by_isometry = transpile(qc, basis_gates=['u3','cx'], optimization_level = 3)
+qc_by_isometry.draw('mpl')
+
+",9474,,,,,11/7/2020 19:20,,,,0,,,,CC BY-SA 4.0 +14525,1,,,11/7/2020 22:58,,2,139,"

I have been learning about quantum error correction using the zero-noise extrapolation method from this paper and have been pleased with the results. This method takes advantage of the fact that the quantum gate noise is predictable as seen, for example, in the plot below. Here, I have taken a simple 2-qubit circuit given by qc.x(0), qc.h(0), qc.cx(0,1), qc.x(0) and added noise to it in the form of pairs of CNOT gates (a noisey identity matrix). I am plotting the $|01\rangle$ solution for this circuit as a function of the number of CNOT pairs that I used. This is done using the qiskit noise model with the IBMQ-montreal gate error rates. Note that the real solution is 0.5.

+

+

Clearly, the noise follows a very predictable relationship which to me is unexpected. Instead, what I expected was the noise to be scattered evenly across the real solution (0.5) with the amount of scatter being proportional to the number of gates, as shown in the made up plot below.

+

+

My question is, why does the noise follow the predictable curve instead of a random scattering about the real solution? And a follow up question, for an arbitrary circuit, how can I predict what the curve will look like?

+

Update: I ran my noisy circuits on the real IBMQ-athens machine to see if it is anywhere close to the simulated results. The plot is below is meant to be the same as the first plot (except the maximum depth is a less because I could not exceed 900).

+

+

Clearly the noise is no where near as organized as in the simulated version. What I don't know is if that was a failure on my part to simulate the noise correctly, or if it is a problem of the qiskit noise simulator itself.

+",13244,,13244,,11/8/2020 2:11,11/8/2020 2:11,Why and how is quantum noise predictable?,,1,5,,,,CC BY-SA 4.0 +14526,2,,14525,11/7/2020 23:53,,1,,"

The curve you are observing seems intuitive to me, since it shows how decoherence works. As you add more gates the state of the qubits tend to the ground state asymptotically .

+

+

You can probably use T1 and T2 to predict the curve.

+",1859,,1859,,11/8/2020 0:12,11/8/2020 0:12,,,,5,,,11/8/2020 0:03,CC BY-SA 4.0 +14527,1,,,11/8/2020 0:30,,2,108,"

I've been trying to perform Grover's algorithm on entangled states, e.g. $|00\rangle + |11\rangle$. However, the algorithm apparently doesn't seem to amplify the amplitude of the state $|11\rangle$ which I have marked. Instead it only applies a net effect of a phase flip, despite applying both oracle and diffusion operator. Is Grover search only applicable to uniform, "pure" states?

+",9633,,1859,,11/8/2020 1:31,11/8/2020 6:55,Is Grover's algorithm only applicable to a pure state?,,1,2,,,,CC BY-SA 4.0 +14528,2,,14527,11/8/2020 6:55,,2,,"

The problem is that you have only two states in your database. So when you mark state $|00\rangle$ its amplitude is $-1$ while the other state has amplitued $1$ (note that I ignore normalization constants). Hence an average of amplitudes is zero. When you flip the amplitudes around the zero average, the amplitudes still have absoute value $1$. As a result, you cannot increase a probability of the marked state.

+",9006,,,,,11/8/2020 6:55,,,,4,,,,CC BY-SA 4.0 +14529,2,,14241,11/8/2020 12:06,,0,,"

Since you can produce the GHZ state, I will skip the corresponding code and just use that QuantumCircuit object to build a density matrix $|GHZ><GHZ|$.

+
from qiskit.quantum_info import DensityMatrix
+DM=DensityMatrix.from_instruction(circuit)
+# here circuit denotes the circuit that contains your GHZ state.
+
+

Or there is another way to do so(not recommended, just for reference).

+
from qiskit.aqua.operators import StateFn
+psi=StateFn(circuit)# produce the state vector
+DM=(psi@~psi).eval()# state ket tensor state bra =density matrix
+# When calling StateFn function, the quantum circuit must not contain classical register
+
+

But note that the density matrix produced by the latter method is not admitted by qiskit, because the DensityMatrix object in qiskit has two attributes(the matrix itself and its dimension).

+",13647,,,,,11/8/2020 12:06,,,,0,,,,CC BY-SA 4.0 +14530,1,14535,,11/8/2020 13:42,,2,128,"

+

How to convert from current state: $$|\psi \rangle =\dfrac{ |01 \rangle + |10 \rangle - |11 \rangle}{\sqrt{3}}$$

+

into a target state

+

$$|\phi \rangle = \dfrac{|01 \rangle - |10 \rangle + |11 \rangle}{\sqrt{3}} $$

+

using only X, Z & H gates? TIA.

+",13749,,1859,,11/10/2020 12:36,11/10/2020 17:39,Transforming $|01 \rangle + |10 \rangle - |11 \rangle \to |01 \rangle - |10 \rangle + |11 \rangle$,,2,2,,,,CC BY-SA 4.0 +14531,2,,14530,11/8/2020 15:04,,4,,"

Apply a Z gate to the first qubit:

+

$$ +Z_1 (|01\rangle + |10\rangle - |11\rangle) = (Z|0\rangle)|1\rangle + (Z|1\rangle)|0\rangle - (Z|1\rangle)|1\rangle) = |01\rangle - |10\rangle + |11\rangle +$$

+",4622,,,,,11/8/2020 15:04,,,,0,,,,CC BY-SA 4.0 +14532,1,14536,,11/8/2020 17:01,,2,149,"

I suppose a quantum state with density matrix like the following is not valid. +$$ +\begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}. +$$

+

Now, let's say I have a valid density operator representing the state $|\psi \rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1 \rangle)$. +$$ +|\psi \rangle \langle\psi | = \frac{1}{2}(|0\rangle \langle 0| + |0\rangle \langle 1| + |1\rangle \langle 0| + |1\rangle \langle 1|) = \frac{1}{2} \begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}. +$$

+

Now I send this state to depolarizing channel $\mathcal{E}$. Because $\mathcal{E}$ is linear: +$$ +\mathcal{E}(|\psi \rangle \langle\psi |) = \frac{1}{2}(\mathcal{E}(|0\rangle \langle 0|) + \mathcal{E}(|0\rangle \langle 1|) + \mathcal{E}(|1\rangle \langle 0|) + \mathcal{E}(|1\rangle \langle 1|)). +$$

+

I'm wondering what the depolarization of $\mathcal{E}(|0\rangle \langle 1|)$ would mean. By definition of depolarizing channel, for noise parameter $p$,

+

$$ +\mathcal{E}(\rho) = (1 - p)\rho + \frac{pI}{2}. +$$

+

But then, what is the meaning of $\mathcal{E}(|0\rangle \langle 1|)$?

+",2403,,,,,11/8/2020 19:53,Depolarization of density operator with zeros in diagonal,,1,2,,,,CC BY-SA 4.0 +14533,2,,14519,11/8/2020 17:10,,2,,"

If you want to understand how to do this, think of the Schmidt decomposition. This shows you that, up to unitaries on the two qubits, the state can be written in the form $\alpha|00\rangle+\beta|11\rangle$. Now, can you answer your own question for this state?

+",1837,,,,,11/8/2020 17:10,,,,1,,,,CC BY-SA 4.0 +14534,2,,9826,11/8/2020 17:34,,3,,"

Looks like qiskit does not support Python 3.9.x yet. Make sure to create your environment with the latest Python 3.8.x instead. Here are the steps to resolve the issue:

+
    +
  1. Create your virtual environment:
  2. +
+
$ conda create -n my-quantum-env python=3.8
+
+
    +
  1. Activate your environment:
  2. +
+
$ conda activate my-quantum-env
+
+
    +
  1. Install qiskit.
  2. +
+
(my-quantum-env) $ pip install qiskit
+
+",13751,,,,,11/8/2020 17:34,,,,2,,,,CC BY-SA 4.0 +14535,2,,14530,11/8/2020 18:27,,4,,"

The other answer by @chrysaor4 is exactly right! I would just like to add a few additional clarification steps (that might or might not be useful)... simply because I have some time while waiting for someone doing shopping... :)

+

First of, we know that the Paulis $X,Z$ and Hadamard gate $H$ take the form

+

$$ +X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \ \ \ \ \ \ \ \ +Z = \begin{pmatrix} 1 & 0\\ 0 & -1 \end{pmatrix} \ \ \ \ \ \ \ \ +H= \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1\\ 1 & -1 \end{pmatrix} +$$

+

Taking the computation basis $\{ |0 \rangle, |1\rangle\}$ which defined as $|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$ and $|1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$ then we can see that

+

$$ X|0 \rangle = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \end{pmatrix} = |1 \rangle \ \ \ \ \textrm{and} \ \ \ \ + X|1 \rangle = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \end{pmatrix} = |0 \rangle +$$

+

similarly

+

$$ Z|0 \rangle = \begin{pmatrix} 1 & 0\\ 0 & -1 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \end{pmatrix} = |0 \rangle \ \ \ \ \textrm{and} \ \ \ \ +Z|1 \rangle = \begin{pmatrix} 1 & 0\\ 0 & -1 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 0 \\ -1 \end{pmatrix} =-|1 \rangle +$$

+

and you can also show that

+

$$ H|0\rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \ \ \ \ \textrm{and} \ \ \ \ +H|1 \rangle = \dfrac{|0\rangle - |1\rangle}{\sqrt{2}} $$

+

From the computations above, we have found out what each of the gates $X,Z, H$ do to the state $|0\rangle $ and $|1\rangle$ respectively.

+
+

Now your goal is to transform the state $\dfrac{ |01\rangle + |10 \rangle - |11\rangle}{\sqrt{3}} $ to the state $\dfrac{ |01\rangle - |10 \rangle + |11\rangle}{\sqrt{3}} $.

+

The transformation fixed the basis states and only changes sign on the second and third basis state. Now if you look back on the computations we did above you can see that the gate $Z$ is something that we would want to use. As it keep the basis state fixed and only change the sign when the state is $|1\rangle$.

+

This tells us that we should apply the $Z$ gate on the first qubit.

+

Now, applying $Z$ on the first qubit and do nothing on the second qubit is simply the operation $Z \otimes I$. Here $I$ is the idenity matrix so it tells us to do nothing to the second qubit. In the circuit representation, this is simply:

+

+

And this operation $Z \otimes I$ does explicitly the following:

+

$$ (Z \otimes I) |01\rangle = Z|0\rangle \otimes I |1\rangle = |0\rangle \otimes |1 \rangle = |0 1\rangle $$ +and +$$ (Z \otimes I) |10\rangle = Z|1\rangle \otimes I |0\rangle = -|1\rangle \otimes |0 \rangle = -|1 0\rangle $$ +and +$$ (Z \otimes I) |11\rangle = Z|1\rangle \otimes I |1\rangle = -|1\rangle \otimes |1\rangle = -|1 1\rangle $$

+

And because of linearity we have then ,

+

$$ Z \otimes I \bigg( \dfrac{|01\rangle + |10 \rangle - |11\rangle}{\sqrt{3}} \bigg) = \dfrac{|01\rangle - |10 \rangle + |11\rangle}{\sqrt{3}} $$

+

Thus, the above circuit is exactly what you are looking for.

+",9858,,13760,,11/10/2020 17:39,11/10/2020 17:39,,,,0,,,,CC BY-SA 4.0 +14536,2,,14532,11/8/2020 19:53,,4,,"

Quantum channels are foremost, linear operators. So given a basis for the Hilbert-Schmidt operator space (for example the states $\{|0\rangle\langle 0|,|0\rangle\langle 1|,|1\rangle\langle 0|,|1\rangle\langle 1|\}$ that you've chosen above), where density matrices reside, it acts linearly on the basis elements. Perhaps, the easiest way to see it is to write it in the Kraus form, $$\mathcal{E}(X) = \sum\limits_{j}^{} K_{j} X K_{j}^{\dagger}$$ with $\sum\limits_{j}^{} K_{j}^{\dagger} K_{j} = \mathbb{I}$, where its linear action is more "transparent" (I'm assuming the convex-combination way of writing is what's confusing you here). With this, the action of $\mathcal{E}$ on $| 0 \rangle \langle 1 | $ is $\mathcal{E}(| 0 \rangle \langle 1 | ) = \sum\limits_{j}^{} K_{j} | 0 \rangle \langle 1 | K_{j}^{\dagger}$, whatever that's equal to.

+

There is no "meaning" of $\mathcal{E}(|0\rangle\langle 1|)$ because $|0\rangle\langle 1|$ is not a state; so don't worry about interpreting it.

+",1108,,,,,11/8/2020 19:53,,,,0,,,,CC BY-SA 4.0 +14537,1,14540,,11/8/2020 22:23,,4,347,"

I'm trying to implement the same Jupyter notebook Jin-Sung Kim gave in his YouTube video The Variational Quantum Eigensolver — Programming on Quantum Computers — Coding with Qiskit S2E4; however, I'm facing the error as below:

+

Error:

+
step 0
+/Users/bambrozi/.local/share/virtualenvs/ibm-quantum-challenge-2020-ZWRg31rS/lib/python3.8/site-packages/qiskit/chemistry/core/hamiltonian.py:91: DeprecationWarning: The ChemistryOperator is deprecated as of Qiskit Aqua 0.8.0 and will be removed no earlier than 3 months after the release date. Instead, the FermionicTransformation can be used to transform QMolecules and construct ground state result objects.
+  super().__init__()
+/Users/bambrozi/.local/share/virtualenvs/ibm-quantum-challenge-2020-ZWRg31rS/lib/python3.8/site-packages/qiskit/chemistry/core/hamiltonian.py:415: DeprecationWarning: Processing a dictionary result is deprecated, pass a (minimum) eigensolver result now.
+  warnings.warn('Processing a dictionary result is deprecated,'
+---------------------------------------------------------------------------
+TypeError                                 Traceback (most recent call last)
+<ipython-input-3-66becf9098c9> in <module>
+     13     # exact classical result
+     14     exact_result = NumPyMinimumEigensolver(qubit_op, aux_operators=aux_ops)
+---> 15     exact_result = operator.process_algorithm_result(exact_result)
+     16 
+     17     # VQE
+
+~/.local/share/virtualenvs/ibm-quantum-challenge-2020-ZWRg31rS/lib/python3.8/site-packages/qiskit/chemistry/core/chemistry_operator.py in process_algorithm_result(self, algo_result)
+     88             return self._process_algorithm_result(algo_result)
+     89         else:
+---> 90             lines, result = self._process_algorithm_result(algo_result)
+     91             result['algorithm_retvals'] = algo_result
+     92             return lines, result
+
+~/.local/share/virtualenvs/ibm-quantum-challenge-2020-ZWRg31rS/lib/python3.8/site-packages/qiskit/chemistry/core/hamiltonian.py in _process_algorithm_result(self, algo_result)
+    374             # TODO return self._process_algorithm_result_excited_states(algo_result)
+    375         else:
+--> 376             return self._process_algorithm_result_deprecated(algo_result)
+    377 
+    378     def _process_algorithm_result_ground_state(self, algo_result: MinimumEigensolverResult) \
+
+~/.local/share/virtualenvs/ibm-quantum-challenge-2020-ZWRg31rS/lib/python3.8/site-packages/qiskit/chemistry/core/hamiltonian.py in _process_algorithm_result_deprecated(self, algo_result)
+    419 
+    420         # Ground state energy
+--> 421         egse = algo_result['energy'] + self._energy_shift + self._ph_energy_shift
+    422         result['energy'] = egse
+    423         lines = ['=== GROUND STATE ENERGY ===']
+
+TypeError: 'NumPyMinimumEigensolver' object is not subscriptable
+
+

Source-code:

+
# %%
+import numpy as np 
+import pylab 
+import copy
+from qiskit import BasicAer 
+from qiskit.aqua import aqua_globals, QuantumInstance
+from qiskit.aqua.algorithms import NumPyMinimumEigensolver, VQE 
+from qiskit.aqua.components.optimizers import SLSQP 
+from qiskit.chemistry.components.initial_states import HartreeFock
+from qiskit.chemistry.components.variational_forms import UCCSD
+from qiskit.chemistry.drivers import PySCFDriver 
+from qiskit.chemistry.core import Hamiltonian, QubitMappingType
+# %%
+molecule = 'H .0 .0 -{0}; Li .0 .0 {0}'
+distances = np.arange(0.5, 4.25, 0.25)
+vqe_energies = []
+hf_energies = []
+exact_energies = []
+# %%
+for i, d in enumerate(distances):
+    print('step', i)
+
+    # set up experiment:
+    driver = PySCFDriver(molecule.format(d/2), basis='sto3g')
+    qmolecule = driver.run()
+    operator = Hamiltonian(qubit_mapping=QubitMappingType.PARITY,
+                           two_qubit_reduction=True, 
+                           freeze_core=True,
+                           orbital_reduction=[-3, -2])
+    qubit_op, aux_ops = operator.run(qmolecule)
+
+    # exact classical result
+    exact_result = NumPyMinimumEigensolver(qubit_op, aux_operators=aux_ops)
+    exact_result = operator.process_algorithm_result(exact_result)
+
+    # VQE
+    optimzer = SLSQP(maxiter=1000)
+    initial_state = HartreeFock(operator.molecule_info['num_orbitals'],
+                                 operator.molecule_info['num_particles'],
+                                 qubit_mapping=operator._qubit_mapping,
+                                 two_qubit_reduction=operator._two_qubit_reduction)
+    var_form = UCCSD(num_orbitals=operator.molecule_info['num_orbitals'],
+                     num_particles=operator.molecule_info['num_particles'],
+                     initial_state=initial_state,
+                     qubit_mapping=operator._qubit_mapping,
+                     two_qubit_reduction=operator._two_qubit_reduction)
+    algo = VQE(qubit_op, var_form, optimzer, aux_operators=aux_ops)
+
+    vqe_result = algo.run(QuantumInstance(BasicAer.get_backend('statevector_simulator')))
+    vqe_result = operator.process_algorithm_result(vqe_result)
+
+    exact_energies.append(exact_result.energy)
+    vqe_energies.append(vqe_result.energy)
+    hf_energies.append(vqe_result.hartree_fock_energy)
+
+

Thanks for the help!

+",13751,,55,,11/10/2020 17:29,11/10/2020 17:29,TypeError: 'NumPyMinimumEigensolver' object is not subscriptable,,1,0,,,,CC BY-SA 4.0 +14538,2,,14476,11/8/2020 22:27,,1,,"

The answers above noting that $H^2=I$ neatly capture this. If you want an alternative way of seeing this, you can look at what $H$ does to each of the computational basis states if applied twice. (Since any state will be a superposition of the basis states, understanding how the operator acts on each basis state will tell you what it does to a general state.)

+
    +
  • When $H$ is applied to $|0 \rangle \equiv \begin{bmatrix}1\\0\end{bmatrix}$, matrix multiplication means you can read off the first column of $H$ to see what the coefficients of $|0 \rangle$ are in the standard basis after applying $H$ to it. Specifically, $H$ takes $|0 \rangle$ to $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$.
  • +
  • When $H$ is applied to $|1 \rangle \equiv \begin{bmatrix}0\\1\end{bmatrix}$, matrix multiplication means you can read off the second column of $H$ to see what the coefficients of $|1 \rangle$ are in the standard basis after applying $H$ to it. Specifically, $H$ takes $|1 \rangle$ to $\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$.
  • +
+

To apply $H$ to each of the computational basis states a second time, we can just re-use the results from above: +$$HH |0 \rangle = H\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \\= \frac{1}{2}((|0\rangle + |1\rangle)+(|0\rangle - |1\rangle)) \\=\frac{1}{2}(2|0\rangle)=|0\rangle,$$ +$$HH |1 \rangle = H\frac{1}{\sqrt{2}}(|0\rangle - |1\rangle) \\= \frac{1}{2}((|0\rangle + |1\rangle)-(|0\rangle - |1\rangle)) \\=\frac{1}{2}(2|1\rangle)=|1\rangle.$$ +Since applying $H$ twice to both computational basis states results in no change, applying $H$ to any state results in no change, i.e., $H^2=I$.

+",13752,,,,,11/8/2020 22:27,,,,0,,,,CC BY-SA 4.0 +14539,2,,9035,11/8/2020 22:48,,2,,"

I would also like to mention these:

+
    +
  • The Introduction to Quantum Computing: It has a few rough edges and it leans on the multiple universes interpretation of measurement in quantum mechanics, but it was well organized and provides a good overview in a short time.
  • +
  • Quantum Computer Science: An Introduction: A bit surprised that Mermin's textbook was not mentioned yet. It provides some additional ways of thinking about the algorithms. I found his group theory explanation (as background for understanding how period finding relates to factoring) in the appendix a little too concise, but that may be just me.
  • +
  • Quantum Computing: A Gentle Introduction: I found this book to be pretty comprehensive and clear enough so that if I needed an alternative explanation of something, I could find it here:
  • +
+",13752,,,,,11/8/2020 22:48,,,,0,,,,CC BY-SA 4.0 +14540,2,,14537,11/8/2020 22:56,,3,,"

The line:

+

exact_result = NumPyMinimumEigensolver(qubit_op, aux_operators=aux_ops)

+

should be

+

exact_result = NumPyMinimumEigensolver(qubit_op, aux_operators=aux_ops).run()

+
+

Here is the full code that I ran and its output:

+
# %%
+import numpy as np 
+import pylab 
+import copy
+from qiskit import BasicAer 
+from qiskit.aqua import aqua_globals, QuantumInstance
+from qiskit.aqua.algorithms import NumPyMinimumEigensolver, VQE 
+from qiskit.aqua.components.optimizers import SLSQP 
+from qiskit.chemistry.components.initial_states import HartreeFock
+from qiskit.chemistry.components.variational_forms import UCCSD
+from qiskit.chemistry.drivers import PySCFDriver 
+from qiskit.chemistry.core import Hamiltonian, QubitMappingType
+import matplotlib.pyplot as plt
+%matplotlib inline
+%config InlineBackend.figure_format = 'svg' # Makes the images look nice
+
+
+molecule = 'H .0 .0 -{0}; Li .0 .0 {0}'
+distances = np.arange(0.5, 4.25, 0.25)
+vqe_energies = []
+hf_energies = []
+exact_energies = []
+# %%
+for i, d in enumerate(distances):
+    print('step', i)
+
+    # set up experiment:
+    driver = PySCFDriver(molecule.format(d/2), basis='sto3g')
+    qmolecule = driver.run()
+    operator = Hamiltonian(qubit_mapping=QubitMappingType.PARITY,
+                           two_qubit_reduction=True, 
+                           freeze_core=True,
+                           orbital_reduction=[-3, -2])
+    qubit_op, aux_ops = operator.run(qmolecule)
+
+    # exact classical result
+    exact_result = NumPyMinimumEigensolver(qubit_op, aux_operators=aux_ops).run()
+    exact_result = operator.process_algorithm_result(exact_result)
+
+    # VQE
+    optimzer = SLSQP(maxiter=1000)
+    initial_state = HartreeFock(operator.molecule_info['num_orbitals'],
+                                 operator.molecule_info['num_particles'],
+                                 qubit_mapping=operator._qubit_mapping,
+                                 two_qubit_reduction=operator._two_qubit_reduction)
+    var_form = UCCSD(num_orbitals=operator.molecule_info['num_orbitals'],
+                     num_particles=operator.molecule_info['num_particles'],
+                     initial_state=initial_state,
+                     qubit_mapping=operator._qubit_mapping,
+                     two_qubit_reduction=operator._two_qubit_reduction)
+    algo = VQE(qubit_op, var_form, optimzer, aux_operators=aux_ops)
+
+    vqe_result = algo.run(QuantumInstance(BasicAer.get_backend('statevector_simulator')))
+    vqe_result = operator.process_algorithm_result(vqe_result)
+
+    exact_energies.append(exact_result.energy)
+    vqe_energies.append(vqe_result.energy)
+    hf_energies.append(vqe_result.hartree_fock_energy)
+    
+fig = plt.figure()
+plt.plot(distances,vqe_energies, label ='Mean Values')
+plt.show()
+
+

+",9858,,,,,11/8/2020 22:56,,,,1,,,,CC BY-SA 4.0 +14541,1,14549,,11/9/2020 9:53,,0,242,"

I work on comparing QSVM and Classic SVM (SKlearnSVM) with using Qiskit. I have to show +quantum supremacy at 400000-500000 samples but I don't get good results. I have problem with long time training and using big RAM when I use big training samples (In both cases). If I use big training samples in quantum algorithm, I can't get results of tests in short time (such as 1-4 days is acceptable). For example, I try do a test with 1000000 samples when I train quantum kernel on 20 samples and I got a bug in running state for some work (It was already above 10000 works; The work hanged). The reason of bug is unknown. For tests I use 2 quants (maybe it is little?) and last version libraries. Dataset is my generate (with perceptible differents). I try normalize dataset but I got a code mistake of numpy library (can't reshape array ant e.t.c). +For begining I used example from github tutorial, next I used other methods of class (that I find in qiskit - .train(),.test()) but I don't see differents here (if I use .run() and .predict() with rebooting of kernel).

+

And I have question - So can I to show this comparing generally with using Qiskit? So how? Maybe can I show quantum supremacy on other size of samples? Or can I use Qiskit library wrong?

+",13482,,55,,11/10/2020 17:29,1/3/2023 21:00,Comparing QSVM & Classic SVM on BigData. Quantum Supremacy,,1,1,,,,CC BY-SA 4.0 +14542,1,,,11/9/2020 10:33,,-1,1025,"

I was hoping to gain some insights on how I can convey to the public the ways in which Quantum Computing can have positive social impact?

+

I'm going convey this information in an A4 sized infographic to help create more awareness of this technology and how it can help us in the future. From my research the main tangible advantage of Quantum computing is a logistical one, however when I look at the UN sustainable development goals, I was hoping that you could enlighten me if there are other areas where this technology is going to help our race?

+

The UN Sustainable Development Goals: +1-No poverty +2-Zero hunger +3-Good health and well-being +4-Quality education +5-Gender equality +6-Clean water and sanitation +7-Affordable and clean energy +8-Decent work and economic growth +9-Industry, innovation and infrastructure +10-Reduced inequalities +11-Sustainable cities and communities +12-Responsible consumption and production +13-Climate action +14-Life below water +15-Life on land +16-Peace, justice and strong institutions +17-Partnerships for the goals

+

Full disclosure, I am a Business school student, so I have a very limited knowledge of the subject but I chose it because I am fascinated by the possibilities of the technology rather than choosing a much more cliché subject!

+",13756,,1937,,11/11/2020 8:31,11/12/2020 21:20,University Project - Quantum computing and it's social impact?,,3,0,,11/10/2020 12:20,,CC BY-SA 4.0 +14543,1,,,11/9/2020 11:25,,3,68,"

I would like to know if there is a place in which is summarized the gate characteristics of the different quantum computer existing (IBM,Google, others).

+

For instance, which kind of two qubit gate they physically implement. Their quality, etc.

+

From Sycamore paper I am able to access some of those date from google. From IBM I am struggling to find their characteristics on internet. I am particularly interested to know what is the physical two qubit gate they realize.

+",5008,,55,,11/10/2020 17:30,11/10/2020 17:30,Gate characteristics of different platforms,,1,0,,,,CC BY-SA 4.0 +14544,1,15747,,11/9/2020 12:02,,3,110,"

Suppose Alice and Bob have access to shared entanglement and a classical channel and wish to simulate the following quantum protocol. Alice sends over to Bob an $n$-qubit state which is not known to him. Bob then does a projective measurement with $2$ outcomes. The measurement is known to both parties before the protocol starts. I am interested in the communication cost of simulating this protocol.

+

Option 1: Alice teleports her state to Bob with the cost of $2n$ classical bits of communication. Bob applies the unitary correction required and then measures the state.

+

Option 2: Alice does the projective measurement herself and simply communicates $1$ bit of information to Bob.

+

Question: If Alice cannot do the projective measurement herself, can she and Bob do better than Option 1? Can they still successfully execute this protocol but with only $1$-bit (or at least fewer than $2n$ bits) of communication?

+",4831,,10480,,1/30/2021 7:07,1/30/2021 7:07,Teleportation followed by measurement: Lowering communication cost,,1,2,,,,CC BY-SA 4.0 +14545,2,,14542,11/9/2020 14:27,,2,,"

I've listed down the advantages that I believe Quantum computing will have in the future in the areas of some of the UN sustainable development goals:

+
    +
  1. Decent work and economic growth: Quantum computing is developing field. We have ideas but we are still working on the implementation because of that, it creates jobs for people around the world who are learning quantum computing, and would like to have a professional career or undergo research in this field.

    +
  2. +
  3. Industry, innovation, and infrastructure: Quantum computing is a relatively new, and developing area in computer science. We are only in the second generation of quantum technology, so there is a huge possibility of impact under this goal. Technology progress and investing in scientific research and innovation is covered under this and quantum computing can help in promoting innovation, and entrepreneurship to get equal access to information, and knowledge.

    +
  4. +
  5. Climate action: A quantum computer will increase the storage capacity of a computer and algorithms can speed up the process. We have information about climate changes occurring across the world but while processing that much data is possible cleaning of that data is still very inefficient. If we can develop quantum algorithms that can help us do that, we can understand changes from very early times and see what happened and analyse how it can be prevented from happening again.

    +
  6. +
  7. Partnerships for the goals: One of the hindrances to investing in quantum computing is a huge cost for the scientific equipment and facilities. Partnerships between developed and developing countries can be essential to achieve this goal.

    +
  8. +
+",12624,,,,,11/9/2020 14:27,,,,2,,,,CC BY-SA 4.0 +14546,2,,14542,11/9/2020 14:36,,1,,"

I believe these links will be useful:

+ +",9474,,,,,11/9/2020 14:36,,,,1,,,,CC BY-SA 4.0 +14547,1,,,11/9/2020 15:34,,6,545,"

The QFT on the group $\mathbb{Z}_N$ is given by +\begin{equation} +QFT\,|k\rangle =\frac{1}{\sqrt{N}} \sum_{j=0}^{N-1} e^{2\pi i\,jk/N}|j\rangle\,. +\end{equation}

+

The usual circuit implements the QFT with $N=2^n$ on $n$ qubits. Does anyone know how to realize this transformation when $N$ is not a power of 2? I have found an algorithm that approximates a QFT with arbitrary $N$, but I would like to find out if some exact circuit is known. I think that it should at least in some cases, since the problem 5.1 of Nielsen and Chuang's book is to find it when $N=p$ is a prime number.

+

I'm interested in particular on the $\mathbb{Z}_3$ transform, which corresponds to the matrix +\begin{equation} + \frac{1}{\sqrt{3}}\,\begin{pmatrix} + 1&1&1 \\ 1&e^{2\pi i/3}&e^{-2\pi i/3} \\ 1&e^{-2\pi i/3}&e^{2\pi i/3} + \end{pmatrix}\,. +\end{equation}

+

Of course it acts on a 3d space, so to realize it using qubits we should extend it to a unitary operator on at least a $2^2$ dimensional Hilbert space. One possibility could be

+

\begin{equation} + \begin{pmatrix} + \frac{1}{\sqrt3 } + \begin{pmatrix} + 1&1&1 \\ 1&e^{2\pi i/3}&e^{-2\pi i/3} \\ 1&e^{-2\pi i/3}&e^{2\pi i/3} + \end{pmatrix} & \\ + & 1 + \end{pmatrix}\,, +\end{equation} +but then how can we realize it exactly? When $N=2^n$ we can get the $\frac{1}{\sqrt{2^n}}$ prefactor with the n Hadamard gates that prepare the uniform superpositions, but now that $\sqrt{3}$ factor is really bothering me.

+",13748,,13748,,11/10/2020 10:08,11/10/2020 10:08,Quantum Fourier Transform for general cyclic groups,,1,0,,,,CC BY-SA 4.0 +14548,1,14551,,11/9/2020 15:56,,3,125,"

A passage on page 86 of Quantum Computation and Quantum Information by Michael A. Nielsen & Isaac L. Chuang has been bugging me for a while,

+
+

Suppose the states $\vert \psi_i\rangle$ are orthonormal. Then Bob can do a quantum measurement to distinguish these states, using the following procedure. Define measurement operators $M_i\equiv \vert \psi_i\rangle\langle\psi_i\vert$, one for each possible index $i$, and an additional measurement operator $M_0$ defined as the positive square root of the positive operator $I-\sum_{i\ne0}\vert \psi_i\rangle\langle\psi_i\vert$. These operators satisfy the completeness relation, and if the state $\vert \psi_i\rangle$ is prepared then $p(i)=\langle\psi_i\vert M_i\vert\psi_i\rangle=1$, so the result $i$ occurs with certainty. Thus, it is possible to reliably distinguish the orthonormal states $\vert \psi_i\rangle$.

+
+

Here Bob is presented with a state $\vert \psi_i\rangle$ from orthonormal states $\{\vert \psi_i\rangle\}_{1\le i\le n}$ and his task is to identify the index correctly.

+

The setup seems very strange to me. When Bob "measures" the state $\vert \psi_i\rangle$, shouldn't the state collapse to a computational basis assuming the measurement was done in it with probabilities given by the coefficients? And what does "$i$ occurs with certainty" even mean? Does it mean that $\vert \psi_i\rangle$ will always be from the given set? But then that's obvious since that was stated in the setup. And also, I don't see how Bob has even correctly identified the index at all.

+

It seems to me that there's a gap in my understanding of Postulate 3 which states the mathematical definition of quantum measurement. Any guidance would be helpful. Also, I wanna add that I'm not from a physics background. Thank you.

+",13098,,,,,11/10/2020 20:17,How to identify index $k$ when presented with a state $\vert \psi_k\rangle$ from orthonormal states $\{\vert \psi_i\rangle\}_{1\le i\le n}$?,,3,0,,,,CC BY-SA 4.0 +14549,2,,14541,11/9/2020 16:17,,1,,"

There is a difference between Quantum Supremacy and Quantum Advantage.

+

Quantum Supremacy has been shown on a quantum computer, first by Google in 2019 through their paper Quantum supremacy using a programmable superconducting processor. Roughly speaking, quantum supremacy test is about generating random states that is not at all efficient classical simulatable.

+

Quantum advantage is about solving practical problems with speed-up over classical computer even against the world's best supercomputer. This is no where near being achievable. For instance, to run Shor's algorithm on a 2000 bit number into its primes would require millions of physical qubits (because you need to use additional qubits for error corrections) while require each physical qubits to be under certain error threshold. If you look at what we have now then you can see this is pretty far off!

+

+

lately, there have been a lot of interest in using quantum computers for chemistry related problems. In particular, the electronic structure problem. So maybe it is interesting to when there will be quantum advantage in that topic... A recent paper, How will quantum computers provide an industrially relevant computational advantage in quantum chemistry? shows that we are still a long time a way as well from seeing quantum advantage in this arena. I should note that there are new proposed techniques that can shorten the computational time for the quantum computers on these problems but the quantum resource (number of qubits) is very high.

+
+

So if you are looking for quantum advantage on your problem with current devices, then I don't you will find it.

+",9858,,45,,7/11/2022 20:49,7/11/2022 20:49,,,,0,,,,CC BY-SA 4.0 +14550,2,,14548,11/9/2020 16:17,,2,,"

Here note that $i$ is fixed. Now, a measurement need not be in the computational basis (perhaps this is the gap in your understanding, there are many different orthonormal bases for a Hilbert space, just note that each nontrivial unitary operator gives a change of orthonormal basis) and so when Bob measures $|\psi_i\rangle$ with the positive operator $|\psi_i\rangle\langle \psi_i|$ the resulting state is $|\psi_i\rangle$ with probability $1$ (this is exactly by postulate 3). Also you should think about a measurement as a function that ultimately gives some outcome, it is convenient to think about outcomes as labels on an orthonormal basis for the Hilbert space, so in this case we would get the outcome $i$.

+",11793,,11793,,11/9/2020 16:20,11/9/2020 16:20,,,,12,,,,CC BY-SA 4.0 +14551,2,,14548,11/9/2020 16:22,,2,,"

Bob's task is just to say which state he received, not to actually produce a particular state. So it doesn't really matter what the post-measurement state is.

+
+

When Bob "measures" the state $|\psi_i\rangle$, shouldn't the state collapse to a computational basis assuming the measurement was done in it with probabilities given by the coefficients?

+
+

The measurement is not* being done in the computational basis, the measurement operators are explicitly defined as $\{M_i\}_i$ where $M_i = |\psi_i\rangle \langle \psi_i |$. These operators are all orthogonal projectors that sum to the identity and hence form a valid measurement. By the measurement postulate we have that if Bob was sent $|\psi_i \rangle$ and the measurement gave outcome $i$ then the post-measument state is +$$ +\frac{M_i^{1/2} |\psi_i\rangle}{\| M_i^{1/2} |\psi_i \rangle \|} = \frac{|\psi_i \rangle \langle \psi_i |\psi_i\rangle}{\| |\psi_i \rangle \langle \psi_i |\psi_i \rangle \|} = |\psi_i \rangle. +$$

+
+

And what does "𝑖 occurs with certainty" even mean?

+
+

This means suppose that Bob is given the state $|\psi_i \rangle$ and performs the measurement corresponding to the operators $\{M_i \}_i$. Then with probability $1$ he will get the outcome $i$. To see this we just use the Born rule: the probability getting outcome $j$ given he received the $i$-th state is +$$ +\begin{aligned} +p(j|i) &= \mathrm{Tr}[ M_j |\psi_i \rangle \langle \psi_i |]\\ +&= \mathrm{Tr}[ |\psi_j \rangle \langle \psi_j |\psi_i \rangle \langle \psi_i |] \\ +&= \delta_{ij} +\end{aligned} +$$ +where $\delta_{ij}$ equals $1$ if $i=j$ and zero otherwise.

+

*Really we can choose any basis to be the computational basis so this is up to however you define computational.

+

Response to comments

+

I'm also not a physicist so I don't really know what goes on in the lab when an experimentalist measures a quantum state. But fortunately, one of the great things about quantum information in my opinion, is that the theory is abstracted enough such that we do not necessarily need to know such details in order to be able to do meaningful things. A measurement (for me) is just some abstract box which is labelled by a set of measurement operators $\{M_i\}$ where the $M_i$ satisfy $0 \leq M_i \leq I$ and $\sum_i M_i = I$. When I measure some state $\rho$ with the measurement $\{M_i\}_i$ I send it into this box. After sending it into the box, the box responds with a piece of classical information which is the measurement outcome. The list of possible outcomes that it can choose from are defined by the indexes of the measurement operators. It chooses the outcome randomly, it doesn't matter for this exposition exactly how it chooses but it does so and it will, with probability $p(j)$, tell me that it measured the outcome $j$. The probability with which it reports the outcome $j$ is given by the Born rule, +$$ +p(j) = \mathrm{Tr}[M_j \rho]. +$$ +Some measuring devices may also output a post-measurement state and one rule for which state comes out is that when the measuring device outputs the outcome $j$ the state after measurement is +$$ +\frac{M_j^{1/2} \rho M_{j}^{1/2}}{\mathrm{Tr}[M_j \rho]}. +$$

+",9854,,9854,,11/9/2020 20:15,11/9/2020 20:15,,,,9,,,,CC BY-SA 4.0 +14552,1,,,11/9/2020 16:30,,3,78,"

Even though Trotterized Hamiltonians have polynomial time scaling directly, the process of quantum phase estimation means that the controlled unitaries $ CU$ scale exponentially with number of precision bits. That means we need to apply our controlled Hamiltonian an exponential number of times if we increase the number of precision bits. Furthermore, because increasing the trotter step size requires greater precision, doesn't this directly imply that there is some relationship between Hamiltonian size and precision required, and thus a somewhat exponential relationship?

+

So, does Trotterization technically scale closer to exponential time or amortized superpolynomial time? Are there ways to get around this additional time cost incurred by QPE?

+",8343,,55,,11/10/2020 17:31,11/10/2020 17:31,Reducing cost of Phase Estimation for Trotterization,,0,1,,,,CC BY-SA 4.0 +14554,2,,14543,11/9/2020 19:57,,2,,"

For IBM machines, you can just select a provider backend that is available to you and look at its specifications. For example, if I want to look at their ibmq_santiago machine specification I can run:

+
%matplotlib inline
+# Importing standard Qiskit libraries and configuring account
+from qiskit import QuantumCircuit, execute, Aer, IBMQ
+from qiskit.compiler import transpile, assemble
+from qiskit.tools.jupyter import *
+from qiskit.visualization import *
+provider = IBMQ.load_account()
+backend = provider.get_backend('ibmq_santiago')
+backend
+
+

Which will output the following Widget:

+

+

There you can see that the two qubit gate that is native to this machine is CNOT gate.

+
+

If you want to go further and look at the gates specifications on each qubit, for instance the pulse duration, then you can do something like:

+
print('Gate Pulse Duration Time on Different Qubit: \n')
+for gate in backend.properties().gates:
+    print("{} gate on qubits {} duration is {}{}".format(gate.name, gate.qubits, gate.parameters[1].value, gate.parameters[1].unit))
+
+

which will print out something like:

+

+",9858,,,,,11/9/2020 19:57,,,,0,,,,CC BY-SA 4.0 +14555,2,,14547,11/9/2020 20:50,,4,,"

Kitaev gave an algorithm to approximate Quantum Fourier Transform over an arbitrary cyclic group.

+

Later, Mosca and Zalka showed how his construction can be made exact.

+

You can find a nice description for Kitaev algorithm in Dave Bacon lecture notes for example.

+",9474,,,,,11/9/2020 20:50,,,,0,,,,CC BY-SA 4.0 +14556,1,14559,,11/9/2020 22:59,,5,1127,"

The following are the matrices for SWAP and iSWAP gates.

+

SWAP = +\begin{pmatrix} + 1 & 0 & 0 & 0 \\ + 0 & 0 & 1 & 0 \\ + 0 & 1 & 0 & 0 \\ + 0 & 0 & 0 & 1 + \end{pmatrix} +iSWAP = +\begin{pmatrix} + 1 & 0 & 0 & 0 \\ + 0 & 0 & i & 0 \\ + 0 & i & 0 & 0 \\ + 0 & 0 & 0 & 1 + \end{pmatrix} +Both are similar except iSWAP adds a phase to $|01\rangle$ and $|10\rangle$ amplitudes.

+

How can the SWAP operation be realized using the iSWAP gate?

+",4722,,55,,11/24/2020 14:20,11/19/2022 6:01,How to realize SWAP operation using iSWAP gate?,,3,1,,,,CC BY-SA 4.0 +14557,2,,14542,11/9/2020 23:46,,1,,"

Here are some long-term advantages that are not outside of the realm of possibility. I've stuck to ones that I think are least controversial – we're so far away from realizing any of these that they are fundamentally all speculation no matter how you slice it.

+
    +
  1. No Poverty: There is no clear advantage here specific to poverty itself. To be frank, quantum computing will most likely benefit more privileged populations, at least in the short term. That is currently the status quo.

    +
  2. +
  3. Zero hunger: One could speculate that quantum computing technologies may aid in improving agricultural yields by simulating the FeMo cofactor. By understanding this molecule better, it is expected that artificial nitrogenase enzymes may be developed that allow for the efficient manufacture of nitrogen fertilizers. This also factors into energy consumption – the current method for producing nitrogen fertilizer leverages the Haber-Bosch process, which is estimated to account for 1-2% of world energy consumption.

    +
  4. +
  5. Good health: It is expected quantum computing will contribute to significant improvements in drug development pipelines. To date, the failure rate of a drug from conception to market is quite high – a lower failure rate and improved scalability of in silico simulations of protein-ligand binding studies may significantly improve the economic efficiency of drug development. Whether these improvements translate into greater access, novel antibiotics (often considered economically infeasible to develop), novel vaccines, and improvements in precision medicine is speculative. Nonetheless, I personally believe there is a pathway to significant advances in the biomedical sciences due to quantum computing technologies.

    +
  6. +
  7. Quality education: I have nothing for you here, maybe someone else has some ideas.

    +
  8. +
  9. Gender equality: See number 4.

    +
  10. +
  11. Clean water and sanitation: It's plausible that advances in molecular simulation due to quantum computing could improve our ability to efficiently treat water. For example, one could imagine that quantum computers may lead to improvements in the membrane technologies, used for filtration in reverse osmosis water purification, via quantum simulation. As I understand it, these membranes are expensive and they tend to foul quite quickly, leading to a regular replacement schedule.

    +
  12. +
  13. Affordable clean energy: Who knows! It would be great if a physicist could chime in here but I imagine quantum computing has some potential to improve our simulations of plasma in a fusion reactor. Whether this would be practical, useful, or translate into scalable nuclear fusion is very much unclear to me (not my wheelhouse).

    +
  14. +
  15. Decent work and economic growth: I would expect that quantum computing will allow for the growth of many ancillary industries that are powered by advances in science and engineering. This would be in addition to the economic growth inherent to the establishment of a novel industry with a potentially pivotal technology at its center.

    +
  16. +
  17. Industry, innovation, and infrastructure: See 8; I would add that there is potential for novel secure infrastructure in the form of a quantum Internet. That said, it's hard to predict what that will mean in practice on the global or domestic scale.

    +
  18. +
  19. Reduced inequalities: This one's complex; in some regards classical computing has democratized knowledge and removed barriers to entry that have typically inhibited broad economic participation by less privileged members of the global community. Of course, it has also increased inequalities locally in technology centers (e.g. the Bay Area). I would imagine that without public policies that emphasize fairness quantum computing could contribute to a widening of these disparities.

    +
  20. +
  21. Sustainable cities and communities: Quantum computing is often cited as having a potential role in traffic management infrastructure. Usually this is mapped to the famous traveling salesman problem (TSP), which is an NP-Complete problem. What this means is that we don't expect a substantial improvement in our ability to solve large scale instances of the TSP with a quantum computer (i.e. we expect a polynomial speedup for the worst case instances, at best). I'm no expert in this space but my guess is that, rather than improved traffic management, the greatest value may come from some improvements to energy efficiency and a smart electricity grid that leverages batteries with an efficient chemistry (with battery researchers potentially using quantum simulation to develop these chemistries). Ultimately, quantum computing may allow us to eek out small efficiencies contributing to greater sustainability. Another example may be reductions in the energy required for certain types of computing that would otherwise rely on large classical data centers.

    +
  22. +
  23. Responsible consumption and production: It's unclear (to put it mildly) how quantum computing will make humans behave more responsibly. Perhaps quantum computers may improve demand prediction on the part of manufacturers.

    +
  24. +
  25. Climate action: Certainly quantum computers won't facilitate climate action anymore than a regular computer does. That said, it may be that quantum simulation or other quantum approaches may allow for the development of novel, efficient carbon capture technologies. That'd be a win. This is a similar argument to the improved battery chemistries noted above, which would be relevant here, too.

    +
  26. +
  27. Life below water: Unclear.

    +
  28. +
  29. Life on land: Unclear.

    +
  30. +
  31. Peace, justice, and strong institutions: Unclear. Though, I will say that if nation states can no longer break one another's encryption it could increase volatility. It's been argued that mutual spying gives governments better insight into each other's strategies, which mitigates opportunities for misunderstanding and strategic miscalculations.

    +
  32. +
  33. Partnerships for the goals: N/A?

    +
  34. +
+

As you can see, most of this stuff is unclear and speculative. The fact is, the quantum information processing field is so new that, in most cases, we can't even begin to conceive of the implications of scalable quantum computing (FTQC). Personally, as with most new technologies (classical computing being a particularly salient case in point), I have no doubt it will be a mixed bag of advantages and drawbacks.

+

Finally, most examples of an advantage I’ve identified about hinge on large-scale quantum simulation. This is not a coincidence — quantum simulation is one of the best studied applications with the potential to map to many real-world problems in physics, chemistry, and biology. The exponential speedup admitted by quantum simulation also provides the greatest flexibility in implementation; whether we have gains or reductions in the efficiency of the computation (relative to classical approaches) as we map it from theory to practice (I.e. implementation), the exponential speedup means we’ll probably derive a significant advantage in the end. Also, it should be said that many of the applications identified are also the subject of a large volume of machine learning (especially deep learning) research. In the near term, the greatest gains in these problems being solved are most likely to come from classical ML-based methods, not quantum ones.

+",1937,,1937,,11/12/2020 21:20,11/12/2020 21:20,,,,2,,,,CC BY-SA 4.0 +14559,2,,14556,11/9/2020 23:55,,8,,"

It can't be done in one or two uses of the iSwap because an iSwap is equivalent (up to single qubit rotations) to a SWAP+CZ. A single SWAP+CZ is not a swap. The two swaps in a pair of SWAP+CZs cancel out, leaving you with two CZs (and arbitry single qubit operations around them), which is also not enough to do a swap.

+

But you can do it with three:

+

+",119,,,,,11/9/2020 23:55,,,,4,,,,CC BY-SA 4.0 +14560,1,,,11/10/2020 0:36,,2,114,"

I am Java and Python programmer who started self-learning Quantum Computing a couple of months back. The journey has been thus far very tough. I have been using QisKit and Quirk to learn by in addition to Khan academy on the Linear Algebra side.

+

I have now started to dive a little into the deep and and read research and go through the practise of trying replicate circuits on Quirk then QisKit.

+

I have come accross the followng paper An Optimized Quantum Maximum or Minimum Searching Algorithm and its Circuits

+

The paper proposes this QUMMSA algorithm to find the minimum or maximum in a dataset.

+

What I would love to do is replicate the QUMMSA circuit in Quirk with the Titanic experiment written in the paper but with just two inputs.

+

How do I best implement the circut?

+",13729,,55,,11/24/2020 14:19,11/24/2020 14:19,How to implement the Maximum or Minimum Searching Algorithm (QUMMSA) circuit in Quirk?,,0,0,,,,CC BY-SA 4.0 +14561,2,,14556,11/10/2020 0:38,,1,,"

Using matrix multiplication, +$$\begin{pmatrix} + 1 & 0 & 0 & 0 \\ + 0 & 0 & 1 & 0 \\ + 0 & 1 & 0 & 0 \\ + 0 & 0 & 0 & 1 + \end{pmatrix} += +\begin{pmatrix} + 1 & 0 & 0 & 0 \\ + 0 & 0 & i & 0 \\ + 0 & i & 0 & 0 \\ + 0 & 0 & 0 & 1 + \end{pmatrix} +\begin{pmatrix} + 1 & 0 & 0 & 0 \\ + 0 & -i & 0 & 0 \\ + 0 & 0 & -i & 0 \\ + 0 & 0 & 0 & 1 + \end{pmatrix} +$$ +So the question is which gates does the second matrix in the matrix multiplication on the right represent?

+

A starting point is that the phase gate is $\begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}$ and that the Z-gate is $\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$, and $\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}\begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}$. This gets us the upper left portion of the second matrix.

+

Once we have $\begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}$, we can use the X-gate $\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$ and pre-and post-multiply it:$\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\begin{pmatrix} 1 & 0 \\ 0 & -i \end{pmatrix}\begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} = \begin{pmatrix} -i & 0 \\ 0 & 1 \end{pmatrix}$. This gets the lower right portion of the second matrix.

+",13752,,,,,11/10/2020 0:38,,,,5,,,,CC BY-SA 4.0 +14562,1,,,11/10/2020 7:56,,1,483,"

Quantum gates are basically matrices belonging to $C_{2\times2}$. Now, what are the properties of these matrices? We know that to preserve the normalization factor of the qubits these are unitary. All good. But then again we know that every unitary matrix is represented by rotation around Z, Y, and Z-axis (I am mentioning the Z-Y decomposition here).

+

So that means any unitary matrix is a rotation?

+

One funny thing, is this similar to rotation matrices similar to $R^{3}$ with determinant 1 etc?

+",13763,,55,,11/24/2020 14:18,11/24/2020 14:18,What are the properties of the matrices representing quantum gates?,,2,1,,,,CC BY-SA 4.0 +14563,1,,,11/10/2020 8:10,,1,121,"

I am trying to change the appearance of the circuit_drawer in output='mpl' mode. The registers of the Quantum Circuit are named like ($q0_0$, $q0_1$, $q1_0$, $q2_0$, $q2_1$,..) but I'd like to name them myself. I can't find a style function or option which is able to do that... any ideas?

+

To be clear what I would like to change:

+

+",13659,,55,,11/24/2020 14:18,11/24/2020 14:18,How to change the names of the registers displayed with circuit_drawer (output='mpl'),,1,0,,,,CC BY-SA 4.0 +14564,2,,14563,11/10/2020 8:24,,3,,"

When initializing the registers for the quantum circuit you need to set the parameter 'name'. For example:

+
f_in = QuantumRegister(n, name='f_in')
+###add other registers here### 
+qc = QuantumCircuit(f_in, ...)
+qc.draw(ouput='mpl')
+
+

Gives the output:

+

+",13659,,,,,11/10/2020 8:24,,,,0,,,,CC BY-SA 4.0 +14565,2,,14562,11/10/2020 9:20,,1,,"

Yes, unitary matrix is a natural generalization of orthogonal matrix (which is a rotation with a possible sign flip) in the case of complex numbers. It's defined as a linear map that doesn't change inner products between vectors in $\mathbb{C}^n$.

+

A unitary matrix with a real numbers is exactly an orthogonal matrix. We have $U^\dagger = (\overline{U})^T$ for any matrix $U$, for unitary we have $UU^\dagger=I$, and for real we have $U=\overline{U}$. Hence $UU^T=I$.

+

Their determinant can be any complex number with modulus $1$.

+",5870,,,,,11/10/2020 9:20,,,,1,,,,CC BY-SA 4.0 +14566,2,,14548,11/10/2020 9:33,,2,,"

Perhaps it's more illuminating to look at how the measurement is made.

+

Since the set of states $\{|\psi_i\rangle\}_{1\le i\le n}$ is not assumed to form a complete basis, we need to first complete them. Assume that the dimension of the Hilbert space is $d \ge n+1$, and define states $|\psi_{n+1}\rangle,|\psi_{n+2}\rangle,\ldots,|\psi_{d}\rangle$ so that the set $\{|\psi_i\rangle\}_{1\le i\le d}$ is a complete basis. This can always be done, for example with the Gram-Schmidt procedure.

+

We want to do a measurement in the basis $\{|\psi_i\rangle\}_{1\le i\le d}$, but we cannot do that, we can only make a measurement in the computational basis $\{|i\rangle\}_{1\le i\le n}$. This is always the case in quantum computing, and most experimental setups: there is one fixed basis in which the measurement is made, and it is difficult or impossible to measure in different basis.

+

What we do then is apply the unitary $$ U = \sum_{i=1}^d |i\rangle\langle \psi_i|$$ to his initial state, and then make a measurement in the computational basis. It is easy to check that $U$ is in fact a unitary, as $U^\dagger U = U U^\dagger = I$, so it is always possible to implement it. How to implement it, and how difficult it is, depends of course on the specific set $\{|\psi_i\rangle\}_{1\le i\le d}$.

+

Now suppose the initial state is one of these states, say $|\psi_3\rangle$. What happens? Bob applies $U$ to it, and gets $U|\psi_3\rangle = |3\rangle$. Now he measures $|3\rangle$ in the computational basis, and the result will be 3 with certainty. In this way he can identify the index correctly, and it is easy to see that it holds for any possible index.

+

With this procedure the probability of outcome $i$ is given by the measurement operators defined in the question: +$$M_i := |\psi_i\rangle\langle\psi_i|$$ +for $1\le i \le n$, and +$$M_0 := \sum_{k=n+1}^d |\psi_k\rangle\langle\psi_k| = I-\sum_{k=1}^n |\psi_k\rangle\langle\psi_k|.$$ +The post-measurement state will not be given by them, though, as they give a post-measurement state in the set $\{|\psi_i\rangle\}_{1\le i\le d}$ , but the procedure here gives one in the computational basis.

+",12541,,12541,,11/10/2020 20:17,11/10/2020 20:17,,,,4,,,,CC BY-SA 4.0 +14567,2,,14562,11/10/2020 11:49,,1,,"

Since I think question 1 is solved well by the upper answer, I will skip to question 2.

+

They have some similar property with the rotation in $R^3$, but from a group theory point of view, the quantum gates(2D unitary matrix) belong to a larger group, $SU(2)$, while 3D rotations belong to $SO(3)$, and there is a two-to-one map between $SU(2)$ and $SO(3)$ ($SU(2)$ contains $SO(3)$). For a detailed explanation, see Wikipedia.

+

And there is a more direct way to see the difference, if you draw the Bloch sphere of a quantum state sometimes you need to denote their phase while in the general $R^3$ case, this is nonsense.

+",13647,,,,,11/10/2020 11:49,,,,1,,,,CC BY-SA 4.0 +14568,2,,14438,11/10/2020 14:51,,1,,"

The key observation that is used, both to break the bit commitment scheme and the ideal coin tossing scheme, is that by requiring that one of the players has a zero probability of cheating, you require the fidelity between two of the reduced density operators to be zero. The flip side of this means that the two reduced density operators are perfectly distinguishable to the other player. For example, in the bit commitment scheme if we want to prevent Alice from cheating (changing her answer following the commit phase) we allow Bob to distinguish between the two reduced density operators (and so he could learn Alice's committed bit). This observation is used in the "backward induction proof" of the ideal quantum coin tossing is impossible theorem in https://arxiv.org/pdf/quant-ph/9711065.pdf to ultimately give a contradiction.

+

Remark that in bit commitment the trade off goes both ways. If we want to prevent Bob from distinguishing between the two reduced density matrices with probability no greater than 1/2, then we end up allowing Alice to cheat because the indistinguishability of the reduced density matrices implies that Alice can change her answer, as the two states are then related by a local isometry (this is Uhlmann's theorem).

+

The $\epsilon$-concealing and $\delta$-binding parameters in the bit commitment scheme merely interpolate between the two mentioned extremes, ultimately there is a fundamental trade off between the two parameters, which demonstrates that there is no ideal bit commitment scheme.

+",11793,,11793,,12/16/2020 17:37,12/16/2020 17:37,,,,0,,,,CC BY-SA 4.0 +14569,1,,,11/10/2020 15:40,,1,71,"

In admm optimizer, when running the demo, it has attribute error, binary_vartype does not have attribute 'one_letter_symbol'. Does any one know how to solve it? +

+

Here is the code:

+
import time
+from typing import List, Optional, Any
+import numpy as np
+import matplotlib.pyplot as plt 
+
+from docplex.mp.model import Model
+
+from qiskit import BasicAer
+from qiskit.aqua.algorithms import QAOA, NumPyMinimumEigensolver
+from qiskit.optimization.algorithms import CobylaOptimizer, MinimumEigenOptimizer
+from qiskit.optimization.problems import QuadraticProgram
+from qiskit.optimization.algorithms.admm_optimizer import ADMMParameters, ADMMOptimizer
+
+# If CPLEX is installed, you can uncomment this line to import the CplexOptimizer.
+# CPLEX can be used in this tutorial to solve the convex continuous problem, 
+# but also as a reference to solve the QUBO, or even the full problem.
+# 
+# from qiskit.optimization.algorithms import CplexOptimizer
+
+# define COBYLA optimizer to handle convex continuous problems.
+cobyla = CobylaOptimizer()
+
+# define QAOA via the minimum eigen optimizer
+qaoa = MinimumEigenOptimizer(QAOA(quantum_instance=BasicAer.get_backend('statevector_simulator')))
+
+# exact QUBO solver as classical benchmark
+exact = MinimumEigenOptimizer(NumPyMinimumEigensolver()) # to solve QUBOs
+
+# in case CPLEX is installed it can also be used for the convex problems, the QUBO, 
+# or as a benchmark for the full problem.
+#
+# cplex = CplexOptimizer()
+
+# construct model using docplex
+mdl = Model('ex6')
+
+v = mdl.binary_var(name='a')
+w = mdl.binary_var(name='w')
+t = mdl.binary_var(name='t')
+u = mdl.continuous_var(name='u')
+
+mdl.minimize(v + w + t + 5 * (u-2)**2)
+mdl.add_constraint(v + 2 * w + t + u <= 3, "cons1")
+mdl.add_constraint(v + w + t >= 1, "cons2")
+mdl.add_constraint(v + w == 1, "cons3")
+
+# load quadratic program from docplex model
+qp = QuadraticProgram()
+#qp.from_docplex(mdl)
+print(qp.export_as_lp_string())
+
+

And here is the link to the tutorial: https://github.com/Qiskit/qiskit-tutorials/blob/master/tutorials/optimization/5_admm_optimizer.ipynb

+",13765,,9858,,11/10/2020 16:24,11/10/2020 16:24,"Tutorial, optimization part, 5_admm_optimizer has attribute error",,0,2,,12/14/2020 14:16,,CC BY-SA 4.0 +14572,2,,14522,11/10/2020 17:32,,1,,"
+

Now, my question is what is the use of above representation, if all the operation are defined on initial state.

+
+

This means very little. Like in any kind of dynamics, you start with an initial state and apply operations to it. In this case, you might start with the state you mention but then you apply coin and walker operation that will evolve that state into something else.

+",55,,,,,11/10/2020 17:32,,,,0,,,,CC BY-SA 4.0 +14573,1,,,11/10/2020 18:36,,4,52,"

In the HHL algorithm, we need to estimate the eigenvalues of a matrix $A$. The result is stored in a register with $l$ qubits. Let $T = 2^l$. $T$ cannot be too small, otherwise the result would have a large error. How large should $T$ be?

+

The original paper (p. 11) states: we make the assumption that $\delta \leq T/10$. Here $\delta = \lambda_jt_0 - 2\pi k$, $\lambda_j$ is any eigenvalue of $A$, $t_0$ is another parameter to be chosen, and $k$ is an integer that ranges from $0$ to $T - 1$. However, this means that $\delta$ may be anything between $\lambda_jt_0 - 2\pi T$ and $\lambda_jt_0$. How is it possible to guarantee that $\delta \leq T/10$?

+",13769,,55,,11/24/2020 14:17,11/24/2020 14:17,"In the HHL algorithm, how large should the eigenvalue estimation register be?",,0,0,,,,CC BY-SA 4.0 +14574,1,,,11/10/2020 20:37,,3,64,"

I have the results of 2 separate jobs that contain a set of 75 circuits each. I am trying to compare these jobs by plotting the average counts from all the circuits in job 1 vs the average counts from all the circuits in job 2 on a single histogram plot.

+

The image below is an example of what I am looking to create where the grey counts would be the average from the circuits in job 1 and the blue counts would be the average from the circuits in job 2.

+

+

Is this possible? What is the best way to go about creating this plot?

+

Thanks in advance!

+",13770,,1859,,11/10/2020 21:46,11/11/2020 1:19,Is it possible to plot the average counts from two jobs with multiple circuits on a single histogram in Qiskit?,,1,0,,,,CC BY-SA 4.0 +14575,2,,14574,11/11/2020 1:19,,1,,"

Yes, I have checked the code and find out that this is possible.

+

The qiskit function plot_histogram takes two types of input as the data: either a single dictionary or a list of dictionaries, so what you need is get the two distinct counts(that are two dictionaries) and then combine them into a list.

+

Here comes a simple illustration.

+
from qiskit.visualization import plot_histogram
+dict1={'00':2,'01':3,'10':1,'11':5}
+dict2={'00':0,'01':6,'10':7,'11':4}
+plot_histogram([dict1,dict2])
+
+

and the resulting bar plot will be

+

+",13647,,,,,11/11/2020 1:19,,,,0,,,,CC BY-SA 4.0 +14576,1,14593,,11/11/2020 1:25,,5,1119,"

There are thousands of articles, books and web sites describing the Hadamard Gate from a theoretical point of view.

+

But I haven't been able to find any photo about any real implementeation of a Hadamard Gate on superconducting circuits nor any article describing how to make one.

+

Only some articles speaking about optical implementation of Hadamard gates. +(An approach to realize a quantum Hadamard gate through optical implementation)

+

Maybe the following is the only one I've found with some information, though quite theoretical too (Realization of efficient quantum gates with a superconducting qubit-qutrit circuit)

+

How are the IBM and Google Hadamard gates fabricated (or created in the laboratory) and operated?

+",5138,,55,,11/11/2020 14:51,11/12/2020 5:39,How are the IBM's and Google's Hadamard gates fabricated and operated?,,3,1,,,,CC BY-SA 4.0 +14577,1,,,11/11/2020 5:06,,1,141,"

I found that how to make CRY Gates. +But I don't know how to make Controlled-CRY Gates. +Please show me a figure. + +Sorry for the poor English.

+",13730,,55,,11/13/2020 16:22,11/13/2020 16:22,How to make Controlled-CRY Gates,,1,1,,,,CC BY-SA 4.0 +14578,2,,14577,11/11/2020 5:25,,2,,"

If you are asking about the gate decomposition of $CCR_Y$ then it is:

+

+

The picture above was taken from this paper.

+

The more generalize case is:

+

+

This is from this textbook on page 182.

+",9858,,,,,11/11/2020 5:25,,,,1,,,,CC BY-SA 4.0 +14579,2,,14576,11/11/2020 7:43,,4,,"

Fundamentally, a device such as an IBM quantum computer interacts according to a Hamiltonian, which might have some time-varying parameters. For example, for a single qubit, it might look like: +$$ +H=BZ+\Omega(t)X, +$$ +where $X$ and $Z$ are the standard Pauli matrices, and $B$ is a constant.

+

The goal is "simply" to specify the function $\Omega(t)$ to generate whatever unitary evolution you want according to the differential equation +$$ +i\frac{d|\psi\rangle}{dt}=H|\psi\rangle. +$$

+

For the specific case of Hadamard, you can just set $\Omega(t)=B$ (assuming this is possible given the system constraints) for a fixed length of time $t_0$. Your evolution is then +$$ +U=e^{-iB(X+Z)t_0}=I\cos(B\sqrt{2}t_0)-i\sin(B\sqrt{2}t_0)\frac{X+Z}{\sqrt{2}} +$$ +So, if I pick $B\sqrt{2}t_0=\pi/2$, we get the evolution +$$ +U=-i\frac{X+Z}{\sqrt{2}}, +$$ +which is Hadamard up to an (irrelevant) global phase.

+",1837,,,,,11/11/2020 7:43,,,,2,,,,CC BY-SA 4.0 +14580,1,,,11/11/2020 10:09,,0,169,"

I try to run HHL algorithm on qasm_simulator. I took the example from here. I try to solve 8x8 random matrix and adjust some parameters in create_eigs.

+
aqua_globals.random_seed = 0
+matrix = random_hermitian(8)
+vector = matrix.dot(np.array([1, 2, 3, 4, 5, 6,7,8]))
+
+orig_size = len(vector)
+matrix, vector, truncate_powerdim, truncate_hermitian = HHL.matrix_resize(matrix, vector)
+
+# Initialize eigenvalue finding module
+eigs = create_eigs(matrix, 3, 10, False)
+num_q, num_a = eigs.get_register_sizes()
+
+# Initialize initial state module
+init_state = Custom(num_q, state_vector=vector)
+
+# Initialize reciprocal rotation module
+reci = LookupRotation(negative_evals=eigs._negative_evals, evo_time=eigs._evo_time)
+
+algo = HHL(matrix, vector, truncate_powerdim, truncate_hermitian, eigs,
+           init_state, reci, num_q, num_a, orig_size)
+result = algo.run(QuantumInstance(Aer.get_backend('qasm_simulator')))
+
+

Then, this error occur.

+
---------------------------------------------------------------------------
+BrokenProcessPool                         Traceback (most recent call last)
+<ipython-input-8-105a0b6b991d> in <module>
+     18 algo = HHL(matrix, vector, truncate_powerdim, truncate_hermitian, eigs,
+     19            init_state, reci, num_q, num_a, orig_size)
+---> 20 result = algo.run(QuantumInstance(Aer.get_backend('qasm_simulator')))
+
+~/.local/lib/python3.8/site-packages/qiskit/aqua/algorithms/quantum_algorithm.py in run(self, quantum_instance, **kwargs)
+     69                 self.quantum_instance = quantum_instance
+     70 
+---> 71         return self._run()
+     72 
+     73     @abstractmethod
+
+~/.local/lib/python3.8/site-packages/qiskit/aqua/algorithms/linear_solvers/hhl.py in _run(self)
+    407         else:
+    408             self.construct_circuit(measurement=False)
+--> 409             self._state_tomography()
+    410         # Adding a bit of general result information
+    411         self._ret["matrix"] = self._resize_matrix(self._matrix)
+
+~/.local/lib/python3.8/site-packages/qiskit/aqua/algorithms/linear_solvers/hhl.py in _state_tomography(self)
+    341 
+    342         # Extracting the probability of successful run
+--> 343         results = self._quantum_instance.execute(tomo_circuits)
+    344         probs = []
+    345         for circ in tomo_circuits:
+
+~/.local/lib/python3.8/site-packages/qiskit/aqua/quantum_instance.py in execute(self, circuits, had_transpiled)
+    268         # maybe compile
+    269         if not had_transpiled:
+--> 270             circuits = self.transpile(circuits)
+    271 
+    272         # assemble
+
+~/.local/lib/python3.8/site-packages/qiskit/aqua/quantum_instance.py in transpile(self, circuits)
+    229                                   the length is one.
+    230         """
+--> 231         transpiled_circuits = compiler.transpile(circuits, self._backend, **self._backend_config,
+    232                                                  **self._compile_config)
+    233         if not isinstance(transpiled_circuits, list):
+
+~/.local/lib/python3.8/site-packages/qiskit/compiler/transpile.py in transpile(circuits, backend, basis_gates, coupling_map, backend_properties, initial_layout, layout_method, routing_method, translation_method, scheduling_method, instruction_durations, dt, seed_transpiler, optimization_level, pass_manager, callback, output_name)
+    241 
+    242     # Transpile circuits in parallel
+--> 243     circuits = parallel_map(_transpile_circuit, list(zip(circuits, transpile_args)))
+    244 
+    245     if len(circuits) == 1:
+
+~/.local/lib/python3.8/site-packages/qiskit/tools/parallel.py in parallel_map(task, values, task_args, task_kwargs, num_processes)
+    133             # Otherwise just reset parallel flag and error
+    134             os.environ['QISKIT_IN_PARALLEL'] = 'FALSE'
+--> 135             raise error
+    136 
+    137         Publisher().publish("terra.parallel.finish")
+
+~/.local/lib/python3.8/site-packages/qiskit/tools/parallel.py in parallel_map(task, values, task_args, task_kwargs, num_processes)
+    123                 future = executor.map(_task_wrapper, param)
+    124 
+--> 125             results = list(future)
+    126             Publisher().publish("terra.parallel.done", len(results))
+    127 
+
+/usr/lib/python3.8/concurrent/futures/process.py in _chain_from_iterable_of_lists(iterable)
+    482     careful not to keep references to yielded objects.
+    483     """
+--> 484     for element in iterable:
+    485         element.reverse()
+    486         while element:
+
+/usr/lib/python3.8/concurrent/futures/_base.py in result_iterator()
+    609                     # Careful not to keep a reference to the popped future
+    610                     if timeout is None:
+--> 611                         yield fs.pop().result()
+    612                     else:
+    613                         yield fs.pop().result(end_time - time.monotonic())
+
+/usr/lib/python3.8/concurrent/futures/_base.py in result(self, timeout)
+    430                 raise CancelledError()
+    431             elif self._state == FINISHED:
+--> 432                 return self.__get_result()
+    433 
+    434             self._condition.wait(timeout)
+
+/usr/lib/python3.8/concurrent/futures/_base.py in __get_result(self)
+    386     def __get_result(self):
+    387         if self._exception:
+--> 388             raise self._exception
+    389         else:
+    390             return self._result
+
+BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.
+
+

Please tell me how to fix this error.

+",13676,,,,,8/8/2021 12:05,Qiskit HHL algorithm BrokenProcessPool error,,1,0,,,,CC BY-SA 4.0 +14581,2,,14580,11/11/2020 11:37,,1,,"

Multiprocessing in Python 3.8 sometimes has some hiccups, especially when used in combination with Matplotlib and Qiskit. You could try several things:

+
    +
  1. Run Python 3.7 instead of 3.8 (that's also likely to be faster since there's less overhead in the parallelization)
  2. +
  3. Check if you used Matplotlib somewhere and try to avoid it before the running the algorithm.
  4. +
  5. Disable parallelization by setting +
    import os
    +os.environ['QISKIT_IN_PARALLEL'] = True  # pretends the code already runs in parallel
    +
    +
  6. +
+

The first option is probably the best. The third option disables parallelization so it will slow down the computation if the circuits are large!

+",9800,,,,,11/11/2020 11:37,,,,1,,,,CC BY-SA 4.0 +14582,1,14608,,11/11/2020 12:40,,2,86,"

Suppose $\vert\Phi\rangle_{AR} = \frac{1}{\sqrt{|D|}}\sum_{i\in D} \vert ii\rangle_{AR}$ is the maximally entangled state. Let $V_{A\rightarrow BE}$ and $\tilde{V}_{A\rightarrow BE}$ be two isometries from $H_A$ to $H_B\otimes H_E$ such that

+

$$\langle\Phi_{AR}\vert I_R\otimes \tilde{V}^\dagger V\vert\Phi_{AR}\rangle\geq 1- \varepsilon$$

+

My questions are about the map $\tilde{V}^\dagger V$.

+
    +
  1. Is $\tilde{V}^\dagger V\leq I_A$ in a positive semidefinite sense? Following Rammus' comment, perhaps this doesn't make sense. Instead, how can one show that $\|I - \tilde{V}^\dagger V\|_1 = \text{tr}(I - \tilde{V}^\dagger V)$?

    +
  2. +
  3. How can one show that $\|I_A - \tilde{V}^\dagger V \|_1\leq \varepsilon|D|$?

    +
  4. +
+

Both these claims are made in Lemma 14 of this paper

+",4831,,4831,,11/11/2020 15:03,11/12/2020 16:17,Properties of composition of isometry and a perturbed adjoint,,2,5,,,,CC BY-SA 4.0 +14583,1,,,11/11/2020 13:11,,3,86,"

I'm not sure is it the right place to ask this but, I think it is better to ask here than Math Overflow. It is about how to find the matrix representation of an operator (for the CHSH test).

+
+

What are the matrices that has $\left|\frac{\pi}{8}\right>$ and $\left|\frac{5 \pi}{8}\right>$ with eigenvalues $\{1,-1\}$?

+
+

I can relate an operator with eigenbasis geometrically, but I do not know how to represent the operator matrix using these eigenbases and eigenvalues.

+",13783,,,,,11/14/2020 7:28,How to find original matrix from eigenbasis and eigenvalues?,,2,2,,,,CC BY-SA 4.0 +14584,2,,14583,11/11/2020 13:16,,4,,"

$$ +\left|\frac{\pi}{8}\right\rangle\left\langle\frac{\pi}{8}\right|-\left|\frac{5\pi}{8}\right\rangle\left\langle\frac{5\pi}{8}\right| +$$

+",1837,,,,,11/11/2020 13:16,,,,0,,,,CC BY-SA 4.0 +14585,1,,,11/11/2020 14:15,,1,454,"

In order to explore whether it is possible to train a Qiskit Quantum circuit with tensorflow I built a small toy model. +The purpose of this toy model is to find via tensorflow the correct angle to get "zero" output independent of the input.

+
import numpy as np
+import qiskit
+from qiskit.circuit import QuantumCircuit, QuantumRegister
+import tensorflow as tf
+from tensorflow.keras.layers import Input, Dense, Layer
+
+def QuantumCircuit(thetas, n_qubits=1):
+   
+   simulator = qiskit.Aer.get_backend('qasm_simulator')
+   shots=1024
+
+   circuit= qiskit.QuantumCircuit(n_qubits)
+   circuit.h(0)
+   circuit.ry(float(thetas),0)
+   circuit.measure_all()
+   
+   job = qiskit.execute(circuit,backend=simulator,shots=shots)
+   result = job.result().get_counts(circuit)
+
+   counts = np.array(list(result.values()))
+   states = np.array(list(result.keys())).astype(float)
+
+   # Compute probabilities for each state
+   probabilities = counts / shots
+   # Get state expectation
+   expectation = np.sum(states * probabilities)
+
+   return np.array(expectation)
+
+class Linear(Layer):
+   def __init__(self,units=1,input_dim=1):
+       super(Linear,self).__init__()
+       self.w = self.add_weight(shape=(input_dim,units),initializer='random_uniform', trainable=True)        
+       
+   def call(self, inputs, input_dim=1):
+       if (tf.executing_eagerly()):
+           return QuantumCircuit(self.w)           
+       return inputs
+
+x_train = np.arange(10)
+y_train = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
+
+inputs=Input(shape=(1,))
+outputs=Linear()(inputs)
+model=tf.keras.models.Model(inputs=inputs,outputs=outputs)
+model.summary()
+model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=0.01),
+loss=tf.keras.losses.MeanSquaredError())
+model.fit(x_train, y_train, epochs=100, batch_size=1, verbose=1)
+
+

Unfortunately the toy model doesn't work and I get the following error:

+

optimizer_v2.py:1219 _filter_grads +([v.name for _, v in grads_and_vars],)) +ValueError: No gradients provided for any variable: ['Variable:0'].

+

So I tried to calculate the gradient "by myself":

+
@tf.custom_gradient
+def custom_activation(w):
+    result  = QuantumCircuit(w)
+    
+    def grad(dy):
+        eps=0.0001
+        result1=QuantumCircuit(w)
+        result2=QuantumCircuit(w+eps)
+        grad=(result2-result1)/eps
+        return dy * [grad]
+
+    return result, grad
+
+

as an intermediate step before the Quantum circuit is called. But this works out neither :-(

+

Does anybody have another idea to plug in Qiskit circuits into tensorflow and to deal with the fact that the automatic differentiation framework of tensorflow does not work in this case ? +Thanks a lot !!

+",7545,,,,,11/11/2020 16:47,Usage of Tensorflow/Keras to train Qiskit circuits,,2,0,,,,CC BY-SA 4.0 +14586,2,,10126,11/11/2020 14:36,,3,,"

Yes, there is a nice way to represent this composition, valid for any linear map, not only unitaries. It is so useful that it has a name, link product.

+

Let $\mathcal E:A\to B$ and $\mathcal F:B\to C$ be two linear maps, and $J(\mathcal E)$ and $J(\mathcal F)$ their Choi representations. The Choi representation of their composition $\mathcal F \circ \mathcal E$ is then given by +$$J(\mathcal F \circ \mathcal E) = \operatorname{tr}_B\big[(I_A\otimes J(\mathcal F))(J(\mathcal E)^{T_B} \otimes I_C)\big],$$ +where $T_B$ is the partial transposition over subsystem $B$.

+",12541,,,,,11/11/2020 14:36,,,,0,,,,CC BY-SA 4.0 +14587,2,,6144,11/11/2020 14:58,,1,,"

If $\Phi$ is positive but not completely positive, then it gives an operator that has positive trace with separable quantum states, that is, an entanglement witness.

+

To see that, let $|\Omega\rangle := \sum_i |ii\rangle$, such that $J(\Phi) = I \otimes \Phi ( |\Omega\rangle\langle\Omega|)$, and let $A,B$ be positive semidefinite operators of the appropriate dimensions. Then +$$\operatorname{tr}\big[I \otimes \Phi ( |\Omega\rangle\langle\Omega|) A\otimes B\big] = \operatorname{tr}\big[|\Omega\rangle\langle\Omega| A\otimes \Phi^\dagger (B)\big] \ge 0,$$ +as the adjoint of a positive map is always positive.

+",12541,,,,,11/11/2020 14:58,,,,2,,,,CC BY-SA 4.0 +14588,1,,,11/11/2020 15:09,,4,126,"

Companion question on MathOverflow

+

Let us order the four nonnegative eigenvalues, summing to 1, of a two-qubit density matrix ($\rho$) as +\begin{equation} +1 \geq x \geq y \geq z \geq (1-x-y-z) \geq 0. +\end{equation} +The set ($S$) of absolutely separable states (those that can not be "entangled" by global unitary transformations) is defined by the additional inequality (eq. (1) in Halder) +\begin{equation} +x - z \leq 2 \sqrt{y (1-x-y-z)}. +\end{equation}

+

Is the set $S$, that is, +\begin{equation} +1 \geq x \geq y \geq z \geq (1-x-y-z) \geq 0 \land x - z \leq 2 \sqrt{y (1-x-y-z)}, +\end{equation} +convex?

+

If so, I would like to seek to determine the John ellipsoids JohnEllipoids containing and contained within $S$ and see if they are simply the same as the circumscribed ($\mbox{Tr}(\rho^2) \leq \frac{3}{8}$) and inscribed ($\mbox{Tr}(\rho^2) \leq \frac{1}{3}$) sets, respectively Adhikari .

+

These two sets are determined by the constraints +\begin{equation} +1 \geq x \geq y \geq z \geq (1-x-y-z) \geq 0 \land x^2 +y^2 +z^2 +(1-x-y-z)^2 \leq \frac{3}{8}. +\end{equation} +and +\begin{equation} +1 \geq x \geq y \geq z \geq (1-x-y-z) \geq 0 \land x^2 +y^2 +z^2 +(1-x-y-z)^2 \leq \frac{1}{3}. +\end{equation} +(The latter set corresponds to the separable "maximal ball" inscribed in the set of two-qubit states (sec. 16.7 GeometryQuantumStates).

+

Further, I am interested in the Hilbert-Schmidt probabilities (relative volumes) Hilbert-Schmidt of these various sets. These probabilities are obtained by integrating over these sets the expression +\begin{equation} +9081072000 \left(\lambda _1-\lambda _2\right){}^2 \left(\lambda _1-\lambda _3\right){}^2 \left(\lambda + _2-\lambda _3\right){}^2 \left(2 \lambda _1+\lambda _2+\lambda _3-1\right){}^2 \left(\lambda _1+2 + \lambda _2+\lambda _3-1\right){}^2 \left(\lambda _1+\lambda _2+2 \lambda _3-1\right){}^2, +\end{equation} +where the four eigenvalues are indicated. (This integrates to 1, when only the eigenvalue-ordering constraint--given at the very outset--is imposed.)

+

In the answer to 4-ball, we report formulas for the Hilbert-Schmidt probabilities (relative volumes) of these inscribed and circumscribed sets, that is, +\begin{equation} +\frac{35 \pi }{23328 \sqrt{3}} \approx 0.00272132 +\end{equation} +and the considerably larger +\begin{equation} +\frac{35 \sqrt{\frac{1}{3} \left(2692167889921345-919847607929856 \sqrt{6}\right)} \pi}{27518828544} \approx 0.0483353. +\end{equation} +(We also have given an exact--but still quite cumbersome--formula [$\approx 0.00484591$] for $\mbox{Tr}(\rho^2) \leq \frac{17}{50}$.)

+

Further, in the answers to AbsSepVol1 and AbsSep2 , +the formula for the Hilbert-Schmidt volume (confirming and rexpressing the one given in +2009paper) +\begin{equation} +\frac{29902415923}{497664}-\frac{50274109}{512 \sqrt{2}}-\frac{3072529845 \pi }{32768 + \sqrt{2}}+\frac{1024176615 \cos ^{-1}\left(\frac{1}{3}\right)}{4096 \sqrt{2}} \approx 0.00365826 +\end{equation} +of the intermediate absolutely separable set $S$ has been given.

+

As to the total (absolute and non-absolute) separability probability of the 15-dimensional convex set of two-qubit density matrices, compelling evidence of various kinds--though yet no formalized proof--indicate that its value is the considerably larger +$\frac{8}{33} \approx 0.242424$ MasterLovasAndai . (One can also enquire as to the John ellipsoids for this [known-to-be] convex set JohnEllipsoid2.)

+

Here is a joint plot of the three sets of central interest here.

+

ThreeSetPlot

+",3089,,2927,,11/14/2020 14:15,11/14/2020 14:15,Is the set of two-qubit absolutely separable states convex?,,0,4,,,,CC BY-SA 4.0 +14589,2,,14585,11/11/2020 16:24,,0,,"

I would use Pennylane to do that. And Pennylane offers a plugin to Qiskit so you can run your circuit on IBM's hardware.

+

Although with the new Qiskit release, they provide a gradient frame work within Qiskit if you are interested. Here is the link to the announcement.. And here is the link to their tutorial notebook on gradient framework.

+",9858,,9858,,11/11/2020 16:40,11/11/2020 16:40,,,,1,,,,CC BY-SA 4.0 +14590,1,,,11/11/2020 16:34,,3,67,"

I am reading through the following article https://arxiv.org/abs/1601.02036.

+

Eq. (22) describes one of the terms of the gradient of the log-likelihood cost function, which can be estimated using Boltzmann averaging.

+

Eq. (22) looks like this

+

$$\frac{Tr[e^{-H}\delta_\theta H]}{Tr[e^{-H}]},$$ +and the article states that this term can be estimated by sampling from eq. (12).

+

Eq. (12) looks like this

+

$$ \rho = \frac{e^{-H}}{Tr[e^{-H}]}.$$

+

Can someone give me an explanation of how this is done on a quantum computer? +I was thinking that the expectation of the truncated Taylor expansion term $e^{-H} \approx I - H$ could be evaluated +$$ \langle v| I - H |v \rangle, $$ +for every basis state $|v \rangle$ and this would make it possible to estimate the diagonal of $\rho$. However, this task would be exponential in the number of qubits so I suspect that this is not how to do it. Any ideas?

+",5632,,55,,11/13/2020 17:05,11/13/2020 17:05,Quantum Boltzmann machine: How do you sample from the Boltzmann distribution on a quantum computer?,,0,1,,,,CC BY-SA 4.0 +14591,2,,14585,11/11/2020 16:47,,1,,"

Indeed as was pointed out, this problem was figured out a few years ago and we built a software library for it. PennyLane was created to make it easier for users to perform automatic differentiation of hybrid quantum-classical computations.

+

For the specific use case, using PennyLane you could create a KerasLayer natively, to create a quantum layer. Such a quantum layer can then be used together with classical layers defined using Keras.

+

Furthermore, PennyLane is hardware and device agnostic. This means that the same quantum circuit could be run on different quantum devices and simulators by a minimal change in code.

+

Additional direct references that would be helpful:

+ +

Disclaimer: I'm one of the developers working on PennyLane.

+",8786,,,,,11/11/2020 16:47,,,,0,,,,CC BY-SA 4.0 +14592,1,,,11/11/2020 18:31,,2,111,"

I was trying to solve an exercise from Vazirani's course "Qubits, Quantum Mechanics and Computers":

+

A mathematically nice, but unphysical, way to detect entanglement is to use the state inversion operator, $T$, which, for all states $n$ acts as $T\vert n\rangle = \vert -n\rangle$. Why can’t this operator be realized physically?

+

Can anyone help me with this problem? Many thanks! The problem is from https://inst.eecs.berkeley.edu/~cs191/fa10/homework/hw7.pdf

+",13785,,1108,,11/12/2020 14:28,11/12/2020 19:18,Can the (universal) state inversion operator be physically realized?,,2,7,,,,CC BY-SA 4.0 +14593,2,,14576,11/11/2020 20:02,,7,,"

A Hadamard gate isn't usually a physical object that you pass qubits through. In the case of superconducting qubits, the Hadamard gate is performed by bouncing microwaves off of the qubits. It doesn't look like anything.

+

So you're not going to find a picture of a superconducting Hadamard gate on a chip. The closest thing to that would be one of the blips in this picture of the microwaves being sent down a line:

+

+",119,,119,,11/11/2020 20:11,11/11/2020 20:11,,,,2,,,,CC BY-SA 4.0 +14594,1,14595,,11/11/2020 23:44,,4,218,"

I had a question last week regarding the simulation of Hamiltonians composed of the sum of Pauli products: How can I simulate Hamiltonians composed of Pauli matrices? I'm having a follow-up question: still for those two Hamiltonians: +$$ +H_{1} = X_1+ Y_2 + Z_1\otimes Z_2 +\\ +H_{2} = X_1\otimes Y_2 + Z_1\otimes Z_2 +$$ +How can I perform the 'controlled version' of them? The thing really confused me is the 'tensor product term': for both $H_1$ and $H_2$, the two qubits are coupled, but if I want to do the controlled time-evolution simulation, should I couple the whole thing with the third qubit? If so, how to do that?

+

Thanks:)

+",12334,,12334,,11/12/2020 0:17,11/12/2020 5:30,Simulate Hamiltonians with Pauli operations (controlled time evolution),,1,2,,,,CC BY-SA 4.0 +14595,2,,14594,11/12/2020 1:01,,2,,"

So we know that $e^{i t H_2}$ has the following circuit:

+

+

From this answer along with page 13 from this paper we can try to build the controlled-version of $e^{i t H_2}$ as follow:

+

+",9858,,9858,,11/12/2020 5:30,11/12/2020 5:30,,,,3,,,,CC BY-SA 4.0 +14596,1,,,11/12/2020 1:46,,0,202,"

Is there a quantum circuit (preferably on Quirk as an example) that will enable me to find the maximum from two inputs?

+

Example

+
    +
  • input A: 11011
  • +
  • input B: 11100
  • +
+

Expected output: 11100

+",13729,,55,,11/13/2020 16:18,11/13/2020 16:18,Is there a quantum circuit to find the maximum of two inputs?,,1,2,,,,CC BY-SA 4.0 +14597,1,,,11/12/2020 2:32,,2,208,"

When simulating quantum circuits in Qiskit, sometimes you need to build your own operation. And when you are doing so you would like to save the computational cost, but the QuantumCircuit object takes only QuantumRegister object as input(while rejects the qubit object) and this might be cumbersome.

+

For instance, see the code:

+
def swappedOp(obj,qr0,qr1,index):
+    circ=QuantumCircuit(qr0,qr1)
+    circ.swap(qr0[qr0.__len__()-1],qr1[index])
+    circ.append(obj,[qr0[i] for i in range(qr0.__len__())]+[qr1[i] for i in range(qr1.__len__())])
+    circ.swap(qr0[qr0.__len__()-1],qr1[index])
+    return Operator(circ)
+
+

In this code, my input obj is a random unitary, and what this function does is to swap the action of two qubits(in this code, it swaps the last qubit of qr0 and qr1[index]) and the latter swap makes sure that in other operations the sequence is unchanged.

+

The needed action of the random unitary(or say obj) is taken place between all qubits in qr0 and one qubit in qr1, but to actually implement this operation in Qiskit I have to expand it to action between all qubits of the two quantum registers because the QuantumCircuit object only takes QuantumRegsiter as +input (not qubit) and this is computationally inefficient.

+

So what I want to know is: is there a way to convert between qubit object and QuantumRegister object? If so, this can be time-saving!

+",13647,,9006,,11/13/2020 10:22,11/17/2020 12:14,Qiskit programming: convert qubit to quantum register,,2,1,,,,CC BY-SA 4.0 +14598,2,,14576,11/12/2020 5:39,,2,,"

If you wish to see how the microwave pulse in IBM's device, you can use their pulse schedule function to generate the pulse correspond to the circuit you are running. For example, if you run the circuitz;

+

+

then on the device, the qubit is being act on by the following microwave pulse:

+

+
+

More details can be found here on the qiskit documentation page

+",9858,,,,,11/12/2020 5:39,,,,1,,,,CC BY-SA 4.0 +14599,2,,9408,11/12/2020 6:42,,1,,"

You could use superdense coding to partially time shift bandwidth, smoothing out network utilization. Or you could increase the bandwidth of a low latency link by sharing entanglement over a high latency link. https://algassert.com/quantum/2014/05/03/Storing-Bandwidth-with-Superdense-Coding.html

+

You can also use it to turn a two way link into a faster one way link. https://algassert.com/quantum/2015/01/17/Superdense-Coding-on-the-Fly-and-in-Reverse.html

+

All that being said, all of this assumes that sending a qubit is no harder than sending a bit, which seems very unlikely to me. Bits effectively are immune to more noise which makes their bandwidth much higher.

+",119,,,,,11/12/2020 6:42,,,,0,,,,CC BY-SA 4.0 +14600,2,,14597,11/12/2020 7:42,,1,,"

Qubit's are elements of the Quantum register. So you cannot really convert a Qubit to a register, but, as you did above, you can simply use a a list of the Qubit, [Qubit].

+

However you don't have to use the Qubit or QuantumRegister types at all. You can instead work with indices, which is often much more convenient. E.g. you code above could be written as

+
def swappedOp(obj, qr0, qr1, index):
+    m, n = len(qr0), len(qr1)  # store the number of qubits
+    circ = QuantumCircuit(m + n)
+    circ.swap(m - 1, m + index)
+    circ.append(obj, circ.qubits)  # circ.qubits are just all qubits in the circuit
+    circ.swap(m - 1, m + index)
+    return Operator(circ)
+
+

I'm not quite sure what obj in your code should act on, so I just assumed it acts on all qubits as you did above. But you can of course also change that line.

+

I hope this gives you the tools you need!

+",9800,,,,,11/12/2020 7:42,,,,1,,,,CC BY-SA 4.0 +14601,2,,14583,11/12/2020 7:49,,2,,"

Any normal matrix $A$ with eigenvalues $\lambda_i$ and respective eigenvectors $|u_i\rangle$ can be writen as +$$ +A = \sum_{i=1}^{n} \lambda_i |u_i\rangle\langle u_i|. +$$ +This is called spectral decomposition.

+

Note that a matrix is normal if $AA^\dagger=A^\dagger A$ holds. Hermitian and unitary matrices are special cases of normal ones.

+",9006,,9006,,11/14/2020 7:28,11/14/2020 7:28,,,,2,,,,CC BY-SA 4.0 +14602,2,,14596,11/12/2020 8:41,,1,,"

The easiest way is with a temporary comparison to decide which input to copy over:

+

+

If you want it to run without the extra output register, you can instead CSWAP the inputs based on the comparison bit, sorting them. You can't uncompute the comparison bit until you unsort them though.

+",119,,,,,11/12/2020 8:41,,,,0,,,,CC BY-SA 4.0 +14603,1,,,11/12/2020 9:19,,7,272,"

Using cirq, I have the following quantum circuit, with three parameters: phi, alpha and beta:

+
q0 = cirq.GridQubit(0,0)
+q1 = cirq.GridQubit(0,1)
+
+phi = sp.Symbol('phi')
+alpha = sp.Symbol('alpha')
+beta = sp.Symbol('beta')
+circuit = cirq.Circuit([
+                cirq.H(q0),
+                cirq.CNOT(q0,q1),
+                cirq.XPowGate(exponent=phi)(q0),
+                cirq.H(q1),
+                cirq.X(q1) ** (alpha*phi),
+                cirq.XX(q0,q1) ** (beta*phi),
+                cirq.measure(q0, q1, key='m')
+                ])
+SVGCircuit(circuit)
+
+

+

This circuit is just some randomness I was playing with, so please don't take it too seriously...

+

If I fix the values of alpha=2 and beta=-3 and perform a scan over phi from $[0,2\pi]$ I can generate a distribution of the number of times the system is measured in state $|00\rangle$ (actually not 100% sure I am right here)...

+

Example scan with phi=0.25

+
>>> resolver = cirq.ParamResolver({'phi':0.25,'alpha':alpha,'beta':beta})              
+>>> trials = cirq.Simulator().run(circuit, resolver, repetitions=1000)
+>>> trials.histogram(key='m')
+Counter({0: 726, 2: 124, 3: 122, 1: 28})
+
+

Plotting trials.histogram(key='m')[0] as a function of phi, I get:

+

+
+

Finally, my question...

+

What would be the best way to set this up as a (hybrid-)ML problem, in order to solve what the values of alpha and beta, given a prior distribution? +I.e. using this above distribution, I could turn this into a regression problem with a little NN to try and learn alpha and beta

+

I can think of possible ways to do it in a manual way by setting up a function to just return the distribution given parameters alpha and beta, before calculating the loss etc. I was hoping there was a better/cleaner way to do this, perhaps via tfq?

+

Any suggestions? Or suggestions to move to qiskit/pennylane?

+",13792,,4986,,11/16/2020 8:34,10/14/2021 18:04,"How to learn parameters in a quantum circuit, given an interference pattern?",,3,4,,,,CC BY-SA 4.0 +14604,2,,14603,11/12/2020 14:04,,0,,"

As I know, the quantum neural network(QNN) does have a category that relates to what you want, that is, learning an unknown oracle. As the operation of your circuit can be considered as known, QNN can generate a unitary that has the same operation as your circuit.

+

But a critical problem arises, is the correct answer always possible?

+

For example, in a two-dimensional rotation case, we know that R($\alpha$)R($\beta$)=R($\alpha+\beta$), so consider the R($\alpha+\beta$) as the oracle, it is impossible to learn the value of $\alpha$ and $\beta$ (but $\alpha+\beta$ is possible). This example is rather coarse, maybe you can extend it to a more general case.

+

And there is intentionally another difficulty, that is, how can we reduce the oracle from the QNN?

+

E.g., the oracle is a two-qubit Hadamard gate ($H\otimes H$) and the QNN architecture is [2,3,2], then what we get is a network of unitaries or a large unitary with dimension $2^7\times2^7$, then is it an easy job to reduce the two-qubit Hadamard gate ($2^2\times2^2$)?

+

The second concern comes to me recently and I have to work on it later (so now it may be just a guess), and for the details of QNN, I think this paper is great.

+

I am new to QNN and looking for more discussion.

+",13647,,,,,11/12/2020 14:04,,,,1,,,,CC BY-SA 4.0 +14605,2,,14350,11/12/2020 14:05,,2,,"

The Hilbert space of a two-qubit system is $4$-dimensional complex vector space. An arbitrary normalized vector in this space can be written as: +$$|\psi\rangle= \frac{[w_0 \, w_1 \, w_2 \, w_3]^t}{\sqrt{|w_0|^2+|w_1|^2+|w_2|^2+|w_3|^2}}$$ +Since an overall phase doesn't change the state of the system, we may choose the first component $w_0$ as real, thus if we define (for $w_0\ne 0$): +$$z_i = \frac{w_i}{w_0}$$ +We obtain: +$$|\psi\rangle= \frac{[1 \, z_1 \, z_2 \, z_3]^t}{\sqrt{1+|z_1|^2+|z_2|^2+|z_3|^2}}$$ +The coordinate functions $z_1$, $z_2$, $z_3$ parametrize almost everywhere the complex projective space $\mathbb{C}P^3$ which is the state space of two-qubit systems; but this fact will not be needed as the Haar probability measure on the space will be derived below from scratch. +The Euclidean measure on the complex four-dimensional vector space $\mathbb{C}^4$ is given by: +$$d_{\mu_{\mathbb{C}^4}} = \prod_{k=1}^4 \frac{d\text{Re}(w_k)d\text{Im}(w_k)}{2\pi}$$ +Obviously, this measure is invariant under the $4$-dimensional unitary group. The normalization condition defines a seven-dimensional sphere $S^7$, a measure on $S^7$ can be constructed as: +$$d_{\mu_{S^7 }} = \int \delta(|w_0|^2+|w_1|^2+|w_2|^2+|w_3|^2-1) \prod_{k=1}^4 \prod_{k=1}^4 \frac{d\text{Re}(w_k)d\text{Im}(w_k)}{\pi}$$ +($\delta$ is the Dirac delta function which restrict the measure to a unit spherical shell). Obviously, this measure is also invariant under the $4$-dimensional unitary group, thus it is a Haar-measure. +Substituting the equations for $z_i$ and integrating over $w_0$, we obtain a Haar-measure over $\mathbb{C}P^3$, i.e., the two-qubit state space: +$$ d_{\mu_{\mathbb{C}P^3}} = \int \delta(|w_0|^2(1+|z_1|^2+|z_2|^2+|z_3|^2)-1) \prod_{k=1}^3\frac{d\text{Re}(w_k)d\text{Im}(w_k)}{\pi} = \int |w_0|^6 (1+|z_1|^2+|z_2|^2+|z_3|^2)^{-1} \delta\left(|w_0|^2- \frac{1}{1+|z_1|^2+|z_2|^2+|z_3|^2}\right) \frac{d\text{Re}(w_0d\text{Im}(w_0)}{\pi}\prod_{k=1}^3 \frac{d\text{Re}(z_k)d\text{Im}(z_k)}{\pi}$$ +Performing the $w_0$ integration in polar coordinates: +We have: +$$\int |w_0|^6 \delta\left(|w_0|^2- \frac{1}{1+|z_1|^2+|z_2|^2+|z_3|^2}\right)\frac{d\text{Re}(w_0)d\text{Im}(w_0)}{\pi}\ = (1+|z_1|^2+|z_2|^2+|z_3|^2)^{-3}$$ +Thus: +$$d_{\mu_{\mathbb{C}P^3}} = \frac{1}{(1+|z_1|^2+|z_2|^2+|z_3|^2)^4}\prod_{k=1}^3\frac{d\text{Re}(z_k)d\text{Im}(z_k)}{\pi}$$ +In summary, we have a representation of a random two-qubit state vector together with a Haar probability measure on the state space.

+

Of course, repeating this construction for a single qubit, we get the usual Bloch vector and the round measure on the Bloch sphere: +$$|\psi\rangle= \frac{[1 \, z]^t}{\sqrt{1+|z|^2}}$$

+

$$d_{\mu_{S^2}} = \frac{1}{(1+|z|^2)^2}\frac{d\text{Re}(z)d\text{Im}(z)}{\pi}$$ +The Cartesian product of two Bloch spheres is the state space of a random separable two-qubit state, the state vector is given by: +$$|\psi\rangle= \frac{[1 \, z_1]^t \otimes [1 \, z_2]^t }{\sqrt{(1+|z_1|^2)( 1+|z_2|^2)}}$$ +And the corresponding measure: +$$d_{\mu_{S^2\times S^2}} = \frac{1}{(1+|z_1|^2)^2(1+|z_2|^2)^2}\prod_{k=1}^2\frac{d\text{Re}(z_k)d\text{Im}(z_k)}{\pi}$$

+

Practically, integrals of polynomial functions over the Haar measures $d_{\mu_{\mathbb{C}P^3}}$ $d_{\mu_{S^2\times S^2}}$ can be exactly evaluated e.g. by passing to polar coordinates.

+",4263,,,,,11/12/2020 14:05,,,,0,,,,CC BY-SA 4.0 +14606,2,,14592,11/12/2020 14:59,,1,,"

If you're talking about a single-qubit transformation where the Bloch vector is changed from $\vec{n}$ to $-\vec{n}$, then I would way think about how the Bloch vector is changing. You want it to go from +$$ +(n_x,n_y,n_z)\rightarrow(-n_x,-n_y,-n_z). +$$ +However, if we do any unitaries we want on the initial state, this doesn't change the feasibility of the operation, so let me start by applying pauli-$Y$. Hence we have achieved the transformation +$$ +(n_x,n_y,n_z)\rightarrow(-n_x,n_y,-n_z), +$$ +and the only step left is an effective +$$ +(n_x,n_y,n_z)\rightarrow(n_x,-n_y,n_z). +$$ +However, this is the transpose operation which, given the question, I'm assuming you already know to be impossible, and hopefully know how to prove is impossible (probably based on completely positive maps).

+

This is a reduction to a known problem. You could probably prove it more directly now. For example, take a suitable two-qubit state and show that the action of $T$ on one qubit does not leave a proper quantum state.

+",1837,,8141,,11/12/2020 18:56,11/12/2020 18:56,,,,1,,,,CC BY-SA 4.0 +14607,2,,14582,11/12/2020 15:01,,3,,"

I'll use $W$ instead of $\tilde V$. I believe there must be more constraints in the paper as to relation between $W$ and $V$ because as it stands the inequality is not true. For example take $V$ to be the identity matrix and let $W$ also be the identity matrix except we make the penultimate and final elements on the diagonal of $W$ be $e^{i \alpha}$ and $e^{-i \alpha}$ for some $\alpha \in [0,2\pi)$. Then +$$ +\mathrm{Tr}[ W^* V] = (|D|-2) + 2 \cos(\alpha). +$$ +So, using the identity $\langle \Phi_{AR} | I_A \otimes M_R | \Phi_{AR} \rangle = \frac{1}{|D|} \mathrm{Tr}[M_R]$, the constraint in the question is equivalent to +$$ +(|D|-2) + 2 \cos(\alpha) \geq |D|(1-\epsilon). +$$ +Rearranging we find this is equivalent to +$$ +\epsilon \geq \frac{2 - 2 \cos(\alpha)}{|D|} = \frac{4 \sin(\alpha/2)^2}{|D|}. +$$

+

Now let $K = \begin{pmatrix} 1-e^{-i \alpha} & 0 \\ 0 & 1-e^{i \alpha} \end{pmatrix}$, then +$$ +\| I - W^* V \|_1 = \| K \|_1 = 4 \sin(\alpha / 2). +$$

+

The claim is that if $|D| \epsilon \geq 4 \sin(\alpha/2)^2$ then we also have $|D|\epsilon \geq 4 \sin(\alpha/2)$ but notice that if $\alpha \in (0, \pi/2)$ then $\sin(\alpha/2)^2 < \sin(\alpha/2)$. Thus we can choose values of $\epsilon$ such that the constraint holds but the conclusion does not.

+",9854,,,,,11/12/2020 15:01,,,,0,,,,CC BY-SA 4.0 +14608,2,,14582,11/12/2020 16:17,,3,,"

After @Rammus answer explaining that the given inequality does not hold in general, i'll try to prove a weaker statement.

+

Define $ \Delta = V - \tilde{V} $. +The assumption is equivalent to +$$ \text{Tr}[I - \tilde{V}^{\dagger} V] \leq \epsilon \cdot |D| \implies +\text{Tr}[V^{\dagger}V - \tilde{V}^{\dagger} V] \leq \epsilon \cdot |D| \implies +\text{Tr}[\Delta^{\dagger} V] \leq \epsilon \cdot |D| $$

+

Since our assumption still holds if we exchange $V, \tilde{V}$ we get +$ \hspace{0.3em} \text{Tr}[(- \Delta)^{\dagger} \tilde{V}] \leq \epsilon \cdot |D| $. +The two inequalities combined give +$ \text{Tr}[\Delta^{\dagger}\Delta] \leq 2 \epsilon \cdot |D| $.

+

So +\begin{align*} +& +||I - \tilde{V}^{\dagger} V ||_1 = ||\Delta^{\dagger} V||_1 = ||\Delta^{\dagger}||_1 = \\ +& +\sum_k s_k \leq \sqrt{|D|} \cdot \sqrt{\sum_k s_k^2} = \sqrt{|D|} \cdot \sqrt{\text{Tr}[\Delta^{\dagger}\Delta]} \leq \sqrt{2\epsilon} \cdot |D| +\end{align*}

+

where $ s_k $ the singular values of $ \Delta $ and we used Cauchy-Schwarz inequality and the fact that trace norm is isometrically invariant.

+",13109,,,,,11/12/2020 16:17,,,,2,,,,CC BY-SA 4.0 +14609,1,14611,,11/12/2020 16:35,,0,118,"

The QPE on IBM platform finds the eigenvalue of a unitary operator, i.e $$U|\phi\rangle=e^{2\pi i\theta}|\phi\rangle$$ +and uses the rotation operators as $$U(\theta)=\begin{bmatrix}0 & 1\\ +1 &e^{i\theta}\end{bmatrix}$$ +My question is we can write $U|\phi\rangle=e^{2\pi i\theta}|\phi\rangle$ as $$U|\phi\rangle=e^{2e i\theta}|\phi\rangle$$ where, since even then the magnitude of the eigenvalue remains same. Of course that would require more number of measurement qubits. For instance for $\theta=0.5$, we had $4$, so this time we can increase the $n$ and get closer to $\theta=0.5$. My question is can this be done.

+",6070,,1859,,11/12/2020 16:49,11/12/2020 20:25,Quantum Phase estimation with $2\pi$ replaced with $2e$,,1,0,,,,CC BY-SA 4.0 +14610,2,,14592,11/12/2020 19:18,,0,,"

Well for starters it violates the no-communication theorem:

+

+

This is because under the hood the UniversalNot operation uses a conjugation. This breaks the symmetry between the imaginary and real parts of the wavefunction, so you can detect the UniversalNot happening anywhere else by preparing a local state like $|0\rangle + i|1\rangle$ and noticing the $|1\rangle$ component changing w.r.t. the $|0\rangle$ component.

+",119,,,,,11/12/2020 19:18,,,,0,,,,CC BY-SA 4.0 +14611,2,,14609,11/12/2020 20:25,,3,,"

No - the key intuition of QPE is that $e^{2 \pi i \theta} $ holds for $\theta \in [0, 1) $, and the reading out the ancilla provides the binary representation of the fraction.

+

If you changed the operator to $e^{2 e i \theta}$, $\theta \not \in [0, 1)$ necessarily. Instead, you should just use the typical QPE approach, but then find $\zeta$ where $2 e i \zeta = 2 \pi i \theta \implies \zeta = \frac{\pi}{e}\theta$, and correct for symmetries afterwards.

+",8343,,,,,11/12/2020 20:25,,,,0,,,,CC BY-SA 4.0 +14612,2,,4977,11/12/2020 22:47,,1,,"

List of quantum network simulators, taken from Rodney van Meter's post to the Quantum Internet Research Group (QIRG) Internet Research Task Force (IRTF) mailing list on 31 March 2020:

+

QuISP, Keio/WIDE +https://github.com/sfc-aqua/quisp

+

SimulaQron, QuTech +http://www.simulaqron.org/

+

NetSquid, QuTech +https://netsquid.org/

+

SeQueNCe, Suchara, Argonne +https://cpb-us-w2.wpmucdn.com/voices.uchicago.edu/dist/0/2327/files/2019/11/SeQUeNCe.pdf

+

SQUANCH, Bartlett +https://pypi.org/project/SQUANCH/ +https://arxiv.org/abs/1808.07047

+

QuNetSim, DiAdamo +https://arxiv.org/abs/2003.06397

+

QKD simulator in ns-3, including routing, Mehic et al +https://ieeexplore.ieee.org/document/8935373 +https://www.qkdnetsim.info/ +https://twitter.com/mickeyze2

+

Physical-layer, online calculator for SPDC +http://spdcalc.org/

+",4733,,4733,,11/14/2020 13:51,11/14/2020 13:51,,,,2,,,,CC BY-SA 4.0 +14614,2,,10057,11/13/2020 8:10,,1,,"

There has been some early studies on the speed limits of speed limits for quantum gates in multi-qubit systems by S. Ashhab, P. C. de Groot, and Franco Nori published in Physical Review. As per this research, it is found that the three-qubit Toffoli gate time varies greatly depending on the type of interactions and the system's geometry, taking only slightly longer than a two-qubit controlled-not (CNOT) gate for a triangle geometry. As per this research, the fidelity of the CNOT and SWAP gates are plotted in the following diagrams.

+

The fidelity of the CNOT gate as a function of the allowed time (t) in the case of Ising interactions.

+

+

The fidelity of the √swap gate as a function of the allowed time (t) in the case of Heisenberg interactions.

+

+",4501,,,,,11/13/2020 8:10,,,,0,,,,CC BY-SA 4.0 +14615,2,,14139,11/13/2020 8:33,,0,,"

The Qiskit.chemistry is part of the Qiskit Aqua (Algorithms for QUantum computing Applications). The qiskit.chemistry package supports problems including ground state energy computations, excited states and dipole moments of molecule, both open and closed-shell.

+

The code comprises chemistry drivers, together with a molecular configuration will return one and two-body integrals as well as other data that is efficiently computed classically. The output data from a driver can then be used as input to the chemistry module that contains logic which is able to translate this into a form that is suitable for quantum algorithms. The following API reference would be very helpful to understand the sample Qiskit.chemistry circuits.

+",4501,,,,,11/13/2020 8:33,,,,0,,,,CC BY-SA 4.0 +14616,2,,14523,11/13/2020 9:04,,2,,"

The block length is defined as the number of physical qubits you are using to encode the logical qubit. Thus in the parameters $[n,k,d]$ the value $n$ is your block length.

+

You can see this paper here for confirmation on what I just stated.

+

The error rate here is probably the error rate of the qubit.

+",9858,,,,,11/13/2020 9:04,,,,0,,,,CC BY-SA 4.0 +14617,1,,,11/13/2020 11:41,,3,265,"

I have came across many books online that all explain that if $N$ is large enough, then the average number of checks in $N/2$ but is there a mathematical explanation or derivation for why this is true?

+

I have considered when $N=2^n$ and tried to use logarithms but am not getting anywhere with this. Any help would be greatly appreciated

+

Sorry, I should have made it clear... I was referring to Grover's search algorithm and how I can show that if $N$ is large enough, then the average number of checks is $N/2$. I know I will have to check $N$ objects in the worst-case scenario

+",13796,,55,,11/19/2020 10:03,12/5/2020 15:24,"Is there an explanation for why, to search through an unstructured database, the average number of checks is $\frac{N}{2}$ in classical computation?",,3,4,,,,CC BY-SA 4.0 +14618,2,,14617,11/13/2020 13:44,,1,,"

It depends how formal you want to be about this. You might just start by saying that if you select $N/2$ items out of a database of size $N$, you've got a probability of 1/2 of finding the element you want. That gives a pretty good hint.

+

But if you want to do the full gory detail: imagine you take samples and keep going until you get a match. What's the probability that you stop on the $n^{th}$ round? It's given by (probability of not matching on 1st round)$\times$(probability of not matching on 2nd round)$\times\ldots\times$(probability of not matching on (n-1)th round)$\times$(prob of matching on nth round).

+

Assuming we got to the nth round, we have $N+1-n$ samples to pick from, of which 1 is a match and the other $N-n$ do not match. Thus, the probability of ending on the nth round is +$$ +p(n)=\frac{N-1}{N}\times\frac{N-2}{N-1}\times\frac{N-3}{N-2}\times\ldots\times\frac{N+1-n}{N+2-n}\times\frac{1}{N+1-n}. +$$ +If you look through all these terms, most cancel and you just get +$$ +p(n)=\frac{1}{N}. +$$ +You're equally likely to find the answer on each selection (perhaps feels obvious now we've calculated it!).

+

The average number of runs that you need is then +$$ +\sum_nnp(n)=\frac{N+1}{2}. +$$

+",1837,,,,,11/13/2020 13:44,,,,1,,,,CC BY-SA 4.0 +14619,2,,14617,11/13/2020 13:53,,1,,"

I think what you are talking about must an unstructured database, which can be improved by Grover search algorithm to $O(\sqrt n)$.

+

When learning courses like computation theory there may be related discussion of the search of the structured and unstructured database and they will tell you that classically the search of unstructured database will take $O(n)$ and structured can be faster.

+

For the unstructured case, which should be your case, say there are n data inside the database, and then the possibility that an arbitrary index leads to the right answer is $\frac{1}{n}$, then if you tested another case and found that it is wrong, then you guess again. At this time the probability of failing is $1-\frac{1}{n-1}$. If you are failing continuously, then the corresponding possibility is $\displaystyle\prod_{i=n-x+1}^{n}\frac{i-1}{i}$ at step x.

+

Given the probability formula, then at step $x=\frac{n}{2}$, the failure probability is $p=\displaystyle\prod_{i=n/2+1}^{n}\frac{i-1}{i}=\frac{(n-1)!/(n/2)!}{n!/(n/2+1)!}=\frac{n+2}{2n}$, which equals 0.5 when $n\rightarrow\infty$ (at step n you can see that the success possibility is 1).

+",13647,,,,,11/13/2020 13:53,,,,1,,,,CC BY-SA 4.0 +14620,2,,14139,11/13/2020 14:12,,0,,"

You can see the recent Google paper, but I have to say beforehand that this paper doesn't suit you. This paper requires familiarity with both the fields of quantum computing(to understand quantum circuit thing) and atomic-molecular physics(to understand the task and the Hartree-Fock method).

+

Maybe this qiskit documentation better suits you. With a background of CS, you should be familiar with the travelling salesman problem. But notes that this is another path of quantum computing, it focused on the Hamiltonian which depicts the time-evolution of the system while on the contrary, the quantum circuit acts on the state vector(or say qubits) step by step.

+

(Quantum annealing always using the time-dependent-Hamiltonian, I have not seen the Hamiltonian of this qiskit case but I guess this is in fact quantum annealing. But do not be that worry, quantum Turing machine, quantum circuit model and quantum annealer can be polynomially equivalent.)

+

I have to admit that this answer may not be that helpful to you.

+",13647,,,,,11/13/2020 14:12,,,,1,,,,CC BY-SA 4.0 +14621,1,,,11/13/2020 14:50,,1,76,"

We define the quantum state on a complex network in the form,

+

$$\mid\psi(t)\rangle=\sum_{i=1}^{N}\sum_{j=1}^{k_i}\psi_{i,j}(t)\lvert + i\to j\rangle, $$

+

where $N$ is the total number of nodes, the state $|i \to j⟩$ resides on the node $i$ and is to hop to the adjacent site $j$, while $k_i$ is the number of links attached to the node $i$.

+

My question is how this $|i \to j \rangle$, can be represented using binary coded bit string?

+

Reference: Discrete-time quantum walk on complex networks for community detection by Kanae Mukai

+",13517,,55,,11/19/2020 9:59,11/19/2020 9:59,How to encode $|i \rightarrow j \rangle$ using binary string?,,0,4,,,,CC BY-SA 4.0 +14622,1,14624,,11/13/2020 17:21,,3,244,"

You are given a function $f : \{0,1\}^n \to \{0,1\}$ and a quantum circuit, $C$, computing the signed implementation of $f$. Let $I_0$ be the input bit-strings of length $n$ where the first bit is $0$, and $I_1$ be the +remaining ones (i.e., the first bit is $1$).

+

You are given the promise that $f$ is one of these two types:

+
    +
  1. $f(x) = 0 $ for all $x$ belonging to $I_0$ and $f(x) = 1$ for all $x$ belonging to $I_1$

    +
  2. +
  3. The total number of strings in $I_0$ for which $f(x) = 1$ plus the total number of strings in $I_1$ for which $f(x)$ is $0$ is $2^{n-1}$.

    +
  4. +
+

Give an algorithm (i.e., quantum circuit) to distinguish between these two cases by calling $C$ only once.

+",13798,,55,,11/17/2020 10:17,11/17/2020 10:17,How to solve this Deutsch Jozsa variant?,,1,3,,,,CC BY-SA 4.0 +14623,1,,,11/13/2020 19:21,,0,32,"

In a non-regular graph the degree of each node is different.

+

So, the dimension of the coin operator also needs to be changed (as the number of options the walker has to hop to adjacent nodes will be different) as opposed to for example a 2-d regular graph where coin dimensions are $C^2$ for every node.

+

Any idea.

+",13517,,55,,11/19/2020 9:59,11/19/2020 9:59,How to make a Node dependent coin operator?,,0,2,,,,CC BY-SA 4.0 +14624,2,,14622,11/13/2020 20:11,,3,,"

I like this one!

+

Hint: Can you transform the function into another one that is closer to the type of functions Deutsch-Jozsa algorithm deals with?

+

Answer under spoiler, so as not to ruin the fun for others:

+
+

Implement the following phase oracle based on the oracle given for $f(x)$: $g(x) = f(x)$ if $x \in I_0$, and $g(x) = 1 - f(x)$ if $x \in I_1$. You can do that by applying the $f(x)$ oracle and then doing a Z gate on the first qubit. +
+ Now you have one of the two cases: +
+ 1. $g(x) = 0$ for all $x$ (constant!) +
+ 2. The total number of strings for which $g(x) = 1$ equals $2^{n-1}$ (balanced!) +
+ And this is exactly the Deutsch-Jozsa problem!

+
+",2879,,,,,11/13/2020 20:11,,,,1,,,,CC BY-SA 4.0 +14626,1,,,11/13/2020 20:56,,2,228,"

Given a matrix, say $\begin{bmatrix} 1.5 & 0.5\\ +0.5& 1.5 +\end{bmatrix}$, with eigenvalues $1$ and $2$, how do I proceed with the quantum phase estimation algorithm? +In particular, how do I choose $\theta$?

+

In the text I am reading it says fix $\theta=\pi$ and $\pi/3$ for the eigenvalues. How do they get this? +Can somebody explain?

+

Edit: is it linked by the approximation that $ \theta= 2\arcsin(C/\lambda_j)$, if so then why is $C=1$ in this matrix case?

+",6070,,55,,11/19/2020 9:56,11/19/2020 9:56,"Given a matrix, how do I proceed with the quantum phase estimation algorithm and choose $\theta$?",,1,4,,,,CC BY-SA 4.0 +14627,2,,1568,11/13/2020 21:27,,0,,"

https://www.academia.edu/resource/work/44494922

+

Check out the link above; it shows a computerized version of the delayed-choice quantum eraser experiment (Schully's) using an IBM quantum computer (with results); the answered provided by previous respondents refer to "Wheeler's delayed-choice experiment" not so much an "eraser" experiment. The difference is addressed in the paper.

+",13802,,,,,11/13/2020 21:27,,,,0,,,,CC BY-SA 4.0 +14628,2,,1568,11/13/2020 21:36,,4,,"

Quirk includes a mockup of the delayed choice eraser as an example circuit:

+

+

Any situation where you create an entangled state, and then switch between measuring in the same basis on both sides or a different basis will show the effect. You can reduce it down to fewer qubits if you're willing to give up the more visually direct waves in the output expectation:

+

+

+

In fact you can even make classical analogues:

+
+

Bob has a six-sided die, a two-sided coin, and a small empty box to put the coin in. He rolls the die, gets a result between 1 and 6, and places the coin in the box in a way that depends on the die roll. If the die roll was even, the coin is placed heads up. If the die roll was odd, the coin is placed tails up. Bob then writes down his die roll, and carefully hands the box to Alice.

+

Alice now has to decide to either a) just open the box or b) shake the box before opening it. (Shaking the box randomizes the coin.) Once the box is open, she writes down whether the coin was face up or face down, and also writes down whether or not she shook the box.

+

+
+",119,,,,,11/13/2020 21:36,,,,1,,,,CC BY-SA 4.0 +14630,2,,11796,11/13/2020 23:28,,3,,"

There is a recent article that just came out couple of months ago related to Dwave's new chip. Even here, you can see that they mentioned that there is no "quantum advantage" over classical thus far on any of the problems they have considered.

+

I like the comment made by Malibu Stacey in the comment section... and I quote

+
+

It's really not. Is D-Wave's new hardware "faster" than using a "classical" solution like Fujitsu's Digital Annealer hardware?
+Well you don't need to do multiple runs of the same problem on the Digital Annealer to have any confidence in your results like you do on D-Wave's hardware so no it's not any faster. +Is it more cost effective? The Digital Annealer is just a piece of regular silicon (AKA an ASIC) which doesn't need to be be supercooled so it's far cheaper to run (it's built on a PCI-E card so you could plug it into any regular desktop assuming you could get Fujitsu to sell you one). +Can it solve more complex problems? D-Wave's new hardware more than doubles the number of variables you can use to 5000 compared to their previous iteration but the first iteration of the Digital Annealer can handle a maximum of 8192 variables.

+So it's a pretty simple answer. It's not faster, cheaper or "better" than the purely classical solution which has been publicly available for almost 2 years now.

+
+",9858,,,,,11/13/2020 23:28,,,,0,,,,CC BY-SA 4.0 +14631,2,,11796,11/14/2020 1:26,,0,,"

If there is any quantum advantage, this Lockheed Martin paper must show a clue.

+

In this paper, they utilized the D-Wave machine to sample the Boltzmann distribution and thus trained a deep neural network. According to their observation, their machine can sample far better than a classical computer at the same sampling times(I have not read their code for the classical method, so this statement might have some problem). But the author also committed that they have not provided any theoretical analysis. I myself is also trying to figure out that, or in a more rigorous way, if there are any quantum advantage.

+

Here is two of their plot.

+

+",13647,,,,,11/14/2020 1:26,,,,0,,,,CC BY-SA 4.0 +14634,1,14638,,11/14/2020 11:24,,1,112,"

I want to perform the following operation: +$$U|0\rangle =1/\sqrt{n}\sum_{i=0}^{n}(|i\rangle).$$ +I know that Hadmard gate can give me the superposition of states $|0\rangle$ and $|1\rangle$. But it can only be applied to a single-qubit system.

+

Does anyone have any idea for a multi-qubit system?

+",13517,,55,,11/19/2020 9:53,11/19/2020 9:53,Which Gate set can be used to perform the function $U|0\rangle =\frac{1}{\sqrt{n}}\sum_{i=0}^{n}(|i\rangle)$?,,2,0,,,,CC BY-SA 4.0 +14635,2,,14634,11/14/2020 11:46,,2,,"

In fact, you just need to implement a lot of Hadamard gates(if lg(n) gives an integer).

+

E.G.

+

+",13647,,,,,11/14/2020 11:46,,,,4,,,,CC BY-SA 4.0 +14636,1,,,11/14/2020 13:48,,1,59,"

I would like to construct a quantum circuit s.t.

+
    +
  1. It maps a certain (relatively small) subset of computational basis vectors onto a different subset of those, e.g.
  2. +
+

$$ +|0101001\rangle \to |1000010\rangle, \; |1001011\rangle \to |0111011\rangle, \ldots +$$

+

(I was tempted to call such action "a permutation", but I guess it not necessarily is one.)

+
    +
  1. I don't care what circuit's action is on the rest of the basis vectors.
  2. +
+

How can I do that? Of course, ideally I would like to achieve this with a minimum number of single-qubit gates and CNOTs.

+",6313,,55,,11/19/2020 10:05,11/19/2020 10:05,How do I construct a circuit to reshuffle some computational basis vectors?,,0,5,,,,CC BY-SA 4.0 +14637,1,14646,,11/14/2020 14:03,,1,91,"

Excuse me if this question is absurd. I discovered logic gates a few weeks ago.

+

two-qubis Logic gates are represented by 4x4 matrices. +Can they mimic a general density matrix of pairs of spin 1/2 particles? +The problem that I have in mind is the reconstruction (tomography) of the global density matrix from the local measurement by Alice and Bob once they can compare their results. +I suppose that we can measure the 16 elements of the logic gate matrix. +Does it help to find a similar procedure for Bob and Alice?

+",13807,,8141,,11/15/2020 10:54,11/15/2020 10:54,How to measure a general two-qubits gate? Does it help to Bob and Alice?,,1,1,,,,CC BY-SA 4.0 +14638,2,,14634,11/14/2020 17:06,,1,,"

If your question implementation of the operation $U$ such that it create a equally superposition state, that is,

+

$$U|0\rangle^{\otimes n} =\dfrac{1}{\sqrt{2^n}} \sum_{i=0}^{2^n-1}|i\rangle$$

+

then $U$ can be implemented as

+

$$ U = H \otimes H \otimes \cdots \otimes H = H^{\otimes n}$$ +where $H$ is the Hadamard gate defined as $H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1\\ 1 & -1 \end{pmatrix}$ and $\otimes$ represents the tensor product operation as usual. For example,

+

$$ H \otimes H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1\\ 1 & -1 \end{pmatrix} \otimes \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1\\ 1 & -1 \end{pmatrix} = \dfrac{1}{2}\begin{pmatrix} 1 & 1 & 1 & 1\\ 1 & -1 & 1 & -1\\ 1 & 1 & -1 & -1\\ 1 & -1 & -1 & 1 \end{pmatrix} $$ +and note that by the property of tensor product of linear map

+

$$(H \otimes H) |0\rangle^{\otimes 2} = H|0\rangle \otimes H|0\rangle = \dfrac{|0\rangle + |1 \rangle}{\sqrt{2}} \otimes \dfrac{|0\rangle + |1 \rangle}{\sqrt{2}} = \dfrac{|00\rangle + |01\rangle + |10\rangle + |11\rangle}{2} $$

+

Hence, we see that $U$ defined as $H\otimes H$ takes $|00\rangle$ to +$$ \dfrac{1}{\sqrt{2^2}}\sum_{i =0}^{2^2 -1} |i\rangle = \dfrac{1}{2}\big( |0\rangle + |1\rangle + |2\rangle + |3\rangle\big) = \dfrac{1}{2}\big( |00\rangle + |01\rangle + |10\rangle + |11\rangle\big) $$

+
+
+
+

Now if you trying to implement a $U$ such that it takes the state

+

$$ |0\rangle^{\otimes n} \to \dfrac{1}{\sqrt{n}} \sum_{i =0}^{n-1} |i\rangle $$

+

for instance:

+

$$|000 \rangle \to \dfrac{1}{\sqrt{3}} \bigg(|000\rangle + |001\rangle + |010\rangle\bigg) = \dfrac{1}{\sqrt{3}} |0\rangle \otimes \big( |00 \rangle + |01\rangle + |10 \rangle ) = |W\rangle$$

+

I call the transformative state $|W\rangle $ because it is similar to the W-state. This transformation is more difficult than what we have done above to create uniform superposition state. But first note that we were able to factor out the first qubit from the system, so all we really need to do is to implement the state

+

$$ |P \rangle = \dfrac{1}{\sqrt{3}} \big( |00 \rangle + |01\rangle + |10 \rangle ) $$ +I call this state $P$ because of it is a partial entanglement state, The circuit to implement the state transformation from $|00\rangle \to |P \rangle$ is as follow:

+

+

You can see the statevector amplitude here:

+

+

Now, because of the fact that we were able to factor out the first qubit completely from the other two, this means by adding another qubit to our circuit, we can generate the transformation we wanted in the beginning. That is:

+

+

And we can look at the statevector and see that

+

+
+

Although it should be noted that if we extend this to 4 qubit then things get a little easier as we are looking for the transformation:

+

\begin{align} +|0000\rangle \to &\dfrac{1}{\sqrt{4}} \big(|0000\rangle + |0001\rangle + |0010\rangle + |0011\rangle \big) \\ +&= \dfrac{1}{\sqrt{4}} |00\rangle \otimes \big( |00\rangle + |01\rangle + |10\rangle + |11\rangle \big) \\ +&= \dfrac{1}{\sqrt{4}} |00\rangle \otimes \big(H \otimes H \big) |00\rangle +\end{align}

+

Thus the circuit would just be

+

+

and the state vector here is

+

+

From here you can see that for any qubit system $n$ such that $n = 2^N$ where $N \in \mathbb{N}$ then it will be something like the above case. That is, if you have $8$ qubit, then your transformation would be something like:

+

$$|00000000\rangle \to |00000\rangle \otimes \bigg[ (H \otimes H \otimes H)|000\rangle \bigg] $$

+

Which has the circuit representation of

+

+
+

And if you extend this to $n$-qubit state where $n \neq 2^N $ then can built the circuit to from the $n=3$-qubit case. For instance, if $n=5$-qubit then we are looking for the transformation

+

\begin{align} +|00000 \rangle \to &\dfrac{1}{\sqrt{4}} \big(|00000\rangle + |00001\rangle + |00010\rangle + |00011\rangle + |00100\rangle \big) \\ +&= \dfrac{1}{\sqrt{5}} |00\rangle \otimes \big( |000\rangle + |001\rangle + |010\rangle + |011\rangle + |100\rangle \big) \\ +\end{align}

+

To create the state $| P_5 \rangle = \dfrac{1}{\sqrt{5}} \big( |000\rangle + |001\rangle + |010\rangle + |011\rangle + |100\rangle \big)$ we can use the circuit:

+

+

then adding another two additional qubit to the above circuit give you what you want.

+",9858,,9858,,11/14/2020 19:14,11/14/2020 19:14,,,,1,,,,CC BY-SA 4.0 +14639,1,,,11/14/2020 17:20,,1,67,"

I am reading the following article, https://arxiv.org/abs/1812.08767, and I am trying to go though the derivation of McLachlan's variational principle for imaginary time evolution. The derivation is done in section B.1.2.

+

I am confused about going from this equation:

+

+

to this equation (assuming real $\theta_i$):

+

+

I think the $x$ at the end is a typo. What I dont understand is how the variation $\delta$ removes the need to sum over $i$, going from eq. (120) to (123). They also remove the $\dot{\theta}_i$ factor and seem to replace it with $\delta \theta_i$. I also dont understand why the final term in eq. (120) disappears.

+

I think I am overall a little confused as to what the variation $\delta$ actually does to an equation. Could anyone explain?

+",5632,,,,,11/14/2020 17:20,Variational imaginary time evolution: confused with derivation,,0,2,,,,CC BY-SA 4.0 +14640,2,,14172,11/14/2020 19:05,,1,,"

For a VQE, the circuit applies $Z \otimes Z$ and $X \otimes Z$ on different iterations, and their expectation values are added classically. So, it doesn't really matter which is run first on a quantum computer - they're entirely different circuits.

+",8343,,,,,11/14/2020 19:05,,,,0,,,,CC BY-SA 4.0 +14641,2,,14603,11/15/2020 2:12,,3,,"

I think there might be a lot to unpack here. Just making sure my understanding of the problem is correct:

+

I hand you a quantum circuit with some free parameters and then I hand you some samples from that quantum circuit at specific parameter values, but I don't tell you what the parameter values are and then your goal is to try and determine what the parameter values are via some optimization or ML type algorithm that takes the samples I gave you as input. I'm not entirely sure this is what you're after, but I can offer you a simple piece of code that does some of the major steps here in TFQ, which can hopefully serve as a good starting point to play around with things:

+
my_symbols = ...
+my_circuit = cirq.Circuit(...) # created containing `my_symbols`
+
+true_parameters = [1,2,3]
+guess_parameters = [4,5,6]
+
+# guess_distribution is a ragged tensor of shape [n_circuits, n_samples, n_qubits]
+guess_distribution = tfq.layers.Sample(my_circuit, symbol_names=my_symbols, symbol_values = guess_parameters, repetitions=10000)
+
+# true_distribution is a ragged tensor of shape [n_circuits, n_samples, n_qubits]
+true_distribution = tfq.layers.Sample(my_circuit, symbol_names=my_symbols, symbol_values = true_parameters, repetitions=10000)
+
+# Compute the histograms. [n_circuits, 2^n_qubits + 1]
+guess_probs = tf.math.bincount(tf.cast(guess_distribution.to_tensor(), tf.dtypes.int32)) / 10000
+true_probs = tf.math.bincount(tf.cast(true_distribution.to_tensor(), tf.dtypes.int32)) / 10000
+
+# Measure the distribution overlap between your parameter guess and the true parameters. scalar tensor.
+kl_overlap = tf.keras.losses.KLDivergence()(guess_probs, true_probs)
+
+

You could go a lot of different ways with this snippet. For example:

+
    +
  1. You could try different ways to characterize distribution closeness. KL divergence is a good way, but it is by no means the only way. Like you mention in your question there might be some ways of computing a few expectation values from your circuit that work as a good proxy quantity for distribution closeness.

    +
  2. +
  3. You could remain focused on the single circuit case and attempt to optimize the values of guess_parameters using an optimizer of your choice (gradient free ones like this one could work well). If you would like to use gradient based optimizers like the ones found in TensorFlow, you might need to investigate defining a custom gradient for your specific problem of "measuring distribution closeness" (since sampling on it's own is not differentiable) using the @tf.custom_gradient tag. This would then be compatible with your standard GradientTape workflow:

    +
  4. +
+
x = tf.constant(my_guess)
+with tf.GradientTape() as g:
+  g.watch(x)
+  y = my_closeness_function_decorated_with_custom_gradient(x)
+
+# Can now optimize x values using this tensor here.
+# Along with any of `tf.optimizers`.
+dy_dx = g.gradient(y, x)
+
+
    +
  1. Lastly you could frame the problem slightly differently: I hand you a quantum circuit with some free parameters and then I hand you some samples from that quantum circuit where each sample has a corresponding label associated with it. This label indicates a unique values of parameters that this sample came from. Again I don't tell you what any of these parameters are, but now the problem has become slightly harder in your goal is to try and determine which parameter values correspond to each specific label (not just one set of values for alpha and beta this time like in #1) using an algorithm that incorporates just the samples and labels.
  2. +
+

This is a far more complex problem and could function very similarly to the example you linked in your question, where the neural network must learn to map from labels to parameter values where the loss gets backprop'd through the samples you take via your closeness measure. At a high level this would require incorporating the above snippet decorated with a @tf.custom_gradient into that tutorial plus some structural modifications to the tf.keras.Model, but is in principle very doable. There are some more complex TFQ examples here that we also walk through here.

+

As a final note I will say TensorFlow is tricky and when you throw things like TensorFlow Quantum (or pennylane) on top of that, things can get really tricky. If you are more interested in 1 and 2 from the list, you might be better off sticking with you favorite between cirq/qiskit and doing everything manually, but if you are more interested in 3 I'd say tackling the learning curve of TF + TFQ would definitely help in the long run.

+

Here's a paper that might also interest you. They tackle a slightly different problem. Here the authors tried to use a neural network to emulate sampling from a quantum circuit. Turns out it's a little tricky :).

+",11700,,9006,,11/15/2020 7:24,11/15/2020 7:24,,,,1,,,,CC BY-SA 4.0 +14642,1,14645,,11/15/2020 5:21,,3,252,"

+

Hi, How to convert $|100\rangle$ 3-qubit quantum state into $\frac{1}{\sqrt{2}}(|000\rangle + |111\rangle)$ state using only Hadamard and CNOT gates? Also, is output state an entangled one?

+",13749,,55,,11/17/2020 16:24,11/17/2020 16:24,Transforming $|100\rangle$ state into $|000\rangle + |111\rangle$ state using only Hadamard and CNOT gates,,2,0,,,,CC BY-SA 4.0 +14643,2,,14642,11/15/2020 6:11,,2,,"

+

The upper figure shows the quantum circuit to do so, the first $X$ gate is to let the first qubit be in the $|1\rangle$ state coherently.

+

The state $\frac{|000\rangle+|111\rangle}{\sqrt2}$ is the GHZ state, it is one of the most famous tri-qubit entangled state (another one is the W state), you may see Wikipedia for detail.

+",13647,,9006,,11/15/2020 7:29,11/15/2020 7:29,,,,10,,,,CC BY-SA 4.0 +14644,1,,,11/15/2020 6:31,,0,112,"

It is very common to look at stabilizer codes as codes over GF(2) or codes over GF(4). Mostly I have seen this for computations for distance of codes and syndromes. How do other notions like say automorphism group (over GF(2)) or some other invariants translate to stabilizer code? In other words will automorphism group of GF(2) equivalent code say something about its corresponding stabilizer code? For eg. Let $Q$ be a quantum code and corresponding GF(2) linear code be $C$ represented by generatir matrix (or parity check matrix M). Now given $aut(C)$ that is $\lbrace A,P \in GL(F_2) \times S_n \rbrace$ that fix M, what can we say about aut(Q), I suppose now automorphism groups would be defined over complex fields or considering stabilizer formalism we might have one over paulis if we want to look at stabilzers as analog of generator matrices.

+",8132,,8132,,11/16/2020 9:12,11/17/2020 14:29,Considering quantum codes as codes over $F_2$,,1,4,,,,CC BY-SA 4.0 +14645,2,,14642,11/15/2020 7:38,,4,,"

If the first qubit is in state $|1\rangle$, i.e. the input state $|100\rangle$ then resulting GHZ state is $\frac{1}{\sqrt{2}}(|000\rangle - |111\rangle)$, i.e. the phase is $\pi$. To have phase $0$, $Z$ has to be applied but this gate is not allowed. But you can use controlled $Z$ which is composed only with $H$ and $CNOT$. The circuit is this

+

+

A part before orange line produces the state $\frac{1}{\sqrt{2}}(|000\rangle - |111\rangle)$ from $|100\rangle$, a part after the line is controlled $Z$.

+

Here is a resulting state from IBM Q:

+

+

As you can see, the phase is correct.

+",9006,,,,,11/15/2020 7:38,,,,0,,,,CC BY-SA 4.0 +14646,2,,14637,11/15/2020 10:53,,2,,"

Long story short: if you want to characterize a circuit or operation, you have to perform Quantum process tomography (QPT), which is a generalization of quantum state tomography, which is used to characterize states. QPT is not very easy unfortunately, there is a little math involved. Please see this answer to a previous question for a general overview.

+

A note on the relation of states/density matrices and unitaries

+

First a note on the correspondence between two-qubit states and two-qubit operations. You are right in saying that both are represented by $4\times 4$ matrices, but, as Rammus points out, the sets of valid density matrices and valid operations are not the same.

+
    +
  • A density matrix must have unit trace and only positive eigenvalues; the only way for a density matrix to have an eigenvalue of $1$ is when all others are zero, which means that the matrix is rank $1$ (this is a pure state).

    +
  • +
  • A unitary matrix has only unit eigenvalues (up to a phase) and is necessarily full rank.

    +
  • +
+

We can conclude that no density matrix can be a unitary matrix and vice versa.

+

Back to the question at hand

+

If Alice and Bob share a (possibly entangled) pair of spin-$\frac{1}{2}$ particles (we generally refer to the particles as qubits), they can reconstruct the state of the particle if they have multiple copies of the state. To do this, they both make repeated coordinated measurements in the $X, Y$ and $Z$ basis, so that they obtain $3^2 = 9$ different measurement statistics. They can reconstruct the density matrix from all of the (combined) measurement outcomes, and the important thing to notice is that all measurements are local measurements; they only have to coordinate and communicate classically. This procedure is known as quantum state tomography (QST), please check this answer for further details.

+

If they know that their particles always go through some $2$-qubit unitary, they can try to reconstruct this unitary by having different 'input states' on which the unitary acts, and subsequently perform QST to reconstruct these 'output states'. If the output state of enough input states is known (you need $\geq 4^{2} = 16$ different input states) the entire unitary is encoded into the relation between the pairs of input and output states. Reconstructive methods allow to estimate the unitary operation.

+

Please do not be disheartened if you are not able to fully grasp what I have said here. QPT is not easy, and contains some slightly more advanced topics in quantum information science.

+

The main take away is that, yes, it is possible to reconstruct a unitary matrix from measurement results, coordination and some smart thinking alone.

+

Direct answers to your questions for quick reference

+
+

Can they mimic a general density matrix of pairs of spin 1/2 particles?

+
+

As pointed out, no, because the sets of density matrices and unitary operations is strictly disjoint.

+
+

The problem that I have in mind is the reconstruction (tomography) of the global density matrix from the local measurement by Alice and Bob once they can compare their results. I suppose that we can measure the 16 elements of the logic gate matrix.

+
+

As hinted at above, the direct elements from a unitary can not be measured, but we can reconstruct the elements through smart measurements on the output states of the unitary.

+
+

Does it help to find a similar procedure for Bob and Alice?

+
+

All the operations that Alice and Bob need to perform need to be coordinated between each other, and all operations are symmetrical; therefore it does not matter who is who.

+
+

Excuse me if this question is absurd.

+
+

Absolutely not!

+",8141,,,,,11/15/2020 10:53,,,,0,,,,CC BY-SA 4.0 +14647,1,14648,,11/15/2020 12:58,,1,103,"

Commutation operation is essential in quantum mechanics, but when I was trying to use the commutator of IBM qiskit I find something confusing.

+

Here comes the problematic code.

+
from qiskit import QuantumCircuit
+from qiskit.quantum_info import DensityMatrix
+from qiskit.aqua.operators.legacy import commutator
+
+qr0=QuantumCircuit(1)
+qr1=QuantumCircuit(1)
+circ0.x(0)
+dm0=DensityMatrix.from_instruction(circ0)
+circ1.z(0)
+dm1=DensityMatrix.from_instruction(circ1)
+
+

The upper codes generates two Density Matrices, and since they are matrices, mathematically we can compute their commutator, but then after you run commutator(dm0,dm1) you'll find that it's not working. Even if you try some other types like input two Operators or input the detailed matrices(dm.data) but it is just raised an error. E.g. in the lower code when the detailed matrices case returns an error.

+
dm0=Operator(dm0)
+dm1=Operator(dm1)
+commutator(dm0.data,dm1.data)
+
+

The errors that qiskit reports are nearly identical so I just put one of them as an example.

+

+

I know numpy or scipy can help me in circumventing the trouble, but I still want to ask: have anyone meet this before? Do you know how to fix this? Thanks!

+",13647,,1859,,11/15/2020 23:32,11/15/2020 23:32,How does Qiskit Aqua commutator work?,,1,0,,,,CC BY-SA 4.0 +14648,2,,14647,11/15/2020 13:19,,2,,"

According with the commutator documentation, it works on WeightedPauliOperator, not on numpy arrays.

+
from qiskit.aqua.operators.legacy import commutator
+from qiskit.aqua.operators import WeightedPauliOperator
+from qiskit.quantum_info import Pauli
+
+pauli_a = 'X'
+pauli_b = 'Z'
+coeff_a = 0.5
+coeff_b = 0.5
+pauli_term_a = [coeff_a, Pauli.from_label(pauli_a)]
+pauli_term_b = [coeff_b, Pauli.from_label(pauli_b)]
+op_a = WeightedPauliOperator(paulis=[pauli_term_a])
+op_b = WeightedPauliOperator(paulis=[pauli_term_b])
+
+print(commutator(op_a, op_b))
+
+
Representation: paulis, qubits: 1, size: 1
+
+",1859,,1859,,11/15/2020 13:31,11/15/2020 13:31,,,,1,,,,CC BY-SA 4.0 +14650,1,14652,,11/15/2020 17:04,,3,1703,"

In the photo provided the Quantum Fourier Transform is depicted in Qiskit before the barrier. I don't understand the result of inverse. Conceptually, should the inverse of the QFT be the same resultant as the original implementation? And is the inverse correctly depicted in Qiskit for this 3 bit QFT algorithm show below?

+",13081,,55,,11/18/2020 9:05,11/18/2020 9:05,Qiskit Inverse of a quantum fourier transformation,,1,0,,,,CC BY-SA 4.0 +14651,1,,,11/15/2020 17:34,,2,1229,"

I confused about how to calculate the probabilities and getting a certain result of measuring Bell's states with Pauli matrices as the operator. When you measure something, the state involved would be projected onto an eigenstate of the observable.

+

given $|\psi\rangle = \frac{1}{\sqrt2} (|01⟩ + |10⟩)$ as the state and +$\sigma_x = \left[\begin{matrix}0&1\\1&0\\\end{matrix}\right]$ as the observable.

+

if the probability is 1/2, how to calculate them actually? What is the state after measurement?

+",13823,,55,,11/18/2020 21:10,11/18/2020 21:10,What is the result of measuring $\sigma_x$ on the state $|01\rangle+|10\rangle$?,,2,0,,,,CC BY-SA 4.0 +14652,2,,14650,11/15/2020 17:55,,4,,"

From linear algebra we know that $(AB)^{-1} = B^{-1} A^{-1}$. This is because $(AB)*(AB)^{-1} = ABB^{-1}A^{-1} = AIA^{-1} = I$.

+

Hence, if you have the circuit to generate the Bell state from the state $|00\rangle$ which takes the form of:

+

+

then its inverse would be:

+

+

Putting them together gives you:

+

+

This makes sense as the inverse of $CNOT$ is $CNOT$, so they would formed Identity operator. Similarly, the inverse of Hadamard gate is itself... so altogether they will cancel each other out completely.

+
+

Thus, if I generate the QFT circuit for 4 qubit without the SWAP at the end, I would have:

+

+

then similarly to the above explanation with respect to the bell circuit and its inverse, the inverse QFT would be:

+

+

This is the reason why you see that you see in your circuit. hope that helps...

+",9858,,,,,11/15/2020 17:55,,,,0,,,,CC BY-SA 4.0 +14653,1,14657,,11/15/2020 22:22,,10,1096,"

I am newbie on Quantum Computing. Actually I am a software engineer but I want to understand how quantum computers work. So my question may be absurd. Sorry about that.

+

I tried to understand Deutsch-Jozsa algorithm to understand how quantum computers work. I understood it mathematically. But I couldn't understand it's logic. How this algorithm finds the solution in only one iteration?

+

Before studying about quantum computing in depth, I have been seeing that quantum computer can perform $2^n$ ($n$ is qubits count) process same time thanks to qubits superposition in various videos on YouTube.

+

I have two question:

+
    +
  1. Where is the parallelism in Deutsch-Jozsa algorithm? As I understand, the reason why this problem can be solved in one iteration is qubits can be put any position via quantum gates on Bloch sphere. Is it true?
  2. +
  3. How to develop quantum algorithm? Isn't it very difficult that developing an algorithm by thinking the state of matrices?
  4. +
+",13826,,55,,11/17/2020 10:16,5/31/2021 15:54,Where is the parallelism in Deutsch-Jozsa algorithm?,,2,0,,,,CC BY-SA 4.0 +14654,2,,14651,11/15/2020 23:08,,4,,"

The way to do this first requires rewriting whatever state you have in terms of the eigenstates of the operator in question. +$$ +|0\rangle = \frac{1}{\sqrt{2}} (|+\rangle + |-\rangle)\\ +|1\rangle = \frac{1}{\sqrt{2}} (|+\rangle - |-\rangle) +$$ +so that $|\psi\rangle$ becomes +$$ +\begin{align} +|\psi\rangle &= \frac{1}{\sqrt{2}} \Big( \frac{1}{2} (|+\rangle + |-\rangle)(|+\rangle - |-\rangle) + \frac{1}{2} (|+\rangle - |-\rangle)(|+\rangle + |-\rangle) \Big) \\ +&= \frac{1}{2\sqrt{2}} (2|++\rangle - 2|--\rangle) \\ +&= \frac{1}{\sqrt{2}} (|++\rangle - |--\rangle) +\end{align} +$$

+

Notice that this state still looks entangled in the $X$-basis, which is general property that entanglement cannot disappear just by rotating between bases. The second thing is that when you say you want to measure $X$, you have written a single-qubit operator, but this a two-qubit state. We can easily make it a two-qubit operator by taking the tensor product +$$ +\text{X on the first qubit} \rightarrow X \otimes I\\ +\text{X on the second qubit} \rightarrow I \otimes X +$$ +Here it actually doesn't matter which qubit of the entangled pair we measure, because their states are maximally correlated in the $X$-basis. Since the state's components are now expressed in terms of the eigenstates of either operator above, we can take the norm-squared of the amplitudes of the components of the state to see that we get either $|+\rangle$ (+1) or $|-\rangle$ (-1) with probability $1/2$ on either qubit we choose to measure.

+
+

See @KAJ226's post for the probability/measuring, below I'll explain how to get the eigenvectors

+

For the operators $Z$ and $Y$ the procedure is the same. Note that the computational state $|0\rangle$ and $|1\rangle$ are the eigenstates of the $Z$ operator, so you don't need to rewrite them. The eigenstates of the $Y$ operator are +$$ +|y+\rangle = \frac{1}{\sqrt{2}} (|0\rangle + i|1\rangle)\\ +|y-\rangle = \frac{1}{\sqrt{2}} (|0\rangle - i|1\rangle) +$$ +so that the computational states, rewritten in the $Y$-basis, are +$$ +|0\rangle = \frac{1}{\sqrt{2}} (|y+\rangle + |y-\rangle)\\ +|1\rangle = \frac{1}{i\sqrt{2}} (|y+\rangle - |y-\rangle) +$$

+

To obtain the eigenvectors of any matrix (operator), you look for solutions of the following equation

+

$$ +A|v\rangle = \lambda |v\rangle\\ +(A - \lambda I) |v\rangle = 0 +$$

+

where $A$ is an operator, $I$ is the identity matrix, $|v\rangle$ is a vector, and $\lambda$ is an eigenvalue. This equation has solutions when the determinant of the matrix $A - \lambda I$ is 0. As an example, for the $X$ operator

+

$$ +det(X - \lambda I) = 0\\ +det\begin{bmatrix} -\lambda & 1 \\ 1 & -\lambda \end{bmatrix} = 0\\ +\lambda^2 - 1 = 0\\ +\lambda = \pm 1 +$$

+

Knowing the eigenvalues, we plug them back into the original equation to find the eigenvectors. For the first eigenvalue $\lambda = +1$

+

$$ +A|v\rangle = +1 |v\rangle\\ +\begin{bmatrix} 0 & 1 \\ 1 & 0\end{bmatrix}\begin{bmatrix} a \\ b\end{bmatrix} = \begin{bmatrix} a \\ b\end{bmatrix} +$$

+

which says that $a=b$, so that the eigenvectors of eigenvalue +1 are the vectors $a\begin{bmatrix} 1 \\ 1 \end{bmatrix}$ for some scalar $a$. But remember, these vectors are quantum states, which must be normalized, so we can find $a$

+

$$ +\langle v | v \rangle = 1 = a^* a \begin{bmatrix} 1 & 1\end{bmatrix} \begin{bmatrix} 1 \\ 1 \end{bmatrix} = 2|a|^2 \\ +\frac{1}{2} = |a|^2 +$$

+

and we see that a simple solution is just that $a = \frac{1}{\sqrt{2}}$, which is the familiar normalization factor. The state we have found is

+

$$ +\begin{align} +\frac{1}{\sqrt{2}} \begin{bmatrix} 1 \\ 1\end{bmatrix} &= \frac{1}{\sqrt{2}} \bigg( \begin{bmatrix} 1 \\ 0 \end{bmatrix} + \begin{bmatrix} 0 \\ 1 \end{bmatrix} \bigg) \\ +&= \frac{1}{\sqrt{2}} \big( |0\rangle + |1\rangle \big) \equiv |+\rangle +\end{align} +$$

+

So if an eigenvector of $X$ is $|+\rangle$, then applying $X \otimes I$ to the state $|+\rangle \otimes |\phi\rangle$ for arbitrary $|\phi\rangle$ yields $+1 |+\rangle |\phi\rangle$, which is an eigenvector of eigenvalue +1.

+",4622,,4622,,11/16/2020 12:13,11/16/2020 12:13,,,,4,,,,CC BY-SA 4.0 +14655,1,14671,,11/16/2020 0:01,,1,63,"

How do I prove that for a general tri-partite state $\rho_{ABE}$, the following holds: +$$ +H(\rho_{AB}) = H(\rho_{E}), H(\rho_{AE}) = H(\rho_{B}), +$$ +where, $H$ is the Von Neumann entropy. Would Schmidt decomposition help? But I can only do it in a bi-partite scenario. Thanks!

+",2403,,55,,11/17/2020 10:16,11/17/2020 10:16,"Prove that for a general tri-partite state $\rho_{ABE}$, $H(AB) = H(E)$",,1,0,,,,CC BY-SA 4.0 +14656,1,,,11/16/2020 1:14,,-1,264,"

I confused about how to calculate the PROBABILITIES and getting a certain result of measuring Bell's states with Pauli matrices as the operator. When you measure something, the state involved would be projected onto an eigenstate of the observable.

+

Given $|ψ⟩ = \frac{1}{\sqrt2} (|01⟩ + |10⟩)$ as the state and $σy = \left(\begin{matrix}0&-i\\i&0\\\end{matrix}\right)$ as the observable.

+

How to calculate probability on the first qubit actually? What is the state after measurement?

+",13823,,2879,,11/16/2020 3:23,11/16/2020 7:41,Probabilities of entangled state. Quantum measurement,,1,3,,11/18/2020 6:28,,CC BY-SA 4.0 +14657,2,,14653,11/16/2020 1:18,,7,,"

In fact, in the original paper of Deutsch and Jozsa they actually implemented two oracles, here comes their procedure. If you omit the second $U_f$ and get a state $|\psi\prime>=\displaystyle\sum_{i=0}^{2N-1}(-1)^{f(i)}|i,f(i)>$, when quering the expectation value you need to put another $U_f$ on $|\phi>$ to get a state $|\phi\prime>=\displaystyle\sum_{i=0}^{2N-1}|i,f(i)>$. Otherwise, $<\phi|\psi\prime>$ always equals 0.

+

+

For your first question, the ability to using n qubits to evaluate say $2^n$ functions is parallelism. You see that for a classical computer, there are $2^n$ operations to evaluate while for the quantum computer you only need to perform the operation once (in this case if you applied n Hadamard gate beforehand). As for how the procedure works, I think what you mean is to perform a measurement and that won't work.

+

For the Deutsch-Jozsa, after you prepared the state $|\psi>$, what you need to do to extract the result is to get the expectation value, $<\phi|\psi>$, while if you perform a direct measurement $<\psi|\psi>$ you can not get the phase factor because there is no phase difference.

+

For your second question, it is difficult and all the comments I see admit this. What you need is to read some papers to find potential direction toward new algorithms.

+

First read this paper. Peter Shor write this paper in 2003, it includes what we have achieved and what we might to able to(although this is a rather old paper). Then there are a lot of recently hot fields like quantum machine learning, quantum network, optimization algorithms(such as using a quantum computer to solve travelling salesman problem), or some simulation algorithm for quantum systems.

+

Also, there are different approaches to implement quantum computing, like the quantum Turing machine, quantum annealing, quantum circuit, quantum random walk, and so on.

+",13647,,13647,,11/16/2020 2:22,11/16/2020 2:22,,,,1,,,,CC BY-SA 4.0 +14658,1,14669,,11/16/2020 2:50,,3,272,"

The quantum conditional entropy $S(A|B)\equiv S(AB)-S(A)$, where $S(AB)=S(\rho_{\rm AB})$ and $S(B)=S(\rho_{\rm B})$ is known to be non-negative for separable states. For entangled states, it is known that the quantum conditional entropy can attain both negative and positive values. Thus, a negative quantum conditional entropy serves as a sufficient, but not necessary, criterion for the quantum state to be entangled. References where this is stated would be https://arxiv.org/pdf/1703.01059.pdf or https://arxiv.org/pdf/quant-ph/9610005.pdf.

+

While it is easy to find entangled states which yield negative quantum conditional entropies, such as any pure entangled state, I cannot think of/construct an entangled state which yields a positive quantum conditional entropy. Can someone provide an example?

+",9082,,55,,11/17/2020 10:15,11/17/2020 10:15,Positive conditional quantum entropy for entangled state,,1,0,,,,CC BY-SA 4.0 +14659,1,20694,,11/16/2020 3:38,,6,105,"

I have a Q# operation:

+
    operation init_and(a: Qubit, b: Qubit, target: Qubit) : Unit is Adj {
+        // Uncomment this when using Toffoli simulator.
+        // CCNOT(a, b, target);
+
+        // Uncomment this when doing resource estimates.
+        body(...) {
+            CCNOT(a, b, target);
+        }
+        adjoint(...) {
+            H(target);
+            if (M(target) == One) {
+                CZ(a, b);
+            }
+        }
+    }
+
+

As you can see from the comments, I have to choose between being able to simulate the operation (when testing the correctness of constructions using it) and being able to correctly cost the operation (because uncomputing it should cost zero T gates).

+

Is there some way to get the best of both worlds? For example, some way to say "when testing correctness use this, when doing cost estimates use this"? Some way to query "Is the Hadamard available?"?

+",119,,55,,11/17/2020 10:15,8/3/2021 2:10,Simulator-dependent implementations in Q#,,3,0,,,,CC BY-SA 4.0 +14660,2,,14653,11/16/2020 3:46,,6,,"
+

"Where is the parallelism in Deutsch-Jozsa algorithm?"

+
+

Instead of inputting just 0 or just 1 into the black box, you input both 0 and 1 into the black box at the same time, because you send $\frac{1}{\sqrt{2}}\left(|0\rangle + |1\rangle \right)$ into the black box.

+
+

As I understand, the reason why this problem can be solved in one +iteration is qubits can be put any position via quantum gates on Bloch +sphere. Is it true?

+
+

It's true that quantum gates can put qubits anywhere on the surface of the Bloch sphere, but the reason for the parallelism is what I said in my answer to your first question: please see above :)

+
+

"How to develop quantum algorithm? Isn't it very difficult that +developing an algorithm by thinking the state of matrices?"

+
+

David Deutsch was a genius, and even he didn't come up with what we now call the Deutsch-Jozsa algorithm. He came up with an algorithm in 1985 that works only 50% of the time (and this was generalized to more than one qubit with Jozsa in the early 90s), and then it was four brilliant authors in 1998: Cleve, Eckert, Macchiavello and Mosca that came up with the version of the algorithm that you see in textbooks (and works 100% of the time, assuming no decoherence). Keep in mind that Deutsch's 1985 paper came more than a decade after Holevo discovered that n qubit can carry more information than n classical bits, and years after Feynman (the most prolific scientist in the world at the time) gave prolific talks motivating people to think about computing with hardware.

+

Therefore, you are correct, it's not easy to come up with something like the Deutsch-Jozsa algorithm out of thin air. Even Deutsch didn't do it, and even his version with Jozsa wasn't the modern version we see in textbooks. So how then do you program efficiently for quantum computers? Experience. Study the basic algorithms and the more you do, the more you'll get the hang of it and be able to now which quantum sub-routines to use, and how to develop your own algorithms when (and if!) you ever need to do that.

+",2293,,2927,,5/31/2021 15:54,5/31/2021 15:54,,,,2,,,,CC BY-SA 4.0 +14661,1,14662,,11/16/2020 4:24,,4,68,"

I'm reading a Hamiltonian simulation example proposed in this paper. From their notation, the operator $D_y$ (sometimes it's called $H_y$) serves the function to diagonalize the Pauli matrix $\sigma_y(Y)$ (the corresponding circuit is illustrated below): +$$ +D_y\ (or\ H_y)=HSX=\frac{1}{\sqrt{2}}\begin{bmatrix} +i & 1\\ +-i & 1 +\end{bmatrix} +\quad\quad\quad [A] +$$
+

+

However, unlike $D_x$, which is the Hadamard gate, I found $D_y$ is sometimes written in different ways, like in this answer by @Craig Gidney:

+

$$ +D_y\ (or\ H_{YZ}) = \frac{Y+Z}{\sqrt{2}} = \frac{1}{\sqrt{2}}\begin{bmatrix} +1 & -i\\ +i & -1 +\end{bmatrix} +\quad\quad\quad [B] +$$

+

and in this answer by @Davit Khachatryan:

+

$$ +D_y\ (or \ 'Y'_{not\ pauli\ here}) = U_2(0,\pi/2) =\frac{1}{\sqrt{2}}\begin{bmatrix} +1 & -i\\ +1 & i +\end{bmatrix} +\quad\quad\quad [C] +$$

+

Thus I'm wondering are those different versions of $D_y$ the same thing? Are they essentially all belong to $U_2$ gate?

+

Also, when should we use two $U_3$ gates outside of the CNOT gates to perform the time-evolution simulation (like in this case, the answer from @KAJ226)?

+

Thanks!!!

+",12334,,12334,,11/16/2020 18:28,11/16/2020 18:28,Definitions of $D_y$ gate in Hamiltonian simulation: are they the same?,,1,0,,,,CC BY-SA 4.0 +14662,2,,14661,11/16/2020 7:36,,2,,"

A and C are technically the same thing, they only differ by a global phase, which makes no difference.

+

B is technically different, but serves the same purpose. Note that if +$UYU^\dagger=Z$, then $$R_zUYU^\dagger R_z^\dagger=R_zZR_z^\dagger=ZR_zR_z^\dagger=Z$$ +so if the only effect you're interested in is the diagonalisation of $Y$, there is a freedom of an arbitrary $Z$ rotation $R_z=e^{i\theta Z/2}$ in the definition of your unitary.

+

In the end, we have the relations +$$ +D^C=-iD^A=S^\dagger D^B. +$$

+",1837,,,,,11/16/2020 7:36,,,,2,,,,CC BY-SA 4.0 +14663,2,,14656,11/16/2020 7:41,,1,,"

The matrix $\sigma_Y$ has two eigenvalues $\pm 1$, so the one-qubit projectors for the measurement are +$$ +\frac12(I\pm\sigma_Y). +$$ +Since you're measuring a two-qubit state, you need to express the measurement projects on both qubits. Since you're doing nothing to the second qubit, that's just the identity matrix: +$$ +P_{\pm}=\frac12(I\pm\sigma_Y)\otimes I. +$$ +You can check that $P_++P_-=I\otimes I$.

+

Now measurement follows the standard formalism. The probabilities of getting either outcome are +$$ +p_{\pm}=\langle\psi|P_{\pm}|\psi\rangle +$$ +and the possible states after the measurement are +$$ +|\psi_{\pm}\rangle=P_{\pm}|\psi\rangle/\sqrt{p_{\pm}}. +$$

+",1837,,,,,11/16/2020 7:41,,,,0,,,,CC BY-SA 4.0 +14664,1,,,11/16/2020 9:07,,0,272,"

For a n-qubit quantum state $|\psi\rangle=\displaystyle\sum_{i=0}^{2^N-1}|i\rangle$, by definition it's density matrix is $|\psi\rangle\langle\psi|=\displaystyle\sum_{i,j=0}^{2^N-1}|j\rangle\langle i|$.

+

Recently I am trying to implement a quantum neural network given by a paper, and one step of it is required so, maybe up to a normalization constant(at supplementary note 2, when calculating the derivative).

+

For a $2^N$ dimensional identity matrix, it does not violate the requirements of being a density matrix, but I just cannot figure out how to do so and I even think this is not possible, have anybody be at this place before?

+

An additional requirement of mine is that the density matrix must be produced by some qubits or this problem might be truly tedious.

+",13647,,1859,,11/21/2020 17:07,11/21/2020 17:07,Produce a quantum state with its density matrix an identity matrix up to an constant,,1,0,,,,CC BY-SA 4.0 +14665,1,,,11/16/2020 9:15,,2,336,"

I am running variational algorithms using QuasmSimulator, which means I am performing a classical optimization where the cost function is computed running a quantum circuit. Moreover, for the optimizer to converge I need high accuracy, which implies a large number of shots.

+

These two things combined make a run last for days on my laptop, even for a few qubits. Thus, I am trying to run shots in parallel to save some time. Qiskit has a backend option for this:

+
from qiskit.providers.aer import QasmSimulator
+backend = QasmSimulator(method="automatic", max_parallel_threads=6, max_parallel_shots=6)
+
+... the rest of the code...
+
+job = execute(circ, backend, shots=nshots)
+
+

However, when setting this option I see no difference, neither in runtime nor in CPU usage from Window's task manager. I think the problem could be that normally a python script just uses one core, so when Qiskit runs it "thinks" that indeed you have one core only. Any suggestion?

+

I am using Qiskit 0.23.0

+

(Note that I asking specifically about parallel shots and not parallel circuits, although that might also help with another issue I have)

+",11551,,,,,12/6/2022 15:08,Parallel shots on Qiskit,,1,7,,,,CC BY-SA 4.0 +14666,2,,14603,11/16/2020 9:25,,1,,"

Here's an update for those interested (& before I had read Michael's comment)

+

I changed my problem around a bit, after discovering TFQ/cirq cannot (yet) handle serialising complex power-raised gates. Also, it was getting too complex using a ControlledPQC to have non-trainable values (phi) and trainable values alpha and beta .. I think it's doable but it really does get tricky.

+

Anyway, here is the modified problem and solution I found adapting TensorFlow Quantum's examples ....

+
+

I now have this circuit:

+
# define two qubits
+q0 = cirq.GridQubit(0,0)
+q1 = cirq.GridQubit(0,1)
+
+# make a PauliSum gate that will return [1] if the state is a bell state b00 (|00>)
+z0 = cirq.Z(q0)
+z1 = cirq.Z(q1)
+z00 = (((1+z0)/2)*((1+z1)/2) )
+
+# define three parameters, x will be varied - a,b are fixed
+phi = sp.Symbol('phi')
+alpha = sp.Symbol('alpha')
+beta = sp.Symbol('beta')
+
+
+circuit = cirq.Circuit([
+                cirq.rx(phi)(q0),
+                cirq.ry(-2*phi)(q1),
+                cirq.H(q0),
+                cirq.CNOT(q0,q1),
+                cirq.rx(alpha)(q0),
+                cirq.ry(beta)(q1),
+                ])
+
+

which looks like: +

+

I can calculate the z00 expectation which is going to give me the same distribution as would running measurements on the state $|00\rangle$ (obviously)

+
#fix two values of alpha and beta
+a = 1.8
+b = -3
+
+#loop over phi from -6 to 6
+x_values = np.arange(-6,6,0.05)
+y_expectations = []
+
+for j in x_values:
+    #resolve the circuit for different values of phi
+    resolver = cirq.ParamResolver({'alpha':a,'beta':b,'phi':j})
+
+    #calcuclate the expectation value
+    result = cirq.Simulator().simulate(cirq.resolve_parameters(circuit,resolver))
+    e = z00.expectation_from_state_vector(result.final_state_vector,{q0:0,q1:1})
+    y_expectations.append(e)
+
+plt.scatter(x_values,y_expectations,label=f'Expected, $\\alpha$={a}, $\\beta$={b}')
+plt.xlabel('$\phi$')
+plt.ylabel('Expectation')
+plt.legend()
+plt.show();
+
+

Gives the following:

+

+

I can split the circuit into two parts:

+
    +
  1. Input qubits with rotations by the angle \phi
  2. +
+
input_circuit = cirq.Circuit([
+                cirq.rx(phi)(q0),
+                cirq.ry(-2*phi)(q1)
+                ])
+>>> input_circuit
+(0, 0): ───Rx(phi)──────
+
+(0, 1): ───Ry(-2*phi)───
+
+
    +
  1. The circuit that is going to be my model - aka given some inputs (rotated qubits) these will be entangled and rotated by fixed values that I want to learn.
  2. +
+
model_circuit = cirq.Circuit([
+                cirq.H(q0),
+                cirq.CNOT(q0,q1),
+                cirq.rx(alpha)(q0),
+                cirq.ry(beta)(q1),
+              ])
+>>> model_circuit
+
+(0, 0): ───H───@───Rx(alpha)───
+               │
+(0, 1): ───────X───Ry(beta)────
+
+

Using tfq I can make a really simple model based on the model_circuit:

+
#building a keras model
+#- the input is the input_circuit 
+#- the PQC outputs the expectation to be in state |00> from the model circuit, given the input circuit
+model = tf.keras.Sequential([
+    tf.keras.layers.Input(shape=(), dtype=tf.string),
+    tfq.layers.PQC(model_circuit, z00),
+])
+
+

Also, need to convert the input circuits (one circuit per value of phi) into tensors:

+
#generate a series of input circuits, with different x values (values of phi)
+input_circuits =  tfq.convert_to_tensor([
+                                        cirq.resolve_parameters(input_circuit, cirq.ParamResolver({'phi':x}))
+                                        ] for x in x_values)
+
+

I can test the model (randomly initialised values of alpha and beta given my input circuits:

+
#test the model 
+y_test = model([input_circuits]).numpy()
+#plot how a randomly initiated model compares with the expected
+plt.plot(x_values,y_expectations,lw=4,label=f'Expected, $\\alpha$={a}, $\\beta$={b}')
+plt.plot(x_values,y_test,'ro',label='Pre-trained NN output')
+plt.xlabel('$\phi$')
+plt.ylabel('Expectation')
+plt.legend()
+plt.show();
+
+

+

Next is to compile the model, using a basic optimiser and loss, e.g.:

+
optimizer = tf.keras.optimizers.Adam(learning_rate=0.01)
+loss = tf.keras.losses.MeanSquaredError()
+model.compile(optimizer=optimizer, loss=loss)
+model.summary()
+
+

Then the model can be fitted given now the y_expected from the original expectations (this could easily be the original 'measurements' distribution instead)

+
y_expected = np.array(y_expectations)
+history = model.fit(
+      input_circuits, y_expected,
+      epochs=20,
+      verbose=0)
+
+

After the model has been trained, I can make the predictions again and see how it's easily learnt what the parameters were:

+

+

I hope this helps someone - it's not quite the answer to my problem and I would like to not have to split up the circuit into an input and model. Ultimately this was just me having a bit of fun and I don't think is very realistic anyway!

+",13792,,12667,,10/14/2021 18:04,10/14/2021 18:04,,,,0,,,,CC BY-SA 4.0 +14667,2,,14651,11/16/2020 9:31,,3,,"

Note that $ \sigma_x = \begin{pmatrix} 0 & 1\\ 1 & 0 \end{pmatrix} $ has two eigenvectors $|+ \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix} $ and $|- \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ -1 \end{pmatrix} $ with the corresponding eigenvalues of $+1$ and $-1$, respectively.

+

According to the Born rule, the probability that we will get $+1$ on the first qubit which correspond to the $|+\rangle$ is $Tr( \rho M)$, where $\rho$ is the density matrix and in this case it is $\rho = |\psi \rangle \langle \psi|$, and $M$ is the projection operator onto the basis vector corresponding to the measurement outcome of $+1$ on the first qubit in this case. Calculating it out explicitly:

+

$$ \rho = |\psi \rangle \langle \psi | = \begin{pmatrix} 0 & 0 & 0 & 0\\ 0 & 1/2 & 1/2 & 0\\ 0 & 1/2 & 1/2 & 0\\ 0 & 0 & 0 & 0 \end{pmatrix} $$

+

\begin{align} M = |+\rangle \langle+| \otimes I = \bigg[ \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \end{pmatrix} \bigg] \otimes \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} &= \dfrac{1}{2} \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} \otimes \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} \\ +&= \dfrac{1}{2}\begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\\ 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\end{pmatrix} +\end{align}

+

And therefore,

+

$$Tr(\rho M) = Tr\bigg(\begin{pmatrix} 0 & 0 & 0 & 0\\ 0 & 1/2 & 1/2 & 0\\ 0 & 1/2 & 1/2 & 0\\ 0 & 0 & 0 & 0 \end{pmatrix} \dfrac{1}{2}\begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\\ 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\end{pmatrix} \bigg) = \dfrac{1}{2} $$

+
+

UPDATE: The state after measurement, $|\psi_{post}\rangle $, is going to be +\begin{align} +|\psi_{post}\rangle = \dfrac{ M |\psi \rangle }{ \sqrt{prob(+1)}} = \dfrac{ \dfrac{1}{2}\begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\\ 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\end{pmatrix} \dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 1 \\ 1 \\ 0 \end{pmatrix} }{ \sqrt{ 1/\sqrt{2} } } = \dfrac{1}{2} \begin{pmatrix} 1 \\ 1 \\ 1 \\ 1 \end{pmatrix} = |+ +\rangle +\end{align}

+

Note that $|++\rangle = |+ \rangle \otimes |+\rangle = \bigg(\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}\bigg) \otimes \bigg(\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}\bigg) = \dfrac{|00\rangle + |01\rangle + |10\rangle + |11\rangle }{2} $

+
+
+

This can be extended to measurement in $Y$ basis as well. But $ \sigma_y = \begin{pmatrix} 0 & -i\\ i & 0 \end{pmatrix} $ and hence its two eigenvectors +are $|i \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ i \end{pmatrix} $ and $|-i \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ -i \end{pmatrix} $ with corresponding eigenvalues of $+1$ and $-1$ respectively. Then the probability to see $+1$ on the first qubit can be again calculated by $Tr(\rho M)$ but here $M = |i\rangle \langle i| \otimes I $ which can be calculated explicitly as

+

\begin{align} M = |i\rangle \langle i| \otimes I = \bigg[ \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ i \end{pmatrix} \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & -i \end{pmatrix} \bigg] \otimes \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} &= \dfrac{1}{2} \begin{pmatrix} 1 & -i \\ i & 1 \end{pmatrix} \otimes \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} \\ +&= \dfrac{1}{2}\begin{pmatrix} 1 & 0 & -i & 0\\ 0 & 1 & 0 & -i\\ i & 0 & 1 & 0\\ 0 & i & 0 & 1\end{pmatrix} +\end{align}

+

and hence

+

$$Tr(\rho M) = Tr\bigg(\begin{pmatrix} 0 & 0 & 0 & 0\\ 0 & 1/2 & 1/2 & 0\\ 0 & 1/2 & 1/2 & 0\\ 0 & 0 & 0 & 0 \end{pmatrix} \dfrac{1}{2}\begin{pmatrix} 1 & 0 & -i & 0\\ 0 & 1 & 0 & -i\\ i & 0 & 1 & 0\\ 0 & i & 0 & 1\end{pmatrix} \bigg) = \dfrac{1}{2} $$

+
+

Update 2:

+

If you want to measure in the $Z$ basis then it's trivial as you can already see the answer but we can follow the same procedure for confirmation. $\sigma_z = \begin{pmatrix} 1 & 0\\ 1 & -1 \end{pmatrix} $ and it has two eigenvectors $|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$ and $|1 \rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$ with two associate eigenvalues $+1$ and $-1$ respectively. Now to know the probability of getting the first qubit to be measured with $+1$ is $Tr(\rho M)$ where $\rho$ is similar as before, and $M = |0\rangle \langle 0| \otimes I$, which works out explicitly as

+

\begin{align} M = |0\rangle \langle 0| \otimes I = \bigg[ \begin{pmatrix} 1 \\ 0 \end{pmatrix} \begin{pmatrix} 1 & 0 \end{pmatrix} \bigg] \otimes \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} &= \begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix} \otimes \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} \\ +&= \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\end{pmatrix} +\end{align}

+

Hence

+

$$Tr(\rho M) = Tr\bigg(\begin{pmatrix} 0 & 0 & 0 & 0\\ 0 & 1/2 & 1/2 & 0\\ 0 & 1/2 & 1/2 & 0\\ 0 & 0 & 0 & 0 \end{pmatrix} \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\end{pmatrix} \bigg) = \dfrac{1}{2} $$

+

and the state after collapsed is: +\begin{align} +|\psi_{post}\rangle = \dfrac{ \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 0\\ 0 & 0 & 0 & 0\end{pmatrix} \dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 1 \\ 1 \\ 0 \end{pmatrix} }{ \sqrt{ 1/\sqrt{2} } } = \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \end{pmatrix} = |0 1\rangle +\end{align}

+

This makes sense because we have $|\psi \rangle = \dfrac{|01\rangle + |10\rangle}{\sqrt{2}} $ and so if the first qubit is in the state $|0\rangle$ after measurement then this means that the state $|\psi \rangle$ has collapsed onto the eigenvector $|01 \rangle$, hence the reason why our calculation show $|01\rangle$ for $|\psi_{post}\rangle$. Similarly, if the read out indicates that the first qubit is a $|1\rangle$ then $|\psi_{post}\rangle$ would have been $|10\rangle$.

+",9858,,9858,,11/18/2020 19:58,11/18/2020 19:58,,,,14,,,,CC BY-SA 4.0 +14668,2,,14665,11/16/2020 9:32,,0,,"

There is a question which is quite alike to your problem in Quantum Computing-stack exchange. I have answered it before, you may see that.

+

I think the number of shots nearly does not change the running time(although I have been voted -1), you can see the problem and answers yourself.

+

Just for short, I think after qiskit evaluates the state vector, it gives you measurement results based on that state vector, instead of evaluate state vector $n$ times and gives you one measurement result each time(I guess, since if you import the time package and observe the time consumed about different shots you won't see a pattern that the consumed time grows with the number of shots).

+",13647,,13647,,11/16/2020 10:00,11/16/2020 10:00,,,,4,,,,CC BY-SA 4.0 +14669,2,,14658,11/16/2020 9:42,,4,,"

As you mention pure states will not do. So lets look at a simple example of mixed entangled states, two-qubit Werner states. Let $\rho_{AB} = q |\Psi^- \rangle \langle \Psi^-| + (1-q) I / 4$ where $| \Psi^- \rangle = \frac{1}{\sqrt{2}}(|01\rangle - |10\rangle)$ and $q \in [0,1]$. It is known that this family of states is separable iff $q \in [0, 1/3]$.

+

So let's calculate their conditional entropy. We have +$$ +H(AB) = 2 - \frac34 (1-q) \log(1-q) - \frac14 (1+3q)\log(1+3q) +$$ +and $H(B) = 1$. Putting this together we have +$$ +H(A|B) = g(q) +$$ +where $g(q) = 1 - \frac34 (1-q) \log(1-q) - \frac14 (1+3q)\log(1+3q)$. Now you can check that for a range of values greater than $1/3$ the conditional entropy is positive. E.g. $g(1/2) \approx 0.549$. Plotting $g(q)$ it looks like the entropy becomes positive somewhere just below $q = 3/4$.

+

+",9854,,,,,11/16/2020 9:42,,,,0,,,,CC BY-SA 4.0 +14670,1,,,11/16/2020 9:42,,2,62,"

I am trying to understand a part from the article "Restrictions on Transversal Encoded Quantum Gate Sets" (arxiv link) by Eastin and Knill.

+

In the article they talk about the importance of transversal encoded gates for fault tolerant quantum computing. They prove that there can't be a gate set that works on a non trivial quantum code space $\mathcal C$ that is also universal and the gates are transversal.

+

I understand the claim, but I have tried to understand the proof for a couple of weeks and just cant wrap my mind around it.

+

Can someone help me understand the following paragraph from the article?

+
+

An outline of the argument is as follows: The set of logical unitary product operators, $\mathcal G$, is a Lie subgroup of the Lie group of unitary product operators, $\mathcal T$. As a Lie group, $\mathcal G$ can be partitioned into cosets of the connected component of the identity, $\mathcal C$; these cosets form a discrete set, $\mathcal Q$. Using the fact that the Lie algebra of $\mathcal C$ is a subalgebra of $\mathcal T$, it can be shown that the connected component of the identity acts trivially for any local-error-detecting code. This implies that the number of logically distinct operators implemented by elements of $\mathcal G$ is limited to the cardinality of $\mathcal Q$. Due to to the compactness of $\mathcal T$, this number must be finite. A finite number of operators can approximate infinitely many only up to some fixed accuracy; thus, $\mathcal G$, the set of logical unitary product operators, cannot be universal. Transversal operators may be viewed as product operators with respect to a transversal partitioning of the code, so the ability to detect an arbitrary error on a transversal part implies the nonexistence of a universal, transversal encoded gate set.

+
+

Thank you for any help :)

+",13832,,2927,,10/13/2021 23:29,10/13/2021 23:29,"Understanding ""Restrictions on Transversal Encoded Quantum Gate Sets""",,0,0,,,,CC BY-SA 4.0 +14671,2,,14655,11/16/2020 10:13,,4,,"

This is not true for general tripartite states. Take the trivial example where $ABE$ share a maximally mixed state and each parties subsystem is of dimension $d$. The reduced states of a two-party subsystem are maximally mixed of dimension $d^2$ and of a single party system are maximally mixed of dimension $d$. As the dimensions are different and they are maximally mixed they cannot have the same entropy.

+

However, the result does hold if $\rho_{ABE} = |\psi\rangle \langle \psi|$ is a pure state. Moreover, we can use the Schmidt decomposition by identifying a two-party subsystem with just a single party. For example lets call $H_{A} \otimes H_B$ just $H_{D}$. Then we can view $|\psi\rangle$ as a state in $H_D \otimes H_E$ and use the Schmidt decomposition. That is we know there exists orthonormal bases $\{|i\rangle_D\}$ and $\{|i\rangle_E\}$ of $D$ and $E$ respectively such that +$$ +|\psi \rangle_{DE} = \sum_i \sqrt{\lambda_i} |ii\rangle. +$$ +As a consequence the reduced states have the same spectrum, +$ +\rho_D = \sum_i \lambda_i |i \rangle \langle i |$ and $\rho_E = \sum_i \lambda_i |i \rangle \langle i |$ and hence $H(D) = H(E)$. If you want to make this proof more formal you can do the identifying $H_A \otimes H_B$ with a single Hilbert space $H_D$ step using an isometry map $V : H_{A} \otimes H_{B} \rightarrow H_D$ and then note that the von Neumann entropy is invariant under isometries.

+",9854,,,,,11/16/2020 10:13,,,,1,,,,CC BY-SA 4.0 +14672,2,,9716,11/16/2020 10:14,,0,,"

So, in order to clarify what I wrote in the comments I'll write an answer here. I found a convincing approach by adding variables to nodes and combining it to ZX-Calculus with scalars (scalars are like normalization factors, see for example this paper). Indeed, a red node labelled with $0$ means "project on 0" and the red node labeled with $\pi$ means "project on $1$". That way, I can write directly a red node labelled $a\pi$, which is equivalent to saying that I measured an $a$.

+

This approach is equivalent to writing two diagrams, one with a red node $0$ and one with a red node $\pi$, and rewrite it until you get simple scalars (that's why you need ZX-Calculus with scalars), and this scalar will be equal to the probability of measuring $0$ or $1$. The addition of variables is just a nice trick to make sure that you just write a single diagram, which is much quicker to write, especially when you add several measurements. This idea is used (introduced?) for example in this paper. Note however that you need to extend the rules a bit, in order to add rules that apply for nodes with variables. But usually it's not very hard to see which rule you need to apply: just see for each rule what happens when $a=0$ and when $a=1$, and here you go!

+

This approach is so great that now I never write any matrix to check math statements/circuits/...: I just write a small ZX diagram, and I can check what happens very easily!

+

Sorry, I don't have time right now to give examples, but I'm planning to write a blog post at some point... Will come back when I do so. In the meantime, feel free to ask questions in comments!

+",5969,,,,,11/16/2020 10:14,,,,2,,,,CC BY-SA 4.0 +14673,1,,,11/16/2020 11:21,,1,258,"

What is a unitary operator that makes all the amplitudes all negative on the arbitrary state of $n$ qubits? +For example suppose, $n=2$, the arbitrary state is: +$a_1|00\rangle+a_2|01\rangle-a_3|10\rangle+a_4|11\rangle$ then the unitary operator will give the result +$-a_1|00\rangle-a_2|01\rangle-a_3|10\rangle-a_4|11\rangle$ on the above state (where $a_i$ are real positive numbers that are the amplitudes).

+

In other words the amplitudes are not complex numbers and the negative signs are randomly distributed regarding the $a_i$ for $n=2$; a similar statement is true for any $n$. Also we do not know for which $a_i$is negative or positive without measuring the state (which will destroy the state and we do not want to destroy the state).

+

An informal description of what the question asks is, is there a unitary operator that gives the version of an arbitrary state which has negated absolute values of all the original amplitudes in the resulting state generated by the unitary operator.

+",13834,,55,,11/17/2020 10:14,1/18/2022 4:11,What is a unitary operator that makes all the amplitudes all negative on the arbitrary state of $n$ qubits?,,3,4,,,,CC BY-SA 4.0 +14675,2,,14673,11/16/2020 12:24,,0,,"

First, apply $X$ gate on second qubit and then controlled $Z$ gate. The resulting state would be $a_1|00\rangle + a_2|01\rangle + a_3|10\rangle + a_4|11\rangle$. Now, you can apply operator $-I$ which is a global phase $\pi$.

+

In fact, you do not have to apply global phase operator as states which differ in global phase only as indistinguishable.

+",9006,,,,,11/16/2020 12:24,,,,2,,,,CC BY-SA 4.0 +14676,2,,14673,11/16/2020 12:36,,6,,"

If I understand your question correcly, you are asking for a unitary that, in effect, looks at amplitudes in the computational basis, which are assumed to all be real, and if they are positive, make them negative.

+

This, quite simply, is impossible for a unitary. To see this, note that you would have (in the 1-qubit case, although you can do exactly the same for any number of qubits) +$$ +U(|0\rangle-|1\rangle)=-|0\rangle-|1\rangle,\qquad U(|0\rangle+|1\rangle)=-|0\rangle-|1\rangle. +$$ +In other words, there are two distinct inputs that produce the same output. This is not a reversible procedure, and therefore cannot be unitary (because all unitaries are reversible).

+

(Technically, I should allow for the introduction of ancilla qubits as well. This will not change the conclusion).

+",1837,,,,,11/16/2020 12:36,,,,5,,,,CC BY-SA 4.0 +14678,1,14680,,11/16/2020 15:17,,3,236,"

The diamond distance between two channels $\Phi_0$ and $\Phi_1$ is defined in this answer.

+
+

$$ \| \Phi_0 - \Phi_1 \|_{\diamond} = \sup_{\rho} \: \| (\Phi_0 \otimes \operatorname{Id}_k)(\rho) - (\Phi_1 \otimes \operatorname{Id}_k)(\rho) \|_1 $$ where $\operatorname{Id}_k$ denotes the identity channel from $M_k(\mathbb{C})$ (the set of $k\times k$ complex matrices) to itself, $\| \cdot \|_1$ denotes the trace norm, and the supremum is taken over all $k \geq 1$ and all density matrices $\rho$ chosen from $M_{nk}(\mathbb{C}) = M_n(\mathbb{C}) \otimes M_{k}(\mathbb{C})$.

+
+

Let $N_1$ and $N_2$ be two completely positive trace nonincreasing maps that satisfy

+

$$\|N_1 - N_2\|_\diamond\leq \varepsilon.$$

+

For any channel $N_{A\rightarrow B}$, we define its Stinespring dilation to be an isometry $V_{A\rightarrow BE}$ such that $\text{Tr}_E(V\rho V^\dagger) = N(\rho)$.

+

Can one show that there exist Stinespring dilations $V_1$ and $V_2$ of $N_1$ and $N_2$ respectively such that we also have a bound on

+

$$\|V_1 - V_2\|_\diamond$$

+

in terms of $\varepsilon$?

+",4831,,10480,,10/27/2021 17:24,10/29/2021 14:16,Diamond norm distance bound on Stinespring dilations of channels,,1,5,,,,CC BY-SA 4.0 +14679,2,,14659,11/16/2020 16:06,,5,,"

One possibility is to override a default implementation using an alternative one for a specific simulator. Here, init_and would be the default implementation as in the uncommented code and CCNOT would be the alternative.

+

In the Q# libraries, we have the exact same case for Microsoft.Quantum.Canon.ApplyAnd and Microsoft.Quantum.Canon.ApplyLowDepthAnd. Here is a cut down version of +https://github.com/microsoft/QuantumLibraries/blob/main/Standard/src/Canon/And.cs:

+
#nullable enable
+
+using System;
+using Microsoft.Quantum.Simulation.Core;
+using Microsoft.Quantum.Simulation.Simulators;
+
+namespace SameNameSpaceAsQSharpInitAnd {
+    public partial class init_and {
+        public class Native : init_and {
+            private bool use_classical_adjoint;
+
+            public Native(IOperationFactory m) : base(m) {
+                use_classical_adjoint = m is ToffoliSimulator;
+            }
+
+            public override Func<(Qubit, Qubit, Qubit), QVoid> __AdjointBody__ {
+                get {
+                    if (use_classical_adjoint) {
+                        return base.__Body__;
+                    }
+                    return base.__AdjointBody__;
+                }
+            }
+
+        }
+    }
+}
+
+

In your case overrides for __ControlledBody__ and __ControlledAdjointBody__ are not required.

+

The C# code needs to be implemented in the same project and namespace where you implement the init_and Q# operation.

+",13836,,119,,11/16/2020 18:08,11/16/2020 18:08,,,,0,,,,CC BY-SA 4.0 +14680,2,,14678,11/16/2020 16:23,,4,,"

Yes, in fact there exists Stinespring dilations such that

+

$$\frac{\|N_1-N_2\|_{cb}}{\sqrt{\|N_1\|_{cb}}+\sqrt{\|N_2\|_{cb}}}\leq \|V_1-V_2\|\leq \sqrt{\|N_1-N_2\|_{cb}}$$ where the distance between the isometries is the in terms of the operator norm and $N_1,N_2$ are unital completely positive maps and $V_1,V_2$ are their Stinespring isometries.

+

A unital completely positive map $N_i(X)=V_i^*\pi(X)V_i$ is dual to a CPTP map, so that is something to be aware of here...

+

See https://arxiv.org/pdf/0710.2495.pdf

+

Note: above the $cb$-norm is the completely bounded "operator" norm, where as the completely bounded trace norm (or diamond norm) is more common in quantum information. I believe that this does bound the diamond norm since, at least for finite dimensional maps (completely postive maps between matrix algebras) we have +$$\|V_1-V_2\|_\diamond =\sup_{dim(H)}\|(V_1-V_2)\otimes id_{B(H)}\|_1\\\leq d\cdot \sup_{dim(H)}\|(V_1-V_2)\otimes id_{B(H)}\|_\infty=d\|V_1-V_2\|_{cb}\leq d\sqrt{\|N_1-N_2\|_{cb}},$$ where $d$ is the dimension of the space on which $(V_1-V_2)\otimes id_{B(H)}$ acts, and $B(H)$ is the set of bounded operators on $H$.

+",11793,,11793,,10/29/2021 14:16,10/29/2021 14:16,,,,7,,,,CC BY-SA 4.0 +14681,1,14682,,11/16/2020 18:01,,1,179,"

In Qiskit, is there a way to get the individual results from each shot on the IBM quantum device (instead of simply the summary statistics)? The result JSON file provides the count of all the 1024 shots.

+",8343,,55,,11/17/2020 10:13,11/17/2020 10:13,IBM Q - Individual Run Results,,2,0,,,,CC BY-SA 4.0 +14682,2,,14681,11/16/2020 19:28,,3,,"

You can set memory=True in assemble() or execute(). Then use result.get_memory() to get the per-shot measurement.

+

For example:

+
job = execute(circs, memory=True, shots=4)
+result = job.result()
+print(result.get_counts(0))  # prints {'00': 3, '11': 1}
+print(result.get_memory(0))  # prints ['00', '00', '11', '00']  
+
+",12195,,,,,11/16/2020 19:28,,,,0,,,,CC BY-SA 4.0 +14683,2,,14681,11/16/2020 19:32,,3,,"

It seems like this documentation will help you: https://qiskit.org/documentation/stubs/qiskit.result.Result.html#qiskit.result.Result.get_memory

+
from qiskit import QuantumCircuit, Aer, execute
+provider = IBMQ.load_account()
+
+circuit = QuantumCircuit(3)
+
+circuit.h(0)
+circuit.h(1)
+circuit.cx(0, 1)
+circuit.cx(0, 2)
+circuit.barrier(range(3))
+circuit.h(0)
+circuit.h(1)
+circuit.barrier(range(3))
+circuit.measure_all()
+print(circuit)
+
+job = execute(circuit, Aer.get_backend('qasm_simulator'), shots=10, memory=True)
+
+print('result for each shot:', job.result().get_memory() )
+
+
     ┌───┐           ░ ┌───┐ ░ ┌─┐      
+q_0: ┤ H ├──■────■───░─┤ H ├─░─┤M├──────
+     ├───┤┌─┴─┐  │   ░ ├───┤ ░ └╥┘┌─┐   
+q_1: ┤ H ├┤ X ├──┼───░─┤ H ├─░──╫─┤M├───
+     └───┘└───┘┌─┴─┐ ░ └───┘ ░  ║ └╥┘┌─┐
+q_2: ──────────┤ X ├─░───────░──╫──╫─┤M├
+               └───┘ ░       ░  ║  ║ └╥┘
+c: 3/═══════════════════════════╩══╩══╩═
+                                0  1  2 
+result for each shot: ['101', '001', '100', '100', '101', '101', '001', '100', '101', '100']
+
+",9858,,1859,,11/16/2020 22:15,11/16/2020 22:15,,,,0,,,,CC BY-SA 4.0 +14684,2,,14626,11/16/2020 20:29,,3,,"

Quantum phase estimation does not have anything to do with $\theta$. I feel that you are confusing phase estimation with the implementation of HHL as given in the paper https://arxiv.org/abs/1804.03719.

+

As for quantum phase estimation, it works only on unitary matrices. Given a unitary matrix $U$ and and eigenvector $|\psi\rangle$ of $U$ with some eigenvalue $e^{2\pi i\theta}$ (which we do not know), quantum phase estimation allows one to estimate $\theta$. To do this we assume that we have some way of preparing the state $|\psi\rangle$ (maybe we are given the state $|\psi\rangle$ explicitly or we are given a black box that prepares this state). We also assume that we can perform a controlled version of the given unitary $U$. The circuit for phase estimation then looks like the following:

+

+

where $U^{j}$ denotes that the unitary $U$ has been applied $j$ times consecutively and $QFT$ is the circuit for the quantum Fourier transform on n qubits. The bitstring corresponding to measuring the first n qubits of this circuit is the binary representation of the value $2^n\theta$ from where we can obtain the value of $\theta$. The value of n depends on the required accuracy of the estimation which is for you to fix as needed. For the complete math behind this algorithm, you could refer to the book Quantum Computation and Quantum Information by Nielsen and Chuang or any other standard book on quantum computing.

+

Notice that except for a method to prepare the eigenstate $|\psi\rangle$ and the controlled version of the unitary $U$, you do not need anything else explicitly.

+
+

Image Credits: Qiskit

+
+",9097,,,,,11/16/2020 20:29,,,,8,,,,CC BY-SA 4.0 +14685,2,,14664,11/17/2020 0:35,,1,,"

In fact, I figured out by myself. When I was reading this website, it posts a density matrix that I want(that is a long website, to find the corresponding part, just search the keyword 'identity').

+

Here comes the method. To produce a $2^n$ dimensional density matrix, you need n qubits as ancilla and n qubits as the target. In the case of $n=1$, implement the $\hat H$ on the ancilla, then use a $cx$ gate with ancilla as the target.

+

The density matrix of the whole system is $\rho_{AB}=(\frac{|00\rangle+|11\rangle}{\sqrt2})(\frac{\langle 00|+ \langle 11|}{\sqrt2})$, and the density matrix of the target(the reduced density matrix) is $\rho_A=Tr_B(\rho_{AB})=\frac{1}{2}(|0\rangle\langle0|+|1\rangle\langle1|)=\frac{I_A}{2}$, which satisfies my requirement.

+",13647,,1859,,11/21/2020 17:07,11/21/2020 17:07,,,,5,,,,CC BY-SA 4.0 +14687,1,,,11/17/2020 7:13,,2,267,"

When I click the “IBMid” for the first time, I can see the login page and input my username and password. However it return to the initial page(https://quantum-computing.ibm.com/login) and after that the page would give no response no matter which button I click. What is the problem?

+",13842,,55,,11/18/2020 22:33,11/18/2020 22:33,Can Not Login IBM Quantum Experience!,,1,2,,11/21/2020 17:08,,CC BY-SA 4.0 +14688,1,15244,,11/17/2020 7:41,,0,108,"

Let's say I do something to a qubit, and I want to entangle it to a 2nd one, like this:

+
     ┌───┐     
+q_0: ┤ ? ├──■──
+     └───┘┌─┴─┐
+q_1: ─────┤ X ├
+          └───┘
+
+

If I measure the 2nd I know the 1st one would have the same result. Now I mess with the first one. In Qiskit, I'll have to reset the 2nd qubit and for the CNOT to maintain the entanglement:

+
     ┌───┐      ░ ┌───┐ ░      
+q_0: ┤ ? ├──■───░─┤???├─░───■──
+     └───┘┌─┴─┐ ░ └───┘ ░ ┌─┴─┐
+q_1: ─────┤ X ├─░──|0>──░─┤ X ├
+          └───┘ ░       ░ └───┘
+
+

My question is how do I make sure the 2nd qubit reflect the measurement of the first one, without the reset (which is not unitary); basically, how do I CNOT to a dirty ancilla? Obviously I can CNOT to a blank ancilla, or swap a blank one up, but say I want an universal gate that do this a million time, and I just don't have enough blank qubits; is there a way that use a finite number of qubits, no matter how many time you repeat the gate, that can achieve the task of making sure some ancilla(s) reflect the measurement of the first qubit? Or is it impossible (and why)?

+

Thank you!

+",7598,,7598,,11/17/2020 8:23,12/23/2020 11:09,Is there a way to entangle to a dirty qubit?,,1,6,,,,CC BY-SA 4.0 +14689,1,14706,,11/17/2020 8:09,,0,230,"

From what I understand, any circuit can be combined to make a gate, which has a square, unitary matrix form that acts on the $2^n$ row of the qubits state column vector. For example, the circuit

+
     ┌───┐     
+q_0: ┤ H ├──■──
+     ├───┤┌─┴─┐
+q_1: ┤ H ├┤ X ├
+     └───┘└───┘
+
+

has the matrix form $\begin{bmatrix} +\tfrac{1}{2} & \tfrac{1}{2} & \tfrac{1}{2} & \tfrac{1}{2} \\ +\tfrac{1}{2} & -\tfrac{1}{2} & -\tfrac{1}{2} & \tfrac{1}{2} \\ +\tfrac{1}{2} & \tfrac{1}{2} & -\tfrac{1}{2} & -\tfrac{1}{2} \\ +\tfrac{1}{2} & -\tfrac{1}{2} & \tfrac{1}{2} & -\tfrac{1}{2} \\ +\end{bmatrix}$ +which acts on the vector $\begin{bmatrix}1 \\ 0 \\ 0 \\ 0 \end{bmatrix}$ of the initial $|0\rangle$ state. But when I try to get_unitary() a circuit with a reset gate, Qiskit tells me that reset instruction is not unitary and therefore it cannot give me any matrix form. My question is, in general, how do a reset gate affect the matrix form of a multi-qubit gate/circuit?

+

Thank you!

+

Edit: The circuit I'm trying to find the matrix form for is i.e. like this:

+
     ┌───┐          
+q_0: ┤ H ├──■───────
+     ├───┤┌─┴─┐     
+q_1: ┤ H ├┤ X ├─|0>─
+     └───┘└───┘     
+
+",7598,,7598,,11/17/2020 11:20,11/17/2020 18:32,What is the effect of the reset gate on the matrix form of a gate/circuit?,,2,0,,,,CC BY-SA 4.0 +14690,2,,14689,11/17/2020 8:27,,0,,"

You can use:

+
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit,  execute, BasicAer, Aer
+qreg_q = QuantumRegister(2, 'q')
+creg_c = ClassicalRegister(2, 'c')
+circuit = QuantumCircuit(qreg_q, creg_c)
+circuit.h(qreg_q[0])
+circuit.h(qreg_q[1])
+circuit.cx(qreg_q[0], qreg_q[1])
+print(circuit)
+
+backend = Aer.get_backend('unitary_simulator')
+job = execute(circuit, backend)
+result = job.result()
+print(result.get_unitary(circuit, decimals=3))
+
+

and you will get the output

+
     ┌───┐     
+q_0: ┤ H ├──■──
+     ├───┤┌─┴─┐
+q_1: ┤ H ├┤ X ├
+     └───┘└───┘
+c: 2/══════════
+               
+[[ 0.5+0.0000000e+00j  0.5-6.1232340e-17j  0.5-6.1232340e-17j
+   0.5-1.2246468e-16j]
+ [ 0.5+0.0000000e+00j -0.5+6.1232340e-17j -0.5+6.1232340e-17j
+   0.5-1.2246468e-16j]
+ [ 0.5+0.0000000e+00j  0.5-6.1232340e-17j -0.5+6.1232340e-17j
+  -0.5+1.2246468e-16j]
+ [ 0.5+0.0000000e+00j -0.5+6.1232340e-17j  0.5-6.1232340e-17j
+  -0.5+1.2246468e-16j]]
+
+
+

But you can also use the quantum_info option.. by running the following code using the above circuit:

+
import qiskit.quantum_info as qi
+operator = qi.Operator(circuit)
+
+

The output of operator will be:

+
Operator([[ 0.5+0.j,  0.5+0.j,  0.5+0.j,  0.5+0.j],
+          [ 0.5+0.j, -0.5+0.j, -0.5+0.j,  0.5+0.j],
+          [ 0.5+0.j,  0.5+0.j, -0.5+0.j, -0.5+0.j],
+          [ 0.5+0.j, -0.5+0.j,  0.5+0.j, -0.5+0.j]],
+         input_dims=(2, 2), output_dims=(2, 2))
+
+

Hope this is what you are looking for.

+
+

update: The above description is of course without having the reset operation being applied. Resetting a qubit is not a unitary operation as $U|0\rangle = |0\rangle$ and $U|1\rangle = |0\rangle$, hence it is not a reversible operation.

+",9858,,9858,,11/17/2020 18:18,11/17/2020 18:18,,,,2,,,,CC BY-SA 4.0 +14691,1,14693,,11/17/2020 8:33,,2,174,"

I am working on a paper about Continuous Variable QKD. (https://arxiv.org/abs/1711.08500v2)

+

I read about direct and reverse reconciliation in this paper. I don't understand what exactly Reconciliation is? Reconciliation algorithms, reconciliation protocols and so on.

+

I am really confused. Can any one explain reconciliation to me?

+",10371,,10371,,11/19/2020 6:55,11/19/2020 6:55,"What is meant with ""reconciliation"" in CV QKD?",,1,5,,,,CC BY-SA 4.0 +14692,2,,14687,11/17/2020 8:34,,0,,"

There is no reason I an think of to why they would blocked you...

+

I would suggest you post this issue to their support team through the Qiskit Slack channel.

+

It can be problematic sometime to get connected to IBM Quantum Experience... but these issues are fixed rather quickly.

+",9858,,,,,11/17/2020 8:34,,,,0,,,,CC BY-SA 4.0 +14693,2,,14691,11/17/2020 10:34,,4,,"

I assume the paper you are reading is referring to information reconciliation.

+

Information reconciliation is a vital part of post-processing in QKD, to limit (or erase in the best-case scenario) the amount of errors/differences between the key of Alice and Bob.

+

In that sense, it is a form of (classical) error-correction, and, broadly speaking, it works like this:

+
    +
  • Alice and Bob run a QKD protocol together and both obtain a raw key $k_{a}$ and $k_{b}$ of whatever length.
  • +
  • In real world scenarios, $k_{a} \not = k_{b}$ due to measurement errors, imperfect channels etc. Alice and Bob want the exact same key, so they need to fix this.
  • +
  • However, $k_{a} \simeq k_{b}$; we can write $k_{b} = k_{a} + \epsilon$, where $\epsilon$ is the error/difference between Alice and Bob, and therefore $\epsilon \simeq \overrightarrow{0}$ (i.e. $\epsilon$ is a bitstring with almost all entries equal to $0$ because there are not that many errors).
  • +
  • Alice and Bob have (in advance) agreed to use a certain error code to perform error correction. This error code is some linear function $f$ that calculates the syndrome $s$ of a key. Note that the error code may or may not be secret to Alice and Bob.
  • +
  • It is hard to reverse this function in general. $s$ is of considerably shorter length than $k$. So, there are multiple $k$ with the same $s$.
  • +
  • Alice calculates $s_{a} = f(k_{a})$ and publicly communicates $s_{a}$. Any Eve cannot do anything with this because the function is in general hard to reverse.
  • +
  • Bob receives $s_{a}$ and calculates $s_{b}$. The function is linear, so $s_{b} = f(k_{b}) = f(k_{a} + \epsilon) = f(k_{a}) + f(\epsilon) = s_{a} + s_{\epsilon}$. Therefore, the 'error syndrome' $s_{\epsilon} = s_{a} - s_{b}$ encodes only information about $\epsilon$.
  • +
  • Only Bob can calculate $s_{\epsilon}$. Because the code was designed properly (and for this exact function), and because $\epsilon \simeq \overrightarrow{0}$, Bob can decode the error syndrome to estimate $\epsilon$: $\hat{\epsilon} = f^{-1}(s_{\epsilon})$.
  • +
  • Finally, Bob calculates $\hat{k_{a}} = k_{b} - \hat{\epsilon}$. If the code is any good, +$\hat{k_{a}} - k_{a} \rightarrow 0$, i.e. Alices key and Bobs corrected key are very close/almost always the same.
  • +
+

There are a lot of important details I have grossed over, but this is the general idea. For a nice introduction of information reconciliation/error correction in the scope of QKD, check this paper.

+

Note that the above is error-correction for general QKD, not necessarily only for continuous variable QKD. I suspect that there are small discrepancies between the two, but the main goal should be the same.

+",8141,,8141,,11/17/2020 11:39,11/17/2020 11:39,,,,0,,,,CC BY-SA 4.0 +14694,2,,14597,11/17/2020 12:14,,0,,"

Today I suddenly noticed that my question is stupid, at least for the code I presented. I have rewritten the code and posted it below:

+
from qiskit import QuantumCircuit,QuantumRegister
+from qiskit.quantum_info.operators import Operator
+def swappedOp(obj,qr0):
+    qr1=QuantumRegister(1)
+    circ=QuantumCircuit(qr0,qr1)
+    circ.swap(qr0[qr0.__len__()-1],qr1)
+    IN=[qr0[i] for i in range(qr0.__len__())]+[qr1[0]]
+    circ.append(obj,IN)
+    circ.swap(qr0[qr0.__len__()-1],qr1)
+    return Operator(circ)
+
+qr0=QuantumRegister(2)
+qr1=QuantumRegister(2)
+circ=QuantumCircuit(qr0,qr1)
+from qiskit.quantum_info import random_unitary
+numQubits=3
+obj=random_unitary(2**numQubits)
+newObj=swappedOp(obj,qr0)
+circ.append(newObj,[qr0[i] for i in range(2)]+[qr1[0]])
+
+

In this case, since I returned an operator, I can use a one-qubit quantum register together with the size-varying quantum register qr0 to generate an Operator object and this technique can be also useful if I returned circ.to_instruction() or circ.to_gate().

+

So at least in my case, the function to convert a qubit to a single-qubit quantum register is not meaningful.

+",13647,,,,,11/17/2020 12:14,,,,0,,,,CC BY-SA 4.0 +14695,1,14697,,11/17/2020 12:48,,0,306,"

I am reading the following paper: Optimal two-qubit quantum circuits using exchange interactions.

+

I have a problem with the calculation of the unitary evolution operator $U$ (Maybe it is stupid):

+

I have figure out the matrix of $H$:

+

\begin{equation} +H = J \begin{bmatrix}1 & 0 & 0 & 0\\ + 0 & -1 & 2 & 0\\ + 0 & 2 & -1 & 0\\ + 0 & 0 & 0 & 1\\ +\end{bmatrix} +\end{equation}

+

But I cannot write the matrix of Operator $U$ and get the result of $(SWAP)^α$.

+

Could you please help me to calculate it? I really want to know how to get the matrix of U.

+

Thank you so much.

+

The figure is shown as below:

+

+

+",,user13341,8141,,11/17/2020 13:18,11/17/2020 13:28,Quick question about Two-qubit SWAP gate from the Exchange interaction,,1,2,,,,CC BY-SA 4.0 +14696,1,,,11/17/2020 13:12,,5,656,"

There are two popular initial states, in general, for VQEs: the unitary coupled cluster ansatz and the hardware efficient ansatz (for details, see here: https://quantaggle.com/algorithms/ansatz/). Intuitively, what are the main differences between these two and when do we prefer one to the other?

+",1351,,55,,11/18/2020 22:35,11/19/2020 3:59,"What are the main differences between the ""unitary coupled cluster"" and the ""hardware efficient"" ansatzes in VQE?",,1,0,,,,CC BY-SA 4.0 +14697,2,,14695,11/17/2020 13:24,,1,,"

You need to calculate $U=e^{-iHt}$. The trick to doing this is working out the eigenvectors of $H$: there's $|00\rangle$ and $|11\rangle$ with eigenvalues J, and +$$ +|\Psi^{\pm}\rangle=(|01\rangle\pm|10\rangle)/\sqrt{2} +$$ +with eigenvalues $(-1\pm 2)J$. In particular, notice that this means 3 of the eigenvalues are $J$. Hence, there are two eigenspaces of $H$, $|\Psi^-\rangle\langle\Psi^-|$ and $I-|\Psi^-\rangle\langle\Psi^-|$. Hence, we can find +$$ +U=e^{-iJt}(I-|\Psi^-\rangle\langle\Psi^-|)+e^{3iJt}|\Psi^-\rangle\langle\Psi^-|. +$$ +If you remove an irrelevant global phase, this is just the same as +$$ +U=(I-|\Psi^-\rangle\langle\Psi^-|)+e^{4iJt}|\Psi^-\rangle\langle\Psi^-|. +$$ +This is exactly what you were after, with $4Jt=\pi\alpha$.

+",1837,,8141,,11/17/2020 13:28,11/17/2020 13:28,,,,5,,,,CC BY-SA 4.0 +14698,1,14699,,11/17/2020 13:31,,3,191,"

I would like to implement $S^{\dagger}$ gate in Q# and I would like the best way to do it, is it correct to say that $S^{\dagger}$ is equivalent to R1( -Pi()/2 , q) ? Is it also correct to say that $S^{\dagger}$ is equivalent to Rz( -Pi()/2 , q) but with a global phase ?

+

Thank you.

+",12910,,1859,,11/18/2020 6:16,11/18/2020 6:16,$S^{\dagger}$ gate in Q#,,2,0,,,,CC BY-SA 4.0 +14699,2,,14698,11/17/2020 13:56,,1,,"

It is correct. Since you have $R_1(\theta) = \begin{bmatrix}1 & 0\\ 0 & e^{i\theta}\end{bmatrix}$ and $R_z(\theta) = \begin{bmatrix}e^{-i\theta/2} & 0\\ 0 & e^{i\theta/2}\end{bmatrix}$ just using the value of $\theta = -\pi/2$ gives you $R_1(-\pi/2) = \begin{bmatrix}1 & 0\\ 0 & -i\end{bmatrix} = S^{\dagger}$ and $R_z(-\pi/2) = e^{i\pi/4}\begin{bmatrix}1 & 0\\ 0 & -i\end{bmatrix}$ which works exactly the same as $S^{\dagger}$ but with a global phase of $e^{i\pi/4}$.

+",9097,,,,,11/17/2020 13:56,,,,0,,,,CC BY-SA 4.0 +14700,2,,14644,11/17/2020 14:29,,2,,"

Let me briefly elaborate on my comment. I'm not an expert on coding theory but I certainly know the symplectic formalism. If you want to know more about codes, I would recommend that you read "Quantum Error Correction Via Codes Over GF(4)" by Calderbank, Rains, Shor, and Sloane for the $\mathbb{F}_4$ formulation or "Quantum error-correcting codes and their geometries" by Ball, Centelles, and Huber for a $\mathbb F_2$ formulation.

+

I assume that you know that any element of the $n$-qubit Pauli group $P_n$ can be written uniquely as $W(z,x,t) = i^t Z(z)X(x)$ for $t\in\mathbb{Z}_4$, $z,x\in\mathbb{F}_2^{n}$ where $Z$ and $X$ are defined as usual as $Z(z)|u\rangle = (-1)^{z\cdot u}$, $X(x)|u\rangle = |u+x\rangle$. Note that the centre of $P_n$ is $\langle i \mathbb{I}\rangle$. We get a projection: +$$ +\pi : \; P_n \rightarrow \mathbb{F}_2^{2n}, \quad W(z,x,t) \mapsto (z,x). +$$ +Another way of seeing this is that $P_n$ is a group of order $2^{2n+2}$ which is "almost" extraspecial, i.e. the quotient $P_n/Z(P_n)$ is a (discrete symplectic) vector space. It is symplectic since +$$ +W(v,t)W(u,s) = (-1)^{[v,u]}W(u,s)W(v,s) +$$ +for $[v,u]:= v_z\cdot u_x - v_x \cdot u_z$ the standard symplectic product on $\mathbb F_2^{2n}$.

+

Since $\pi$ is a homomorphism, subgroups $S\subset P_n$ project to linear subspaces $\bar S:=\pi(S)\subset\mathbb F_2^{2n}$. By the above commutation relation, $S$ is Abelian if and only if $\bar S$ is isotropic, i.e. $S\subset S^\perp$ (self-orthogonal in coding language). +Now it should be clear that any $[[n,k]]$ stabiliser code $Q$ given by a stabiliser group $S$ projects to an isotropic subspace $\bar S$. Since $S$ has rank $n-k$, the dimension of $\bar S$ is $n-k$, too.

+

A code word $s\in\bar S$ is of the form $s=(z_1,\dots,z_n,x_1,\dots,x_n)$. Its weight is defined as $\mathrm{wt}(s)=|\{(z_i,x_i)\neq 0\}|$. +The automorphism group of $\bar S$ is then defined within the symplectic weight-preserving transformations on $\mathbb F_2^{2n}$. The latter are exactly the pair-wise coordinate permutations $S_n$ times the "local" symplectic group $\mathrm{Sp}_2(\mathbb F_2)$ acting on each symplectic pair independently, i.e. it has order $6^n n!$.

+

Now for the automorphism group of $Q$. +Any symplectic map on $\mathbb F_2^{2n}$ is induced from a Clifford unitary and any two Cliffords induce the same map if and only if they differ by a Pauli operator. +This means that $\mathrm{Aut}(\bar S)$ is basically $\mathrm{Aut}(Q)$ up to multiplication with Pauli operators. +More precisely, $\mathrm{Aut}(\bar S) = \mathrm{Aut}(Q)/S$. +The only difference between the two comes from the projection $\pi$.

+

Finally, let me remark that by mapping $(1,0) \mapsto 1$ and $(0,2)\mapsto \omega$ we get an additive mapping between $\mathbb F_2^{2n}$ and $\mathbb F_4^n$ which maps the isotropic linear codes in the above sense to self-orthogonal additive codes over $\mathbb F_4$. In this way, stabiliser codes fit better into the framework of coding theory, but this does not change the structure.

+",2305,,,,,11/17/2020 14:29,,,,0,,,,CC BY-SA 4.0 +14701,2,,14698,11/17/2020 16:09,,4,,"

Since the S operation supports the Adjoint functor, the Q# call Adjoint S(target) is the easiest way to call the $S^{\dagger}$ gate.

+

To verify that this is the same as the suggestion made above by Tharrmashastha V, you can use the AssertOperationsEqualReferenced operation:

+
AssertOperationsEqualReferenced(1,
+    ApplyToEachCA(Adjoint S, _),
+    ApplyToEachCA(Rz(-PI() / 2.0, _), _)
+);
+
+",1978,,,,,11/17/2020 16:09,,,,0,,,,CC BY-SA 4.0 +14702,1,,,11/17/2020 16:54,,7,500,"

I am trying to understand Shor's algorithm. I am not quite sure why the initialization, indicated as $|1\rangle$ in the below image at the bottom left is chosen as it is? I understand the modular exponentiation method in principle, but I am not sure which initialization should be chosen.

+

+",12480,,55,,11/18/2020 22:36,11/18/2020 22:36,Shor's algorithm: initialization of second register,,2,1,,,,CC BY-SA 4.0 +14703,2,,14696,11/17/2020 16:59,,2,,"

The original proposal to do calculate the molecular ground state energy was to use quantum simulation and quantum phase estimation, like what proposed through this paper: Simulated Quantum Computation of Molecular Energies and Simulation of Electronic Structure Hamiltonians Using Quantum Computers. Unfortunately, even though efficient, it still is very expensive for current hardware. Current hardware are noisy and don't have too many qubits, hence the name Noisy Intermediate-Scale Quantum (NISQ). So quantum simulation and phase estimation is not achievable.

+

This is when the Variational Quantum Eigensolver (VQE) came out. It tries to mitigate the some of this circuit depth issue to the number of circuits one would need to perform... through the use of variational principle.

+

+

Notice that calculate $\langle \psi(\theta) | H| \psi (\theta) \rangle$ you have to use many quantum circuits as $H = \sum_{i}^{poly(N)} \alpha_i P_i$ and so $\langle H\rangle_{\psi(\theta)} = \sum_{i}^{poly(N)} \alpha_i \langle P_i \rangle$ but we can only measure in the computational basis so many circuits will be needed to do this calculation. Note that the decomposition of the Hamiltonian $H$ to Pauli strings is only in $O(poly(N))$ for the certain problems (like the molecular electronic Hamiltonian). But for a general Hamiltonian, you would need $4^N$ terms.

+

In any case, the question now is, what is the implementation of $U(\theta)$? The space of unitary matrices is huge (there are uncountable many unitary matrices)... but motivated by classical methods, the original paper of VQE proposed to implement $U(\theta)$ through the use of UCCSD, which is chemically motivated. Furthermore. this can be implement efficiently on a quantum computer. This is great, but it is still way too expensive for current quantum hardware! To see why, let's look at the UCCSD circuit for the $LiH$ problem that being used as an example in the Qiskit tutorial.

+

+

There is no way any current quantum hardware will be able to do something like that. So this is where the Heuristic Ansatze idea came about. People tried and still trying (like here or here or here and many more) to find ways to design quantum circuit( $U(\theta)$ ) that is very short-depth but still able to achieve an energy that is within the ground state energy within chemical precision. Because it is a heuristic ansatze, we don't usually know if we will be able to achieve an energy within chemical accuracy, opposed to the UCCSD ansatze. However, heuristic ansatze allows us to design quantum circuit that matches the hardware layout. This way, you can save a lot of the swapping overhead that you would encounter otherwise.

+",9858,,9858,,11/19/2020 3:59,11/19/2020 3:59,,,,0,,,,CC BY-SA 4.0 +14704,1,14709,,11/17/2020 17:06,,7,172,"

If I have two projectors $\pi_1, \pi_2$ such that for some $|{\phi}\rangle$:

+

$\langle {\phi}| \pi_1 |{\phi}\rangle \geq e$ and $\langle {\phi}| \pi_2 | {\phi}\rangle \geq e$

+

What can I conclude about the following quantity?

+

$\langle {\phi} | \pi_1 \pi_2 |{\phi}\rangle$

+

Is it also $\geq e$?

+",11830,,55,,11/18/2020 22:37,11/19/2020 17:02,What can I conclude about $\langle \phi|\pi_1\pi_2|\phi\rangle$ if $\langle \phi|\pi_i|\phi\rangle\ge e$?,,3,1,,,,CC BY-SA 4.0 +14705,2,,14704,11/17/2020 17:39,,3,,"

$$ +\pi_1 = \begin{pmatrix} +1&0\\ +0&0\\ +\end{pmatrix}\\ +\pi_2 = \begin{pmatrix} +0&0\\ +0&1\\ +\end{pmatrix}\\ +\rho = \frac{1}{\sqrt{2}} \begin{pmatrix} +1\\ +1\\ +\end{pmatrix}\\ +e = \frac{1}{2} +$$

+",434,,,,,11/17/2020 17:39,,,,3,,,,CC BY-SA 4.0 +14706,2,,14689,11/17/2020 18:32,,2,,"

The reset isn't unitary, so there is no unitary matrix for the circuit. You need to switch to looking at the general channel of the circuit (e.g. described by Krauss operators).

+

Alternatively, you can introduce environment qubits and replace the reset with unitary operations acting on the environment (e.g. the reset could swap a zero'd qubit in the environment for the qubit you want to reset). You can then look at the unitary of the system+environment circuit, although keep in mind that there are multiple ways to translate a reset so there is some ambiguity in which unitary you get.

+",119,,,,,11/17/2020 18:32,,,,2,,,,CC BY-SA 4.0 +14707,1,14708,,11/17/2020 19:08,,2,406,"

For any completely positive trace nonincreasing map $N_{A\rightarrow B}$, the adjoint map is the unique completely positive linear map $N^\dagger_{B\rightarrow A}$ that satisfies

+

$$\langle N^\dagger(\sigma), \rho\rangle = \langle \sigma, N(\rho)\rangle$$

+

for all linear operators $\sigma \in \mathcal{L}(\mathcal{H}_B)$ and $\rho \in \mathcal{L}(\mathcal{H}_A)$.

+

Let $V_{A\rightarrow BE}$ be any isometry such that $\text{Tr}_E(V\rho V^\dagger) = N(\rho)$. This is the Stinespring representation of any completely positive map. Since $N^\dagger$ is also a completely positive map, it also has a Stinespring representation.

+

Question: Given $V$, can one write down the Stinespring representation of $N^\dagger$? Naively taking the transpose conjugate of $V$ to write down something like

+

$$\text{Tr}_E(V^\dagger\sigma V) = N^\dagger(\sigma)$$

+

doesn't even make sense since $V^\dagger_{BE\rightarrow A}$ whereas the isometry we are after should go from $B$ to $AE'$.

+",4831,,55,,11/18/2020 22:39,10/5/2021 21:05,What is the Stinespring representation of the adjoint of a channel?,,1,0,,,,CC BY-SA 4.0 +14708,2,,14707,11/17/2020 21:08,,2,,"

An adjoint to partial trace is just tensoring by $I$, i.e. $\text{Tr}_2^\dagger(\sigma) = \sigma \otimes I$.

+

So in this case we can write +$$ +N^\dagger(\sigma) = V^\dagger (\sigma \otimes I_E)V. +$$

+

If $N^\dagger$ is trace-preserving then it can be written as $\text{Tr}_{E'}(U\sigma U^\dagger)$ for some isometry $U:B \rightarrow AE'$. But in general $N^\dagger$ is not trace-preserving, but unital. So such form $\text{Tr}_{E'}(U\sigma U^\dagger)$ may not be possible.

+",5870,,5870,,10/5/2021 21:05,10/5/2021 21:05,,,,5,,,,CC BY-SA 4.0 +14709,2,,14704,11/17/2020 23:00,,5,,"

Based on those relations there's nothing more that you can conclude. Consider the two extremes.

+

At one extreme $\pi_1$ and $\pi_2$ project onto the same subspace, in which case: +$$\langle {\phi} | \pi_1 \pi_2 |{\phi}\rangle = \langle {\phi} | \pi_1 |{\phi}\rangle = \langle {\phi} | \pi_2 |{\phi}\rangle \ge e, \;\; \pi_1=\pi_2=\pi_1 \pi_2.$$

+

At the other extreme $\pi_1$ and $\pi_2$ project onto perpendicular subspaces, in which case +$$\langle {\phi} | \pi_1 \pi_2 |{\phi}\rangle = 0, \;\; \pi_1 \pi_2 = 0.$$

+

Based on the stated relationships, the projectors could exist anywhere between and including these two extremes. If $e>0$, you could at least say that $\vert \phi \rangle$ is not perpendicular to either the $\pi_1$ or $\pi_2$ subspaces, but that alone still doesn't tell you any more about the value of $\langle {\phi} | \pi_1 \pi_2 |{\phi}\rangle$.

+

EDIT: DaftWullie's answer makes an important point that I missed. If $e>\frac{1}{\sqrt{2}}$ (with $\vert \phi \rangle$ normalized), $\pi_1$ and $\pi_2$ cannot be orthogonal projectors, in which case $e$ imposes the lower bound $2e^2-1$.

+",8623,,8623,,11/19/2020 17:02,11/19/2020 17:02,,,,2,,,,CC BY-SA 4.0 +14710,2,,14702,11/18/2020 1:29,,3,,"

The initial state of Shor's algorithm is $\frac{1}{\sqrt N}\displaystyle\sum_{a=0}^{N-1}|a\rangle$, and it is OK to move this state to $\frac{1}{\sqrt N}\displaystyle\sum_{a=0}^{N-1}|a,x\rangle$ as our initial state since the modular exponentiation takes $x$ as one of its input.

+

Here shows the model of a $\text{controlled}-U$ gate, and a circuit for factoring (figure comes from this paper).

+

+

+

So I think the $|x\rangle$ denoted here directs to $|x\rangle$, although I do not know why they are doing so.

+",13647,,9006,,11/18/2020 7:54,11/18/2020 7:54,,,,2,,,,CC BY-SA 4.0 +14711,2,,14702,11/18/2020 9:39,,4,,"

For preference, in a phase estimation algorithm, you would set the state of the second register equal to an eigenstate of the unitary operator $U$, the plan being to find its eigenvalue, which depends on the period $r$. In fact, any of the eigenvectors $|u_s\rangle$ would do for values $s=0,1,\ldots r-1$ as these have eigenvalues related to $s/r$.

+

However, the eigenstates themselves depend on $r$, so without knowing $r$, you cannot make the eigenstate, and so you cannot find $r$. That's a problem.

+

The way to circumvent the problem is that you can prepare the state $|1\rangle$, and it turns out that this state is an equal superposition of all the vectors $|u_s\rangle$. Using linearity, you now know the outcome - an equal superposition of the estimates of the different eigenvalues (entangled with the second register). Thus, in effect, what the phase estimation does is it measures one of the $s/r$ eigenvalues at random (with equal probability). (You then use the continued fractions algorithm to figure out which $s$ it was.)

+",1837,,,,,11/18/2020 9:39,,,,6,,,,CC BY-SA 4.0 +14713,1,,,11/18/2020 16:45,,3,127,"

I think I roughly understand the quantum algorithm for the general Abelian Hidden Subgroup Problem (HSP). We begin by constructing a uniform superposition, calculating the function over that superposition in another register, then measure it to yield a coset state (i.e. a state whose nonzero components all lie in the same coset). Applying the Quantum Fourier Transform will then yield an element that is "orthogonal," or in the kernel, of the hidden subgroup. Repeating this only polynomially many times, we can be certain with arbitrarily high probability that we have produced the hidden subgroup.

+

My question is, where does this go wrong for non-Abelian subgroups? And what exactly about being Abelian is so important for this algorithm to work correctly? If someone could provide an intuitive explanation, that would be even better! Thanks.

+",13618,,,,,11/19/2020 14:36,What is the intuitive reason for why Abelian HSPs are much easier than Non-Abelian HSPs?,,1,0,,,,CC BY-SA 4.0 +14714,2,,14713,11/18/2020 17:55,,3,,"

I will begin by saying that first of all the HSP quantum algorithm works on any group, regardless of whether it is abelian or not. The problem is that when the group is not abelian (or the hidden subgroup isn't normal), the algorithm fails to find a description of the hidden subgroup in a polynomial number of steps.

+

Now, in an abelian group, each element composes its conjugacy class and therefore the group elements are in one-to-one correspondence with the characters (functions on the group). So near the end of the algorithm for HSP, in an abelian group when we measure after applying the QFT we always get a character with the desired kernel, and we can show that repeating this sampling always gets us a description of the hidden subgroup in a polynomial number of steps. However, in a non-abelian group, the characters are no longer in one-to-one correspondence with the elements (because the conjugacy classes are no longer singletons) and so it's not clear how to obtain an efficient polynomial time sampling routine to get the description of the subgroup.

+

This sampling I've mentioned is known in the literature as weak Fourier sampling. The idea is that weak Fourier sampling is sufficient to deduce the structure of the hidden subgroup in certain cases (like when the group is abelian), however, it is known to fail for HSP in non-abelian groups like the symmetric group.

+

The notes on Quantum Algorithms by Andrew Childs (https://www.cs.umd.edu/~amchilds/qa/) seem to be the most detailed on this subject if you are interested in reading more.

+",11793,,11793,,11/19/2020 14:36,11/19/2020 14:36,,,,0,,,,CC BY-SA 4.0 +14715,1,14717,,11/19/2020 0:41,,5,2022,"

I have a silly question as I am an absolute beginner! So as described in Qiskit:

+
+

It performs the NOT operation (equivalent to applying an X gate) on the second qubit only when the first qubit is $|1\rangle$ and otherwise leaves it unchanged.

+
+

in the piece of the related program we have :

+
# Let's do an CX-gate on |00>
+q = QuantumRegister(2)
+qc = QuantumCircuit(q)
+qc.cx(q[0],q[1])
+qc.draw(output='mpl')
+
+

In my mind I need 2 inputs for a CX gate A & B as (q[0] and q[1]) so that it can control B and NOT A, and also a third qubit as an output. But here we have q[0] as an input and q[1] as an output apparently. Can anybody help me please to understand the logic?

+",13698,,55,,11/22/2020 16:53,11/22/2020 16:53,How does the CX gate work?,,2,0,,,,CC BY-SA 4.0 +14716,2,,13943,11/19/2020 0:42,,0,,"

I've come across a paper (published in 2009) by Nishimura and Ozawa that appears to wrap up this line of inquiry. From my reading, the upshot of the paper is this:

+

The quantum query and circuit models of complexity are "perfectly equivalent", meaning that they can simulate one another with:

+
    +
  • Zero error
  • +
  • A constant time overhead
  • +
+

Regarding the second point, this is my interpretation of "perfectly equivalent" – put another way, my interpretation may not be correct and it may be that they can simulate one another with zero error and a polynomial time, rather than constant time, overhead.

+",1937,,1937,,11/19/2020 7:17,11/19/2020 7:17,,,,0,,,,CC BY-SA 4.0 +14717,2,,14715,11/19/2020 1:26,,6,,"

When you apply the CNOT gate on the state $|00\rangle$ what you will get out is the state $|00\rangle$, as the CNOT gate logically do the following:

+

$CNOT|00\rangle = |00\rangle, \ \ \ CNOT|01\rangle = |01\rangle, \ \ \ CNOT|10\rangle = |11\rangle, \ \ \ CNOT|11\rangle = |10\rangle$

+

where $\bigg\{|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} , |1\rangle\ = \begin{pmatrix} 0 \\ 1 \end{pmatrix} \bigg\}$ represents the computational basis. Here we are taking the first qubit as the controlled qubit, and the second qubit as the target qubit. That is, if the first (Controlled) qubit is in the state $|1\rangle$ then you apply the $X$ (NOT) gate to the second (Target) qubit, otherwise you do nothing. Thus, in this setting the CNOT gate has matrix representation (in the computational basis) as:

+

\begin{equation}\label{CNOT matrix} + CNOT = \begin{pmatrix} + 1 & 0 & 0 & 0\\ + 0 & 1 & 0 & 0 \\ + 0 & 0 & 0 & 1 \\ + 0 & 0 & 1 & 0 \\ + \end{pmatrix} +\end{equation}

+

so that is what you implement when you run the circuit:

+

+
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+qreg_q = QuantumRegister(2, 'q')
+creg_c = ClassicalRegister(2, 'c')
+circuit = QuantumCircuit(qreg_q, creg_c)
+circuit.cx(qreg_q[0], qreg_q[1])
+circuit.draw( 'mpl',style={'name': 'bw'}, plot_barriers= False, scale = 1)
+
+

as always, all state in quantum computer starts at the state $|00\cdots 0\rangle$. Hence, this means that for our circuit above $q_0 = |0\rangle$ and $q_1 = |0\rangle$, so the starting state is $|00\rangle = |0\rangle \otimes |0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} \otimes \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \\0 \\0 \end{pmatrix} $. Notice that

+

$$ CNOT|00\rangle = \begin{pmatrix} + 1 & 0 & 0 & 0\\ + 0 & 1 & 0 & 0 \\ + 0 & 0 & 0 & 1 \\ + 0 & 0 & 1 & 0 \\ + \end{pmatrix} \begin{pmatrix} 1 \\ 0 \\0 \\0 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \\0 \\0 \end{pmatrix} = |00\rangle $$

+

The input is the state of $|00\rangle$ and the output is also $|00\rangle$.

+

Note that: circuit.cx(qreg_q[0], qreg_q[1]) indicates that the controlled qubit is in the quantum register qreg_q[0] and it will act on the target qubit which is in the quantum register qreg_q[1]. And this can be changed. That is, you can make the qubit in the quantum register qreg_q[1] as your controlled qubit and the qubit in the quantum register qreg_q[0] as your target qubit by simply switch the 5th line of the code to: circuit.cx(qreg_q[1], qreg_q[0]). The circuit will look like:

+

+
+

If you instead input a different state, says $|10\rangle$ then the result would be different, it would be $|11\rangle$ in this case. That is, if you execute the circuit:

+

+

Note that the $X$ gate here is to put the qubit $q_0$ from the state $|0\rangle$ to $|1\rangle$. That is, we are making the input state $|10\rangle$. The output state now would be $|11\rangle$ as the controlled qubit is now in the state $|1\rangle$ so it will act on the target qubit by applying the $X$ (NOT) gate. If you run this on the simulator, you will see something like:

+

+

Here is the code to generate the following circuit and plot in Qiskit:

+
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit, BasicAer, execute
+from qiskit.visualization import plot_histogram
+%matplotlib inline
+qreg_q = QuantumRegister(2, 'q')
+creg_c = ClassicalRegister(2, 'c')
+circuit = QuantumCircuit(qreg_q, creg_c)
+circuit.x(qreg_q[0])
+circuit.cx(qreg_q[0], qreg_q[1])
+circuit.measure(qreg_q[0], creg_c[0])
+circuit.measure(qreg_q[1], creg_c[1])
+circuit.draw( 'mpl',style={'name': 'bw'}, plot_barriers= False, scale = 1)
+backend = BasicAer.get_backend('statevector_simulator')
+job = execute(circuit, backend, shots = 1)
+plot_histogram(job.result().get_counts(), color='black', title="Result")
+
+

And you can work this out explicitly in matrix algebra as well:

+

$$ CNOT|10\rangle = \begin{pmatrix} + 1 & 0 & 0 & 0\\ + 0 & 1 & 0 & 0 \\ + 0 & 0 & 0 & 1 \\ + 0 & 0 & 1 & 0 \\ + \end{pmatrix} \begin{pmatrix} 0 \\ 0 \\1 \\0 \end{pmatrix} = \begin{pmatrix} 0 \\ 0 \\0 \\1 \end{pmatrix} = |11\rangle $$

+",9858,,12667,,11/19/2020 5:32,11/19/2020 5:32,,,,6,,,,CC BY-SA 4.0 +14718,1,14722,,11/19/2020 7:20,,1,100,"

I am trying to solve the first question on the qiskit test which is writing a code for a full adder.

+

So based on my research if I have $A$ q[0], $B$ q[1] and $C$ in q[2] as input and Sum and Cout as output, I should be able to produce the correct outputs by the following gates:

+
q[0] XOR1 q[1] ---> q[4]
+
+q[0] AND1 q[1] ---> q[3]
+
+q[2] XOR2 q[4] ---> q[5] (SUM)
+
+q[2] AND2 q[4] ---> q[6]
+
+q[3] OR q[6] ---> q[7] (COUT)
+
+
+

Writing the following program I get that my answer is producing wrong results :

+
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+from qiskit import IBMQ, Aer, execute
+
+##### build your quantum circuit here
+
+#Define registers and a quantum circuit
+q = QuantumRegister(8) 
+c = ClassicalRegister(2)
+qc = QuantumCircuit(q,c)
+
+# Preparing inputs
+qc.x(q[0])  # Comment this line to make Qbit0 = |0>
+qc.x(q[1])  # Comment this line to make Qbit1 = |0>
+qc.x(q[2])  # Comment this line to make Qbit2 = |0> ( carry-in bit )
+qc.barrier()
+
+# AND gate1 implementation
+qc.ccx(q[0],q[1],q[3])
+qc.barrier()
+
+# XOR gate1 implementation
+qc.cx(q[0],q[4])
+qc.cx(q[1],q[4])
+qc.barrier()
+
+# XOR gate2 implementation
+qc.cx(q[2],q[5])
+qc.cx(q[4],q[5])
+qc.barrier()
+
+# AND gate2 implementation
+qc.ccx(q[2],q[4],q[6])
+qc.barrier()
+
+#OR gate implementation
+qc.cx(q[3],q[7])
+qc.cx(q[6],q[7])
+qc.ccx(q[3],q[6],q[7])
+qc.barrier()
+
+# Measuring and put result to classical bit
+# ( sum )
+qc.measure(q[5],c[0])
+# ( carry-out )
+qc.measure(q[7],c[1])
+
+# execute the circuit by qasm_simulator
+backend = Aer.get_backend('qasm_simulator')
+job = execute(qc, backend, shots=1000)
+result = job.result()
+count = result.get_counts()
+print(count)
+qc.draw(output='mpl')
+
+

Grading tells me that my results are not matching, but I cannot figure out what is wrong with my code. +Thank you so much for help.

+",13698,,55,,11/22/2020 16:53,11/22/2020 16:53,How do I check what is wrong in my full-adder code?,,1,2,0,,,CC BY-SA 4.0 +14719,1,14760,,11/19/2020 8:37,,2,532,"

I have successfully installed the Qiskit in Anaconda by using pip install qiskit.

+

But I can't import Qiskit and get the following error.

+
    ---------------------------------------------------------------------------
+OSError                                   Traceback (most recent call last)
+<ipython-input-5-578b7f7e9727> in <module>
+----> 1 import qiskit
+
+~\anaconda3\envs\quantum_computing\lib\site-packages\qiskit\__init__.py in <module>
+     29 
+     30 # The main qiskit operators
+---> 31 from qiskit.circuit import ClassicalRegister
+     32 from qiskit.circuit import QuantumRegister
+     33 from qiskit.circuit import AncillaRegister
+
+~\anaconda3\envs\quantum_computing\lib\site-packages\qiskit\circuit\__init__.py in <module>
+    212    random.random_circuit
+    213 """
+--> 214 from .quantumcircuit import QuantumCircuit
+    215 from .classicalregister import ClassicalRegister, Clbit
+    216 from .quantumregister import QuantumRegister, Qubit, AncillaRegister, AncillaQubit
+
+~\anaconda3\envs\quantum_computing\lib\site-packages\qiskit\circuit\quantumcircuit.py in <module>
+     23 from collections import OrderedDict, defaultdict
+     24 from typing import Union
+---> 25 import numpy as np
+     26 from qiskit.exceptions import QiskitError
+     27 from qiskit.util import is_main_process
+
+~\AppData\Roaming\Python\Python38\site-packages\numpy\__init__.py in <module>
+    138 
+    139     # Allow distributors to run custom init code
+--> 140     from . import _distributor_init
+    141 
+    142     from . import core
+
+~\AppData\Roaming\Python\Python38\site-packages\numpy\_distributor_init.py in <module>
+     24                 # NOTE: would it change behavior to load ALL
+     25                 # DLLs at this path vs. the name restriction?
+---> 26                 WinDLL(os.path.abspath(filename))
+     27                 DLL_filenames.append(filename)
+     28     if len(DLL_filenames) > 1:
+
+~\anaconda3\envs\quantum_computing\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error, winmode)
+    379 
+    380         if handle is None:
+--> 381             self._handle = _dlopen(self._name, mode)
+    382         else:
+    383             self._handle = handle
+
+OSError: [WinError 193] %1 is not a valid Win32 application
+
+

So what should I do to solve this problem?

+",13859,,55,,11/22/2020 16:53,11/22/2020 16:53,Import Qiskit fails,,4,2,,11/21/2020 17:07,,CC BY-SA 4.0 +14720,2,,14719,11/19/2020 8:41,,2,,"

Try the following command and get back if errors persist

+

from qiskit import *

+",13860,,9006,,11/19/2020 9:48,11/19/2020 9:48,,,,1,,,,CC BY-SA 4.0 +14721,2,,14704,11/19/2020 8:45,,4,,"

Let's assume +$$ +\pi_i|\phi\rangle=e_i|\phi\rangle+\sqrt{1-e_i^2}|\phi_i^\perp\rangle, +$$ +where $\langle\phi|\phi_i^\perp\rangle=0$ and, for simplicity, let's assume the $e_i$ are real. We can immediately expand +$$ +\langle\phi|\pi_1\pi_2|\phi\rangle=\left(f_1\langle\phi|+\sqrt{1-f_1^2}\langle\phi_1^\perp|\right)\left(f_2|\phi\rangle+\sqrt{1-f_2^2}|\phi_2^\perp\rangle\right) +$$ +This simplifies to +$$ +f_1f_2+\sqrt{1-f_1^2}\sqrt{1-f_2^2}\langle\phi_1^\perp|\phi_2^\perp\rangle, +$$ +which is bounded between +$$ +f_1f_2\pm\sqrt{1-f_1^2}\sqrt{1-f_2^2}. +$$ +Thus, we can say +$$ +\min_{f_1,f_2\geq e}f_1f_2-\sqrt{1-f_1^2}\sqrt{1-f_2^2}\leq\langle\phi|\pi_1\pi_2|\phi\rangle\leq\max_{f_1,f_2\geq e}f_1f_2+\sqrt{1-f_1^2}\sqrt{1-f_2^2}. +$$ +Clearly the right-had side of this bound is just 1. But it's the left side we're really interested in. To perform the minimisation, let $f_i=\cos\theta_i$. Then, we want +$$ +\min_{\theta_1,\theta_2}\cos(\theta_1+\theta_2). +$$ +If we assume that $\theta_1+\theta_2<\pi$, the minimum is achieved by setting both $\theta_1$ and $\theta_2$ as large as possible, corresponding with $f_i=e$. Thus, provided $e>0$, the minimum value is $2e^2-1$. +$$ +\langle\phi|\pi_1\pi_2|\phi\rangle\geq 2e^2-1 +$$

+",1837,,1837,,11/19/2020 12:09,11/19/2020 12:09,,,,0,,,,CC BY-SA 4.0 +14722,2,,14718,11/19/2020 9:28,,2,,"

If I am correct, I suppose you are talking about the Qiskit Challenge 2020. A possible reason why your circuit is being graded wrong is because the question asks you to construct the circuit for full adder and give it the input $A=1$, $B=0$ and $X=1$. However, I think as per your code, you are preparing the qubits to be $|ABX\rangle = |111\rangle$ instead of $|101\rangle$. Baring that, your circuit works perfectly fine from what I could analyze.

+",9097,,9006,,11/19/2020 9:50,11/19/2020 9:50,,,,1,,,,CC BY-SA 4.0 +14724,2,,14719,11/19/2020 11:47,,0,,"

OS Error refers to an operating system error. On this page, you can see that +qiskit is tested on 64-bit os solely.

+

The report says that your operating system is 32-bit, this should be the reason. When I was first pip install qiskit, it fails. Later I changed my python from a 32-bit version to a 64-qubits one and then pip succeeds(my laptop is 64-bit). If your CPU is 64-bit you can use a windows 64-bit virtual machine, to see more detail follow this stack overflow link.

+

If you cannot you the win64 virtual machine maybe you can rent a VPS or submit your script to the IBM Q server.

+",13647,,,,,11/19/2020 11:47,,,,1,,,,CC BY-SA 4.0 +14725,2,,14715,11/19/2020 12:01,,2,,"

The previous answer is rich enough and technically helpful. However, I would like to give an insight from different perspective. In quantum circuits, ALWAYS the number of inputs equals the number of outputs! The reason is that quantum circuit makes only transformation on the state of qubits and CANNOT clone (make copy of) them. Therefore, CX gate transform the target qubit depending on the control qubit which is remain unchanged.

+",13479,,,,,11/19/2020 12:01,,,,0,,,,CC BY-SA 4.0 +14726,2,,14719,11/19/2020 12:53,,2,,"

The issue you're seeing is actually unrelated to qiskit itself. It's a conflict between package versions in your anaconda and the system python install. What it looks like from the stack trace there is that you're running in the anaconda environment and it is loading numpy from a different python environment (which was not installed with anaconda). This is causing a conflict when the anaconda's environment python is trying to load it. This could be because of win32 vs win64 binary issue or some other dll incompatibility between the 2 environments. What I would recommend is if you want to continue using conda is to create a new conda environment and leverage conda install to install numpy and scipy then pip install qiskit. So something like:

+
conda create new-qiskit
+conda activate new-qiskit
+conda install numpy scipy
+pip install qiskit
+
+

or what I typically do when testing on windows is to just not use conda and create a normal python virtualenv and pip install qiskit directly with that.

+",5529,,,,,11/19/2020 12:53,,,,1,,,,CC BY-SA 4.0 +14728,1,,,11/19/2020 21:22,,2,81,"

I would like to discuss the discrepancies between what we see in the simulator versus what we see in the actual running of the code on any IBMQ machine for any qubits at 5 or above. I am doing a final project on grover's algorithm, and the premise would require an extremely large number of qubits. I have tested my theory on the simulators up to 26 qubits (took 6 hours), and they are ~100% accurate. When I went to test the theory using the exact same circuit, I couldn't get a circuit of 4 qubits to even deviate from statistical random distrubution.

+

First of all, I have used Qiskit and Q# to create the exact same algorithm. If you could provide me with a methodology that would allow for easier work / do the work for the transpiler on qiskit, or the ability to utilize a real quantum computer in Q#, I would appreciate it.

+

Currently the transpiler in qiskit / IBMQ for grover's algorithm is limited to around 6-7 qubits. I don't like that I don't have more gates available. Regardless of this issue, I get garbage results for an oracle / ancilla at or larger than 4 qubits total. Why is is that the transpiler / decoherance that is occuring within the circuit is so terrible that I cannot construct Grover's algorithm using gates at or larger than 4 qubits? The probabilties of the simulators themselves are upwards of 99%, but even after a two qubit Grover's algorithm, it shows as only 40ish %?

+

When I go to three qubits, the entire algorithm is garbage, and I cannot provide ANY accuracy other than a random distribution, and when I tabulated it the accuracy was actually less than the statistical random distrubution. I'm not happy with what is going on here, as I cannot feasibly run anything of meaning on any IBMQ machine. I don't understand why the transpiler is inserting such a ludicrous range in the possible number of gates (about a hundred different possible gate configurations for 5 qubit Grover's algorithm)

+

Is this an issue with the transpiler? Is this just an issue with general decoherance? I don't understand why the quantum computer can't peform a grover's algorithm of 5 or more.

+

Please help me to understand what I am not getting here. Are the physical devices that far off from where I felt the technology was? I was hoping that a 15 qubit machine would be able to actually perform better, esp. in the 5 qubit realm.

+
#initialization
+import matplotlib.pyplot as plt
+import math
+import numpy as np
+
+# importing Qiskit
+from qiskit import ClassicalRegister, QuantumRegister
+from qiskit.providers.ibmq import least_busy
+from qiskit.quantum_info import Statevector
+from qiskit.providers.aer import QasmSimulator
+
+# import basic plot tools
+from qiskit.visualization import plot_histogram
+
+def initialize_s(qc,qubits):
+    """Apply a H-gate to 'qubits' in qc"""
+    for q in qubits:
+        qc.h(q)
+    return qc
+
+def numberofiterations(nqubits):
+    temp = 2 ** nqubits;
+    squareRoot = math.sqrt(temp)
+    iterations = round(squareRoot)
+    return iterations
+
+def oracle(nqubits):
+    q = QuantumRegister(nqubits)
+    qc = QuantumCircuit(q)
+    #set the oracle's 0 bits
+    qc.x(q[1])
+    qc.x(q[2])
+    #qc.x(q[5])
+    #qc.x(q[7])
+    #qc.x(q[8])
+    #qc.x(q[12])
+    #qc.x(q[13])
+    #qc.x(q[15])
+    #qc.x(q[19])
+    #qc.x(q[20])
+    #qc.x(q[21])
+    #qc.x(q[22])
+    #qc.x(q[24])
+    qc.h(q[nqubits-1])
+    #[0,3,4,6,9,10,11,14,16,17,18,23,26,27],30,ancilla_qubits=None, mode='noancilla')
+    #qc.mcx([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24],q[25],ancilla_qubits=None, mode='noancilla')
+    #qc.cx([0],[1])
+    qc.mcx([0,1,2],q[nqubits-1],ancilla_qubits=None, mode='noancilla')
+    qc.x(q[1])
+    qc.x(q[2])
+    #qc.x(q[5])
+    #qc.x(q[7])
+    #qc.x(q[8])
+    #qc.x(q[12])
+    #qc.x(q[13])
+    #qc.x(q[15])
+    #qc.x(q[19])
+    #qc.x(q[20])
+    #qc.x(q[21])
+    #qc.x(q[22])
+    #qc.x(q[24])
+    qc.h(q[nqubits-1])
+    #return the oracle as a gate.
+    oracle = qc.to_gate()
+    oracle.name = "U$_\omega$"
+    return oracle
+
+
+def diffuser(nqubits):
+    qc = QuantumCircuit(nqubits)
+    # Apply transformation |s> -> |00..0> (H-gates)
+    for qubit in range(nqubits):
+        qc.h(qubit)
+    # Apply transformation |00..0> -> |11..1> (X-gates)
+    for qubit in range(nqubits):
+        qc.x(qubit)
+    # Do multi-controlled-Z gate
+    qc.h(nqubits-1)
+    qc.mcx(list(range(nqubits-1)), nqubits-1)  # multi-controlled-toffoli
+    #qc.cx([0],[1])
+    qc.h(nqubits-1)
+    # Apply transformation |11..1> -> |00..0>
+    for qubit in range(nqubits):
+        qc.x(qubit)
+    # Apply transformation |00..0> -> |s>
+    for qubit in range(nqubits):
+        qc.h(qubit)
+    # We will return the diffuser as a gate
+    U_s = qc.to_gate()
+    U_s.name = "$U_s$"
+    return U_s
+
+n = 4
+qr = QuantumRegister(n-1, 'register')
+anc = QuantumRegister(1, 'ancilla')
+cr = ClassicalRegister(n-1, 'classical')
+grover_circuit = QuantumCircuit(qr,anc)
+grover_circuit = initialize_s(grover_circuit, list(range(n)))
+iterations = numberofiterations(n-1)
+for j in range(iterations ):
+    grover_circuit.append(oracle(n), list(range(n)))
+    grover_circuit.append(diffuser(n), list(range(n)))
+measure_circuit = QuantumCircuit(qr,cr)
+measure_circuit.measure(qr,cr)
+```
+
+",13881,,55,,11/23/2020 17:07,11/23/2020 17:07,Length / transpilation issues with Grover's algorithm,,0,11,,,,CC BY-SA 4.0 +14729,1,,,11/19/2020 21:39,,1,97,"

I run many tests with VQC and QSVM algorithms. In last times I can't get final result because some job hang on state Creating, Validating or Running. It can continue many hours and It doesn't finish. For example, I run test with some parameters and get result but after I run test with the same parameters and not get result because this problem. It happens with real devices and qasm_simulator. For QSVM These problems happen after long time (>1000 jobs), for VQC - in the beginning. Does it are problems of site or my code? +Sorry for my english. +

+

My code:

+
import warnings
+import numpy as np
+from qiskit.aqua import QuantumInstance
+from qiskit.aqua.algorithms import VQC
+from qiskit.aqua.components.optimizers import SPSA, COBYLA
+from qiskit.aqua.components.feature_maps import RawFeatureVector
+from qiskit.circuit.library import TwoLocal, ZZFeatureMap
+from qiskit import IBMQ
+
+
+#I read file where data look so:
+#1234
+#28313
+#2145
+#27216
+#...
+
+def get_bd(str):
+    f = open(str,'r')
+    data = f.read()
+    _true = []
+    _false = []
+    for i in range(3):
+        m = []
+        a,none,data = data.partition('\n')
+        b,none,data = data.partition('\n')
+        m.append(int(a))
+        m.append(int(b))
+        _false.append(m)
+    
+    for i in range(3):
+        m = []
+        a,none,data = data.partition('\n')
+        b,none,data = data.partition('\n')
+        m.append(int(a))
+        m.append(int(b))
+        _true.append(m)
+    return _false, _true
+
+
+def get_tr(name,n):
+    f = open(name,'r')
+    data = f.read()
+    test = []
+    for i in range(n):
+        m = []
+        a,none,data = data.partition('\n')
+        b,none,data = data.partition('\n')
+        m.append(int(a))
+        m.append(int(b))
+        test.append(m)
+    return test
+
+train_false,train_true = get_bd('spectrain.txt')
+test_false,test_true = get_bd('spectest.txt')
+
+warnings.filterwarnings("ignore", category=DeprecationWarning)
+
+IBMQ.enable_account('0adb8fad54503818021e5540edd831eb17ff2b794c33f544630a57041a7f808140fd5bf21be60984b652025147b4ee5fded6f0783763b0fc9c18dbfcf61cdfdc')
+provider = IBMQ.get_provider(hub='ibm-q')
+
+
+shots = 8192
+feature_dim = 2
+backend = provider.get_backend('ibmq_qasm_simulator')
+optimizer = SPSA(max_trials=1000, c0=4.0, skip_calibration=True)
+optimizer.set_options(save_steps=1)
+#feature_map = RawFeatureVector(feature_dimension=feature_dim)
+feature_map = ZZFeatureMap(feature_dimension=feature_dim, reps=2,entanglement='linear')
+#feature_map = SecondOrderExpansion(feature_dimension=2,depth=2,entanglement='linear')
+
+var_form = TwoLocal(feature_dim, ['ry', 'rz'], 'cz', reps=3)
+
+training_data = {'A': np.asarray(train_false),'B': np.asarray(train_true)}
+#test_false,test_true = get_bd('test_data')
+testing_data = {'A': np.asarray(test_false),'B': np.asarray(test_true)}
+
+
+
+vqc = VQC(optimizer, feature_map, var_form, training_data, testing_data)
+quantum_instance = QuantumInstance(backend, shots=shots,skip_qobj_validation=False)
+
+result = vqc.run(quantum_instance)
+print("testing success ratio: ", result['testing_accuracy'])
+
+

Hmm. I run it today on trainning samples in 3-norm,3-anomaly samples and It doesn't hang... while. So yesterday It worked in first time until I run training for 1000-norm,1000-anomaly samples where problem happens. I try to run 1000-norm,1000-anomaly samples later for checking.

+

Update 21.11.2020 +I try run VQC algorithm 1000-norm,1000-anomaly samples and get this: +

+

Some jobs were completed but It hangs now. I get good result with this test yesterday. Today I set 8192 shots (It was 2 shots in last time) and We see this image.

+",13482,,55,,11/23/2020 17:07,11/23/2020 17:07,State bug in IBM Quantum Experience,,0,2,,,,CC BY-SA 4.0 +14730,1,14731,,11/19/2020 22:57,,1,104,"

I'm revisiting my knowledge on phase kickback, and I realize that there are many holes in my understanding. I've come across the definition that phase kickback is the phenomenon that occurs when you apply a controlled unitary where the target qubit is in an eigenstate of the unitary thus kicking the phase to the ancilla qubit So here's my question:

+

Why is it that when applying a controlled operation where the target qubit is an eigenstate, that the phase of that state gets kicked up to the ancilla qubit?

+",13449,,,,,11/20/2020 22:05,Why does the phase of the eigenstate get kicked up to the ancilla qubit?,,1,3,,,,CC BY-SA 4.0 +14731,2,,14730,11/20/2020 1:18,,2,,"

Here is a basic example of a two system that might help you to see this better. Suppose I have these two circuits:

+

Circuit 1: Which put the "Controlled qubit" in the state $|1\rangle$ and the "Target qubit" state in $H \big(X|0\rangle \big) = \dfrac{|0\rangle - |1\rangle}{\sqrt{2}} $. Note that this state, $|psi \rangle = \dfrac{|0\rangle - |1\rangle}{\sqrt{2}} $ is an eigenvector of the NOT gate $X = \begin{pmatrix} 0 & 1\\ 1 & 0 \end{pmatrix}$ since $ X|\psi \rangle = X \bigg(\dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg) = -1 \bigg(\dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg) = -1|\psi \rangle $.

+

+

so here the state before the Controlled-NOT (CNOT) operation is $|1\rangle \bigg(\dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg) = \dfrac{|10\rangle - |11\rangle}{\sqrt{2}}$.

+

hence

+

$$ CNOT \bigg( \dfrac{|10\rangle - |11\rangle}{\sqrt{2}} \bigg) = \dfrac{|11\rangle - |10\rangle}{\sqrt{2}} = - \bigg( \dfrac{|10\rangle - |11\rangle}{\sqrt{2}}\bigg) = - \bigg( |1\rangle \otimes \dfrac{ |0\rangle - |1\rangle}{\sqrt{2}} \bigg) $$

+
+

But as you know, the state $|\psi \rangle = - \bigg( |1\rangle \otimes \dfrac{ |0\rangle - |1\rangle}{\sqrt{2}} \bigg) $ and the state $|\phi \rangle = |1\rangle \otimes \dfrac{ |0\rangle - |1\rangle}{\sqrt{2}}$ are equivalent.

+



+

Circuit 2: Which put the "Controlled qubit" in the state $\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$, and "Target qubit" still in $\dfrac{|0\rangle - |1\rangle}{\sqrt{2}} $

+

+

here the state before the Controlled-NOT (CNOT) operation is: +$$\bigg(\dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \bigg)\bigg(\dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg) = \dfrac{|00\rangle - |01\rangle + |10\rangle - |11\rangle}{2}$$ +Hence +\begin{align} CNOT \bigg( \dfrac{|00\rangle - |01\rangle + |10\rangle - |11\rangle}{2} \bigg) &= \dfrac{|00\rangle - |01\rangle + |11\rangle - |10\rangle}{2}\\ +&= \bigg( \dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg) \otimes \bigg( \dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg) +\end{align}

+

From here we can see that the controlled qubit started in the state $\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$ but ended in the state $\dfrac{|0\rangle - |1\rangle}{\sqrt{2}}$. Thus, it has picked up the overall phase of the state: $ -1 \bigg(\dfrac{|0\rangle - |1\rangle}{\sqrt{2}} \bigg) $ as its relative phase.

+",9858,,13449,,11/20/2020 22:05,11/20/2020 22:05,,,,0,,,,CC BY-SA 4.0 +14732,1,14734,,11/20/2020 4:30,,3,117,"

I'm a bit confused about in which case the two unitary gates in a quantum circuit could be canceled? I'm reading an example in this paper. In the following diagram, Figure (b) is a simplified circuit of Figure (a): + +I'm wondering if Figure (b) is the simplest optimization result of Fig. a? In their diagram, the first and third part of the circuit are grouped together, I do understand that two Hadamard gates are canceled, but why the two C-NOT gates (acting on the second and the ancilla qubit) are also canceled? (in this case, those two C-NOT gates are not next to each other)

+

My guess is they're canceled since no unitary gates are directly sandwiched between the two control qubits (despite there's another C-NOT between them targeted at the same ancilla qubit). Is this the right explanation? How can I have a better understanding of what's going on?

+

Thanks!!!

+",12334,,,,,11/20/2020 6:29,Gate cancellations in Hamiltonian simulation,,1,0,,,,CC BY-SA 4.0 +14733,1,,,11/20/2020 5:24,,1,89,"

Is the following unitary transformation possible? If so, what will be the value of $U$?

+

$$U|i,j_1\rangle = 1/\sqrt{k}(|i,j_1\rangle+|i,j_2\rangle+|i,j_3\rangle...+|i,j_k\rangle)$$

+

Here, $i$ is a node in a graph and $j_1,j_2....j_k$ are the nodes to which node $i$ is attached. $k$ is the degree of node.

+

For example: Consider we have 8 nodes in the graph and Node 0($|000\rangle$) is attached to node 1($|001\rangle$) ,node 7($|111\rangle$) and node 5($|101\rangle$). +So, what I want is a single $U$ operator which does this:

+

$$U|000,001\rangle=1/\sqrt{3}(|000,001\rangle+|000,111\rangle+|000,101\rangle)$$ +$$U|000,111\rangle=1/\sqrt{3}(|000,001\rangle+|000,111\rangle+|000,101\rangle)$$ +$$U|000,101\rangle=1/\sqrt{3}(|000,001\rangle+|000,111\rangle+|000,101\rangle)$$

+",13517,,55,,11/23/2020 17:06,11/23/2020 17:06,"How to perform the unitary transformation $U|i,j_1\rangle = 1/\sqrt{k}(|i,j_1\rangle+|i,j_2\rangle+|i,j_3\rangle...+|i,j_k\rangle)$?",,2,3,,,,CC BY-SA 4.0 +14734,2,,14732,11/20/2020 6:21,,4,,"

It is true that these two circuits are equivalent:

+

+

as the the controlled qubit $q_1$ is the same. So if $q_1$ is a $|1\rangle$ then you can see that it will apply two $X$ gates to $q_2$ and they will cancel each other out.

+",9858,,9858,,11/20/2020 6:29,11/20/2020 6:29,,,,1,,,,CC BY-SA 4.0 +14735,1,,,11/20/2020 7:09,,2,157,"

I asked about decomposition gate of CCRY last week, and the answer was:

+

+

However, I now also want to do this for CCCRY. Please someone tell me.

+",13730,,9858,,11/20/2020 7:39,11/20/2020 7:57,How to make the gate decomposition of CCCRY,,3,1,,,,CC BY-SA 4.0 +14736,2,,14735,11/20/2020 7:44,,1,,"

There is an automatic way to design a gate, utilizing qiskit. When drawing the figure of a quantum, you can use the code circ.decompose().draw() to show a decomposed circuit.

+

Code first:

+
from qiskit import QuantumCircuit,QuantumRegister
+from qiskit.circuit.library.standard_gates import RYGate
+from qiskit.circuit import Parameter
+import matplotlib.pyplot as plt
+qr=QuantumRegister(4)
+circ=QuantumCircuit(qr)
+a=Parameter('a') # You can replace a with theta here
+CCCRY=RYGate(a).control(3)
+circ.append(CCCRY,qr)
+circ.decompose().draw('mpl')
+plt.show()
+
+

And this gives the following decomposition:

+

+

In this figure, $U_3(\theta,\phi,\lambda)=RZ(\phi)RX(-\pi/2)RZ(\theta)RX(\pi/2)RZ(\lambda)$, so $U_3(\theta,0,0)=RY(\theta)$.

+",13647,,,,,11/20/2020 7:44,,,,0,,,,CC BY-SA 4.0 +14737,2,,14735,11/20/2020 7:55,,0,,"

You can use the same trick by replacing $RY(\theta)$ by $CRY(\theta)$ i.e

+

$$ CCCRY = CC(CRY) $$

+

Then you can continue the simplification process till you find an excutable circuit.

+",13479,,,,,11/20/2020 7:55,,,,0,,,,CC BY-SA 4.0 +14738,2,,14735,11/20/2020 7:57,,1,,"

In general, you can design $n$-controlled $U$ gate, $CCC\cdots CU = C^{n}U $, using the technique from Mike and Ike on page 184, starting with

+

+

where

+

+

and here your $Controlled-U$ is $CR_y$ which is

+

+",9858,,,,,11/20/2020 7:57,,,,0,,,,CC BY-SA 4.0 +14739,2,,3971,11/20/2020 11:27,,1,,"

Quantum computing is totally understandable without physics background for several reasons:

+
    +
  1. Quantum computing is sufficiently written in abstract mathematical language (Linear Algebra).
  2. +
  3. Quantum computing does not include dynamical equations such as Schrodinger equations. Moreover, all operations can be understood as logical gates instead of physical entities.
  4. +
  5. Quantum mechanics itself made a bridge between physics and information in a such way that information scientist can understand it from his/her perspective.
  6. +
+

However, quantum mechanics and quantum computing includes new concepts that are hard to accept by everyone including physicists. So don't worry.

+",13479,,,,,11/20/2020 11:27,,,,0,,,,CC BY-SA 4.0 +14740,2,,12615,11/20/2020 13:23,,1,,"

I found a paper not yet peer-reviewed by José Manuel Bravo which presents a quantum algorithm to calculate the Hamming distance of two binary strings of equal length and in particular the Hamming weight of a binary string, the number of 1's in the string. It is based on the Deutsch-Jozsa algorithm. Two experiments have been simulated on the IBM Q Experience composer. Bravo, J.M. Calculating Hamming Distance with the IBM Q Experience. Preprints 2018, 2018040164 (doi: 10.20944/preprints201804.0164.v2)

+",13888,,,,,11/20/2020 13:23,,,,0,,,,CC BY-SA 4.0 +14741,2,,14733,11/20/2020 13:39,,4,,"

There is a question that has something in common with your question, see the answer by @DaftWullie.

+

Since all three input states after the operation, $U$, give the same result, then we can not decide which state is our input(it can not be recovered), this means that the operation is not reversible.

+

Maybe, after you appended some ancilla and enlarge the operation $U$ your requirement is possible.

+",13647,,,,,11/20/2020 13:39,,,,0,,,,CC BY-SA 4.0 +14742,2,,14733,11/20/2020 13:57,,2,,"

To compute the values of $U$ matrix representation you should calculate its elements $<{i, j}|U|{i', j'}>$ for all values of $i, i', j, j'$. +For instance:

+

$$ U_{i,j_1,i,j_1} = <{i, j_1}|U|{i, j_1}> = 1/\sqrt{k} $$ +$$ U_{i,j_2,i,j_1} = <{i, j_2}|U|{i, j_1}> = 1/\sqrt{k} $$

+

and so on..

+

You should also define the state $U|i,j>$ for all $i$ and $j$ to completely determine the $U$ matrix. Otherwise, it will contain unknown elements.

+

However, your example shows that your transformation is not unitary:

+

If $U|x> = U |y>$ while $<x|y> = 0$, it implies that +if $U$ is unitary, then $$ <x|U^\dagger U|y> = 0$$ which is contradiction since $U|x> = U |y>$.

+

Hence, your transformation is NOT unitary (which is obvious from the identical outputs which implies IR-REVERSIBILITY). You should include ENTANGLING operations with additional qubits to achieve a legal quantum gate.

+",13479,,13479,,11/20/2020 18:47,11/20/2020 18:47,,,,7,,,,CC BY-SA 4.0 +14743,1,,,11/20/2020 14:48,,1,138,"

I want to record the time that a VQE solver takes to find the ground state. At the moment I am using:

+
%matplotlib inline
+# Importing standard Qiskit libraries and configuring account
+from qiskit import QuantumCircuit, execute, Aer, IBMQ
+from qiskit.compiler import transpile, assemble
+from qiskit.tools.jupyter import *
+from qiskit.visualization import *
+import numpy as np
+import matplotlib.pyplot as plt
+import time
+
+# Loading your IBM Q account(s) and assigning backend
+IBMQ.load_account()
+provider = IBMQ.get_provider('ibm-q')
+qcomp = provider.get_backend('ibmq_valencia')
+
+#Imports for algorithm
+from qiskit.chemistry.drivers import PySCFDriver, UnitsType, Molecule
+from qiskit.chemistry.transformations import FermionicTransformation, FermionicQubitMappingType
+from qiskit.aqua.algorithms import NumPyMinimumEigensolver
+from qiskit import BasicAer
+from qiskit.aqua import QuantumInstance
+from qiskit.chemistry.algorithms.ground_state_solvers.minimum_eigensolver_factories import VQEUCCSDFactory
+from qiskit.chemistry.algorithms.ground_state_solvers import GroundStateEigensolver
+
+        
+#Define molecule
+molecule = Molecule(geometry=[['H', [0., 0., 0.]],
+                              ['H', [0., 0., 0.735]]],
+                     charge=0, multiplicity=1)
+
+driver = PySCFDriver(molecule = molecule, unit=UnitsType.ANGSTROM, basis='sto3g')
+
+#Map fermionic hamiltonian to qubit hamiltonian
+transformation = FermionicTransformation(qubit_mapping=FermionicQubitMappingType.PARITY,
+                                        two_qubit_reduction=True,
+                                        freeze_core=True)
+
+
+#Initialize the VQE solver
+vqe_solver = VQEUCCSDFactory(QuantumInstance(backend = qcomp))
+
+#Ground state algorithm
+calculation_VQE = GroundStateEigensolver(transformation, vqe_solver)
+        
+#Calculate results
+start = time.time()
+VQE_result = calculation_VQE.solve(driver)
+end = time.time()
+time_difference = (end - start)
+print(VQE_result.total_energies)
+print(time_difference)
+
+

However, after running this a few times on different IBM quantum machines, I am quite sure that the times I am recording are including the time spent waiting in queue to run the computations (but not completely certain on this). +Is there any way to record the time taken by the VQE to compute the ground state energy without including queue time.

+",13724,,55,,11/23/2020 17:05,11/23/2020 17:05,Recording the time taken by a VQE to find ground state energy,,1,0,,,,CC BY-SA 4.0 +14744,2,,14743,11/20/2020 16:00,,2,,"

You are correct that your current strategy will include the time spent in queue and other overhead processes.

+

If you are looking to only get the time spent evaluating, then you can use Aqua's logging feature. If you turn on Aqua's logging, then it will show you INFO logs during the VQE's run. Within these logs are times taken for each evaluation and parameter binding. Although not ideal, you can add all of these times up and come up with a rough estimate of the total time taken for the entire VQE run.

+

You can enable Aqua's logging by running this snippet of code with your imports:

+
import logging
+from qiskit.aqua import set_qiskit_aqua_logging
+set_qiskit_aqua_logging(logging.DEBUG)  # choose INFO, DEBUG to see the log
+
+

An example of what one of the iteration's logs would look like:

+
2020-11-20 10:30:48,980:qiskit.aqua.algorithms.minimum_eigen_solvers.vqe:INFO: Energy evaluation returned [-1.17232169] - 74336.84897 (ms), eval count: 1
+
+",6180,,,,,11/20/2020 16:00,,,,1,,,,CC BY-SA 4.0 +14745,1,14747,,11/20/2020 16:13,,2,156,"

+

I created two qubits in IBM quantum experience and measured the second qubit without applying any gate. +The result I got had a computational basis of 00 and 10. How does the measurement of the second qubit change the basis to 00 and 10? I have just started to learn quantum computing, so the question may sound silly.

+",13890,,55,,11/23/2020 17:05,11/23/2020 17:05,Measurement of 1 qubit in a two qubit system,,3,0,,,,CC BY-SA 4.0 +14746,2,,14745,11/20/2020 16:18,,1,,"

Quantum computer are not perfect. There are certain limitation to quantum computers currently. Qubits are highly susceptible to noise and are error prone. A stray commic ray or thermal vibrations can change the results of the calculation. The Quantum computer must be maintained at very cold temperatures and if that temperature is not maintained then the qubit can have give faulty results. You'll notice that when ibm qiskit runs your program it runs the program several times, to calculate an average score to account for this quantum noise. You can change the number of time qiskit runs results to create a more accurate result.

+

If you look at the 'y-axis' of your results, you will notice this algorithm was run 100 times. (see under histogram). Looks like one in 100 times this algorithm gave an incorrect result.

+",13081,,13081,,11/20/2020 16:24,11/20/2020 16:24,,,,0,,,,CC BY-SA 4.0 +14747,2,,14745,11/20/2020 16:19,,1,,"

If you had run this on the statevector_simulator then you will only see $|00\rangle$. However, due to hardware noise, which in this case coming out from the measurement error, you will have some $|1\rangle$ in your measurement on $q_1$. Depends on the hardware noise level, you might see 'more' or 'less' of $|1\rangle$ appearing in your result. If you want to improve your output probabilities result, just add more shots.

+

Update: Why would we would we only see the state $|00\rangle$ in the ideal world, like if we have used the statevector_simulator instead of the hardware?

+

The reason is because the starting/initial state on a quantum computer always start in the state $|000\cdots 0\rangle$. That is, every qubit initialize with $|0\rangle$. And this state can be prepared with very high fidelity. In your case, you have two qubit, so your system is initialize at the state $|00\rangle$. That is $|q_0\rangle = |0\rangle$ and $|q_1 \rangle = |0 \rangle$. So now without doing any operation on this qubit, you ask the quantum computer, what state is the second qubit, $q_1$ in? The answer should be $|0\rangle$ if you have a measurement process with no noise! Because the state the qubit $q_1$, $|q_1\rangle = |0\rangle$. There is no other answer it can give you. However, if there is noise presence, it might change this answer from a $|0\rangle$ to a $|1\rangle$ every so often, depending on the noise level of course. Say you ask 100 times, 95 of the time you will get the correct answer of $|0\rangle$ and 5 time it will return a $|1\rangle$ due to error. Think of this as like when you are driving in car through a scenic mountain area, then your friend call and ask if you want to come over to hangout. Because of where you are, the signal is not very clear, so eventhough you say "YUP", he/she might hear as a "NOPE" instead.... so if you have say"YUP", "YUP",.... "YUP" 100 times, he/she might pick up a "NOPE" 5 time out of the 100 time. This is what you see in your histogram plot... sometime the measurement process pick-up a $|1\rangle$ because of the noise in the measurement process as your friend has picked up a "NOPE" from bad signal.

+

Note that this should not be confusing with the state $|q_1 \rangle = \dfrac{|0\rangle + |1 \rangle}{\sqrt{2}}$... In this case, when you ask the quantum computer, "Hey QC, what state is $|q_1\rangle$ in? It will return you with a $|0\rangle$ or a $|1\rangle$ with $1/2$ probability. This is not because of the noise in your system. If you run this experiment $100,000$ time, you might get $49820$ time it will returns a $|0\rangle$ and $50,180$ time it will returns a $|1\rangle$. This is because your state $|q_1\rangle$ is in superposition of both $|0\rangle$ and $|1\rangle$, so when making a measurement, it will collapse onto either one of these state. And in this case, where $|q_1 \rangle = \dfrac{|0\rangle + |1 \rangle}{\sqrt{2}}$, the probability of collapsing onto the state $|0\rangle$ is 50% probability and the state $|1\rangle$ is also 50%. This is similar to tossing a coin if you think about it...

+",9858,,9858,,11/20/2020 17:17,11/20/2020 17:17,,,,4,,,,CC BY-SA 4.0 +14748,2,,10150,11/20/2020 16:29,,0,,"

To add to the circuit by @Craig, the reason why papers tend to mention that some gate is obtainable by $\sqrt{swap}$ upto a few single qubit gates is because the set that contains the $\sqrt{swap}$ gate and all the one qubit gates is considered to be a universal set of quantum gates. That is, by just using just the $\sqrt{swap}$ gate and some single qubit gates, it is possible to construct any single or multi qubit quantum gate.

+",9097,,,,,11/20/2020 16:29,,,,0,,,,CC BY-SA 4.0 +14749,2,,14745,11/20/2020 16:45,,1,,"

What you are seeing here is coming from the fact that quantum computation on real machines is not perfect.

+

In a perfect world, since you did not put any gates on your circuit, the state it should return is $|00\rangle$, the common initial state on any machine by default.
+However, on real quantum machines, qubits can experience noise from the operations you are doing. Here, the $|1\rangle$ on the Qubit 1 comes from an error when measuring the Qubit, and there isn't really a way to completely avoid those errors when running quantum circuits on real machines.

+

Does that answer your question or do you need more explanation on something? Feel free to ask :)

+",12396,,,,,11/20/2020 16:45,,,,8,,,,CC BY-SA 4.0 +14750,1,,,11/20/2020 17:46,,2,78,"

I am trying to work out how to program a simulation of a quantum +computer program. I think I understand all the steps, of implementing a simulation, except +the simulation of the measurement. +I will use 2 qubit states to illustrate; though the illustration below extends in +an obvious way to n qubits. +Suppose after we are up to the state just before measurement it is

+

$a_0|00\rangle+a_1|01\rangle+a_2|10\rangle+a_3|11\rangle$

+

Suppose there exist a unique maximum from the real numbers +$a_0,a_1,a_2,a_3$ let refer to this as m; and that the sum of squares +of the 4 amplitudes sum to 1. +and we want to know what is the most likely state that will be measured.

+

A) Is the most likely state to be measured +the one with maximum squared amplitude of $a_0,a_1,a_2,a_3$ +in other words, the most likely state has a probability $m^2$ of being measured +-for example, out of 100 repeated measurements $(100*(m^2))$, to the nearest integer, will be the likely state.

+

or

+

B) Is the most likely state to be measured the one that has the highest ratios +regarding the amplitudes, compared to every other state, +the ratio measures how many times more likely one state is to be measured when +compared to another state,suppose that $a_3$ is near to one, and $a_0,a_1,a_3$ are near to +zero then computing the absolute values of

+

$|a_3/a_2|,|a_3/a_1|, |a_3/a_0|$ I assume, not sure but assuming here, will give the largest 3 values when compared +to any of the values in the two lists of amplitude ratios

+

$|a_2/a_3| ,|a_2/a_1|, |a_2/a_0|$

+

or

+

$|a_1/a_2|,|a_1/a_0|, |a_1/a_3|$

+

therefore $a_3$ is most likely to measured and suppose $a_3/a_2, a_3/a_1, a_3/a_0$ are all largest than some integer I +then if I is large enough for the simulation then we can ignore how many times, referred to as T, we measure +the state because we can conclude $a_3$ is measured every time.

+

So is the answer A or B?

+",13834,,13968,,12/16/2021 4:24,12/16/2021 4:24,Details for implementing the measurement of a simulation,,1,0,,,,CC BY-SA 4.0 +14751,1,14758,,11/20/2020 18:35,,5,234,"

Let's say I need to find the state $111$ in a "database" that is not the computational basis for a 3-qubits system (because it doesn't contain all of the basis vectors or contains the same vector more than one time). For example, this database could be the set $\{000, 010, 001, 000, 000, 110\}$.

+

How can I adjust Grover's algorithm for this kind of search? I would like a Qiskit implementation of this case.

+",13893,,55,,11/23/2020 17:08,12/8/2020 11:29,Qiskit: How can I modify Grover's algorithm to search for a state that doesn't belong to a basis set?,,2,3,,,,CC BY-SA 4.0 +14752,2,,14673,11/20/2020 19:04,,0,,"

You should know that amplitudes are not OBSERVABLES (they cannot be measured). In general, the minus sign is just a phase factor ($ -1 = e^{i\pi}$), which is irrelevant to the statistical outcome, since $ |a|^2 = |-a|^2 $.

+

Consequently, we cannot find an unitary operation that distinguishes between a minus signed amplitude and a positive one (or either the amplitude of a bigger magnitude from others).

+",13479,,15391,,1/18/2022 4:11,1/18/2022 4:11,,,,0,,,,CC BY-SA 4.0 +14753,2,,14750,11/21/2020 1:43,,1,,"

A pure state $|\psi \rangle = \sum c_i |e_i\rangle $ is a superposition state of the states $|\psi_\rangle$ and the $|c_i|^2$ is probability that one would observe $|\psi_i\rangle$ when measured.

+

For example: Suppose we have $|\psi \rangle = \dfrac{3}{5}|0\rangle + \dfrac{4}{5}|1\rangle $

+

Then this state $|\psi\rangle$ will be measured as $|0\rangle$ in the $Z$ basis (computational basis, the usual basis one deals with when thinking about quantum computing) with probability $\bigg| \dfrac{3}{5} \bigg|^2 = \dfrac{9}{25}$. And similarly, it has probability $\bigg| \dfrac{4}{5} \bigg|^2 = \dfrac{16}{25}$ being measured as $|1\rangle$. Note that $\dfrac{9}{25} + \dfrac{16}{25} = 1 $. This makes sense because there are only 2 possible states ($|0\rangle$ or $|1\rangle$ ) that you can measure, so their probability must sum up to $1$. In this case, we see that we will see the state $|\psi \rangle$ collapsed onto the state $|1\rangle$ more often than it will collapse to the state $|0\rangle$. However, there is no pattern to this collapse. That is, you don't expect them to alternate, $|0\rangle$ then $|1\rangle$ then $|0\rangle$ of that sort. It will be random. But after doing maybe 1000 experiment, you find that you recorded 355 times that the state $|\psi \rangle$ collapse to the state $|0\rangle$ and the other 645 it has collapsed to the state $|1\rangle$.

+

Hence giving $|\psi \rangle = \sum c_i |e_i\rangle $, the largest $|c_i|^2$ value do tells us that we will observe that particular $|\psi_i\rangle$ state more than the other states in our experiments.

+
+
+

Now, can we look at the absolute ratio of these two states $( |0\rangle$ and $|1\rangle )$ and say which one it will collapse to more often? Yes, at least mathematically. And you can see here $\bigg| \dfrac{4}{5}/\dfrac{3}{5} \bigg| > \bigg| \dfrac{3}{5}/\dfrac{4}{5} \bigg|$. But we must remember that we in general do not have access to the superposition of the state of the qubit! This superposition is only know by the qubit itself. That is, giving a qubit in the state $|\psi \rangle = \alpha|0\rangle + \beta|1\rangle $ we would never know what $\alpha$ or $\beta$ is. And to retrieve this information of $|\alpha|^2$ and $|\beta|^2$, we do many many measurements to get a statistical distribution. This is how quantum mechanics was postulate. It is not a problem of engineering.

+",9858,,,,,11/21/2020 1:43,,,,0,,,,CC BY-SA 4.0 +14754,1,14757,,11/21/2020 3:14,,1,105,"

+

In the circuit, the CNOT gate is applied in 11 state and it should transform into 10 state. But why is the probability of getting 01 state 100 percent?

+",13890,,,,,11/21/2020 6:29,State vector after applying CNOT,,1,1,,,,CC BY-SA 4.0 +14755,1,14756,,11/21/2020 3:29,,2,80,"

I got another follow-up question about Hamiltonian simulation from the previous post: if I perform the controlled time-evolution of the Hamiltonian:

+

$$ +H_{3} = \alpha\ X_1\otimes Y_2 + \beta \ Z_1\otimes Z_2 +$$ +where $\alpha$ and $\beta$ are real constants. When they're both equal to 1, $H_3$ could be simulated via the following quantum circuit (answer from @KAJ226): + +However, how can I introduce those constants when they're not equal to 1? This paper by Earl Campbell proposed an idea to build up a compiler and randomly 'select' the part of Hamiltonian according to a probability distribution determined by constants like $\alpha$ and $\beta$.

+

I think this is a good way to incorporate the effects of those constants (the effect would be more obvious if you have enough time steps), but it's still kind of 'indirect' to me. I'm wondering is there another option that I can show the effects of $\alpha$ and $\beta$ when they are generic real numbers?

+

Thanks!!

+",12334,,1859,,11/21/2020 16:33,11/21/2020 16:33,Hamiltonian simulation: how can I incorporate the constant before each term?,,1,0,,,,CC BY-SA 4.0 +14756,2,,14755,11/21/2020 5:41,,2,,"

You'll place the phase within the CRz gate.

+

The approach you've taken essentially argues that: $$ e^{it H_3} \approx e^{it \alpha X_1 \otimes Y_2} e^{it \beta Z_1 \otimes Z_2} $$

+

So, when you're applying the Rz gate, you can select the $it \alpha$ coefficient to align with the necessary phase (likely you'll use $\theta = -2 t \alpha$, depending on the definition of your Rz)

+

Something to keep in mind with the approach that you're leveraging is that it is a form of exponentiated Hamiltonian splitting. Namely, $$ e^{-i \sum H_j t} = \prod_{j = 1}^m e^{-i H_j t} + \mathcal{O}(m^2 t^2) $$

+

(From Microsoft) This is important to keep in mind because the circuit that you're implementing does not perfectly simulate the Hamiltonian, and the selection of $t$ has significant impacts on the accuracy of the realized circuit.

+

I note this because it's really important to understand the foundational simulation theory in conjunction with simulation realization. Microsoft has great resources, plus the Whitfield paper previously suggested is excellent.

+",8343,,,,,11/21/2020 5:41,,,,2,,,,CC BY-SA 4.0 +14757,2,,14754,11/21/2020 6:29,,2,,"

You are right, that $CNOT |11\rangle = |10\rangle $ in the usual setting. But the reason why you see the answer as $|01\rangle$ instead is because Qiskit uses little endian convention.

+

See this documentation to clear thing up.

+",9858,,,,,11/21/2020 6:29,,,,0,,,,CC BY-SA 4.0 +14758,2,,14751,11/21/2020 9:18,,3,,"

I will quickly reexplain how Grover's Algorithm works :

+
    +
  • First you put your whole system in an equal superposition. The means, for example, with 3 qubits, that your system will be in the state : $|\psi\rangle = \frac{1}{\sqrt{3}}|000\rangle+\frac{1}{\sqrt{3}}|001\rangle+\cdots+\frac{1}{\sqrt{3}}|110\rangle+\frac{1}{\sqrt{3}}|111\rangle$. You will assign one of these basis states for each element of your database.
  • +
  • Then you run the phase-flip oracle gate : $|U_\omega\rangle$
  • +
  • You also run Grover's diffusion operator : $|U_s\rangle$
  • +
  • You repeat the two last steps until the complex amplitude of the state that corresponds to the searched element of your database, has a high enough probability to be measured
  • +
+

As you can see you need at least as many basis states as you have elements in your database, because you assign an element of you database to each basis set. But since you system starts in an equal superposition, every basis state is searchable, as is every element of your database as long as you link a basis state to an element of your database.

+

However, many different questions mix inside yours, for example, if there is more than one correct element, how does the algorithm work ? I hope I could shed some light on the situation !

+",8746,,,,,11/21/2020 9:18,,,,2,,,,CC BY-SA 4.0 +14759,1,,,11/21/2020 9:48,,0,102,"

I am reading the following paper: Discrete-time quantum walk on complex networks +for community detection by Kanae Mukai
+We define the Coin operator $C$ by: $C=C_1\otimes C_2....C_n$ , We define coin operator for Node $i, C_i:H_i\to H_i$ is given by:

+

$C_i^F|i\to j_1\rangle|i\to j_2\rangle.......|i\to j_k\rangle=(|i\to j_1\rangle|i\to j_2\rangle.......|i \to j_k\rangle)1/\sqrt(k_i) \begin{pmatrix} 1 & 1 & 1 & ... & 1\\ 1 & e^{\iota\theta/k_i} & e^{2\iota\theta/k_i} & ... & e^{(k_i-1)\iota\theta/k_i}\\ 1 & e^{2\iota\theta/k_i} & e^{4\iota\theta/k_i} & ... & e^{2(k_i-1)\iota\theta/k_i}\\ . & . & . & . & .\\. & . & . & . & .\\. & . & . & . & .\\ 1 & e^{(k_i-1)\iota\theta/k_i} & e^{2(k_i-1)\iota\theta/k_i} & ... & e^{(k_i-1)(k_i-1)\iota\theta/k_i}\end{pmatrix}$
+Here $k_i$ is the degree of $i^{th}$ node and $\theta=2\pi$. The author called this coin as Fourier Coin. And this $i\to j$ implies that Node $i$ is going to hope to adjacent Node $j$. +Now, What is going on with this equation?

+",13517,,,,,11/21/2020 17:12,What is this equation for coin operator is trying to do in this quantum walk for Non-regular graph? This coin operator is called Fourier coin,,1,1,,,,CC BY-SA 4.0 +14760,2,,14719,11/21/2020 10:13,,1,,"

Reinstalling numpy didn't work for me.

+

I delete the C:\Users\USERNAME\AppData\Roaming\Python\Python38\* folder because that was left behind by a previous Python which I had uninstalled.

+

And this work for me.

+

Thanks to everyone who all answered my questions and I appreciate it.

+",13859,,,,,11/21/2020 10:13,,,,0,,,,CC BY-SA 4.0 +14762,1,,,11/21/2020 12:12,,2,63,"

I'm currently working on QRAC and was wondering if there's an encoding protocol in $3 \rightarrow 1$ such that the receiver is able to retrieve any one of the XOR combinations of the bits, along with the original bits itself ( a grand total of 7 functions; if a, b, c are the bit positions, the receiver should be able to guess a, b, c, a+b, b+c, c+a, a+b+c with a probability greater than 1/2).

+

Is this even possible? My initial guess would be to use some kind of POVM measurements in the decoding part but don't how to proceed with that.

+

If you have any ideas on this then please let me know. Thank you.

+",13591,,55,,11/22/2020 16:54,11/22/2020 21:13,$3 \rightarrow 1$ QRAC encoding for XOR functions,,1,3,,,,CC BY-SA 4.0 +14763,1,14783,,11/21/2020 13:26,,4,227,"

Let $|\psi\rangle$ be a $n$ qubit Haar-random quantum state. I am trying to show that in the limit of large $n$, for each $z_{i} \in \{0, 1\}^{n}$, +$$ |\langle 0|\psi\rangle|^{2}, |\langle 1|\psi\rangle|^{2}, \ldots, |\langle 2^{n} - 1|\psi\rangle|^{2} ~\text{are i.i.d random variables and}$$

+

$$ |\langle z_{i}|\psi\rangle|^{2} \sim \text{PorterThomas}(\alpha),$$ +where the probability density function for the Porter Thomas distribution is given by +$$ f(\alpha) = 2^{n} e^{-2^{n} \alpha}.$$

+

For example, look at Fact 10 of this paper. I am specifically interested in why we need a large enough $n$ to have the i.i.d approximation.

+",1351,,55,,10/20/2022 15:19,10/20/2022 15:19,Compute the large $n$ distribution of $|\langle z_i|\psi\rangle|^2$ over Haar random quantum states,,1,0,,,,CC BY-SA 4.0 +14764,1,,,11/21/2020 15:14,,1,561,"

I'm trying to simplify the inner for loop of this implementation of the Mosca-Ekert semi-classical variant of Shor's algorithm. The inner for loop should have only linear length, but this implementation is exponential.

+

From https://github.com/ttlion/ShorAlgQiskit/blob/master/Shor_Sequential_QFT.py

+
    """ Cycle to create the Sequential QFT, measuring qubits and applying the right gates according to measurements """
+    for i in range(0, 2*n):
+        """reset the top qubit to 0 if the previous measurement was 1"""
+        circuit.x(up_reg).c_if(c_aux, 1)
+        circuit.h(up_reg)
+        cMULTmodN(circuit, up_reg[0], down_reg, aux, a**(2**(2*n-1-i)), N, n)
+        """cycle through all possible values of the classical register and apply the corresponding conditional phase shift"""
+        for j in range(0, 2**i):
+            """the phase shift is applied if the value of the classical register matches j exactly"""
+            circuit.u1(getAngle(j, i), up_reg[0]).c_if(up_classic, j)
+        circuit.h(up_reg)
+        circuit.measure(up_reg[0], up_classic[i])
+
+

The obvious way of using c_if(up_classic[j],j) doesn't work. I've tried using an if statement as in

+
for j in range(0, i):
+    """the phase shift is applied if the value of the classical register matches j exactly"""
+    if up_classic[j]:
+        circuit.u1(getAngle(2**j,i), up_reg[0])
+
+

but test runs fail to find the correct factor for small semiprimes like 21 or 33.

+",9305,,55,,11/22/2020 17:02,11/22/2020 17:02,Simplifying Qiskit circuit with c_if(),,1,0,,,,CC BY-SA 4.0 +14765,1,14902,,11/21/2020 16:15,,5,189,"

Uhlmann's theorem states that if two states $\rho_A, \sigma_A$ satisfy $F(\rho_A, \sigma_A)\geq 1 - \varepsilon$, then there for any purification $\Psi_{AR}$ of $\rho_A$, one can find a purification $\Phi_{AR}$ of $\sigma_A$ such that

+

$$F(\Psi_{AR}, \Phi_{AR})\geq 1 - \varepsilon$$

+

The purification $\Phi_{AR}$ can be found by optimizing over unitaries on the purifying register alone i.e. the following holds for any choice of purification $\Phi_{AR}$

+

$$\sup_{U_R}F(\Psi_{AR}, (I_A\otimes U_R)\Phi_{AR})\geq 1- \varepsilon$$

+

Since the trace distance and fidelity are closely related, one can translate Uhlmann's theorem into the following. Given $\|\rho_A - \sigma_A\|_1 \leq \varepsilon$, for any purification $\Psi_{AR}$ of $\rho_A$ and $\Phi_{AR}$ of $\sigma_A$ , we have

+

$$\inf_{U_R}\|\Psi_{AR} - (I_A\otimes U_R)\Phi_{AR}\|_1\leq \delta(\varepsilon),$$

+

where $\lim_{\varepsilon \rightarrow 0}\delta(\varepsilon) = 0$. Crucially, $\delta(\varepsilon)$ has no dependence on the dimension of the state.

+

Question: Is the above statement true for any other Schatten p-norm. Given $\rho_A, \sigma_A$ such that $\|\rho_A - \sigma_A\|_p\leq \varepsilon$ and for any purifications $\Psi_{AR}$ of $\rho_A$ and $\Phi_{AR}$ of $\sigma_A$, is it true that

+

$$\inf_{U_R}\|\Psi_{AR} - (I_A\otimes U_R)\Phi_{AR} \|_p \leq \delta(\varepsilon)$$

+

I am particularly interested in the above statement for the operator norm i.e. $p = \infty$.

+",4831,,4831,,11/23/2020 16:56,11/29/2020 20:49,Closeness of purifications of states,,1,5,,,,CC BY-SA 4.0 +14766,2,,14764,11/21/2020 16:21,,1,,"

The conditional c_if on Qiskit checks a condition on a classical register, not a classical bit. Therefore, up_classic[j] is not valid.

+

Doing the if at construction time (like on your second case) makes no sense, since up_classic[j] is unknown at that time. Notice that, in the original code, up_classic is set at the end of the loop, with circuit.measure(up_reg[0], up_classic[i]).

+",1859,,,,,11/21/2020 16:21,,,,2,,,,CC BY-SA 4.0 +14768,1,14770,,11/21/2020 17:05,,6,1751,"

Assuming two qubits start in the state: +$|\psi\rangle = \frac{1}{\sqrt 2}|00\rangle + \frac{1}{2}|10\rangle- \frac{1}{2}|11\rangle $

+

What is the probability of measuring the second qubit as 0? And what is the new state of the system after measuring the first qubit as 1?

+

I know that for a single qubit state that the probability amplitudes are the coefficient squared. In a two qubit system are the probabilities distributed to the individual states? I.e. from this example does the each zero state in the state: $|00⟩$ have a 50% chance? And I don't really understand the second question, any suggestion on where to review or study?

+",13081,,55,,11/22/2020 17:01,2/7/2021 18:10,What is the probability of finding the second qubit as $0$ in the state $|\psi\rangle=\frac1{\sqrt2}|00\rangle+\frac12|10\rangle-\frac12|11\rangle $?,,1,1,,,,CC BY-SA 4.0 +14769,2,,14759,11/21/2020 17:12,,1,,"

The operator Fourier Coin is $k$-point Discrete Fourier Transform (DFT) of node $i$. +The matrix representation of a general $N$-point DFT can be found here.

+

The implementation of DFT on the quantum computer is what we know as QFT, and it can be found in Mike and Ike on pg.219. More specifically, an eight-point DFT can be implemented on the quantum computer as

+

+",9858,,,,,11/21/2020 17:12,,,,3,,,,CC BY-SA 4.0 +14770,2,,14768,11/21/2020 18:53,,8,,"

If we have the state $|\psi \rangle = \dfrac{1}{\sqrt{2}}|00\rangle + \dfrac{1}{2}|10\rangle - \dfrac{1}{2}|11\rangle$ then the probability of the second qubit being in the state $|0\rangle$ is the probability of the state $|\psi \rangle$ having $|0\rangle$ on the second qubit. In this case, it is from the states $|00\rangle$ and $|10\rangle$. So The probability of measuring the second qubit in the state $|0\rangle$ is $\bigg| \dfrac{1}{\sqrt{2}} \bigg|^2 + \bigg| \dfrac{1}{2} \bigg|^2 = \dfrac{3}{4} $.

+

You can also work this out more explicitly as well. That is, we have

+

$$ +|\psi \rangle = \begin{pmatrix} 1/\sqrt{2} \ \ \\ 0 \\ 1/2 \\ -1/2 \end{pmatrix} +$$

+

We are looking for the probability that the second qubit is in the state $|0\rangle$ so the projective measurement $M$ is

+

$$ +M = I \otimes |0\rangle \langle 0 | = \begin{pmatrix} + 1 & 0 & 0 & 0\\ + 0 & 0 & 0 & 0\\ + 0 & 0 & 1 & 0\\ + 0 & 0 & 0 & 0 + \end{pmatrix} +$$ +and so according to Born's rule we have that the probability to measure the second qubit in the state $|0\rangle$ is

+

$$ + \langle \psi | M | \psi \rangle = \begin{bmatrix} 1/\sqrt{2} & 0 & 1/2 &-1/2 \end{bmatrix} +\begin{bmatrix} + 1 & 0 & 0 & 0\\ + 0 & 0 & 0 & 0\\ + 0 & 0 & 1 & 0\\ + 0 & 0 & 0 & 0 + \end{bmatrix} \begin{bmatrix} 1/\sqrt{2} \ \ \\ 0 \\ 1/2 \\ -1/2 \end{bmatrix} = \dfrac{1}{2} + \dfrac{1}{4} = \dfrac{3}{4} +$$

+
+

Also, the state post measurement is $|\psi_{post} \rangle = \dfrac{M|\psi\rangle}{\sqrt{3/4}}$.

+

You can extend this to the case where the first qubit is mesured in the state $|1\rangle$ too. In this case, the projective measurement $M = |1\rangle \langle 1| \otimes I$

+",9858,,9858,,2/7/2021 18:10,2/7/2021 18:10,,,,0,,,,CC BY-SA 4.0 +14771,1,14782,,11/21/2020 19:54,,4,198,"

$\newcommand{\expectation}[1]{\mathop{\mathbb{E}} \left[ #1 \right] } +\newcommand{\Var}{\mathrm{Var}}$ From Nielsen & Chuang 10th edition page 261:

+
+

Consider a classical algorithm for the counting problem which samples uniformly and independently $k$ times from the search space, and let $X1, \dots, X_k$ be the results of the oracle calls, that is, $X_j = 1$ if the $j$th oracle call revealed a solution to the problem, and $X_j = 0$ if the $j$th oracle call did not reveal a solution to the problem. This algorithm returns the estimate $S \equiv N \times \sum_j X_j/k$ for the number of solutions to the search problem. Show that the standard deviation in $S$ is $\bigtriangleup S = \sqrt{ M(N − M)/k }$.

+
+

The question goes on but I'm already stuck here. To get to the standard deviation first I'm trying to calculate the variance via:

+

$$ +\Var(S) = \expectation{S^2} - \expectation{S}^2 \tag1\label1 +$$ +$$ +\expectation{S} = N \times \sum_j \expectation{X_j}/k = \frac{N}{k} \sum_{j=1}^k \frac{M}{N} = M \tag2\label2 +$$

+

Therefore $S$ is an unbiased estimator of M.

+

Now:

+

$$ +\expectation{S}^2 = \expectation{\left( N \times \sum_j X_j/k \right)^2} = \frac{N^2}{k^2} \expectation{\left( \sum_j X_j \right)^2} = \frac{N^2}{k^2} \sum_{i=1}^k \sum_{j=1}^k \expectation{X_i X_j} \tag3\label3 +$$

+

To calculate $\expectation{X_i X_j}$ we need to consider 2 cases:

+
    +
  1. $i=j \implies \expectation{X_i X_i}=P(X_i=1)=M/N \tag4\label4$
  2. +
  3. $i \neq j \implies \expectation{X_i X_j}=P(X_i=1, X_j=1)=\frac{M}{N} \frac{M-1}{N-1} \tag5\label5$
  4. +
+

Case 1 happens $k$ times, therefore case 2 must happen $k^2-k$ times. So we have:

+

$$ +\expectation{S}^2 = \frac{N^2}{k^2} \left( k \frac{M}{N} + (k^2 - k) \frac{M}{N} \frac{M-1}{N-1} \right) \tag6\label6 +$$

+

Putting \eqref{2} and \eqref{6} together, after some tedious algebra I got:

+

$$ +\Var(S) = \frac{M}{k} \frac{(N-M)(N-k)}{N-1} \tag7\label7 +$$

+

If $k \ll N$, then \eqref{7} is close to what is stated in the original question but is not exactly it. Can anyone spot where I made the blunder?

+",12643,,,,,11/22/2020 13:07,Nielsen & Chuang Exercise 6.13: Standard deviation of classical counting algorithm,,1,0,,,,CC BY-SA 4.0 +14772,2,,6728,11/22/2020 1:09,,0,,"

Since you can get the state vector of the 5-qubit state, you can use the technique of -----partial-trace to get the state of a specific qubit(This git-hub code implements partial trace using only NumPy).

+

Here comes an example. Suppose you have a two-qubit state $|\psi\rangle=|0\rangle|0\rangle$. Then you produced a state $|\phi\rangle=CNOT(H|0\rangle|0\rangle)$ where the control of CNOT is the first qubit. This produces one of the Bell states, $|\Phi^+\rangle$. Then you traced out the first qubit, the remaining matrix, I/2 is the density matrix of the second qubit, and you can read the probability of getting each result(50% for $|0\rangle$).

+

The code for the upper example:

+
from qiskit import QuantumCircuit,QuantumRegister
+from qiskit.quantum_info import DensityMatrix
+import numpy as np
+def partial_trace(rho,qubit2keep):
+#https://gist.github.com/neversakura/d6a60b4bb2990d252e9e89e5629d5553
+    num_qubit=int(np.log2(rho.shape[0]))
+    for i in range(len(qubit2keep)):
+            qubit2keep[i]=num_qubit-1-qubit2keep[i]
+    qubit_axis=[(i,num_qubit+i) for i in range(num_qubit)
+                    if i not in qubit2keep]
+    minus_factor=[(i,2*i) for i in range(len(qubit_axis))]
+    minus_qubit_axis=[(q[0]-m[0],q[1]-m[1])
+                        for q, m in zip(qubit_axis,minus_factor)]
+    rho_res=np.reshape(rho,[2,2]*num_qubit)
+    qubit_left=num_qubit-len(qubit_axis)
+    for i,j in minus_qubit_axis:
+        rho_res=np.trace(rho_res,axis1=i,axis2=j)
+    if qubit_left>1:
+        rho_res=np.reshape(rho_res,[2**qubit_left]*2)
+    return rho_res
+qr=QuantumRegister(2)
+circ=QuantumCircuit(qr)
+circ.h(qr[0])
+circ.cx(qr[0],qr[1])
+DM=DensityMatrix.from_instruction(circ)
+print(DM.data)
+PT=partial_trace(DM.data,[0])
+print(PT)
+
+

I used a different to generate the state vector and the density matrix, besides I have done tiny adjustment on the partial_trace' code to reverse it's qubit alignment to fit my own code. The two print` operation prints

+

$\begin{pmatrix}0.5&0&0&0.5\\0&0&0&0\\0&0&0&0\\0.5&0&0&0.5&\end{pmatrix}$ +and $\begin{pmatrix}0.5&0.5\\0.5&0.5\end{pmatrix}$.

+",13647,,13647,,11/22/2020 1:37,11/22/2020 1:37,,,,0,,,,CC BY-SA 4.0 +14773,2,,6842,11/22/2020 1:26,,6,,"

Nielsen and Chuang Box 5.2 does indeed need more elaborate explanation.

+

I’m going to describe the architecture of efficient $O(n^3)$ modular exponentiation circuit from the paper ‘Quantum Networks for Elementary Arithmetic Operations’ – Vedral, Barenco, Ekert, 1995, for the case $n = 3$ using specific 3-bit numeric values in order to make general approach more illustrative. It seems to be exactly what you need, since

+
    +
  1. The circuit's efficiency is $O(n^3)$
  2. +
  3. The circuit is not subject to further lower-level optimization, but it is still efficient and replicates logic behind commonly used decomposition technique (you can find more elaborate comments on efficiency in the paper)
  4. +
+

The Idea

+

Let’s first revisit the idea which is used to construct the circuit of the interest. Using the property of modular multiplication $(A\times B) \mod{N} = (A \mod{N}\times B \mod{N}) \mod{N}$, we can see that modular exponentiation is a succession of modular multiplications: +$$y^x \mod{N} =(y^{x_02^0}\times y^{x_12^1}\times ... \times y^{x_{n−1}2^{n−1}} ) \mod{N}=$$ +$$=(...([(y^{x_02^0 }\times y^{x_12^1} ) \mod{N}] \times ... \times y^{x_{n−1}2^{n−1}} )\mod{N}...) \mod{N},$$ +where $x = x_02^0 + x_12^1 + ... + x_{n-1}2^{n-1}$. +Now, any modular multiplication operation can be represented by modular additions in the following way: +$$zm \mod{N}=(z_0 2^0 m+z_1 2^1 m+..+z_{n−1}2^{n−1}m)\mod{N},$$ +where $z = z_02^0 + z_12^1 + ... + z_{n-1}2^{n-1}$. +Finally, modular addition can be represented using addition and logical operations, as you will see later in the text.

+

The Circuit

+

Some comments on notations: wires marked in blue are auxiliary wires for lower-level operations. I decided to keep them in order for the reader not to lose track of what’s going on. Values and circuit elements corresponding to known-in-advance classical information are marked red.

+

Let’s go through the logic of building the circuit from the lowest level with elementary quantum operations to the highest level with modular multiplications

+

3-qubit addition circuit ADDER. +We will use circuits CARRY and SUM which implement bitwise carry and sum operations. + +Note that thick black line on the right side of a block denotes operation itself, while thick black line on the left side of a block denotes reverse operation, i.e. operation with reverse order of all elementary operation for the block.

+

CARRY and SUM are used to construct 3-qubit addition transformation ADDER + +Note that $a$ is the number decoded with 3 qubits, $b$ is the number decoded with 3 qubits, but the register $|b\rangle_b$ contains additional qubit to account for the possibility of 4-bit result of addition.

+

3-qubit modular addition circuit ADDER_MOD. +Modular addition has two blocks: Block 1 and Block 2. + +The logic of the Block 1 is the following: firstly, ADDER acts +$$|a\rangle_a |b\rangle_b |0\rangle_c |N\rangle_N |0\rangle_t \rightarrow |a\rangle_a |a+b\rangle_b |0\rangle_c |N\rangle_N |0\rangle_t$$ +Then 3 SWAP gates swap the register $a$ with the register $N$: +$$|a\rangle_a |a+b\rangle_b |0\rangle_c |N\rangle_N |0\rangle_t \rightarrow |N\rangle_a |a+b\rangle_b |0\rangle_c |a\rangle_N |0\rangle_t$$ +Then reverse ADDER extracts $N$: +$$|N\rangle_a |a+b\rangle_b |0\rangle_c |a\rangle_N |0\rangle_t \rightarrow |N\rangle_a |a+b-N\rangle_b |0\rangle_c |a\rangle_N |0\rangle_t$$ +At that point we are interested in the sign of $a+b-N$. If it is greater than 0, we want to keep the result in the register $b$, but if it is less than 0, we want to make addition of $N$ once again to get $a+b$ in the register $b$, and this is why see CNOTs, the third ADDER and SWAPS in the rest of Block 1.

+

Note that CNOTs denoted by red color are there to make transformation $|N\rangle_a\rightarrow |0\rangle_a$ before ADDER if the value of register $t$ is $|1\rangle_t$, and then undo this operation after ADDER. This is the first time when classically known N affects configuration of the circuit itself: in the case of $N=5=101_2$ we need 2 CNOTs before ADDER and 2 CNOTS after ADDER, but if $N=6=111_2$, we would have to use 3 red CNOTs before ADDER and 3 red CNOTS after ADDER.

+

The role of the Block 2 is to uncompute the value $|1\rangle_t$ to $|0\rangle_t$, if it appears.

+

3-qubit controlled modular multiplication circuit Ctrl_MULT_MOD. +Block Ctrl_MULT_MOD implements the following transformation: +$$|c\rangle_x |z\rangle_z |0\rangle_a |0\rangle_b |0\rangle_c |N\rangle_N |0\rangle_t\rightarrow |c\rangle_x |z\rangle_z |0\rangle_a |zm \mod{N}\rangle_b |0\rangle_c |N\rangle_N |0\rangle_t, \text{ if } c = 1$$ +$$|c\rangle_x |z\rangle_z |0\rangle_a |0\rangle_b |0\rangle_c |N\rangle_N |0\rangle_t\rightarrow |c\rangle_x |z\rangle_z |0\rangle_a |z\rangle_b |0\rangle_c |N\rangle_N |0\rangle_t, \text{ if }c=0$$ +For this particular block we use $m=3=11_2, N=5=101_2$ + +The role of red Toffoli gates is to replace zeros in the register $|0\rangle_a$ with the state $|m\times z_i 2^𝑖 \mod{N}\rangle_a$ to further add up all this numbers to get $|z\times 𝑚 \mod{N}\rangle_b$. Red Toffoli gates put values $m\times 2^i \mod{N}$ in the register $a$ conditionally on values in registers $x$ and $z$. Note that numbers $m\times 2^i \mod{N}$ can be classically and efficiently computed. Also note that this is the second time when classically known information affects configuration of the circuit itself.

+

The last block of CNOTs is used to put value $z$ in the register $|0\rangle_b$ if control $|c\rangle_x$ is $|0\rangle_x$

+

3-qubit modular exponentiation circuit MODULAR_EXPONENTIATION. +Finally, using an array of controlled modular multiplications, we can implement modular exponentiation using known classical information for every step. It should be a succession of controlled modular multiplications with controls set on wires of the register $x$. But every Ctrl_MULT_MOD should be accompanied by SWAPs and reverse Ctrl_MULT_MOD to reset one of the registers to zero and free it for the next controlled modular multiplication (see the original paper for more details). Notation $(...)^{−1}\mod{N}$ is for modular inverse, which can be efficiently classically precomputed using Euclid’s algorithm.

+

To sum up, this Ctrl_MULT_MOD blocks implement the following chain of transformations which lead to the desired result: +$$|x\rangle_x |1\rangle_z |0\rangle_a |0\rangle_b |0\rangle_c |N\rangle_N |0\rangle_t\rightarrow |x\rangle_x |1\times y^{x_0 2^0}\mod{N}\rangle_z |0\rangle_a |0\rangle_b |0\rangle_c |N\rangle_N |0\rangle_t \rightarrow$$ +$$\rightarrow |x\rangle_x |1\times y^{x_0 2^0}\times y^{x_1 2^1}\mod{N}\rangle_z |0\rangle_a |0\rangle_b |0\rangle_c |N\rangle_N |0\rangle_t \rightarrow... \rightarrow$$ +$$\rightarrow |x\rangle_x |y^x\mod{N}\rangle_z |0\rangle_a |0\rangle_b |0\rangle_c |N\rangle_N |0\rangle_t,$$ +

+

The last thing I want to mention is that if the size of the register $|N\rangle_N$ is n, then the size of the register $|x\rangle_x$ should be $2n$ to make MODULAR_EXPONENTIATION circuit usable in Shor's algorithm. As one can see from the last picture, going to $2n = 6$ qubits in $|x\rangle_x$ for this particular case requires just additional 3 wires for $|x\rangle$ and additional 3 blocks of [Ctrl_MULT_MOD - SWAPs - inverse Ctrl_MULT_MOD].

+

Regarding your question about changes which occur when we go from $11^x \mod{15}$ to $7^x \mod{21}$: for $N=15$ we need 4 bits to encode this number, so the current architecture requires 8 or less qubits for the register $x$, 4 qubits for the register $z$, 4 qubits for the register $a$, 4+1 qubits for the register $b$, 4 qubits for the register $c$, 4 qubits for the register $N$ and 1 qubit for control $t$. If we use $N=21$, then it will be 10 or less qubits for the register $x$, 5 qubits for the register $z$, 5 qubits for the register $a$, 5+1 qubits for the register $b$, 5 qubits for the register $c$, 5 qubits for the register $N$ and 1 qubit for control $t$. So one can see that number of qubits grows as $O(n)$, which is acceptable according to the original paper

+",13812,,13812,,11/24/2020 1:18,11/24/2020 1:18,,,,0,,,,CC BY-SA 4.0 +14774,1,14875,,11/22/2020 1:40,,2,66,"

Consider a circuit acting on $n\geq2p+1$ qubits. The first $p$ qubits encode some unknown state $|\psi\rangle$. Next $p$ qubits encode a fixed given basis state $|\phi\rangle=|\ldots f_2f_1f_0\rangle$. The $(2p+1)$th qubit is initialized in the $|0\rangle$ state. Using the standard set of gates, how can I check if $|\psi\rangle$ is equal to $|\phi\rangle$ and put the result of this comparison into the $2p+1$th qubit? (I wrote "$\geq$" in case we need ancillas).

+

I guess, the implementation has to do something with the SWAP test, but I don't want to do any measurements. Feels like my question is purely on classical logic, and there's nothing quantum about it.

+

Please note that my question is NOT about comparing two arbitrary states. One state is a known state from the computational basis.

+",6313,,6313,,11/27/2020 20:32,11/28/2020 7:20,Check if $|\psi\rangle$ is equal to a fixed basis state using the standard set of gates,,2,0,,,,CC BY-SA 4.0 +14775,2,,14774,11/22/2020 3:14,,1,,"

Yes, SWAP can be used, this paper gives a quantum mechanical method in it's supplementary to test the fidelity between a known state and an unknown state using two Hadamard gate and a controlled-SWAP operation(a measurement on the single-qubit control is needed, and it is acquired to do several times, say 10**3 times).

+

There are two metrics to compare the similarity between two quantum states, trace distance $D(p_x,q_x)=\frac{1}{2}\displaystyle\sum_x|p_x-q_x|$ where ps and qs are probility distribution, and fidelity $F(\rho,\sigma)=tr\sqrt{\rho^{1/2}\sigma\rho^{1/2}}$ where $\sigma$ and $\rho$ are density matrices, see Nielson's book for more detail.

+

Once you get the probability distribution of the density matrix you can use trace distance or fidelity to compare the similarity between two quantum states, but to get the two data, repeated measurements are required(or say quantum state tomography to get the density matrix), since we can not know a thing which is quantum(so we have to convert it to classical many many times, i.e. frequent measurements).

+",13647,,,,,11/22/2020 3:14,,,,1,,,,CC BY-SA 4.0 +14776,1,14780,,11/22/2020 3:22,,4,141,"

From my understanding, a qubit is entangled when the state of one qubit depends on the other, and vice versa. Can the following bell states have probability amplitudes other than 1/2 and still be entangled?:

+

$ |\Phi^\pm\rangle = \frac{1}{\sqrt{2}} (|0\rangle_A \otimes |0\rangle_B \pm |1\rangle_A \otimes |1\rangle_B) $

+

${\displaystyle +|\Psi ^{\pm }\rangle ={\frac {1}{\sqrt {2}}}(|0\rangle _{A}\otimes |1\rangle _{B}\pm |1\rangle _{A}\otimes |0\rangle _{B})} +$

+

For example, is it possible to have bell pairs with probability amplitudes that are not $ \dfrac{1}{\sqrt{2}}$, but rather something like this: $|\Psi\rangle = \frac{\sqrt{3}}{2} (|00 \rangle + \frac{1}{2} |11\rangle)$

+",13081,,55,,11/23/2020 19:40,1/27/2021 18:53,Can the following Bell states have probability amplitudes other than 1/2 and still be entangled?,,2,0,,,,CC BY-SA 4.0 +14777,2,,14776,11/22/2020 4:39,,1,,"

They won't be Bell-pairs though(by definition). Because Bell-pairs are maximally entangled. Meaning, if you take a partial trace over one of the subsystems, the resulting state must have maximum entropy. Which, with unequal amplitudes, would not be possible.

+

But they can be entangled. Assuming that you wanted a state like: $|\Psi\rangle = \frac{\sqrt{3}}{2} |00\rangle + \frac{1}{2} |11\rangle$, it is indeed entangled. You can look up Peres-Horodecki criterion to detect the presence of entanglement in smaller dimensions. The amplitudes do not have to be equal, the only thing that matters is that there is no way to write it as a product of two states.

+

The state that you have mentioned at the end, $|\Psi\rangle$, is not a valid quantum state. The squared sum of amplitudes must be 1.

+",2403,,2403,,11/22/2020 4:45,11/22/2020 4:45,,,,1,,,,CC BY-SA 4.0 +14778,2,,6728,11/22/2020 4:51,,0,,"

The formula should be:

+

$$ +\langle h |( \mathbb{I} \otimes |1\rangle\langle1| \otimes \mathbb{I}\otimes \mathbb{I}\otimes \mathbb{I})|h\rangle. +$$ +Now, you can use python or numpy to build the measurement operator in the middle and calculate the above inner product to find the probability of the second qubit being 1.

+",2403,,,,,11/22/2020 4:51,,,,0,,,,CC BY-SA 4.0 +14779,1,,,11/22/2020 5:29,,-1,87,"

How can I perform an operation similar to Numpy.exp() in qiskit?

+",13399,,5955,,11/23/2020 13:21,11/23/2020 13:21,How to calculate the exponential of all elements in an input array using qiskit?,,1,9,,11/29/2020 15:04,,CC BY-SA 4.0 +14780,2,,14776,11/22/2020 5:39,,1,,"

Absolutely.

+

Given an arbitrary two-qubit state $|\psi \rangle $, it is NOT entangled if we can write $|\psi \rangle $ as: +$$ |\psi \rangle = |a\rangle \otimes |b\rangle \hspace{.75 cm} \textrm{where} \ \ |a\rangle, |b \rangle \in \mathbb{C}^2 $$

+

Thus, there are many entangled states! Essentially, if you pick a random two-qubit pure state, it is most likely to be an entangled state. Now, not all entangled state are equal. Some are more entangled than other. For example, Bell states are maximal entangled state, but a state like $|\psi \rangle = \dfrac{\sqrt{3}}{2}|00\rangle + \dfrac{1}{2}|11\rangle $ is less entangled than the Bell states. In fact, we can quantify this using the concept of "Concurrence" which is directly related to the concept of "Entanglement of Formation" (Here is the original paper on these concepts).

+

For the Bell state $|\psi_{Bell} \rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}} $, the Concurrence measurement is $1$, which is the same for entanglement of formation.

+

For another state, say the one you interested in, $|\phi \rangle = \dfrac{\sqrt{3}}{2}|00\rangle + \dfrac{1}{2}|11\rangle $, you can work out the Concurrence measurement value for this state to be $\dfrac{3}{4}$ which is less than $1$. Thus, one would say that this state is less entangled than the Bell state $|\psi_{Bell} \rangle$.

+",9858,,10480,,1/27/2021 18:53,1/27/2021 18:53,,,,1,,,,CC BY-SA 4.0 +14781,2,,14779,11/22/2020 5:45,,3,,"

Just import numpy and use it as usual. For example:

+
import numpy as np
+array = [1, 2 , 3]
+exp_array = np.exp(array)
+print('expoential of array:', exp_array)
+
+

The output is:

+
expoential of array: [ 2.71828183  7.3890561  20.08553692]
+
+",9858,,,,,11/22/2020 5:45,,,,0,,,,CC BY-SA 4.0 +14782,2,,14771,11/22/2020 13:07,,5,,"

Since the classical algorithm samples "uniformly and independently $𝑘$ times from the search space", equation $(5)$ should be, $P(X_i=1, X_j=1)= P(X_i=1)P(X_j=1)=\frac{M^2}{N^2}$ instead. If you substitute $(5)$ with this, you would arrive at the book's standard deviation.

+",7460,,,,,11/22/2020 13:07,,,,0,,,,CC BY-SA 4.0 +14783,2,,14763,11/22/2020 13:35,,5,,"

In the following, I'll show the evaluation of the probability densities of the transition probabilities: $|\langle \psi | z\rangle^2$ and their pairwise independence. I didn't work out the full mutual independence.

+

The $n$-qubit pure states span the complex projective space $CP^{N-1}$ with $N=2^n$. Pure $n$-qubit states can be parametrized almost everywhere as: +$$|\psi(\mathbf{\zeta}, \mathbf{\bar{\zeta}})\rangle = \frac{[1, \zeta _1,.,.,., \zeta _{N-1}]^t}{\sqrt{1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta} }}$$ +(The states which cannot be parametrized as above consist of a lower dimensional subspace, thus they correspond to zero probability and they do not contribute to the probabilistic calculations)

+

The Haar volume element of $CP^{N-1}$ is given by: +$$d{\mu}_{CP^{N-1}}(\mathbf{\zeta}, \mathbf{\bar{\zeta}}) = \frac{(N-1)!}{\pi^{N-1}}\frac{\prod_{k=1}^{N-1} d\zeta_k d\bar{\zeta}_k}{(1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta})^N}$$

+

It is normalized to a unit total volume. +$$\int_{CP^{N-1}} d{\mu}_{CP^{N-1}}(\mathbf{\zeta}, \mathbf{\bar{\zeta})} = 1$$

+

In the scalar product $\langle z_k|\psi(\mathbf{\zeta}, \mathbf{\bar{\zeta}})\rangle $ only one term $\zeta_k$ survives. It is exactly at the index $k$ whose binary representation contains ones in the places where the string $z_k$ has ones and zeros where the string $z_k$ has zeros.

+

Thus, we get the following expression for the transition squared amplitude (for an arbitrary $z$): +$$\alpha = |\langle z_k|\psi(\mathbf{\zeta}, \mathbf{\bar{\zeta}})\rangle|^2 = \frac{\bar{\zeta_k} \zeta_k }{(1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta})^N}$$

+

Thus, the probability density of $\alpha$ is given by: +$$ f_{\alpha}(\alpha) = \int_{CP^{N-1}} \delta\left(\alpha - \frac{\bar{\zeta_k} \zeta_k }{(1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta})}\right) \, d{\mu}_{CP^{N-1}} $$

+

Where $\delta$ is the Dirac delta function. +Defining: +$$x = \sum_{j\ne k} \bar{\zeta_j} \zeta_j$$ +and +$$u_k = \bar{\zeta_k} \zeta_k $$ +and in addition, expressing the integration elements over $\bar{\zeta_k}$ and $\zeta_k$ in polar coordinates: +$$ d\zeta_k d\bar{\zeta}_k = \frac{1}{2} du_k d\theta_k$$ +We obtain: +$$ f_{\alpha}(\alpha) = \frac{(N-1)!}{\pi^{N-1}}\int_{CP^{N-1}} \delta\left(\alpha - \frac{u_k }{(1+x)(1+\frac{u_k}{(1+x))})}\right) \, \frac{1}{2} du_k d{\theta_k} \frac{\prod_{j\ne k} d\zeta_j d\bar{\zeta}_j}{(1+x)^N(1+\frac{u_k}{(1+x))}))^N}$$ +Performing another change of variables: +$$v_k = \frac{u_k}{1+x}$$ +We obtain: +$$f_{\alpha}(\alpha) = \frac{(N-1)!}{\pi^{N-1}}\int_{CP^{N-1}} \delta\left(\alpha - \frac{v_k }{(1+v_k)}\right) \, \frac{1}{2} dv_k d{\theta_k} \frac{\prod_{j\ne k} d\zeta_j d\bar{\zeta}_j}{(1+x)^{N-1}(1+v_k)^N}$$ +Using the properties of the Dirac delta function: +$$\delta\left(\alpha - \frac{v_k }{(1+v_k)}\right) = (1+v_k) \delta\left(v_k- \frac{\alpha }{(1-\alpha)}\right) $$ +Substituting into the integral (and performing the trivial integral over $\theta_k$: $\int d{\theta_k} = 2\pi$, we obtain:

+

$$f_{\alpha}(\alpha) = (N-1) (1-\alpha)^{N-3} \frac{(N-2)!}{\pi^{N-2}}\int_{CP^{N-2}} \frac{\prod_{j\ne k} d\zeta_j d\bar{\zeta}_j}{(1+\sum_{j\ne k} \bar{\zeta_j} \zeta_j)^{N-1}}$$ +The integral with its pre-factor is just the normalized volume element of $CP^{N-2}$. i.e., equal to $1$. +Thus +$$f_{\alpha}(\alpha) = (N-1) (1-\alpha)^{N-3}$$ +In the limit $N\rightarrow \infty$ +$$f_{\alpha}(\alpha) \approx N (1-\alpha)^N = N \left(1-\frac{N\alpha}{N}\right)^N \approx N e^{-N\alpha} = 2^n e^{-2^n\alpha}$$

+

Pairwise independence

+

For $l\ne k$: +$$\beta = |\langle z_l|\psi(\mathbf{\zeta}, \mathbf{\bar{\zeta}})\rangle|^2 = \frac{\bar{\zeta_l} \zeta_l }{(1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta})^N}$$ +The joint probability density: +$$ f_{\alpha, \beta}(\alpha, \beta) = \int_{CP^{N-1}} \delta\left(\alpha - \frac{\bar{\zeta_k} \zeta_k }{(1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta})}\right) \delta\left(\beta - \frac{\bar{\zeta_l} \zeta_l }{(1+\mathbf{\zeta}^{\dagger} \mathbf{\zeta})}\right) \, d{\mu}_{CP^{N-1}} $$

+

Pursuing the same method as above, separation of the coordinates $\zeta_k$, $\zeta_l$ from the other coordinates and defining:

+

$$x = \sum_{j\ne k,l} \bar{\zeta_j} \zeta_j,$$ +then performing the necessary changes of variables and the polar angular trivial integrations, we arrive at:

+

$$f_{\alpha, \beta}(\alpha, \beta) = \frac{(N-1)!}{\pi^{N-1}}\int_{CP^{N-1}} \delta\left(\alpha - \frac{v_k }{(1+v_k+v_l)}\right) \delta\left(\beta - \frac{v_l }{(1+v_k+v_l)}\right) \, \frac{1}{4} dv_k d{\theta_k} dv_l d{\theta_l} \frac{\prod_{j\ne k} d\zeta_j d\bar{\zeta}_j}{(1+x)^{N-2}(1+v_k+v_l)^N}$$

+

Again, using the transformation properties of the delta functions:

+

$$\delta\left(\alpha - \frac{v_k }{(1+v_k+v_l)}\right) \delta\left(\beta - \frac{v_l }{(1+v_k+v_l)}\right)= (1+v_k+v_l)^3\delta\left(v_k- \frac{\alpha }{(1-\alpha - \beta)}\right) \delta\left(v_l- \frac{\beta }{(1-\alpha - \beta)}\right)$$ +and after the substitution, we have +$$dv_k dv_l = \frac{d\alpha d\beta}{(1-\alpha - \beta)^3 }$$ +Thus, we are left with: +$$f_{\alpha, \beta}(\alpha, \beta) = (N-1)(N-2) (1-\alpha-\beta)^{N-6} \frac{(N-3)!}{\pi^{N-3}}\int_{CP^{N-3}} \frac{\prod_{j\ne k, l} d\zeta_j d\bar{\zeta}_j}{(1+\sum_{j\ne k,l} \bar{\zeta_j} \zeta_j)^{N-2}}$$ +Again, the integral with its pre-factor is just the normalized volume element of $CP^{N-3}$. +Thus, we are left with: +$$f_{\alpha, \beta}(\alpha, \beta) = (N-1)(N-2) (1-\alpha-\beta)^{N-6}$$ +In the limit $N\rightarrow \infty$ +$$ f_{\alpha, \beta}(\alpha, \beta) \approx N^2 \left(1-\alpha- \beta\right)^N = N^2 \left(1-\frac{N(\alpha+\beta)}{N}\right)^N \approx N^2 e^{-N(\alpha+\beta)}= 2^n e^{-2^n\alpha} 2^n e^{-2^n\beta} \approx f_{\alpha}(\alpha) f_{\beta}(\beta) $$

+

Thus, the random variables are pairwise independent.

+

Without the large $N$ approximation, the joint distribution function is not equal to the product of the individual distributions.

+",4263,,4263,,11/23/2020 8:04,11/23/2020 8:04,,,,0,,,,CC BY-SA 4.0 +14785,1,15080,,11/22/2020 16:06,,1,138,"

Suppose I have three different operators $U_1, U_2,U_3$. Now, these three operators will be applied if my current state of the system is $|\psi_0\rangle,|\psi_1\rangle $ and $|\psi_2\rangle$ respectively.

+

Now suppose I started with some initial state $|\psi_{initial}\rangle$ and after applying two unitary operations it will be converted to one of the states above and on the basis of that the respective unitary operator needs to applied.

+

I know we can't measure the state as it will collapse the system. So, what method can be applied here?

+",13517,,55,,11/27/2020 19:09,12/10/2020 9:26,How to apply a operator to qubit system on the basis of current state of system?,,1,3,,,,CC BY-SA 4.0 +14786,1,,,11/22/2020 19:03,,2,765,"

When calculating the probability of getting +1 on X-basis on the first qubit of Bell's state $|01\rangle+|10\rangle$, the result is 1/2 with the state after measurement |++⟩ while the probability of measuring the second qubit with the collapse state is 1 and the state after measurement also $|++\rangle$.

+

When calculating the probability of getting +1 on Z-basis on the first qubit of Bell's state $|01\rangle+|10\rangle$, the result is 1/2 with the state after measurement |01⟩ while the probability of measuring the second qubit with the collapse state is 0 and the state after measurement also $|01\rangle$.

+

What is other possible result of measuring X and Z, for example, XX, XZ, ZX, ZZ ?

+

How to build a table to compile all of the possible results?

+",13823,,55,,11/27/2020 19:09,2/12/2021 22:05,What are the possible results of measuring $X$ and $Z$ on the state $|01\rangle+|10\rangle$?,,2,0,,,,CC BY-SA 4.0 +14787,1,14791,,11/22/2020 19:05,,2,88,"

In this example implementation of Grovers Algorithm from the Qiskit Textbook which solves a $2\times 2$ sudoku puzzle:

+

https://qiskit.org/textbook/ch-algorithms/grover.html

+

The circuit iterates twice (see picture)

+

My question is:

+

How is the data in the $c_0 - c_3$ and out0 qubits utilised.

+

To me it looks like $c_0 - c_3$ and out are never fed back into the $v_0 - v_3$ qubits, and $v_0 - v_3$ are the only ones that are measured at the end.

+

I'm not sure if I've misinterpreted how entanglement works here, or how the CX gates work.

+

+",13909,,55,,11/27/2020 19:10,11/27/2020 19:10,How does feedback work in simple Grovers algorithm where $n=4$?,,1,0,,,,CC BY-SA 4.0 +14788,2,,14786,11/22/2020 19:30,,2,,"

Starting with the state $|\psi \rangle = \dfrac{|01\rangle + |10 \rangle }{\sqrt{2}} = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 1 \\ 1 \\ 0 \end{pmatrix} $.

+

If you want to find the probability of measuring $+1$ in observable $X = \begin{pmatrix} 0 & 1\\ 1 & 0 \end{pmatrix} $ for the first qubit, and $+1$ in the observable $Z = \begin{pmatrix} 1 & 0\\ 0 & -1 \end{pmatrix} $ for the second qubit then you can calculate it as $\langle \psi| M | \psi \rangle = Tr(\rho M)$ where $\rho = |\psi \rangle \langle \psi |$ and here $M = |+\rangle\langle +| \otimes |0\rangle\langle 0 |$ since $|+\rangle = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} $ is the eigenvector corresponding to the $+1$ eigenvalue of $X$ and $|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} $ is the eigenvector corresponding to the $+1$ eigenvalue of $Z$. So explicitly

+

\begin{align} M = |+\rangle \langle+| \otimes |0\rangle\langle 0| &= \bigg[ \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \end{pmatrix} \bigg] \otimes \bigg[ \begin{pmatrix} 1 \\ 0 \end{pmatrix} \begin{pmatrix} 1 & 0 \end{pmatrix} \bigg] \\ +&= \dfrac{1}{2} \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} \otimes \begin{pmatrix} 1 & 0 \\ 0 & 0\end{pmatrix} \\ +&= \dfrac{1}{2}\begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 0 & 0 & 0\\ 1 & 0 & 1 & 0\\ 0 & 0 & 0 & 0\end{pmatrix} +\end{align} +Thus, +$$\langle \psi| M | \psi \rangle = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 & 1 & 1 & 0 \end{pmatrix} \dfrac{1}{2}\begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 0 & 0 & 0\\ 1 & 0 & 1 & 0\\ 0 & 0 & 0 & 0\end{pmatrix} \dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 1 \\ 1 \\ 0 \end{pmatrix} = \dfrac{1}{4} $$

+

Also note that, the above is the same if we have done $Tr(\rho M)$ since +$$Tr\bigg( \rho M \bigg) = Tr\bigg( \begin{pmatrix} 0 & 0 & 0 & 0\\ 0 & 1/2 & 1/2 & 0\\ 0 & 1/2 & 1/2 & 0\\ 0 & 0 & 0 & 0 \end{pmatrix} \dfrac{1}{2}\begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 0 & 0 & 0\\ 1 & 0 & 1 & 0\\ 0 & 0 & 0 & 0\end{pmatrix} \bigg) = \dfrac{1}{4}$$

+
+

You can extend this to other cases as well.

+
+

Update:

+

If you want to do sequential measurement, then you can find the the post measurement state $|\psi\rangle_{post}$ then follow the same procedure.

+

For instance, if we again start with $|\psi \rangle = \dfrac{|01\rangle + |10 \rangle }{\sqrt{2}} = \dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 1 \\ 1 \\ 0 \end{pmatrix} $

+

and we want to find the probability of measuring $+1$ in observable $X = \begin{pmatrix} 0 & 1\\ 1 & 0 \end{pmatrix} $ for the first qubit. Then afterward, finding the probability of measuring $+1$ in observable $X $ for the first qubit, and $+1$ in the observable $Z = \begin{pmatrix} 1 & 0\\ 0 & -1 \end{pmatrix} $ for the second qubit on this collapsed state then we can do it as follow:

+

First Step: To find the probability of measuring $+1$ in observable $X $ we can construct $M $ as +\begin{align} M = |+\rangle \langle+| \otimes I = \bigg[ \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} \dfrac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \end{pmatrix} \bigg] \otimes \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} &= \dfrac{1}{2} \begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix} \otimes \begin{pmatrix} 1 & 0 \\ 0 & 1\end{pmatrix} \\ +&= \dfrac{1}{2}\begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\\ 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\end{pmatrix} +\end{align}

+

And therefore,

+

$$\langle \psi| M | \psi \rangle = \dfrac{1}{2} $$

+

and the state after measurement, $|\psi_{post}\rangle $, is going to be +\begin{align} +|\psi_{post}\rangle = \dfrac{ M |\psi \rangle }{ \sqrt{prob(+1)}} = \dfrac{ \dfrac{1}{2}\begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\\ 1 & 0 & 1 & 0\\ 0 & 1 & 0 & 1\end{pmatrix} \dfrac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 1 \\ 1 \\ 0 \end{pmatrix} }{ \sqrt{ 1/\sqrt{2} } } = \dfrac{1}{2} \begin{pmatrix} 1 \\ 1 \\ 1 \\ 1 \end{pmatrix} +\end{align}

+

Second Step: Now the probability of measuring $+1$ in observable $X $ for the first qubit, and $+1$ in the observable $Z $ for the second qubit on this collapsed state $|\psi_{post} \rangle$ can be calculated as $\langle \psi_{post} | M | \psi_{post} \rangle $ where again $M = |+\rangle\langle +| \otimes |0\rangle\langle 0 |$ (as indicated why on the top of this answer). Hence this probability is

+

$$ +\langle \psi_{post} | M | \psi_{post} \rangle = \dfrac{1}{2} \begin{pmatrix} 1 & 1 & 1 & 1 \end{pmatrix} \dfrac{1}{2}\begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 0 & 0 & 0\\ 1 & 0 & 1 & 0\\ 0 & 0 & 0 & 0\end{pmatrix} \dfrac{1}{2} \begin{pmatrix} 1 \\ 1 \\ 1 \\ 1 \end{pmatrix} = \dfrac{1}{2} +$$

+

Where the post state after this process, $|\psi_{post 2} \rangle$ is now in the state

+

$$ +|\psi_{post 2} \rangle = \dfrac{ \dfrac{1}{2}\begin{pmatrix} 1 & 0 & 1 & 0\\ 0 & 0 & 0 & 0\\ 1 & 0 & 1 & 0\\ 0 & 0 & 0 & 0\end{pmatrix} \dfrac{1}{2} \begin{pmatrix} 1 \\ 1 \\ 1 \\ 1 \end{pmatrix} }{ \sqrt{1/2} } = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 0 \\ 1 \\ 0 \end{pmatrix} = \dfrac{|00\rangle + |10\rangle }{\sqrt{2}} +$$

+",9858,,9858,,11/23/2020 20:15,11/23/2020 20:15,,,,6,,,,CC BY-SA 4.0 +14790,2,,14762,11/22/2020 21:13,,1,,"

I found a way to do it for the $2\to1$ QRAC. I simply guessed that we could leave the measurement bases as they are, $Z$ for the first bit, and $X$ for the second bit, and added $Y$ as the basis with which to extract the XOR of the two bits. From the guess obtaining the optimal encoding states is then easy, we just need to diagonalize the relevant operators. They are +\begin{align*} +|\psi_{00}\rangle & = \sqrt{p}|0\rangle + \sqrt{1-p}\ e^{\frac{\pi i}4}|1\rangle \\ +|\psi_{01}\rangle & = \sqrt{p}|0\rangle + \sqrt{1-p}\ e^{-\frac{3\pi i }4}|1\rangle \\ +|\psi_{10}\rangle & = \sqrt{1-p}|0\rangle + \sqrt{p}\ e^{-\frac{\pi i}4}|1\rangle \\ +|\psi_{11}\rangle & = \sqrt{1-p}|0\rangle + \sqrt{p}\ e^{\frac{3\pi i}4}|1\rangle, +\end{align*} +where $p=\frac{3+\sqrt3}{6}$ is also the probability of success in this QRAC. I don't know whether it is optimal, but I guess it is, since it's so nice and symmetrical.

+

Now for the $3\to1$ case such a simply idea cannot work, as you want to extract 7 different functions, but there are only these 3 mutually unbiased bases in dimension 2. What I would do is to find some set of 7 bases that is in some sense uniformly distributed on the Bloch sphere and see if it works. Another idea is to simply do a see-saw optimization and see what you get.

+",12541,,,,,11/22/2020 21:13,,,,1,,,,CC BY-SA 4.0 +14791,2,,14787,11/23/2020 0:59,,1,,"

The quantum register c can be regarded as ancilla. For the first part of each iteration(before the CCCC-NOT), each two cx compares if the state of the two qubits is identical, if not, one ancilla will be converted to the state $|1\rangle$. The CCCC-NOT checks whether the four ancillae are all $|1\rangle$, if so, a phase-flip operation is implemented.

+

The second part of each iteration(between CCCC-NOT and the diffusion unitary) converts the ancillae into its original state($|0000\rangle$, for reversibility). The action of diffusion unitary should be familiar to you.

+

Introduce ancilla into the quantum circuit will certainly increase the difficulty of classical simulation, but it may decrease the difficulty of designing an algorithm (sometimes it is impossible to achieve the goal without the ancilla).

+",13647,,,,,11/23/2020 0:59,,,,6,,,,CC BY-SA 4.0 +14793,1,,,11/23/2020 6:02,,3,208,"

I'm reading about surface code theory recently (Phys. Rev. A 86, 032324). When I come across the magic state distillation part, it is difficult for me to understand the circuits. In addition, I have read Bravyi and Kitaev's paper about magic state distillation(Phys. Rev. A 71, 022316). But when back to the circuits below, I still can not figure out the process how it work. + +

+",11562,,55,,11/25/2020 9:04,11/25/2020 9:04,How to understand the circuits used for magic state distillation in surface code?,,1,0,,,,CC BY-SA 4.0 +14796,1,,,11/23/2020 19:46,,2,53,"

There are numerous questions that asks about practical application demonstration of the Grover algorithm for arrays and databases.

+

However examples are not seen anywhere.

+

While searching for its practicality, I came across with study Is Quantum Search Practical which states that creation of the oracle is a hardware level aspect (section 4 - Oracle implementation).

+

Can I get please get some support in clarifying this?

+",9759,,55,,11/25/2020 9:05,11/25/2020 9:05,Is Grovers Algorithm Oracle creation a hardware level aspect?,,1,3,,,,CC BY-SA 4.0 +14797,2,,14796,11/23/2020 19:55,,5,,"

Typically the oracle is a reversible circuit that implements some classical pass/fail check. In order to query the circuit under superposition, it has to be run on a quantum computer instead of a classical computer. That's all the authors mean when they say quantum hardware is required.

+",119,,,,,11/23/2020 19:55,,,,2,,,,CC BY-SA 4.0 +14798,1,,,11/23/2020 21:08,,3,141,"

Suppose we have the normalised states $|\phi_{1}\rangle,|\phi_{2}\rangle \in A \otimes B$ where $A$ and $B$ are $d$-dimensional complex vector spaces.

+

Suppose $|\langle\phi_{2}|\phi_{1}\rangle| < 1$.

+

Can we say what is the upper bound of $\| \mathrm{Tr}_{B} (|\phi_{1}\rangle\langle\phi_{2}| )\|_{1}$?

+",11616,,55,,11/25/2020 9:06,11/25/2020 9:06,How can we upper bound the norm of a partial trace?,,1,2,,,,CC BY-SA 4.0 +14799,2,,13592,11/23/2020 21:13,,1,,"

$T_1$ and $T_2$ are two measurement of decoherence on a qubit.

+

$T_1$ is known as the "relaxation time" or "longitudinal coherence time" or "amplitude damping".... It measures the loss of energy from the system. You can calibrate/measure/determine the $T_1$ time by first initialize the qubit in the $|0\rangle$ then apply the $X$ gate, where $X = \begin{pmatrix} 0 & 1\\ 1 & 0 \end{pmatrix} = |0\rangle\langle 1| + |1\rangle \langle 0|$ and wait for certain amount of time and measure the probability of the state being in the $|1\rangle$ eigenstate.

+

$T_2$ is known as the "dephasing time" or "transverse coherence time" or "phase coherence time" or "phase damping" ... and $T_2$ can be determined by again initialize the qubit in the state $|0\rangle$ then apply the Hadamard gate $H = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1\\ 1 & -1 \end{pmatrix}$ to the inital qubit state $|0\rangle$. We will also wait for some time, $t$, and then apply another Hadamard gate, then measure the probability of the qubit being in the state $|0\rangle$. Here, as you can see, if we have no decoherence then the qubit will ended up back to the state $|0\rangle$ with 100% probability, as $HH|0\rangle = |0\rangle$. But of course this is not the case with qubit, the longer the wait time, the closer this probability will get to $1/2$ as the qubit will go/dephase from the state $\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$ to $|0\rangle$ or $|1\rangle$ before the second Hadamard gate. Which will then put the qubit back in the superposition state.

+",9858,,,,,11/23/2020 21:13,,,,0,,,,CC BY-SA 4.0 +14800,2,,14798,11/23/2020 21:29,,6,,"

The $1$-norm decreases under partial trace and so we have an upper bound of $1$ when the states are normalized, +$$ +\|\mathrm{Tr}_B[|\psi_1\rangle \langle \psi_2|]\|_1 \leq \||\psi_1\rangle \langle \psi_2|\|_1 = 1. +$$

+

This bound cannot be improved upon without extra information about the states. Here is a counterexample. Take $|\psi_1 \rangle = |00\rangle$ and $|\psi_2 \rangle = |10\rangle$. Then we have $\langle \psi_1 |\psi_2\rangle = 0$. Moreover we have, +$$ +\|\mathrm{Tr}_B[|\psi_1\rangle \langle \psi_2|]\|_1 = \||0 \rangle \langle 1|\|_1 = 1. +$$

+",9854,,,,,11/23/2020 21:29,,,,0,,,,CC BY-SA 4.0 +14801,1,,,11/23/2020 21:56,,2,301,"

There will be a certain value of getting the probability when measuring any Bell's state with Pauli operators such as observable X, Y, or Z. What is the meaning behind all this measurement? the result of the measurement will show or prove what? Are they any theory or explanation behind all the measurements?

+",13823,,55,,11/25/2020 9:07,12/24/2020 1:50,What is the meaning of measuring a Bell state with Pauli operators?,,1,3,,,,CC BY-SA 4.0 +14802,2,,14801,11/24/2020 0:14,,1,,"

Postulates of Quantum Mechanics:

+
    +
  1. The state of quantum mechanical system, including all the information you can know about it. It is represented by a normalized ket $|\psi\rangle$
  2. +
  3. A physical observable is represented mathematically by an operator $A$ that acts on kets.
  4. +
  5. The only possible result of a measurement of an observable is one of the eigenvalues $\lambda_n$ of the corresponding operator $A$.
  6. +
  7. The probability of obtaining the eigenvalue $\lambda_n$ in a measurement of the observable $A$ on the system in the state $|\psi \rangle$ is $|\langle \lambda_n | \psi \rangle|^2 $ where $|a_n\rangle$ is the normalized eigenvector of $A$ corresponding to the eigenvalue $a_n$.
  8. +
  9. After measurement of $A$ that yields the result of $a_n$, the quantum system is in a new state that is normalized projection of the original system ket onto the ket (or kets) corresponding to the result of the measurement: +$$|\psi_{post} \rangle = \dfrac{P_n |\psi \rangle}{ \sqrt{ \langle \psi | P_n | \psi \rangle} } $$
  10. +
  11. (for completemess, I will add this postulate here as well) The time evolution of a quantum system is determined by the Hamiltonian or total energy operator $H(t)$ through the Schrodinger equation +$$ i\hbar \dfrac{d}{dt} |\psi(t) \rangle = H(t)|\psi(t) \rangle $$
  12. +
+

The postulates of quantum mechanics dictates how one treat a quantum mechanical system mathematically and how to interpret the mathematics to learn about the physical system in question. These postulate cannot be proven, but hey have successfully tested by many experiments, and so we accept them as an accurate way to describe quantum mechanical systems.

+
+

Reference: Quantum Mechanics by David H. McIntyre.

+",9858,,9858,,12/24/2020 1:50,12/24/2020 1:50,,,,0,,,,CC BY-SA 4.0 +14803,1,,,11/24/2020 3:47,,2,384,"

So how can I verify that the Pauli Group is a Group? Then furthermore, Abelian? And then to sum it up, the order of the group. Trying to do some research into the group but I can't find much about it.

+",13921,,55,,11/25/2020 9:09,11/25/2020 9:09,How can I verify that the Pauli group is a group? And is it abelian?,,1,6,,11/29/2020 15:00,,CC BY-SA 4.0 +14804,1,,,11/24/2020 4:54,,-2,91,"

Multiplication of two arrays in quantum computing.

+",13922,,,,,11/24/2020 5:50,"How can I multiply two arrays like [1,2,3] and [4,5,6] in quantum computing aspects?",,1,2,,11/29/2020 15:01,,CC BY-SA 4.0 +14805,2,,14804,11/24/2020 5:50,,1,,"

If you are asking how to multiply two arrays $u = [1,2,3]$ and $v = [4,5,6]$ in Qiskit setting then you can do this as would normally do... by import numpy.

+
import numpy as np
+u = [1,2,3]
+v = [4,5,6]
+product_uv = np.multiply(u,v)
+
+
+

If that is not what you are asking for... but rather on how the quantum processor multiply two arrays, then think about about how a classical processor multiply two arrays... and make all those operations reversible...

+

Quantum computers are not meant to replace classical computers. They are meant to solve certain hard problems that classical computers can't efficiently (at least we haven't figure out a way to do it yet)... but we are not even there yet.

+

If you want to learn more about quantum computing, I suggest the Qiskit Textbook, and Prof. John Preskill's Lecture note or this textbook.

+",9858,,,,,11/24/2020 5:50,,,,5,,,,CC BY-SA 4.0 +14806,2,,14803,11/24/2020 7:07,,3,,"

For the three Pauli matrices, {${\sigma_1,\sigma_2}=0$}, so certainly this can not form an abelian group. The Pauli group is an isomorphism with $D_4$.

+

The elements of the Pauli group are {${I, \sigma_x, \sigma_y, i\sigma_z, -I, -\sigma_x, -\sigma_y, -i\sigma_z}$}, so the order of this group is 8. In variant subgroups are {${I, -I}$}, {${I, -I, \sigma_{x/y}, -\sigma_{x/y}}$} and {${I, -I, i\sigma_z, -i\sigma_z}$}. $I$ and $-I$ is the only emelemt in its class. {$\pm\sigma_{x/y}$} and {$\pm i\sigma_z$} forms a class( totally 5 classes). +Order 1 element: $I$. Order 2 elements: $\sigma_x, \sigma_2, -I, -\sigma_x, -\sigma_y$. And Order 3 elements: $\pm i\sigma_z$.

+

To check that the upper set actually forms a group, you need to prove that the set satisfies the four properties of a group: closure, associativity, identity element, inverse element, see Wikipedia for more detail.

+

Here comes the group table of the Pauli group.

+

+

You can also see Wikipedia and check it is identical to the group table of $D_4$(in fact the tables are different because the ordering of elements is different).

+",13647,,13647,,11/24/2020 8:22,11/24/2020 8:22,,,,2,,,,CC BY-SA 4.0 +14807,1,14808,,11/24/2020 7:31,,2,482,"

Is it possible for me to construct a gate that inverse everything ($|0\rangle \rightarrow -|0\rangle, |1\rangle \rightarrow -|1\rangle$, etc. basically like a $-I$ gate) from the basic $X, Y, Z, CX,...$ gates, for any number of qubits? How do I do so if it's possible?

+

Thank you!

+",7598,,,,,11/24/2020 11:10,How do I create an inverse identity gate?,,2,0,,,,CC BY-SA 4.0 +14808,2,,14807,11/24/2020 7:44,,8,,"

As a general rule, you wouldn't bother constructing this: it is just a global phase that has no observable consequence.

+

If you really insist on doing this, introduce an ancilla qubit in the $|1\rangle$ state and apply a $Z$ gate to it.

+

PS "inverse identity gate" is a really bad name for it. The identity operation is its own inverse.

+",1837,,,,,11/24/2020 7:44,,,,2,,,,CC BY-SA 4.0 +14809,2,,14793,11/24/2020 8:24,,3,,"

The key property these circuits have to satisfy is that, if there is a small number of Z or X errors next to the key gate (the T gate or the S gate in this case), the measurements that you perform will detect those errors. Additionally, they have to have the property that in the noiseless case they output the state you want. Put those two together, and you have a distillation circuit.

+

The 15-to-1 T state distillation circuit is an example circuit in Quirk. You can confirm there that the circuit meets both properties. It outputs a T state by default, and if you put Z errors next to the T gates, the post-selection present in the circuit filters out cases with at most two errors.

+",119,,,,,11/24/2020 8:24,,,,0,,,,CC BY-SA 4.0 +14810,2,,14807,11/24/2020 11:10,,4,,"

You might be interested in controlled version of $-I$. Despite the fact that you can neglect global phase in case of non-controlled gates, you cannot do so in case of controlled version.

+

The controled gate $-I$ is described by matrix +\begin{pmatrix} +1 & 0 & 0 & 0\\ +0 & 1 & 0 & 0\\ +0 & 0 & -1 & 0\\ +0 & 0 & 0 & -1\\ +\end{pmatrix}.

+

This gate set a phase to $\pi$ (note that $\mathrm{e}^{i\pi} = -1$) if control qubit is in state $|1\rangle$.

+

To implement the gate simply put $Z$ gate on first qubit (i.e. control qubit) and nothing (i.e. identity operator) on second qubit (i.e. target qubit). You can check that the matrix above is really equal to $Z \otimes I$ and hence the proposed construction really implements the requested gate.

+",9006,,,,,11/24/2020 11:10,,,,0,,,,CC BY-SA 4.0 +14811,1,14812,,11/24/2020 14:25,,-1,75,"

Can we create a Controlled gate with below functionality?

+

if {a==|1> && b==|1>} then {qc.x(b)}

+

Basically, a CCX gate but the output Qubit is actually one of the input Qubits. Apparently, In ccx/mct repetition isn't allowed!

+

Please do let me know. TIA!

+",13749,,55,,11/24/2020 18:57,11/24/2020 18:57,"How to create a gate with functionality CCX(a,b,b)?",,1,0,,,,CC BY-SA 4.0 +14812,2,,14811,11/24/2020 15:13,,2,,"

No, you can't do that. It wouldn't be reversible. It sends both a=1,b=1 and a=1,b=0 to a=1,b=0.

+",119,,,,,11/24/2020 15:13,,,,0,,,,CC BY-SA 4.0 +14813,1,,,11/24/2020 19:07,,1,195,"

Let us write the possible states of a qubit in the Bloch representation as +$$\newcommand{\bs}[1]{{\boldsymbol{#1}}}\rho_{\bs r}\equiv \frac{I+\bs r\cdot\bs \sigma}{2},$$ +where $\bs\sigma=(\sigma_1,\sigma_2,\sigma_3)$ are the Pauli matrices. +I can then represent $\rho_{\bs r}$ as the vector +$$\rho_{\bs r}\doteq \frac12\begin{pmatrix}1 \\ \bs r\end{pmatrix}.$$ +In this representation, I can represent a linear operator acting on $2\times 2$ matrices, $\mathcal E\in\mathrm{Lin}(\mathrm{Lin}( \mathbb C^2))$, as a matrix +$$\mathcal E\doteq \begin{pmatrix}1 & \bs 0^T \\ \bs t & \Delta\end{pmatrix},$$ +where $\Delta\in\mathrm{Lin}(\mathbb C^2)$ and $\bs t\in\mathbb R^2$. +This form of $\mathcal E$ automatically preserves the normalisation. +The action of $\mathcal E$ on $\rho_{\bs r}$ can then be written as +$$\mathcal E(\rho_{\bs r}) = \rho_{\Delta\bs r + \bs t}.$$ +Is there a good way to see how the CPTP constraint on $\mathcal E$ translates into constraints on $\bs t$ and $\Delta$ in this representation?

+

Clearly, for $\mathcal E(\rho)$ to still be a state we need $\|\Delta \bs r+\bs t\|\le 1$. Is this the only requirement?

+",55,,,,,11/25/2020 0:12,How does the CPTP constraint reflect on the matrix representation of a qubit channel in the Pauli basis?,,1,0,,,,CC BY-SA 4.0 +14814,1,,,11/24/2020 19:17,,-1,45,"

I've successfully used IBM Q Experience for quite a while now. But the interface seems to have changed. After I run a simulation on my quantum circuit, I go to Results but I don't see the answer in the form of a histogram like I used to. Where is it?

+",13928,,,,,11/24/2020 19:35,Where are my Results?,,1,0,,,,CC BY-SA 4.0 +14815,2,,14814,11/24/2020 19:35,,2,,"

With out seeing what you see, I can't say much. How many qubits were you using? If you use ibmq_16_melbourne and measure all the qubit then you don't expect to see the histogram plot, and you shouldn't since there are $2^{15} = 32768$ eigenbasis.... I believe in those cases, you can download the generated cvs file.

+
+

However, to see if the histogram plot still shows up on small enough problem (something of 5 qubit or less) I ran a quick test on my account on using the following circuit:

+

+

and when I go to my Result tab on IBMQ Experience, I clicked on the result for this run and still see the histogram plot:

+

+",9858,,,,,11/24/2020 19:35,,,,0,,,,CC BY-SA 4.0 +14816,1,14822,,11/24/2020 21:30,,5,285,"

In chapter 9 of Scott Aaronson's book Quantum Computing Since Democritus (see online progenitor lecture notes here), he introduces a strange (to me) conceptualization of applying two Hadamard-like operations to a qbit, summed up in this diagram:

+

+

I had the opportunity to ask him about this and he made three interesting statements:

+
    +
  1. This is called the "Feynman" or "sum-over-paths" picture of quantum mechanics
  2. +
  3. This picture is interesting because it reveals the effect of destructive interference
  4. +
  5. If a QC is simulated using the sum-over-paths method, it takes exponential time instead of space
  6. +
+

How does the sum-over-paths picture work conceptually for quantum computation? For example, given a series of quantum logic gates applied to some qbits, how would I calculate the resulting amplitude values of those qbits using the sum-over-paths method? If this is too complicated to explain in an answer on this site, are there any good introductions to this topic elsewhere?

+

Also, do any of the main quantum languages/frameworks include a sum-over-paths simulator?

+",4153,,4153,,11/25/2020 13:38,11/26/2020 14:04,"What is the ""sum-over-paths"" picture of quantum computing?",,2,2,,,,CC BY-SA 4.0 +14817,1,14830,,11/24/2020 21:39,,2,147,"

In multiple sources, e.g. RGK, KGR, it is stated (without proof) that if you take any two qubit state and send it through a depolarizing channel, the resulting state would be a Bell-diagonal state. I understand that a bipartite Bell-diagonal state $\rho_{AB}$ has the form:

+

$$ +\rho_{AB} = \lambda_1 |\Psi^+\rangle\langle \Psi^+| + \lambda_2 |\Psi^-\rangle\langle \Psi^-| +\lambda_3 |\Phi^+\rangle\langle \Phi^+| +\lambda_4 |\Phi^-\rangle\langle \Phi^-|, +$$ +where $|\Psi^+\rangle, |\Psi^-\rangle, |\Phi^+\rangle, |\Phi^-\rangle$ are the usual Bell states. +The action of a depolarizing channel $\mathcal{E}$ on two qubits is defined as:

+

$$ +\mathcal{E}(\rho_{AB}) = \sum_i (E_i \otimes E_i) \rho_{AB} (E_i \otimes E_i)^\dagger, +$$ +where $E_i \in \{\mathbb{I}, \sigma_x, \sigma_y, \sigma_z\}$ are the Pauli operators. +However, I don't see why ANY bipartite density operator would be transformed into a Bell-diagonal state. Is there any proof of this claim?

+",2403,,,,,11/25/2020 8:17,Two qubit state + Depolarizing channel = Bell diagonal state?,,1,0,,,,CC BY-SA 4.0 +14818,1,14819,,11/24/2020 21:50,,2,91,"

The question is basically the title but given a unitary operator $U$ and a computational basis, can we say anything about the complex number below?

+

$$c = \sum_{i}\langle i \vert U \vert j\rangle$$

+

I expected that it would be $|c| = 1$ but this does not seem to generally hold.

+",13931,,55,,11/26/2020 11:27,11/26/2020 11:27,What is $\sum_{i}\langle i \vert U \vert j\rangle$ for unitary $U$?,,2,2,,,,CC BY-SA 4.0 +14819,2,,14818,11/24/2020 22:13,,2,,"

Welcome to the quantum computing stack exchange.

+

If you view $\sum_{i} \langle i |$ as a (non-properly normalized) (bra) state $\sqrt{d}\langle \psi |$, where $|\psi\rangle = \frac{1}{\sqrt{d}}\sum_{x \in \{0,1\}^{n}}|x\rangle$, the quantity $c$ becomes just the inner product of $\sqrt{d}\langle \psi |U|j\rangle$. Here, $d =2^{n}$ is the proper normalization constant.

+

Without imposing any other constraints on $U$, $U|j\rangle$ just becomes some random state $|\phi\rangle$. Thus, $c = \sqrt{d}\langle \psi|\phi\rangle$ and the only thing we can conclude is:

+

$$ +0 \leq |c| \leq \sqrt{d} +$$

+",8141,,8141,,11/25/2020 16:09,11/25/2020 16:09,,,,7,,,,CC BY-SA 4.0 +14820,1,14823,,11/24/2020 22:40,,2,501,"

I want to simulate the final state of an ansatz in cirq using simulate. +Now I want to calculate the expectation value of a Hamiltonian.

+

How do I do this? I can only find simulator.run examples in cirq. But I want to access the wavefunction and therefore would need simulator.simulate.

+

Is there a function in cirq I can use or how could I do this?

+",13353,,55,,11/26/2020 11:27,12/26/2020 12:05,Cirq.simulate expectation value of a Hamiltonian,,1,0,,,,CC BY-SA 4.0 +14821,2,,14813,11/24/2020 23:19,,2,,"

This representation of $\mathcal{E}$ is also known as the Pauli transfer matrix or PTM; see this document by Greenbaum for a brief introduction.

+

As stated in section $2.3.2$ of that document, the TP constraint is automatically met by having the top row be $(1,0\ldots 0)$. This is because trace preservation dictates that for $\rho_{\boldsymbol{r}}$ we have $\mathrm{tr}(\mathcal{E}(\rho_{\boldsymbol{r}})) = \mathrm{tr}(\rho_{\boldsymbol{r}})$. By linearity of the trace it must thus also hold for $\boldsymbol{e}_{i}$ for $i \in \{0,1,2,3\}$, which are just the Paulis $\boldsymbol{\sigma}$ in the space where the PTM acts upon. Since they are traceless, TP gives $\mathrm{tr}(\mathcal{E}(\boldsymbol{e}_{i})) = \mathrm{tr}(\boldsymbol{e}_{i}) = d\delta_{0i}$, which is evidently only true if $\mathcal{E}^{PTM}_{0,i} = \delta_{0i}$.

+

As also stated in the section $2.3.2$, the CP constraint doesn't work as nicely. The constraint $||\Delta\boldsymbol{r} + \boldsymbol{t}||\leq 1$ actually also permits positive (but not-completely positive) maps. The classical example of the transpose gives: +$$ +\boldsymbol{\Delta}=\begin{bmatrix}1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 &0 & 1 +\end{bmatrix}, \boldsymbol{t}= \boldsymbol{0} +$$ +for which $||\Delta\boldsymbol{r} + \boldsymbol{t}|| \leq 1$ obviously holds.

+

I would rephrase the channel into some other representation for which the CP constraint does work nicely. However, matters are made worse because, for instance, conversion between the PTM and $\chi$-representation is not always trivial (See section $2.1.3$ of the document).

+",8141,,8141,,11/25/2020 0:12,11/25/2020 0:12,,,,0,,,,CC BY-SA 4.0 +14822,2,,14816,11/24/2020 23:33,,5,,"

Initially perhaps it is best to compare and contrast a couple of different approaches to simulating the output of a random quantum circuit $U$ of about $m=1000$ gates acting on, say, $n=53$ qubits initialized to $\vert 0^{53}\rangle$, as in Sycamore. Suppose we execute our circuit $U$ on the $53$ qubits of Sycamore, and we sample to get an output string $b\in\{0,1\}^{53}$. We wish to determine the probability of getting an output $b$, e.g. determine $\Vert\langle b\vert U\vert 0^{53}\rangle\Vert^2$

+
    +
  1. In a first "Schrödinger" approach, we can store all $2^{53}$ amplitudes in memory, and update each amplitude based on the $m=1000$ gates, one for each step. This requires memory on the order of $2^n$ (e.g. a lookup table for each amplitude), but time on the order of $m 2^n$ (just keep updating the wavefunction for each gate), followed by a quick look-up of the amplitude/probability for $b$.
  2. +
  3. In a second "Feynman" approach, one instead puts primacy on the actual output $b$ that is sampled, and performs the sum-over-paths calculations to determine the corresponding probability of obtaining $b$. Because only the measured output string $b$ is stored, memory usage is much improved to about $m+n$, but time takes roughly $4^m$ (doubling for each branch).
  4. +
  5. One can combine the two approaches as considered by Aaronson and Chen - into what they termed the "Schrödinger-Feynman" hybrid algorithm, that uses $\mathrm{poly}(m,n)$ space and $m^{O(n)}$ time.
  6. +
+

Given a decision problem, we can put the output of the decision into a register $b\in\{0,1\}$; say $b=0$ if the decision is NO but $b=1$ if the decision is YES. If we have a quantum circuit to determine $b$, we can see that we can run a Schrödinger algorithm or a Feynman algorithm to determine whether $b=1$.

+

There are some implications for complexity classes of Feynman's path integral approach that I am not versed in, but I think Aaronson is fond of saying something like "Feynman won his Nobel by proving $\mathrm{BQP}\subseteq\mathrm{P}^\mathrm{\#P}$", well before $\mathrm{BQP}$ was even defined.

+",2927,,2927,,11/25/2020 0:22,11/25/2020 0:22,,,,0,,,,CC BY-SA 4.0 +14823,2,,14820,11/25/2020 0:32,,3,,"

You can get the wavefunction from cirq.final_state_vector(circuit). Then you can define your observable as an instance of cirq.PauliSum, on which you will be able to use the expectation_from_state_vector() method to get the expectation value.

+",4986,,4986,,11/25/2020 1:37,11/25/2020 1:37,,,,5,,,,CC BY-SA 4.0 +14824,1,,,11/25/2020 3:24,,0,223,"

I have been trying to execute the quantum circuit in the backend of the IBM 16 qubit Melbourne machine. I end up getting

+
IBMQBackendApiError: 'Error submitting job: "HTTPSConnectionPool(): Max retries exceeded with url: **** SignedHeaders= ** Signature= ****(Caused by SSLError(SSLError(1, \'[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1108)\')))
+
+

but when I check my IBMQ account the status of the job is Creating. I do not understand why I get such an error. Can someone help to identify what exactly the issue is?

+",9778,,5955,,11/27/2020 15:55,12/3/2020 14:38,Error while trying to execute the Quantum Circuits in IBMQ,,1,2,,,,CC BY-SA 4.0 +14825,1,14829,,11/25/2020 3:29,,2,149,"

I am now studying QEC and feel confused. If I have a density matrix before the correction:

+

The circuit is:

+

$\rho = p^0(1-p)^3|\varphi\rangle \langle\varphi|+p^1(1-p)^2\sum_{i=1}^3X_i|\varphi\rangle \langle\varphi|X_i+p^2(1-p)\sum_{i=1}^3(X_3 X_2 X_1)X_i|\varphi\rangle \langle\varphi|X_i(X_1 X_2 X_3)+p^3(X_3 X_2 X_1)|\varphi\rangle \langle\varphi|(X_1 X_2 X_3)$

+

My answer is: +$\rho = p^0(1-p)^3|\varphi\rangle \langle\varphi|+3p^1(1-p)^2|\varphi\rangle \langle\varphi|+3p^2(1-p)|\varphi\rangle \langle\varphi|+p^3|\varphi\rangle \langle\varphi|$

+

After the circuit works, what is the probability to find the logical qubit in the state $|ψ\rangle$ and why the system is not in the state $|ψ\rangle = α|000\rangle + β |111\rangle$ with probability 1 after the error correction procedure of random bit flips? It makes me confused.

+

Hope someone can help me with my problems.

+

By the way, Nielsen's book has little examples for a newbie to learn, where could I find more exercises and examples?

+

Sorry about the pictures, I just draw this quick picture by my hand.

+",,user13341,2403,,11/26/2020 2:52,11/26/2020 2:52,Question about quantum error correction and density matrixs,,1,0,,,,CC BY-SA 4.0 +14826,2,,14818,11/25/2020 4:05,,1,,"

You know that the columns of a unitary matrix are orthonormal: https://math.stackexchange.com/questions/1688950/why-do-the-columns-of-a-unitary-matrix-form-an-orthonormal-basis. This means that the squares of the elements in each column should add up to 1, but that doesn't mean the sum of the elements in each column (what you have above) will add up to a value of magnitude 1.

+

For example, you could have +$$H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix},$$ +which is clearly unitary.

+

The squared elements of the first half column add up to $\frac{1}{2}+\frac{1}{2}=1$ as do the squared elements of the second column. +However, the elements of the first column itself add up to $\frac{1}{\sqrt{2}}+ \frac{1}{\sqrt{2}} = \frac{2}{\sqrt{2}}$ while the elements of the second column add up to $\frac{1}{\sqrt{2}} - \frac{1}{\sqrt{2}} = 0.$

+",13752,,,,,11/25/2020 4:05,,,,2,,,,CC BY-SA 4.0 +14829,2,,14825,11/25/2020 7:51,,1,,"

The error correcting code that you are using is the 3-qubit majority vote. In other words:

+
    +
  • If 0 or 1 $X$ errors occur, error correction returns the original state $|\psi\rangle$
  • +
  • If 2 or 3 $X$ errors occur, error correction returns the bit-flipped state $XXX|\psi\rangle$ ($XXX|\psi\rangle$ is a valid state, so error correction should never change it, and a pair of $X$ errors are equivalent to a single error on $XXX|\psi\rangle$)
  • +
+

Hence, the state that you get after error is (sort of) +$$ +\rho=(1-p)^2(1+2p)|\psi\rangle\langle\psi|+p^2(3-2p)XXX|\psi\rangle\langle\psi|XXX. +$$ +Why do I say "sort of"? Strictly, you have measured the two ancilla qubits. You know what measurement result you got. For example, if you got the 00 answer, you know that all qubits were the same. Hence, you either had the $(1-p)^3|\psi\rangle\langle\psi|$ case or the $p^3XXX|\psi\rangle\langle\psi|XXX$. Hence, your density matrix in this case should be +$$ +\rho_{00}=\frac{(1-p)^3|\psi\rangle\langle\psi|+p^3XXX|\psi\rangle\langle\psi|XXX}{(1-p)^3+p^3} +$$ +If the measurement results were anything else, you're choosing between a one-error case and a two-error case. Hence +\begin{align} +\rho_{xy}&=\frac{(1-p)^2p|\psi\rangle\langle\psi|+p^2(1-p)XXX|\psi\rangle\langle\psi|XXX}{(1-p)^2p+p^2(1-p)} \\ +&=(1-p)|\psi\rangle\langle\psi|+pXXX|\psi\rangle\langle\psi|XXX +\end{align}

+",1837,,1837,,11/25/2020 14:57,11/25/2020 14:57,,,,5,,,,CC BY-SA 4.0 +14830,2,,14817,11/25/2020 8:17,,2,,"

Firstly, note that every Bell state $|\psi_{ij}\rangle=(|0i\rangle+(-1)^j|1\bar i\rangle)/\sqrt{2}$ is an eigenstate of $E_i\otimes E_i$ for all $i$ (the eigenvalues are either $\pm 1$). Hence, a Bell-diagonal state remains Bell-diagonal under the action of the map. This already suggests that a Bell-diagonal state is likely to be the ultimate destination of the map, but let us prove that.

+

Consider an arbitrary state $|\Psi\rangle$. This can be decomposed in the Bell basis, +$$ +|\Psi\rangle=\sum_{i,j}a_{ij}|\psi_{ij}\rangle. +$$ +We have $XX|\psi_{i1}\rangle=-|\psi_{i,1}\rangle$ and $XX|\psi_{i0}\rangle=|\psi_{i,0}\rangle$. So, for example, if I calculate +$$ +|\Psi\rangle\langle\Psi|+XX|\Psi\rangle\langle\Psi|XX, +$$ +then this knocks out any cross terms such as $|\psi_{i0}\rangle\langle\psi_{j1}|$

+

Similarly, $ZZ|\psi_{0i}\rangle=|\psi_{0,i}\rangle$ and $ZZ|\psi_{1i}\rangle=-|\psi_{1i}\rangle$, so terms such as $|\psi_{0i}\rangle\langle\psi_{1j}|$ will also be knocked out. Ultimately, the only terms that are left are $|\psi_{ij}\rangle\langle\psi_{ij}|$, i.e. the state is Bell diagonal.

+

Strictly, to put all this together carefully, you want to say +$$ +\rho_x=\rho+XX\rho XX +$$ +and +$$ +\mathcal{E}(\rho)=\rho_x+ZZ\rho_xZZ +$$ +two see how the two separate steps that I've made fit together.

+",1837,,,,,11/25/2020 8:17,,,,4,,,,CC BY-SA 4.0 +14831,1,14844,,11/25/2020 9:30,,0,74,"

I'm stumped by these questions in Chuang's book.

+

If I have a state $|ψ\rangle=1/2\sqrt2(1+M_0)(1+M_1)(1+M_2)|0\rangle_7$, where +$$M_0=X_0X_4X_5X_6; M_1=X_1X_3X_5X_6; M_2=X_2X_3X_4X_6$$

+

I rewrite its superposition expression without operators on the computational basis:

+

$$|ψ\rangle=1/2^5[(|0000000\rangle+|1111111\rangle)+(|1000111\rangle+|0111000\rangle)+(|0101011\rangle+|1010100\rangle)+(|0011101\rangle+|1100010\rangle)+(|1101100\rangle+|0010011\rangle)+(|1011010\rangle+|0100101\rangle)+(|0110110\rangle+|1001001\rangle)+(|1110001\rangle+|0001110\rangle)] $$

+

I am not sure if it is right. Hope you guys can give me some suggestions.

+

Also, I am not sure $X$ or $Z$ operations are fault-tolerant. I learned from Chuang's book that a complete set of gates consisting of $H$-gate, phase-gate, C-NOT, and $T$ gates can be constructed using fault-tolerant procedures. In my opinion, $X$ is not fault-tolerant and $Z$ is fault-tolerant, since $Z$ is one of the phase gates.

+

Am I wrong? Hope someone can help me with my problems!

+

Thank you

+",13938,,55,,11/26/2020 11:30,11/29/2020 1:11,Pauli Matrix tolerant and encoding,,1,4,,,,CC BY-SA 4.0 +14833,1,,,11/25/2020 13:32,,2,227,"

I am working now on a quantum neural network project and want a deep explanation on the Repeat Until Success circuit. What I know about this circuit is that it allows a nonlinear activation function to be applied by rotating around the $\hat y$ axis by an angle $\theta$. But I don't understand till now how this circuit works? Can someone help me to clarify how it works?

+

Thank you

+",13940,,55,,11/26/2020 11:35,4/20/2021 10:52,"What is a ""repeat until success quantum circuit"" in quantum neural networks?",,1,2,,,,CC BY-SA 4.0 +14834,1,14838,,11/25/2020 13:51,,4,123,"

In QAOA 1, why do we pick the initial Hamiltonian $B$ to be $\sigma_x$ applied to each qubit? Would it be possible to pick $B$ to be an application of $\sigma_z$'s instead? Then $C$ and $B$ would be both diagonal in the Z-basis. What is preventing us from taking this choice for $B$? +Thanks in advance!

+",12047,,55,,11/26/2020 11:36,11/26/2020 11:36,"In QAOA, why do we pick the initial Hamiltonian $B$ to be $\sigma_x$ applied to each qubit?",,1,0,,,,CC BY-SA 4.0 +14835,1,14841,,11/25/2020 14:17,,3,203,"

If I from qiskit.quantum_info import random_unitary and then random_unitary(2**number_of_qubits) What returns is a unitary matrix with dimension $(2^{number\_of\_qubits},2^{number\_of\_qubits})$, and if I stimulating the unitary operation on a classical computer it is matrix computation.

+

Here comes my question: what quantum computers do to implement this random unitary?

+

From the universality of quantum gate set, we know that an arbitrary single-qubit operation can be decomposed into the set of $\{H, S, T\}$ or $\hat U=\hat\Phi(\delta)\hat R_z(\alpha)\hat R_y(\theta)\hat R_z(\beta)$ where $\hat \Phi(\delta)=\begin{pmatrix}e^{i\delta}&0\\0&e^{i\delta}\end{pmatrix}$, $\hat R_z(\alpha)=\begin{pmatrix}e^{i\alpha/2}&0\\0&e^{-i\alpha/2}\end{pmatrix}$ and $\hat R_y(\theta)=\begin{pmatrix}cos\frac{\theta}{2}&sin\frac{\theta}{2}\\-sin\frac{\theta}{2}&cos\frac{\theta}{2}\end{pmatrix}$.

+

But when considering physical realizations, we need to consider the problem of finite precision and so on. Then, which method will the quantum computers adopt? And more generally, what if we introduce CNOT here to form the universal quantum gate set for an arbitrary number of qubits?

+

Even a great reference paper or detailed qiskit documentation can be helpful (in fact to make my work rigorous this is essential). I appreciate you in advance.

+",13647,,55,,5/18/2021 8:03,5/18/2021 8:03,How do quantum computers implement a random unitary gate?,,1,4,,,,CC BY-SA 4.0 +14836,2,,14824,11/25/2020 14:36,,1,,"

Update: This is caused by safebrowse.io blocking the url and sending back a http response (which the client interpreted as a TLS version it didn't understand). Unfortunately safebrowse.io doesn't allow whitelisting a single url, so you'll need to disable it entirely. Here’s a link on how to do it: https://howtoremove.guide/safebrowse-io-virus/#:~:text=What%20is%20Safebrowse.io%3F,compromise%20their%20system%20and%20privacy

+
+

A handful of people reported the same issue on Qiskit Slack. This appears to be an IBM Cloud (which IBM Quantum Experience runs on) issue and is still being investigated by them. Unfortunately the only workarounds are

+
    +
  1. use a VPN or
  2. +
  3. use a different network or
  4. +
  5. submit your jobs through IBM Quantum Experiment Quantum Lab (jupyter notebook)
  6. +
+",12195,,12195,,12/3/2020 14:38,12/3/2020 14:38,,,,1,,,,CC BY-SA 4.0 +14837,1,,,11/25/2020 16:21,,3,66,"

Consider a state $\rho$ and two observables $P$ and $Q$.

+

Is there a good way to characterise how correlated the associated expectation values are? Be it in terms of mutual information or something else.

+

As an example, if $\rho$ is a qubit and $P_i=|i\rangle\!\langle i|$ projectors onto the computational basis states, then we know that $P_0$ and $P_1$ are fully correlated, as $\langle P_1\rangle = 1- \langle P_0\rangle$. Knowing one tells the value of the other. +On the other hand of the spectrum, if $P_+\equiv |+\rangle\!\langle +|$, then knowledge of $\langle P_0\rangle$ imposes the bound +$$\frac12 - \sqrt{\langle P_0\rangle(1-\langle P_0\rangle)} \le \langle P_+\rangle \le \frac12 + \sqrt{\langle P_0\rangle(1-\langle P_0\rangle)}.$$ +This can be seen starting from writing $\rho=\frac12(I+\sum_k c_k \sigma_k)$, observing that $\langle P_0\rangle = (1+c_z)/2$, $\langle P_+\rangle = (1+c_x)/2$, and $c_z^2+c_x^2\le1$, and thus concluding that $|c_x|\le \sqrt{1-c_z^2}$ with $c_z=2\langle P_0\rangle-1$. +Thus, in the case of $P_+$, we have a continuous freedom compatible with an observed value of $\langle P_0\rangle$, albeit with constrained bounds.

+

Can similar characterisations be made in the general case of an arbitrary pair of observables $P$ and $Q$? +To be more precise, I'm asking, given $\alpha=\langle P\rangle$, what is +$$\{\langle Q\rangle_\rho\equiv \mathrm{Tr}(\rho Q) : \rho\in\mathrm D(\mathcal X)\text{ such that } \langle P\rangle_\rho=\alpha\},$$ +where $\mathrm D(\mathcal X)$ is the set of all states in the relevant Hilbert space $\mathcal X$.

+",55,,55,,11/26/2020 12:32,11/26/2020 12:32,Can we characterise how correlated the expectation values associated with a pair of observables are?,,0,4,,,,CC BY-SA 4.0 +14838,2,,14834,11/25/2020 17:35,,5,,"

We don't really need $B = \sum \sigma_j^x$ in our QAOA algorithm. As long as you pick it in such a way that it doesn't commute with $C$. One of the reason is if they are commute, then they share a common eigenvector. Then if you run into this type of situation, you will never get out, and you will be stuck in this state. You can think of $U(\beta, B)$ as a driver, it helps to navigate the Ansatze from getting stuck.

+

In term of the reason why $B = \sum \sigma_j^x$ in the first place is because QAOA is sort of a discretization of Quantum Annealing so that is why we see that the Ansatze of QAOA takes the form: $U = e^{-i\beta_p B}e^{-i \gamma_p C} \cdots e^{-i\beta_1 B} e^{-i \gamma_1 C} = \prod_{i} e^{-i\beta_i B} e^{-i \gamma_i C} $ which is a trotter approximation of the time evolution in the quantum annealing.

+",9858,,,,,11/25/2020 17:35,,,,2,,,,CC BY-SA 4.0 +14841,2,,14835,11/25/2020 20:08,,3,,"

In terms of decomposing an arbitrary unitary matrix on n-qubit system, this paper "Quantum Circuits for Isometries" might be a helpful guide. As well as this paper: "Introduction to UniversalQCompiler" which is implemented in the UniversalQCompiler package for Mathematica.

+

And how to implement single qubit and CNOT gates on hardware, i guess a good place to look at is the Qiskit documentation on Openpulse.

+",9858,,,,,11/25/2020 20:08,,,,1,,,,CC BY-SA 4.0 +14842,1,14854,,11/25/2020 20:57,,3,107,"

I am very new to the theory of the Choi representation of quantum processes and I am learning it all by myself from research papers (especially this https://arxiv.org/abs/1111.6950) as I didn't find any quantum info book describing it. I was wondering if given two Choi operators $\Lambda_1$, $\Lambda_2$, it was possible to construct a new Choi operator $\Lambda$ as a convex linear combination of the two. i.e. $\Lambda = (1-a)\Lambda_1 + a \Lambda_2$ as one would do with the states $(1-a)\rho_1 + a \rho_2$. If it is possible to what process $\Lambda$ would correspond?

+",13945,,,,,11/26/2020 18:12,Does it make sense to sum two Choi operators?,,2,1,,,,CC BY-SA 4.0 +14843,2,,14842,11/25/2020 22:34,,2,,"

Any quantum channel, which of course has a Choi-representation, has a Kraus operator representation too. Meaning, any action of a channel can be described by a set of Kraus Operators.

+

Let $\Lambda_1$ and $\Lambda_2$ be described as (on some density operator $\rho$):

+

$$ +\Lambda_1 (\rho) = \sum_i E_i \rho E_i^\dagger, \\\Lambda_2 (\rho) = \sum_j F_j \rho F_j^\dagger. +$$

+

Then, you can see that a convex combination of these two channels would be another channel with action as:

+

$$ +\Lambda(\rho) = (1 - a) \Lambda_1(\rho) + a \Lambda_2(\rho) = (1 - a) \sum_i E_i \rho E_i^\dagger + a\sum_j F_j \rho F_j^\dagger +$$

+",2403,,,,,11/25/2020 22:34,,,,3,,,,CC BY-SA 4.0 +14844,2,,14831,11/25/2020 23:44,,1,,"

The state that you should obtain is a superposition of all possible products of ($I$ and) $M_{0},M_{1}$ and $M_{2}$ acting on $|0\rangle_{7}$. That is:

+

\begin{equation} +\begin{split} +III |0\rangle_{7}&= |0\rangle_{7} \\ +M_{0}II|0\rangle_{7} = X_{0}X_{4}X_{5}X_{6}|0\rangle_{7} &= |1000111\rangle \\ +IM_{1}I|0\rangle_{7} = X_{1}X_{3}X_{5}X_{6}|0\rangle_{7} &= |0101011\rangle \\ +IIM_{2}|0\rangle_{7} = X_{2}X_{3}X_{4}X_{6}|0\rangle_{7} &= |0011101\rangle \\ +M_{0}M_{1}I|0\rangle_{7} = X_{0}X_{1}X_{3}X_{4}|0\rangle_{7} &= |1101100\rangle \\ +M_{0}IM_{2}|0\rangle_{7} = X_{0}X_{2}X_{3}X_{5}|0\rangle_{7} &= |1011010\rangle \\ +IM_{1}M_{2}|0\rangle_{7} = X_{1}X_{2}X_{4}X_{5}|0\rangle_{7} &= |0110110\rangle \\ +M_{0}M_{1}M_{2}|0\rangle_{7} = X_{0}X_{1}X_{2}X_{6}|0\rangle_{7} &= |1110001\rangle \\ +\end{split} +\end{equation}

+

You just sum up these terms (including the proper normalization factor of $\sqrt{8}=2\sqrt{2}$ of course) and that's the state that you get.

+

Then, fault-tolerance only makes sense in the scope of QEC's and the logical operations you perform on encoded logical states. A single qubit-operation is not fault-tolerant nor 'not fault-tolerant' - the definition doesn't really apply to it (or, at least, it doesn't really make sense to think about it).

+

Saying that the $X$ gate is not and the $Z$ gate is fault-tolerant is a statement that therefore doesn't ring very nicely - maybe you can explain your thinking more, especially with what you think fault-tolerance is?

+",8141,,8141,,11/25/2020 23:50,11/25/2020 23:50,,,,1,,,,CC BY-SA 4.0 +14845,1,14848,,11/26/2020 1:30,,4,161,"
    +
  1. Consider two multipartite states $\rho_{A_1A_2..A_L}$ and $\sigma_{A_1A_2..A_L}$ in $\mathcal{H}_{A_1} \otimes\mathcal{H}_{A_2} \otimes...\mathcal{H}_{A_L} $. For an arbitrary permutation $\pi$ over $\{ 1, \ldots ,L\}$, is it true that
  2. +
+

$$ +\lVert \rho_{A_1A_2..A_L} - \sigma_{A_1A_2..A_L} \lVert_1 = \lVert \rho_{A_{\pi(1)}A_{\pi(2)}..A_{\pi(L)}} - \sigma_{A_{\pi(1)}A_{\pi(2)}..A_{\pi(L)}} \lVert_1? +$$

+
    +
  1. If 1. is not true, is the following true: +If $\rho_{A_1A_2..A_LB}$ and $\sigma_{A_1A_2..A_LB}$ are two calssical-quantum states in $\mathcal{H}_{A_1} \otimes\mathcal{H}_{A_2} \otimes...\mathcal{H}_{A_L} \otimes \mathcal{H}_{B}$, i.e., one can write $\rho_{A_1A_2..A_LB} = \sum_{a_1} \ldots \sum_{a_L} p(a_1,a_2,\ldots,a_L) |a_1\rangle \langle a_1| \otimes \ldots \otimes |a_L\rangle \langle a_L| \otimes \rho_B^{a_1,\ldots,a_L}$, then +$$ +\lVert \rho_{A_1A_2..A_LB} - \sigma_{A_1A_2..A_LB} \lVert_1 = \lVert \rho_{A_{\pi(1)}A_{\pi(2)}... B...A_{\pi(L)}} - \sigma_{A_{\pi(1)}A_{\pi(2)}... B...A_{\pi(L)}} \lVert_1, +$$ +where the position of the subscript $B$ is arbitrary on the righthand side.
  2. +
+",13709,,55,,11/26/2020 17:58,11/26/2020 17:58,Is the trace distance between multipartite states invariant under permutations?,,2,1,,,,CC BY-SA 4.0 +14847,2,,14816,11/26/2020 2:26,,5,,"

Expanding on Mark S's answer with some math:

+

Let's take Aaronson's example, where you are applying the following unitary $U$ twice to a qbit initialized to $|0\rangle$:

+

$$ +U = +\begin{bmatrix} +\frac{1}{\sqrt{2}} & \frac{-1}{\sqrt{2}} \\ +\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ +\end{bmatrix} +$$

+

The conventional (Schrödinger) picture would represent this computation as follows:

+

$$ +UU|0\rangle = +\begin{bmatrix} +\frac{1}{\sqrt{2}} & \frac{-1}{\sqrt{2}} \\ +\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ +\end{bmatrix} +\begin{bmatrix} +\frac{1}{\sqrt{2}} & \frac{-1}{\sqrt{2}} \\ +\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ +\end{bmatrix} +\begin{bmatrix} +1 \\ 0 +\end{bmatrix} = +\begin{bmatrix} +\frac{1}{\sqrt{2}} & \frac{-1}{\sqrt{2}} \\ +\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ +\end{bmatrix} +\begin{bmatrix} +\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} +\end{bmatrix} = +\begin{bmatrix} +0 \\ 1 +\end{bmatrix} = +|1\rangle +$$

+

Suppose you didn't care about the value of the entire state vector, but rather just the value of a single amplitude. Could you calculate this amplitude without keeping the entire $2^n$-sized state vector around in memory? Turns out yes, you can, with the the Feynman (or sum-over-paths) picture. Consider the following equation:

+

$$ +|x\rangle = U_m \ldots U_1|\psi\rangle +$$

+

How do we calculate the value of the final amplitude $i$, $|x\rangle[i]$? It's a simple recursive algorithm. Let's define the recursive function $f(|\psi\rangle, U, i)$, which returns the value of amplitude $i$ after the (1-qbit (2x2) or 2-qbit (4x4)) unitary operations in $U$ are applied to initial state $|\psi\rangle$:

+
    +
  1. Base case: $U = [\ ]$, return $|\psi\rangle[i]$
  2. +
  3. General case: $U = [U_m, \ldots, U_{1}]$, $U_m$ is a 1-qbit 2x2 matrix: in the $i$th row of the full matrix $M = \mathbb{I}_2 \otimes \ldots \otimes U_m \otimes \ldots \otimes \mathbb{I_2}$ (which would be multiplied against the state vector) there will be at most two nonzero entries at some indices $a$ and $b$; this means we need the amplitudes at index $a$ and $b$ for the state prior to $U_m$ being applied, so return: +$$ +M[i,a]\cdot f(|\psi\rangle, Tail(U), a) + M[i,b] \cdot f(|\psi\rangle, Tail(U), b) +$$
  4. +
  5. General case: $U = [U_m, \ldots, U_{1}]$, $U_m$ is a 2-qbit 4x4 matrix: in the $i$th row of the full matrix $M = \mathbb{I}_2 \otimes \ldots \otimes U_m \otimes \ldots \otimes \mathbb{I_2}$ (which would be multiplied against the state vector) there will be at most four nonzero entries at some indices $a$, $b$, $c$, and $d$; this means we need the amplitudes at index $a$, $b$, $c$, and $d$ for the state prior to $U_m$ being applied, so return: +$$ +M[i,a]\cdot f(|\psi\rangle, Tail(U), a) + M[i,b] \cdot f(|\psi\rangle, Tail(U), b) + M[i,c] \cdot f(|\psi\rangle, Tail(U), c) + M[i,d] \cdot f(|\psi\rangle, Tail(U), d) +$$
  6. +
+

For our example above, this looks as follows; calculating the value of $f(|0\rangle, [U, U], 2)$ (aka the final amplitude for state $|1\rangle$):

+

$$ +f(|0\rangle, [U, U], 2) = U[2,1] f(|0\rangle, [U], 1) + U[2,2] f(|0\rangle, [U], 2) +$$ +$$ +f(|0\rangle, [U, U], 2) = \frac{1}{\sqrt{2}} f(|0\rangle, [U], 1) + \frac{1}{\sqrt{2}} f(|0\rangle, [U], 2) +$$ +$$ +f(|0\rangle, [U, U], 2) = \frac{1}{\sqrt{2}} \left( \frac{1}{\sqrt{2}} f(|0\rangle, [\ ], 1) + \frac{-1}{\sqrt{2}} f(|0\rangle, [\ ], 2) \right) + \frac{1}{\sqrt{2}} f(|0\rangle, [U], 2) +$$ +$$ +f(|0\rangle, [U, U], 2) = \frac{1}{\sqrt{2}} \left( \frac{1}{\sqrt{2}} \cdot 1 + \frac{-1}{\sqrt{2}} \cdot 0 \right) + \frac{1}{\sqrt{2}} f(|0\rangle, [U], 2) +$$ +$$ +f(|0\rangle, [U, U], 2) = \frac{1}{2}+ \frac{1}{\sqrt{2}} \left( \frac{1}{\sqrt{2}} f(|0\rangle, [\ ], 1) + \frac{1}{\sqrt{2}} f(|0\rangle, [\ ], 2) \right) +$$ +$$ +f(|0\rangle, [U, U], 2) = \frac{1}{2}+ \frac{1}{\sqrt{2}} \left( \frac{1}{\sqrt{2}} \cdot 1 + \frac{1}{\sqrt{2}} \cdot 0 \right) +$$ +$$ +f(|0\rangle, [U, U], 2) = 1 +$$

+

Given $m$ unitary operations on $n$ qbits, this will clearly take $O(4^m)$ time if every operation is a two-qbit 4x4 matrix, since it will lead to four additional recursive calls at every level. It will take at least $O(m)$ space, since the recursive call stack will grow to length proportional to $m$ (other sources say $O(m + n)$ but I'm not sure where the $n$ term comes in).

+

It's somewhat unclear how you could efficiently determine the indices of amplitudes affected by the operator at each recursive level, but I'm sure if I thought about it hard enough there'd be some obvious trick. I'll also have to think some more about how this recursive algorithm relates to the branching diagram up above.

+",4153,,4153,,11/26/2020 14:04,11/26/2020 14:04,,,,0,,,,CC BY-SA 4.0 +14848,2,,14845,11/26/2020 8:35,,6,,"

A permutation of the qubits is a unitary operation. The trace distance is invariant under unitaries (https://en.wikipedia.org/wiki/Trace_distance#Properties). Thus, statement 1 is true.

+",1837,,,,,11/26/2020 8:35,,,,0,,,,CC BY-SA 4.0 +14849,2,,14845,11/26/2020 12:12,,5,,"

I'd like to add a small addition to the answer of @DaftWullie about why you would expect this operationally to be true -- without knowing permutations correspond to unitary matrices.

+

It boils down to the Holevo-Helstrom Theorem (HHT) that says the trace distance between two states characterizes operationally the probability that we can distinguish the two states. Suppose some referee has two multipartite states and places each of their subsystems in different boxes. We are then given a collection of boxes $A_1, \dots, A_n$ which we are told contain the parts of either the state $\rho$ or the state $\sigma$ with $50\%$ probability of each. Tasked with guessing whether we got $\rho$ or $\sigma$ we know by the HHT that our probability of guessing correctly using the optimal strategy is a function of +$$ +\lVert \rho_{A_1A_2..A_n} - \sigma_{A_1A_2..A_n} \lVert_1. +$$ +Moreover, from the perspective of a guessing game it is clear that our probability of guessing correctly shouldn't depend on which order we decide to arrange our boxes in the lab -- as part of the guessing protocol we could anyway rearrange the boxes to maximize the guessing probability. So for any permutation $\pi$ the probability of guessing correctly when we're given boxes $A_{\pi(1)},\dots,A_{\pi(n)}$ should be the same and hence, +$$ +\lVert \rho_{A_1A_2..A_n} - \sigma_{A_1A_2..A_n} \lVert_1 =_{\mathrm{operationally}} \lVert \rho_{A_{\pi(1)}A_{\pi(2)}..A_{\pi(n)}} - \sigma_{A_{\pi(1)}A_{\pi(2)}..A_{\pi(n)}} \lVert_1. +$$

+

Please note that this is in no way a proof and $=_{\mathrm{operationally}}$ is not a well-defined concept. This is merely some intuition to maybe complement the accepted answer. On reflection, thinking of the permutation as a rearranging the order of the boxes in the lab tells us that the permutation operation should be a unitary one -- we could always just reverse the arrangement if we please which should not affect the state.

+",9854,,9854,,11/26/2020 15:28,11/26/2020 15:28,,,,2,,,,CC BY-SA 4.0 +14850,1,,,11/26/2020 12:57,,0,84,"

I'm using Qiskit and after running the circuit, as we all know, we get a count dictionary such as

+
{'0000': 66,
+ '0001': 71,
+ '0010': 68,
+ '0011': 70,
+ '0100': 77,
+ '0101': 64,
+ '0110': 64,
+ '0111': 51,
+ '1000': 52,
+ '1001': 67,
+ '1010': 43,
+ '1011': 64,
+ '1100': 61,
+ '1101': 59,
+ '1110': 73,
+ '1111': 74} 
+
+

Here the minimum count is 1010:43. I want the same output just reversed [1024-(count)]. I know this can be achieved by few lines of python, but I was curious if this is possible to do with a quantum circuit?

+",12154,,55,,11/30/2020 11:53,11/30/2020 11:53,Quantum Circuit to inverse the probability distribution,,1,1,,,,CC BY-SA 4.0 +14851,1,14866,,11/26/2020 14:21,,4,326,"

I would like to obtain a list of all stabilizer states in the given dimension (not necessarily qubit systems). What is an efficient way of generating this list numerically?

+",13952,,13952,,11/27/2020 11:01,11/30/2020 12:19,How to generate all stabilizer states numerically?,,1,3,,,,CC BY-SA 4.0 +14852,1,14860,,11/26/2020 14:30,,3,128,"

When finding the best angles for QAOA we optimize over $F_{p}(\beta , \gamma) = \langle \psi_p(\gamma,\beta)|C|\psi_p(\gamma,\beta)\rangle $.
+In each optimization step we simulate the circuit $m$ times and then calculate the mean $\mu$ of the outcomes which is $F_{p}(\beta , \gamma) = \langle \psi_p(\gamma,\beta)|C|\psi_p(\gamma,\beta)\rangle $.

+

What would happen if we don't optimize over the mean but on the maximum of the results of the simulation

+

Wouldn't it be much more efficient as fewer shots are needed for each simulation?

+

Are there any papers or work about this?

+",11646,,9006,,11/27/2020 7:51,11/27/2020 8:00,To find the best angles in QAOA why we do not optimize over a maximum ofall shots instead of a mean?,,1,0,,,,CC BY-SA 4.0 +14853,2,,14850,11/26/2020 17:11,,2,,"

There is no a way in Qiskit to get the results in that format. So, you will have to go for the pure Python way:

+
counts = {'0000': 66, '0001': 71, '0010': 68, '0011': 70,
+          '0100': 77, '0101': 64, '0110': 64, '0111': 51,
+          '1000': 52, '1001': 67, '1010': 43, '1011': 64,
+          '1100': 61, '1101': 59, '1110': 73, '1111': 74} 
+
+shots = 1024
+counts = { k:(shots-v) for k,v in counts.items()}
+
+",1859,,,,,11/26/2020 17:11,,,,4,,,,CC BY-SA 4.0 +14854,2,,14842,11/26/2020 18:12,,5,,"

The one from channels to Choi state is a linear isomorphism. This means that whatever is valid for one set, is valid from the other. Practically, besides how we write it down, there is no mathematical difference at all between a channel and its Choi state, they are the same mathematical object. Hence, it shouldn't be surprising that the convex combination of a bunch of Choi states corresponds to che Choi state of the convex combination of the corresponding channels, neverthess let's write it down explicitely, if

+

$$ \Lambda_i =\mathbb 1_A\otimes\mathcal E_B^i |\Omega\rangle_{AB}$$

+

where $|\Omega\rangle_{AB}$ is the unnormalized maximally entangled state, then

+

$$ \sum_{i}p_i \Lambda_i=\sum_{i}p_i\mathbb 1_A\otimes \mathcal E_B^i|\Omega\rangle_{AB}=\mathbb 1_A\otimes\left(\sum_{i}p_i \mathcal E_B^i\right) |\Omega\rangle_{AB}$$

+

so you can see that the linear combination $\sum_{i}p_i \Lambda_i$ is the Choi state of the map $\sum_{i}p_i \mathcal E_B^i$. It remains to see whether this map is a channel. It is trace preserving because

+

$$\mathrm{Tr} \left(\sum_{i}p_i \mathcal E_B^i(\rho)\right)=\sum_i p_i=1$$

+

and completely positive because a sum of CP maps is CP.

+

Conversely it is clear that if you take a convex combination of channel, the corresponding Choi state is the convex combination of the Choi states of the individual channels.

+",5125,,,,,11/26/2020 18:12,,,,0,,,,CC BY-SA 4.0 +14855,1,,,11/27/2020 0:03,,1,118,"

I have some Q# code which I'm editing using visual studio code. The codebase is divided into a src/ folder and a test/ folder. The problem I'm having is that, although the tests do build and pass, VSCode claims that every use of something from the referenced src/ folder is invalid.

+

For example, in this screen shot you can see red underlines as if there are errors, but actually the project builds and runs fine:

+
+

+
+

This is quite annoying, and I can't figure out what about my setup is causing it.

+

Here is src/example.qs:

+
namespace Example {
+    open Microsoft.Quantum.Intrinsic;
+
+    @EntryPoint()
+    operation main() : Unit {
+        Message("main");
+    }
+
+    operation op() : Int {
+        return 42;
+    }
+}
+
+

Here is test/test.qs:

+
namespace Example.Tests {
+    
+    open Example;
+    open Microsoft.Quantum.Diagnostics;
+
+    @Test("ToffoliSimulator")
+    operation test_op() : Unit {
+        if (op() != 42) {
+            fail "wrong result";
+        }
+    }
+}
+
+

Here is src/src_project.csproj:

+
<Project Sdk="Microsoft.Quantum.Sdk/0.13.20111004">
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
+  </PropertyGroup>
+</Project>
+
+

Here is test/test_project.cs_proj:

+
<Project Sdk="Microsoft.Quantum.Sdk/0.13.20111004">
+
+  <PropertyGroup>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
+    <IsPackable>false</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Microsoft.Quantum.Xunit" Version="0.13.20111004" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
+    <PackageReference Include="xunit" Version="2.4.1" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
+    <DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
+    <ProjectReference Include="..\src\src_project.csproj" />
+  </ItemGroup>
+</Project>
+
+

Here is .vscode/tasks.json:

+
{
+    "version": "2.0.0",
+    "tasks": [
+        {
+            "label": "run tests",
+            "command": "dotnet",
+            "type": "process",
+            "args": [
+                "test",
+                "${workspaceFolder}/test/test_project.csproj",
+            ],
+            "group": {
+                "kind": "test",
+                "isDefault": true
+            }
+        },
+    ]
+}
+
+

And finally here is .vscode/launch.json:

+
{
+   "version": "0.2.0",
+   "configurations": [
+        {
+            "name": "debug",
+            "program": "dotnet",
+            "type": "coreclr",
+            "args": [
+                "run",
+                "--project",
+                "${workspaceFolder}/src/src_project.csproj",
+                "-s",
+                "ToffoliSimulator",
+            ],
+            "request":"launch",
+            "logging": {
+                "moduleLoad": false
+            },
+        },
+    ]
+}
+
+",119,,55,,11/30/2020 11:53,4/27/2022 2:06,Correctly configuring a Q# test project in Visual Studio Code,,1,1,,,,CC BY-SA 4.0 +14856,1,14872,,11/27/2020 0:08,,3,58,"

I want to create a unit test in Q# that runs an operation and asserts that it used at most 10 Toffoli operations. How do I do this?

+

For example, what changes do I have to make to the code below?

+
namespace Tests {
+    open Microsoft.Quantum.Diagnostics;
+    open Microsoft.Quantum.Intrinsic;
+
+    operation op() : Unit {
+        using (qs = Qubit[3]) {
+            for (k in 0..10) {
+                CCNOT(qs[0], qs[1], qs[2]);
+            }
+        }
+    }
+
+    @Test("ResourcesEstimator")
+    operation test_op_toffoli_count_at_most_10() : Unit {
+        ...?
+        op();
+        ...?
+        if (tof_count > 10) {
+            fail "Too many Toffolis";
+        }
+    }
+}
+```
+
+",119,,55,,11/30/2020 11:53,11/30/2020 11:53,Creating a resource count unit test in Q#,,2,2,,,,CC BY-SA 4.0 +14858,2,,14659,11/27/2020 5:15,,2,,"

Here is currently how I get this done. I have a Q# file that defines an operation is_toffoli_simulator which is then overriden in a C# file. Then I can use that operation in any method I want, instead of having to do something special for each method. The main downside is that because is_toffoli_simulator returns a value, it prevents the automatic creation of an adjoint.

+

In Q#:

+
namespace Hackery {
+    operation is_toffoli_simulator() : Bool {
+        // HACK: overriden in C# file.
+        return false;
+    }
+}
+
+

In C#:

+
#nullable enable
+
+using System;
+using Microsoft.Quantum.Simulation.Core;
+using Microsoft.Quantum.Simulation.Simulators;
+
+namespace Hackery {
+    public partial class is_toffoli_simulator {
+        public class Native : is_toffoli_simulator {
+            private Func<QVoid, bool> _body;
+
+            public Native(IOperationFactory m) : base(m) {
+                var b = m is ToffoliSimulator;
+                _body = args => b;
+            }
+
+            public override Func<QVoid, bool> __Body__ => _body;
+        }
+    }
+}
+
+

At which point you can do:

+
    operation init_and(a: Qubit, b: Qubit, target: Qubit) : Unit is Adj {
+        body(...) {
+            CCNOT(a, b, target);
+        }
+        adjoint(...) {
+            if (is_toffoli_simulator()) {
+                CCNOT(a, b, target);
+            } else {
+                H(target);
+                if (M(target) == One) {
+                    CZ(a, b);
+                }
+            }
+        }
+    }
+
+",119,,,,,11/27/2020 5:15,,,,0,,,,CC BY-SA 4.0 +14859,1,24200,,11/27/2020 6:42,,9,289,"

As far as I understood from a series of papers, minimizing the T-count in Clifford+T circuits is essential for fault-tolerant quantum computing:

+
+

While techniques such as magic state distillation and injection allow for fault-tolerant implementation of T gates, they typically require an order of magnitude more resources than Clifford gates

+
+

For example see here and here.

+

But do I understand correctly that while minimizing T-count (incl. in Clifford+T circuits) does not give a significant gain for the current IBM open quantum systems (real hardware, not simulations!), in particular, due to the fact that at the moment T gate (like T†, U1/P and RZ gates)

+
+

can be implemented virtually in hardware via framechanges (i.e. at zero error and duration)

+
+

See the documentation

+",12416,,1859,,11/27/2020 23:04,2/21/2022 18:30,Is there a good reason to use T-count minimization for circuits executed on current IBM open quantum systems (real hardware)?,,2,4,,,,CC BY-SA 4.0 +14860,2,,14852,11/27/2020 8:00,,3,,"

In QAOA we are looking for a ground state of a Hamiltonian $H$. This means that we want to find a quantum state $|\psi\rangle$ for which a energy is minimal, or in other words, a state asociated with a minimal eigenvalue.

+

Suppose that $|\psi\rangle$ is our eigenstate, hence +$$ +H|\psi\rangle = \lambda|\psi\rangle, +$$ +where $\lambda$ is respective eigenvalue. Multiplying by $\langle\psi|$ we get +$$ +\langle\psi|H|\psi\rangle = \langle\psi|\lambda|\psi\rangle = \lambda, +$$ +since $\langle\psi|\lambda|\psi\rangle = \lambda\langle\psi|\psi\rangle = \lambda$ ($\langle\psi|\psi\rangle = 1$ comes from requirement that a quantum state is a unit vector).

+

As we want $\lambda \rightarrow \min$, we have to minimize $\langle\psi|H|\psi\rangle$, i.e. the mean.

+",9006,,,,,11/27/2020 8:00,,,,0,,,,CC BY-SA 4.0 +14861,1,14864,,11/27/2020 8:18,,2,155,"

Recently, I came across the article Realization of efficient quantum gates with a superconducting qubit-qutrit circuit where its authors proposed a physical implementation of three qubits quantum gates with two physical qubits and one physical qutrit controlled by microwave pulses.

+

As a result, they were able to implement physically CCZ gate which when accompanied by two Hadamards implements Toffoli gate.

+

They also proposed configuration implementing Fredking gate, another three qubits gate which together with Hadamard gate form universal set.

+

Finally, they showed that their design can be used for implementation of $CC-U$ gate, where +$$ +U= +\begin{pmatrix} +\cos(\theta) & \mathrm{e}^{i\varphi}\sin(\theta)\\ +\mathrm{e}^{-i\varphi}\sin(\theta) & -\cos(\theta)\\ +\end{pmatrix}, +$$ +which is more or less similar to $U3$ gate on IBM Q (to be precise $U(\theta, \varphi) = U3(2\theta,-\varphi,\pi+\varphi)$).

+

As it seems that this proposal is able to cut lenght of circuit, particularly in case of Toffoli gates (implemented by physical CC-Z gate and two Hadamards only) and therefore enables us to implement more complex cirucits, I am curious if such design is being implemented or at least considered by companies like IBM or Google for their next generation of quantum processors. I highly appreciate any links.

+",9006,,1859,,11/27/2020 20:04,12/7/2020 12:09,Is there a quantum processor with physically implemented Toffoli gate?,,2,2,,,,CC BY-SA 4.0 +14862,2,,14861,11/27/2020 8:23,,1,,"

Not quite what you're asking, but...

+

With something like the IBM processors, if you have the right permissions, you can get "pulse level" control of the system. This means you can directly manipulate the Hamiltonian. In principle, this can give you multi-qubit gates directly, if only you can design your pulses correctly.

+",1837,,,,,11/27/2020 8:23,,,,5,,,,CC BY-SA 4.0 +14863,2,,14856,11/27/2020 9:22,,0,,"

The way I can think of is using the ressource estimator. By using a python or C# host file, you can use the ressource simulator and store its value. In python, for example, the ressource estimator will return a dictionary containing the number of single qubit Pauli or Clifford gates under the key [QubitClifford]. You could then use a simple if condition to check if the number of Pauli gates is under 10. If you want to know more about unit tests, I asked this question a couple of weeks ago.

+

I hope this could help.

+",8746,,,,,11/27/2020 9:22,,,,2,,,,CC BY-SA 4.0 +14864,2,,14861,11/27/2020 9:38,,1,,"

Although I can't find an online resource currently, I'm pretty certain that people in QuTech (Tim Taminiau and his group, specifically) are trying to physically implement a Toffoli gate in their NV-center systems. It's definitely on-going research though.

+

Both Google and IBM use transmons as their systems - entangling gates are implemented here using physical 'coupling' resonance cavities - as far as I known, it would in principle be possible to connect multiple (i.e. $3$) qubits, so that one would get a coupled Hamiltonian between $3$ qubits simultaneously. I, however, am not knowledgeable enough to judge the feasibility of this.

+",8141,,8141,,12/7/2020 12:09,12/7/2020 12:09,,,,0,,,,CC BY-SA 4.0 +14865,1,,,11/27/2020 12:08,,2,108,"

In Qiskit, for a given QuantumCircuit object, you can compute its Choi-matrix via the corresponding Choi object, for example:

+
myCircuit = QuantumCircuit(q1,q2)
+myChoi = Choi(myCircuit)
+
+

My problem is, that code gives the Choi-matrix describing the whole system, but I'm interested to one subsystem, say the one associate to q1. +What can I do?

+

I would like to do something like

+
myChoi = Choi(myCircuit, q1)
+
+",8954,,2293,,2/24/2021 14:54,2/24/2021 14:54,Getting Choi-matrix of a subsystem,,0,3,,,,CC BY-SA 4.0 +14866,2,,14851,11/27/2020 13:33,,5,,"

First of all, keep in mind that there is no efficient way of generating them, simply because the number of stabiliser states increases super-exponentially with the number of qudits $n$ (like $p^{O(n^2)}$).

+

Second, I can only give you hints how to do it here, since a detailed treatise would take too long. Sorry. As far as I know, there is also no literature with details on implementation where I can point you to. I'm currently writing a tutorial on the stabiliser formalism which will contain more details and possibly even pseudo-code. But the pre-print will not be out before beginning of next year.

+

We consider stabiliser states in prime dimension $p$ (if you want prime-power, like e.g. for MUBs, that's similar). Define $\omega:=\exp(2\pi i /p)$ to be the standard choice of a primitive $p$-th root of unity.

+

State vector representation

+

For $p\neq 2$, the Hilbert space vectors representing stabiliser states can be chosen to be of the following form (Refs. [1,2]) +$$ + |K, q, b\rangle := \frac{1}{|K|} \sum_{x\in K} \omega^{q(x)+b\cdot x} |x\rangle, +$$ +where $K\subset\mathbb F_p^n$ is an affine subspace, $q$ is a quadratic form on $K$, and $b\in\mathbb F_p^n$.

+

For $p=2$, this is +$$ + |K, q, b \rangle := \frac{1}{|K|} \sum_{x\in K} i^{b\cdot x}\omega^{q(x)} |x\rangle, +$$ +i.e. the linear part is computed mod 4 instead of mod 2.

+

Now you can enumerate all stabiliser state by iterating over all possible affine subspaces $K$, and then over quadratic and linear forms on $K$. The later part is easy once you have fixed a basis of $K$.

+

Density matrix representation

+

The projectors of stabiliser states are determined by their stabiliser group $S$ as follows +$$ +P(S) = \frac{1}{p^n} \sum_{g\in S} g. +$$ +The stabiliser groups modulo signs correspond to so-called Lagrangian subspaces $L\subset \mathbb F_p^{2n}$ (see my answer here). These are $n$-dimensional linear subspaces such that the symplectic form of any two elements vanishes (Ref. [3]): +$$ + 0 = [v,w] := \sum_{i=1}^{n} v_i w_{n+i} - w_i v_{n+i}, \quad \forall v,w\in L. +$$ +Any vector $v\in L$ correspond to a Pauli/Weyl operator $W(v)$ and the above equation expresses that those should commute.

+

Now, for $p\neq 2$, we can rewrite the projector as +$$ +P(S) = P(L,h) = \frac{1}{p^n} \sum_{v\in L} \omega^{[h,v]} W(v). +$$ +From this representation, we can see that the coefficients of $P(L,h)$ in the Weyl basis (i.e. its Bloch vector) are given by $\omega^{[h,v]}$ if $v\in L$ and 0 otherwise. +Hence, one can again iterate over Lagrangian subspaces $L$, and then over the vectors $h$. The latter part is again simplest in a basis of $L$. +In the case $p\neq 2$, one can alternatively use the representation of stabiliser states by their Wigner functions.

+

For $p= 2$, this is a bit uglier. The coefficients here have the form +$$ +P(S) = P(L,h) = \frac{1}{2^n} \sum_{v\in L} (-1)^{\alpha(v)} W(v). +$$ +For a suitable function $\alpha$. +To compute $\alpha$, one can fix it arbitrarily on a basis of $L$ (i.e. choose signs for the generators of $S$) and then compute the coefficients of all other elements from that using +$$ +\alpha(v+w) = \beta(v,w) - \alpha(v) - \alpha(w) +$$ +where $\beta$ is some horrible function determining whether you get an additional sign when you multiply two Pauli operators. +Its explicit form is e.g. given in a paper of mine (Ref. [4, App. A])), but also elsewhere.

+

Literature

+
    +
  1. Dehaene, Jeroen, and Bart De Moor. “The Clifford Group, Stabilizer States, and Linear and Quadratic Operations over GF(2).” Physical Review A 68, no. 4 (2003). https://doi.org/10.1103/PhysRevA.68.042318.
  2. +
  3. Gross, D., and M. Van den Nest. “The LU-LC Conjecture, Diagonal Local Operations and Quadratic Forms over GF(2),” (2007). https://arxiv.org/abs/0707.4000v2.
  4. +
  5. Gross, D. “Hudson’s Theorem for Finite-Dimensional Quantum Systems.” Journal of Mathematical Physics 47, no. 12 (2006): 122107. https://doi.org/10.1063/1.2393152.
  6. +
  7. Heimendahl, Arne, Markus Heinrich, and David Gross. “The Axiomatic and the Operational Approaches to Resource Theories of Magic Do Not Coincide.” arXiv:2011.11651 (2020). http://arxiv.org/abs/2011.11651.
  8. +
+",2305,,2305,,11/30/2020 12:19,11/30/2020 12:19,,,,4,,,,CC BY-SA 4.0 +14867,1,,,11/27/2020 14:44,,2,991,"

I'm trying to run a VQE for a specific custom Anzats. The Anzats is built up of an unitary matrix $U_H$, which I'm trying to created in this way:

+
from qiskit import *
+from qiskit.circuit import Parameter
+from qiskit.quantum_info import Operator
+import math as m
+
+u_circuit = QuantumCircuit(2)
+
+# This does not work
+theta = Parameter('θ')
+
+U_H = Operator([
+[m.cos(2 * theta) - 1j * m.sin(2 * theta), 0, 0, 0],
+[0, m.cos(2 * theta), -1j * m.sin(2 * theta), 0],
+[0, -1j * m.sin(2 * theta), m.cos(2 * theta), 0],
+[0, 0, 0, m.cos(2 * theta) - 1j * m.sin(2 * theta)]
+])
+
+u_circuit.unitary(U_H, [0, 1], label='U_H(θ)')
+
+U_H_gate = u_circuit.to_gate(label='U_H(θ)')
+
+

However, for the VQE to work, the circuit needs to be parameterized, and because of that, so does the unitary gate U_H. Unfortunately, I'm not able to parameterize my variable θ in my operator that I later transform into a 2-qubit gate. Also I can't find a way to bind theta so that it only exists between $0$ and $2\pi$. Whenever I try to build a circuit using this function to generate the gates in the Ansatz, I get the following error:

+
ParameterExpression with unbound parameters ({Parameter(θ)}) cannot be cast to a float.
+
+

Does anyone know how I can create a parameterized circuit consisting of parameterized gates of the form described by the matrix the U_H operator, where theta ranges from $0$ to $2\pi$?

+",13960,,55,,11/30/2020 11:55,12/23/2021 18:45,Creating a parameterized Operator in Qiskit,,3,0,,,,CC BY-SA 4.0 +14868,2,,14867,11/27/2020 16:06,,2,,"

If I follow this correctly, the problem is that operator does not currently support parameters. This is a reported issue https://github.com/Qiskit/qiskit-terra/issues/4751

+",1859,,,,,11/27/2020 16:06,,,,0,,,,CC BY-SA 4.0 +14870,1,14871,,11/27/2020 19:15,,1,527,"

Executing the following:

+
import numpy as np
+from qiskit import IBMQ, QuantumCircuit, Aer, execute
+from qiskit.quantum_info import Operator
+from qiskit.providers.ibmq import least_busy
+from qiskit.visualization import plot_histogram
+from qiskit.tools.jupyter import *
+provider = IBMQ.load_account() 
+
+

I get the following error which I do not know what to do about, does anybosy know what I can do?

+
ibmqfactory.load_account:WARNING:2020-11-27 
+13:08:45,170: Credentials are already in use. The 
+existing account in the session will be replaced.
+
+",13698,,55,,11/30/2020 11:55,11/30/2020 11:55,"IBMQ: ""Credentials are already in use""",,1,0,,,,CC BY-SA 4.0 +14871,2,,14870,11/27/2020 19:25,,1,,"

This is NOT an error.

+

It just means that you have loaded your account previously, maybe from the previous run. It will just replace your previous credential... and shouldn't cause any issue.

+",9858,,,,,11/27/2020 19:25,,,,0,,,,CC BY-SA 4.0 +14872,2,,14856,11/27/2020 20:24,,2,,"

There are multiple ways to do this, depending on what exactly you want to check.

+
    +
  1. Using AllowAtMostNCallsCA library operation.
  2. +
+

The easiest way (with the code short enough to be included) is applicable if you know that you only use CCNOT gates when you want a Toffoli gate, and you never use Controlled X gates. In this case you can AllowAtMostNCallsCA operation that enforces exactly that:

+
namespace Tests {
+    open Microsoft.Quantum.Diagnostics;
+    open Microsoft.Quantum.Intrinsic;
+
+    operation op() : Unit {
+        using (qs = Qubit[3]) {
+            for (k in 0..10) {
+                CCNOT(qs[0], qs[1], qs[2]);
+            }
+        }
+    }
+
+    @Test("ResourcesEstimator")
+    operation test_op_toffoli_count_at_most_10() : Unit {
+        within {
+            AllowAtMostNCallsCA(10, CCNOT, "Too many Toffolis");
+        } apply {
+            op();
+        }
+    }
+}
+
+

This test will fail right away, and that's how you can notice that the loop actually uses 11 CCNOTs. However, if you replace the CCNOTs in the loop body with Controlled X([qs[0], qs[1]], qs[2]); (which is exactly the same gate), the test will happily pass irrespective of how many times you use the gate.

+
    +
  1. Using resource estimator.
  2. +
+

You can write a test (it will have to be in a different language, though) that will invoke ResourcesEstimator, run an operation using it, extract the statistics and analyze them. I don't have a ready example on hand; the closest thing is this documentation. This approach has the advantage of matching the resource estimates done by ResourcesEstimator exactly, rather than tracking specific gates.

+
    +
  1. Using custom simulator.
  2. +
+

If you want to do some sophisticated checks, for example, count all gates that act on exactly 3 qubits and limit their number, you can write your own simulator that would extend the simulator you like by doing some extra counting whenever an operation is called. This simulator could expose access to those statistics to your Q# code, so you could write custom assertions using this data. I'm not including the full code here, since it's pretty lengthy (and you indicated that you don't want to use a second language); you can find a complete example here (some tasks in the Quantum Katas use tests like "prohibit all multi-qubit operations except Measure", so this simulator comes handy).

+",2879,,,,,11/27/2020 20:24,,,,0,,,,CC BY-SA 4.0 +14873,2,,8702,11/27/2020 22:14,,1,,"

I am still unable to see the ~/.qiskit/settings.conf file. Did the listing to show hidden files as well as created a new conda environment for a new qiskit environment.

+

I am on a mac and following the instructions listed here: https://qiskit.org/textbook/ch-prerequisites/setting-the-environment.html

+",13961,,,,,11/27/2020 22:14,,,,2,,,,CC BY-SA 4.0 +14874,1,14877,,11/27/2020 22:54,,0,893,"

I checked this code multiple times, I am trying to reproduce the same code using Grover's algorithm from qiskit summerschool:

+
 import numpy as np
+ from qiskit import IBMQ, QuantumCircuit, Aer, execute
+ from qiskit.quantum_info import Operator
+ from qiskit.providers.ibmq import least_busy
+ from qiskit.visualization import plot_histogram
+ from qiskit.tools.jupyter import *
+ provider = IBMQ.load_account()
+
+def phase_oracle(n, indices_to_mark, name='Oracle'):
+qc = QuantumCircuit(n, name=name)
+oracle_matrix = np.identity(2**n)
+for index_to_mark in indices_to_mark:
+    oracle_matrix[index_to_mark, index_to_mark]= -1
+qc.unitary(operator(oracle_matrix), range(n))
+return qc
+
+def diffuser(n):
+qc=QuantumCircuit(n,name='Diff - "V"')
+qc.h(range(n))
+qc.append(phase_oracle(n,[0]),range(n))
+qc.h(range(n))
+return qc
+
+def Grover(n, marked):
+qc=QuantumCircuit(n,n)
+r = int(np.round(np.pi/
+(4*np.arcsin(np.sqrt(len(marked)/2**n)))-1/2))
+print(f'{n} qubits, basis state {marked} marked, {r} 
+rounds')
+qc.h(range(n))
+for _ in range(r):
+    qc.append(phase_oracle(n,marked),range(n))
+    qc.append(diffuser(n),range(n))
+qc.measure(range(n),range(n))
+return qc
+
+n = 5
+x = np.random.randint(2**n)
+marked = [x]
+qc = Grover(n, marked)
+
+qc.draw()
+
+

I get the name operator error which I cannot figure out the reason:

+
 NameError                                 Traceback 
+(most recent call last)
+ <ipython-input-22-96635782dc30> in <module>
+  2 x = np.random.randint(2**n)
+  3 marked = [x]
+  ----> 4 qc = Grover(n, marked)
+  5 
+  6 qc.draw()
+
+ <ipython-input-20-f14e47e0af5d> in Grover(n, marked)
+ 20     qc.h(range(n))
+ 21     for _ in range(r):
+  ---> 22         
+ qc.append(phase_oracle(n,marked),range(n))
+ 23         qc.append(diffuser(n),range(n))
+ 24     qc.measure(range(n),range(n))
+
+  <ipython-input-20-f14e47e0af5d> in phase_oracle(n, 
+  indices_to_mark, name)
+  4     for index_to_mark in indices_to_mark:
+  5         oracle_matrix[index_to_mark, 
+  index_to_mark]= -1
+   ----> 6     qc.unitary(operator(oracle_matrix), 
+   range(n))
+  7     return qc
+  8 
+
+

NameError: name 'operator' is not defined. Can anybody help me woth this?

+",13698,,,,,11/28/2020 1:18,Why do I get the error name operator is not defined?,,1,0,,,,CC BY-SA 4.0 +14875,2,,14774,11/27/2020 23:08,,1,,"

I guess you assume that $\psi$ is a bit string, so $|\psi\rangle$ is not fully arbitrary (there is no way to compare with an arbitrary state without measurements).

+

Logically, it's just $(\phi_0=\psi_0 ~AND~ \phi_1=\psi_1 ~AND~ ...)$.

+

To implement the first comparison you can use $CNOT_{0a} \cdot CNOT_{pa} \cdot X_{a}$ where $a$ is the index of an ancilla qubit (0-initialized). $CNOT$ is basically a sum modulo 2 (in the target qubit), so the value of the ancilla $a$ will be $\phi_0 \oplus \psi_0 \oplus 1$, which is the same as $\phi_0=\psi_0$. Similarly for other comparisons.

+

To accumulate results in the ancillas $a, a+1, a+2, ..., a+p-1$ you can use a multiply controlled $NOT$ gate (Toffoli generalization) where the target is $(2p+1)$-th qubit. To implement such gate you can use a bunch of Toffoli gates $-$ a standard scheme, see e.g. Nielsen&Chuang book.

+

And it's good practice to uncompute, even if $\psi$ is just a bit string.

+",5870,,5870,,11/28/2020 7:20,11/28/2020 7:20,,,,0,,,,CC BY-SA 4.0 +14876,1,14884,,11/28/2020 1:17,,2,145,"

Could someone help me with $Problem-10.52$ in Nielsen and Isaac Chuang‘s book?

+

The screenshot is shown below. I have no idea about that.

+

Hope someone can give me some suggestions.

+

By the way, if I want to know whether an operator is fault-tolerant, what should I DO to check it? For example, the $Z$ operator (as shown below) is a fault-tolerant operator in the encoding procedure, or not. I only know the fault-tolerant operator only allows 1-bit error to happen.

+

+",,user13341,,user13341,11/28/2020 13:30,11/28/2020 13:30,CSS Code and Fault-tolerant Problem in Nielsen and Isaac Chuang‘s book,,1,2,,,,CC BY-SA 4.0 +14877,2,,14874,11/28/2020 1:18,,2,,"

That is because on line 14 of your program, you wrote:

+

qc.unitary(operator(oracle_matrix), range(n))

+

when it should be:

+

qc.unitary(Operator(oracle_matrix), range(n))

+

You should have capitalized the O in operator. Changing that, I get the following output when executed your code:

+
5 qubits, basis state [15] marked, 4 rounds
+     ┌───┐┌─────────┐┌─────────────┐┌─────────┐┌─────────────┐┌─────────┐»
+q_0: ┤ H ├┤0        ├┤0            ├┤0        ├┤0            ├┤0        ├»
+     ├───┤│         ││             ││         ││             ││         │»
+q_1: ┤ H ├┤1        ├┤1            ├┤1        ├┤1            ├┤1        ├»
+     ├───┤│         ││             ││         ││             ││         │»
+q_2: ┤ H ├┤2 Oracle ├┤2 Diff - "V" ├┤2 Oracle ├┤2 Diff - "V" ├┤2 Oracle ├»
+     ├───┤│         ││             ││         ││             ││         │»
+q_3: ┤ H ├┤3        ├┤3            ├┤3        ├┤3            ├┤3        ├»
+     ├───┤│         ││             ││         ││             ││         │»
+q_4: ┤ H ├┤4        ├┤4            ├┤4        ├┤4            ├┤4        ├»
+     └───┘└─────────┘└─────────────┘└─────────┘└───────���─────┘└─────────┘»
+c: 5/════════════════════════════════════════════════════════════════════»
+                                                                         »
+«     ┌─────────────┐┌─────────┐┌─────────────┐┌─┐            
+«q_0: ┤0            ├┤0        ├┤0            ├┤M├────────────
+«     │             ││         ││             │└╥┘┌─┐         
+«q_1: ┤1            ├┤1        ├┤1            ├─╫─┤M├─────────
+«     │             ││         ││             │ ║ └╥┘┌─┐      
+«q_2: ┤2 Diff - "V" ├┤2 Oracle ├┤2 Diff - "V" ├─╫──╫─┤M├──────
+«     │             ││         ││             │ ║  ║ └╥┘┌─┐   
+«q_3: ┤3            ├┤3        ├┤3            ├─╫──╫──╫─┤M├───
+«     │             ││         ││             │ ║  ║  ║ └╥┘┌─┐
+«q_4: ┤4            ├┤4        ├┤4            ├─╫──╫──╫──╫─┤M├
+«     └─────────────┘└─────────┘└─────────────┘ ║  ║  ║  ║ └╥┘
+«c: 5/══════════════════════════════════════════╩══╩══╩══╩══╩═
+«                                               0  1  2  3  4 
+
+",9858,,,,,11/28/2020 1:18,,,,0,,,,CC BY-SA 4.0 +14878,1,14880,,11/28/2020 3:04,,5,167,"

Let's say I have a density matrix of the following form:

+

$$ +\rho := \frac{1}{2} (|a \rangle \langle a| + |b \rangle \langle b|), +$$ +where $|a\rangle$ and $|b\rangle$ are quantum states. I saw that the eigenvalues of this matrix are: +$$ +\frac{1}{2} \pm \frac{|\langle a | b \rangle|}{2}. +$$ +I was just wondering how this is derived. It seems logical, i.e if $|\langle a | b \rangle| = 1$ then the eigenvalues are $0$ and $1$, otherwise if $|\langle a | b \rangle| = 0$ then they are half and half. This means that the entropy of the system would either be $0$ or $1$. But I was just wondering how to calculate the eigenvalues from $\rho$.

+",2403,,10480,,2/7/2021 0:50,2/7/2021 0:50,How are the eigenvalues of $\rho=\frac12(|a\rangle\!\langle a| +|b\rangle\!\langle b|)$ derived?,,2,1,,,,CC BY-SA 4.0 +14879,1,,,11/28/2020 6:36,,3,194,"

I am very new to quantum computing and I have started learning the concepts watching the IBM summerschool videos and trying to solve the IBM quantum challenge problems. One of their problems is solving the lights out puzzle using grovers' algorithm. After learning Grover's algorithm I went through the example the did on sudoko here: +https://qiskit.org/textbook/ch-algorithms/grover.html

+

There are three steps to solve a problem using Grovers' algorith :

+
    +
  1. Create a reversible classical circuit that identifies a correct solution

    +
  2. +
  3. Use phase kickback and uncomputation to turn this circuit into an oracle

    +
  4. +
  5. Use Grover's algorithm to solve this oracle

    +
  6. +
+

For lights out problem, I'm struggling with finding the classical solution to it using the known gates(like what they did for Sudoko using XOR gate).

+

If I start with an input [101000010] for a $3$x$3$ puzzle in which $0$ means off and one means lit, what would be the possible gates I can use to turn off all the lights eventually?

+

(I know the mathematical algebric solution to the lights out problem, should I probably use that as the reversible classical circuit?)

+

I appreciate it if anyone can guide me through this

+",13698,,9318,,11/28/2020 21:39,11/28/2020 21:39,How to write the classical algorithm for lights out problem?,,0,0,,,,CC BY-SA 4.0 +14880,2,,14878,11/28/2020 7:49,,2,,"

For this it suffices to consider the two-dimensional subspace spanned by $|a\rangle$ and $|b\rangle$. Let $|0\rangle$ and $|1\rangle$ be an orthonormal basis of this subspace. Then +$$\begin{align} +|a\rangle =& a_0 |0\rangle + a_1 |1\rangle\\ +|b\rangle =& b_0 |0\rangle + b_1 |1\rangle +\end{align} +$$ +and +$$\rho = \frac{1}{2}\left(\begin{array}{cc} +a_0 a_0^*+b_0b_0^* & a_0a_1^* + b_0 b_1^*\\ +a_1 a_0^*+ b_1b_0^* & a_1a_1^*+b_1b_1^* +\end{array}\right).$$ +That is, now you have a 2x2 Hermitian matrix and calculate its eigenvalues as usual. Hint: A Hermitian matrix +$$\left(\begin{array}{cc} +a & c + d i\\ +c - d i & b +\end{array}\right)$$ has eigenvalues $\frac{1}{2}(a + b \pm \sqrt{(a-b)^2+ 4 (c^2+d^2)})$.

+",104,,,,,11/28/2020 7:49,,,,0,,,,CC BY-SA 4.0 +14881,1,,,11/28/2020 8:47,,6,95,"

In the original QAOA paper from Farhi +https://arxiv.org/pdf/1411.4028.pdf, +it is stated in chapter 2 last paragraph (page 6) that: when measuring $F_{p}(\beta , \gamma)$ we get an outcome of at least $F_{p}(\beta , \gamma) - 1$ with probability of $1 - 1/m$ with order $m \log(m)$ repetitions.
+Where is this proven? Or what is the idea behind that?

+

Thanks:))

+",11646,,16606,,3/20/2022 0:07,3/20/2022 0:07,"In QAOA why do we need $m \log(m)$ repetitions to get at least $F_{p}(\beta , \gamma) - 1$ with probability of $1 - 1/m$?",,0,0,,,,CC BY-SA 4.0 +14882,2,,13994,11/28/2020 10:44,,2,,"

Probability And Randomness: Quantum Versus Classical by By Andrei Yu Khrennikov is a great book on the foundations of quantum randomness. Introduction to Random Time and Quantum Randomness by Kai Lai Chung and Jean-Claude Zambrini is another work on quantum randomness. Both these books are more focusing on the theoretical foundations of quantum randomness. MIT has also published a recent work on quantum randomness by Liu, Zi-Wen.

+",4501,,,,,11/28/2020 10:44,,,,0,,,,CC BY-SA 4.0 +14883,1,,,11/28/2020 10:48,,4,149,"

When trying to execute complex quantum circuits on IBMQ real devices, one can encounter a typical error (ERROR_RUNNING_JOB) with the message 'Circuit runtime is greater than the device repetition rate [8020]'.

+

I think am fully concerned on what refers to circuit fidelity and transpile optimizations. However, what I'm trying to get is just what are those device repetition rates that my circuit runtime should be smaller than (my goal is to study current device limits for executions of a quantum algorithm depending on the parameters given, which affects significantly on the circuit runtime).

+

What's more, how can I calculate the circuit runtime depending on its depth (and I suppose types and number of gates being required)?

+

For example, someone asked 7 months ago how to fix the 8020 error, which is "simply" fixed by reducing the circuit size, but at which point does someone have to reduce it depending on the real device (like ibmq_16_melbourne or ibmq_manhattan)?

+",13967,,55,,11/30/2020 11:20,5/21/2021 20:02,IBMQ backends: How can I know the repetition rate and depth limits of real devices?,,1,0,,,,CC BY-SA 4.0 +14884,2,,14876,11/28/2020 12:41,,1,,"

I think you just get stuck, this is an easy job. For stabilizer codes, the logical state $|0\rangle_L$ and $|1\rangle_L$ are just superposition of states(maintaining the same state under stabilizer operation).

+

To verify $\bar Z$ and $\bar X$ are logical $Z$ and $X$ operators, just notice that $\bar Z|0\rangle_L=|0\rangle_L,\ \bar Z|1\rangle_L=-|1\rangle_L,\ \bar X|0\rangle_L=|1\rangle_L,$ and $\bar X|1\rangle_L=|0\rangle_L$.

+

These two are the logical states for Steane code(or see the original paper):

+

+

You can see that all superposition states of $|0\rangle_L$ contains even number of $|1\rangle's$, so $\bar Z|0\rangle_L=|0\rangle_L$, while for $|1\rangle_L$ the number of $|1\rangle$ is odd-definite. I'll leave the $\bar X$ part of work for you(it's quite tedious).

+",13647,,,,,11/28/2020 12:41,,,,2,,,,CC BY-SA 4.0 +14885,1,14886,,11/28/2020 13:34,,2,68,"

In the proof of Uhlmann's theorem, the book writes the polar decomposition: $A = |A|V$, with $|A| = \sqrt{A^\dagger A}$.

+

Shouldn't it be $V|A|$ instead? +The former case is $A^\dagger A = V^\dagger|A||A|V$ while the latter case is $A^\dagger A = |A|V^\dagger V|A| = |A||A| = A^\dagger A$.

+",13968,,55,,11/30/2020 11:17,11/30/2020 11:17,"In Uhlmann's theorem, should the polar decomposition be written as $A=|A|V$ or $A=V|A|$?",,1,1,,,,CC BY-SA 4.0 +14886,2,,14885,11/28/2020 14:15,,2,,"

Ok I confused myself in the first version of this answer.

+

With the definition $|A|:=\sqrt{A^\dagger A}$, it should be $A=U|A|$. If you define instead $|A|:=\sqrt{A A^\dagger}$, then it is $A=|A|U$. Both definitions are common.

+

There is a left and a right polar decomposition $A=PU=UP'$ which are related to the SVD $A=V\Sigma W^\dagger$ by +$$ +P=V\Sigma V^\dagger, \quad U = VW^\dagger, \quad P' = W\Sigma W^\dagger. +$$ +Note that $\Sigma$ is the diagonal matrix with the singular values of $A$, i.e. the eigenvalues of $|A|=\sqrt{A^\dagger A}$ (or $\sqrt{A A^\dagger}$, they are the same), on its diagonal. Clearly, we have +$$ +A^\dagger A = P'U^\dagger U P' = W\Sigma^2 W, \quad AA^\dagger = V\Sigma^2 V^\dagger +$$ +hence $P'=\sqrt{A^\dagger A}=|A|$ and $P=\sqrt{AA^\dagger}$.

+",2305,,2305,,11/28/2020 14:27,11/28/2020 14:27,,,,0,,,,CC BY-SA 4.0 +14887,1,14896,,11/28/2020 15:48,,4,699,"

In a lot of presentation I always see people say that $n$ qbit are approximately $2^n$ classical bit. +Those talks where oriented for a broad audience, so they left out a lot of things. +Deep down I felt that this couldn't be possible, but I didn't know anythings about qc so maybe this was the problem.

+

Now I've started learning qc (as a computer engineer) and I'm studying the concept of super dense coding, that it the base of the association $n$ qbit equal $2^n$ classical bits.(If it's not this let me know)

+

I've understood what the topic is about, but I still think that the association $n$ qbit equal $2^n$ classical bits is wrong or at least misleading.

+

Sending 2 bit to Bob, will require Alice to have 1 qbit and 1 entangled qbit where the other part of the eqbit is owned by Bob. +Just by reading this is clear that 2 bit actually correspond to 1 qbit + 1eqbit, but reading online one common approach to say that 1qbit=2bit is by introducing a third part that is responsible to send and eqbit to Alice and Bob. +Isn't this a flawed way to think? When someone say $n$ qbit equal $2^n$ bit, they are implicitly stating that there is a way to encode the information of $2^n$ bits in $n$ qbit, but if you actually study the theory is not like this.

+

Also saying that 1qbit +1eqbit =2 bit, is not too much different than saying 1qbit+1qbit=2qbit=2bit, because at the end of the day 1eqbit is just a qbit in a particular state. I know that differentiating between them is important since they are two different things, but physically we can see them as two object (two photons for example) that are in a different position, still they 'occupy the space of two object'. +I also know that approximating 1 eqbit with 1 qbit is a strong affirmation, but stating that 1qbit = 2bit is stronger imo.

+

Is my way of thinking flawed? Why and where?

+

Also there is another thing that I couldn't understand on my own. +In the textbook that I'm using (Quantum Computation and Quantum Information) one thing that they say is:

+
+

Suppose Alice and Bob initially share a pair of qubits in the entangled +state..

+
+

Since the sharing of the eqbit and the sending of the qbit seems to happen in two different temporal window, they are able to store qbit? +In essence I don't understand the temporal window of the algorithm. I understand how it works, but not when. Can you clarify this?

+

Note that this second question is related to the first, because I kind of understand the point of super dense coding, if you can send qbit at two different time and exploit quantum mechanics to send less qbit when needed, but if everything happen at the same time (the sending of the eqbit and the sending of the qbit) then I don't know the point of super dense coding.

+",9285,,55,,11/30/2020 11:17,10/5/2021 19:47,Does 1 qubit correspond to 2 bits?,,2,0,,,,CC BY-SA 4.0 +14888,1,,,11/28/2020 16:41,,5,96,"

I am interested in photonic computing, and I am curious how the gates work. I once saw a picture of a photonic CNOT gate that used just mirrors and polarizers. I have not been able to find any blueprints or schematics for working photonic gates.

+",13972,,55,,11/30/2020 11:12,11/30/2020 11:12,How do we realise photonic gates?,,0,3,,,,CC BY-SA 4.0 +14889,2,,11857,11/28/2020 17:39,,3,,"

I totally agree with the comments of Sam Jaques and Sam Palmer. I would just elaborate a little bit more on that.

+

The idea is that there is indeed no approximation in the step 3, but there is "some kind" of approximation between steps 3 and 4. To understand what kind of approximation it is and why $2^t$ should be an integer multiple of $r$, let's start from the step 3:

+

$$\frac{1}{\sqrt{2^t}}\sum_{x=0}^{2^t-1}|x\rangle|f(x)\rangle = \frac{1}{\sqrt{r2^t}}\sum_{l=0}^{r-1}\sum_{x=0}^{2^t-1} e^{2\pi i l x/r}|x\rangle|\hat{f}(l)\rangle$$

+

After rearrangement of the last expression and multiplication&division by $2^t$ in the power of the exponent, we get:

+

$$\frac{1}{\sqrt{r2^t}}\sum_{l=0}^{r-1}\sum_{x=0}^{2^t-1} e^{2\pi i l x/r}|x\rangle|\hat{f}(l)\rangle = \frac{1}{\sqrt{r}}\sum_{l=0}^{r-1}\Big(\frac{1}{\sqrt{2^t}}\sum_{x=0}^{2^t-1} e^{2\pi i (l2^t/r)\frac{x}{2^t}}|x\rangle\Big)|\hat{f}(l)\rangle$$

+

Now recall that the Fourier transform of the quantum state $|j\rangle$ is $\frac{1}{\sqrt{2^t}}\sum_{x=0}^{2^t-1} e^{2\pi i (j)\frac{x}{2^t}}|x\rangle$. Keep in mind that $(j)$ in the exponent's power is an integer, and $j$ in $|j\rangle$ is a binary representation of an integer $j$ by a quantum state (for instance, if $j=5$, then $|j\rangle = |1\rangle|0\rangle|1\rangle)$

+

Finally, notice that if $(l2^t/r)$ is integer (i.e. if $2^t$ is an integer multiple of $r$), then the expression inside round brackets from step 3 is exactly the Fourier transform of the state $|l2^t/r\rangle$:

+

$$\frac{1}{\sqrt{2^t}}\sum_{x=0}^{2^t-1} e^{2\pi i (l2^t/r)\frac{x}{2^t}}|x\rangle = FT (|l2^t/r\rangle)$$

+

In this case, there is no need for approximations at all, because moving from step 3 to step 4 we get

+

$$\frac{1}{\sqrt{r}}\sum_{l=0}^{r-1}\Big(FT (|l2^t/r\rangle)\Big)|\hat{f}(l)\rangle \rightarrow \frac{1}{\sqrt{r}}\sum_{l=0}^{r-1}|l2^t/r\rangle|\hat{f}(l)\rangle$$

+

If you compare it with what is written in Nielsen and Chuang step 4, you will notice that $|\tilde{l/r}\rangle$ is exactly a quantum state $|l2^t/r\rangle$ for binary representation of integer $l2^t/r$.

+

But if $l2^t/r$ is not an integer (i.e. if $2^t$ is not an integer multiple of $r$), then

+

$$\frac{1}{\sqrt{2^t}}\sum_{x=0}^{2^t-1} e^{2\pi i (l2^t/r)\frac{x}{2^t}}|x\rangle \neq FT (|l2^t/r\rangle),$$

+

since for rational $l2^t/r$ there is no integer binary representation, and thus, no quantum state $|l2^t/r\rangle$. In this case, what we get from $|\tilde{l/r}\rangle$ in step 4 is only an approximation.

+

Additionally, you asked about period-finding specifically, but the same logic applies to the descriptions of order-finding algorithm and discrete logarithm algorithm in Nielsen and Chuang.

+",13812,,,,,11/28/2020 17:39,,,,0,,,,CC BY-SA 4.0 +14890,1,14894,,11/28/2020 17:57,,1,123,"

For quantum states $\vert\psi_1\rangle, \vert\psi_2\rangle, \vert\phi\rangle$, is it true that:

+

$$\tag{1}\langle \phi\vert\psi_1\rangle\langle\psi_1\vert\phi\rangle\langle \phi\vert\psi_2\rangle\langle\psi_2\vert\phi\rangle + \langle \phi\vert\psi_2\rangle\langle\psi_2\vert\phi\rangle\langle \phi\vert\psi_1\rangle\langle\psi_1\vert\phi\rangle \leq \langle \phi\vert\psi_1\rangle\langle\psi_2\vert\phi\rangle + \langle \phi\vert\psi_2\rangle\langle\psi_1\vert\phi\rangle.$$

+

My argument is that each number $c_i = \langle\phi\vert\psi_i\rangle$ is a complex number with modulus smaller than 1 since it is the square root of a probability. So we have to show:

+

$$2|c_1|^2|c_2|^2 \leq c_1c_2^* + c_1^*c_2\tag{2}.$$

+",13973,,2293,,12/12/2020 16:57,12/13/2020 21:40,Inequality in overlap of quantum states,,2,1,,,,CC BY-SA 4.0 +14891,1,14897,,11/28/2020 21:20,,2,92,"

I have noticed one identity in case of tensor product from this post. But I can't understand why it is true.

+

$\langle v_i| \otimes \langle w_j| \cdot |w_k\rangle \otimes |v_m\rangle = \langle v_i|v_m\rangle \cdot \langle w_j|w_k\rangle$

+

Now if I consider $\langle v_i|$ to be $[a,b]$ and $\langle w_j|$ to be $[c,d]$. (note these are $1 \times 2$) then

+

$\langle v_i| \otimes \langle w_j| = [a,b] \otimes [c,d] + = [ac,ad,bc,bd]$

+

Similarly $|w_k\rangle \otimes |v_m\rangle = [e,f]^T \otimes [g,h]^T = [eg, eh, fg, fh]^T $

+

Scalar product between them = $[ac,ad,bc,bd] . [eg, eh, fg, fh]^T = aceg+ adeh+ bcfg+ bdfh$

+

Now as per the identity if we do

+

$\langle v_i|v_m\rangle = [a,b] . [g,h]^T = ag+bh$ +and +$\langle w_j|w_k\rangle = [c,d] . [e,f]^T = ce+df$

+

So $\langle v_i|v_m\rangle \cdot \langle w_j|w_k\rangle = (ag+bh).(ce+df)= aceg + adfg + bceh + bdfh$

+

Now they are not the same. What is the reason for this behavior?

+",13763,,55,,11/30/2020 11:11,11/30/2020 11:11,Discrepancy in inner product between tensor products,,1,2,,,,CC BY-SA 4.0 +14894,2,,14890,11/29/2020 3:10,,0,,"

$\langle a | b \rangle$ is usually a scalar, so you can move such objects around on the left side, and arrive at (assuming all wavefunctions are normalized):

+

\begin{align} +\tag{1} + \langle \phi\vert\psi_1\rangle\langle\psi_1\vert\phi\rangle\langle \phi\vert\psi_2\rangle\langle\psi_2\vert\phi\rangle + \langle \phi\vert\psi_2\rangle\langle\psi_2\vert\phi\rangle\langle \phi\vert\psi_1\rangle\langle\psi_1\vert\phi\rangle &= 2\langle \phi\vert\psi_2\rangle\langle\psi_2\vert\phi\rangle\langle \phi\vert\psi_1\rangle\langle\psi_1\vert\phi\rangle \\ +&=2|c_1|^2|c_2|^2 \tag{2}\\ +&\le2.\tag{3} +\end{align}

+

In the case where $c_1$ and $c_2$ are positive and real-valued, which does actually happen quite often in quantum mechanics, you'd get:

+

\begin{align} +2(c_1c_2)^2 ~~~~~&\textrm{vs.} ~~~~~2 c_1c_2\tag{4} \\ +\end{align}

+

Then since $c_1 c_2 \le 1$, you would be correct that the left side is $\le$ the right side. However there's cases where the inequality is not true, for example:

+ +

$c_1$ purely real and $c_2$ purely imaginary:

+

The right-hand side (of your inequality in Eq. 2) becomes:

+

$$ +c_1c_2^* + c_1^*c_2 = c_1(c_2 - c_2) = 0\tag{5}, +$$

+

but the left-hand side is bigger than 0 because $|c_2|^2>0.$

+

$c_1$ and $c_2$ have different signs:

+

The right-side (of your inequality in Eq. 2) can be negative while the left-side is positive.

+",2293,,2293,,12/13/2020 21:40,12/13/2020 21:40,,,,12,,,,CC BY-SA 4.0 +14896,2,,14887,11/29/2020 8:00,,4,,"

Lets start with notion that $n$ qubits are equivalent to $2^n$ classical bits. This is wrong. However, it is true that to describe a quantum state composed of $n$ qubits we need $2^n$ complex numbers since $n$ qubits state is superposition containing all combination of $n$ classical qubits ($2^n$). Writen by formula, $n$ qubits state is +$$ +|q_0q_1...q_{n-1}\rangle = \sum_{i=0}^{2^n}a_{i}|i\rangle, +$$ +where $i$ represent basis states (e.g. $|0...00\rangle$, $|0...01\rangle$, $|0...10\rangle$, $|0...11\rangle$ etc. until $|1...11\rangle$) and $a_{i} \in \mathbb{C}$.

+

Concerning information contained in qubits. Any qubit can be described as +$$ +|q\rangle = \alpha|0\rangle + \beta|1\rangle, +$$ +where $\alpha, \beta \in \mathbb{C}$. Since paraeters $\alpha$ and $\beta$ are complex numbers, theoretically a qubit can contain infinite amount of information because you need infinite amout of bits to represent complex number exactly. This is of course impossible in reality since computers have finite memory. Moreover and what is the most important, when you measure a qubit, it collapeses to either 0 or 1. So, in the end you have either 0 or 1, i.e. one classical bit. Therefore, one qubit contains one bit of information.

+

Regarding superdense coding. It is often said that in superdense coding you send only one qubit but in the end you have two classical bits. It is true that you send only one qubit but to have superdense coding, you need to have two entangled qubits before. So, effectively two qubits are needed for transmiting two classical bits.

+",9006,,,,,11/29/2020 8:00,,,,8,,,,CC BY-SA 4.0 +14897,2,,14891,11/29/2020 10:37,,2,,"

The identity is wrong. It should be +$$ +\langle v_i | \otimes \langle w_j | \cdot | w_k \rangle \otimes | v_m \rangle = \langle v_i | w_k \rangle \langle w_j | v_m \rangle. +$$

+",9854,,,,,11/29/2020 10:37,,,,4,,,,CC BY-SA 4.0 +14898,1,15676,,11/29/2020 13:13,,6,158,"

From Nielsen and Chuang's book: $\textit{Quantum computation and quantum information}$, how can (5.34) equal (5.33)? I.e.

+

$$\dfrac{1}{2} \int_{e-1}^{2^{t-1}-1} dl \dfrac{1}{l^2} = \dfrac{1}{2(e-1)}.$$

+",13968,,8623,,11/30/2020 21:22,1/25/2021 20:49,"In Nielsen and Chuang, how can $\frac{1}{2(e-1)}$ result from $\frac12\int_{e-1}^{2^{t-1}-1}dl\frac{1}{l^2}$?",,1,6,,,,CC BY-SA 4.0 +14899,1,14901,,11/29/2020 14:33,,2,87,"

I have recently started with quantum computing and created a quantum teleportation circuit to transmit a qubit state from q_0 to q_2 using Qiskit.

+

I understand that I can transmit any state information from q_0 to q_2. Is it then fair to expect that I can also transmit a morse code like string of 0s and 1s (say 1001)? +This is the circuit I built after watching/reading Qiskit tutorials.

+",13983,,55,,11/30/2020 10:48,11/30/2020 10:48,Can I teleport a string of 0s and 1s?,,1,2,,,,CC BY-SA 4.0 +14900,1,,,11/29/2020 17:44,,4,241,"

A paper Three-dimensional surface codes: Transversal gates and fault-tolerant architectures discusses 3D surface codes and shows that

+
+

CZ and CCZ gates are transversal in [these] codes.

+
+

They give a small example in Appendix A. +I'm a bit confused by some of the parameters. There are three codes listed there; each is $[[12,1,2]]$.

+

So does that mean that the "overall code" acts on 36 qubits? In that case how are the three codes +"stitched" together to form the bigger code? Alternatively, if I have some $[[n,k,d]]$ code, how do +I check if it can implement a CZ,CCZ,CCCZ,...gate or not?

+",12265,,9006,,11/30/2020 7:52,11/30/2020 7:52,Which codes can implement transversal non-Clifford gates,,0,2,,,,CC BY-SA 4.0 +14901,2,,14899,11/29/2020 18:42,,1,,"

As you noticed, the first thing you do is to put the $q_0$ to the state you want to teleport to $q_2$. For instance, if you want to transport $|1\rangle$ to $q_2$ then you would first apply the $X$ gate to flip $q_0$ to the state $|1\rangle$.

+

+

This is because the initial state of a quantum computer is usually starts in the state $|000\cdots0\rangle$. Thus, if you want to teleport $1$ then apply $X$ gate to $q_0$ in the beginning, if you want to teleport $0$ then do nothing.

+
+

So if you insist to design a program in Qiskit to generate a quantum circuit to teleport a morse code of some sort, you can do it as follow:

+
%matplotlib inline
+from qiskit import QuantumCircuit, execute, BasicAer, IBMQ
+from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+from numpy import pi
+
+def teleported_circuit(code):
+    qreg_q = QuantumRegister(3, 'q')
+    creg_c = ClassicalRegister(1, 'c')
+    circuit = QuantumCircuit(qreg_q, creg_c)
+    if code == 1:
+        circuit.x(qreg_q[0])
+    circuit.barrier(range(3))
+    circuit.h(qreg_q[1])
+    circuit.cx(qreg_q[1], qreg_q[2])
+    circuit.cx(qreg_q[0], qreg_q[1])
+    circuit.h(qreg_q[0])
+    circuit.barrier(range(3))
+    circuit.cx(qreg_q[1], qreg_q[2])
+    circuit.cz(qreg_q[0], qreg_q[2])
+    circuit.measure(qreg_q[2], creg_c[0])
+    backend = BasicAer.get_backend('statevector_simulator')
+    job = execute(circuit, backend, shots = 1)
+    return job.result().get_counts()
+
+#### Example #### 
+code_string = [1,0,0,1,1,1]
+teleported_code = [ teleported_circuit(code_string[i]) for i in range(len(code_string)) ]
+print('Here is your telported code:', teleported_code)
+
+

The output would be:

+
Here is your telported code: [{'1': 1}, {'0': 1}, {'0': 1}, {'1': 1}, {'1': 1}, {'1': 1}]
+
+",9858,,,,,11/29/2020 18:42,,,,1,,,,CC BY-SA 4.0 +14902,2,,14765,11/29/2020 20:49,,8,,"

No dimension-independent bound is possible.

+

Consider states $\rho_A$ and $\sigma_A$ that are close in $p$-norm (for $p>1$) but have relatively low fidelity. Specifically, assume +$$ +\|\rho_A - \sigma_A\|_p = \varepsilon +$$ +and +$$ +\operatorname{F}(\rho_A,\sigma_A) += \bigl\|\sqrt{\rho_A}\sqrt{\sigma_A}\bigr\|_1 = \delta, +$$ +where $\varepsilon$ is small and $\delta$ is bounded away from 1. I'll give a specific example below.

+

The maximal fidelity between purifications $\Phi_{AB}$ and $\Psi_{AB}$ is also equal to $\delta$, so the minimal trace norm of the difference between purifications is bounded as follows: +$$ +\bigl\|\Phi_{AB} - \Psi_{AB}\bigr\|_1 \geq 2 \sqrt{1 - \delta^2}, +$$ +with equality when the purifications are chosen optimally.

+

Now the key is that the operator $\Phi_{AB} - \Psi_{AB}$ has rank equal to 2 (assuming the two states are not equal, which we get from $\delta <1$). Thus, for any choice of $p\in[1,\infty]$, we obtain +$$ +\bigl\|\Phi_{AB} - \Psi_{AB}\bigr\|_p +\geq \frac{1}{2} \bigl\|\Phi_{AB} - \Psi_{AB}\bigr\|_1 +\geq \sqrt{1 - \delta^2}, +$$ +which is not small when $\delta$ is bounded away from 1.

+

As an extreme example, choose $n$ to be a large positive integer and define states in $2n$ dimensions like this: +$$ +\rho_A += \frac{1}{n}\sum_{k=1}^n |k\rangle\langle k| +$$ +and +$$ +\sigma_A += \frac{1}{n}\sum_{k=n+1}^{2n} |k\rangle\langle k|. +$$ +These states are close in $\infty$-norm when $n$ is large, +$$ +\varepsilon = \bigl\|\rho_A - \sigma_A\|_{\infty} = \frac{1}{n}, +$$ +and because they are orthogonal their fidelity is zero: $\delta = 0$. The minimal $\infty$-norm between two purifications is therefore at least $1$, which obviously exceeds any constant factor times $\varepsilon$.

+",1764,,,,,11/29/2020 20:49,,,,0,,,,CC BY-SA 4.0 +14903,1,14904,,11/29/2020 21:38,,1,162,"

I am trying to implement a basic quantum computing emulator. In the chapter on Grover's algorithm, we're shown the following circuit:

+

+

They demonstrate Grover's algorithm with a function $f$ that picks out $101$, i.e. $f(101)=1$ and $0$ otherwise. They start with $\psi_{1}=[1, 0, 0, 0, 0, 0, 0, 0]^{T}$. The Hadamard gate (specifically H tensored with itself $n$ times) gives $\psi_{2}=1/\sqrt8 [1, 1, 1, 1, 1, 1, 1, 1]^{T}$. This is as far as I've come. They don't show explicitly how to get to $\psi_{3}$, which should be $1/\sqrt8 [1, 1, 1, 1, 1, -1, 1, 1]^{T}$. I am not sure how to interpret the circuit.

+

My best guess was to take the tensor product of $|0 \rangle=|000 \rangle$ and $|1 \rangle = [0, 1]^{T}$, then apply $I_{2^{n}} \otimes H$, then $U_{f}$. However, I have two problems:

+

The book says that, at that stage in the calculation, $\psi_{3} = 1/\sqrt8 [1, 1, 1, 1, 1, -1, 1, 1]^{T}$, which has length $8$, instead of $16$. I don't know how to "extract" the "top" qubits. Furthermore, my answer is $1/4[1, 1..., 1]^{T}$, which doesn't suggest the correct answer (especially given the fact that every entry is $1/4$).

+

Am I misinterpreting this circuit? What is the correct way to go from $\psi_{2}$ to $\psi_{3}$, from a programmatic point of view?

+",13987,,13987,,11/30/2020 14:08,11/30/2020 14:08,"Question about a circuit from ""Quantum Computing for Computer Scientists""",,2,0,,,,CC BY-SA 4.0 +14904,2,,14903,11/30/2020 1:31,,2,,"

Have you tried Quirk? It can handle things like extracting the tensor factor of intermediate states for you, so you get a sense of what you should be getting as the answer.

+

+

In general, the tensor factor may not exist because the extra qubit could be entangled with the part you're trying to extract. But if it's not entangled, which in this case it's not, then you just look at the subset of the state vector where the extra qubit is 0 and that's your answer (after normalizing) (or, if the part of the state vector where the extra qubit is 0 is all amplitudes zero, look at the subset where the extra qubit is 1).

+

To be more specific, what you do is group the state vector into parts keyed by the state of qubits you're not including. You then pick the part with the largest 2 norm as your reference part. This is the result you will return, normalized to have 2-norm of 1, if the state is not entangled. The state is not entangled if all the parts are parallel to each other. To verify lack of entanglement in a numerically stable way, you sum up the dot products of the reference part with all the parts (including itself). If the sum of dot products has a magnitude of 1, the state is not entangled. The sum's magnitude will get smaller as entanglement increases, though it won't necessarily get to zero.

+",119,,119,,11/30/2020 1:42,11/30/2020 1:42,,,,0,,,,CC BY-SA 4.0 +14905,2,,14903,11/30/2020 9:46,,2,,"

As you have read, Grover's Algorithm consists of starting in an equal superposition and the applying two gates, $U_\omega$ and $U_s$, $\sqrt{n}$ times where $n$ is the number of elements.

+

You are looking on how to implement $U_\omega$ which gets from state $\psi_2$ to $\psi_3$. This is called a phase flipping oracle since it adds a phase of $e^{i\pi} = -1$ to the basis state which represents the correct element. The best way to do so is to apply an $X$ gate to a $|-\rangle = \frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)$ to a separate allocated qubit, when you recognize that it is the correct basis states. This tutorial describes how do implement this gate for a graph coloring problem in Q#.

+

To answer some of your other questions :

+
    +
  • The state vector is of length 8 since there are 3 qubits which gives $2^3 = 8$ basis states.
  • +
  • To implement $U_s$, here is a question which shows how to implement it in basic gates
  • +
+",8746,,,,,11/30/2020 9:46,,,,0,,,,CC BY-SA 4.0 +14906,1,14908,,11/30/2020 12:21,,4,203,"

I wrote a circuit that makes use of Toffoli gates, but it is too inefficient for my purpose.

+

In my circuit the states of control qubits are fixed to $|+\rangle$ state. So I wanted to know if there is an efficient way to realize a Toffoli for that fixed case.

+",8954,,8954,,12/1/2020 15:45,12/16/2020 17:38,Is there an efficient way to realize a Toffoli with control qubits fixed at $|+\rangle$?,,1,0,,,,CC BY-SA 4.0 +14907,2,,14887,11/30/2020 14:33,,6,,"

There are two different things at play here: (i) superdense coding and (ii) Holevo's bound.

+
    +
  1. Holevo's bound tells us that $n$ qubits can only store $n$ bits of information. See for example, this answer: How can the Holevo bound be used to show that $n$ qubits cannot transmit more than $n$ classical bits?
  2. +
  3. Superdense coding allows us to send 2 bits of information using a single qubit in the presence of preshared entanglement. This is not the same as 1 qubit being "equal" to 2 bits of information.
  4. +
+",1108,,,,,11/30/2020 14:33,,,,7,,,,CC BY-SA 4.0 +14908,2,,14906,11/30/2020 17:10,,6,,"

If one of your controls is in the plus state, or your target is in the zero state, you can decompose inline using four T gates instead of seven T gates. For example, this circuit outputs the same thing as applying a Toffoli:

+

+

(Of course if you input a state other than $|+\rangle$ for that second qubit, the result won't be correct.)

+

I don't think it's possible to further reduce the cost of the circuit, even by specifying more individual inputs (other than of course the trivial ones like doing nothing because a control is known to be off or switching to a better gate set). The reason I don't think it's possible is because you can create a magic state by acting on the state where both controls are $|+\rangle$ and the target is $|0\rangle$. You can use this magic state to apply a Toffoli to an arbitrary state via gate teleportation. So any improvement in the special case is actually an improvement in the general case. Also there are results around needing some minimum number of T states to produce a Toffoli state (e.g. Table 1 of https://arxiv.org/abs/1904.01124 says that the Tof-from-T conversion rate is somewhere between 3.63 and 4).

+",119,,119,,12/16/2020 17:38,12/16/2020 17:38,,,,7,,,,CC BY-SA 4.0 +14910,1,14918,,11/30/2020 20:01,,9,472,"

I'm reading Huang et al. (2020) (nature physics), where the authors present a version of Aaronson's shadow tomography scheme as follows (see page 11 in the arXiv version):

+

We want to estimate a state $\rho$. We apply a number of random unitary evolutions, $\rho\mapsto U\rho U^\dagger$, picking $U$ from an ensemble $\mathcal U$. For each choice of unitary $U$, we perform a measurement, observing a state $|b\rangle$. We then apply the inverse evolution to this state, obtaining $U^\dagger|b\rangle$. On average, this procedure leaves us with the state +$$\mathcal M(\rho) =\mathbb E_{U\sim\mathcal U}\Bigg[ + \sum_b \underbrace{\langle b|U\rho U^\dagger|b\rangle}_{\text{prob of observing $|b\rangle$}} \!\!\!\!\!\!\! + \overbrace{(U^\dagger |b\rangle\!\langle b|U)}^{\text{post-measurement state}} +\Bigg].$$ +The claim is then that $\mathcal M$ can be inverted to obtain, on average, the original state: +$$ + \hat\rho=\mathcal M^{-1}(U^\dagger |\hat b\rangle\!\langle \hat b| U) + \,\,\text{ is such that } \,\, \mathbb E[\hat \rho]=\rho. +$$

+

Is there an easy way to see how one would go in performing such inversion? The authors mention that we are thinking here of $\mathcal M$ as a linear map, so I suppose we represent $\rho$ as a vector in some operatorial basis of Hermitians, which is fine, but to then perform the inversion of this linear map we would need to characterise it, which in this case I think would mean to know the values of $\mathcal M(\sigma_i)$ for some complete basis of Hermitians $\{\sigma_i\}_i$.

+",55,,55,,12/1/2020 9:14,12/2/2020 8:57,"In shadow tomography, how is the state reconstructed from its shadows?",,2,2,,,,CC BY-SA 4.0 +14911,2,,14867,11/30/2020 20:37,,0,,"

Could you try this as an alternative?

+
from qiskit import QuantumCircuit
+from qiskit.circuit import Parameter, Gate
+
+
+class UHGate(Gate):
+    def __init__(self, theta, label=None):
+        super().__init__('U', 2, [theta], label=label)
+        
+        
+    def _define(self):
+        qc = QuantumCircuit(2)
+        qc.unitary(self.to_matrix(), [0, 1])
+        
+        self.definition = qc
+        
+    def to_matrix(self):
+        t = float(self.params[0])
+        a = np.exp(-2j * t)
+        c = np.cos(2 * t)
+        s = -1j * np.sin(2 * t)
+
+        return np.array([[a, 0, 0, 0], 
+                         [0, c, s, 0], 
+                         [0, s, c, 0],
+                         [0, 0, 0, a]])
+
+
+t = Parameter('θ')
+qc = QuantumCircuit(2)
+qc.append(UHGate(t), [0, 1])
+
+

The idea is to 'delay' the building of the unitary gate to the point where you have available the values of the unbound parameters.

+

Another option is to manually decompose the unitary operator into 1 and 2-qubit gates that Qiskit natively supports and can be parameterized.

+",13109,,,,,11/30/2020 20:37,,,,0,,,,CC BY-SA 4.0 +14912,2,,12611,11/30/2020 21:59,,2,,"

The only reason why we are using STO-nG for quantum computing is because current quantum hardware have limited number of qubits. If we have an ideal quantum computer with many qubits, we wouldn't want to use STO-3G but rather a more sophisticated basis set.

+

Here are some examples of the qubit requirement to represent the electronic Hamiltonian of $H_2$, $LiH$ and $H_2O$ using both STO-3G or cc-pVDZ (correlation-consistent poralized valence only double zeta) basis set under Jordan-Wigner transformation.

+

+

As you can see, we don't have the quantum resources to actually solve the electronic structure problem outside of the minimal basis set (STO-ng) at the moment. We have limited number of qubits, and the qubits we have are noisy!

+

Many literature papers seem to indicate "Chemical accuracy" calculation on quantum computer using STO-3G, and this might be the confusion... because what they ought to say is "Chemical precision". They are obtaining result within 1 mHA comparing to the exact diagonalization of the electronic Hamiltonian under STO-3G basis set discretization. But the true result maybe way off if the molecular system is complicated.

+

So in conclusion, we only use STO-3G because of the restriction we have with current quantum hardware. Not because it is better.

+

It should be noted that the graph showing the required qubits above is not taking into different qubit reduction techniques like qubit tapering and etc. People have been and are working on different quantum resource reduction schemes ( for example: here or here and many more..) to get the number of qubits required to represent a particular problem down... so they can run this particular problem on current quantum hardware.

+",9858,,9858,,12/1/2020 1:00,12/1/2020 1:00,,,,0,,,,CC BY-SA 4.0 +14913,2,,13361,12/1/2020 3:34,,2,,"

One naive way is based from this paper, Cloud Quantum Computing of an Atomic Nucleus, by adding odd number of CNOTs gate to the circuit and do extrapolation. It is kinda hand wavy and you hope that it will gives you something closer to the true result.

+

So let's say your original circuit is:

+

+

Here you have 1 CNOT gate. Then you would perform another execution using a longer but identical circuit:

+

+

Here you have 3 CNOT gates. At this point, you use the two results to do your extrapolation.

+",9858,,,,,12/1/2020 3:34,,,,0,,,,CC BY-SA 4.0 +14915,2,,14910,12/1/2020 7:16,,3,,"

This is not a complete answer but a couple of comments that should help clarify these details:

+

(i) $\mathcal{M}$ is not invertible as a quantum channel but as a linear map; namely, even though the inverse exists, $\mathcal{M}^{-1}$ is not CP, even though it is a linear map. Assuming the input-output dimensions are the same, the only CP maps that are invertible are unitaries. This is the same problem that arises when studying dynamical semigroups for Markovian evolutions, they are described as a family $\{ e^{t \mathcal{L}} \}_{t \geq 0}$ where $\mathcal{L}$ is the Lindbladian; clearly $e^{-t \mathcal{L}}$ is the inverse, but it is not CP.

+

(ii) The authors assume ``tomographic completeness,'' that is, for each $\sigma \neq \rho, \exists U \in \mathcal{U} \text{ s.t. } \langle b| U \sigma U^{\dagger} | b \rangle \neq \langle b| U \rho U^{\dagger} | b \rangle$ which ensures that $\mathcal{M}^{-1}$ exists and is unique.

+

(iii) The classical shadow, $\hat{\rho}$ is not necessarily positive semidefinite since it originates from the application of a not CP map on some state.

+

(iv) $\mathcal{M}^{-1}$ is applied to the classically stored measurement outcomes, $U^{\dagger} | \hat{b} \rangle \langle \hat{b} | U$ and not the quantum states themselves.

+",1108,,,,,12/1/2020 7:16,,,,3,,,,CC BY-SA 4.0 +14917,1,,,12/1/2020 11:06,,2,506,"

I am executing a quantum circuit on an IBM quantum device and I need to start a timer as soon as the job in the queue starts running. I have already used:

+
result = job.result() 
+execution_time = result.time_taken
+
+

but in this particular case what I need is more like a "signal", like a variable that is switched on as soon as the queue is over and causes the timer to start. I tried using the job status but it didn't seem to work.

+",13893,,55,,12/10/2020 8:41,12/10/2020 8:41,How to measure a quantum circuit's execution time on a real IBM device?,,1,0,,,,CC BY-SA 4.0 +14918,2,,14910,12/1/2020 11:33,,7,,"

Under the assumption that the ensemble $\mathcal{U}$ faithfully produces the Haar expectations at least to the second moment, the inversion can be performed as suggested in the last paragraph of the question:

+

Define:

+

$$\theta_b = U^{\dagger}|b\rangle\langle b| U$$

+

and replace the averaging over the ensemble by Haar averaging. (This step is is done only to compute the resulting quantity. In practice we average over the ensemble):

+

$$\mathcal{M}(\rho) = \int d\mu_{\small{HARR}} \sum_b \mathrm{Tr}(\rho \theta_b) \theta_b$$

+

($d\mu_{\small{HARR}} $ is normalized to a unit volume). Suppose that we need to measure the expectation of an operator $O$ in the state $\rho$. We measure this operator in the final state average the expectations over the ensemble and the computational basis projectors, we obtain the following result:

+

$$\mathrm{Tr}(\mathcal{M}(\rho) O) = \int d\mu_{\small{HARR}} \sum_b \mathrm{Tr}(\rho \theta_b) \mathrm{Tr}(O \theta_b)$$

+

Using the following identity:

+

$$\int d\mu_{\small{HARR}} \mathrm{Tr}(\rho \theta_b) (O \theta_b) = \frac{ \mathrm{Tr}(\rho) \mathrm{Tr}(O)+ \mathrm{Tr}(\rho O) }{N(N+1)}$$

+

($N$ is the dimension of the Hilbert space), thus we obtain:

+

$$\mathrm{Tr}(\mathcal{M}(\rho) O) = \frac{ \mathrm{Tr}(O)+ \mathrm{Tr}(\rho O) }{(N+1)}$$

+

From which the required expectation $\mathrm{Tr}(\rho O)$ can be computed.

+

Of course, we can repeat the procedure for a complete basis of the Lie algebra $\mathfrak{u}(N)$ for a full tomography of $\rho$.

+

Explanation of the integration formula

+

$\theta_b = U^{\dagger}|b\rangle\langle b| U$ is a one-dimensional projector can be written as:

+

$$\theta_b = |\Psi \rangle\langle\Psi|$$

+

where $ |\Psi\rangle$ is a unit vector

+

When $U$ uniformly scans the unitary group manifold, $ |\Psi\rangle$ will uniformly scan a $2N-1$ dimensional round sphere. This is because the metric of a round sphere is Haar. Thus, we need to evaluate an integral of the form:

+

$$\int_{S^{2N-1} }\langle\Psi| A |\Psi \rangle \langle\Psi| B |\Psi\rangle d\mu_{\small{ROUND}}(S^{2N-1}) $$

+

The integrand is a homogeneous polynomial of the components of the unit vector $ |\Psi\rangle = \sum_{a=1}^N \psi_a |a\rangle$:

+

$$\langle\Psi| A |\Psi \rangle \langle\Psi| B |\Psi\rangle = \sum_{a,b,c,d} A_{ab} B_{cd} \bar{\psi_a}\bar{\psi_c}\psi_b \psi_d$$

+

Integrals of homogeneous polynomials on the sphere can be evaluated as Gaussian integrals up to an overall normalization, which can be computed from a trivial particular example. In this case we can use the Wick's theorem:

+

+

The constant can be evaluated by taking $A=B=I_{N\times N}$, we get:

+

$$\mathrm{Const.} = \frac{1}{N(N+1)}$$

+",4263,,4263,,12/2/2020 8:57,12/2/2020 8:57,,,,2,,,,CC BY-SA 4.0 +14919,1,14922,,12/1/2020 12:08,,3,254,"

I am executing a quantum circuit on an IBM quantum device. The circuit is simple:

+

A single qubit (start from $|0\rangle$),

+
    +
  1. Rx($\pi/2$)
  2. +
  3. Measure (in z) +3 .Rx($-\pi/2$)
  4. +
  5. Measure (in z)
  6. +
+

The final measurement probabilities should be +Prob:1/2, result:0; Prob:1/2, result:1.

+

But the simulation results are always Prob:1, result:0. It is as if the simulator is ignoring the first measurement. So my question is how to implement a quantum measurement in the middle of a quantum circuit on IBMQ?

+",13997,,55,,12/10/2020 8:41,12/10/2020 8:41,IBMQ: Can I implement a quantum measurement in the middle of a quantum circuit?,,1,2,,,,CC BY-SA 4.0 +14920,1,,,12/1/2020 12:37,,1,56,"

I was reading a paper Quantum Polar codes by Mark M. Wilde, where he discusses the N uses of the channel in the classical-quantum channel setting. What does he mean by "multiple channel uses"?

+

In the above context I want to use a depolarization channel $\Delta_{\lambda}$ [1](https://en.wikipedia.org/wiki/Quantum_depolarizing_channel) over which $N$ qubits are transmitted. To accomplish this task I have two ideas given below, and I am not sure if either one of them is correct.

+

Two options:

+
    +
  1. Should I evolve each of $N$ qubits by $\Delta_{\lambda}(\rho_i)$ indivisually and then do a tensor $\hat{\rho_i}\bigotimes\hat{\rho_{i+1}}\bigotimes,...,\bigotimes\hat{\rho_N}$,to get final state
  2. +
  3. Or should I input a composite state first and the evolve it as +$\Delta_{\lambda}(\rho^{\otimes N}) = \lambda\rho^{\otimes N}+\frac{1- \lambda}{2^N}I_{(2^N X \,2^N)}$
  4. +
+

+",13996,,13996,,12/2/2020 11:12,12/2/2020 11:12,"What does it mean ""the N uses of classical-quantum channel""?",,0,5,,,,CC BY-SA 4.0 +14921,2,,14917,12/1/2020 13:28,,2,,"

result.time_taken is the execution time. There is also job.time_per_step() that gives you the timestamps of each step of the job's life cycle.

+

If you're looking to set some variable locally in your program, the best you can do is probably use job status. job.wait_for_final_state() supports a callback function that you can use to set the variable when status changes.

+",12195,,,,,12/1/2020 13:28,,,,2,,,,CC BY-SA 4.0 +14922,2,,14919,12/1/2020 16:08,,2,,"

If you start with $|\psi\rangle$ in the state $|0\rangle$ and apply $Rx(\pi/2)$ gate to it, which is the following circuit,

+

+

Your qubit is now in the state $|\psi \rangle = \dfrac{|0\rangle - i|1\rangle}{\sqrt{2}}$. If you are making a measurement at this step,

+

+

then you qubit state $|\psi\rangle$ will collapsed onto one of the eigenstate $|0\rangle$ or $|1\rangle$. In this case, it will have $\dfrac{1}{2}$ probability of collapsing into either $|0\rangle$ or $|1\rangle$ since $\bigg| \dfrac{1}{\sqrt{2} } \bigg|^2 = \dfrac{1}{2} $ and $\bigg| \dfrac{-i}{\sqrt{2} } \bigg|^2 = \dfrac{1}{2} $.

+

So after the measurement, you have two possible results:

+
    +
  1. $|\psi \rangle = |0\rangle$

    +
  2. +
  3. $|\psi \rangle = |1\rangle$

    +
  4. +
+

In either case, if you are making another measurement here, then you will guarantee to collapsed into that particular state with $100\%$ probability. That is, if you your qubit collapsed to the state $|0\rangle$ after the first measurement, then the second measurement will reads out the state $|0\rangle$ with $100\%$ probability (assuming that there is no noise of course). And if you your qubit collapsed to the state $|1\rangle$ after the first measurement, then the second measurement will reads out the state $|1 \rangle$ with $100\%$ probability.

+

Now if you are running this experiments many times, then you will see that the probabilistic result on the first measurement will of course effect the readout of the second measurement. That is if you run the following circuit:

+

+

$10,000$ times then you expect $5000$ times it will be in the state $|0\rangle$ and $5000$ times is in the state $|1\rangle$, if there is no noise... but because of noise we will deviate from these numbers a bit. We can test this with the qasm_simulator from Qiskit on the circuit above:

+

+

Here is the code:

+
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+from numpy import pi
+from qiskit import QuantumCircuit, BasicAer, execute
+from qiskit.visualization import plot_histogram
+%matplotlib inline
+
+qreg_q = QuantumRegister(1, 'q')
+creg_c = ClassicalRegister(1, 'c')
+circuit = QuantumCircuit(qreg_q, creg_c)
+
+circuit.rx(pi/2, qreg_q[0])
+circuit.measure(qreg_q[0], creg_c[0])
+circuit.measure(qreg_q[0], creg_c[0])
+
+backend = BasicAer.get_backend('qasm_simulator')
+job = execute(circuit, backend, shots = 10000)
+print('Counts of experiment:', job.result().get_counts())
+plot_histogram(job.result().get_counts(), color='black', title="Result")
+
+
+

If you want to reset your qubit, that is you want to put it back to a particular state, then you can first use the reset function in Qiskit to first put the qubit to the state $|0\rangle$ then do some operation in follow to get the qubit to that particular state.

+

For instance, if you have some 1 qubit quantum circuit, and we want to reset it back to the state $|1\rangle$, then we can do the following:

+

+

The operation reset is indicated by the $|0\rangle$ symbol on the circuit. This put your qubit back to the state $|0\rangle$. Then by applying the $X$ gate (denoted as $U_3(\pi, 0 , \pi)$ on the circuit) to it, you put your qubit back to the state $|1\rangle$. So now, if you are making a measurement here, you will get a readout of the state $|1\rangle$ with $100 \%$ probability.

+

Here is the code to generate the circuit:

+
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+from numpy import pi
+
+qreg_q = QuantumRegister(1, 'q')
+creg_c = ClassicalRegister(1, 'c')
+circuit = QuantumCircuit(qreg_q, creg_c)
+
+circuit.rx(pi/2, qreg_q[0])
+circuit.t(qreg_q[0])
+circuit.s(qreg_q[0])
+circuit.reset(qreg_q[0])
+circuit.x(qreg_q[0])
+circuit.decompose().draw( 'mpl',style={'name': 'bw'}, plot_barriers= False, initial_state = True, scale = 1)
+
+
+

Update after comment: To implement a $R_x(\pi/4)$ if the first measurement outcome is $|0\rangle$, and a $R_x(\pi/8)$ if the first outcome is $|1\rangle$ we can use c_if operation. The circuit is the following:

+

+

However, I don't think this is implementable on hardware yet. Below is the code:

+
from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
+from numpy import pi
+from qiskit import QuantumCircuit, BasicAer, execute
+from qiskit.visualization import plot_histogram
+%matplotlib inline
+
+qreg_q = QuantumRegister(1, 'q')
+creg_c = ClassicalRegister(1, 'c')
+circuit = QuantumCircuit(qreg_q, creg_c)
+
+circuit.rx(pi/2, qreg_q[0])
+circuit.measure(qreg_q[0], creg_c[0])
+circuit.rx(pi/4, qreg_q[0]).c_if(creg_c, 0)
+circuit.rx(pi/8, qreg_q[0]).c_if(creg_c, 1)
+circuit.measure(qreg_q[0], creg_c[0])
+
+backend = BasicAer.get_backend('qasm_simulator')
+job = execute(circuit, backend, shots = 1)
+print('Counts of experiment:', job.result().get_counts())
+plot_histogram(job.result().get_counts(), color='black', title="Result")
+
+",9858,,9858,,12/2/2020 3:06,12/2/2020 3:06,,,,3,,,,CC BY-SA 4.0 +14923,1,14924,,12/1/2020 20:26,,2,1366,"

Applying the Hadamard gate twice in a row, it restores the original input: +

+

https://algassert.com/quirk#circuit={%22cols%22:[[%22H%22],[%22H%22]]}

+

However, if a CNOT control is added between the two Hadamard gates, the output of the second Hadamard gate changes:

+

+

https://algassert.com/quirk#circuit={%22cols%22:[[%22H%22],[%22%E2%80%A2%22,%22X%22],[%22Chance%22],[%22H%22]]}

+

I can't understand the behavior of the second Hadamard gate: the input has remaining $\frac{|0\rangle+|1\rangle}{\sqrt{2}}$ and the gate does not seem to have any effect.

+",13982,,13982,,12/1/2020 20:31,12/1/2020 21:52,A CNOT between two Hadamard gates: why does the CNOT changed the output of the second Hadamard gate?,,1,0,,,,CC BY-SA 4.0 +14924,2,,14923,12/1/2020 21:11,,4,,"

This is because the CNOT gate created an an entangled state and the system after the CNOT gate can't be written individually. That is, you can't stay that your first qubit is in the state $\dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$ anymore.

+

That is consider the circuit:

+

+

Here $q_0 $ and $q_1$ both start in the state $|0\rangle$. So you start with the initial state $|\psi\rangle_{init} = |0\rangle \otimes |0\rangle = |00\rangle$.

+
    +
  1. By first applying the Hadamard gate on the first qubit put the system in the state $|\psi \rangle_0 = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}} \otimes |0\rangle = \dfrac{|00\rangle + |10\rangle}{\sqrt{2}}$. Here you can say that your first qubit $q_0$ is in the state $|q_0 \rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$ and your second qubit $q_1$ is in the state $|q_1\rangle = |0\rangle$.
  2. +
+
+
    +
  1. Then, applying the CNOT gate here with the controlled-qubit being $q_0$ and target qubit being $q_1$ puts the state in $|\psi \rangle_1 = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}} $. +Note that you can no longer can write $|\psi \rangle_1 = |q_0 \rangle \otimes |q_1\rangle$. That is, you can't say that the first qubit is in the state $|q_0\rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$ and the second qubit in some state $|q_1\rangle$. They are entangled to one another.
  2. +
+
+
    +
  1. Lastly, if you apply the Hadamard gate to the first qubit, which is applying the operation $H \otimes I = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1\\ 1 &-1 \end{pmatrix} \otimes \begin{pmatrix} 1 & 0\\ 0 & 1 \end{pmatrix} $ to the state $|\psi \rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}} = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1\\ 0 \\ 0 \\1 \end{pmatrix} $ +we will get the final state +$|\psi\rangle_{final} = \dfrac{|00\rangle + |01\rangle + |10\rangle - |11\rangle}{2} = \dfrac{1}{2} \begin{pmatrix} 1\\ 1 \\ 1 \\-1 \end{pmatrix}$
  2. +
+

This is the reason why you see that you have $50\%$ probability of measuring the first qubit $q_0$ in the state $|0\rangle$ and $50\%$ probability of measuring it in the state $|1\rangle$.

+",9858,,9858,,12/1/2020 21:52,12/1/2020 21:52,,,,0,,,,CC BY-SA 4.0 +14925,1,,,12/2/2020 4:15,,3,63,"

Say I have a qubit in the state (ignoring normalization) $$|\phi\rangle = \alpha|0\rangle + e^{i\alpha}\beta|1\rangle.$$ +How can I invert the sign of its phase, thus making it $$\alpha|0\rangle + e^{-i\alpha}\beta|1\rangle$$ using only the basic gates $\{X,Y,Z,H,S\}?$

+",14005,,55,,12/10/2020 8:40,12/10/2020 8:40,How to change the sign of a phase: sending $\alpha|0\rangle+e^{i\alpha}\beta|1\rangle$ to $\alpha|0\rangle+e^{-i\alpha}\beta|1\rangle$?,,1,4,,,,CC BY-SA 4.0 +14926,1,,,12/2/2020 7:54,,2,43,"

I need to optimize a general version of 3$\rightarrow$1 QRAC where Bob is asked to retrieve one of the XOR combinations of the bits( If ABC is the given string to Alice, then Bob would be asked to retrieve one of the following functions, namely, A, B, C, A$\oplus$B, A$\oplus$c, B$\oplus$C, A$\oplus$B$\oplus$C). I know that build in optimization in Mathematica could be used for this kind of stuff, but I'm unsure how to proceed.

+

Kindly ask if you have any confusion regarding my problem. Thanks

+",13591,,,,,12/3/2020 10:38,Numerical optimization of QRAC,,1,0,,,,CC BY-SA 4.0 +14927,1,,,12/2/2020 8:48,,4,1449,"

By using the Qiskit qasm-simulator, I want to simulate a quantum circuit of 40 qubits. However, the number of qubits 40 is greater than maximum number (24) for qasm-simulator. Is there any possibility to increase this number?

+",14007,,16606,,3/20/2022 0:07,3/20/2022 0:07,Maximum number of qubits supported by the Qasm simulator,,2,2,,,,CC BY-SA 4.0 +14928,2,,14927,12/2/2020 9:24,,0,,"

If you use ibmq_qasm_simulator then the maximum number of qubit supported is 32. And you can't increase this number. Here is Qiskit documentation on this simulator.

+

Remember that simulating quantum system is very resource extensive, and being able to simulating a system with 32 qubits is pretty impressive.

+",9858,,,,,12/2/2020 9:24,,,,2,,,,CC BY-SA 4.0 +14929,1,18175,,12/2/2020 9:31,,6,199,"

Consider two $n$ qubit Haar-random quantum states $|\psi\rangle$ and $|\phi\rangle$. Let $D_{|\psi\rangle}$ and $D_{|\phi\rangle}$ be the two probability distributions (over $n$-bit strings) obtained by measuring $|\psi\rangle$ and $|\phi\rangle$ respectively, in the standard basis. I had two questions:

+
    +
  1. What can we say about the total variation distance between $D_{|\psi\rangle}$ and $D_{|\phi\rangle}$ (with some probability over the choice of a particular $|\psi\rangle$ and $|\phi\rangle$)?
  2. +
  3. Are $D_{|\psi\rangle}$ and $D_{|\phi\rangle}$ computationally/statistically indistinguishable (again with some probability over the choice of a particular $|\psi\rangle$ and $|\phi\rangle$)?
  4. +
+

EDIT: I managed to prove that they are not statistically indistinguishable, with overwhelming probability. However, are they computationally indistinguishable?

+",1351,,1351,,12/3/2020 3:08,6/29/2021 11:14,How close or far apart are the distributions generated by two Haar random states?,,1,0,,,,CC BY-SA 4.0 +14930,2,,14925,12/2/2020 9:31,,4,,"

This very much depends on whether you know the phase $\alpha$ (which I assume is not intended to be the same as the amplitude $\alpha$!).

+

If you do not know the phase $\alpha$, then the operation that you're asking about is the transpose. This is well known to be physically impossible (it's typically the first example given if you read about completely positive maps).

+

If you know $\alpha$, then the gate you need to implement is +$$ +\left(\begin{array}{cc} 1 & 0 \\ 0 & e^{-2i\alpha} \end{array}\right). +$$ +If you have a universal set of gates available, this is no problem. If you only have the Clifford gates available, as you seem to be suggesting, you can only make this work if $\alpha=\pm\pi/4,\pm\pi/2$, corresponding to the operations $S$ and $Z$ respectively I've left out some $\pi$ factors as you can consider them as signs incorporated into the $\beta$).

+",1837,,,,,12/2/2020 9:31,,,,0,,,,CC BY-SA 4.0 +14931,2,,14927,12/2/2020 9:31,,4,,"

Actually, the maximum number of qubits in the local qasm_simulator is 30, and 32 for the ibmq_qasm_simulator. You can see this 30-limit by running Aer.get_backend('qasm_simulator').configuration().to_dict() and you can see the configuration for the simulator, including the max number of qubits.

+

However, I believe it is possible to play with the matrix product state option to get a little bit more, I am not sure, I invite you to check this tuto from Qiskit, they might go through it :)

+

EDIT : Actually the 24-limit comes from BasicAer, I invite you to use the simulators from Aer, or the ibmq_qasm_simulator that have better limits. You can also play with the backend options, see in this documentation from Qiskit that explains pretty much everything there is to know!

+

Hope this helps :)

+",12396,,12396,,12/2/2020 10:37,12/2/2020 10:37,,,,0,,,,CC BY-SA 4.0 +14932,1,14995,,12/2/2020 17:02,,3,115,"

Given two states $\rho_A, \sigma_A$, Uhlmann's theorem states that the fidelity between them is achieved in the following way

+

$$F(\rho_A, \sigma_A) = \max_{U_{R'}}F(\rho_{AR'}, (I\otimes U_{R'})\sigma_{AR'})$$

+

where $U_{R'}$ are unitary operators and $\rho_{AR'}, \sigma_{AR'}$ are arbitrary purifications.

+

Instead of purifications, let us consider extensions of the state. That is, let $\rho_{AR}$ (possibly a mixed state) satisfy $\text{Tr}_R(\rho_{AR}) = \rho_A$ and $\sigma_{AR}$ (possibly a mixed state) satisfy $\text{Tr}_R(\sigma_{AR}) = \sigma_A$. I am aware of the following fact (5.33 of these notes): For any fixed extension $\rho_{AR}$ we have +$$F(\rho_A, \sigma_A) = \max_{\sigma_{AR}}\{F(\rho_{AR}, \sigma_{AR}) : \text{Tr}_R(\sigma_{AR}) = \sigma_A\} \tag{1}$$ +Let $\sigma^*_{AR}$ be the state that achieves the maximum above.

+

Questions

+
    +
  1. How is $\sigma^*_{AR}$ related to an arbitrary extension $\sigma_{AR}$? If they were purifications, one had the simple fact that they were related by a unitary on $R$.

    +
  2. +
  3. If $|R|$ was large enough that there exist pure extension states $\sigma_{AR}$, then is $\sigma^*_{AR}$, the extension that achieves the maximum in $(1)$, also pure?

    +
  4. +
+",4831,,4831,,12/4/2020 17:06,12/5/2020 16:43,Fidelity of extensions of states,,1,0,,,,CC BY-SA 4.0 +14933,1,,,12/2/2020 18:47,,5,535,"

According to the tutorial https://qiskit.org/textbook/ch-algorithms/grover.html I understand the mathematical principle of diffusion operator:

+

$$ +\begin{equation} +\begin{split} +U_s&=2\left|s\right\rangle\left\langle s\right|-I \\ +&=H^{\otimes n}U_0H^{\otimes n} \\ +&=H^{\otimes n}\left(2\left|0\right\rangle\left\langle 0\right|-I\right)H^{\otimes n} \\ +&=H^{\otimes n}\begin{bmatrix}1 & & & \\ & -1 & & \\ & & \ddots & \\ & & & -1\end{bmatrix}H^{\otimes n} +\end{split} +\end{equation} +$$

+

For example, for two qubits

+

$$\left|s\right\rangle=\frac{1}{2}\left(\left|00\right\rangle+\left|01\right\rangle-\left|10\right\rangle+\left|11\right\rangle\right)=\frac{1}{2} +\begin{pmatrix}1 \\ 1 \\ -1 \\ 1 \end{pmatrix}$$

+

applying the diffusion operator and we got

+

$$H^{\otimes 2}U_0H^{\otimes 2}\frac{1}{2} +\begin{pmatrix}1 \\ 1 \\ -1 \\ 1 \end{pmatrix}=\begin{pmatrix}0 \\ 0 \\ 1 \\ 0 \end{pmatrix}$$

+

where +$$H^{\otimes 2}=\begin{bmatrix}1 & 1 & 1 & 1 \\ 1 & -1 & 1 & -1 \\ 1 & 1 & -1 & -1 \\1 & -1 & -1 & 1 \end{bmatrix}$$

+

So far this transformation is working well, it reflected the states of $s$ as expected. But it is difficult for me to understand the role played by the Hadamard gate here. How to prove or explain the following equation?

+

$$2\left|s\right\rangle\left\langle s\right|-I=H^{\otimes n}\left(2\left|0\right\rangle\left\langle 0\right|-I\right)H^{\otimes n}$$

+

or

+

$$ +\left|s\right\rangle\left\langle s\right|=H^{\otimes n}\left|0\right\rangle\left\langle 0\right|H^{\otimes n} +$$

+",13982,,13982,,12/3/2020 7:14,12/3/2020 11:18,How to understand intuitively the Grover diffusion operator?,,2,1,,,,CC BY-SA 4.0 +14934,1,14999,,12/2/2020 20:00,,3,543,"

I am a new user of Qiskit and I believe there is a simple answer to my question but I have had a very hard time finding a straightforward answer. I am trying to transform a given $3 \times 3$ (Hermitian) Hamiltonian matrix into a qubit operator and then use the built-in VQE solver for evaluating the minimum eigenvalue for said matrix.

+

I have been successful in doing something similar using the qiskit.chemistry.FermionicOperator built-in class (see example below) but for this example the Hamiltonian is mapped to a Fermionic one-body qubit Hamiltonian which has $2^n$ eigenvalues instead of $n$ eigenvalues (where $n=3$ for this case). I am hoping there is a simple way to directly map a matrix to a qubit operator. My vague understanding is I need to write the matrix as a sum of weighted Pauli operators but I would expect there would exist some predefined function for doing this? (I have looked at the source code for the FermionicOperator class but it did not help me much).

+
import numpy as np
+import scipy
+import h5py
+
+from qiskit.aqua.algorithms import VQE, NumPyEigensolver
+from qiskit.chemistry import FermionicOperator
+from qiskit import Aer
+
+backend = Aer.get_backend("qasm_simulator")
+
+c1=1
+c2=2
+c3=3
+
+ff=np.zeros((3,3))
+ff[1,1]=2
+ff[2,2]=1
+
+n=3
+
+Hamil=np.zeros((n,n))
+Hamil[1,1]=c2
+Hamil[2,2]=-c3/2+c2
+Hamil[0,2]=np.sqrt(2)*c1
+Hamil[1,2]=np.sqrt(2)*c1
+Hamil[2,0]=np.sqrt(2)*c1
+Hamil[2,1]=np.sqrt(2)*c1
+
+vals,vecs=np.linalg.eig(Hamil)
+
+print("Standard Eigenvalues: ")
+print(vals)
+
+Hamil_op = FermionicOperator(h1=Hamil)
+Hamil_ops = Hamil_op.mapping(map_type='parity', threshold=1e-12)
+result = NumPyEigensolver(Hamil_ops,k=int(2**n)).run()
+
+print("Quibit Eigenvalues=")
+print(result['eigenvalues'])
+
+vqe = VQE(operator=Hamil_ops)
+vqe_result = np.real(vqe.run(backend)['eigenvalue'])
+print("VQE Eigenvalue")
+print(vqe_result)
+
+

With result:

+
Standard Eigenvalues:
+[-1.45426242  0.90078898  3.05347344]
+Quibit Eigenvalues=
+[-1.45426242+0.j -0.55347344+0.j  0.        +0.j  0.90078898+0.j
+  1.59921102+0.j  2.5       +0.j  3.05347344+0.j  3.95426242+0.j]
+VQE Eigenvalue
+0.18608074335373637
+
+",14009,,55,,12/10/2020 8:41,12/10/2020 8:41,Using Qiskit VQE for solving an eigenvalue problem,,1,5,,,,CC BY-SA 4.0 +14935,2,,14933,12/2/2020 20:17,,3,,"

It is often described as flipping the number around the mean. Lets take example with real numbers (normally these are complex numbers). For example, we have an array of 4 elements and we want to find element 3. We will start in an equal superposition. We have : $$|\psi\rangle = [\frac{1}{2}, \frac{1}{2}, \frac{1}{2}, \frac{1}{2}]$$ When we apply $U_\omega$ we will flip ("add a minus") to the 3rd number : $$|\psi\rangle = [\frac{1}{2}, \frac{1}{2}, -\frac{1}{2}, \frac{1}{2}]$$ When we apply Grover's diffusion operator, we take the mean/average : $$a = \frac{3*\frac{1}{2}-\frac{1}{2}}{4}=\frac{1}{4}$$ When we do the inversion around the mean of a number $v$, we do $-v+2*a$ which gives us : $$-\frac{1}{2}+(2*\frac{1}{4})=0$$ and $$-(-\frac{1}{2})+(2*\frac{1}{4})=1$$. If we do this for every element, this gives us : $$|\psi\rangle = [0, 0, 1, 0]$$ As you can see, we just increased the probability to measure the correct element and decreased the probability of the incorrect elements. This of course is a very simple example, but it demonstrates the effect really well. This is the same example as in the section 6.4 of quantum computing for computer scientists. If you have any more questions, please write a coment !

+",8746,,,,,12/2/2020 20:17,,,,2,,,,CC BY-SA 4.0 +14936,1,22099,,12/2/2020 22:40,,8,161,"

The Childs, Kthari, and Rolando (2017) (CKS) algorithm can solve the quantum linear systems problem (QLSP) in $\operatorname{poly}(\log N, \log(1/\epsilon))$ time while the HHL algorithm solves it in $\operatorname{poly}(\log N, 1/\epsilon)$ time. So, if the CKS algorithm is superior, then why is the HHL more popular?

+

Additionally, are there any examples of the CKS algorithm being used to solve a system of equations on a real or simulated quantum computer?

+",13244,,13244,,11/28/2021 23:15,11/28/2021 23:15,Why is HHL the popular choice to solve QLSP and not the Childs et al. (2017) algorithm?,,1,3,,,,CC BY-SA 4.0 +14937,2,,14855,12/2/2020 23:01,,1,,"

A current limitation of the extensions (both VS and VS Code) is that they are only able to deal with exactly one workspace folder, and anything outside that folder doesn't exist as far as the extension is concerned. I suspect you are opening the folder with the test project in VS Code, correct? If so, then the extension is unaware of the src folder, since that folder is not contained in the workspace folder (the test folder). If you instead open a folder that contains both the src and the test folder, then everything should work fine.

+",12864,,,,,12/2/2020 23:01,,,,3,,,,CC BY-SA 4.0 +14938,1,,,12/2/2020 23:32,,1,54,"

I am trying to find out about the mechanism of measurement in IBM Q devices. To be specific, if I apply two Hadamard gates on the first qubit and identity on the second then is it possible to immediately measure so that the second qubit is not affected by the second Hadamard on the first qubit? +Also, are measurements on qubits simultaneous? Does it differ with devices?

+",12967,,55,,12/10/2020 8:44,12/10/2020 8:44,Mechanism of measurement in IBM quantum devices,,1,1,,,,CC BY-SA 4.0 +14939,2,,14938,12/3/2020 1:05,,2,,"

I don't know if this is what you are looking for but I will try to write out what I see.

+
+

If you are thinking of a circuit like this:

+

+

Then the gates on the first qubit, $q_0$, will not be affected the second qubit at all as they not interacting with one another. The entire system is in a separable state. So it doesn't really matter when you make the measurement on the second qubit, the result will be the same.

+

Now, if you actually run this on the quantum computer then I don't think the measurement is actually being executed until after the second Hadamard gate on the first qubit has been executed. You can check the pulse schedule for the circuit above:

+

+

Now, if you looking at a circuit that have entangled gate between the two qubits,

+

+

then the measurement on the second qubit $q_1$ won't be executed until the second Hadamard gate is being executed as well. But again, the Hadamard gate on the first qubit won't affect the second qubit as it only acts on the first qubit. Hence, it is fine that the measurement is being executed after the second Hadamard gate have been applied to $q_0$. The result won't change.

+
+

Also, if you have a circuit like:

+

+

Then the Hadamard gate on the second qubit, $q_1$, won't be executed until when the 4th Hadamard gate is being executed on the first qubit. This is because if we apply the Hadamard gate to the second qubit too early, it will idling for a long time and more decoherence effects will take place.

+",9858,,,,,12/3/2020 1:05,,,,3,,,,CC BY-SA 4.0 +14940,1,14941,,12/3/2020 1:11,,5,532,"

If there're four qubits in my circuit, how can I arrange my gates so that the final output state is a superposition of all the possible states of 4 qubits? (there're 16 of them in total). I've tried some 2-qubits circuits to generate the superposition states like $|\Psi^+\rangle$ and $|\Phi^-\rangle$, but I'm not exactly sure if there's a way to create the superposition of all the possible states.

+",12334,,9006,,12/3/2020 13:26,12/3/2020 13:26,Is there a way to create a superposition of all the possible states?,,1,2,,,,CC BY-SA 4.0 +14941,2,,14940,12/3/2020 1:17,,9,,"

Do you mean mapping the state $|0\rangle^{\otimes n} \to \dfrac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n-1} |i\rangle $ ?

+

If that is the case then you can just apply $H^{\otimes n}$ to the state $|0\rangle^{\otimes n}$. That is, you apply a Hadamard gate to each of the qubit.

+

The reason for this is $H |0\rangle = \dfrac{|0\rangle + |1\rangle}{\sqrt{2}}$ and so

+

\begin{align} \overbrace{H|0\rangle \otimes H|0\rangle \otimes \cdots \otimes H|0\rangle}^{n \ \textrm{times}} &= \overbrace{ \bigg( \dfrac{|0\rangle +|1\rangle}{\sqrt{2} } \bigg)\otimes \bigg( \dfrac{|0\rangle +|1\rangle}{\sqrt{2} } \bigg) \otimes \cdots \otimes \bigg( \dfrac{|0\rangle +|1\rangle}{\sqrt{2} } \bigg) }^{n \ \textrm{times}} \\ +&= \dfrac{1}{\sqrt{2^{n}}}\big( \overbrace{ |00\cdots0\rangle + |00\cdots1\rangle + \cdots + |11\cdots 1\rangle }^{2^n \ \textrm{terms} } \big)\\ +&= \dfrac{1}{\sqrt{2^n}}\sum_{i=0}^{2^n-1} |i\rangle +\end{align}

+",9858,,9858,,12/3/2020 1:27,12/3/2020 1:27,,,,10,,,,CC BY-SA 4.0 +14942,2,,14933,12/3/2020 7:46,,2,,"

Like @Jonathcraft mentioned, the diffusion operator inverts the probability amplitudes about their mean. What is equally important to note is that the inversion about the mean is the same as a reflection of the state-vector about the state $|u\rangle = \frac{1}{2^{n/2}}\sum_x\lvert x\rangle$, which is the equal superposition of all the basis states for an n-qubit system.

+

To understand this, consider the general state $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$:

+
    +
  • Flipping the amplitudes about the mean ($\mu = \frac{\alpha+\beta}{2}$) would yield the state $|\psi\prime\rangle = \beta|0\rangle + \alpha|1\rangle$.
  • +
  • To reflect about the state $|u\rangle = \frac{1}{\sqrt{2}}{|0\rangle}+\frac{1}{\sqrt{2}}{|1\rangle}$, you would first have to find the angle between $|\psi\rangle$ and $|u\rangle$, and then rotate $|\psi\rangle$ by twice that angle. You can verify using the general $2\times 2$ rotation matrix that this yields $|\psi\prime\rangle$.
  • +
+

Now, to answer your question about the presence of the Hadamard Gate -

+

When you want to reflect a given state about the equal superposition over all basis states $|u\rangle$, the easy way to think about it is using these 3 steps:

+
    +
  1. Transform $|u\rangle$ into $|0\rangle^n$ - This is achieved by applying the Hadamard Transform to all $n$ qubits.
  2. +
  3. Reflect your vector (which would also have been transformed by the application of the Hadamard transform) about $|0\rangle^n$. The matrix for this is $diag_n(1, -1, -1, ..., -1)$.
  4. +
  5. Transform $|0\rangle ^n$ back to $|u\rangle$ to reverse what you did in the first step. Since the Hadamard gate is its own inverse, this is equivalent to repeating Step 1.
  6. +
+

Putting it all together, the diffusion operator is given by:

+

$$ +H^{\otimes n} \begin{bmatrix}1 & & & \\ & -1 & & \\ & & \ddots & \\ & & & -1\end{bmatrix} H^{\otimes n} +$$

+",8955,,8955,,12/3/2020 11:18,12/3/2020 11:18,,,,0,,,,CC BY-SA 4.0 +14943,2,,14926,12/3/2020 10:38,,1,,"

Mathematica cannot handle this, as there is no algorithm that will deterministically achieve the global optimum. What you can do is do local optimization for several choices of initial points, and from that hopefully get the global optimum.

+

The algorithm normally used in this case is the see-saw. The idea is that your probability of success is a bilinear function of the states and observables. For a fixed choice of observables, the probability of success is a linear function of the states, which is trivial to optimize, and for a fixed choice of states the probability of success is a linear function of the observables, which is again trivial to optimize. You choose then randomly some initial observables, get the optimal states for them, then for these states obtain the optimal observables, then for these states get the optimal observables, and so on, until you converge.

+

More precisely, the probability of success is given by +$$p_\text{succ} := \sum_{x,y,b} c_{xyb} \operatorname{tr} \rho_x E^b_y,$$ where $\rho_x$ will be the 8 different states you use to encode the bits, and $\{E^0_y,E^1_y\}$ the 7 different POVMs that should get the functions you want. The coefficients $c_{xyb}$ are then determined by the functions.

+

Define then +$$ A^b_y := \sum_{x} c_{xyb} \rho_x $$ +and +$$ B_x:= \sum_{y,b} c_{xyb} E^b_y,$$ +so that +$$p_\text{succ} = \sum_{x} \operatorname{tr} \rho_x B_x = \sum_{yb} \operatorname{tr} A^b_y E^b_y. $$ +Then a given choice of observables determines $B_x$, and you get the optimal states for them by maximizing $\sum_{x} \operatorname{tr} \rho_x B_x $, and a given choice of states determines $A^b_y$, and you get the optimal observables for them by maximizing $\sum_{yb} \operatorname{tr} A^b_y E^b_y$.

+",12541,,,,,12/3/2020 10:38,,,,0,,,,CC BY-SA 4.0 +14944,1,,,12/3/2020 11:18,,4,127,"

I have been trying to implement a QAOA for solving a traveling salesman problem (TSP) using qulacs and python. However, even for 3 cities, the implementation fails. Within QAOA, we try to minimise +$$ +\begin{equation} +F_p(\gamma,\beta) = \langle \gamma,\beta | C | \gamma,\beta\rangle, +\end{equation} +$$ +where $C$ is the cost function of the TSP, and $|\gamma,\beta\rangle$ is a quantum state depending on these two angles. I had a closer look at my classical optimisation of the angles $\beta, \gamma$, for which I used the scipy.optimize.minimize function with the Nelder-Mead method. I realised that the resulting optimal angles are highly dependent on the initial angles. Additionally, I had a look at my cost function $C$. It seems like the optimisation got stuck in many local minima.

+

I have seen several implementations of a QAOA TSP using other software frameworks, and most of them also used scipy.optimize.minimize for the angles optimisation. Is getting stuck in local minima a known issue for QAOA TSP, or do I have to search for another error source? If the first, how can I overcome this issue?

+",13925,,55,,12/10/2020 8:45,1/5/2021 22:22,Classical optimisation of angles in QAOA for TSP gets stuck in local minima?,,1,0,,,,CC BY-SA 4.0 +14945,1,14949,,12/3/2020 14:40,,1,154,"

I created a $|0\rangle$ state then applied $H$ gate to get $\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$ and then I meausred my state. But I always found 1. +I expected to find 0 and 1 uniformly random like the case of beam splitter.

+

Here is my code:

+
qubit = cirq.NamedQubit("myqubit")
+circuit = cirq.Circuit(cirq.H(qubit))
+for i in range(10):
+    result2 = cirq.measure(qubit, key='myqubit')
+    print(result2)
+print(circuit)
+# run simulation
+result = cirq.Simulator().simulate(circuit)
+print("result:")
+print(result)
+print(result2)
+
+

How can I find uniformly random result ?

+",13548,,55,,12/10/2020 8:45,12/10/2020 8:45,Why is the Measurement Result Always 1? (expected to find uniformly random measurement),,2,0,,,,CC BY-SA 4.0 +14946,1,,,12/3/2020 14:46,,2,99,"

I have an evolved quantum composite state $\hat{\rho}^{\otimes{N}}$ that I retrieved from a quantum channel $\mathcal{E}$, Now I do know how to define a POVM for the evolved states $\hat{\rho}$ that the channel outputs one by one. But how can I define POVM for composite quantum state.

+

Suppose I embed $X = [1,0,1,1]$ classical information into $\rho_i$ as follows:

+

$\rho_0 = \begin{pmatrix} +0 & 0 \\ +0 & 1 +\end{pmatrix}\rightarrow for \; x_0=1, \\ \rho_1 = \begin{pmatrix} +1 & 0 \\ +0 & 0 +\end{pmatrix} \rightarrow for \; x_1=0, \\\rho_2 = \begin{pmatrix} +0 & 0 \\ +0 & 1 +\end{pmatrix}\rightarrow for \; x_2=1, \\\rho_3 = \begin{pmatrix} +0 & 0 \\ +0 & 1 +\end{pmatrix} \rightarrow for \; x_3=1,$

+

Now each of the $\rho_i^N$ evolves when $\mathcal{E}$ is applied and we get respective $\hat{\rho_i}^N$, I tensor the evolved states and retrieve a composite quantum state as $\hat{\rho_i}^{\otimes{N}}$ with $dXd$ square matrix where $d=2^N$. +Now, how can I define POVM measurements to get the classical information back?

+",13996,,55,,12/10/2020 8:45,12/10/2020 8:45,How to define POVM measurement operators for a composite quantum state,,0,1,,,,CC BY-SA 4.0 +14947,1,14948,,12/3/2020 15:26,,0,99,"

Give the following input: +$$ +A: 1110 \\ +B: 0111 \\ +\text{indicator}: 0 \text{ or } 1 +$$ +How do I copy the value of A or B to target qubits if indicator is 0 or 1 respectively?

+

In the image below, the indicator=0 so the value of the copy_of_a_or_b qubits should resemble a_input qubits:

+

+

How can I do this in Qiskit?

+",13729,,55,,12/10/2020 8:46,1/22/2021 19:08,Coping values based on indicator qubit in Qiskit,,2,0,,,,CC BY-SA 4.0 +14948,2,,14947,12/3/2020 15:56,,0,,"

It seems you are looking for a classical operation called multiplexer. It is possible to build such operation with Qiskit's uniformly controlled gates (UCGate). More info in here.

+

However, this way might not be the easier way. After reading Cryoris' answer, here is my version of your example (which piggyback on Cryoris' great answer):

+

Let's set your current circuit:

+
from qiskit import *
+
+a_input = QuantumRegister(4, name='a')
+b_input = QuantumRegister(4, name='b')
+
+inputs = QuantumCircuit(a_input, b_input)
+
+inputs.initialize('1110', a_input)
+inputs.initialize('0111', b_input)
+
+inputs.draw('mpl')
+
+

+

(side note, if your run inputs.decompose().draw('mpl') you will notice that the order of the $X$ gates are going to be "in reverse". That's because Qiskit endianness.)

+

Now, time to create the multiplexer. This scales up the Cryoris' answer:

+
from qiskit.circuit.library import CXGate
+
+indicator = QuantumRegister(1, name='indicator')
+a_or_b = QuantumRegister(4, name='aORb')
+
+multiplexer = QuantumCircuit(a_input, b_input, indicator, a_or_b)
+for i in range(4):
+    # If indicator is 0, copy from A
+    multiplexer.append(CXGate().control(1, ctrl_state='0'), [indicator, a_input[i], a_or_b[i]])
+    
+multiplexer.barrier(a_input, b_input)
+
+for i in range(4):
+    # If indicator is 1, copy from B
+    multiplexer.append(CXGate().control(1, ctrl_state='1'), [indicator, b_input[i], a_or_b[i]])
+
+multiplexer.draw('mpl')
+
+

+

The register a_or_b needs to be measured:

+
output = ClassicalRegister(4, name='output')
+measure = QuantumCircuit(a_or_b)
+measure.measure_all(a_or_b)
+
+

The composed result:

+
circuit = inputs + multiplexer + measure
+circuit.draw('mpl')
+
+

+

Finally, we need to "set" the indicator qubit. Once circuit for each possibility:

+
indicator0 = QuantumCircuit(indicator)
+indicator0.initialize('0', indicator)
+
+indicator1 = QuantumCircuit(indicator)
+indicator1.initialize('1', indicator)
+
+

Time to test how it works:

+
job = execute(indicator0 + circuit, backend=BasicAer.get_backend('qasm_simulator'))
+job.result().get_counts().keys()
+
+
dict_keys(['1110'])
+
+
job = execute(indicator1 + circuit, backend=BasicAer.get_backend('qasm_simulator'))
+job.result().get_counts().keys()
+
+
dict_keys(['0111'])
+
+",1859,,1859,,12/3/2020 17:48,12/3/2020 17:48,,,,1,,,,CC BY-SA 4.0 +14949,2,,14945,12/3/2020 16:32,,0,,"

You are not measuring your qubit. Look at what your print(circuit) is returning

+
myqubit: ───H───
+
+

You need to add the measurement gate to the circuit like so:

+
circuit = cirq.Circuit(cirq.H(qubit), cirq.measure(qubit, key='myqubit'))
+
+

Printing this circuit returns myqubit: ───H───M───

+

In your case, with the loop; you can append the gates:

+
for i in range(10):
+    circuit.append(cirq.measure(qubit, key='myqubit'))
+
+

Printing this one returns myqubit: ───H───M───M───M───M───M───M───M───M───M───M───M───

+

Both programs will get you the expected uniform random measurements.

+",362,,362,,12/3/2020 17:22,12/3/2020 17:22,,,,5,,,,CC BY-SA 4.0 +14950,2,,14947,12/3/2020 16:34,,1,,"

"Copying" a bit value from one qubit to another in this sense means applying a $CX$ gate where the source qubit is the control. If you additionally want to control this operation on an indicator qubit you can add another control. Then you have a $CCX$ or Toffoli. If you use an "ordinary" or closed control, the bit value will be copied if the indicator is 1. If you sandwich the control with two $X$ gates however -- an open control -- it will copy when the indicator is 0. +In your case you could just apply two $CCX$ gates per bit where once you use an open control on the indicator and once a closed control on the indicator.

+

In circuits (for only one bit, for several qubits just repeat this operation):

+
>>> from qiskit import QuantumCircuit, QuantumRegister
+>>> from qiskit.circuit.library import XGate
+>>> qr_a, qr_b, qr_i, qr_t = QuantumRegister(1, 'a'), QuantumRegister(1, 'b'), QuantumRegister(1, 'indicator'), QuantumRegister(1, 'target')
+>>> circuit = QuantumCircuit(qr_a, qr_b, qr_i, qr_t)
+>>> open_ccx = XGate().control(2, ctrl_state='01')
+>>> closed_ccx = XGate().control(2)  # per default ctrl_state='00'
+>>> circuit.append(open_ccx, [qr_a, qr_i, qr_t])  # copy A if indicator is 0
+>>> circuit.append(closed_ccx, [qr_b, qr_i, qr_t])  # copy B if indicator is 1
+>>> circuit.draw()
+
+        a_0: ──■───────
+               │
+        b_0: ──┼────■──
+               │    │
+indicator_0: ──o────■──
+             ┌─┴─┐┌─┴─┐
+   target_0: ┤ X ├┤ X ├
+             └───┘└───┘
+
+

And now the nicer solution by using a blockwise control. Since Qiskit can control arbitrary operations we can just define our custom copy operation consisting of 4 $CX$ gates and then control this, once open and once closed. Like so:

+
>>> qr_a, qr_b, qr_i, qr_t = QuantumRegister(4, 'a'), QuantumRegister(4, 'b'), QuantumRegister(1, 'indicator'), QuantumRegister(4, 'target')
+>>> circuit = QuantumCircuit(qr_a, qr_b, qr_i, qr_t)
+>>> copy = QuantumCircuit(8)  # circuit to copy 4 bits
+>>> copy.cx(range(4), range(4, 8))
+>>> open_copy = copy.control(1, ctrl_state='0')
+>>> closed_copy = copy.control(1, ctrl_state='1')
+>>> circuit.append(open_copy, qr_i[:] + qr_a[:] + qr_t[:])
+>>> circuit.append(closed_copy, qr_i[:] + qr_b[:] + qr_t[:])
+
+

Hope that helps!

+",9800,,9800,,1/22/2021 19:08,1/22/2021 19:08,,,,1,,,,CC BY-SA 4.0 +14951,1,14953,,12/3/2020 16:46,,0,60,"

I've been receiving "Circuit runtime is greater than the device repetition rate [8020]" errors when running a relatively simple circuit on ibmq_16_Melbourne, but have had no issues whatsoever when running the same on the Aer backend simulator. The circuit size is 11 and depth is 6. Would anyone have any idea why this might be happening? Thank you!

+

Clarification: I am attempting to implement Shor's algorithm using the circuit image below. I have heard mentioned that the three large controlled multiplication gates are not necessary, but I am admittedly not clear on this as my results are much different without them. Any advice is greatly appreciated. +

+",14019,,16606,,3/20/2022 0:07,3/20/2022 0:07,Device Repetition Rate on Melbourne,,1,4,,,,CC BY-SA 4.0 +14952,2,,14945,12/3/2020 16:51,,1,,"

@Victory Omole already answered the question.

+

But here is the fixed code if you are interested.

+
qubit = cirq.NamedQubit("myqubit")
+circuit = cirq.Circuit()
+circuit = cirq.Circuit(cirq.H(qubit))
+circuit.append(cirq.measure(qubit, key='result'))
+print(circuit)
+s=cirq.Simulator()
+samples=s.run(circuit, repetitions=1000)
+print('Single measurement result:' ,samples.histogram(key='result'))
+
+print('****************************************')
+circuit2 = cirq.Circuit(cirq.H(qubit))
+for i in range(10):
+    circuit2.append(cirq.measure(qubit, key='myqubit'))
+print(circuit2)
+samples2 = s.run(circuit, repetitions=1000)
+print('Hadamard follows by 10 measurements result:' ,samples2.histogram(key='result'))
+
+

The output would be something like:

+
myqubit: ───H───M('result')───
+Single measurement result: Counter({0: 501, 1: 499})
+****************************************
+myqubit: ───H───M───M───M───M───M───M───M───M───M───M───
+Hadamard follows by 10 measurements result: Counter({1: 502, 0: 498})
+
+
+

Update: If you want to print out the counter, that is, accessing the result at each shot/experiment then you can do the following: (There is a better to do this probabbly but I don't really use cirq...)

+
samples2 = [s.run(circuit, repetitions=1) for i in range(10) ]
+samples2
+
+

The output would be something like:

+
[result=1,
+ result=0,
+ result=1,
+ result=1,
+ result=1,
+ result=0,
+ result=1,
+ result=0,
+ result=0,
+ result=0]
+
+",9858,,9858,,12/3/2020 17:43,12/3/2020 17:43,,,,3,,,,CC BY-SA 4.0 +14953,2,,14951,12/3/2020 17:10,,2,,"

The error Circuit runtime is greater than the device repetition rate [8020] is associate with the fact that your circuit is too deep. The device can't handle that many quantum operations.

+

The depth of 6 might not seems a lot but it can when pretty large when you map it to the real hardware device. This is because not all the qubits are connected in a quantum processor. Hence a lot of overhead swapping needs to be done.

+

For example: Consider this depth 6 random circuit.

+

+

You can create this random circuit with some fixed depth through Qiskit as follows:

+
from qiskit.circuit.random import random_circuit
+num_qubits = 11
+circuit_depth = 5
+max_operands = 3 #between 0 and 3
+measurement_all_qubit = True
+qc_random = random_circuit(num_qubits, circuit_depth, max_operands=max_operands, measure=measurement_all_qubit)
+print( 'original ircuit depth', qc_random.depth() )
+qc_random.draw( 'mpl',style={'name': 'bw'},  scale = 1, filename = 'random depth 6', plot_barriers= False, initial_state = True)
+
+
+

The above doesn't take into account the hardware connectivity issues. But if we are going to map this onto real hardware, like the ibmq_16_melbourne then it would get larger. In fact, it would translate to a circuit of depth of 108. Below is the transpiled circuit being mapped to ibmq_16_melbourne.

+

+

Here is the code for that transpilation process if you are interested:

+
provider = IBMQ.load_account()
+from qiskit.compiler import transpile
+Circuit_Transpile = transpile(qc_random, provider.get_backend('ibmq_16_melbourne') , optimization_level=3)
+print('Transpiled circuit depth', Circuit_Transpile.depth() )
+Circuit_Transpile.draw( 'mpl',style={'name': 'bw'}, filename = 'random transpiled', plot_barriers= False, initial_state = True, scale = 1)
+
+",9858,,9858,,12/3/2020 22:24,12/3/2020 22:24,,,,0,,,,CC BY-SA 4.0 +14955,1,14957,,12/3/2020 18:57,,2,174,"

I noticed that in QAOA the problem hamiltonian always consists of $Z$ and $I$ gates. But isn't QAOA a form of Adiabatic Programming? Where the idea is just to go from one ground state to another? +Does that not mean that every Hamiltonian can be the problem Hamiltonian?

+

And the Mixer consists always just of $X$ gates. Why not $Y$ gates for example?

+",11646,,4127,,12/3/2020 19:21,12/3/2020 19:33,Why does the problem Hamiltonian of QAOA always consist of $Z$ and $I$ gates?,,1,0,,,,CC BY-SA 4.0 +14957,2,,14955,12/3/2020 19:33,,2,,"

QAOA was first introduced as a quantum algorithm to tackle combinatorial optimization problems. Hence, there is a direct translation of these to Hamiltonians with $I$ and $Z$ operators. And you always see the mixer as just $X$ operators because

+
    +
  1. the equal-superposition state (obtained by Hadamard transform on $| 0\rangle^{\otimes N}$) is a ground state of the mixer (which is a requirement in adiabatic computing)
  2. +
  3. the type of problems tackled do not include constraints.
  4. +
+

However, other mixers can be used depending what one wants to solve (see this article on modifying the mixers for constrained combinatorial optimization problems).

+",4127,,,,,12/3/2020 19:33,,,,0,,,,CC BY-SA 4.0 +14958,2,,5164,12/3/2020 19:48,,1,,"

I have written a collection of C programs together with a python interface that satisfies most of the requiremets listed above. Documentation see section

+

https://mmgroup.readthedocs.io/en/latest/api.html#the-subgroup-2-1-24-co-1-of-the-monster-and-the-clifford-group

+

in +https://mmgroup.readthedocs.io/en/latest/ .

+

My motivation for doing so was that high-speed computation in the Clifford group $\mathcal{C}_{12}$ of 12 qubits is useful for computations in the monster group.

+",14018,,,,,12/3/2020 19:48,,,,0,,,,CC BY-SA 4.0 +14959,1,14960,,12/3/2020 21:23,,5,726,"

When uploading a QASM-file with ÒPENQASM 3.0; as first line, the code editor on quantum-computing.ibm.com will throw an error.

+

However the qiskit Python library doesn't support the new features (e.g. for-loops) of OPENQASM 3 either.

+

So where can I run an OPENQASM 3.0 file?

+",14022,,55,,12/10/2020 8:47,12/10/2020 8:47,How to run a OpenQASM 3.0 file?,,1,1,,,,CC BY-SA 4.0 +14960,2,,14959,12/3/2020 22:10,,6,,"

OpenQASM3 is in an early release stage for circulation for feedback in the quantum community. OpenQASM3 aims to be a standardized language proposal for near-term quantum computing hardware with real-time computing capabilities. We hope that it will lay the foundation for extracting tangible benefits from real quantum computers in the coming years by providing a straightforward interface for research in error-correction, classical/quantum algorithms, and control techniques. Information about the language can be found in the live specification. It is expected that this will evolve quite rapidly in the coming months. We value all feedback and accept issues or pull requests being submitted on the language specification repository.

+

A formal grammar and accompanying parser should be available shortly and will be found in the language repository. Work has begun to add support for the new functionality introduced in OpenQASM3 in Qiskit, simulators, and hardware backends. As support is rolled out it will be announced.

+",9863,,,,,12/3/2020 22:10,,,,1,,,,CC BY-SA 4.0 +14961,1,,,12/4/2020 0:11,,2,104,"

Question

+

If I tell you all the averages of powers of position and momentum in quantum mechanics can you tell me the value of the wave-function? What can you tell me about the wavefunction? Is there anything about this in the literature?

+

Attempted Proof

+

I'm uncertain about the proof (I think the answer is no) and it's validty but here's my attempt. Starting with the modulus of the the wave-function in position space:

+

$$ |\psi(x,t)|^2 = \psi(x,t)^* \psi(x,t)$$

+

Let us expand around $z$:

+

$$ |\psi(x,t)|^2 = \Big( \psi(z,t)^* + (x -z)\psi'(z,t)^* + \frac{(x -z)^{2}}{2!}\psi''(z,t )^* +\dots \Big )$$

+

$$\cdot \Big (\psi(z,t) + (x -z)\psi'(z,t) + \frac{(x -z)^{2}}{2!}\psi''(z,t)+\dots \big)$$

+

Multiplying the R.H.S brackets together. We will refer to the below equation as equation $\lambda$:

+

$$ |\psi(x,t)|^2 = | \psi(z,t)|^2 + (x -z)\psi'(z,t)^* \psi(z,t) + (x -z)\psi'(z,t) \psi(z,t)^* +\dots $$

+

Let us substitute $x \to z + c/(2N) \int_{-N}^N dz$ in equation $\lambda$:

+

$$ |\psi(z + \frac{c}{2N} \int_{-N}^N dz,t)|^2 \cdot 1 = | \psi(z,t)|^2 + (\frac{c}{2N} \int_{-N}^N dz)\psi'(z,t)^* \psi(z,t) + (\frac{c}{2N} \int_{-N}^N dz)\psi'(z,t) \psi(z,t)^* +\dots $$

+

Multiplying $2N$ both sides , rearranging terms and taking the limit $N \to \infty$:

+

$$ \lim_{N \to \infty} 2N (|\psi(z + \frac{c}{2N} \int_{-N}^N dz,t)|^2 - | \psi(z,t)|^2) = \lim_{N \to \infty} ( c \int_{-N}^N dz)\psi'(z,t)^* \psi(z,t) + ( c \int_{-N}^N dz)\psi'(z,t) \psi(z,t)^* +\dots $$

+

The R.H.S can be now expressed as a function of momentum averages as it has terms such as $\int_{-\infty}^\infty \psi'(z)\psi(z) dz$. Hence,

+

$$ \lim_{N \to \infty} 2N (|\psi(z + \frac{c}{2N} \int_{-N}^N dz,t)|^2 - | \psi(z,t)|^2) = f(c,z,\langle p \rangle, \langle p^2 \rangle, \langle p^3 \rangle, \dots) $$

+

Similarly if we define $\tilde \psi(p,t)$ in momentum space:

+

$$ \lim_{N \to \infty} 2N (|\tilde \psi(\tilde z + \frac{c}{2N} \int_{-N}^N d \tilde z,t)|^2 - | \tilde \psi(\tilde z,t)|^2) = g(c, \tilde z,\langle x \rangle, \langle x^2 \rangle, \langle x^3 \rangle, \dots) $$

+

We can compare powers of $c$ and learn something about the wavefunction.

+",5045,,5045,,12/4/2020 1:13,1/12/2021 15:12,Given averages of powers of position and momentum in quantum mechanics what information can be secured about the wave-function?,,2,5,,,,CC BY-SA 4.0 +14962,1,14963,,12/4/2020 5:05,,1,302,"
    +
  1. Given $|\psi \rangle = \dfrac{1}{\sqrt{3}}|00\rangle + \dfrac{1}{\sqrt{6}}|01\rangle + \dfrac{1}{\sqrt{2}}|11\rangle $ get the expected value of the situation at gate $Z$ for the quantum gate.

    +
  2. +
  3. Given $|\psi \rangle = \dfrac{1}{\sqrt{3}}|00\rangle + \dfrac{1}{\sqrt{6}}|01\rangle + \dfrac{1}{\sqrt{2}}|11\rangle $ get the expected value of the situation at gate $X$ for the quantum gate.

    +
  4. +
+

I couldn't find the right answer. Would you help me please?

+",14027,,55,,12/10/2020 8:51,12/10/2020 8:51,How to measure expectation values of $Z$ and $X$ on the given states?,,1,5,,12/14/2020 14:16,,CC BY-SA 4.0 +14963,2,,14962,12/4/2020 5:27,,2,,"

Given $|\psi \rangle = \dfrac{1}{\sqrt{3}}|00\rangle + \dfrac{1}{\sqrt{6}}|01\rangle + \dfrac{1}{\sqrt{2}}|11\rangle = \begin{pmatrix} \dfrac{1}{\sqrt{3}} \\ \dfrac{1}{\sqrt{6}} \\ 0 \\ \dfrac{1}{\sqrt{2}} \end{pmatrix} $ since $|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix} $ and $|1\rangle = \begin{pmatrix} 0 \\ 1\end{pmatrix} $

+

Now, we also have that $Z = \begin{pmatrix} 1 & 0\\ 0 & -1\end{pmatrix}$ then note that $Z|0\rangle = |0\rangle$ and $Z|1\rangle = -|1\rangle$. Hence

+

\begin{align} +\langle \psi | ZZ |\psi \rangle &= \bigg(\dfrac{1}{\sqrt{3}}\langle 00|+ \dfrac{1}{\sqrt{6}}\langle 01| + \dfrac{1}{\sqrt{2}}\langle 11|\bigg)Z Z \bigg(\dfrac{1}{\sqrt{3}}|00\rangle + \dfrac{1}{\sqrt{6}}|01\rangle + \dfrac{1}{\sqrt{2}}|11\rangle \bigg)\\ +&=\bigg(\dfrac{1}{\sqrt{3}}\langle 00|+ \dfrac{1}{\sqrt{6}}\langle 01| + \dfrac{1}{\sqrt{2}}\langle 11|\bigg) \bigg(\dfrac{1}{\sqrt{3}}ZZ|00\rangle + \dfrac{1}{\sqrt{6}}ZZ|01\rangle + \dfrac{1}{\sqrt{2}}ZZ|11\rangle \bigg)\\ +&=\bigg(\dfrac{1}{\sqrt{3}}\langle 00|+ \dfrac{1}{\sqrt{6}}\langle 01| + \dfrac{1}{\sqrt{2}}\langle 11|\bigg) \bigg(\dfrac{1}{\sqrt{3}}|00\rangle - \dfrac{1}{\sqrt{6}}|01\rangle + \dfrac{1}{\sqrt{2}}|11\rangle \bigg)\\ +&= \dfrac{1}{3}\langle 00| 00\rangle - \dfrac{1}{6}\langle 01|01\rangle + \dfrac{1}{2}\langle11|11\rangle = \dfrac{1}{3} - \dfrac{1}{6} + \dfrac{1}{2} = \dfrac{2}{3} +\end{align}

+

Also notice that

+

\begin{align} +\langle \psi | ZZ |\psi \rangle &= \begin{pmatrix} \dfrac{1}{\sqrt{3}} & \dfrac{1}{\sqrt{6}} & 0 & \dfrac{1}{\sqrt{2}} \end{pmatrix} +\begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & -1 & 0 & 0\\ 0 & 0 & -1 & 0\\ 0 & 0 &0 & 1\end{pmatrix} + \begin{pmatrix} \dfrac{1}{\sqrt{3}} \\ \dfrac{1}{\sqrt{6}} \\ 0 \\ \dfrac{1}{\sqrt{2}} \end{pmatrix} \\ +&= \begin{pmatrix} \dfrac{1}{\sqrt{3}} & \dfrac{1}{\sqrt{6}} & 0 & \dfrac{1}{\sqrt{2}} \end{pmatrix} \begin{pmatrix} \dfrac{1}{\sqrt{3}} \\ -\dfrac{1}{\sqrt{6}} \\ 0 \\ \dfrac{1}{\sqrt{2}} \end{pmatrix} = \dfrac{1}{3} - \dfrac{1}{6} + \dfrac{1}{2} = \dfrac{2}{3} +\end{align}

+

Similarly if we are consider $\langle \psi |XX| \psi\rangle$. Now, just replace $Z$ with $X$ for the computation where $X = \begin{pmatrix} 0 & 1\\ 1 & 0\end{pmatrix}$ and so $X|0\rangle = |1\rangle$ and $X|1\rangle = |0\rangle$.

+",9858,,,,,12/4/2020 5:27,,,,0,,,,CC BY-SA 4.0 +14964,1,14968,,12/4/2020 5:37,,6,682,"

How can I get a subspace of a quantum circuit? More precisely, I'm dealing with quantum circuit with data qubits ('q') and ancilla qubits ('anc'), such as $(q_0,q_1,...,q_n,anc_0,..anc_m)$.

+

After some quantum operations, I'd like to get a unitary matrix representation of the data qubits. Is this possible?

+",13527,,55,,12/10/2020 8:53,12/10/2020 8:53,How to get subspace of quantum circuit?,,1,1,,,,CC BY-SA 4.0 +14966,1,,,12/4/2020 8:09,,-2,121,"

How can I get this situation entangled on IBMQ experience?

+

$$|00\rangle:\\ +|01\rangle:\\ +|10\rangle:\\ +|11\rangle: +$$

+",14029,,1859,,12/4/2020 12:11,12/5/2020 9:10,How can I get $|00\rangle |01\rangle |10\rangle |11\rangle$ entangled on IBMQ experience?,,3,1,,,,CC BY-SA 4.0 +14967,1,15485,,12/4/2020 8:19,,3,238,"

What is the sign problem in quantum simulations and how do stoquastic Hamiltonians solve it? I tried searching for a good reference that explains this but explanations regarding what the sign problem is are very hand-wavy.

+

A related question, for stoquastic Hamiltonians are only off-diagonal terms zero or non-positive or are diagonal terms also zero and non-positive? Slide 2 here suggests all matrix terms are non-positive, but that means the diagonals have to all be zero, as a Hamiltonian is positive semi-definite and positive semi-definite matrices have non-negative diagonal entries.

+",1351,,1351,,12/4/2020 9:38,1/12/2021 9:17,Sign problem and stoquastic Hamiltonians,,2,0,,,,CC BY-SA 4.0 +14968,2,,14964,12/4/2020 8:43,,5,,"

What you are looking for is the partial trace of a density matrix, $|\psi\rangle\langle\psi|$, where $|\psi\rangle=|q_0,q_1,...,ac_0,ac_1,...\rangle$. This matrix is surely a unitary matrix, and it can be viewed as a tensor product of all the density matrices of each qubit.

+

To get a subspace of a quantum circuit, you have to partial trace over all the irrelevant qubits, in your case, $Tr_{ac}(|\psi\rangle\langle\psi|)$.

+

If you are using qiskit, see the lower code as an example:

+
from qiskit import QuantumCircuit,QuantumRegister
+from qiskit.quantum_info import DensityMatrix,partial_trace
+import numpy as np
+qr=QuantumRegister(2)
+circ=QuantumCircuit(qr)
+circ.h(qr[0])
+circ.cx(qr[0],qr[1])
+DM=DensityMatrix.from_instruction(circ)
+print(DM.data)
+PT=partial_trace(DM,[0])
+print(PT.data)
+
+

If you are not using the python package, and suppose you already got the density matrix of the entire quantum circuit, see the lower code(qiskit is again used to generate the density matrix, but I provide another function for partial trace in this place):

+
def partial_trace(rho,qubit2keep):
+    num_qubit=int(np.log2(rho.shape[0]))
+    for i in range(len(qubit2keep)):
+            qubit2keep[i]=num_qubit-1-qubit2keep[i]
+    qubit_axis=[(i,num_qubit+i) for i in range(num_qubit)
+                    if i not in qubit2keep]
+    minus_factor=[(i,2*i) for i in range(len(qubit_axis))]
+    minus_qubit_axis=[(q[0]-m[0],q[1]-m[1])
+                        for q, m in zip(qubit_axis,minus_factor)]
+    rho_res=np.reshape(rho,[2,2]*num_qubit)
+    qubit_left=num_qubit-len(qubit_axis)
+    for i,j in minus_qubit_axis:
+        rho_res=np.trace(rho_res,axis1=i,axis2=j)
+    if qubit_left>1:
+        rho_res=np.reshape(rho_res,[2**qubit_left]*2)
+    return rho_res
+from qiskit import QuantumCircuit,QuantumRegister
+from qiskit.quantum_info import DensityMatrix
+import numpy as np
+qr=QuantumRegister(2)
+circ=QuantumCircuit(qr)
+circ.h(qr[0])
+circ.cx(qr[0],qr[1])
+DM=DensityMatrix.from_instruction(circ)
+print(DM.data)
+PT=partial_trace(DM.data,[0])
+print(PT)
+
+

(Note that the partial_trace function is a rewritten of this one, the default sequence in this code and mine are reversed.)

+

The two codes give identical results. In PT=partial_trace(DM.data,[0]), [0] denotes +the qubit to be traced out, maybe some test should be helpful for you to trace out the qubits that you don't need correctly.

+",13647,,,,,12/4/2020 8:43,,,,1,,,,CC BY-SA 4.0 +14969,1,15397,,12/4/2020 9:02,,5,153,"

I am writing a piece of work on Grover's algorithm and I am looking for references on the phase-kickback trick to transform a state oracle in a phase oracle.

+

Is there any paper or there a part on it in Nielsen and Chuang ?

+",8746,,8746,,4/1/2021 9:23,4/1/2021 9:23,Resources and references about phase kickback trick,,1,1,,,,CC BY-SA 4.0 +14971,2,,14966,12/4/2020 10:40,,1,,"

I am not sure what you are looking for but if you are looking for how to get the state $|00\rangle$ to become an entangled state and I am assuming a maximal entangled state like a Bell-state $|\psi \rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}} $ then it is pretty simple. Just apply the Hadamard gate to the first qubit follow by CNOT gate. That is something like this:

+

+
from qiskit import QuantumRegister, QuantumCircuit
+%matplotlib inline
+
+qreg_q = QuantumRegister(2, 'q')
+creg_c = ClassicalRegister(2, 'c')
+circuit = QuantumCircuit(qreg_q, creg_c)
+circuit.h(qreg_q[0])
+circuit.cx(qreg_q[0], qreg_q[1])
+circuit.draw( 'mpl',style={'name': 'bw'}, scale = 1, initial_state = True)
+
+

Now if you want to put the state $|01\rangle$ into the same maximal entangled Bell-state as the one above, you can first flip the second qubit to get it back to $|0\rangle$ from $|1\rangle$... so now you are back the state $|00\rangle$ hence you can apply the same circuit as the one above.

+",9858,,,,,12/4/2020 10:40,,,,0,,,,CC BY-SA 4.0 +14972,2,,14967,12/4/2020 11:49,,3,,"

Stoquastic Hamiltonians have only non-positive off-diagonal terms, see for instance the abstract of this paper by Bravyi et al. The diagonal terms may be zero, but may also be stricly positive.

+

The sign problem is not restricted to only an appearance in quantum computing; it even stems from more general physics - check for instance this question and answer by user wsc on the physics stack exchange. The answer also links to this text by Troyer and Wiese.

+

My understanding is limited, but I know that it is closely correlated with Quantum Monte Carlo methods, which are methods of stochastic simulation of quantum mechanical systems that have been very effective, but only for Hamiltonians that do not suffer under the sign problem.

+",8141,,8141,,1/12/2021 9:17,1/12/2021 9:17,,,,4,,,,CC BY-SA 4.0 +14973,1,14982,,12/4/2020 16:56,,1,564,"

When I create a circuit using Qiskit and then transpile it using transpiled_circuit = transpile(circuit, ibm_backend, optimization_level=1) then I open my IBMQ account and go to circuit composer to draw the circuit and run it on the same backend, the transpiled circuit I got from the circuit composer is different from that from my qiskit code.

+

For example, I have the following circuit :

+

+

when I transpile it in my qiskit code +transpiled_circuit = transpile(circuit, provider.get_backend('ibmq_athens'), optimization_level=1) I got the following circuit :

+

+Using the IBMQ experience circuit composer I got the following transpiled circuit when I run using ibmq_athens

+

+

I tried different optimization levels in qiskit and the transpiled circuit is also different.

+

My question is how I can get a transpiled circuit in qiskit to be the same as the one returned from IBMQ experience circuit composer.

+",10495,,55,,12/10/2020 8:54,12/10/2020 8:54,How to transpile a circuit using Qiskit as done in IBMQ experience,,4,0,,,,CC BY-SA 4.0 +14974,2,,14973,12/4/2020 17:27,,0,,"

The reason why your transpiled circuit you got from the circuit composer is different from that from your qiskit code is because the native gates on IBM's quantum hardware only consists of CNOT, and single qubit gates ($U_1, U_2, U_3$ ); and furthermore NOT all the qubits are connected to one another.

+

For Athen, you have:

+

+

And so when you execute your CCNOT gate, you must decompose it to the hardware native set of gates. This can be done as:

+

+

So here when you have a CNOT between two qubits that are not connected, you have to do some overhead swapping which resulted in a much longer circuit than what you orginally have.

+

This is why part of the Quantum Volume metric is also influenced by the qubits connectivity. Less connectivity implies you have to do more overhead gate execution resulting in longer circuit depth which in turns require longer qubit coherence...

+",9858,,,,,12/4/2020 17:27,,,,9,,,,CC BY-SA 4.0 +14976,1,15011,,12/4/2020 19:11,,7,191,"

Suppose I have access to a pretty typical gate set, for example $\{\text{CNOT}, \text{SWAP}, \text{R}_{x}, \text{R}_{y}, \text{R}_{z}, \text{CR}_x, \text{CR}_y, \text{CR}_z\}$ where $\text{CR}$ is a controlled single-qubit rotation. I'm curious about decompositions of gates in the following forms: +$$ +U_1 = \begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & a & b & 0 \\ +0 & c & d & 0 \\ +0 & 0 & 0 & 1 +\end{pmatrix} \qquad +U_2 = \begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0& e & f \\ +0 & 0 & g & h +\end{pmatrix} +$$ +where all constants are real. It seems like these decompositions should be straightforward since $U_1$ has a similar form to $\exp{(i\theta \text{SWAP})}$ and $U_2$ has a similar form to $\exp{(i\theta \text{CNOT}})$. However I'm having difficulty getting rid of the imaginary coefficients that are a necessary result of the exponential generator.

+

Is there a straightforward way to find decompositions when the block form of a desired unitary with real coefficients is the same as an exponentiated member of the desired gateset?

+",1939,,10480,,3/10/2021 3:56,3/10/2021 3:56,Decomposing gates resembling exponentiated members of desired gateset,,3,3,,,,CC BY-SA 4.0 +14977,1,,,12/4/2020 20:08,,3,60,"

I understand the problem well enough and I'm trying to understand the algorithm, Shor's version. It's not easy to read the abstract descriptions available everywhere --- Shor's paper, Nielsen's book and many others. I will build a numerical example --- various numerical examples --- if none are available out there, but if you know any that will be a nice start.

+

If you don't know any, feel free to give me directions on how to build it. For instance, I have already understood that a key step to the algorithm is setting up two registers |a>|b> and then applying a circuit that takes |$a$>|$b$> to |$y\oplus g^a x^{-b}$>, where $g$ is a generator and $x$ is the number whose logarithm we want to find. (The computation is be reduced mod $p$.) (Of course, $y$ is to be initialized to zero.)

+

The next step is to compute the QFT, something I've never done and looks a bit difficult, so I will consider the previous step a mile stone for now. I think that at the previous step I will have a superposition of all possible values of the pair $(a,b)$ and so the QFT would only serve to amplify the states that are interesting.

+

As you can see, more than examples, I'm looking for careful steps and explanations. I'll appreciate any help on this.

+",14021,,55,,12/10/2020 8:54,12/10/2020 8:54,Is there an example of Shor's algorithm for the discrete log problem with concrete numbers anywhere?,,0,8,,,,CC BY-SA 4.0 +14978,2,,14973,12/4/2020 20:34,,1,,"

I was able to obtain similar results to your IQX output using the routing_method='sabre' and layout_method='sabre' options.

+",14041,,,,,12/4/2020 20:34,,,,0,,,,CC BY-SA 4.0 +14979,2,,14966,12/4/2020 21:51,,3,,"

Quantum entanglement is a state of 2 or more qubits where the quantum state of individual qubits cannot be described. on simple terms, you cannot identify the probability in which the qubit is going to collapse to 0 or 1.

+

Now to answer your question, There is one thing not clear about the circuit in your description.

+

What do the vectors $|00\rangle$, $|01\rangle$, $|10\rangle$, $|11\rangle$ represent?

+

Is it 2 qubit in super position (with 0 input and 2 hadamard gates) or 8 individual qubits?

+

If it is 2 qubits in superposition adding a simple cx gate as user KAJ226 mentioned will put it into an entangled bell state.

+

Assuming that it is a 8 qubit system, you just have to put the first qubit and all other qubit in individual bell states. This will put the overall system into entangled state.

+

+

This circuit will result in either all zero state or all one state as shown below.

+

+",14047,,9006,,12/5/2020 9:10,12/5/2020 9:10,,,,0,,,,CC BY-SA 4.0 +14980,1,,,12/4/2020 22:09,,1,134,"

I have two (unrelated) questions when I run circuits on IBM Q Expierence.

+

The first one is encountered, when I run the built-in function VQE (for H2 molecule). It seems two circuits were run, and the resultant histograms seem to be different. See the first screenshot attached. I try to look up on the doc, but have no clue. May I know why is that?

+

The second one is encountered, when I try to create a circuit where the 0th qubit is controlled by the 5th one. This is run on ibm_16_melbourne. The compiled circuit is pretty strange, see the second screenshot attached, where the number of qubits does not seem to match (q0-q3, q8-q14 are not involved), and I am not sure if the desired property (described above) is respected. Any help would be greatly appreciated!

+

In both cases, the results seem to be correct/acceptable, so I think it is just a question of visualization on the IBM Q Expierence.

+

+

+",9816,,,,,12/5/2020 22:58,Two questions on circuit composer on IBM Q Experience,,1,1,,12/14/2020 14:17,,CC BY-SA 4.0 +14981,2,,14980,12/4/2020 23:20,,0,,"

Answer to question 1: There are two circuits being executed because you are trying to find the expectation value of the Hamiltonian, $\langle \psi |H|\psi\rangle$ = $\langle \psi | \sum_i \alpha_i P_i | \psi \rangle = \sum_i \alpha_i \langle \psi|P_i|\psi\rangle $. So naively each circuit is representing one of the calculation of $\langle \psi|P_i|\psi\rangle $. For example, the electronic Hamiltonian for $H_2$ at bond distance 1.5 Angstrom under Parity Mapping with two-qubit reduction can be written as:

+

$$H = -1.009II + 0.1291IZ + -0.1291ZI -0.0041ZZ + 0.2295XX $$

+

but since $II, IZ, ZI, ZZ$ are in the same tensor product basis, they can be evaluated as single quantum circuit, and you just need to do some post processing calculations... that is you don't have to run 4 different quantum circuits, one for each. But $\langle XX \rangle$ need to have its own circuit. Hence the reason why you see two circuits here.

+
+

Regarding to question 2: I don't see how you do the transpilation process so I can't say much. When I see your orginial circuit:

+

+

and look at ibmq_16_device which has qubit layout as +

+

I would map $q_0 \to 1, q_5 \to 2, q_1 \to 3, q_2 \to 4, q_3 \to 5, q_4 \to 6 $ then this way your circuit can be executed in just depth of 2. There are other mapping you could do, of course. When I run the original circuit with optimization_level = 3 in Qiskit, I have the following transpiled circuit:

+

+
+

UPDATE AFTER COMMENT BY OP ON CREATING HIS/HER OWN ANSATZE FOR VQE EVALUATIONS:

+

Regarding to OP comment on create a parametrized Ansatze for his work on VQE. An Ansatze is just a a parametrized quantum circuit, and you can create parametetrized quantum circuit pretty easy. Here is an example of how to do that with the circuit you have in mind:

+
%matplotlib inline
+# Importing standard Qiskit libraries
+from qiskit import QuantumCircuit, QuantumRegister
+from qiskit.circuit import QuantumCircuit, ParameterVector
+from qiskit.compiler import transpile, assemble
+from qiskit.visualization import *
+provider = IBMQ.load_account()
+
+var_form = QuantumCircuit(6)
+params = ParameterVector('a', 6)
+for i in range(6):
+    var_form.ry(params[i],i)
+var_form.cx(1,2)
+var_form.cx(3,4)
+var_form.cx(0,5)
+
+

This will give you the following parametrized circuit:

+

+

You can now pass this into your VQE function! Hope this helps. :)

+

Also note that Qiskit does offer a few Heuristic Ansatze, like EfficientSU2 or ExcitationPreserving, TwoLocal, etc...

+",9858,,9858,,12/5/2020 22:58,12/5/2020 22:58,,,,8,,,,CC BY-SA 4.0 +14982,2,,14973,12/5/2020 0:45,,0,,"

transpiled_circuit = transpile(circuit, ibm_backend, seed_transpiler=13) gave me the circuit returned from IBMQ. Also I discovered that even on IBMQ, transpilation is random in most of the backends, in other words, when you run the same circuit many times on the same backend, you get different transpiled circuits.

+",10495,,,,,12/5/2020 0:45,,,,0,,,,CC BY-SA 4.0 +14983,2,,14966,12/5/2020 8:09,,0,,"

Two prepare an entalged state composed of two qubits, you need to apply any controlled gates on these qubits. Such gates create a link between the qubits and as a result they are entangled. Nice example are Bell states. These states can be prepared by putting Hadamard gate on first qubit and then CNOT on both qubits. CNOT is the controlled gate providing the link between qubits.

+",9006,,,,,12/5/2020 8:09,,,,0,,,,CC BY-SA 4.0 +14984,1,15000,,12/5/2020 9:28,,3,201,"

In the article Is Quantum Search Pratical the authors emphasized that a complexity of an oracle is often neglected when advantages of Grover search are discussed. In the end, a total complexity of the search can be given mostly by the oracle complexity.

+

Let's assume that we are able to prepare an oracle composed from Clifford gates only (i.e. CNOT, Hadamard gate $H$, phase gate $S$ and Pauli gates $X$, $Y$ and $Z$). Naturaly, such oracle would be very simple, for example XOR function implemented by CNOT gate.

+

Now, turn to Grover diffusion operator. The operator is composed of Hadamard gates and $X$ gates. These are Clifford ones. But the issue is controled $Z$ gate. For two qubits Grover operator CZ gate can be implemented with two Hadamards and CNOT. Therefore, in this simple case, Grover operator is composed of Clifford gates only.

+

To sum up, my ideas so far, for simple "Cliffordian" oracle and two qubits case, only Clifford gates are employed in the Grover search. According to Gottesman-Knill theorem, such circuit can be simulated efficiently on a classical computer.

+

However, what about $n$ qubit Grover diffusion operator? It seems to me that to implement controlled $Z$ gates with $n-1$ controlling qubits we would need to employ non-Clifford gates (e.g. Toffoli), hence it would not be possible to simulate Grover search efficiently on a classical computer.

+

So, my question is if this statement is right: Two qubits Grover search with an Oracle implemented with Clifford gates only can be efficiently simulated on a classical computer. For three qubits or non-Cliffordian oracle, the efficient simulation of Grover search on a classical computer is impossible.

+",9006,,,,,12/5/2020 20:42,Is it possible to construct Grover search from Clifford gates only?,,1,1,,,,CC BY-SA 4.0 +14985,2,,13143,12/5/2020 11:41,,2,,"

The matrix form of a Toffoli gate with control qubits $q_a$ and $q_b$ and a target qubit $q_x$ applied on a $n$-sized qubit register may be described as +$$ +T = \left[ \begin{array}{ccccc} +t_{1,1} & & \cdots & & t_{1,2^n}\\ + & \ddots & & \\ +\vdots & & t_{i,j} & & \vdots \\ +& & & \ddots & \\ +t_{2^n,1} & & \cdots & & t_{2^n,2^n} +\end{array} \right] +$$ +with $t_{i,j} \in \left \{ 0,1 \right \}$ defined by

+

$$ +t_{i,j} = \left \{ \begin{array}{rlcl} + 1 & \mbox{if } (i-1) \land M \neq M & { and } & j = i \\ +1 & \mbox{if } (i-1) \land M = M & { and } & j = \delta_i + i \\ + 0 & \mbox{otherwise} +\end{array} \right. +$$ +where $\land$ represents the bitwise AND operator, $M = 2^{n-a} + 2^{n-b}$ and +$$ +\delta_i = \left \{ \begin{array}{rl} + (2^{n-x}) & \mbox{if } 2^{n-x} \land (i-1) = 0 \\ +-(2^{n-x}) & \mbox{otherwise} +\end{array} \right. +$$ +The matrix $T$ is an identiy matrix with some rows/cols switched to implement the controlled NOT gate: $M$ represents the mask used to identify the rows to be remapped and $\delta_i$ represents the shift applied to remap them.

+

I have prepared a short pyhton code snippet to calulate $T$

+
import numpy as np
+def T(n,a,b,x) :
+    m = 2**(n-a)+2**(n-b)
+    d = lambda i : 2**(n-x) if (2**(n-x)) & i == 0 else -(2**(n-x))
+    T = np.array([([0] * 2**n)] * 2**n)
+    for i in range(2**n) :
+        for j in range(2**n) :
+            T[i][j] = 1 if (i & m == m and j == d(i) + i) or (i & m != m and j == i) else 0
+    return T
+
+

For example, the Toffoli matrix T(4,3,2,1) is

+
array([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+       [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+       [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+       [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+       [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+       [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
+       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
+       [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
+       [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
+       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
+       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0],
+       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
+       [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
+       [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
+       [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]])
+
+",13818,,,,,12/5/2020 11:41,,,,0,,,,CC BY-SA 4.0 +14986,1,14988,,12/5/2020 11:44,,1,172,"

I am looking for a quantum circuit which maps state $|00\rangle$ to $|\psi\rangle=\frac{1}{\sqrt{2}} |00\rangle+\frac{1}{\sqrt{2}}|1+\rangle$.

+

The circuit should only apply quantum gates from the Clifford group (specifically, $CNOT$, $H$, $P$) and the $T$ gate:

+

$$ +CNOT = \begin{bmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0 +\end{bmatrix}, \quad +H = \frac{1}{\sqrt{2}}\begin{bmatrix} +1 & 1 \\ +1 & -1 +\end{bmatrix}, \quad +P = \begin{bmatrix} +1 & 0 \\ +0 & i +\end{bmatrix}, \quad +T = \begin{bmatrix} +1 & 0 \\ +0 & e^{i \pi / 4} +\end{bmatrix} +$$

+
+

My Thoughts

+

Because these gates are universal for quantum computation (as stated here), I know that a circuit which approximates $|\psi\rangle$ must exist. I am hoping that I can produce $|\psi\rangle$ exactly, but I was not able to find the corresponding circuit.

+

I already figured out the the circuit needs to apply $T$ at least one, as $|\psi\rangle$ has no stabilizers from the Pauli group (determined by brute-force), and any state produced by a Clifford circuit would have stabilizers from the Pauli group.

+",2444,,2444,,12/5/2020 17:38,12/5/2020 17:38,Prepare state $|00\rangle+|1+\rangle$ using Clifford gates and the T-gate,,1,2,,,,CC BY-SA 4.0 +14987,1,14989,,12/5/2020 13:51,,0,133,"

Let $\left|\psi_1\right\rangle=\alpha_1\left|0\right\rangle+\beta_1\left|1\right\rangle$ , and $\psi_2=\alpha_2\left|0\right\rangle+\beta_2\left|1\right\rangle$.

+

Assume that $\left|\psi\right\rangle$ is a mixed state of $w_1*\left|\psi_1\right\rangle$ and $w_2*\left|\psi_2\right\rangle$ with $w_1+w_2=1$.

+

How to calculate the state vector of $\left|\psi\right\rangle$ ?

+",13982,,55,,12/7/2020 11:54,12/7/2020 11:54,How to calculate the state vector of a mixed state of two superposition state?,,1,0,,,,CC BY-SA 4.0 +14988,2,,14986,12/5/2020 14:31,,3,,"

The circuit is a Hadamard + a Controlled - Hadamard gate.

+

+

Note that $ S $ gate is $ P $ gate in your notation.

+",13109,,,,,12/5/2020 14:31,,,,2,,,,CC BY-SA 4.0 +14989,2,,14987,12/5/2020 14:35,,2,,"

If the state is a mixed state of $|\psi_{1}\rangle$ and $|\psi_{2}\rangle$ (or any two states) it cannot be written as a state vector; state vectors only describe pure states, as opposed to mixed states.

+

If it is a coherent superposition of $|\psi_{1}\rangle$ and $|\psi_{2}\rangle$, you can write:

+

$$\sqrt{w_{1}}|\psi_{1}\rangle + \sqrt{w_{2}}|\psi_{2}\rangle = (\sqrt{w_{1}}\alpha_{1} + \sqrt{w_{2}}\alpha_{2})|0\rangle + (\sqrt{w_{1}}\beta_{1} + \sqrt{w_{2}}\beta_{2})|1\rangle$$

+

The implicit assumption here is that $|\psi_{1}\rangle$ and $|\psi_{2}\rangle$ are orthogonal. If this is not the case, it makes less sense to sum the two states in such a way, but one can always normalize using their inner product $1+\sqrt{w_{1}w_{2}}|\langle\psi_{1}|\psi_{2}\rangle|^{2}$ (as you already pointed out in your comment):

+

$$ +\frac{1}{1+\sqrt{w_{1}w_{2}}|\langle\psi_{1}|\psi_{2}\rangle|^{2}}\Big( \sqrt{w_{1}}|\psi_{1}\rangle + \sqrt{w_{2}}|\psi_{2}\rangle\Big) +$$

+

If it is not a coherent superposition but indeed a (statistical) mixture of the two, a good (but wieldy) description of the state is:

+
+

"I am not certain what the state of the qubit is. It is either $|\psi_{1}\rangle$ or $|\psi_{2}\rangle$, but not a proper superposition of the two. With probability $w_{1}$ it is $|\psi_{1}\rangle$, and with probability $w_{2}$ it is $|\psi_{2}\rangle$."

+
+

Now, that is quite a mouthful and therefore we also have a different technique of writing down the state, making use of density matrices. The density matrix $\rho$ describing the state is

+

(with $\langle\psi_{1}|$ the complex transpose of $|\psi_{1}\rangle$):

+

$$ +\begin{split} +\rho &= w_{1}|\psi_{1}\rangle \langle\psi_{1}| + w_{2}|\psi_{2}\rangle \langle\psi_{2}| \\ +&= w_{1} \begin{bmatrix}\alpha_{1}\alpha^{*}_{1} & \alpha_{1}\beta^{*}_{1} \\ \alpha^{*}_{1}\beta_{1} & \beta_{1}\beta_{1}^{*}\end{bmatrix} + w_{2} \begin{bmatrix}\alpha_{2}\alpha^{*}_{2} & \alpha_{2}\beta^{*}_{2} \\ \alpha^{*}_{2}\beta_{2} & \beta_{2}\beta_{2}^{*}\end{bmatrix} \\ +\end{split} +$$

+

For more info you could check, for instance, the Wikipedia page on density matrices or a good Quantum mechanics or quantum computing book.

+",8141,,8141,,12/5/2020 15:18,12/5/2020 15:18,,,,4,,,,CC BY-SA 4.0 +14990,1,15001,,12/5/2020 14:52,,4,107,"

I'm reading Programming Quantum Computers trying to understand Shor's algorithm. I learned there that we prepare a state $|x^i \bmod N\rangle$, then apply the QFT to this state. The QFT changes the amplitudes from a uniform superposition to large amplitudes evenly spaced out by the period of $x^i \bmod N$. For example, here's a graph of the amplitudes after applying the QFT with $N = 35$. That's on page 241.

+

+

The book says there are 12 spikes evenly spaced. I see a lot more than 12 spikes evenly spaced. Should I count just the highest ones and stop when I've counted 12? But isn't that subjective? How would I figure out that the number is really 12 from just looking at this graph without knowing the right answer? (In other words, how do I get 12 out of this?)

+",14021,,2927,,12/5/2020 16:02,12/5/2020 22:07,What are the interesting spikes in this after-QFT graph (page 241) of Programming Quantum Computers?,,1,3,,,,CC BY-SA 4.0 +14992,2,,14617,12/5/2020 15:24,,0,,"

Experiment - is ours Friend!

+

See, I've wrote a little script, to test this theory:

+
#!/usr/bin/python3
+
+import time
+import random
+
+li      = [ ]
+size        = 1000000
+size        = 100000
+size        = 10000     # 3 seconds
+# size      = 1000      # 0.2 seconds
+# size      = 100
+
+
+DEBUG       = False
+# DEBUG     = True
+
+start_time  = time.time( )
+for i in range( 0, size ):
+    li.append( i )
+random.shuffle( li )
+speed       = time.time( ) - start_time
+
+print( "gen done in:", speed, "seconds" )
+
+if DEBUG:
+    print( li )
+
+def find_i( i ):
+    N = 0
+    for j in li:
+        if i == j:
+            return N
+        N += 1
+
+start_time  = time.time( )
+
+accum_N     = 0
+for i in range( 0, size ):
+    accum_N += find_i( i )
+
+speed       = time.time( ) - start_time
+print( "find done in:", speed, "seconds" )
+
+#--------------------------------------------------------
+average     = accum_N / size
+
+relation    = size / average
+
+print( "accum_N:", accum_N )
+print( "size:", size )
+print( "average:", average )
+print( "size relate to average number of steps as", int( relation ), "to 1" )
+
+

Output:

+
$ python3 script.py
+gen done in: 0.004632234573364258 seconds
+find done in: 3.0313122272491455 seconds
+accum_N: 49995000
+size: 10000
+average: 4999.5
+size relate to average number of steps as 2 to 1
+
+
    +
  • On the gen stage, we are simply pushing every int from range 0 to size === $N$.
  • +
  • Thereafter, shuffle the result list.
  • +
  • Thereafter, we are goin to find each integer, from range 0 to size in this list, and accumulate number of comparisons / steps in accum_N variable
  • +
  • as you can see, the number - is $N/2$
  • +
+",14063,,,,,12/5/2020 15:24,,,,0,,,,CC BY-SA 4.0 +14993,1,14996,,12/5/2020 16:18,,1,56,"

My question is linked to the Nielsen Chuang book. Particularly equation 2.216 on basis change from $|0\rangle$, $|1\rangle$ to orthonormal $|a\rangle$ and $|b\rangle$. How do we get the equation from the following?

+

+

I understand everything except why we get the negative sign in the coefficient.

+",14064,,55,,12/7/2020 11:53,12/7/2020 11:53,"How do get from $|0\rangle=\alpha|a\rangle+\beta|b\rangle$, $|1\rangle=\gamma|a\rangle+\delta|b\rangle$ to an expression for $|01\rangle-|10\rangle$?",,1,0,,,,CC BY-SA 4.0 +14994,1,14998,,12/5/2020 16:37,,4,243,"

I asked about how to identify the period looking at a Fourier transform plot. The answer seems to be to run the fourier transform multiple times getting multiple values associated to high probabilities described by the graph. So still using the same picture, suppose I read it twice and I got the values |5> and |11>. These are the highest spikes (after the first highest in |0>.) How would I figure out the period 12 out of 5 and 11? Can you show an example of the calculation?

+

+

An attempted solution. Reading Peter Shor's paper (on page 320), we find that his $q$ is $q=64$ here in our example. Shor is saying we can obtain a fraction $d/r$ in lowest terms (where $r = 12$ here) by rounding $c/q$ to the nearest fraction having a denominator smaller than $n=35$ here. Our possible $c$ here is $5$ and $11$.

+

Let's try that. After the QFT, we got $c = 5$ and we have $q = 64$. So we get $5/64 = 0.078125$ and we want to round that to the nearest fraction having a denominator smaller than $35$. For $5/64$, I find the continued fraction $[0,12,1,4]$. (I checked that $5/64 = 1/(12 + 1/(1 + 1/4))$, so that's correct.) Now, from this continued fraction (in list form) I get the following sequence of fractions: $1/4, 5/4, 64/5, 5/64$. (I'm not sure what I'm doing.) Perhaps $5$ is bad luck? But, no, trying the same thing with $11$ will also produce $11/64$. So even though I know how to compute the continued fraction algorithm, I don't know what to do with it. I'm gonna have to look at Hardy and Wright, Chapter X.

+",14021,,14021,,12/6/2020 17:18,12/6/2020 17:18,Shor's algorithm: what to do after reading the QFT's result twice?,,1,0,,,,CC BY-SA 4.0 +14995,2,,14932,12/5/2020 16:43,,5,,"

Let's start with the second question. There is nothing special about an extension $\sigma_{AR}^{\ast}$ that allows it to be optimal for the right-hand side of (1); any extension $\sigma_{AR}$ of $\sigma_A$ could happen to be optimal for the right choice of $\rho_{AR}$. For example, if we suppose that $\sigma_{AR}$ is any given extension of $\sigma_A$, and we take $\rho_{AR} = \sigma_{AR}$, then the unique optimizing extension is $\sigma_{AR}^{\ast} = \sigma_{AR}$. We may therefore not conclude that this optimal extension is pure.

+

For the first question, now that we know that an arbitrary choice of an extension $\sigma_{AR}$ could maximize the right-hand side of (1) for an appropriate choice of $\rho_{AR}$, we see that the question is equivalent to asking how any two extensions of the same state relate. I suppose you could come up with alternative ways to characterize the condition that two states are extensions of the same state, but there's nothing beyond this to say, and in particular there is no unitary or isometric equivalence in general when the states are not pure.

+",1764,,,,,12/5/2020 16:43,,,,0,,,,CC BY-SA 4.0 +14996,2,,14993,12/5/2020 18:42,,1,,"

This is just algebra because $(a-b)|u\rangle + (c-d)|v\rangle = (a-b)|u\rangle - (d-c)|v\rangle $.

+
+

To be more explicit to the problem, first note that:

+

\begin{align} +|01\rangle = \big( \alpha |a\rangle + \beta |b\rangle\big) \otimes \big(\gamma |a\rangle + \delta |b\rangle \big) = \alpha \gamma |aa\rangle + \alpha \delta |ab\rangle + \beta \gamma |ba\rangle + \beta \delta |bb\rangle +\end{align} +and similarly +\begin{align} +|10\rangle = \big( \gamma |a\rangle + \delta |b\rangle \big) \otimes \big( \alpha |a\rangle + \beta |b\rangle\big) = \gamma \delta|aa\rangle + \gamma \beta |ab\rangle + \delta \alpha |ba\rangle + \delta \beta |bb\rangle +\end{align}

+

and so

+

\begin{align} +\dfrac{|01\rangle - |10\rangle}{\sqrt{2}} &= \dfrac{\alpha \gamma |aa\rangle + \alpha \delta |ab\rangle + \beta \gamma |ba\rangle + \beta \delta |bb\rangle}{\sqrt{2}} \\ +&- \\ +&\hspace{0.6 cm}\frac{\gamma \delta|aa\rangle + \gamma \beta |ab\rangle + \delta \alpha |ba\rangle + \delta \beta |bb\rangle}{\sqrt{2}} \\ +&= 0 + \dfrac{\big(\alpha \delta - \gamma \beta \big)|ab\rangle}{\sqrt{2}} + \dfrac{\big( \beta\gamma - \delta \alpha\big) |ba\rangle}{\sqrt{2}} + 0 \\ +&= \dfrac{\big(\alpha \delta - \gamma \beta \big)|ab\rangle - \big( \delta \alpha -\beta\gamma \big) |ba\rangle}{\sqrt{2}} \\ +&= \dfrac{\big(\alpha \delta - \gamma \beta \big)|ab\rangle - \big( \alpha \delta -\gamma \beta\big) |ba\rangle}{\sqrt{2}} \\ +&= \big(\alpha \delta - \gamma \beta \big) \dfrac{|ab\rangle - |ba\rangle}{\sqrt{2}} +\end{align}

+",9858,,,,,12/5/2020 18:42,,,,0,,,,CC BY-SA 4.0 +14997,1,,,12/5/2020 19:21,,2,128,"

Everytime I execute Grover's search algorithm on IBM real quantum computers I get a wrong answer (it doesn't find the correct winner state) unless I use only 2 qubits. For any higher number of qubits it fails. I've already maximized the number of shots and tried with every free device. Also, the algorithm works perfectly in every simulation with any number of qubits. +Could this be a connectivity problem? Do I need each qubit to be connected to all the other ones in the circuit for Grover's algorithm to work?

+

Here is the Python code I am using. It implements a generalized Grover's algorithm for n qubits.

+
import matplotlib.pyplot as plt
+import numpy as np
+from math import *
+from qiskit import *
+from qiskit.tools.visualization import circuit_drawer, plot_histogram
+from qiskit.quantum_info.operators import Operator
+
+
+def computational_basis(number_of_qubits, space_dimension):
+
+    basis = []
+    for i in range(space_dimension):
+        a = bin(i)[2:]
+        l = len(a)
+        b = str(0) * (number_of_qubits - l) + a
+        basis.append(b)
+
+    return basis
+
+
+def scalar_product(a, b):  # Where a and b are two items of the "basis" list
+
+    if a == b:
+        return 1
+    else:
+        return 0
+
+
+def oracle_generator(space_dimension, winner_state):
+
+    for i in range(space_dimension):
+        if basis[i] == winner_state:
+            mark = basis.index(basis[i])
+
+    oracle_matrix = np.identity(space_dimension)
+    oracle_matrix[mark, mark] = -1
+
+    oracle = Operator(oracle_matrix)
+    return oracle
+
+
+def diffuser_generator(space_dimension):
+
+    diffuser_matrix = np.empty((space_dimension, space_dimension))
+    for i in range(space_dimension):
+        for j in range(space_dimension):
+            diffuser_matrix[i, j] = (2 * scalar_product(basis[i], basis[0]) * scalar_product(basis[0], basis[j])) - scalar_product(basis[i], basis[j])
+
+    diffuser = Operator(diffuser_matrix)
+    return diffuser
+
+
+def grover_iteration(number_of_qubits, circuit, qr):
+
+    all_qubits_list = []
+    for i in range(n):
+        all_qubits_list.append(i)
+
+    circuit.unitary(oracle, all_qubits_list, label='oracle')
+
+    for i in range(number_of_qubits):
+        circuit.h(qr[i])
+
+    circuit.unitary(diffuser, all_qubits_list, label='diffuser')
+
+    for i in range(number_of_qubits):
+        circuit.h(qr[i])
+
+
+# Number of qubits
+n = 3
+# Space dimension
+N = int(pow(2, n))
+# Winner state
+winner = '111'
+
+
+# Make a list of computational basis vectors (strings)
+basis = computational_basis(n, N)
+
+
+# Build a quantum circuit for n-qubit Grover's algorithm
+oracle = oracle_generator(N, winner)
+diffuser = diffuser_generator(N)
+
+qr = QuantumRegister(n, 'q')
+cr = ClassicalRegister(n, 'c')
+
+grover_circuit = QuantumCircuit(qr, cr)
+
+for i in range(n):
+    grover_circuit.h(qr[i])
+
+if n == 2:
+    grover_iteration(n, grover_circuit, qr)
+else:
+    for i in range(int(sqrt(N))):
+        grover_iteration(n, grover_circuit, qr)
+
+grover_circuit.measure(qr, cr)
+
+
+# Draw Grover circuit
+circuit_drawer(grover_circuit, output='mpl')
+plt.show()
+
+
+# Execute circuit
+IBMQ.load_account()
+provider = IBMQ.get_provider('ibm-q')
+qcomp = provider.get_backend('ibmq_valencia')
+job = execute(grover_circuit, backend=qcomp, shots=8192)
+result = job.result()
+
+
+# Results
+plot_histogram(result.get_counts(grover_circuit))
+plt.show()
+
+",13893,,55,,12/7/2020 11:53,12/7/2020 11:53,Connectivity in Grover's algorithm on real quantum computers,,1,3,,,,CC BY-SA 4.0 +14998,2,,14994,12/5/2020 19:24,,3,,"

This is the continued fraction part of the algorithm, step 5 on Wikipedia. What you've measured is $y$ such that $\frac{yr}{Q}\approx c$, where $c$ is some unknown integer, $r$ is the hidden period (in this case 12), and $Q=64$ is the size of the QFT. This means that $\frac{y}{Q}\approx \frac{c}{r}$. For $y=5$, we have $\frac{5}{64}\approx \frac{1}{12}$, and for $y=11$, we have $\frac{11}{64}\approx \frac{2}{12}$. So that's the relation between the measured values and the period.

+

How do we actually find the period from those values, though (since we don't know $c$ or $r$)? With continued fractions. A continued fraction for a number $x$ is defined recursively, with $a_0=x$, then with $b_n=\lfloor a_n\rfloor$, and $a_n=\frac{1}{a_{n-1}-b_{n-1}}$. Applied to this problem with $x=\frac{5}{64}$, we have

+

$$ a = (\frac{5}{64},\frac{64}{5},\frac{5}{4},4,0,\dots)$$ +$$ b = (0,12,1,4,0,\dots)$$

+

From this, we can reconstruct approximations, and the denominator of these approximations will likely be the period. The wikipedia page on continued fractions explains that we get a series of approximate fractions $\frac{h_n}{k_n}$, where we set a numerator $h_n=b_nh_{n-1}+h_{n-2}$ and denominator $k_n=b_nk_{n-1}+k_{n-2}$, with initial values $h_{-1}=1$, $h_{-2}=0$, $k_{-1}=0$, and $k_{-2}=1$. This gives two sequences:

+

$$h = (0, 1, 0, 1, 1, 5)$$ +$$ k = (1,0, 1, 12, 13, 64)$$

+

which gives three approximate fractions: $\frac{1}{12}$, $\frac{1}{13}$, and $\frac{5}{64}$. The last one is what we started with and is useless because 64 is too big (the period must be less than 35, after all). The first one is the actual period.

+

I don't know much about continued fractions but I think these approximations converge very quickly to the original fraction. So in practice, I think you would just check each denominator in the sequence of approximate fractions (in this case, both 12 and 13) since (a) there should not be that many approximate fractions, and (b) the final steps of Shor's algorithm are so inexpensive.

+",4517,,,,,12/5/2020 19:24,,,,5,,,,CC BY-SA 4.0 +14999,2,,14934,12/5/2020 20:23,,1,,"

I believe to have answered my own question through further attempts. Per the comment from KAJ226, it is true that a $(3 \times 3)$ matrix cannot be represented as a string of Paulis so I have nested the $(3 \times 3)$ matrix into a $(4 \times 4)$ matrix where the final row and column are all zeros. From this I can omit the useless eigenvalue/eigenvector and just retain the relevant results for the $(3 \times 3)$ matrix.

+

My solution mostly came from using the WeightedPauliOperator, MatrixOperator, and op_converter classes. Below is a sample of my code with corresponding outputs. Thanks to those who gave suggestions to help me out!

+
import numpy as np
+import scipy
+import h5py
+
+from qiskit.aqua.algorithms import VQE, NumPyEigensolver
+from qiskit.aqua.operators import WeightedPauliOperator, MatrixOperator, op_converter
+from qiskit import Aer
+
+backend = Aer.get_backend("qasm_simulator")
+
+c1=-0.5
+c2=.75
+c3=2
+
+n1=3
+Hamil=np.zeros((n1,n1))
+Hamil[1,1]=c2
+Hamil[2,2]=-c3/2+c2
+Hamil[0,2]=c1
+Hamil[1,2]=c1
+Hamil[2,0]=c1
+Hamil[2,1]=c1
+
+print("(3x3) Hamiltonian")
+print(Hamil)
+
+vals,vecs=np.linalg.eig(Hamil)
+
+print("Standard Eigenvalues: ")
+print(vals)
+
+n2=4
+Hamil=np.zeros((n2,n2))
+Hamil[1,1]=c2
+Hamil[2,2]=-c3/2+c2
+Hamil[0,2]=c1
+Hamil[1,2]=c1
+Hamil[2,0]=c1
+Hamil[2,1]=c1
+
+print("(4x4) Hamiltonian")
+print(Hamil)
+
+Hamil_Mat=MatrixOperator(Hamil)
+Hamil_Qop = op_converter.to_weighted_pauli_operator(Hamil_Mat)
+
+q_vals = NumPyEigensolver(Hamil_Qop,k=4).run()
+
+print("Qubit Op Eigenvalues: ")
+print(q_vals['eigenvalues'])
+
+vqe=VQE(Hamil_Qop)
+vqe_result=vqe.run(backend)
+
+print("VQE Eigenvalue: ")
+print(vqe_result['eigenvalue'])
+
+

With result:

+
(3x3) Hamiltonian
+[[ 0.    0.   -0.5 ]
+ [ 0.    0.75 -0.5 ]
+ [-0.5  -0.5  -0.25]]
+Standard Eigenvalues:
+[-0.75  0.25  1.  ]
+(4x4) Hamiltonian
+[[ 0.    0.   -0.5   0.  ]
+ [ 0.    0.75 -0.5   0.  ]
+ [-0.5  -0.5  -0.25  0.  ]
+ [ 0.    0.    0.    0.  ]]
+Qubit Op Eigenvalues:
+[-0.75+0.j  0.  +0.j  0.25+0.j  1.  +0.j]
+VQE Eigenvalue:
+(-0.705078125+0j)
+
+",14009,,,,,12/5/2020 20:23,,,,0,,,,CC BY-SA 4.0 +15000,2,,14984,12/5/2020 20:42,,5,,"

The diffusion operator is a multi controlled not operation (modulo some hadamards). It's not a Clifford operation.

+

Also any useful oracle you'd use with Grover's algorithm won't be Clifford operations either, since any Clifford oracle accepts 0%, 50%, or 100% of all inputs which makes search trivial.

+",119,,,,,12/5/2020 20:42,,,,2,,,,CC BY-SA 4.0 +15001,2,,14990,12/5/2020 22:07,,3,,"

Looking at the graphs you've reproduced, the left graph shows the evaluation of $2^x\bmod 35$ for $x\in\{0,\dots 63\}$ while the right graph illustrates the amplitude of the discrete Fourier transform for $\hat{x}\in\{0,\dots 63\}$. The comment that there are "12 evenly spaced spikes" indicates that the local maxima of the right graph repeat every $64/12=5.33$ values.

+

You are correct, you do not have access to $\hat{x}$ in a manner that lets you observe this periodicity in $\hat{x}$ immediately; however, what you do have access to is a way to sample $\hat{x}_i$ for multiple $i$ in a manner that returns $\hat{x}_i$ with probability given by the (square of the) height of the respective $\hat{x}_i$.

+

For example, if you were to run the modular exponentiation (left graph) followed by the QFT (right graph), and sample the first register, you are likely to get a value such as $0$ with higher probability than $5$, with higher probability than $32$, with higher probability than $11$, with higher probability than $6$, etc.

+

From these respective samplings of $\hat{x}_i$, you can run the classical portions (the continued fraction portion) of Shor's algorithm to deduce that, indeed, there were 12 evenly spaced spikes in $\hat{x}$, giving you the period of $12$ in $2^x\bmod 35$. There are a lot of details that I'm forgetting but the point is that you use the samples from your QFT as inputs to this classical portion.

+",2927,,,,,12/5/2020 22:07,,,,0,,,,CC BY-SA 4.0 +15002,2,,12382,12/6/2020 11:17,,3,,"

Use this command to install qiskit-textbook module

+
pip install git+https://github.com/qiskit-community/qiskit-textbook.git#subdirectory=qiskit-textbook-src
+
+",14070,,,,,12/6/2020 11:17,,,,0,,,,CC BY-SA 4.0 +15003,1,,,12/6/2020 13:07,,1,218,"

I consider a process $\mathcal{E}$ that is at least CP and hermitian preserving.

+

I know that the Choi matrix then has the form:

+

$$ M = \sum_k |M_k \rangle \rangle \langle \langle M_k | $$

+

Where $|M_k \rangle \rangle$ are the Kraus operators of $\mathcal{E}$ in the "vectorized" form from Choi isomorphism.

+

My question:

+

How from this fact can I show that the only different set of Kraus operator can be related through unitary transformations ?

+

I know that if I write $|M_k \rangle \rangle=\sum_{i} U_{ik} |A_i \rangle \rangle$ I can see that:

+

$$ M = \sum_i |A_i \rangle \rangle \langle \langle A_i|$$

+

But how can I proove that it is the only possibility to find other Kraus operator, based on the Choi matrix ?

+",5008,,55,,12/25/2020 23:32,5/13/2022 8:53,"Prove that different Kraus decompositions are related through a unitary, using the Choi isomorphism",,1,0,,,,CC BY-SA 4.0 +15004,1,15005,,12/6/2020 13:10,,3,125,"

I am trying to understand the state given here:

+

$$ +\frac{1}{\sqrt{n}} \sum_{j=0}^{n-1} |j\rangle |j\rangle +$$

+

Suppose $n = 4$, I would interpret this state as being $1/2(|00\rangle + |11\rangle + |22\rangle + |33\rangle)$. Is this correct? And if so, what does $|2\rangle$ or $|3\rangle$ mean?

+",14072,,55,,12/25/2020 23:32,12/25/2020 23:32,"What does $|j\rangle$ mean, when $j > 1$?",,3,1,,,,CC BY-SA 4.0 +15005,2,,15004,12/6/2020 14:04,,4,,"

Each $|j\rangle$ is a multi-qbit state. So if $n = 4$, $|2\rangle$ and $|3\rangle$ are $|10\rangle$ and $|11\rangle$ respectively. For $n = 4$ your final formula would be:

+

$$ +\frac{1}{\sqrt{4}} \left( |00\rangle|00\rangle + |01\rangle|01\rangle + |10\rangle|10\rangle + |11\rangle|11\rangle \right) +$$ +$$ +\frac{1}{\sqrt{4}} \left( |0000\rangle + |0101\rangle + |1010\rangle + |1111\rangle \right) +$$

+",4153,,,,,12/6/2020 14:04,,,,2,,,,CC BY-SA 4.0 +15007,2,,14997,12/6/2020 17:11,,2,,"

After ran your code, which have a circuit structure of the form:

+

+

However, mapping it to Valencia, which has qubit connectivity map as:

+

+

then the transpiled circuit takes the form:

+

+

Which after asking Qiskit to spit out the circuit depth and all the gate operations we have:

+
Transpiled circuit depth 122
+
+Quantum operations used: OrderedDict([('cx', 73), ('u2', 59), ('u1', 21), ('u3', 9), ('measure', 3), ('barrier', 1)])
+
+

Then we see that the transpiled circuit is quite long and the probability of the circuit running with succession is not so positive as Valencia only has Quantum Volume of 16.

+
+

As a note on how to get the transpiled circuit and its depth and different operations, you can do the following:

+
from qiskit.compiler import transpile
+provider = IBMQ.load_account()
+Circuit_Transpile = transpile(grover_circuit, provider.get_backend('ibmq_valencia') , optimization_level=3)
+print('Transpiled circuit depth', Circuit_Transpile.depth() )
+print('Quantum operations used:', Circuit_Transpile.count_ops())
+Circuit_Transpile.draw( 'mpl',style={'name': 'bw'}, filename = 'transpiled circuit', plot_barriers= False, initial_state = True, scale = 1)
+
+",9858,,,,,12/6/2020 17:11,,,,2,,,,CC BY-SA 4.0 +15008,2,,14973,12/6/2020 17:59,,1,,"

Consider that the transpilation process is not deterministic and the output might vary in every run (seed_transpiler sets the PRNG seed).

+
from qiskit import *
+
+circuit = QuantumCircuit(5, 5)
+circuit.ccx(1,2,4)
+circuit.ccx(2,3,4)
+circuit.measure(4, 4)
+circuit.draw('mpl')
+
+

+
transpile(circuit, provider.get_backend('ibmq_athens'), seed_transpiler=13).draw('mpl', fold=0)
+
+

+",1859,,1859,,12/6/2020 18:09,12/6/2020 18:09,,,,0,,,,CC BY-SA 4.0 +15009,1,15036,,12/6/2020 20:17,,2,170,"

I have been trying to build myself an example of Shor's computations for the discrete log. I started out with this objective and I realized I should understand the factorization first, which I did and did. Having a clue about the factorization, perhaps now I can tackle the discrete log, but it's still not that easy.

+

Problem. Find $a$ such that $2^a = 7 \bmod 29$. (We know $2$ is a generator of $Z_{29}$.)

+

Peter Shor tells us to find $q$, a power of $2$ that is close to $29$, that is, $29 < q < 2\times29$. So $q = 32 = 2^5$ suffices. Next he tells us to put two register |$a$> and |$b$> in uniform superposition $\bmod 28$. (Why $\kern-0.4em\bmod 28$? Why not $\kern-0.4em\bmod 29$?) Then in a third register compute |$2^a 7^{-b} \bmod 29$>.

+

This will produce a periodic sequence in superposition. Applying the QFT to this register, we should be able to extract this period. When I look at the sequence for this concrete case (which is $2^a 7^{-b} \bmod 29$), I find $[1, 25, 16, 23, 24, 20, 7, 1, 25, 16, 23, 24, 20, 7, 1, ...]$ So, I can see the period is $7$.

+

What is the calculation that I must do now to extract the solution $a = 12$?

+",14021,,55,,12/25/2020 23:32,12/25/2020 23:32,How to build an example of Shor's algorithm for the discrete log?,,1,0,,,,CC BY-SA 4.0 +15010,2,,14976,12/6/2020 23:54,,3,,"

If we can implement the second unitary $ U^{(2)} $, we immediately have a decomposition for the first since: +$$ U^{(1)} = CNOT_{1, 0} \cdot U^{(2)}_{0, 1} \cdot CNOT_{1, 0} $$ +if we set $ (e, f, g, h) = (d, c, b, a) $.

+

$ U^{(2)} $ is a controlled - $ V $ gate where $ V $ is the unitary matrix +$ V = \begin{bmatrix} e & f \\ g & h \end{bmatrix} $.

+

Now since $ e^2 + g^2 = 1, e, g \in \mathbb{R} $, we can write $ e = \text{cos}(\phi) $ and $ g = \text{sin}(\phi) $. Similarly, $ f = \text{sin}(\theta) $ and $ h = \text{cos}(\theta) $. The two vectors must be orthogonal so:

+

$$ +e \cdot f + g \cdot h = 0 \implies +\text{cos}(\phi) \cdot \text{sin}(\theta) + \text{sin}(\phi) \cdot \text{cos}(\theta) = 0 \implies +\text{sin}(\phi + \theta) = 0 +$$

+

This means that either

+
    +
  • $ \theta = -\phi \implies +V = \begin{bmatrix} \text{cos}(\phi) & -\text{sin}(\phi) \\ + \text{sin}(\phi) & \text{cos}(\phi) + \end{bmatrix} += R_y(2\phi) \implies U^{(2)} = CR_y(2\phi) $, or

    +
  • +
  • $ \theta = \pi -\phi \implies +V = \begin{bmatrix} \text{cos}(\phi) & \text{sin}(\phi) \\ + \text{sin}(\phi) & -\text{cos}(\phi) + \end{bmatrix} += R_y(2\phi) \cdot Z = e^{i \frac{\pi}{2}} \cdot R_y(2\phi) \cdot R_z(\pi) +$.

    +
  • +
+

Once we obtain these decompositions of $ V $ it's straight-forward to implement it as a controlled operatiion. +(see for example Nielsen and Chuang section on Controlled Operations).

+",13109,,,,,12/6/2020 23:54,,,,0,,,,CC BY-SA 4.0 +15011,2,,14976,12/7/2020 0:08,,4,,"

The key idea is to use Y-rotations, because they include the imaginary unit which cancels the imaginary unit present in the exponential formula.

+

Start with $U_2$. Note that it is an orthogonal matrix, because $e, f, g, h \in \mathbb{R}$. Therefore there exists angle $\theta$ such that

+

$$ +U_2(\theta) = \begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & \cos \theta/2 & -\sin \theta/2 \\ +0 & 0 & \sin \theta/2 & \cos \theta/2 +\end{pmatrix} +$$

+

or

+

$$ +U_2(\theta) = \begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & \cos \theta/2 & \sin \theta/2 \\ +0 & 0 & \sin \theta/2 & -\cos \theta/2 +\end{pmatrix}. +$$

+

These two forms correspond to the two connected components of $O(2)$, i.e. to a rotation and a rotoreflection, respectively. Noting that

+

$$ +R_y(\theta) = \exp(-i\theta Y/2) = I \cos \frac{\theta}{2} - i Y \sin \frac{\theta}{2} = \begin{pmatrix} +\cos \theta/2 & -\sin \theta/2 \\ +\sin \theta/2 & \cos \theta/2 +\end{pmatrix} +$$

+

we see that in the rotation case

+

$$ +U_2(\theta) = C^{(1)}R_y^{(2)}(\theta) +$$

+

and in the rotoreflection case

+

$$ +U_2(\theta) = C^{(1)}R_y^{(2)}(\theta) \, C^{(1)}Z^{(2)} +$$

+

where $C^{(i)}$ indicates that the $i$th qubit is the control and $R_y^{(j)}$ and $Z^{(j)}$ indicate that the $j$th qubit is the target.

+

We can extend the above result to $U_1$ using the $CNOT$ gate. Specifically, we exploit the fact that the matrix of the $C^{(2)}NOT^{(1)}$ gate is the permutation matrix that swaps the second and fourth basis elements

+

$$ +C^{(2)}NOT^{(1)} = \begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0 \\ +0 & 1 & 0 & 0 +\end{pmatrix}. +$$

+

As before, we notice that $U_1$ is orthogonal due to the requirement that $a, b, c, d \in \mathbb{R}$ and therefore there exists angle $\theta$ such that

+

$$ +U_1(\theta) = \begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & \cos \theta/2 & -\sin \theta/2 & 0 \\ +0 & \sin \theta/2 & \cos \theta/2 & 0 \\ +0 & 0 & 0 & 1 +\end{pmatrix} +$$

+

or

+

$$ +U_1(\theta) = \begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & \cos \theta/2 & \sin \theta/2 & 0 \\ +0 & \sin \theta/2 & -\cos \theta/2 & 0 \\ +0 & 0 & 0 & 1 +\end{pmatrix} +$$

+

where once again the two forms correspond to a rotation and a rotoreflection, respectively. We reduce the rotation case of $U_1$ to the rotation case of $U_2$ using

+

$$ +U_1(\theta) = C^{(2)}NOT^{(1)} \, U_2(-\theta) \, C^{(2)}NOT^{(1)} +$$

+

and the rotoreflection case of $U_1$ to the rotoreflection case of $U_2$ using

+

$$ +U_1(\theta) = C^{(2)}NOT^{(1)} \, U_2(-\theta) \, Z^{(1)} \, C^{(2)}NOT^{(1)} +$$

+

where $Z^{(1)}$ is the single-qubit $Z$ gate applied to the first qubit.

+",10480,,,,,12/7/2020 0:08,,,,1,,,,CC BY-SA 4.0 +15012,2,,15004,12/7/2020 0:58,,3,,"

The dimension of the Hilbert space associated to a quantum system does not have to be two. Quantum systems whose Hilbert space is two-dimensional - known as qubits - are the most popular, but they do not exhaust all possibilities. For example:

+
    +
  • qutrit has a three-dimensional Hilbert space and its computational basis states are often labeled $|0\rangle, |1\rangle, |2\rangle$,
  • +
  • a system of two qubits has a Hilbert space with four dimensions and even though the basis states are often labeled as $|00\rangle, |01\rangle, |10\rangle, |11\rangle$, one could also named them $|0\rangle, |1\rangle, |2\rangle, |3\rangle$,
  • +
  • a system of $n$ qubits has a Hilbert space with dimension $2^n$,
  • +
  • quantum harmonic oscillator has countably infinite dimensional Hilbert space.
  • +
+

Answering your question more directly: Your expansion of the sum in the question is correct and $|2\rangle, |3\rangle$ simply refer to the third and fourth states in the computational basis of the four-dimensional Hilbert space.

+",10480,,10480,,12/7/2020 1:23,12/7/2020 1:23,,,,0,,,,CC BY-SA 4.0 +15013,1,15021,,12/7/2020 3:49,,3,547,"

I am trying to understand the integration on page 4 of this paper. Consider a Haar random circuit $C$ and a fixed basis $z$. Each output probability of a Haar random circuit (given by $|\langle z | C |0^{n} \rangle |^{2}$, for each fixed z) is distributed according to the Porter Thomas distribution, given by +\begin{equation} +\text{PorterThomas}(x) = 2^{n} e^{-2^{n} x}. +\end{equation}

+

The paper claims that +\begin{equation} +\mathbb{E}[|\langle z | C |0^{n} \rangle |^{2}] = \int_{0}^{\infty} \frac{x}{2^{n}} x e^{-x} \,dx = \frac{2}{2^{n}}. +\end{equation}

+

However, I do not understand the integration at all. Shouldn't the integration instead be

+

\begin{equation} +\mathbb{E}[|\langle z | C |0^{n} \rangle |^{2}] = \int_{0}^{\infty} x ~2^{n} e^{-2^{n} x} \,dx = \frac{1}{2^{n}}, +\end{equation} +where I am just using the definition of the expected value and plugging in the pdf for Porter Thomas. However, this gives me a very different answer.

+

Where are all the extra terms coming from and why is the answer $\frac{2}{2^{n}}$?

+",1351,,55,,10/20/2022 15:17,10/20/2022 15:17,Computing expectation value of $|\langle z|C|0^n\rangle|^2$ over Haar random circuit,,2,0,,,,CC BY-SA 4.0 +15014,1,15016,,12/7/2020 4:32,,3,211,"

I'm trying to use Cirq with TensorFlow Quantum to simulate a variational quantum classifier. There's a tutorial on the TFQ website on building a quantum neural network to classify a simplified version of MNIST, which I've been using for reference.

+

The classifier that I'm building requires building my own custom gates.

+

After encoding the data as quantum circuits, the next step is to convert these Cirq circuits to tensors using tfq.convert_to_tensor.

+

I've found that this function works fine for any built-in Cirq gates, but when I pass my own custom gate as the argument, I get ValueError: Cannot serialize op <__main__.Custom_Gate object at...

+

Here's some watered down code that gives the gist of my attempts:

+
def simple_func(x):
+    return x*cirq.z
+
+class Custom_Gate(cirq.Gate):
+    def __init__(self, x, n):
+        self.x = x
+        self.n = n
+    def _unitary_(self):
+        return simple_func(self.x)
+    def _num_qubits_(self):
+        return self.n
+    def _circuit_diagram_info_(self, args: 'cirq.CircuitDiagramInfoArgs'):
+        return ['U']
+
+x = 3
+n = 1
+U = Custom_Gate(x, n)
+q0 = cirq.GridQubit(0, 0)
+test_circuit = cirq.Circuit()
+test_circuit.append(U.on(q0))
+SVGCircuit(test_circuit)
+
+tfq.convert_to_tensor([test_circuit])
+
+

Am I making a mistake somewhere? Or does tfq.convert_to_tensor just not work for custom gates?

+

Thank you.

+",13991,,13991,,12/7/2020 21:54,9/6/2022 16:02,Does TensorFlow Quantum tfq.convert_to_tensor work on custom gates?,,1,3,,,,CC BY-SA 4.0 +15015,1,15022,,12/7/2020 5:13,,1,222,"

I have a pure quantum state $|i\rangle$ and another state $|\psi\rangle = \frac{1}{\sqrt{2}}(|i\rangle + |j\rangle)$. A state orthogonal to $|\psi\rangle$ is $|\phi\rangle$. Among these states, I know the following:

+

$$ +\langle i | \psi \rangle = \frac{1}{\sqrt{2}} \\ +\langle \phi | \psi \rangle = 0. \\ +$$ +Then, what can I say about the inner product of $|i\rangle$ and $|\phi\rangle$? I.e., is there a way to find:

+

$$ +\langle i | \phi \rangle +$$. +Thanks!

+",2403,,55,,12/25/2020 23:33,12/25/2020 23:33,Find inner product of two states given inner product of an orthogonal state,,1,0,,,,CC BY-SA 4.0 +15016,2,,15014,12/7/2020 6:02,,4,,"

I'm the engineer who looks after TensorFlow Quantum. Serializing custom gates is not supported. There is an active issue on the GitHub here: https://github.com/tensorflow/quantum/issues/354 . A quick workaround would be to try and determine the gate decomposition for your custom gate in terms of tfq.util.get_supported_gates gate instances. A good place to start might be the cirq.kak_decomposition.

+

Michael

+",11700,,,,,12/7/2020 6:02,,,,0,,,,CC BY-SA 4.0 +15017,1,,,12/7/2020 6:07,,2,157,"
    +
  1. We know that in Qiskit noise models modeling specific quantum machine prototypes exist and can be inserted into the code. However, are these models fixed in nature or they continuously improve themselves using machine learning techniques so that they can provide results ideally depicting a prototype.

    +
  2. +
  3. Also which is a better way of getting correct results. Designing a circuit in circuit composer and executing on a selected IBM machine or writing a code for the circuit in Qiskit and executing the circuit on QASM simulator with a noise model for a IBM quantum machine inserted into the code.

    +
  4. +
+",13172,,55,,12/25/2020 23:33,5/25/2021 2:04,Is Noise model for quantum prototypes accurate in Qiskit,,1,0,,,,CC BY-SA 4.0 +15018,1,15019,,12/7/2020 6:14,,1,85,"

I had a question about obtaining the probability of a certain state from the histogram, still using this example, suppose there's a variable in my quantum circuit, it's values are stored in an 'np.linspace' array. This is the result obtained from one of the elements in that array: + +If I'm only interested in the probability of the '0010' state (0.831 here), is there a faster way I can get a list (or array) of the probability of '0010' using each element in my original linspace? I tried to incorporate a few commands (like job_sim and result_sim) into a function, but that doesn't work.

+

ps: The structure of my function looks something like this:

+
from qiskit import IBMQ
+provider = IBMQ.load_account()
+sim = provider.backends.ibmq_qasm_simulator
+def qc(Variable):
+    qcz = QuantumCircuit(qrz,crz)
+    ......
+    job_sim = execute(qcz, sim)
+    result_sim = job_sim.result()
+    counts = result_sim.get_counts()
+    probs = counts['0010'] / sum(counts.values())
+    return probs
+
+

After that I want to call the function using each of the elements in my linspace.

+

update:Sorry maybe I was a bit unclear in my original question, if my simulation result is determined by some variable X, for each value of X, I might obtain a different probability of the state '0010'. If there're N values of X, all of which are stored in an array and I want to run my circuit N times, is there a faster way I can do that instead of manually changing the variable and record the result? Thanks for the help:)

+",12334,,12334,,12/7/2020 6:49,12/7/2020 7:39,Is there a faster way to get 'a list of' result from 'a list of inputs'?,,1,7,,,,CC BY-SA 4.0 +15019,2,,15018,12/7/2020 6:28,,1,,"

You can do something like this:

+
%matplotlib inline
+# Importing standard Qiskit libraries
+from qiskit import QuantumCircuit, QuantumRegister,  IBMQ, ClassicalRegister
+from qiskit.circuit import QuantumCircuit, ParameterVector
+from qiskit.compiler import transpile, assemble
+from qiskit.providers.ibmq.managed import IBMQJobManager
+from qiskit.visualization import *
+provider = IBMQ.load_account()
+backend = provider.get_backend('ibmq_valencia')
+
+def qc(Variable):
+    var_form = QuantumCircuit(2,2)
+    var_form.u1(Variable,0)
+    var_form.cx(0,1) 
+    var_form.measure([0,1],[0,1])
+    return var_form
+
+Variables = [1,2,3,4,5]
+circuits = []
+for i in range(len(Variables) ):
+    circuit =  QuantumCircuit(2,2)
+    circuit = qc(Variables[i])
+    circuits.append( circuit   )
+
+circuits = transpile(circuits, backend=backend) 
+job_manager = IBMQJobManager()
+MyExperiments = job_manager.run(circuits, backend=backend, name='MyExperiment')
+results = MyExperiments.results()
+
+

Note that qc(Variable) is spitting out circuit output of the form:

+

+

so the Ry gate is taking in the variable. You can modify the circuit to your choice.

+

Now when I run this, and look in the IBMQX results tabs I see the following:

+

+

Hope this helps.

+",9858,,9858,,12/7/2020 7:39,12/7/2020 7:39,,,,1,,,,CC BY-SA 4.0 +15020,2,,15017,12/7/2020 6:41,,1,,"

I would think the noise model are based off the calibration data of the real hardware. I am not sure how often IBM updated them. Hopefully someone from the IBM team can provide more details.

+

In term your second question/point. After designing my quantum algorithm/circuit, I would first test it on the simulator without any noise and see how it works first. Making sure that everything works the way it supposed too, at least on a small scale. Then after seeing that it works on simulator on a small scale, I can now start adding noise to the simulator to see how it performs. After all this, I would then perform circuit run on the real hardware and perhaps doing it with error mitigation techniques.

+",9858,,,,,12/7/2020 6:41,,,,1,,,,CC BY-SA 4.0 +15021,2,,15013,12/7/2020 6:53,,5,,"

The issue that easily leads to confusion is the dual role played by output bitstring probability. It enters the computation of the average in two ways. On one hand, it determines how often one sees different bitstrings. On the other hand, it determines the contribution that each bitstring makes towards the average. In mathematical terms, the output bitstring probability affects both the probability measure of the random variable as well as its value.

+

To see this, consider the following example procedure that yields $\mathbb{E}[|\langle z | C |0^{n} \rangle |^{2}]$:

+
    +
  1. Run the quantum circuit on a noiseless quantum computer or simulator and obtain the output bitstring $z$.
  2. +
  3. Simulate the quantum circuit on a classical computer to compute the value of the probability $|\langle z | C |0^{n} \rangle |^{2}$.
  4. +
  5. Repeat steps 1 and 2 to obtain the average of probabilities computed in step 2 across many output bistrings sampled in step 1.
  6. +
+

In step 1, the output bitstring probability affects the bitstrings you see - you see the more likely bitstrings more often. In step 2, it affects the value you add up in the computation of the average - the more likely bitstrings contribute more towards the average.

+

We can make this reasoning more rigorous (following section IV C of QS paper supplement). The fact that the distribution of output bitstring probabilities is Porter-Thomas means that the fraction of output bitstrings with probability in $[p, p+dp]$ is:

+

$$ +Pr(p) \, dp \approx 2^n e^{-2^np} dp. +$$

+

Since there are $2^n$ possible output bitstrings, the number of bitstrings with probability in $[p, p+dp]$ is

+

$$ +N(p) \, dp \approx 4^n e^{-2^np} dp. +$$

+

Therefore, the probability that in step 1 above we see a bitstring whose probability lies in $[p, p+dp]$ is

+

$$ +f(p) \, dp \approx p \, 4^n e^{-2^np} dp. +$$

+

Note that $f(p)$ is the probability density function for the output bitstring probability. Therefore, the average output bitstring probability is

+

$$ +\mathbb{E}[|\langle z | C |0^{n} \rangle |^{2}] = \int_0^1 p f(p) dp \approx \int_0^1 p^2 4^n e^{-2^np} dp \approx 2/2^n +$$

+

as expected.

+

You may object that $f(p)$ defined above is not correctly normalized. This is due to the fact that the exponential formula is an approximate form of the Porter-Thomas distribution which is in fact a Beta distribution

+

$$ +(2^n - 1) (1 - p)^{2^n - 2} \approx 2^n e^{-2^np}. +$$

+

In practice, this approximation is very good for $n$ above a dozen or so.

+

For completeness, note that if you were running the quantum circuits on a noisy quantum computer the distribution in step 1 would be different and the resulting average would be a number between $1/2^n$ and $2/2^n$ according to the fidelity obtained in the experiment. This is the key idea behind linear cross-entrpy benchmarking.

+",10480,,,,,12/7/2020 6:53,,,,2,,,,CC BY-SA 4.0 +15022,2,,15015,12/7/2020 7:17,,4,,"

The answer depends on the dimension $d$ of the Hilbert space.

+

If $d = 2$ then $|\phi\rangle = \frac{e^{i\theta}}{\sqrt{2}} (|i\rangle - |j\rangle)$ for some $\theta \in [0, 2\pi)$ and so $\langle i | \phi \rangle = \frac{e^{i\theta}}{\sqrt{2}}$. In other words, it can be any complex number of absolute value $\frac{1}{\sqrt{2}}$.

+

If $d > 2$ then $|\phi\rangle = \frac{a}{\sqrt{2}} (|i\rangle - |j\rangle) + b|k\rangle$ for some $a, b \in \mathbb{C}$ such that $a^2 + b^2 = 1$ and any $|k\rangle$ orthogonal to $|i\rangle$ and $|j\rangle$. Therefore, $\langle i | \phi \rangle = \frac{a}{\sqrt{2}}$. In other words, it can be any complex number whose absolute value is in $[0, \frac{1}{\sqrt{2}}]$.

+

(I assume that $\langle i|j \rangle = 0$ and all kets are normalized.)

+",10480,,,,,12/7/2020 7:17,,,,7,,,,CC BY-SA 4.0 +15023,2,,15004,12/7/2020 7:50,,3,,"

The thing that you write inside a ket is just a label. It can actually correspond to anything that you want it to. By convention, labels 0, 1, 2, 3... correspond to orthogonal states. So, you should interpret this as whatever system you're using has enough capacity to have a set of 4 orthogonal states, i.e. the Hilbert space dimension is at least 4. You're probably used to just seeing $|0\rangle$ and $|1\rangle$ because most of the time in quantum information, we deal with a qubit, which has Hilbert space dimension 2. But that's an assumption of convenience. Physically, it's far more common to have multiple levels.

+",1837,,,,,12/7/2020 7:50,,,,0,,,,CC BY-SA 4.0 +15024,2,,14976,12/7/2020 8:09,,3,,"

What you're really recognising in the structure here is that your matrix decomposes into two $2\times2$ blocks, one of which is an arbitrary single-qubit unitary, and the other is an identity matrix. Once you know how to make one such matrix, it's easy to work out how to do any other matrix of the same structure because it's just a simple basis permutation. For example, to go from $U_2$ to $U_1$, I need to change +$$ +00\rightarrow 00, 01\rightarrow 11, 10\rightarrow 10, 11\rightarrow 01. +$$ +This is achieved by a controlled-not controlled from the second qubit and targeting the first qubit. In other words, $U_1=CU_2C$, where $C$ is the aforementioned controlled-not. Of course, once you have a circuit representation of $U_2$, there may be some manipulations you can do to reduce the gate count.

+

To do $U_2$, there's a standard technique. You're familiar with the idea that any single-qubit unitary can be implemented with +$$ +U=e^{i\theta}R_z(\alpha)R_y(\beta)R_z(\gamma), +$$ +and hopefully with the identity $XR_Y(\alpha)X=R_Y(-\theta)$ (and similarly for $R_Z$). So, let's assume we've found $\theta,\alpha,\beta,\gamma$ corresponding to the $2\times 2$ block that you want to implement. To gate $U_2$, i.e. controlled-$U$, we start by apply a phase gate $R_Z(\theta)$ on the first qubit. Then we write a decomposition +$$ +R_z(\alpha)R_y(\beta)R_z(\gamma)=R_z(\alpha)R_Y(\beta/2)XR_y(-\beta/2)R_z(-(\alpha+\gamma)/2)XR_z((\gamma-\alpha)/2), +$$ +noting that if you remove the $X$ rotations, you get +$$ +R_z(\alpha)R_Y(\beta/2)R_y(-\beta/2)R_z(-(\alpha+\gamma)/2)R_z((\gamma-\alpha)/2)=I. +$$ +So, this means that we could perform the sequence $R_z((\gamma-\alpha)/2)$ on qubit 2, controlled-not targeting qubit 2, $R_y(-\beta/2)R_z(-(\alpha+\gamma)/2)$ on qubit 2, controlled-not targeting qubit 2 and finally $R_z(\alpha)$ on qubit 2. Note that if qubit 1, the control qubit, is in state $|0\rangle$, the controlled-nots do nothing and the sequence on qubit 2 is +$$ +R_z(\alpha)R_Y(\beta/2)R_y(-\beta/2)R_z(-(\alpha+\gamma)/2)R_z((\gamma-\alpha)/2)=I. +$$ +while if the control qubit is in $|1\rangle$, the sequence on qubit 2 is +$$ +R_z(\alpha)R_Y(\beta/2)XR_y(-\beta/2)R_z(-(\alpha+\gamma)/2)XR_z((\gamma-\alpha)/2)=R_z(\alpha)R_y(\beta)R_z(\gamma)=Ue^{-i\theta}. +$$

+",1837,,,,,12/7/2020 8:09,,,,0,,,,CC BY-SA 4.0 +15025,1,,,12/7/2020 9:17,,3,110,"

I am trying to write down this problem (friend/enemy graph) in a polynomial matrix form in order to understand quantum annealing better, but it seems like the problem should actually be split into multiple matrices.

+

Does anyone have any idea how to replicate this problem in a polynomial matrix?

+",13981,,9006,,12/7/2020 11:26,12/7/2020 11:26,D-WAVE QUBO Matrix Form,,0,0,,,,CC BY-SA 4.0 +15026,1,,,12/7/2020 10:30,,1,55,"

I'm curious about for which $n$ there exists a $2\times 2$ unitary matrix $U(n)$ such that for $1 \le k \le n$ $$|U^k_{1,0}(n)|^2 = \frac kn,$$ +where $U^k_{1,0}(n)$ is the lower left element of the $k$th power of $U(n)$.

+

The idea is that if such a matrix exists, then applying it $k$ times to the quantum state $|0\rangle$ will produce the quantum state $\sqrt{1-k/n}|0\rangle + \sqrt{k/n}|1\rangle$ modulo some phases, a "quantum coin" with probability $k/n$ of giving outcome 1.

+

It's easy to see that it exists for $n=2$, with an example being +$$U(2) = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & -1 \\ 1 & 1 \end{pmatrix},$$ +but I couldn't find an example for any other $n$. A bit of brute force shows that no such matrices exist for $n=3$, and suggests that indeed no other $n$ works. Perhaps there's an elegant way to prove this? Or maybe there is a construction that I missed?

+
+

I originally posted this question on Mathematics Stack Exchange, but nobody was interested about it there.

+",12541,,,,,12/7/2020 16:06,Existence of unitary matrix that produces quantum coin with given frequencies via iteration,,2,0,,,,CC BY-SA 4.0 +15027,2,,15026,12/7/2020 10:55,,1,,"

Let's try a general construction. We know that, to satisfy the $k=1$ instance, we need $U_{1,0}=1/\sqrt{n}$, up to a possible phase. But we can always take one of the elements of $U$ to be real by removing a global phase.

+

We also know that the sum mod-square of the rows and columns for a unitary is 1, and that the rows must be mutually orthogonal. This gives us a lot of structure for $U$. +$$ +U=\frac{1}{\sqrt{n}}\left(\begin{array}{cc} \sqrt{n-1}e^{i\theta_1} & -e^{i(\theta_4+\theta_1)} \\ +1 & \sqrt{n-1}e^{i\theta_4} \end{array}\right). +$$ +Now we just start multiplying it together. We find that +$$ +|U_{1,0}^2(n)|^2=\frac{4(n-1)}{n^2}\cos^2((\theta_1-\theta_4)/2). +$$ +So, for all $n\geq 2$, there's a solution for $\theta_1-\theta_4$ that gives a working $k=2$. Next, $k=3$: +$$ +|U_{1,0}^3(n)|^2=\frac{(2 (n-1) \cos (\theta_1-\theta_4)+n-2)^2}{n^3} +$$ +Since we already know the value of $\cos^2((\theta_1-\theta_4)/2)=n/(2(n-1))$, we can use the double angle formula to find $\cos (\theta_1-\theta_4)=1/(n-1)$. Hence +$$ +|U_{1,0}^3(n)|^2=\frac{1}{n}\neq\frac{3}{n}. +$$ +Hence, this only works for $n=1,2$ where we do not require that the $k=3$ condition is satisfied.

+
+

For a more elegant version, note that if the relation holds for $k=n$, it must be that +$$ +U^n=e^{i\phi}\left(\begin{array}{cc} 0 & e^{-i\theta} \\ e^{i\theta} & 0 \end{array}\right)=e^{i\phi}(\cos\theta X+\sin\theta Y). +$$ +$U$ must be an $n^{th}$ root of this, so +$$ +U^k=e^{ik\phi/n}\left(I\cos(k\pi/(2n))+i\sin(k\pi/(2n))(\cos\theta X+\sin\theta Y)\right). +$$ +In other words, +$$ +|U^k_{1,0}|^2=\sin^2(k\pi/(2n))\neq \frac{k}{n}, +$$ +with the exception of $k=1,n=2$ which, as we already know, does work. +(There are a few phase freedoms floating around here, but they don't make a difference to the final answer. I don't want to worry about them because it detracts from the simple concept of this answer.)

+",1837,,1837,,12/7/2020 13:54,12/7/2020 13:54,,,,6,,,,CC BY-SA 4.0 +15028,1,15040,,12/7/2020 12:02,,6,144,"

A few days ago, Atos company published new benchmark for quantum computers. The benchmark is called Q-Score and it is defined as follows:

+
+

To provide a frame of reference for comparing performance scores and maintain uniformity, Q-score relies on a standard combinatorial optimization problem, the same for all assessments (the Max-Cut Problem, similar to the well-known TSP – Travelling Salesman Problem, see below). The score is calculated based on the maximum number of variables within such a problem that a quantum technology can optimize (ex: 23 variables = 23 Q-score or Qs)

+
+

According to Atos, one of main advantages of the new benchmark is its link to real-life problem (Max-Cut or TSP). Moreover, the new benchmark is not purely technical as quantum volume is.

+

Atos also said that

+
+

While the most powerful High Performance Computers (HPC) worldwide to come in the near term (so called “exascale”) would reach an equivalent Q-score close to 60, today we estimate, according to public data, that the best Quantum Processing Unit (QPU) yields a Q-score around 15 Qs. With recent progress, we expect quantum performance to reach Q-scores above 20 Qs in the coming year. [....] As per the above, Atos estimates quantum superiority in the context of optimization problems to be reached above 60 Qs.

+
+

Source of quotes: Atos press release

+

Based on the quotes above, I have these objections against the Atos benchmark:

+
    +
  1. The bechmark measures only one aspect of a quantum processor (QUBO problems performance) while quantum volume takes into cosideration general properties of a quantum processor and hence it describes its average behavior. This seems more useful as QUBO problems are a narrow part of tasks which can be solved on a quantum computer.

    +
  2. +
  3. It has not been proven yet that a gate-based quantum computer or a quantum annealer provides advantage in solving QUBO task in comparison with classical computer. It seems that complexity is still exponential and there is a difference in constants only. Therefore, I would choose Shor, Grover or HHL algorithm as benchmark preferably as these algorithms reduces complexity in comparison with classical equivalents. If Atos is interested in easy-to-explain benchmark, lenght of RSA key which a quantum processor is able to factor (break) would be ilustrative as well.

    +
  4. +
  5. Proclamation that Q-Score equal to 60 means quantum supremacy is not justified. Solving QUBO problems with thousands of variables is possible on current classical (super)computers.

    +
  6. +
+

My question is whether my objections are justified and make sense.

+",9006,,,,,12/7/2020 22:00,Could a new benchmark of quantum processors Q-Score by Atos be more useful than quantum volume?,,1,0,,,,CC BY-SA 4.0 +15029,1,15030,,12/7/2020 12:26,,0,275,"

I have a system of $N$ qubits and want to construct a quantum operator $Z_i Z_j + Z_k$, where $Z_i$ denotes the Pauli-Z operator acting on the $i$th qubit. Is there any direct way in qiskit, how I could implement this?

+

I know that I can construct an operator by e.g. saying op = Z^Z, if I have a system of 2 qubits and want the operator being the Pauli-Z on each qubit. But I would like to tell qiskit the indices of the qubits that $Z$ should act on (such that on all the other qubits Identity is applied).

+

My way so far consists of constructing a Quantum Circuit and converting this to an operator by

+
circZZ = QuantumCircuit(N)  # circuit for Z_i Z_j
+circZ = QuantumCircuit(N)  # circuit for Z_k
+circZZ.z(i)
+circZZ.z(j)
+circZ.z(k)
+opZZ = CircuitOp(circZZ)  # convert circuit to operator
+opZ = CircuitOp(circZ)  # convert circuit to operator
+op = opZZ + opZ
+
+

But that means I have to create quantum circuits everytime I want to get this operator. Is there any shorter and more elegant way to create such an operator?

+",13925,,55,,12/25/2020 23:34,12/25/2020 23:34,qiskit: How to get an operator acting on a certain qubit?,,2,0,,,,CC BY-SA 4.0 +15030,2,,15029,12/7/2020 12:45,,1,,"

The class Operator has a from_label method: https://qiskit.org/documentation/stubs/qiskit.quantum_info.Operator.html?highlight=operator%20from_label#qiskit.quantum_info.Operator.from_label

+

That means you could do something like this:

+
opZZ = Operator.from_label('ZZ')
+opZ = Operator.from_label('Z')
+
+

It's possible to add opZZ and opZ into N-sized op. However, you have to call the _add by hand:

+
op = 0 * Operator.from_label('I' * N)  # Set the initial operator to zero
+op = op._add(opZZ, qargs=[i,j])
+op = op._add(opZ, qargs=[k])
+
+",1859,,13925,,12/10/2020 18:43,12/10/2020 18:43,,,,7,,,,CC BY-SA 4.0 +15031,1,,,12/7/2020 13:41,,1,383,"

I was reading the book by Nielsen & Chuang. I got the part about why we use the density operators. And then I got to the section of theorem 2.6. It says roughly this thing:-

+

The sets $|{\tilde\psi_i} \rangle$ and $|{\tilde\phi_j} \rangle$generate the same density matrix if and only if +$|{\tilde\psi_i} \rangle= u_{i,j} |{\tilde\phi_j} \rangle$, (2.166) +where $u_{i,j}$ is a unitary matrix of complex numbers, with indices $i$ and $j$, and we ‘pad’ whichever set of vectors $|{\tilde\psi_i} \rangle$ or $|{\tilde\phi_j} \rangle$ is smaller with additional vectors 0 so that the two sets have the same number of elements.

+

Ok. I will leave all this tech talk aside and now the main thing is it tries to say is, if I can find two sets of vectors that generate the same density operator, it would be related in some way.

+

Or if we think a bit more we can say that suppose we find one set of $\phi$ then from that if we apply a group of unitary operators, we can reach another set which will have the same state representation or same state? (Yes state because it will have the same density operator).

+

Is this why this theorem got a place in this book? I am missing the idea behind this theorem. Alright, this is what I thought but what do you people think?

+

If you see I am saying something wrong, please correct me.

+",13763,,55,,12/25/2020 23:34,12/25/2020 23:34,Unitary freedom in the ensemble for density matrices,,1,1,,,,CC BY-SA 4.0 +15032,2,,15026,12/7/2020 16:06,,1,,"

This is a correct version of the "elegant" version of DaftWullie's answer.

+

If the relation holds for $k=n$, then +$$ U^n = \begin{pmatrix} 0 & e^{-i\theta} \\ e^{i\theta} & 0 \end{pmatrix}, $$ modulo a global phase. Since the eigenvalues of $U^n$ are $\pm 1$, we have that $(I+U)/2$ and $(I-U)/2$ are orthogonal projectors, and thus +$$ U = e^{i \frac{2\pi a}{n}}(I+U^n)/2 + e^{i(\frac\pi n+\frac{2\pi b}{n})}(I-U^n)/2$$ +for some integers $a,b$. The $k$th power is then just +$$ U^k = e^{i \frac{2\pi k a}{n}}(I+U^n)/2 + e^{i(\frac{\pi k} n+\frac{2\pi k b}{n})}(I-U^n)/2$$ +Modulo a global phase, $U^k$ is then equal to +$$ {U'}^k = I(1+e^{i(\frac{\pi k} n+\frac{2\pi k l}{n})})/2 + U^n(1-e^{i(\frac{\pi k} n+\frac{2\pi k l}{n})})/2,$$ +for some integer $l$, which implies that +$$|U^k_{1,0}|^2 = \sin^2\left(\frac{k\pi}{n}\left(\frac12+l\right)\right).$$ This will be equal to $k/n$ for $l=0$ and $n=2k$, for example. In general it doesn't work, though, because for $k=1$ we need that +$$\frac{\pi}{n}\left(\frac12+l\right) = \pm\arcsin\frac{1}{\sqrt{n}}, $$ +but $\arcsin\frac{1}{\sqrt{n}}$ is only a rational multiple of $\pi$ for $n=1,2,$ and $4$.

+

The cases $n=1,2$ do work, but for $n=4$ we would need +$$\frac{\pi}{4}\left(\frac12+l\right) = \pm\frac{\pi}{6}, $$ +which is not possible for integer $l$.

+",12541,,,,,12/7/2020 16:06,,,,0,,,,CC BY-SA 4.0 +15033,2,,15029,12/7/2020 16:09,,1,,"

You could use the feature that the Opflow in Aqua can take integers as tensorpower, like Z ^ 5 and then fill the blanks with identities. +In a short function that could look like

+
from qiskit.aqua.operators import Z, I
+
+def get_term(i, j, k, n):
+    """i, j and k as in your description and n is the number of qubits."""
+    zz = (I ^ i) ^ Z ^ (I ^ j - i - 1) ^ Z ^ (I ^ (n - j - i - 1))
+    z = (I ^ k) ^ Z ^ (I ^ (n - k - 1))
+    return zz + z
+
+print(get_term(0, 2, 4, 5))
+# 1.0 * ZIZII
+# + 1.0 * IIIIZ
+
+

Note that the order of Z's is reversed to what you did with the circuits, so to get the same results you can just call

+
get_term(n - i - 1, n - j - 1, n - k - 1, n)
+
+

But this is just one way to get to the result, I'm sure there are many others! Your method, via circuits, is looks perfectly good to me.

+",9800,,,,,12/7/2020 16:09,,,,0,,,,CC BY-SA 4.0 +15034,1,15035,,12/7/2020 16:13,,2,73,"

Suppose I have the state $\frac{1}{2}(|0\rangle + |1\rangle)$, how can I refer to ket 0 and ket 1 in general within a state? Would "term 1" and "term 2" work?

+",14072,,55,,12/25/2020 23:36,12/25/2020 23:36,Is there a name for the terms that make up a state?,,2,0,,,,CC BY-SA 4.0 +15035,2,,15034,12/7/2020 16:22,,3,,"

If you have $|\psi \rangle = \alpha |0\rangle + \beta|1\rangle$ then you can refer to $|0\rangle$ and $|1\rangle$ as the basis states. This is generalize to $n$ qubit system as well.

+

And yes, you can just just refer to them as the $|0\rangle$ or "ket 0" state, and $|1\rangle$ or "ket 1" state.

+",9858,,9858,,12/7/2020 16:29,12/7/2020 16:29,,,,0,,,,CC BY-SA 4.0 +15036,2,,15009,12/7/2020 16:44,,2,,"
    +
  1. Fermat's little theorem says that for a prime $p$, $a^{p-1}\equiv 1\mod p$ for all $a$ co-prime to $p$. This means the order of the group of powers of $a$ will divide $p-1$, rather than $p$, hence why the algorithm uses $28$.

    +
  2. +
  3. The "input" is two-dimensional here; it should be all pairs $(a,b)$ for $0\leq a\leq 27$ and $0\leq b\leq 27$. The period you're looking for is a pair of integers $(r_1,r_2)$ such that $2^a7^{-b}\equiv 2^{a+r_1}7^{-b-r_2}\mod p$.

    +
  4. +
+

Let $x$ be the discrete log, i.e., $7\equiv 2^x\mod p$. Then we can re-write this as

+

$$ 2^a2^{-bx}\equiv 2^{a+r_1}2^{-x(b+r_2)}\mod p$$ +Since we know that $2^{28}\equiv 1\mod p$, we can treat the exponents as integers modulo $28$, i.e.,

+

$$a-bx \equiv a+r_1-x(b+r_2)\mod 28$$ +We can cancel out terms with $a$ and $b$:

+

$$\begin{align}0\equiv &r_1-xr_2\mod 28\\ +-r_1r_2^{-1}\equiv &x\mod 28\end{align}$$

+

So the discrete log is $-r_1r_2^{-1}\mod 28$.

+

This means what you really want to do is take a two-dimensional array of results for different values of $a$ and $b$, and find a period in that.

+

It looks like what you've actually found is that the order of $7$ is $7$, i.e., $7^7\equiv 1\mod p$. I don't think this has any impact on Shor's algorithm, but I'm not sure. Usually you would only apply Shor's algorithm to a prime-order group, since you can use the Pohlig-Hellman algorithm to reduce composite-order discrete logs to smaller prime-order discrete logs.

+",4517,,,,,12/7/2020 16:44,,,,1,,,,CC BY-SA 4.0 +15037,1,15053,,12/7/2020 17:52,,3,84,"

In my research, I stumbled on a smooth map: +$$\pi_{\rho_0}: B \setminus \{\rho_0\} \to \partial B$$ +where $B$ is the open Bloch ball, corresponding to the set of mixed states of a single qubit and $\partial B$ is the Bloch sphere proper, consisting of the set of pured states of a single qubit and $\rho_0 \in B$ is a fixed mixed state of a single qubit. The map is defined as follows.

+

After fixing $\rho_0 \in B$, you define the image of a mixed state $\rho \in B$, $\rho \neq \rho_0$ as the intersection of the ray starting from $\rho_0$ and passing through $\rho$ with $\partial B$ (the Bloch sphere proper). This can be characterized as follows. It is the unique pure state which can be written as a linear combination

+

$$a \rho_0 + b \rho$$

+

where $a, b \in \mathbb{R}$ such that $a + b = 1$ and $b > 1$ (and therefore $a < 0$).

+

Note that $\pi$ can be viewed as a map

+

$$ B \times B \setminus \Delta \to \partial B $$

+

mapping $(\rho_0, \rho)$ to $\pi_{\rho_0}(\rho)$, where $\Delta \subset B \times B$ is the diagonal (i.e. $\Delta$ consists of all pairs $(\rho, \rho)$ such that $\rho \in B$).

+

Then if $G = \mathrm{SU}(2)$, then $G$ acts on $B \times B$ by +$$ g.(\rho_0, \rho) := (g \rho_0 g^{-1}, g \rho g^{-1}). $$ +Moreover, $G$ acts on $\partial B$ by +$$ g.\nu = g \nu g^{-1}.$$

+

Then, if I am not mistaken, $\pi$ is $G$-equivariant.

+

This map $\pi$ seems natural. I know it appears in the literature when $\rho_0 = \frac{1}{2}I$ is at the "origin" of the Bloch ball. But did the more general $\pi_{\rho_0}$, where $\rho_0$ is any fixed mixed state of the qubit, appear in the quantum information theory literature please?

+

I would like to investigate whether there may be a link between a problem in geometry that I am interested in and quantum information theory.

+",14062,,,,,12/9/2020 8:41,Does this point-projection of a mixed state onto a pure state appear in the quantum information theory literature?,,1,3,,,,CC BY-SA 4.0 +15038,1,,,12/7/2020 18:27,,2,99,"

I'm trying to solve exercise 10.57 in Nielsen-Chuang, where you have to obtain the standard form check matrix of Shor's code. I followed the procedure laid out in the earlier chapter but then realised that applying the Gauss-Jordan method seems to leave a negative value on my $Z$-side.

+

How to interpret this, or have I just made a mistake? Here's my result: +$$\begin{bmatrix} \left.\begin{matrix} + 1& 0& 1& 1& 1& 0& 0& 0& 1\\ + 0& 1& 0& 1& 1& 1& 0& 1& 1\\ + 0& 0& 0& 0& 0& 0& 0& 0& 0\\ + 0& 0& 0& 0& 0& 0& 0& 0& 0\\ + 0& 0& 0& 0& 0& 0& 0& 0& 0\\ + 0& 0& 0& 0& 0& 0& 0& 0& 0\\ + 0& 0& 0& 0& 0& 0& 0& 0& 0\\ + 0& 0& 0& 0& 0& 0& 0& 0& 0 +\end{matrix}\right| +\begin{matrix} + 0& 0& 0& 0& 0& 0& 0& 0& 0\\ + 0& 0& 0& 0& 0& 0& 0& 0& 0\\ + 0& 0& 1& 0& 0& 0& 0& 0& 0\\ + 0& 0& 0& 1& 0& 0& 0& 0& -1\\ + 0& 0& 0& 0& 1& 0& 0& 0& 1\\ + 1& 0& 0& 0& 0& 1& 0& 0& 0\\ + 0& 1& 0& 0& 0& 0& 1& 0& 0\\ + 0& 0& 0& 0& 0& 0& 0& 1& 0 +\end{matrix} \end{bmatrix}$$

+",13661,,10480,,1/25/2021 2:34,12/16/2022 4:22,Standard form Shor's code,,1,3,,,,CC BY-SA 4.0 +15039,1,,,12/7/2020 20:05,,2,160,"

I am reading Grover's paper "Fixed-Point Quantum Search," (arXiv version with a different name) which improves on his earlier quantum research algorithm. However, I'm having difficulty in understanding some argument. How can we derive the first display on pp.4 from the last equation on pp.3 of the arXiv version. Many thanks!

+",14084,,14084,,12/9/2020 14:40,12/9/2020 14:40,"A question about Grover's paper ""Fixed-Point Quantum Search""",,0,2,,,,CC BY-SA 4.0 +15040,2,,15028,12/7/2020 22:00,,3,,"

(3) is a solid objection. I'm not sure what specifically is meant by "number of variables within a problem that a quantum technology can optimize" but we can use the results of [1] (Fig 4) test some interpretations. In that experiment, QAOA was implemented on a nearest-neighbor connectivity superconducting processor to solve 3-regular MaxCut.

+

If the benchmark is meant as "the quantum computer performed better than random guessing" then that paper's results seems to indicate a Q-score of 23 or so. But performing marginally better than random guessing on a 60 qubit processor is a weak indicator for quantum advantage, especially since the algorithm is supposed to approach optimal performance with large $p$. Alternatively, if the benchmark is to be interpreted as "the quantum computer performed better than classical problems of the same size" it seems like the Q-score threshold of 60 contradicts claims from [2], which suggests hundreds to thousands of qubits required for demonstrating advantage.

+

Repeating this exercise with other MaxCut results like [3] it seems that the Q-score would also depend strongly on the connectivity of the graph considered; this dependence suggests that the benchmark would be biased towards quantum processors with connectivity matching the fixed benchmark problem. Practically that would probably provide an advantage to trapped ion computers compared to superconducting quantum computers.

+

Objection (1) will come up with any kind of single-number benchmark you can propose, e.g. Quantum volume is more general but still appropriate mainly for algorithms that are roughly "square" in depth/width. The appropriateness of the benchmark really depends on how they intend to generalize performance from it. (2) is reasonable but perhaps not very useful for a near term device.

+
+

[1] Arute, F., Arya, K., Babbush, R., Bacon, D., Bardin, J. C., Barends, R., ... & Burkett, B. (2020). Quantum approximate optimization of non-planar graph problems on a planar superconducting processor. https://arxiv.org/abs/2004.04197

+

[2] Guerreschi, G.G., Matsuura, A.Y. (2019). QAOA for Max-Cut requires hundreds of qubits for quantum speed-up. Sci Rep 9, 6903 https://www.nature.com/articles/s41598-019-43176-9

+

[3] Hamerly, R., Inagaki, T., McMahon, P. L., Venturelli, D., Marandi, A., Onodera, T., ... & Enbutsu, K. (2019). Experimental investigation of performance differences between coherent Ising machines and a quantum annealer. Science advances, 5(5) . https://arxiv.org/abs/1805.05217

+",1939,,,,,12/7/2020 22:00,,,,0,,,,CC BY-SA 4.0 +15041,1,,,12/8/2020 0:13,,1,291,"

Is there a way that can obtain sparse matrix of quantum circuit? I used to check my quantum circuit with quantum_info.Operator, but for large number of qubits, it is difficult because of the memory allocation limit. Is it available in qiskit? or should I build elementary gates in sparse matrix format? Thank you!

+",13527,,55,,12/19/2020 9:14,12/19/2020 9:14,Get a sparse matrix of quantum circuit,,1,3,,,,CC BY-SA 4.0 +15042,2,,15041,12/8/2020 3:53,,1,,"

There are classes for Operators, States, Channels, Measures, Randomness, Analysis and Synthesis in Quantum Information ( qiskit.quantum_info ).

+

There is a specific class called SparsePauliOp. It is constructed as a Sparse N-qubit operator in a Pauli basis representation. It seems to be using SciPy internally for creating the sparse matrix. It can be used for performing operator arithmetic for hundred of qubits if the number of non-zero Pauli basis terms is sufficiently small. Please find further details here in the Qiskit Terra API specifications. Qiskit Aqua as has a class called Matrix Operator where we can pass a Sparse Matrix. Please find further details here in the Qiskit Aqua API specifications.

+",4501,,4501,,12/8/2020 5:16,12/8/2020 5:16,,,,2,,,,CC BY-SA 4.0 +15043,2,,13728,12/8/2020 5:01,,0,,"

In my case, running same command ( with !pip install pylatexenc) inside the jupyter notebook solved the issue!

+",14086,,1859,,12/8/2020 11:22,12/8/2020 11:22,,,,1,,,,CC BY-SA 4.0 +15045,1,15046,,12/8/2020 7:47,,7,1042,"

When simulating a quantum circuit using the qiskit qasm_simulator, the qubits that you assign to the quantum circuit may be connected to all other qubits. In other words, if there are $n$ qubits in the quantum circuit, a single qubit can interact with all other $n-1$ qubits.

+

This is quite an unpractical hypothesis for real quantum computation. k-locality is a common criterion for a quantum computer and the only quantum computer I know of that has full qubit-connectivity is this one(I omitted the trivial cases of single- or two-qubit quantum computer). In the case of quantum devices that IBM provides via cloud access, e.g., 5-qubit ibmq_santiago, 5-qubit ibmq_5_yorktown, and 15-qubit ibmq_16_melbourne, all provide limited qubit connectivity.

+

So here arises my question: when designing a quantum circuit we have to take qubit connectivity into consideration, but how does qiskit handle this? Does it assign the job automatically (such that the quantum circuit can still work), or should I pre-assign my logical qubits to the real qubits of the IBM quantum computer by hand? And if so, how do I do that?

+",13647,,15408,,5/8/2021 15:40,5/8/2021 15:40,Qubit Connectivity of IBM Quantum Computer,,3,0,,,,CC BY-SA 4.0 +15046,2,,15045,12/8/2020 8:32,,7,,"

You can pass the parameter coupling_map to execute or transpile. This allows simulating a specific connectivity scheme as a list of edges.

+

The transpiling process (implicit during the execution process) takes care of adapting your circuit to the specific limitations of the backend or to the given limitations such as the coupling_map parameter. You can also control parts of that adaptation with parameters like initial_layout (you can define to which physical qubits you want to allocate your circuit).

+

Consider the following example:

+
from qiskit import *
+
+circuit = QuantumCircuit(3)
+circuit.cx(0, 1)
+circuit.cx(1, 2)
+circuit.cx(2, 0)
+circuit.draw('mpl')
+
+

+

This circuit requires a directed circular connectivity map. By default, transpiling this circuit takes a fully connected map, so it has no changes:

+
transpiled = transpile(circuit)
+transpiled.draw('mpl')
+
+

+

If you want to add the restriction of a particular connectivity map, you can do so with the argument coupling_map. In this case, it is a directed linear connectivity $ 0 \rightarrow 1 \rightarrow 2$:

+
transpiled = transpile(circuit, coupling_map=[[0,1], [1,2]])
+transpiled.draw('mpl')
+
+

+

Notice that a SWAP gate was added and the direction of CNOT was corrected. Also, the qubit allocation is showed on the left-hand side (e.g. logical qubit $q_0$ was allocated to physical qubit $2$.

+

You can control the qubit allocation with the parameter initial_layout. In the following example, logical $q_0$ is forced to be allocated to physical qubit 0 and so on:

+
transpiled = transpile(circuit, coupling_map=[[0,1], [1,2]], initial_layout=[0, 1, 2])
+transpiled.draw('mpl')
+
+

+",1859,,5955,,5/8/2021 10:33,5/8/2021 10:33,,,,0,,,,CC BY-SA 4.0 +15047,2,,15045,12/8/2020 8:34,,4,,"

Qiskit usually does the layout automatically, and it will do so by considering the device you are using (i.e. the qubits connectivity), of course the circuit, and the optimisation level. You can see a brief explanation on the Initial Layout part related to the optimisation level here. You will find explanation as well about this in the Mapping circuits to hardware technology part about the importance of a good layout for optimising the circuit and having the best results possible in the end.

+

You can also do it yourself. Here, you will find all of the layout selections already in Qiskit; as you can see there are a lot of ways to do this. You can also directly put the layout you wish when running your circuit in the execute function.
+Maybe if you want to play with those to better understand the difference, I would suggest to either simply try them on real hardware or on a simulator by also adding the CouplingMap and see where this leads you !

+

I hope this helps :)

+",12396,,,,,12/8/2020 8:34,,,,0,,,,CC BY-SA 4.0 +15048,1,15049,,12/8/2020 10:16,,2,501,"

I want to be able to create the circuit depicted below, but running the code below results in an empty circuit when viewing the job afterwards.

+

+
backend = provider.backends.ibmq_armonk
+
+
+qreg_q = QuantumRegister(1, 'q')
+creg_c = ClassicalRegister(1, 'c')
+circuit = QuantumCircuit(qreg_q, creg_c)
+
+circuit.u(pi/2, pi/2, pi/2, qreg_q[0])
+circuit.x(qreg_q[0])
+circuit.y(qreg_q[0])
+circuit.x(qreg_q[0])
+circuit.y(qreg_q[0])
+circuit.u(pi/2, pi/2, pi/2, qreg_q[0]).inverse()
+
+circuit.measure(qreg_q[0], creg_c[0])
+
+
+qobj = assemble(transpile(circuit, backend=backend), backend=backend)
+job = backend.run(qobj)
+retrieved_job = backend.retrieve_job(job.job_id())
+
+",14088,,55,,12/19/2020 9:15,12/19/2020 9:15,Conjugate transpose of a U-gate,,2,0,,,,CC BY-SA 4.0 +15049,2,,15048,12/8/2020 10:49,,1,,"

Indeed, your circuit can be reduced to an identity circuit as @KAJ226 nicely explains here. The transpilation process notices that and reduces your gates to idle during circuit depth optimization:

+
qreg_q = QuantumRegister(1, 'q')
+creg_c = ClassicalRegister(1, 'c')
+
+circuit = QuantumCircuit(qreg_q, creg_c)
+circuit.u(pi/2, pi/2, pi/2, qreg_q[0])
+circuit.x(qreg_q[0])
+circuit.y(qreg_q[0])
+circuit.x(qreg_q[0])
+circuit.y(qreg_q[0])
+circuit.u(pi/2, pi/2, pi/2, qreg_q[0]).inverse()
+
+circuit.measure(qreg_q[0], creg_c[0])
+
+transpile(circuit, backend=backend).draw('mpl')
+
+

+

You can avoid the optimization by reducing the optimization level to $0$:

+
transpile(circuit, backend=backend, optimization_level=0).draw('mpl')
+
+

+

In your example, you need to modify the transpile call like this:

+
qobj = assemble(transpile(circuit, backend=backend, optimization_level=0), backend=backend)
+
+",1859,,1859,,12/9/2020 10:18,12/9/2020 10:18,,,,1,,,,CC BY-SA 4.0 +15050,1,,,12/8/2020 11:18,,1,73,"

Question:

+
    +
  • Search a 'known' element in an 'unknown' quantum database
  • +
  • Alternatively, show this is fundamentally impossible (somehow related to the Holevo bound or P < NP?)
  • +
+

Related yet different:

+
    +
  • Grover Search (and related improvements): single element marked in a 'full' superposition.
  • +
  • Quantum Associative Memory (and related improvements): single element marked in a database, but the memory oracle marks all 'stored patterns' thus requires knowledge of the database (quantum phone directory).
  • +
  • Quantum Counting (and related improvements): assumes either full superposition or knowledge of database.
  • +
+

Formulation:

+
    +
  • Database structure of $t$ (qu)bits of tag and $d$ (qu)bits of data
  • +
  • An initial state with a equal superposition of tag qubits and zero in the data qubits: $|\psi_0\rangle = \sum_{x \in 2^t} (\dfrac{1}{\sqrt{2^t}} |tag_x\rangle \otimes |0\rangle^d)$
  • +
  • Unitary $U$ that evolves $|\psi_0\rangle$ to $|\psi\rangle = \sum_{x \in 2^t} (\dfrac{1}{\sqrt{2^t}} |tag_x\rangle\otimes |data_x\rangle)$
  • +
  • Thus, every binary encoded tag is unique and has an associated data, however, the data may not be unique
  • +
+

Problem:

+
    +
  • Given $t$, $d$ and the knowledge of which qubits encode the tag and the data
  • +
  • Given access to $|\psi\rangle$ in $t+d$ qubits without explicit knowledge of the superposition state
  • +
  • Search/sample associated tag/s of corresponding $|data_i\rangle$ with high probability
  • +
  • Count the number of tags storing a specific $|data_i\rangle$
  • +
+

Example:

+
    +
  • $t = 2$ qubit tag and $d = 3$ qubit data
  • +
  • $|\psi\rangle = \dfrac{1}{2} (|00.010\rangle + |01.110\rangle + |10.100\rangle + |11.110\rangle)$. The dot is notational denoting the $tag.data$ encoding.
  • +
  • $|data_i\rangle = 110$
  • +
  • Search aim: amplify the corresponding tags towards the state $\dfrac{1}{\sqrt{2}} (|01.110\rangle + |11.110\rangle)$. Note: I can mark and post-select on the data but that would succeed with very low probability if the number of marked states is low and gives no advantage if I want to sample the tags.
  • +
  • Count aim: counting the number of tags $\rvert|tag_i\rangle\rvert= 2$
  • +
+

Motivation

+
    +
  • Imagine a dictionary given as a quantum superposition of word and meanings. I have knowledge of what words are there in the dictionary and can list them classically. I want to query the meaning of a specific word. It seems counterintuitive that I need classical knowledge of the 'meaning of every word in the dictionary' to construct the quantum circuit (oracle+diffusion).
  • +
+",1153,,1859,,12/8/2020 13:15,12/8/2020 13:15,Quantum Search/Count on an unknown superposition state,,0,5,,,,CC BY-SA 4.0 +15051,2,,14751,12/8/2020 11:29,,1,,"

You can use the Quantum Associative Memory algorithm which does not require every element to be present in the database:

+ +

There are various improvements over it:

+ +

You mentioned, the same element can be present multiple times. +This can be taken care by the improvement of Grover search:

+ +

You can also use a Quantum Counting (existence) algorithm to search the number of solutions prior to running the Grover search (or the above variants).

+",1153,,,,,12/8/2020 11:29,,,,1,,,,CC BY-SA 4.0 +15052,2,,15034,12/8/2020 11:39,,1,,"

Generally, a quantum state $|\psi\rangle$ is composed of basis states $|0\rangle$ and $|1\rangle$. This come from linear algebra where any vector can be written as a sum of basis states multplied by an appropriate number. Since quantum states can be described by vectors from $\mathbb{C}^{2^n}$ (where $n$ is a number of qubits in the state), term basis states is more than appropriate.

+

You can also call these states ZERO and ONE in this particular case (a basis composed of $|0\rangle$ and $|1\rangle$ is called computational basis).

+

Just note that your state is not normalized, it should be $\frac{1}{\sqrt{2}}(|0\rangle +|1\rangle)$. Maybe, you were confused by notion that $|\psi\rangle$ collapses to either 0 or 1 with 50 % probability after measurement. However, coefficients in a quantum state are complex numbers called (quantum) amplitudes. A probability is square of amplitude absolute value.

+",9006,,13996,,12/8/2020 15:06,12/8/2020 15:06,,,,0,,,,CC BY-SA 4.0 +15053,2,,15037,12/8/2020 13:37,,3,,"

I am not aware of a direct application of this projection. However, maybe the following geometrical construction is nevertheless of interest to you.

+

Similar ray constructions appear in resource theories, namely in the definition of robustness and generalised robustness monotones.

+

Consider a convex set of states $\mathcal{F}$ which we call the free states in the resource theory. Let us denote by $\mathcal{S}$ the convex set of all states. Then, given a state $\rho$ we define the following functions +$$ +R(\rho) = \inf\big\{ t\geq 0 \; | \; \rho = (1+t)\sigma_0 - t \sigma_1 \text{ for } \sigma_0,\sigma_1\in\mathcal{F} \big\}, +$$ +$$ +GR(\rho) = \inf\big\{ t\geq 0 \; | \; \rho = (1+t)\sigma_0 - t \sigma_1 \text{ for } \sigma_0\in\mathcal{F}, \sigma_1\in\mathcal{S} \big\}. +$$ +In the definitions, we optimise over all rays going through $\mathcal{F}$ which include $\rho$.

+

If $\rho$ is pure, than $\rho$ is the projection of $\sigma_1$ w.r.t to $\sigma_0$ under your map.

+

The monotones have the following geometrical interpretation:

+
    +
  • For $R$: $\sigma_0$ is the closest state in $\mathcal{F}$ to $\rho$ measured w.r.t. to the length of the ray segment which lies in $\mathcal{F}$ (the diameter of $\mathcal{F}$ in this direction)
  • +
  • For $GR$: similar, but compared to the distance of $\sigma_0$ to the opposite boundary of $\mathcal{S}$.
  • +
+

The generalised robustness is equivalent to what is called the max-relative entropy +$$ +\mathcal{D}_\mathrm{max}(\rho) := \inf_{\sigma\in\mathcal{F}} D_\mathrm{max}(\rho||\sigma) = \log\left( 1 + GR(\rho) \right) +$$ +where $D_\mathrm{max}(\rho||\sigma)=\log \inf\{\lambda\geq 0 \, | \, \rho \leq \lambda\sigma\}$.

+

After your remark, I changed $\min$ to $\inf$. However, $\mathcal{F}$ is usually compact.

+

Here is a review on resource theories which appeared recently in RMP. The above functions and more appear in Sec. VI.

+

Chitambar and Goul: "Quantum Resource Theories". https://arxiv.org/abs/1806.06107

+",2305,,2305,,12/9/2020 8:41,12/9/2020 8:41,,,,3,,,,CC BY-SA 4.0 +15054,1,,,12/8/2020 14:32,,3,90,"

In my previous question on this, I managed to come up with a simple recursive algorithm for the sum-over-paths method. However, what other snatches of material I can find online don't use recursion when explaining it. I've tried to come up with a non-recursive form of the algorithm but it always seems to just look like the standard Schrodinger method. What is the non-recursive form of the sum-over-paths algorithm?

+

Also, how does such an algorithm map semantically onto a diagram like this, from Aaronson's quantum computing lecture 9?

+

+",4153,,4153,,12/8/2020 15:03,12/8/2020 15:03,What is the non-recursive form of the sum-over-paths simulation algorithm?,,0,0,,,,CC BY-SA 4.0 +15055,2,,15045,12/8/2020 16:20,,0,,"

Just to add to the other two good answers, we don't just have qubit layout constraint but also available gates. For instance, SWAP gate or an arbitrary two qubit controlled gate is not being implemented directly as a native gate on current hardware. This is something we should take into account when transpiled the circuit as well.

+

Fr example, let's us take a similar circuit to the one given by @Luciano:

+

+

setting basis_gates= ['u1', 'u2', 'u3', 'cx'] in your transpile call, you might get something like this:

+

+",9858,,,,,12/8/2020 16:20,,,,0,,,,CC BY-SA 4.0 +15056,2,,15048,12/8/2020 20:56,,3,,"

Just want to add a small additional detail here that might be useful for future encounter.

+

The reason why you see the circuit with only measurement after the transpilation process is because $(XY)^\dagger = Y^\dagger X^\dagger = -XY$. Since

+

$$ XY = \begin{pmatrix} 0 & 1\\ 1 & 0 \end{pmatrix}\begin{pmatrix} 0 & -i\\ i & 0 \end{pmatrix} = \begin{pmatrix} -i & 0\\ 0 & i \end{pmatrix}$$ +and +$$ (XY)^\dagger = Y^\dagger X^\dagger = \begin{pmatrix} 0 & -i\\ i & 0 \end{pmatrix} \begin{pmatrix} 0 & 1\\ 1 & 0 \end{pmatrix} = \begin{pmatrix} i & 0\\ 0 & -i \end{pmatrix}$$

+

Now note that $(XY)(XY)^\dagger =I $ because of definition of Unitary, and so $ XYXY = -XY(XY)^\dagger = -I $ but in quantum computing, global phase doesn't matter, so $-I = I$... since there is no experiment you can do to distinguish $|0\rangle$ from $-|0\rangle$.

+

Now, looking at your circuit, we have: +$$UXYXYU^\dagger = UXY[-(XY)^\dagger] U^\dagger = -[UXY(XY)^\dagger U^\dagger] = -[U I U^\dagger] = -[UU^\dagger] = -I \equiv I $$
+During the transpilation step, it recognizes this and made the reduction to save the possible number of quantum operations needed...hence the reason why your circuit only consists of the measurement procedure.

+",9858,,,,,12/8/2020 20:56,,,,0,,,,CC BY-SA 4.0 +15057,1,15083,,12/8/2020 21:28,,3,355,"

I've come across this paper about a single-qubit-gate-only QFT implementation. In the paper it is claimed that measuring a qubit after applying the Hadamard gate (it isn't called Hadamard gate in the paper but its description matches that of the Hadamard gate) is no different from measuring before the gate.

+

Now what I assumed is that the measurement before the gate would have been made in the $\{|0⟩,|1⟩\}$ basis and the measurement after the gate would have been made in the $\{|+⟩,|-⟩\}$ basis.

+

However, I came across these conflicting sources about the term "Computational Basis" regarding measurement:

+ +

So my questions are:

+
    +
  1. Does saying "measure in the computational basis" means that in whatever basis you qubits are in you measure them according to that basis to get classical bits or does it always refer to measuring in the {|0⟩,|1⟩} basis?
  2. +
  3. If it is the latter then how does the claim hold when we know that $H|0\rangle=\frac{1}{\sqrt 2}(|0⟩+|1⟩)$ and $H|1\rangle=\frac{1}{\sqrt 2}(|0⟩-|1⟩)$ so the probabilities of measuring an outcome after H should be $\frac{1}{2}$ regardless of the original state of the qubit?
  4. +
+",14095,,,,,12/10/2020 11:13,Measuring in the computational basis in the single qubit gate QFT implementation,,1,0,,,,CC BY-SA 4.0 +15058,1,15069,,12/8/2020 21:34,,1,213,"

If we have a composite system over five qubits ($|\psi\rangle = |a\rangle|b\rangle|c\rangle|d\rangle|e\rangle$), and I want to project into a specific subspace of the first three systems, I can build a projector of the form $|011\rangle\langle011| \otimes I_{de}$ (for example). Before projecting, state $|\psi\rangle$ can be thought of as an array with length $2^5 = 32$. My goal is to do the projection and reduce the size of my vector appropriately (so now I only have an array over the final two qubits). I'm doing this in Qiskit (after I get the statevector and am done evolving). My projectors will always have the form above, just perhaps with a different bitstring (in my example, I had "011"). This is what I've done so far:

+
    +
  1. Since the projectors are diagonal, I convert the string "011" into an integer. In this case, it's 3. The corresponding matrix will look like: +$$ \begin{pmatrix} +0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ +0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ +\end{pmatrix} .$$

    +
  2. +
  3. Because the subspace is like this, the identity matrix $I_{de}$ will just be a matrix of size $2^2\times2^2$ and when we take the tensor product, we will get a matrix similar to the one above, but now the size of the matrix will be bigger, and the $1$ that's above will be the only place where the identity shows up (since everywhere else will be zero). I won't write down the matrix because it has size $32\times32$.

    +
  4. +
  5. If I have my state $|\psi\rangle$ and I want to project down, I figured I just had to find the components of my 32-element array which correspond to this subspace.

    +
  6. +
  7. If the position of the 1 in my matrix above is given by $p$ and my state is an array called psi, then I want to say that the projection is given by simply slicing my array as such: +projected = psi[(2**2)p:(2**2)*(p+1)]

    +
  8. +
+

My question is: Am I doing the right slicing in step 4? I think I am, but it's easy to get tripped up with these subspaces. I know that this won't work in general since the projection operator could be more involved, but in the case where it's diagonal like the above matrix and is only one element, do I have the steps involved correct?

+",1923,,1939,,12/10/2020 8:53,12/10/2020 8:53,How to project a composite system down into a smaller subspace in Python?,,2,4,,,,CC BY-SA 4.0 +15059,2,,15058,12/8/2020 22:30,,0,,"

In your slicing, your taking the elements of the `integers' $\{4p, 4p+1, 4p+2, 4p+3\}$. For $p = 3$, that's $\{12, 13, 14, 15\}$ or $\{01100,01101,01110,01111\}$ in binary - so that's definitely correct. However, this method breaks down if you want to project to any other qubits, for instance.

+

This can be done fairly easy if you don't make the 'full' projector $|011\rangle \langle 011| \otimes I_{de}$, but just $\langle011|\otimes I_{de}$. Or, better yet, define the projector on any set of qubits you want:

+
# Get some nice tools
+from numpy import kron, mat, eye
+
+# Define the subspace to project to. 
+# You can also have higher-dimensional subspace by summing over a basis.
+subspace_1 = np.mat([[1, 0]]) # Project on 0 state
+subspace_2 = np.mat([[0, 1]]) # Project on 1 state
+subspace_3 = np.mat([[0, 1]]) # Project on 1 state
+subspace_4 = eye(2)           # Don't project here!
+subspace_5 = eye(2)           # Don't project here!
+
+# Make the projector
+# Quick and dirty, this can be coded more elegantly
+sub12 = kron(subpace_1, subpace_2)
+sub123 = kron(sub12, subpace_3)
+sub1234 = kron(sub123, subpace_4)
+projector = kron(sub1234, subpace_5)
+
+# Project
+projected = matmul(projector, psi)
+
+

This method alows for more manageability. You can easily define the projector, for instance, for $|0+1\rangle_{123}$:

+
subspace_1 = np.mat([[1, 0]])             # Project on 0 state
+subspace_2 = (2)**(-1/2)*np.mat([[1, 1]]) # Project on + state
+subspace_3 = np.mat([[0, 1]])             # Project on 1 state
+subspace_4 = eye(2)                       # Don't project here!
+subspace_5 = eye(2)                       # Don't project here!
+
+

or $|010\rangle_{145}$:

+
subspace_1 = np.mat([[1, 0]]) # Project on 0 state
+subspace_2 = eye(2)           # Don't project here!
+subspace_3 = eye(2)           # Don't project here!
+subspace_4 = np.mat([[0, 1]]) # Project on 1 state
+subspace_5 = np.mat([[1, 0]]) # Project on 0 state
+
+

etc.

+",8141,,,,,12/8/2020 22:30,,,,2,,,,CC BY-SA 4.0 +15061,1,15065,,12/9/2020 1:20,,9,1562,"

I was reading a book and then I found this statement. I will put the text as well as a screenshot of the text.

+
+

The expectation value of an operator is the mean or average value of that operator +with respect to a given quantum state. In other words, we are asking the following +question: If a quantum state $|\psi\rangle$ is prepared many times, and we measure a given +operator $A$ each time, what is the average of the measurement results? +This is the expectation value and we write this as +$\langle A\rangle =\langle ψ|A|ψ \rangle$ (3.39)

+
+

Here is the screenshot,

+

+",13763,,55,,12/11/2020 8:46,12/11/2020 14:11,"What does it mean to ""measure an operator""?",,2,1,,,,CC BY-SA 4.0 +15062,2,,15061,12/9/2020 2:43,,3,,"

In this case, "measuring an operator" is meant to describe measuring the observable associated with the operator. More commonly one would put a "using" or "with" or "with respect to" between "measure" and "a given operator". As usual, the operator's eigenvalues correspond to measurement results for the observable, and measuring the observable collapses the quantum state to a corresponding eigenstate of the operator, with a probability for each orthogonal eigenstate equal to the probability amplitude of the eigenstate multiplied by its complex conjugate. The Pauli Z operator is the operator for measuring on the 1-qubit computational basis, with a measurement of $\left|0\right>$ being associated with an eigenvalue of 1 and $\left|1\right>$ being associated with an eigenvalue of -1, and the Pauli X operator is similarly associated with the Hadamard basis, to name two.

+

The reason the expectation value for this is given by $\left<\psi\right|A\left|\psi\right>$ can be seen through noticing what happens when $A$ acts on each of its associated eigenstates, which $\left|\psi\right>$ is in general in a superposition of. For the finite case, with the set of eigenvalues of the operator being denoted $S$, you can represent the quantum state as $\left|\psi\right> = \sum_{\lambda \in S}a_\lambda\left|s{_\lambda}\right>$, where $A\left|s_{\lambda}\right> = \lambda\left|s_{\lambda}\right>$ and $a_\lambda$ are the associated probability amplitudes. Then $A\left|\psi\right> = \sum_{\lambda \in S} \lambda a_\lambda \left|s_\lambda\right>$. With $\left<\psi\right| = \sum_{\lambda \in S}\bar a_\lambda\ \left<s_\lambda\right|$ and all the different $\left|s_\lambda\right>$ being orthogonal, we get $\left<\psi\right|A\left|\psi\right> = \sum_{\lambda \in S} \lambda a_\lambda \bar a_\lambda$. With the probability amplitudes multiplied by their complex conjugates being the probability of measurement, this is the traditional expected value formula.

+",7680,,7680,,12/11/2020 14:11,12/11/2020 14:11,,,,1,,,,CC BY-SA 4.0 +15063,1,15072,,12/9/2020 3:38,,1,270,"

I'm wondering if Cirq does (or plans to) support GPU acceleration of matrix operations, including density matrix simulations. I would like to speed up training and evaluations of variational circuits under different noise conditions when GPUs are available.

+",14100,,55,,12/11/2020 8:49,12/11/2020 8:49,Does Cirq support GPU acceleration?,,1,0,,,,CC BY-SA 4.0 +15064,1,,,12/9/2020 4:15,,1,148,"
qiskit.providers.ibmq.exceptions.IBMQBackendApiError: 'Error submitting job:....
+
+(Caused by SSLError(SSLError(1, \'[SSL: 
+WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056)....
+
+
+

I used a basic Qiskit tutorial within a Conda environment, Python3.7, Ubuntu 18. +The was no problem getting it to load account with token and display the following:

+
ibmq_qasm_simulator has 0 queued and simulated qubits
+ibmqx2 has 241 queued and 5 qubits
+ibmq_16_melbourne has 3681 queued and 15 qubits
+ibmq_vigo has 393 queued and 5 qubits
+ibmq_ourense has 507 queued and 5 qubits
+ibmq_valencia has 0 queued and 5 qubits
+ibmq_armonk has 3 queued and 1 qubits
+ibmq_athens has 13 queued and 5 qubits
+ibmq_santiago has 17 queued and 5 qubits
+
+

This is the section of code which generated the error:

+
from qiskit.tools.monitor import job_monitor
+backend = provider.get_backend('ibmq_qasm_simulator')
+config = backend.configuration()
+job = q.execute(circuit, backend, shots=10)
+job_monitor(job)
+
+

I found one reference to the issue being on their cloud and it suggested using a VPN or different Network. I also setup an IBM cloud account, but there does not appear to be a way to incorporate that into qiskit. The next thing I tried was seeing if the IP address of their cloud link being called would work just in a simple browser window along the lines of a suggestion about safe.io intercepting the SSL on Macs.

+

I also tried a few things related to OpenSSL and reinstalling that bit etc... no luck. The qiskit package was installed using PIP within Conda.

+
QisKit Version:
+qiskit-terra: 0.16.1
+qiskit-aer: 0.7.1 
+qiskit-ignis: 0.5.1 
+qiskit-ibmq-provider: 0.11.1
+qiskit-aqua: 0.8.1 
+qiskit: 0.23.1 
+
+",14101,,14101,,12/9/2020 14:21,12/9/2020 14:21,IBMQ qiskit SSL error submitting job,,1,2,,12/9/2020 14:21,,CC BY-SA 4.0 +15065,2,,15061,12/9/2020 7:54,,9,,"

Any operator Hermitian $A$ can be described using its eigenvalue decomposition +$$ +A=\sum_\lambda\lambda P_\lambda, +$$ +where $\{\lambda\}$ are the distinct eigenvalues and $P_{\lambda}$ are the projectors onto the corresponding eigenspaces. So, to talk about measuring an operator means to make a measurement using the basis $\{P_{\lambda}\}$. It also assigns a label of $\lambda$ to an outcome from the projector $P_{\lambda}$ and, since this is a numerical value, you can ask for the expected value of that number. For an initial state $|\psi\rangle$ you get answer $\lambda$ with probability $\langle\psi|P_\lambda|\psi\rangle$, so the expected value is +$$ +\sum_{\lambda}\lambda\langle\psi|P_\lambda|\psi\rangle=\langle\psi|A|\psi\rangle. +$$

+",1837,,,,,12/9/2020 7:54,,,,1,,,,CC BY-SA 4.0 +15066,1,15081,,12/9/2020 12:12,,-2,76,"

I read here that we use matrices to represent quantum logical gates.

+

But I don't like this 'point of view' because I want to build (or simulate logically with a real quantum processor, not through abstract models) mathematical structures as Hilbert space when I already have quantum circuits.
I want to understand how to build matrices with quantum logical gates as real quantum circuits.

+In other words, we let's start with some physical quantum logical gates and we want to build a matrix with those circuits.

+

Can you give me some material explaining how to build a Hilbert space with quantum circuits?

+",14110,,,,,12/11/2020 8:20,How to build a Hilbert space when do we already have concrete quantum logic gates available?,,1,4,,,,CC BY-SA 4.0 +15067,2,,15064,12/9/2020 13:14,,1,,"

This is duplicate of Error while trying to execute the Quantum Circuits in IBMQ

+

My answer from the other post:

+

This is caused by safebrowse.io blocking the url and sending back a http response (which the client interpreted as a TLS version it didn't understand). Unfortunately safebrowse.io doesn't allow whitelisting a single url, so you'll need to disable it entirely. Here’s a link on how to do it: https://howtoremove.guide/safebrowse-io-virus/#:~:text=What%20is%20Safebrowse.io%3F,compromise%20their%20system%20and%20privacy

+",12195,,,,,12/9/2020 13:14,,,,3,,,,CC BY-SA 4.0 +15068,2,,15031,12/9/2020 14:05,,2,,"

The key point is that two different ensembles can give rise to the same density matrix. And, given knowledge of only the density matrix, we cannot assign a unique ensemble to it.

+

Let's consider a simple example, the density matrix corresponding to the maximally mixed state for a qubit is $\frac{\mathbb{I}}{2}$, which can be expressed via two different ensembles, say, +\begin{align} +\frac{1}{2} | 0 \rangle \langle 0 | + \frac{1}{2} | 1 \rangle \langle 1 | = \frac{\mathbb{I}}{2} = \frac{1}{2} | + \rangle \langle + | + \frac{1}{2} | - \rangle \langle - | . +\end{align}

+

Should we, then, think of the state $\frac{\mathbb{I}}{2}$ as states $\{ | 0 \rangle, | 1 \rangle \}$ with equal probability or states $\{ | + \rangle, \{ - \} \}$ with equal probability? The point is, we cannot distinguish these two ensembles.

+

In fact, the maximally mixed state can be written as an equal convex combination of any two orthogonal pure states of the qubit. Therefore, there are infinitely many ensembles that correspond to the density matrix $\frac{\mathbb{I}}{2}$.

+

How much freedom is there in the choice of these ensembles, this is what Theorem 2.6 talks about; that these sets of states are related via a unitary $\left|\tilde{\psi}_{i}\right\rangle=\sum_{j} u_{i j}\left|\tilde{\varphi}_{j}\right\rangle$, where $u_{ij}$ is a unitary.

+",1108,,,,,12/9/2020 14:05,,,,1,,,,CC BY-SA 4.0 +15069,2,,15058,12/9/2020 15:22,,1,,"

Your slicing is correct, and gives the right answer in your example. Here is a generalization of your slicing, for the case where you may have a different string of bits.

+
import numpy as np
+
+def return_indices(subspace):
+    n_qubits = len(subspace)
+    indices = np.array(range(32)).reshape((2,)*n_qubits)
+    output_indices = indices[subspace].reshape(-1)
+    return output_indices
+
+# building a test psi to see if the code works well
+psi = np.zeros(32, dtype=np.complex)
+psi[12:16] = list(range(1,5))
+
+# representing the subspace that we would like to project on
+subspace = (0,1,1,slice(0,2),slice(0,2))
+
+output_indices = return_indices(subspace) #returns array([12, 13, 14, 15])
+
+psi[output_indices] #returns array([1.+0.j, 2.+0.j, 3.+0.j, 4.+0.j])
+
+
+

I also ran another test, by taking

+
subspace2 = (1,0,slice(0,2),1,slice(0,2))
+output_indices2 = return_indices(subspace2)
+
+

Then output_indices2 is array([18, 19, 22, 23]), as it should.

+

Edit: In case you are interested in projecting on the subspace where the first qubit is $0$, the second qubit is $1$ and the third quibit is $+$, then you can simply use linear superposition. Indeed, this is $1/\sqrt{2}$ times the projection of the state on the $|010::\rangle$ subspace plus $1/\sqrt{2}$ times the projection of the state on the $|011::\rangle$ subspace. I am using a colon, just as in Python, to indicate that the corresponding index is free. So you can adapt the code to handle a case where you have a $+$ state. However, the code is written assuming you are mostly interested in $0$ and $1$ states.

+",14062,,14062,,12/9/2020 22:17,12/9/2020 22:17,,,,0,,,,CC BY-SA 4.0 +15070,1,15111,,12/9/2020 17:35,,4,361,"

In the HHL algorithm, how do you efficiently do the $\lambda-$controlled rotation on the ancillary qubit ? It seems to me after reading around some answers that this can be done in two steps :

+
    +
  • First, we map $|\lambda\rangle\mapsto |\frac{1}{\pi}\arcsin(\frac{C}{\lambda})\rangle$, defining $|\frac{1}{\pi}\arcsin(\frac{C}{\lambda})\rangle$ to be a binary representation $|\frac{1}{\pi}\arcsin(\frac{C}{\lambda})\rangle$ with $m$ qubits.
  • +
  • Then perform a controlled rotation $U_y(|\theta\rangle \otimes |0\rangle)\mapsto |\theta\rangle \otimes \big(\cos(\theta)|0\rangle + \sin{(\theta})|1\rangle\big)$ where $U_y$ is simply +$$ +U_y(|\theta\rangle \otimes |0\rangle) = \prod_{j=1}^m (I^{\otimes^m}\otimes R_y(2\pi\theta_j/2^j)) +$$ +i.e. a sequence of controlled rotations where we successively halve the angle of rotation conditionally of the digits of the binary representation of $\theta$.
  • +
+

My question is the following how can one implement efficiently the first step in an environment such as Qiskit ?

+",14113,,55,,12/11/2020 8:49,12/11/2020 12:24,How to effectively compute eigenvalue rotation in HHL,,1,2,,,,CC BY-SA 4.0 +15071,1,,,12/9/2020 18:35,,5,174,"

Let's say we have many qubits and gates. The errors happen randomly, for example with a probability of 0.1% at each place(at this place, no quantum error correction is implemented). If the probability of no error occurs in the whole computation process is higher than 50%, we can repeat the computation maybe 100 times and choose the answer that appears most to be the correct one. In this situation, it seems that error correction is not needed.

+

Do I misunderstand sth?

+",14115,,55,,12/11/2020 8:50,12/11/2020 8:50,"In quantum computation, if the fidelity is high enough to promise over 50% success rate, is quantum error-correction still needed?",,2,2,1,,,CC BY-SA 4.0 +15072,2,,15063,12/9/2020 21:24,,1,,"

Cirq's mainline doesn't have this but you can use cirq-qulacs; which has a Variational Quantum Circuit Simulator and supports CUDA for high performance simulation.

+",362,,362,,12/9/2020 21:30,12/9/2020 21:30,,,,2,,,,CC BY-SA 4.0 +15073,1,,,12/9/2020 21:50,,2,154,"

+

Why am I getting here a measurement outcome of $00$? I measure after the first $X$ gate in a separate output bit c[1] which should result in a $1$ and I measure again after a second $X$ gate in a separate output bit c[0] which should result in a $0$, so $10$ in total. Why do I get the output $00$ as if both measurements are performed after the whole circuit? And how can I do intermediate measurements as expected?

+",14117,,55,,12/11/2020 8:50,12/11/2020 8:50,IBM quantum experience: Why are intermediate measurements ignored?,,2,0,,,,CC BY-SA 4.0 +15074,2,,15073,12/9/2020 22:33,,0,,"

The first measurement is not being ignored.

+

Your quantum state started in the state $|0\rangle$ and after the $X$ gate, it is now in the state $|1\rangle$. Measuring the qubit collapsed it into the state $|1\rangle$ again... since $|1\rangle$ is already an eigenvector of the $Z$ Pauli operator.

+

So your state never changes after the first measurement, you still in the state $|1\rangle$. Thus, after applying another $X$ gate, you get back to $|0\rangle$. That is the reason why you only see $0$ is being measured.

+
+

Edit: My comment about the first measurement "not" being ignored when looking at the measurement probabilities is incorrect.

+

However, the first measurement is not being ignore in the experiment overall... That is, say you start in the state $|0\rangle$ then apply Hadamard gate $H$ to it, make a measurement, apply another Hadamard gate $H$ and then make another measurement. If the first measurement is being ignored, then you would get back $|0\rangle$.. but in fact we don't: +

+

Now, if you put the first measurement in the first cbit1 and the second measurement on the second cbit2 then you get something like:

+

+

This was being simulated on the qasm_simulator as current device is not capable of yet doing this intermediate measurement. So on the real hardware, you can't perform any additional operations after the first measurement.

+

Another note is that if you do this in the circuit composer environment, you get something like:

+

+",9858,,9858,,12/10/2020 16:41,12/10/2020 16:41,,,,3,,,,CC BY-SA 4.0 +15075,2,,15071,12/10/2020 1:09,,4,,"

The comments said well. There is a difference between quantum error correction and your idea.

+

In the case of quantum error correction, these codes have a guarantee that if the fidelity of each operation is higher than a code-specified constant, then literally the quantum computation can be expanded with limitation(although if we enlarge the quantum system, the difficulty of maintaining a high fidelity is increased), this is called threshold theorem(see Quantum error correction for beginners, 10.4.).

+

For your case, if at one place the final possibility that no error occurs is higher than 50%, then what will happen if we double the quantum operations deployed before? Or what if we adjust the $n$-qubit case into a $2n$-qubit case?

+

So if the threshold theorem is satisfied, we have a guarantee that the quantum computation works correctly, while in your case the final probability is circuit-specified.

+

Another difference is that if no error syndrome is detected with a high probability we know that the result is right(and if any syndrome is detected we can correct it), while your idea requires mass repetition from the very beginning.

+

Finally, there is a branch called quantum error detection(see section 6 of the aforementioned paper), this branch only detect error(you can not infer the error type from the measurement result, but you will know if there is an error), and if an error happens the computation must be repeated. Maybe the analysis of this kind of protocol compared with general quantum error correction can help you.

+",13647,,,,,12/10/2020 1:09,,,,0,,,,CC BY-SA 4.0 +15076,1,15077,,12/10/2020 1:53,,6,184,"

It's a newbie question, I know. But I was just wondering if someone could help me understand why this simple circuit results with the measurement shown. I've just didn't get the last step. It's not supposed that the last Hadamard gate would cancel the first one on q[0]? Why I still got results like 011 or 111?

+

+",4197,,55,,12/11/2020 8:54,12/11/2020 8:54,Trying to understand this measurement of a simple quantum circuit,,1,0,,,,CC BY-SA 4.0 +15077,2,,15076,12/10/2020 3:06,,7,,"

You can think of the circuit operation as follows. Remembering that for Hadamard matrix: $H \times H = \mathbb{I}$, your circuit looks like the following: +$$ +H \otimes \mathbb{I} \otimes \mathbb{I}(CCNOT(H|0\rangle \otimes H|0\rangle \otimes |0\rangle )) +$$ +Let's focus on the inner-most part first: +$$ +H|0\rangle \otimes H|0\rangle \otimes |0\rangle \\ +=\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \otimes \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \otimes |0\rangle \\ += \frac{1}{2}(|000\rangle + |010\rangle + |100\rangle + |110\rangle). +$$ +Now, the action of $CCNOT$ gate is that, if the first two qubits are $1$, then the third qubit would be flipped. But notice that in the above state, only the last term has two $1$'s in it, i.e. the $|110\rangle$ term. So, the action of $CCNOT$ on the above state would be: +$$ +CCNOT(\frac{1}{2}(|000\rangle + |010\rangle + |100\rangle + |110\rangle)) \\ += \frac{1}{2}(|000\rangle + |010\rangle + |100\rangle + |111\rangle). +$$ +Now we apply the Hadamard matrix on the first qubit only: +$$ +H \otimes \mathbb{I} \otimes \mathbb{I}(\frac{1}{2}(|000\rangle + |010\rangle + |100\rangle + |111\rangle)) \\ += \frac{1}{2}(\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)|00\rangle + \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)|10\rangle + \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)|00\rangle + \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)|11\rangle)). +$$ +Simplify it! Would be a good exercise if nothing else. :) You would see that the resulting state has the terms that you have shown in the second picture.

+",2403,,2403,,12/10/2020 7:06,12/10/2020 7:06,,,,0,,,,CC BY-SA 4.0 +15079,2,,15073,12/10/2020 9:11,,3,,"

The problem is that IBM Q shows results of measurement of a final quantum state (I found this after some trial and error).

+

When you apply first $X$ gate, qubits switches from $|0\rangle$ to $|1\rangle$. The measurement result is of course 1 and this value is stored in classical register, hence you see 10 in Measurement probabilities window.

+

Now you apply another $X$ gate and this switches your qubit back to state $|0\rangle$. So, after measurement you see 0 in classical register. As I mentioned above, only final state probabilities is shown Measurement probabilities window. So, yes, the first measurement is really ignored and it seems that this is a feature of IBM Q environment, although logic says that if you save results to different classical bits, they should be preserved.

+",9006,,,,,12/10/2020 9:11,,,,2,,,,CC BY-SA 4.0 +15080,2,,14785,12/10/2020 9:26,,1,,"

I assume that you have a qubit register $q$ and given that the state of $q$ is $|\psi_i\rangle$ you want to apply $U_i$ to $q$ for $i=0,1,2$. If this is what you wish to do, then unfortunately if the states $|\psi_i\rangle$'s are not orthogonal to each other, then this kind of operations are not possible in a quantum setting in for any general $U_i$'s. This is not possible because such an operator is not unitary. For instance take the simple case of $q$ being in either the state $|0\rangle$ or $|+\rangle = \frac{|0\rangle + |1\rangle}{\sqrt{2}}$ and I wish to apply $I$ on $q$ if it is in the state $|0\rangle$ and $H$ gate on $q$ if the state of $q$ is $|+\rangle$. This mathematically would mean that I need an operator $U$ that works as follows: $$U|0\rangle=|0\rangle \text{ and } U|+\rangle = \frac{1}{\sqrt{2}}(U|0\rangle + U|1\rangle) =|0\rangle.$$ It is quite obvious that $U$ is not reversible and hence is not a unitary. So such a quantum operation does not exist.

+

However, if the states $|\psi_i\rangle$'s are orthogonal to each other and the state in $q$ is one of these states and is not any superposition of these states, then certainly you can measure and then conditioned on the measured result you can apply the $U_i$ of your choice.

+",9097,,,,,12/10/2020 9:26,,,,0,,,,CC BY-SA 4.0 +15081,2,,15066,12/10/2020 9:29,,1,,"

The Hilbert space in quantum computation is used to express quantum states. In particular, they are vectors in $\mathbb{C} ^ {2^n}$, where $n$ is number of qubits the state is composed of. Any mapping from one state to another one is expressed by a unitary matrix. +This is (a very rough) description of basics behind mathematical model of quantum computation.

+

So, if you have a circuit, you can describe its action on different input basis states, i.e. how input is transformed to output. If you express these states as a vectors in a Hilbert space, in the end you come to matrix representation of the circuit. In other words, you can construct a matrix describing the circuit based on its action on different input states.

+

Hope this helps, as the question is a little bit unclear.

+
+

EDIT: An example how to convert circuit into matrix. Let's consider CNOT gate. This gate is two qubit gate. First qubit is called control, second target. The gate performs negation on the target if control is in state $|1\rangle$, so input-output map has this form:

+
    +
  • $|00\rangle \rightarrow |00\rangle$ (control in state $|1\rangle$, target is not negated)
  • +
  • $|01\rangle \rightarrow |01\rangle$ (control in state $|1\rangle$, target is not negated)
  • +
  • $|10\rangle \rightarrow |11\rangle$ (control in state $|1\rangle$, target is negated)
  • +
  • $|11\rangle \rightarrow |10\rangle$ (control in state $|1\rangle$, target is negated)
  • +
+

Since

+

$$ +|00\rangle = \begin{pmatrix}1 \\ 0 \\ 0 \\ 0 \end{pmatrix} +|01\rangle = \begin{pmatrix}0 \\ 1 \\ 0 \\ 0 \end{pmatrix} +|10\rangle = \begin{pmatrix}0 \\ 0 \\ 1 \\ 0 \end{pmatrix} +|11\rangle = \begin{pmatrix}0 \\ 0 \\ 0 \\ 1 \end{pmatrix} +$$

+

a matrix describing CNOT gate is

+

$$ +\begin{pmatrix} +1 & 0 & 0 & 0 \\ +0 & 1 & 0 & 0 \\ +0 & 0 & 0 & 1 \\ +0 & 0 & 1 & 0 \\ +\end{pmatrix}, +$$

+

i.e. outputs are simply put one beside another. The first column of the matrix represent reactio of the gate on $|00\rangle$ input, second reaction on $|01\rangle$ etc.

+

Concerning software, I use IBM Q Experience environment and Qiskit language.

+",9006,,9006,,12/11/2020 8:20,12/11/2020 8:20,,,,5,,,,CC BY-SA 4.0 +15082,2,,15071,12/10/2020 10:21,,2,,"

All Quantum Error Correction does is suppress the probability of error compared to a 'barebones' approach. If you don't use QECC but the error rates are very low one could, in principle, do without this extra layer of suppressions.

+

However, as already pointed out, the scaling is exponential: for (an unphysical picture of) uncorrelated layers in the computation (let's say $\sim 10000$), with an error rate of $p = 10^{-2}$, the probability of no error happening is $(1-p)^{10000} ~= 10^{-42}$. That's not a lot.

+

You have the extra insight that we still can go for some 'majority' analysis after repeated runs. After enough repeated runs we gather some statistics, and assume the most often returned answer to be the correct one. However, with the above error rate the number of repetitions needed to get sensible statistics is, quite literally, out of this world.

+

QECC's generally suppress the error rate with an exponential factor of $2-3$; so we get $(1-p^{2})^{10000} \sim (1-p^{3})^{10000} = 0.37 \sim 0.99$. That is a tremendous improvement.

+

Remember, some computations that QC's are envisioned to perform are even hard to validate. Consider, for instance, some very big Hamiltonian, of which we ask the QC to give us its ground state energy. We have no way of checking, with a classical computer, if any returned answer even is the ground state.

+

So if we have this huge list of different computation outcomes, of which some are supposedly the correct ones, it can be very hard indeed to check if one of those outcomes is actually the correct one.

+",8141,,,,,12/10/2020 10:21,,,,0,,,,CC BY-SA 4.0 +15083,2,,15057,12/10/2020 11:13,,1,,"

Measuring in the 'Computational Basis' always means to measure in the $\{|0\rangle,|1\rangle\}^n$ basis for $n$ qubits.

+

As for your second question, I feel that you misinterpreted the author. It is certainly true that on applying the $H$ gate on $|0\rangle$ or $|1\rangle$ you would get the states $|0\rangle$ and $|1\rangle$ with equal probabilities. But the underlying idea is this: let $q$ be a qubit in the circuit given in the paper. Let $m$ many gates are applied on $q$. For some $k\le m$, see that if only the first $k$ gates actually transform the state of $q$ (by some rotation) and if for the rest of the $m-k$ gates $q$ just acts as a control qubit, then the last $m-k$ gates cannot change the state of $q$. So, if the probability of obtaining $|0\rangle$ on measuring the qubit $q$ as $|0\rangle$ was $p$ before applying the last $m-k$ gates, then even after applying the $m-k$ gates, the probability of obtaining $|0\rangle$ on measuring $q$ remains $p$. The author then uses this fact and uses the measured outcomes to control the other gates. An example might help understand. Take, for instance, the following three qubit circuit:

+

+

In this circuit, $q_0$ gets rotated in the first gate and just acts as a control qubit for the next two gates. Now notice that if you were to measure $q_0$ just after the first gate, you would get $|0\rangle$ and $|1\rangle$ with equal probabilities. But if you measure $q_0$ after all the gates have been applied, the probabilities of obtaining $|0\rangle$ and $|1\rangle$ still remain the same.

+

Next, notice that the output of this circuit is $|\psi\rangle = \frac{1}{\sqrt{2}}(|000\rangle + |111\rangle)$. So you get the states $|000\rangle$ and $|111\rangle$ with equal probabilities on measuring all the qubits of the circuit after all the gates have been applied. Now, on the other hand let us first measure the qubit $q_0$ just after $H$, then apply an $X$ gate to $q_1$ and $q_2$ only if the measured outcome of $q_0$ is 1 and then measure the qubits $q_1$ and $q_2$. Now, if the measurement of $q_0$ yields $|0\rangle$ then the other two gates have no effect on $q_1$ and $q_2$. So after the final measurement, the complete measured state would be $|000\rangle$. Similarly, if the measurement of $q_0$ yields $|1\rangle$ then the other two gates flips the qubit state in $q_1$ and $q_2$. So after the final measurement, the complete measured state would be $|111\rangle$. Now, if you perform this for some $d$ times, then for an expected $d/2$ times you obtain $|0\rangle$ during the first measurement and so obtain $|000\rangle$ as the final measurement and for an expected $d/2$ times you obtain $|1\rangle$ during the first measurement and so obtain $|111\rangle$ as the final measurement. Now, see that in both the cases, you obtain the same probability distribution. But in the first case we use two two-qubit gates but in the second case, we use no two-qubit gates. So irrespective of whether you measure a qubit after all the gates in a circuit or whether you measure a qubit just after all the rotations on it have been applied, the output probability distribution turns out to be the same. This is the idea that the author tries to convey and use in constructing the single-qubit-gate-only QFT implementation in the paper.

+",9097,,,,,12/10/2020 11:13,,,,0,,,,CC BY-SA 4.0 +15084,1,,,12/10/2020 11:57,,2,233,"

Consider a system composed of two subsystems $A$ and $B$ living in $\mathcal{H}=\mathcal{H}_A \otimes \mathcal{H}_B$. The density matrix of the system $AB$ is defined to be $\rho$. The entanglement negativity of $\rho$, defined as +$$\mathcal{N}_A(\rho) := \frac12(\|\rho^{T_A}\|_1 -1),$$ where $\rho^{T_A}$ is the partial transposition of $\rho$ and $\|\cdot\|_1$ is the trace norm, measures by how much $\rho^{T_A}$ fails to be positive semidefinite. This is useful since would $\rho$ be separable, $\rho^{T_A}$ would be positive semidefinite, hence $\mathcal{N}_A(\rho)=0$. This, along with some other nice properties makes $\mathcal{N}$ a nice entanglement measure.

+

I have read that if $\mathcal{N}_A(\rho)\neq 0$ then one can claim $A$ is entangled with $B$. This is what I don’t understand. By definition, $\mathcal{N}_A(\rho)$ measures by how much $\rho^{T_A}$ fails to be positive semidefinite, an essential property of a separable and hence a non-entangled system. Great, we know whether $\rho$ is entangled or not. However, just because we are told $\rho$ is entangled it doesn’t necessarily mean that the degrees of freedom in $A$ are entangled with those in $B$ right? I guess my problem could steem from the fact that I don’t understand the physical consequences of taking a partial transpose of $\rho$ w.r.t. some subsystem (i.e. what is the physical significance of $\rho^{T_A}$?).

+

Edit: First of all for your all your comments and generous patience. I edited the question to better address my last issue with understanding entanglement negativity.

+",14122,,10480,,3/26/2021 4:42,3/26/2021 4:42,"In a bipartite system $AB$, why does the entanglement negativity $\mathcal{N}(\rho^{T_A})$ measure the entanglement between $A$ and $B$?",,1,13,,,,CC BY-SA 4.0 +15085,2,,14961,12/10/2020 12:20,,0,,"

After thinking about it ... I came up with a peculiar answer. Consider the problem in density matrix formulation. We are given:

+

$$ \langle \hat O^s \rangle = \text{Tr } \rho \hat O^s $$

+

Let us write in terms of eigenvalues $ O_i$ of $\hat O$:

+

$$ \langle \hat O^s \rangle = \sum_{i,j =1}^N \rho_{i,j} O_j^s $$

+

Let us scalar multiply with a constant $k_0$ raise to the power $1/s$ and take limit $s \to \infty$:

+

$$ \lim_{s \to \infty}\langle k_0 \hat O^s \rangle^{1/s} = \begin{cases} + O_{max} & k_0 \sum_{i=1}^N \rho_{i,max} \geq 1 \\ + 0 & \text{otherwise} + \end{cases} $$

+

To convince yourself of the above consider the toy version with $s \to \infty$ and $a> b>1$: +$$ \lim_{s \to \infty}(a5^s + b3^s)^{1/s} = 5$$

+

Let us assume we are lucky or finetune $k_0$ and do not get $0$. Now to get the next eigenvalue we can subtract by $ (k_1 O_{max})^s$. Then we will fine tune $k$ such that:

+

$$ \lim_{s \to \infty} ( \langle k_0 \hat O^s \rangle - (k_0 k_1 O_{max})^s )^{1/s} = \begin{cases} + O_{max - 1} & k_0 k_1 \sum_{i=1}^N \rho_{i,max - 1} \geq 1 \text{ and } k_1 = \sum_{i=1}^N \rho_{i,max} \\ + 0 & \text{otherwise} + \end{cases} $$

+

Keep repeating until all eigenvalues are found and all summation of columns (out of order) of $\rho$ are found. The columns must be now arranged in a way such that $\text{ Tr} \rho = 1$. I suspect this is the best we can do

+",5045,,,,,12/10/2020 12:20,,,,4,,,,CC BY-SA 4.0 +15086,2,,15084,12/10/2020 13:14,,4,,"

There is no good definition of what is an "amount of entanglement". We have some requirements, such as saying that a measure of entanglement must be convex and cannot increase under local operations, but beyond that it is really a matter of taste.

+

There is a nice interpretation of entanglement negativity, though, in the case that $\rho^{T_A}$ only has a single negative eigenvalue. Let it be $-\lambda$. Then by construction $\mathcal N(\rho) = \lambda$, and $d\mathcal N(\rho)$ almost coincides with the amount of white noise you must add to $\rho$ before it becomes separable.

+

This is another measure of entanglement, called random robustness, defined more precisely as $R(\rho)$ being the minimal $s \ge 0$ such that the state +$$\rho' = \frac1{1+s}(\rho + s I/d)$$ +is separable.

+

I'm saying almost because $\rho^{T_A} \ge 0$ in general does not imply that $\rho$ is separable. But in the cases when it does, $R(\rho)$ is the minimal $s$ such that +$${\rho'}^{T_A} = \frac1{1+s}(\rho^{T_A} + s I/d) \ge 0,$$ which is precisely $d\lambda$.

+

More generally, I don't know any nice interpretation for entanglement negativity.

+",12541,,12541,,12/10/2020 15:59,12/10/2020 15:59,,,,12,,,,CC BY-SA 4.0 +15087,1,15088,,12/10/2020 17:13,,1,49,"

I'm running a couple of circuits at the same time using an array of variables. However, I met an issue regarding accessing the counts. Here's part of the code I have:

+
probsu = []
+circuits = []
+
+for i in range(len(Variable)):
+    circuit =  QuantumCircuit(qrz,crz)
+    circuit =  qc(Variable[i])
+    circuits.append(circuit)
+    prob = counts['1001'] / sum(counts.values()) **Issue here**
+    probsu.append(prob)                          **Issue here**
+
+circuits = transpile(circuits, backend=backend) 
+job_manager = IBMQJobManager()
+MyExperiments = job_manager. run(circuits, backend=backend, name='MyExperiment')
+results = MyExperiments.results()
+counts = results.get_counts(circuit)
+
+

I'm not able to get the counts since the line is referenced before the definition in the last line. However, there will be similar issues pop up if I remove the bottom lines before the for loop. How can I resolve this issue? Thanks:)

+",12334,,,,,12/10/2020 17:57,How can I resolve this get_count issue from running multiple circuits?,,1,2,,,,CC BY-SA 4.0 +15088,2,,15087,12/10/2020 17:45,,1,,"

You mean something like this?

+
%matplotlib inline
+# Importing standard Qiskit libraries
+from qiskit import QuantumCircuit, QuantumRegister,  IBMQ, ClassicalRegister
+from qiskit.circuit import QuantumCircuit, ParameterVector
+from qiskit.compiler import transpile, assemble
+from qiskit.providers.ibmq.managed import IBMQJobManager
+from qiskit.visualization import *
+provider = IBMQ.load_account()
+backend = provider.get_backend('ibmq_qasm_simulator')
+
+def qc(Variable):
+    var_form = QuantumCircuit(2,2)
+    var_form.ry(Variable,0)
+    var_form.cx(0,1) 
+    var_form.h(1)
+    var_form.measure([0,1],[0,1])
+    return var_form
+
+Variables = [1,2,3,4,5]
+circuits = []
+for i in range(len(Variables) ):
+    circuit =  QuantumCircuit(2,2)
+    circuit = qc(Variables[i])
+    circuits.append( circuit   )
+
+
+circuits = transpile(circuits, backend=backend) 
+job_manager = IBMQJobManager()
+MyExperiments = job_manager.run(circuits, backend=backend, shots =1000, name='MyExperiment')
+results = MyExperiments.results()
+
+probsu = []
+for i in range(len(Variables) ):
+    prob = results.get_counts(i)['11']/sum( results.get_counts(i).values() ) 
+    probsu.append(prob) 
+print('probability of getting |11> at each circuit:', probsu)
+
+

which generate the output:

+
probability of getting |11> at each circuit: [0.121, 0.33, 0.458, 0.417, 0.178]
+
+

the output above corresponds to the probabilities of reading out $|11\rangle$ on each of the 5 circuits... You can modify this circuit to your purpose... as this is only an example.

+",9858,,9858,,12/10/2020 17:57,12/10/2020 17:57,,,,0,,,,CC BY-SA 4.0 +15089,1,15091,,12/10/2020 19:20,,5,154,"

Let $\mathcal{E}_{A\rightarrow B}$ be a quantum channel and consider its $n-$fold tensor product $\mathcal{E}^{\otimes n}_{A^n\rightarrow B^n}$.

+

Any isometry $V_{A\rightarrow BE}$ that satisfies $\text{Tr}_E(V\rho V^\dagger) = \mathcal{E}(\rho)$ can be used to construct a Stinespring dilation of $\mathcal{E}^{\otimes n}$. Indeed, a valid Stinespring dilation of $\mathcal{E}^{\otimes n}$ is simply $V^{\otimes n}$.

+

Is there any other Stinespring dilation of $\mathcal{E}^{\otimes n}$ that has a smaller environment size than $|E|^n$?

+",4831,,55,,5/23/2022 17:07,5/23/2022 17:07,Does $\mathcal E^{\otimes n}$ admit a more efficient Stinespring dilation than the one used for $\mathcal E$?,,1,0,0,,,CC BY-SA 4.0 +15091,2,,15089,12/10/2020 20:38,,7,,"

No.

+

The minimal size of the environment is just the rank of the Choi matrix of $\mathcal E$, call it $J(\mathcal E)$. Since $J(\mathcal E^{\otimes n}) = \big(J(\mathcal E)\big)^{\otimes n}$ and $\text{rank}(A \otimes B) = \text{rank}(A)\text{rank}(B)$, the minimal size of the environment is just $\text{rank}\big(J(\mathcal E)\big)^n$.

+",12541,,,,,12/10/2020 20:38,,,,4,,,,CC BY-SA 4.0 +15092,1,,,12/10/2020 22:27,,5,89,"

In Neilsen and Chuang, chapter 4.5.2 (~p.193), why did the authors come to the conclusion that complexity of operations $C^n(X)$ and $C^n(\tilde{U})$ is $O(n)$? + +Did they assume using work qubits? If so, then is it true that the complexity in terms of gates has nothing to do with the complexity in terms of space (amount of qubits) and thus, any number of additional qubits is allowed using this notation?

+

Without work qubits this result seems suspicious, since in exercises 4.29 and 4.30 a reader is supposed to find a circuit of complexity $O(n^2)$ using no work qubits: +

+",13812,,55,,12/11/2020 8:56,12/11/2020 8:56,Complexity of controlled operations in a two-level unitary operation,,0,1,0,,,CC BY-SA 4.0 +15093,1,,,12/10/2020 23:00,,2,116,"

I am having trouble understanding how the transpiler works in IBM quantum computers. I am studying the spatial noise correlation between two qubits in an IBM Q device. For that, I don't want the transpiler to change my input circuit. Is it possible to overwrite the transpiler? Can someone explain how the transpiler works?

+",12967,,55,,12/15/2020 9:03,12/15/2020 9:03,Transpiler in IBM Quantum devices,,1,1,,12/14/2020 14:17,,CC BY-SA 4.0 +15094,2,,15093,12/10/2020 23:09,,3,,"

When transpiling you can set the optimization level to 0, to prevent the transpiler from doing anything but unrolling to the natural basis gates of the device, eg., circuit = transpile(circuit, backend, optimization_level=0).

+",9863,,,,,12/10/2020 23:09,,,,2,,,,CC BY-SA 4.0 +15095,1,15100,,12/11/2020 0:08,,2,143,"

Is it possible to design a circuit implementing the unitary matrix

+ +

$$U-\begin{bmatrix} +R_{\Theta_1} & 0 & 0 & 0 \\ +0 & R_{\Theta_2} & 0 & 0 \\ +0 & 0 & R_{\Theta_3} & 0 \\ +0 & 0 & 0 & R_{\Theta_4} \\ +\end{bmatrix}$$

+

for given four angles $\Theta_1,...,\Theta_4$ , where 0 is 2×2-dimensional zero matrix and $R_{\Theta}$ is the rotation matrix with angle $\Theta$?

+

If so, can we implement it on the available quantum programming platforms such as Qiskit, CirQ, PyQuil, or ProjectQ?

+",14089,,2005,,12/11/2020 8:00,12/11/2020 8:00,Design a circuit implementing the unitary matrix,,1,3,,,,CC BY-SA 4.0 +15096,1,15097,,12/11/2020 0:48,,0,69,"

Does CirQ support classically controlled quantum operators where the classical values obtained by the measurement?

+",14089,,,,,12/11/2020 5:37,Classically controlled quantum operators,,1,0,,,,CC BY-SA 4.0 +15097,2,,15096,12/11/2020 5:37,,1,,"

Currently, there is no mechanism for performing classical feedback in cirq. It is on the roadmap. It will probably look something like cirq.X(q)**measurement_result(key) in the end, but for now it doesn't exist.

+",119,,,,,12/11/2020 5:37,,,,1,,,,CC BY-SA 4.0 +15098,1,15103,,12/11/2020 5:38,,2,312,"

It appears that controlled-$U$ type operation is the bedrock to many quantum algorithms, for instance, phase estimation and amplitude estimation. These algorithms systematically employs the controlled-$U$ type operation on the a state, say $|\psi\rangle$, stored in an oracle register while retaining one qubit in the computational register as the control bit. Consider a general case: The control bit is brought into a superposition $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ and the $|\psi\rangle$ is not an eigenstate of operator $U$, meaning $U|\psi\rangle = |\phi\rangle$. Now, we execute the controlled-$U$ operation to have

+

$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)\otimes|\psi\rangle \xrightarrow{c-U}\frac{1}{\sqrt{2}}(|0\rangle\otimes|\psi\rangle + |1\rangle \otimes|\phi\rangle)$

+

where this basically implies that the control bit is entangled with the state in the oracle register. (Phase estimation is a special case where operator $U$ 'squeezes' out a phase factor $U|\psi\rangle = e^{\theta}|\psi\rangle$ and once this phase factor is considered back-kicked to state $|1\rangle$, the states in computational and oracle registers are separable.)

+

Here is what puzzles me. First, when we retain another bit in computational register as the control bit and apply $U$ on the oracle register, to what state are we actually applying this operator $U$? It appears in the most general case the resulting state of the control bit and the oracle register needs to be viewed as one state. Second, how does the matrix that represents this controlled-$U$ operator look like? To be more concrete, take the following 3-bit computational register as example,

+

$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)\otimes\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)\otimes\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$

+

retaining the second bit as control and apply $U$ (on the oracle register), how does that matrix look like?

+",13563,,13563,,12/11/2020 5:56,12/11/2020 9:52,How does a generic controlled-U operation work?,,3,2,,,,CC BY-SA 4.0 +15100,2,,15095,12/11/2020 7:46,,2,,"

At worst, you could perform the construction + +but depending on your different rotations, you may be able to make some efficiency savings. For example, one improvement that you can always make is you could start by applying $R_1$ on the first qubit without controlling it off anything, and then applying $R_iR_1^\dagger$ for the other three controlled-controlled operations.

+",1837,,,,,12/11/2020 7:46,,,,1,,,,CC BY-SA 4.0 +15101,2,,15098,12/11/2020 7:53,,3,,"
+

It appears in the most general case the resulting state of the control bit and the oracle register needs to be viewed as one state.

+
+

Yes, absolutely. This is rather the point of quantum computation - for any interesting computation, there will be entangling steps that mean you cannot view the state as "state of qubit 1, and state of qubit 2" but they are a single, unified state.

+
+

how does the matrix that represents this controlled-U operator look like? ... the second bit as control and apply U (on the oracle register), how does that matrix look like?

+
+

Here, you're doing nothing on the first qubit, so that means apply identity $I$ on that qubit. Hence the operator looks like +$$ +I\otimes |0\rangle\langle 0|\otimes I+I\otimes |1\rangle\langle 1|\otimes U. +$$ +Writing this as a matrix, it looks like +$$ +\left(\begin{array}{cccc} +I & 0 & 0 & 0 \\ +0 & U & 0 & 0 \\ +0 & 0 & I & 0 \\ +0 & 0 & 0 & U +\end{array}\right). +$$

+",1837,,,,,12/11/2020 7:53,,,,3,,,,CC BY-SA 4.0 +15102,1,,,12/11/2020 8:09,,2,227,"

I was trying to see the output of Bell State Measurement in IBM Quantum Experience but in the simulation down the circuit in the histogram, it showed me that the possible qubit will be $|00\rangle$ and $|01\rangle$ whereas in the Bloch sphere it showed $|00\rangle$ and $|11\rangle$ with an angle of 180 degrees. What is the reason behind this as the output states should be $|00\rangle$ and $|11\rangle$ but then it is showing $|00\rangle$ and $|01\rangle$ in the histogram and it showed me the same when I ran that circuit on the quantum computer that is $|00\rangle$ and $|01\rangle$. +This is the photo of the circuit, histogram, and Bloch Sphere.

+",14137,,9097,,12/11/2020 9:31,12/11/2020 15:34,Output of Bell State Measurement,,2,1,,,,CC BY-SA 4.0 +15103,2,,15098,12/11/2020 8:10,,3,,"

We know that operators are applied on qubits. But sometimes it does not make sense to ask the state on which we apply an operator, say $U$. For instance, take the two-qubit entangled state $|\psi\rangle = \frac{1}{\sqrt{2}}(|00\rangle+|11\rangle)$. Now, say, I would like to apply a $H$ gate on the first qubit. If I ask the state on which I will be applying the $H$ gate, it does not make sense because the state of the first qubit alone is not defined for $|\psi\rangle$. This is true whenever we try to apply any $m$-qubit gate $U$ on $m$ qubits that are part of some $n$-qubit entanglement state where $m< n$. So you were perfectly right in saying that in most cases we have to view the state of the control bit and that of the oracle register together.

+

For any $n$-qubit unitary $U$, the matrix of its controlled version $c$-$U$ can be given as $\begin{bmatrix} + I & 0 \\ + 0 & U \\ +\end{bmatrix}$ where $I$ is the identity matrix of size $2^n$ and $0$ is the zero matrix of size $2^n$. This is quite simple. But when you try to obtain the matrix corresponding to the operation where you have 3 registers and the $c$-$U$ is applied from the first register to the third, it follows a similar pattern. For instance, assume that we have three registers of the form $|+\rangle |+\rangle |\phi\rangle$, where $|\phi\rangle$ is some $n$-qubit state. Then on the assumption that the $U$ matrix is of the form $U = [u_{i,j}]_{2^n\times 2^n}$, the matrix representation of the above operation looks like the following: +$$M_u = \begin{bmatrix} + I_{2^n} & 0 & 0 & 0\\ + 0 & I_{2^n} & 0 & 0 \\ + 0 & 0 & U & 0\\ + 0 & 0 & 0 & U\\ +\end{bmatrix}_{(2^{n+2})\times (2^{n+2})}$$ where $I_{2^n}$ is the identity matrix of size $2^n$. Notice that this is a 3-qubit unitary and it is not possible to write $M_u$ as a tensor product of two matrices. This can be viewed as the operator $$|0\rangle\langle 0| \otimes I_2 \otimes I_{2^n} + |1\rangle\langle 1| \otimes I_2 \otimes U.$$ An alternative way to see this using the fact that this operation is equivalent to first swapping the first and the second qubits, then performing a $c$-$U$ with the second qubit as the control and the third register as the target and then again swapping the first and the second qubits. Mathematically, this can be given as $$M_u = (SWAP_{\{1,2\}}\otimes I_{2^n})\cdot (I_2\otimes cU_{\{2,3\}}) \cdot (SWAP_{\{1,2\}}\otimes I_{2^n})$$ where $SWAP_{\{1,2\}}$ is the matrix corresponding to the $SWAP$ gate. This can be generalized even to cases where you have $p$ many gates in between the control and the target qubits very easily.

+",9097,,9097,,12/11/2020 9:28,12/11/2020 9:28,,,,2,,,,CC BY-SA 4.0 +15105,2,,15102,12/11/2020 8:36,,2,,"

I tried to prepare Bell state with circuit described by $\text{CNOT} (H \otimes I)$ and the result is state $\frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$ as expected.

+

Here is my circuit in the composer (including the code):

+

+

After measurement on simulator I get these results

+

+

Please make sure that you measure correctly, i.e. each qubit to separate classical bit:

+
measure q[0] -> c[0];
+measure q[1] -> c[1];
+
+",9006,,1859,,12/11/2020 14:58,12/11/2020 14:58,,,,0,,,,CC BY-SA 4.0 +15106,1,,,12/11/2020 9:21,,-3,183,"

Have you ever seen the preparation of the state $a^{\star}|0\rangle+b^{\star}|1\rangle$ and $a|0\rangle+b|1\rangle$ from one initial state?

+",14136,,55,,12/15/2020 9:06,12/15/2020 9:06,Have you ever seen the preparation of the state $a^{*}|0\rangle+b^*|1\rangle$ and $a|0\rangle+b|1\rangle$ from one initial state?,,2,1,,,,CC BY-SA 4.0 +15108,2,,15098,12/11/2020 9:52,,1,,"

It appears that the answers from Tharrmashastha V and DaftWullie can be combined to give a rather general solution. Consider a $n$-qubit computational register that stores an equally weighted superposition

+

$\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)\otimes \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)\otimes \cdots \otimes \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$

+

and a generic state $|\psi\rangle$ is stored in an oracle register (doesn't have to be a qubit state). Let's assume state $|\psi\rangle$ -- as a vector -- has $m$ components.

+

Now, retain the $i^\text{th}$ qubit (in the computational register) as a control bit and apply an operator $\hat{U}$ on state $|\psi\rangle$. This operation can be represented as the following matrix

+

$\underbrace{I_{2}\otimes I_{2}\otimes\cdots I_{2}}_{i-1 \ \text{times}}\otimes |0\rangle\langle 0|\otimes \underbrace{I_{2}\otimes\cdots \otimes I_{2}}_{n-i \ \text{times}}\otimes I_{m} \\ \ + \underbrace{I_{2}\otimes I_{2}\otimes\cdots I_{2}}_{i-1 \ \text{times}}\otimes |1\rangle\langle 1|\otimes \underbrace{I_{2}\otimes\cdots \otimes I_{2}}_{n-i \ \text{times}}\otimes \hat{U}$

+

where $I_{m}$ denotes a $m$-by-$m$ identity matrix.

+",13563,,,,,12/11/2020 9:52,,,,0,,,,CC BY-SA 4.0 +15109,1,15490,,12/11/2020 10:49,,0,110,"

How can we get rid of runtime next error:

+
Traceback (most recent call last):
+  File "C:\Users\Marija\Anaconda3\lib\site-packages\projectq\types\_qubit.py", line 135, in __del__
+    self.engine.deallocate_qubit(weak_copy)
+  File "C:\Users\Marija\Anaconda3\lib\site-packages\projectq\cengines\_basics.py", line 153, in deallocate_qubit
+    tags=[DirtyQubitTag()] if is_dirty else [])])
+  File "C:\Users\Marija\Anaconda3\lib\site-packages\projectq\cengines\_main.py", line 288, in send
+    raise compact_exception  # use verbose=True for more info
+RuntimeError: Qubit has not been measured / uncomputed. Cannot access its classical value and/or deallocate a qubit in superposition!
+ raised in:
+'  File "C:\\Users\\Marija\\Anaconda3\\lib\\site-packages\\projectq\\backends\\_sim\\_pysim.py", line 139, in get_classical_value'
+'    raise RuntimeError("Qubit has not been measured / "'```
+
+ 
+
+",14089,,14089,,12/28/2020 13:05,1/12/2021 1:06,ProjectQ - Error messages,,1,4,,,,CC BY-SA 4.0 +15110,1,15318,,12/11/2020 11:28,,6,1444,"

I have two quantum circuits, and I would like to compare state vector of the first qubit and check if equals, what is the best way to do that in qiskit ?

+

Let's say I have :

+
psi = QuantumCircuit(5)
+psi.ry(np.pi/4.,0)
+psi.x(0)
+psi.x(1)
+    
+psi2 = QuantumCircuit(5)
+psi2.ry(np.pi/4.,0)
+psi2.x(0)
+
+

I'm looking for a function which returns True when qubit 0 has the same state vector in both circuits.

+

I tried to get the information from Statevector.from_instruction(psi).data, but I don't know how to extract information independently of other qubits.

+

Edit: +I get the right result with this function :

+
def QuantumCircuits_Statevectors_AreEquals(QuantumCircuit1, QuantumCircuit2, QubitIndex):
+
+        statevector1_arr = np.empty([1,2]).astype(complex)
+        statevector2_arr = np.empty([1,2]).astype(complex)
+
+        QuantumCircuit1.snapshot("qbsnap", qubits=[QubitIndex])
+        QuantumCircuit2.snapshot("qbsnap", qubits=[QubitIndex])
+
+        backend = Aer.get_backend('statevector_simulator')
+
+        snapshot1 = execute(QuantumCircuit1, backend).result().data()['snapshots']['statevector']['qbsnap']
+        snapshot2 = execute(QuantumCircuit2, backend).result().data()['snapshots']['statevector']['qbsnap']
+
+        statevector1_arr[0][0] = snapshot1[0][0]
+        statevector1_arr[0][1] = snapshot1[0][1]
+
+        statevector2_arr[0][0] = snapshot2[0][0]
+        statevector2_arr[0][1] = snapshot2[0][1]
+
+        return np.array_equal(statevector1_arr, statevector2_arr)
+
+

But maybe a cleaner solution is possible?

+",12910,,45,,12/29/2020 11:36,2/18/2021 12:36,Get state vector of a single qubit in a circuit in Qiskit,,2,4,,,,CC BY-SA 4.0 +15111,2,,15070,12/11/2020 12:24,,4,,"

There is a new approach that will be merged soon in qiskit terra (here for the PR) that uses polynomial approximation to compute $\arcsin(C/\lambda)$, and asymptotically this would be the efficient implementation.

+

In practice if you are solving a $2\times 2$ matrix or a very small system it would be better to hard code the rotations.

+

The theory and error analyses of this approach are explained in Section VI of this paper.

+",4223,,,,,12/11/2020 12:24,,,,0,,,,CC BY-SA 4.0 +15112,2,,15106,12/11/2020 13:52,,5,,"

$\langle \psi|$ is not a quantum state, but a linear functional on the set of quantum states. $|\psi\rangle$ is a quantum state, any gates that you can apply to it can only take it to quantum states, so in particular not to $\langle \psi|$.

+

Of course, mathematically it is trivial to transform $|\psi\rangle$ into $\langle \psi|$ and vice-versa, but this is not a physical transformation.

+",12541,,,,,12/11/2020 13:52,,,,4,,,,CC BY-SA 4.0 +15113,2,,15102,12/11/2020 15:34,,1,,"

You probably did something like this:

+

+

Since you are only measuring the top qubit, and a Bell state $|\psi \rangle = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}}$ has $1/2$ probability of the first qubit in the state $|0\rangle$ and $1/2$ probability of it being in the state $|1\rangle$. Hence, you got the above probabilities readout plot.

+

If you also put in the second measurement like @MartinVesely did, then you will get the right answer.

+",9858,,,,,12/11/2020 15:34,,,,0,,,,CC BY-SA 4.0 +15115,1,,,12/11/2020 22:04,,1,106,"

Can someone explain the EPR argument with a simple description using Pauli matrices?

+

Two non-commuting physical quantity are being discussed philosophically whether there is an element of reality corresponds to the theory and the possibility of getting a value with certainty when measurement was made. Two argument are stated which are

+
    +
  1. Either the Quantum Mechanic description of reality given by the wave function is not complete;
  2. +
  3. Or the physical quantities associated with non-commuting operators cannot have simultaneous reality.
  4. +
+

To clarify the ideas involved, let us consider a fundamental concept of state which is characterized by state vector, $|a\rangle$ which describe the particle’s behavior. Corresponding to every physical observable, there is an operator which operates on the state vector. +$\hat{A}|a\rangle = a|a\rangle$ +For an eigenstate $|a\rangle$ of Hermitian operator $\hat{A}$, only the eigenvalue a will be obtained after measurement, with a probability equal to unity. The state too will not suffer any change after the measurement process. We can thus predict the outcome of the measurement with a probability equal to one and without disturbing the system in any way. Therefore, by the EPR argument, for an eigenstate, the value of the corresponding observable is an element of physical reality.

+

How to explain the momentum and coordinate in the EPR paper using pauli matrices?

+",13823,,55,,1/5/2021 20:38,1/5/2021 20:38,Understanding the EPR argument with a simple description using Pauli matrices,,0,2,,,,CC BY-SA 4.0 +15116,2,,15106,12/12/2020 0:17,,2,,"

$\left<\psi\right|$ is not a state of a quantum system, it is a linear functional that takes a quantum state and returns a scalar. In terms of basic Linear Algebra, it is a row vector rather than a column vector, and the conjugate transpose of $\left|\psi\right>$. So $\left<\phi|\psi\right>$ is a scalar (inner product) while $\left|\psi\right>\left<\phi\right|$ is a matrix (outer product).

+

You may have wanted instead to convert $\left|\psi\right>$ to another ket that has all of its probability amplitudes on a basis complex conjugated, without transposing the vector, e.g. turning $\left|\psi\right> = \sum_{x = 0}^Na_x\left|x\right>$ to $\sum_{x = 0}^N \bar a_x\left|x\right>$. There is no single unitary transformation that can take any arbitrary state and complex conjugate this way since unitary transformations by their definition preserve complex inner product and if two different states go through this transformation their new inner product together would be conjugated compared to prior, so any inner products that aren't real numbers wouldn't be preserved.

+

If, however, you know in advance what the probability amplitudes of $\left|\psi \right>$ are in the computational basis, then a unitary transform that will complex conjugate at least that quantum state is $C_{jk} = \delta_{jk}e^{-2i \phi_j}$ where $\phi_j$ is the argument of $a_j$ in $\left|\psi\right>$. If you want to convert the probability amplitudes of $U\left|p_0\right>$ to their conjugates given knowledge of $U$ and $\left|p_0\right>$, then such a transformation is $\bar U C\left|p_0\right>$, where $C$ conjugates the amplitudes of $\left|p_0\right>$.

+",7680,,7680,,12/12/2020 17:18,12/12/2020 17:18,,,,2,,,,CC BY-SA 4.0 +15117,2,,14890,12/12/2020 1:00,,3,,"

This is wrong, just take $c_1>0$ and $c_2<0$.

+",491,,,,,12/12/2020 1:00,,,,0,,,,CC BY-SA 4.0 +15122,2,,14285,12/13/2020 0:53,,3,,"

If perturbations are sufficiently small and $\rho_{AB}$ has sufficiently broad support then a desired global state $\rho_{AB}'$ exists. Define

+

$$ +\rho_{AB}' = \rho_{AB} + (\rho_A' - \rho_A) \otimes \rho_B + \rho_A \otimes (\rho_B' - \rho_B) \tag1. +$$

+

Note that $\rho_{AB}'$ is Hermitian and trace one, but may not be positive. However, $\rho_{AB}'$ is positive if $\rho_{AB}$ has broad support and perturbations are not too large. For example, if

+

$$ +\|\rho_A' - \rho_A\|_2 + \|\rho_B' - \rho_B\|_2 \leq \lambda_{min}(\rho_{AB}) +$$

+

where $\lambda_{min}(X)$ denotes the smallest eigenvalue of operator $X$, then for any $|\psi\rangle$

+

$$ +\begin{align} +\langle\psi|\rho_{AB}'|\psi\rangle +& = +\langle\psi|\rho_{AB}|\psi\rangle + +\langle\psi|(\rho_A' - \rho_A) \otimes \rho_B|\psi\rangle + +\langle\psi|\rho_A \otimes (\rho_B' - \rho_B)|\psi\rangle \\ +& \geq +\lambda_{min}(\rho_{AB}) - \|\rho_A' - \rho_A\|_2 - \|\rho_B' - \rho_B\|_2 \geq 0. +\end{align} +$$

+

If $\lambda_{min}(\rho_{AB}') = 0$, then it may be possible to restrict the support of the perturbations so that an analogous inequality holds.

+

The reduced states of $\rho_{AB}'$ are

+

$$ +\begin{align} +{\rm tr}_A(\rho_{AB}') +& = {\rm tr}_A(\rho_{AB}) + \rho_B \, {\rm tr}(\rho_A' - \rho_A) + (\rho_B' - \rho_B) \, {\rm tr}(\rho_A) \\ +& = \rho_B + \rho_B' - \rho_B \\ +& = \rho_B' +\end{align} +$$

+

and similarly ${\rm tr}_B(\rho_{AB}') = \rho_A'$.

+

Finally, the distance

+

$$ +\begin{align} +\|\rho_{AB}' - \rho_{AB}\|_1 +& = \|(\rho_A' - \rho_A) \otimes \rho_B + \rho_A \otimes (\rho_B' - \rho_B)\|_1 \\ +& \leq \|(\rho_A' - \rho_A) \otimes \rho_B\|_1 + \| \rho_A \otimes (\rho_B' - \rho_B)\|_1 \\ +& = \|\rho_A' - \rho_A\|_1 + \|\rho_B' - \rho_B\|_1 \\ +& \leq 2\delta +\end{align} +$$

+

and

+

$$ +\lim_{\delta\rightarrow 0}\varepsilon(\delta) = \lim_{\delta\rightarrow 0} 2\delta = 0 +$$

+

as required.

+

Note that the above construction fails for very pure highly entangled states since in this case the reduced states are nearly completely mixed and so the two product terms in $(1)$ will contain negative elements that are not compensated for by $\rho_{AB}$.

+",10480,,,,,12/13/2020 0:53,,,,0,,,,CC BY-SA 4.0 +15123,1,,,12/13/2020 2:31,,3,394,"

I read Qiskit quantum admm on this website.

+

I doubt whether this Qiskit ADMM algorithm can run on a quantum computer. The code did import packages from Qiskit, but it doesn't create any quantum circuit.

+",14153,,55,,12/14/2020 8:39,12/14/2020 8:39,Does the Qiskit ADMM optimizer really run on quantum computers?,,2,0,,,,CC BY-SA 4.0 +15124,2,,15123,12/13/2020 3:03,,4,,"

The ADMM optimizer is a classical optimizer that will be execute on the classical computer.

+

Nowadays, because of the limitation of the hardware, we see a lot of hybrid quantum-classical algorithms. In particular, Variational algorithms. These algorithms relies on the variational principle.

+

+

Hence, part of the algorithm require a classical computer doing some optimization, for instance, running ADMM optimizer over some cost function. Thus, this is not being done on a quantum computer but rather being executed on a classical computer.

+",9858,,,,,12/13/2020 3:03,,,,2,,,,CC BY-SA 4.0 +15125,2,,15123,12/13/2020 7:36,,2,,"

ADMN optimizer is used for functions having shape +$$ +f(x,y) = q(x) + \varphi(y), +$$ +where $q(x)$ is quadratic function with binary variables and $\varphi(x)$ is convex continuous function.

+

For optimization of $\varphi(y)$ a classical optimization method is used while $q(x)$ can be optimized with a quantum optimizer (VQE, QAOA) or a classical one. Hence you can see that the algorithm can be hybrid or purely classical, it depends on algorithms you choose for optimizing $f(x,y)$.

+

When you start the optimization in Qiskit, try to log to your IBM Q Experience account where you can check if a quantum circuit was prepared and sent to IBM Q.

+

Here a part of code based on Qiskit Tutorial when you can see how to use QAOA in ADMN optimization. Please note that this code run on a state vector simulator. To run it on real quantum hardware, you have to change the backend.

+
# classical optimizer for phi function
+cobyla=CobylaOptimizer()
+# QAOA for q function
+qaoa=MinimumEigenOptimizer(QAOA(quantum_instance=BasicAer.get_backend('statevector_simulator')))
+
+qubo_optimizer = qaoa
+convex_optimizer= cobyla
+
+# initialize ADMM with classical QUBO and convex optimizer
+admm=ADMMOptimizer(params=admm_params,qubo_optimizer=qubo_optimizer,continuous_optimizer=convex_optimizer)
+
+",9006,,,,,12/13/2020 7:36,,,,2,,,,CC BY-SA 4.0 +15126,1,15128,,12/13/2020 17:57,,2,168,"

I try to decompose ansatz into gate set in order to create a circuit in qiskit for QAOA algorithm. +I don't understand how represent parametrized 2 qubit ansatz as circuit.

+

$ H{_B} = \sum_{j=1}^{n} {\sigma_j^x} $

+

$ H_{A} = \frac{1}{2}\sigma_z^1 + \frac{1}{2}\sigma_z^1\otimes\sigma_z^2 $

+

Ansatz for p=1

+

$ \left| \gamma_1,\beta_1 \right\rangle = e^{-i\beta_1H_B} e^{-i\gamma_1H_A} \left| ++ \right\rangle$

+

It is clear how a circuit for $ e^{-i\beta_1H_B} $ looks like, but I stuck in decomposing $ e^{-i\gamma_1H_A} $(more precisely it second term) into parametrised circuit acting on both qubits and depends on $\gamma_1$

+

Any help would be appreciated as well as any insight on multiple qubit decomposition.

+",14161,,14161,,12/13/2020 18:07,12/13/2020 18:32,Decomposition of 2-qubit Hamiltonian into standard gate set for QAOA,,1,0,,,,CC BY-SA 4.0 +15127,1,,,12/13/2020 18:18,,3,314,"

I'm trying to prove Bell's inequality by following the one made by Wigner, that is:

+

$P(+_a,+_b) \le P(+_a,+_c) + P(+_c,+_b)$

+

And that this proof is NOT satisfied for angles between the various axes $\hat a$, $\hat b$ and $\hat c$. +In particular I have chosen the coplanar axes (plane x-y) and that the $\hat c$ axis is the bisector of $\hat a$ and $\hat b$.

+

So I'm in the situation in the picture Graph

+

My idea is to take the singlet state (represented in this case by a specific state of the Bell state) and measure one qubit on one axis ($\hat a$, $\hat b$, $\hat c$) and the other qubit on one of the remaining axes in in such a way as to make all possible combinations.

+

In the specific situation represented in the graph, the angle that I can choose between the various axes must be a value between $0$ and $\frac \pi2$.

+

Now I come to my question: my doubt is whether it is correct how to interpret the measurement phase after I have created the singlet state (entagled state).

+

The entangled state I create it like this:

+
circ = QuantumCircuit(2,2)
+circ.x(0)
+circ.x(1)
+
+circ.h(0)
+circ.cx(0,1)
+
+

Referring to the graph I put earlier, if I wanted to now measure a long qubit $\hat a$ and a long $\hat b$ I would have to measure along x (no rotation for the first case) and rotate the second theta qubit around z and then measure along x, correct?

+

I thought about doing it this way

+
# Long a-axis for qubit 1
+circ.h(0) 
+
+# Long b-axis for qubit 2
+circ.rz(pi/3, 1) 
+circ.h(1)
+
+
+circ.measure(range(2),range(2))
+
+

I wonder if these steps are correct or I forgot something or I can do it in another way. +Because if I measured directly without applying the Hadamard operator before the measurement I would make a measurement along the z-axis I suppose, right?

+

I hope I was clear enough and that we can resolve my doubts! +Thank you for your time!

+",14162,,55,,12/14/2020 8:39,12/14/2020 8:39,How can I measure a qubit on a generic axis on Qiskit?,,0,3,,,,CC BY-SA 4.0 +15128,2,,15126,12/13/2020 18:32,,2,,"

Since $\sigma_z^1 = I \otimes Z$ and $\sigma_z^1 \otimes \sigma_z^2 = Z \otimes Z$ are commute with one another, that is +$$ [\sigma_z^1 , \sigma_z^1 \otimes \sigma_z^2 ] = \sigma_z^1 \cdot \sigma_z^1 \otimes \sigma_z^2 - \sigma_z^1 \otimes \sigma_z^2 \cdot \sigma_z^1 = \boldsymbol{0} $$ +we have that +$$ e^{i\gamma_1 H_a} = e^{i \gamma \frac{1}{2}(\sigma_z^1 + \sigma_z^1 \otimes \sigma_z^2 ) } = e^{i \gamma \frac{1}{2}\sigma_z^1 } e^{i \gamma \frac{1}{2}\sigma_z^1 \otimes \sigma_z^2 } $$ +and now note that $e^{i \gamma \frac{1}{2}\sigma_z^1 }$ has circuit construction as: (look here and here page 7 and 8)

+

+

and similarly, $ e^{i \gamma \frac{1}{2}\sigma_z^1 \otimes \sigma_z^2 } $ have the circuit construction as:

+

+

and put them together, we have the circuit construction for $e^{i \gamma \frac{1}{2}(\sigma_z^1 + \sigma_z^1 \otimes \sigma_z^2 ) }$ as:

+

+",9858,,,,,12/13/2020 18:32,,,,2,,,,CC BY-SA 4.0 +15129,1,15130,,12/13/2020 18:49,,5,704,"

Say we want to swap qubits $a$, $b$ in the same register, where $a,b \in \left \{ 0, 1,\cdots, n-1 \right \}$. What would be the corresponding matrix.

+

For those interested, I'm curious about this matrix because I'm implementing the QFT, which by default leaves the qubits in reverse order. This is generally handled with a layer of SWAP operations-but I haven't been able to find the matrix implementation.

+

For instance it is common knowledge that for $a=0$, $b=1$ (a two-qubit register) the matrix is:

+

$$SWAP=\begin{bmatrix} +1 & 0 & 0 & 0\\ +0 & 0 & 1 & 0\\ +0 & 1 & 0 & 0\\ +0 & 0 & 0 & 1 +\end{bmatrix}$$

+

I understand how this acts on $\langle 10| \equiv \left [ 0, 1, 0, 0 \right ] \leftrightarrow \langle 01| \equiv \left [ 0, 0, 1, 0 \right ] $ but I fail to see where exactly to place the two off-diagonal $1$s in the general case.

+",13987,,,,,12/13/2020 19:46,What is the matrix for a SWAP operation on two qubits?,,1,1,,,,CC BY-SA 4.0 +15130,2,,15129,12/13/2020 19:46,,6,,"

In the general case I think it's easier to consider the matrix in the form +$$ +M = \sum_{i_1,\dots,i_n, j_1, \dots j_n} c_{i_1,\dots,j_n} |i_1 \dots i_n\rangle \langle j_1 \dots j_n|, +$$ +where the $i_1, \dots, i_n,j_1, \dots, j_n$ are all binary and the $c$ with the awful index are the elements of the matrix. Now we know the transformation rules so it's not too hard to indicate which coefficients should be zero and which should be one. (I've labelled the systems $1$ to $n$ for brevity as $n-1$ is a big subscript). Now suppose we want to swap system $p$ with system $q$ where $1 \leq p < q \leq n$. We know exactly what transformation we are after so it shouldn't be too difficult to write down the transformation in the above form.

+

We know that if our state is $|i_1 \dots i_p \dots i_q \dots i_n\rangle$ then we want the map to output the state $|i_1 \dots i_q \dots i_p \dots i_n \rangle$. Well such a map is precisely defined by +$$ +\begin{aligned} +\mathrm{SWAP}_{p,q} &= \sum_{i_1,\dots,i_n} |i_1\dots i_q \dots i_p \dots i_n\rangle \langle i_1 \dots i_p \dots i_q \dots i_n| \\&= \sum_{i_1, \dots,i_n} |i_1\rangle\langle i_1|\otimes \dots \otimes |i_q\rangle \langle i_p |\otimes \dots \otimes |i_p \rangle \langle i_q| \otimes \dots \otimes |i_n\rangle \langle i_n|. +\end{aligned} +$$ +With this form we immediately know the entries of the matrix which are ones (the rest are zero). Then you have to translate this form into the matrix, if $n$ is small then you can do this by hand but it general I would write some code to generate this matrix. For example, the following (written in Mathematica) should generate the swap matrix for swapping subsystems two and three in a three qubit system.

+
outer[i_, j_] := 
+  Transpose[{UnitVector[2, i + 1]}].{UnitVector[2, j + 1]};
+(* Let's swap systems 2 and 3 in a 3 qubit system *)
+
+M = ConstantArray[0, {8, 8}];
+For[i1 = 0, i1 <= 1, i1++,
+  For[i2 = 0, i2 <= 1, i2++,
+   For[i3 = 0, i3 <= 1, i3++,
+    M = M + 
+       KroneckerProduct[outer[i1, i1] , outer[i3, i2], 
+        outer[i2, i3]];
+    ]
+   ]
+  ];
+M // MatrixForm
+
+

This outputs +$$ +\left( +\begin{array}{cccccccc} + 1 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ + 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ +\end{array} +\right). +$$ +which is what we expect $I \otimes \mathrm{SWAP}$ (do nothing on the first system and do a two qubit swap on the second and third systems).

+",9854,,,,,12/13/2020 19:46,,,,0,,,,CC BY-SA 4.0 +15131,1,15136,,12/13/2020 20:25,,0,51,"

This might seem obvious to some but I would like to know what is exactly the purpose of this? And if there is a change of basis...it's just simply taking the new basis and writing it in terms of the old basis right?

+",13030,,,,,12/14/2020 8:14,Why is it important to be in the basis in which measurements will be performed?,,1,3,,,,CC BY-SA 4.0 +15132,1,,,12/13/2020 21:11,,3,60,"

I am looking to analyze some quantum hardware designs, preferably superconducting and photonics, but I can't seem to find sources that give some detailed information. Can someone provide me designs for any of the technologies mentioned above?

+",10153,,55,,12/14/2020 8:46,12/14/2020 8:46,Are there any detailed designs for Quantum Computing hardware?,,0,5,,,,CC BY-SA 4.0 +15133,1,15139,,12/9/2020 18:13,,6,122,"

In this paper, the authors give a proof of the monogamy principle in quantum physics. I'm having trouble understanding the convexity argument in the proof of Lemma 2 (penultimate paragraph, page 2). I suggest the reader read the problem first because the background may well be unnecessary to solve the issue.

+

Quick Background:

+

Let us consider a quantum system for which the Hilbert space can be factorised into $m$ different "sites". That is to say $\mathcal{H} = \bigotimes_{k=1}^{m} \mathcal{H}_k$ where all the individual Hilbert spaces $\mathcal{H}_k$ are $2d$ dimensional for some fixed $d$, i.e. $\mathcal{H}_k = \mathbb{C}^{2d}$ for all $k$. Now let us define a set of localised two outcome observables $M_{k,i}$ with $i=1,2$ and $k=1,2,...,m$ such that they only have $\pm 1$ as their eigenvalues, and are traceless. The authors go on to show that it is possible to choose a basis in which both $M_{k,1}$ and $M_{k,2}$ take the block diagonal form $\oplus_{j=1}^{d}\mathbb{C}^2$ simultaneously for all $k$. The quantity of interest is the Bell correlation +$$B = \langle{\psi|\mathcal{B}|\psi}\rangle.$$ +where +$$\mathcal{B} = \sum_{i_1=0}^{2}...\sum_{i_m=0}^{2}c_{i_1 ... i_m}\bigotimes_{k=1}^{m}M_{k,i_k}$$ +is the Bell operator for some fixed $c_{i_1...i_m}$ coefficients. We're taking $M_{k,0}=1$ as the identity operator. As I understand it, this is useful in having terms in $\mathcal{B}$ that have operators from, say, only two sites a la the CHSH case. The authors claim that "the maximum quantum value of the Bell inequality is achieved by a state that has support on a qubit at each site". I'm assuming by "value of Bell inequality" they mean value $B$. Moreover I'm assuming by "support over one qubit", they mean when the state $|\psi\rangle$ lies entirely in exactly one $\mathbb{C}^2$ sector in all $\mathcal{H}_k$'s. Please correct me if either of these assumptions are incorrect or unreasonable.

+

Problem:

+

Let $|\psi\rangle$ be some state in $\mathcal{H}$. In the second to last paragraph in page 2, the authors define $\rho_{k,j}$ as the "reduced density matrix obtained by projecting $|\psi\rangle$ onto the $j$’th $\mathbb{C}^2$ factor of the $\bigoplus_{j=1}^{d}\mathbb{C}^2$ subspace induced by $M_{k,1}$ and $M_{k,2}$ at site $k$." Now they state that $B$ can be written as $$B = \sum_{j=1}^{d} \text{tr} (\mathcal{B}\rho_{j,k}).$$ They further argue since this is a convex sum over the $\mathbb{C}^2$ sectors, "it follows that the maximum is achieved by a state with support on a qubit at site $k$." I'm assuming they're talking about projecting $|\psi\rangle$ on the $j$'th $\mathbb{C}^2$ subspace of $k$'th site. Here are my questions.

+
    +
  1. What does the $\rho_{j,k}$ mean? It couldn't possibly mean an actual reduced density matrix obtained by tracing out all the degrees of freedom apart from $k$ because then the formula $\langle{\psi|\mathcal{B}|\psi}\rangle = \text{tr} \mathcal{B} \rho_{j,k}$ wouldn't hold as $\mathcal{B}$ has nontrivial operators on other sites too. As far as I know, this kind of expectation value formula holds only when our operator is nontrivial only on one site and identity on the rest.

    +
  2. +
  3. What does the convexity argument mean? I know what a convex sum of vectors is but I don't see a vector, or anything that can be construed as a vector, on either side of the equation. It's scalar on both sides.

    +
  4. +
  5. How does said convexity mean that $B$ is maximised with support only on one sector? What is the corresponding theorem being used here?

    +
  6. +
+

My Attempt at a solution

+

Let's define a projector $P_{j,k}$ which projects a state in $\mathcal{H}$ to the $j$'th $\mathbb{C}^2$ sector of the $k$'th site. For a state $|\psi\rangle$, I'm assuming $\rho_{j,k}\equiv P_{j,k}|\psi\rangle \langle \psi | P_{j,k}$. This may not be, and in all possibility isn't, the $\rho_{j,k}$ the paper is talking about, but I couldn't find another reasonable interpretation. Now, since both $M_{k,1}$ and $M_{k,2}$ are block diagonal in the sectors we obtain the required form $B = \sum_{j=1}^{d} \text{tr} (\mathcal{B}\rho_{j,k})$. Now assuming a dot product structure on the space of all operators on $\mathcal{H}$ given by $A\cdot B \equiv \text{tr}(AB)$, we have $B = \sum_{j=1}^{d} \mathcal{B} \cdot \rho_{j,k}$. +Since $\rho_{j,k}\cdot \rho_{j',k}=0$ if $j\neq j'$, all the $\rho_{j,k}$'s are orthogonal vectors. I guess now there is some argument with which we can say that the maximum value of $B$ can be achieved when $\mathcal{B}$ is aligned perfectly parallel to one of the $\rho_{j,k}$ and it's only that $\rho_{jk}$ that's nonzero. But this doesn't seem to be a particularly strong argument since it suggests that $\mathcal{B}$ lives is a $d$ dimensional vector space, which is obviously not true because we can arbitrary increase the degrees of freedom in its definition by increasing $k$. Moreover this argument doesn't seem to use convexity anywhere so this is probably not what the authors are getting at.

+

Any help regarding elucidating this proof will be of great help. Thanks in advance.

+",14177,Tuneer Chakraborty,14177,,12/16/2020 20:10,12/16/2020 20:10,Role of convexity in proof of Monogamy of Bell correlations,,1,0,,,,CC BY-SA 4.0 +15134,1,15135,,12/13/2020 23:17,,1,171,"

I'm trying to perform QPE on the T-gate in Quirk but I'm not getting the correct result. For the T-gate, I should be measuring (001) with 100% probability, but instead, I'm getting the following:

+

+

I've modeled my implementation directly from the Qiskit QPE tutorial. For the unitary I am using $U(\lambda) = \begin{bmatrix}1 & 0\\0 & e^{i \lambda}\end{bmatrix}$.

+

Where did I go wrong here? Thank you in advance.

+",13991,,,,,12/13/2020 23:50,Trying to perform Quantum Phase Estimation on T-gate,,1,1,,,,CC BY-SA 4.0 +15135,2,,15134,12/13/2020 23:50,,3,,"

Your implementation is really close - on the website, here's the diagram that they used: +

+

So, I think you reversed the angles - it should be $-\pi/2, -\pi/4, -\pi/2$. (Also: there's a QFT inverse that Quirk has, so you can verify that the first half of your circuit is correct).

+",8343,,,,,12/13/2020 23:50,,,,0,,,,CC BY-SA 4.0 +15136,2,,15131,12/14/2020 8:14,,1,,"

I'm guessing that what you mean is the following: if you have a state $|\psi\rangle$ to be measured in an orthonormal basis $|\phi_+\rangle,|\phi_-\rangle$, then you should express $|\psi\rangle$ as +$$ +|\psi\rangle=a|\phi_+\rangle+b|\phi_-\rangle. +$$ +(I assume this is what you mean by being "in the basis"?) +If you can do it like this, then it makes a huge difference to being able to read of the probabilities of measurement outcomes: the corresponding probabilities are simply $|a|^2,|b|^2$.

+

But, really, it's not that important. You could have $|\psi\rangle$ expressed in any basis, because all you have to calculate is $|\langle\phi_+|\psi\rangle|^2$ and $|\langle\phi_-|\psi\rangle|^2$.

+

Equally, as you mention, you could just perform a basis transformation. Imagine that you had +$$ +|\psi\rangle=\alpha|0\rangle+\beta|1\rangle, +$$ +then if you construct +$$ +U=|0\rangle\langle\phi_+|+|1\rangle\langle\phi_-|, +$$ +calculating +$$ +U|\psi\rangle=a|0\rangle+b|1\rangle, +$$ +so reading off the amplitudes of the 0 and 1 components gives you exactly the components you need. To see this, note +$$ +\langle0|U|\psi\rangle=\langle\phi_+|\psi\rangle. +$$

+",1837,,,,,12/14/2020 8:14,,,,0,,,,CC BY-SA 4.0 +15137,1,,,12/14/2020 8:35,,1,96,"

In quantum chemistry, there are concepts about one-particle reduced density matrix (1-RDM) and similarly, the two-particle reduced density matrix (2-RDM). +Generally, for an $n$ particle wavefunction $|\Psi\rangle$ and the corresponding density matrix is ${}^nD=|\Psi\rangle\langle\Psi|$. Then there are two definitions of the 1-RDM and 2-RDM. The first is: +\begin{equation} +{}^1D= \begin{pmatrix} +1 \\ +n +\end{pmatrix} tr_{2,3,\cdots,n} {}^nD +\end{equation} +where will resulting $C_n^1=n$ density matrix. Another method is to define the element of 1-RDM as: +\begin{equation} +{}^1D_{ij} = \langle \Psi|a_i^{\dagger} a_j|\Psi\rangle +\end{equation} +where $i$ and $j$ run over $1$ to $n$ and the matrix will be a $n\times n$ one. Is there any connection or difference between the two representations?

+",6128,,55,,12/15/2020 9:30,12/15/2020 9:30,Is there a connection between the definitions of one- and two-particle reduced density matrices?,,0,6,,,,CC BY-SA 4.0 +15138,1,,,12/14/2020 14:28,,7,233,"

I read about the photonic QC Jiŭzhāng that showed quantum advantage by Gaussian boson sampling. I read that boson sampling itself is a sub-universal technique of QC (where they use single-photon states as input states). In the paper, the scientists describe how they use squeezed states for their computation, which can be produced deterministically (making it better realisable then producing single-photon states).

+

I know the term "squeezed states" from continuous variables approaches (which e.g. Xanadu uses), where a squeezed state is an ellipse in phase space. So I am wondering, whether boson sampling is a special algorithm implemented within the continuous variable approach in QC? Or is it really a totally independent approach of QC?

+",13925,,2927,,12/16/2020 18:35,12/20/2020 16:00,Is Gaussian boson sampling (used for showing quantum advantage) a subcategory of the continuous variable approach?,,1,3,,,,CC BY-SA 4.0 +15139,2,,15133,12/14/2020 14:47,,4,,"

This simultaneous block diagonalization is known as Jordan's lemma (not the complex analysis one though). It's a very common technique in the analysis of device-independent protocols as it allows you (under certain conditions) to reduce the analysis from an arbitrary dimension system to qubit systems. You should take a look at Section 4.3.1 in Scarani15 for more details. I'll try to run through the calculation briefly but there will definitely be some gaps that need filling for a rigorous argument.

+

To start we are considering a two-input, two-output, $m$-party Bell-inequality with outputs $\pm 1$. We'll assume each party measures projectively and each Hilbert space is of the same dimension (otherwise dilate). As you note in your background for each party we can assume that the two observables they have can be simulataneously block diagonalized. That is, there exists a basis of their Hilbert space in which the observables are both block diagonal with blocks of size $2\times 2$. Working from now on in this basis we have that for party $k$, +$$ +M_{k,1} = \bigoplus_n M_{k,1,n} \\ +M_{k,2} = \bigoplus_n M_{k,2,n} +$$ +where $M_{k,i,n}$ are qubit observables with eigenvalues $\pm 1$.

+

Now consider a single term in the Bell-operator $\mathcal{B}$ (without the coefficient). This is something of the form +$$ +M_{1,i_1} \otimes M_{2,i_2} \otimes \dots \otimes M_{m,i_m} +$$ +which is equal to by the block diagonalization +$$ +\bigoplus_{n_1} M_{1,i_1,n_1} \otimes \bigoplus_{n_2} M_{2,i_2,n_2} \otimes \dots \otimes \bigoplus_{n_m} M_{m,i_m,n_m}. +$$ +Now this tensor product of block diagonal operators is itself a block diagonal operator, one block for each tuple $(n_1,\dots, n_m)$, so at this point I think its cleanest to just define some indexing over the tuples $n = (n_1,\dots, n_m)$ and redefine this as something of the form +$$ +\bigoplus_n M_{1,i_1,n_1} \otimes M_{2,i_2,n_2} \otimes \dots \otimes M_{m,i_m,n_m}. +$$ +Notice that for each index $n$ the operator in the block is a $\pm 1$ eigenvalued observable on $m$ qubits. As both of the observables for each party are simultaneously block diagonal (and the identity is trivially block diagonal) this block diagonal form is true for each term in the Bell operator and thus we can write +$$ +\begin{aligned} +\mathcal{B} &= \sum_{i_1=0}^{2}...\sum_{i_m=0}^{2}c_{i_1 ... i_m} M_{1,i_1} \otimes M_{2,i_2} \otimes \dots \otimes M_{m, i_m} \\ +&= \sum_{i_1=0}^{2}...\sum_{i_m=0}^{2}c_{i_1 ... i_m} \bigoplus_n M_{1,i_1,n_1} \otimes M_{2,i_2,n_2} \otimes \dots \otimes M_{m,i_m,n_m} \\ +&= \bigoplus_n \sum_{i_1=0}^{2}...\sum_{i_m=0}^{2}c_{i_1 ... i_m} M_{1,i_1,n_1} \otimes M_{2,i_2,n_2} \otimes \dots \otimes M_{m,i_m,n_m} \\ +&= \sum_n \mathcal{B}_n. +\end{aligned} +$$ +Where on the final line we have defined $\mathcal{B}_n$ to be the operator that is the same as $\mathcal{B}$ on block $n$ but is zero elsewhere. If we let $\Pi_n$ be the projector onto block $n$ then $\Pi_{n_1} \mathcal{B}_r \Pi_{n_2} = \delta_{r n_1} \delta_{n_1 n_2} \mathcal{B}_r$.

+

Now consider an arbitrary state $\rho$ for the $m$ parties and its projection onto the blocks i.e. $\hat{\rho} = \sum_n \Pi_n \rho \Pi_n$. Note that $\hat \rho$ is also a state. Then the expected Bell-value for the projected state is +$$ +\begin{aligned} +B &= \mathrm{Tr}[\mathcal{B} \hat\rho] \\ +&= \sum_n \mathrm{Tr}[ \mathcal{B}_n \hat\rho ] \\ +&= \sum_n \mathrm{Tr}[ \mathcal{B}_n \sum_{r} \Pi_{r} \rho \Pi_{r}] \\ +&= \sum_n \sum_{r}\mathrm{Tr}[\Pi_{r} \mathcal{B}_n \Pi_{r} \rho] \\ +&= \sum_n \mathrm{Tr}[\Pi_n \mathcal{B}_n \Pi_n \rho] \\ +&= \mathrm{Tr}[\sum_n \Pi_n \mathcal{B}_n \Pi_n \rho] \\ +&= \mathrm{Tr}[\mathcal{B} \rho]. +\end{aligned} +$$ +Thus the expected Bell-value does not change when we consider a state $\rho$ and the projection of $\rho$ onto the blocks. For the purposes of computing the maximum Bell-value it is sufficient to consider states that are also block diagonal.

+

In the same vein as $\mathcal{B}_n$, let $\rho_n = \Pi_n \rho \Pi_n$. Note that the restriction of $\rho_n$ to its support is a subnormalized $m$-qubit state with a trace $p(n) = \mathrm{Tr}[\Pi_n \rho \Pi_n]$. So now we want to try to compute the maximum violation. Lets begin with the $m$-qubit problem +$$ +\max \mathrm{Tr}[\mathcal{B}_0 \tau] +$$ +where we maximize over all possible $m$-qubit measurements and $m$-qubit states $\tau$. Let $\mathcal{B}^*_0$ and $\tau^*$ be the optimal choice for this maximization.

+

Now back to the full problem. Let $\tilde \rho_n := \frac{\rho_n}{p(n)}$ be the normalized version of $\rho_n$. Taking the maximum over all measurements and states we have +$$ +\begin{aligned} +\max_{\mathcal{B}, \rho} \mathrm{Tr}[\mathcal{B} \rho] &= \max_{\mathcal{B}_n, \rho_n} \sum_n \mathrm{Tr}[\mathcal{B}_n \rho_n] \\ +&= \max_{\mathcal{B}_n, \tilde{\rho}_n, p(n)} \sum_n p(n) \mathrm{Tr}[\mathcal{B}_n \tilde\rho_n] \\ +&\leq \max_{p(n)} \sum_n p(n) \max_{\mathcal{B}_n, \tilde{\rho}_n} \mathrm{Tr}[\mathcal{B}_n \tilde\rho_n] \\ +& = \max_{p(n)} \sum_n p(n) \mathrm{Tr}[\mathcal{B}_0^* \tau^*] \\ +& = \mathrm{Tr}[\mathcal{B}_0^* \tau^*] +\end{aligned} +$$ +Where on the third line we split the maximization into a maximization of the subnormalization weights and a maximization over the separate blocks and then used the fact that a maximization of a sum is always smaller than the sum of the maximizations. On the fourth line we have identified that $\max \mathrm{Tr}[\mathcal{B}_n \tilde\rho_n]$ is effectively an $m$-qubit problem as the operators in the trace have support only on some $m$-qubit subspace and that $(\mathcal{B}_0^*, \tau)$ is the optimizer of the $m$-qubit problem. Then on the final line we just have $\sum_n p(n) = 1$.

+

So we have found that the maximum Bell-value can always be upper bounded by the maximum Bell-value for an $m$-qubit system hence it is sufficient to consider an $m$-qubit system when considering the maximum Bell-value. And moreoever, the maximum Bell-value can always be achieved by an $m$-qubit system.

+",9854,,9854,,12/15/2020 15:39,12/15/2020 15:39,,,,2,,,,CC BY-SA 4.0 +15140,1,,,12/14/2020 22:38,,4,279,"

I'm learning VQE(variational quantum eigensolver) of qiskit, but I have a question about how it measures the expected value of the energy ($\left \langle H \right \rangle$). I saw in other question and they comment that qiskit use $\left \langle H \right \rangle = \langle \psi | H |\psi \rangle = \sum_{i} \lambda_{i} P_{i} $ where $P_{i}=|\langle \phi_{i}|\psi \rangle|^2$. But my question is if qiskit needs the eigenvector of the operator, why does it use a VQE? Is qiskit has the diagonal representation already or how does qiskit do to measure the energy in a simulator and real device?

+",14171,,13647,,12/15/2020 3:56,12/15/2020 3:56,Expected value in a VQE qiskit,,1,0,,,,CC BY-SA 4.0 +15141,2,,15140,12/15/2020 1:12,,2,,"

The output of variational quantum eigensolver(VQE) is a number(the ground state energy of molecules), see qiskit document.

+

This output has the form of a number, so this can de draw from a few measurements, or we are only focusing on part of the information the quantum state contains. This feature helps us to reduce the resource requirement significantly if we need to know the detailed state vector of the state the technique we need is the quantum state tomography(an expensive technique). For example, for a $n$-qubit state, mathematically it can be described by a $2^n$ dimensional normed-one vector, and what state tomography do is to extract all these, say numbers.

+

So if you are using a classical computer to simulate a quantum computer, then VQE is not useful because you do have all the matrices and vectors. But if you are using real quantum devices then to avoid the resource-consuming quantum tomography then you have to choose your target wisely.

+

I am new to the field of quantum tomography, so if you have problems or my statement is confusing, give me some time, please.

+",13647,,,,,12/15/2020 1:12,,,,4,,,,CC BY-SA 4.0 +15142,1,15172,,12/15/2020 4:31,,5,115,"

I was reading DiCarlo, L., Reed, M., Sun, L. et al. Preparation and measurement of three-qubit entanglement in a superconducting circuit. Nature 467, 574–578 (2010). https://doi.org/10.1038/nature09416 (open access preprint: https://arxiv.org/abs/1004.4324) and came across a quantum circuit symbol that I did not recognize and couldn't find online.

+

+

I am wondering about the symbols after the zero kets, before the rotation gates. The caption reads, "Gate sequences producing states with increasing number of entangled qubits: (a) the ground state (no entanglement)".

+",13991,,119,,12/15/2020 4:36,12/17/2020 0:28,Unknown quantum circuit symbol,,1,3,,,,CC BY-SA 4.0 +15144,1,,,12/15/2020 7:46,,6,1220,"

+

As shown in the picture above, my IBMQ account is unavailable, and I found that my friend's account is also unavailable, but I have not received any email or message notification. what happened?

+",8901,,,,,4/22/2022 20:07,My IBM quantum account has been disabled,,1,9,,4/23/2022 8:26,,CC BY-SA 4.0 +15145,2,,9956,12/15/2020 9:58,,0,,"

I can't really follow the description in the paper you've linked, but it looks similar to the 'identity removal' procedure described in one of my papers here (see Definition 2.27). We describe the one-way model of quantum computing and graph states using the ZX-calculus, which I think is a more clear way of thinking about these things.

+",5998,,,,,12/15/2020 9:58,,,,0,,,,CC BY-SA 4.0 +15146,2,,14139,12/15/2020 10:01,,1,,"

In the paper A Generic Compilation Strategy for the Unitary Coupled Cluster Ansatz they benchmark on a bunch of chemistry circuits that can be found here. I should add that these circuits contain only a single Trotterisation step of the chemistry simulation. The actual simulation circuit would repeat this structure many many times.

+",5998,,,,,12/15/2020 10:01,,,,0,,,,CC BY-SA 4.0 +15147,1,,,12/15/2020 14:55,,2,51,"

What are advantages of a fault-tolerant qudit computation compared with fault-tolerant quantum computation for qubits?

+",5693,,8141,,12/15/2020 15:35,12/15/2020 15:35,Fault-tolerant qudit computation: advantage?,,0,1,,12/17/2020 14:12,,CC BY-SA 4.0 +15149,1,15150,,12/15/2020 17:47,,7,147,"

Let $\rho_{ABC}$ and $\sigma_{C}$ be arbitrary quantum states and $\lambda\in \mathbb{R}$ be minimal such that

+

$$\rho_{ABC}\leq \lambda \rho_{AB}\otimes\sigma_C$$

+

We assume there are no issues with support in the above statement to avoid infinities. Now, one traces out the $B$ register. Let $\mu\in \mathbb{R}$ be minimal so that

+

$$\rho_{AC}\leq \mu\rho_A\otimes \sigma_C$$

+

Clearly, $\lambda\geq\mu$ since partial tracing is a completely positive quantum operation but in this case, since the traced out register had the same state on both the lhs and rhs, is $\lambda = \mu$?

+",14178,,55,,12/21/2020 9:56,12/21/2020 9:56,Positive semidefinite relationship after partial trace,,1,0,,,,CC BY-SA 4.0 +15150,2,,15149,12/15/2020 18:55,,9,,"

No, not necessarily. For example, take $\rho$ to be a GHZ state and let $\sigma$ be the completely mixed state of one qubit. We then have $\lambda=4$ and $\mu=2$.

+",1764,,,,,12/15/2020 18:55,,,,0,,,,CC BY-SA 4.0 +15151,1,15152,,12/15/2020 19:38,,2,144,"

The Renyi entropy of order $\beta$, for a discrete probability distribution $p$ is given by +\begin{equation} +H_{\beta}(p) = \frac{1}{1 - \beta} ~\log \left( \sum_{i \in S} p(i)^{\beta} \right), +\end{equation} +where $S$ is the set of all strings in the support of $p$.

+

As is mentioned here, for two discrete distributions $p$ and $r$ the Renyi entropy of the product distribution $p \times r$ is

+

\begin{equation} +H_{\beta}(p \times r) = H_{\beta}(p) + H_{\beta}(r). +\end{equation}

+

What might be a proof of this fact?

+",1351,,55,,9/22/2021 9:39,9/22/2021 9:39,Prove the additivity of the Renyi entropy: $H_{\beta}(p \times r) = H_{\beta}(p) + H_{\beta}(r)$,,1,2,,,,CC BY-SA 4.0 +15152,2,,15151,12/15/2020 20:30,,5,,"

This only holds if the two distributions are independent. In this case +$$ +\begin{aligned} +H_{\beta}(p \times q) &= \frac{1}{1-\beta} \log\left( \sum_{i,j}(p(i) q(j))^{\beta} \right) \\ +&= \frac{1}{1-\beta} \log\left( \left(\sum_{i}p(i)^{\beta}\right) \left(\sum_jq(j)^{\beta}\right) \right) \\ +&= \frac{1}{1-\beta} \left(\log \left(\sum_{i}p(i)^{\beta}\right) + \log \left(\sum_{j}q(j)^{\beta}\right)\right) \\ +&= H_{\beta}(p) + H_{\beta}(q) . +\end{aligned} +$$

+",9854,,,,,12/15/2020 20:30,,,,0,,,,CC BY-SA 4.0 +15154,1,15155,,12/15/2020 23:39,,2,105,"

I am trying to measure the number operator, together with the ground state energy with the built-in VQE on Qiskit. However, if I pick the backend to be Aer.get_backend('qasm_simulator'), it seems to give an error 'numpy.float64' object is not iterable. Please see the minimal working code and the error message below. This is rather confusing, because the backend BasicAer.get_backend('statevector_simulator') works perfectly fine. Thanks for the help!

+
from qiskit.aqua.algorithms import VQE, NumPyEigensolver
+
+from qiskit.chemistry.components.variational_forms import UCCSD
+from qiskit.chemistry.components.initial_states import HartreeFock
+from qiskit.chemistry.drivers import PySCFDriver, UnitsType
+from qiskit import Aer, BasicAer
+from qiskit.chemistry import FermionicOperator
+from qiskit.aqua.operators import Z2Symmetries
+from qiskit.aqua.components.optimizers import L_BFGS_B
+
+optimizer = L_BFGS_B()
+backend = Aer.get_backend('qasm_simulator')
+# backend = BasicAer.get_backend('statevector_simulator')
+
+atom='H .0 .0 .0; H .0 .0 0.74'
+map_type = 'parity'
+
+driver = PySCFDriver(atom=atom, unit=UnitsType.ANGSTROM, basis='sto3g')    
+molecule = driver.run()
+
+num_alpha = molecule.num_alpha 
+num_beta = molecule.num_beta     
+#     num_particles = molecule.num_alpha + molecule.num_beta
+num_particles = [ num_alpha , num_beta ] 
+num_spin_orbitals = molecule.num_orbitals * 2
+ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)
+
+numOp = ferOp.total_particle_number()        
+
+qubitOp = ferOp.mapping(map_type=map_type)
+
+qubitNumOp = numOp.mapping(map_type=map_type )
+
+qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)    
+qubitNumOp = Z2Symmetries.two_qubit_reduction(qubitNumOp, num_particles)
+
+print('Ground state energy without shift is ' , NumPyEigensolver( qubitOp , k=2 ).run().eigenvalues.real )
+
+
+init_state = HartreeFock( num_spin_orbitals , num_particles , map_type )
+print( 'HF =  ' , init_state.bitstr )
+
+# setup the variational form for VQE
+
+
+
+var_form_vqe = UCCSD(
+        num_orbitals=num_spin_orbitals,
+        num_particles=num_particles,
+        initial_state=init_state,
+        qubit_mapping=map_type , 
+        two_qubit_reduction = True , 
+    )
+
+
+algorithm_vqe = VQE(qubitOp, var_form_vqe, optimizer , aux_operators = [qubitNumOp] )
+
+result_vqe = algorithm_vqe.run(backend)
+
+
+print( 'para_vqe = ' , result_vqe['optimal_point' ] )
+
+print( 'eigenvalue_vqe = ' , result_vqe['eigenvalue' ].real )
+
+print( result_vqe  )
+
+

error message is attached below

+
---------------------------------------------------------------------------
+TypeError                                 Traceback (most recent call last)
+<ipython-input-1-5fb4d9ac0b3c> in <module>
+     59 algorithm_vqe = VQE(qubitOp, var_form_vqe, optimizer , aux_operators = [qubitNumOp] )
+     60 
+---> 61 result_vqe = algorithm_vqe.run(backend)
+     62 
+     63 
+
+~/<redacted>/qiskit/aqua/algorithms/quantum_algorithm.py in run(self, quantum_instance, **kwargs)
+     68                 self.quantum_instance = quantum_instance
+     69 
+---> 70         return self._run()
+     71 
+     72     @abstractmethod
+
+~/<redacted>/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py in _run(self)
+    425 
+    426         if self.aux_operators:
+--> 427             self._eval_aux_ops()
+    428             # TODO remove when ._ret is deprecated
+    429             result.aux_operator_eigenvalues = self._ret['aux_ops'][0]
+
+~/<redacted>/qiskit/aqua/algorithms/minimum_eigen_solvers/vqe.py in _eval_aux_ops(self, threshold)
+    445         # Deal with the aux_op behavior where there can be Nones or Zero qubit Paulis in the list
+    446         self._ret['aux_ops'] = [None if is_none else [result]
+--> 447                                 for (is_none, result) in zip(self._aux_op_nones, aux_op_results)]
+    448         self._ret['aux_ops'] = np.array([self._ret['aux_ops']])
+    449 
+
+TypeError: 'numpy.float64' object is not iterable
+```
+
+",9816,,1859,,12/17/2020 12:39,12/17/2020 12:39,"Is it possible to measure ""aux_operators"" in built-in VQE with backend ""qasm_simulator""",,1,3,,,,CC BY-SA 4.0 +15155,2,,15154,12/16/2020 0:53,,1,,"

I agree that the code you provided only work with statevector_simulator. I ran it, get the output of particle number to be 2 on the statevector_simulator.

+

Interestingly, you can get around this problem by just running another VQE execution with the found optimal parameters and not doing any optimization (by set the max_iteration =0 in the optimizer ), to get the particle number... so essentially you are just calculating $\langle \psi^{optimal} | O_{particle \ number} |\psi^{optimal} \rangle$.

+

The code below does what I just mentioned above. I kept it as you wrote it, just added the VQE energy to the end of what you wrote, and the part to find the particle number from what I described.

+
from qiskit.aqua.algorithms import VQE, NumPyEigensolver
+
+from qiskit.chemistry.components.variational_forms import UCCSD
+from qiskit.chemistry.components.initial_states import HartreeFock
+from qiskit.chemistry.drivers import PySCFDriver, UnitsType
+from qiskit import Aer, BasicAer
+from qiskit.chemistry import FermionicOperator
+from qiskit.aqua.operators import Z2Symmetries
+from qiskit.aqua.components.optimizers import L_BFGS_B
+
+optimizer = L_BFGS_B()
+backend = Aer.get_backend('qasm_simulator')
+# backend = BasicAer.get_backend('statevector_simulator')
+
+atom='H .0 .0 .0; H .0 .0 0.74'
+map_type = 'parity'
+
+driver = PySCFDriver(atom=atom, unit=UnitsType.ANGSTROM, basis='sto3g')    
+molecule = driver.run()
+
+num_alpha = molecule.num_alpha 
+num_beta = molecule.num_beta     
+#     num_particles = molecule.num_alpha + molecule.num_beta
+num_particles = [ num_alpha , num_beta ] 
+num_spin_orbitals = molecule.num_orbitals * 2
+ferOp = FermionicOperator(h1=molecule.one_body_integrals, h2=molecule.two_body_integrals)
+
+numOp = ferOp.total_particle_number()        
+
+qubitOp = ferOp.mapping(map_type=map_type)
+
+qubitNumOp = numOp.mapping(map_type=map_type )
+
+qubitOp = Z2Symmetries.two_qubit_reduction(qubitOp, num_particles)    
+qubitNumOp = Z2Symmetries.two_qubit_reduction(qubitNumOp, num_particles)
+
+print('Ground state energy without shift is ' , NumPyEigensolver( qubitOp , k=2 ).run().eigenvalues.real )
+
+
+init_state = HartreeFock( num_spin_orbitals , num_particles , map_type )
+print( 'HF =  ' , init_state.bitstr )
+
+# setup the variational form for VQE
+
+
+
+var_form_vqe = UCCSD(
+        num_orbitals=num_spin_orbitals,
+        num_particles=num_particles,
+        initial_state=init_state,
+        qubit_mapping=map_type , 
+        two_qubit_reduction = True , 
+    )
+
+
+algorithm_vqe = VQE(qubitOp, var_form_vqe, optimizer ,  include_custom = True )
+from qiskit.aqua import QuantumInstance
+quantum_instance = QuantumInstance(backend = backend, shots= 10000, optimization_level= 3)
+result_vqe = algorithm_vqe.run(quantum_instance)
+
+
+print( 'para_vqe = ' , result_vqe['optimal_point' ] )
+print('VQE energy =', result_vqe['optimal_value'] )
+print('eigenstate:', result_vqe['eigenstate'])
+
+print('**************** Finding Particle Number *************************')
+from qiskit.aqua.components.optimizers import COBYLA
+optimizer = COBYLA(maxiter= 0,tol=0.0001)   
+initial_point = result_vqe['optimal_point' ]
+particle_number_vqe = VQE(qubitNumOp, var_form_vqe, optimizer , include_custom = True, initial_point = initial_point )
+particle_number = particle_number_vqe.run(quantum_instance)
+print( 'Particle_number = ' , particle_number['optimal_value'] )
+
+

The output would be something like:

+
Ground state energy without shift is  [-1.85238817 -1.2458777 ]
+HF =   [False  True]
+para_vqe =  [-7.22409784e-09  1.35083082e-08 -1.12782817e-01]
+VQE energy = -1.852388173569581
+eigenstate: {'01': 9888, '10': 112}
+**************** Finding Particle Number *************************
+Particle_number =  1.999999999999998
+
+",9858,,,,,12/16/2020 0:53,,,,11,,,,CC BY-SA 4.0 +15156,1,15157,,12/16/2020 8:08,,2,288,"

I have one qubit and I apply two gates to it: H and T, which yields the following superposition:

+

$$ +\frac{1}{\sqrt{2}} |0\rangle + \frac{1+i}{2}|1\rangle +$$

+

Now I want to calculate probability of 0 and 1 state:

+

$$ +\left(A_1\right)^2 = \left(\frac{1}{\sqrt{2}}\right)^2 = \frac{1}{2} +$$ +$$ +\left(A_2\right)^2 = \left(\frac{i+1}{2}\right)^2 = \frac{i}{2} +$$ +$$ +S = \left(A_1\right)^2 + \left(A_2\right)^2 = \frac{1+i}{2} +$$ +$$ +P(A_i) = \frac{A_i^2}{S} +$$ +according to prior equations i receive following values +$$ +P(0) = \frac{1}{1+i} \land P(1) = \frac{i}{i+1} +$$

+

I was expecting to get $A_i=0.5$ however $P(0) + P(1) = 1$

+

How do I interpret this results?

+",14183,,10480,,12/16/2020 11:51,12/16/2020 12:29,How to interpret complex probability of superposition state?,,2,0,,,,CC BY-SA 4.0 +15157,2,,15156,12/16/2020 8:28,,4,,"

You forgot to take the absolute value.

+

The Born rule for computing measurement outcome probability from the state vector amplitudes says that the probability is the square of the magnitude of the amplitude.

+

In your case, we get

+

$$ +\left(A_1\right)^2 = \left|\frac{1}{\sqrt{2}}\right|^2 = \frac{1}{2} +$$ +$$ +\left(A_2\right)^2 = \left|\frac{i+1}{2}\right|^2 = \left(\frac{\sqrt{2}}{2}\right)^2 =\frac{1}{2} +$$

+

as expected.

+",10480,,,,,12/16/2020 8:28,,,,0,,,,CC BY-SA 4.0 +15158,1,15159,,12/16/2020 10:56,,3,65,"

From the two main generalizations of the von Neumann entropy:

+

\begin{equation} +S(\rho)=-\operatorname{Tr}(\rho \log \rho) +\end{equation}

+

meaning Rényi:

+

\begin{equation} +R_{\alpha}(\rho)=\frac{1}{1-\alpha} \log \operatorname{Tr}\left(\rho^{\alpha}\right), \alpha \in(0,1) \cup(1, \infty) +\end{equation}

+

and Tsallis:

+

\begin{equation} +T_{q}(\rho)=\frac{1}{1-q}\left(\operatorname{Tr}\left(\rho^{q}\right)-1\right), q \in(0,1) \cup(1, \infty) +\end{equation}

+

we know that in both cases the limit to 1 for the entropic parameters gives us back the von Neumann entropy:

+

\begin{equation} +S(\rho)=\lim _{q \rightarrow 1} T_{q}(\rho)=\lim _{\alpha \rightarrow 1} R_{\alpha}(\rho). +\end{equation}

+

In the case of the quantum Rényi entropy we also know its two limits:

+

\begin{equation} +R_{0}(\rho)=\lim _{\alpha \rightarrow 0} R_{\alpha}(\rho)=\log \operatorname{rank}(\rho) +\end{equation}

+

and

+

\begin{equation} +R_{\infty}(\rho)=\lim _{\alpha \rightarrow \infty} R_{\alpha}(\rho)=-\log \|\rho\|. +\end{equation}

+

I couldn't find anything similar for the quantum Tsallis case? Is there something that is considered trivial?

+",14166,,12541,,12/16/2020 12:58,12/16/2020 12:59,Do we know the limits of the quantum Tsallis entropy?,,1,0,,,,CC BY-SA 4.0 +15159,2,,15158,12/16/2020 11:46,,2,,"

Well for $q \to 0$ we have +$$ +\lim_{q \to 0} T_q(\rho) = \mathrm{rank}(\rho) - 1. +$$ +For $q \to \infty$ it's not really interesting as +$$ +\lim_{q \to \infty} T_{q}(\rho) = 0. +$$ +For the second result note $\lim_{q\to\infty} \mathrm{Tr}[\rho^q] \leq \lim_{q \to \infty} \mathrm{rank}(\rho)\lambda_{\max}(\rho)^q \leq 1$ as $\rho$ is a quantum state. And so the numerator is finite but the denominator blows up to $-\infty$.

+",9854,,9854,,12/16/2020 12:59,12/16/2020 12:59,,,,2,,,,CC BY-SA 4.0 +15160,2,,15156,12/16/2020 12:29,,4,,"

Just to note that the complex number also specify a quantum phase of a qubit. In this particular case +$$ +\frac{1+i}{2} = \frac{1}{\sqrt{2}}\mathrm{e}^{i\frac{\pi}{4}}, +$$ +so the relative phase is $\frac{\pi}{4}$.

+

You can rewrite your qubit state as +$$ +|q\rangle = \frac{1}{\sqrt{2}}(|0\rangle + \mathrm{e}^{i\frac{\pi}{4}} |1\rangle). +$$

+

Now, you easily see that probability of $|0\rangle$ and $|1\rangle$ is $\frac{1}{2} = \Big(\frac{1}{\sqrt{2}}\Big)^2$ in both cases and the phase is $\pi/4$.

+",9006,,,,,12/16/2020 12:29,,,,0,,,,CC BY-SA 4.0 +15161,1,,,12/16/2020 13:09,,3,397,"

If Grover algorithm has a better speed than classical search algorithms, would it be an example of where Quantum computers outruns classical computers?

+

Can we use Grover Algorithm in real world problems?

+",13294,,9006,,12/16/2020 14:38,12/16/2020 14:38,Grover Algorithm vs Classical Search Algorithms,,1,0,,,,CC BY-SA 4.0 +15162,2,,15161,12/16/2020 14:38,,3,,"

A Grover algorithm outperform classical unordered database search algorithms quadratically. So, it can serve as an example of higher performance of quantum computers. However, when complexity of Grover search is assessed, generally a complexity of an oracle is ignored. In some cases the oracle complexity is so high that it cancels out advantage of faster search.

+

Currently, Grover search cannot be used for real world problems because of high noise level and decoherence quantum computers suffer from. However, once these problems are solved, Grover search can be employed naturally for unordered database search and optimization tasks.

+",9006,,,,,12/16/2020 14:38,,,,5,,,,CC BY-SA 4.0 +15163,1,,,12/16/2020 14:54,,3,739,"

I tried to implement the traveling salesman problem (TSP) using QAOA with qiskit. I worked with this qiskit QAOA tutorial and this qiskit minimum eigen optimizer tutorial, where they implement a TSP instance for three cities. However, when I tried to slightly change their example by considering four cities, the QAOA solution fails. I used the NumPyMinimumEigensolver classical solver to compare the QAOA solution with the classical obtained one. While the classical algorithm gives me the right solution, the QAOA solution even fails to visit each city once. I have tried to run QAOA with $p=1$ and $p=2$, both versions give me the same wrong result. I also used the qasm_simulatorinstead of the statevector_simulator, since for 16 qubits the latter is infeasable.

+

The weird thing to me is, that QAOA gives me a way too high cost value. I think this is due to the fact that QAOA gives me an invalid solution where the fourth city is never visited (QAOA's solution translates: city 1->2->3 and no city visited in fourth time step).

+

Does anyone know, why this slight change in the problem makes the algorithm fail? Is there anything wrong in my code?

+

My code:

+
from qiskit import Aer
+from qiskit.optimization.applications.ising import tsp
+from qiskit.aqua.algorithms import NumPyMinimumEigensolver, QAOA
+from qiskit.aqua import aqua_globals, QuantumInstance
+from qiskit.optimization.algorithms import MinimumEigenOptimizer
+from qiskit.optimization.problems import QuadraticProgram
+
+# Generating a TSP instance of n cities
+n = 4
+num_qubits = n ** 2
+ins = tsp.random_tsp(n, seed=123)
+print('distance\n', ins.w)
+
+# Create a random TSP Hamiltonian
+qubitOp, offset = tsp.get_operator(ins)
+qp = QuadraticProgram()
+qp.from_ising(qubitOp, offset, linear=True)
+
+aqua_globals.random_seed = 10598
+quantum_instance = QuantumInstance(Aer.get_backend('qasm_simulator'),
+                                   seed_simulator=aqua_globals.random_seed,
+                                   seed_transpiler=aqua_globals.random_seed)
+qaoa_mes = QAOA(quantum_instance=quantum_instance, initial_point=[0., 0.])
+exact_mes = NumPyMinimumEigensolver()
+
+# solving Quadratic Program using exact classical eigensolver
+exact = MinimumEigenOptimizer(exact_mes)
+exact_result = exact.solve(qp)
+print("\nExact:\n", exact_result)
+
+# solving the Problem using QAOA
+qaoa = MinimumEigenOptimizer(qaoa_mes) 
+qaoa_result = qaoa.solve(qp)
+print("\nQAOA:\n", qaoa_result)
+
+

As a result I get:

+
distance
+ [[ 0. 48. 91. 33.]
+ [48.  0. 63. 71.]
+ [91. 63.  0. 92.]
+ [33. 71. 92.  0.]]
+
+Exact:
+optimal function value: 236.0
+optimal value: [0. 0. 0. 1. 1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 1. 0.]
+status: SUCCESS
+
+QAOA:
+optimal function value: 200111.0
+optimal value: [1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0.]
+status: SUCCESS
+
+",13925,,13925,,12/16/2020 15:23,12/16/2020 15:23,qiskit: Traveling Salesman Problem using QAOA fails for more than 3 cities,,0,1,,,,CC BY-SA 4.0 +15164,2,,5096,12/16/2020 17:50,,0,,"

Q# now has a BigInt type included: https://docs.microsoft.com/en-us/quantum/user-guide/language/typesystem/#available-types

+",119,,,,,12/16/2020 17:50,,,,0,,,,CC BY-SA 4.0 +15165,2,,15138,12/16/2020 18:54,,1,,"

@gIS's comment effectively answers the question, but to provide a bit more detail Aaronson at shtetl-optimized has a nice blog post on the Gaussian Boson Sampling approach of USTC, contrasting it with Fock state Boson Sampling, wherein the presence/absence of photons correspond to something closer to a conventional digital ($\vert 0\rangle$/$\vert 1\rangle$) perspective of quantum computation.

+

Section III of Aaronson's blog post summarizes these differences nicely, although I'll admit I don't understand a good chunk of it. I believe conventional single-photon generation has been challenging; spontaneous parametric downconversion (SPDC) requires a lot of post-selection; and in Gaussian Boson Sampling the key point may be something like a Gaussian state is "a state that’s exponential in some quadratic polynomial in the creation operators", which is (apparently) significantly easier to tune.

+

It's not clear to me yet whether in the end this corresponds to a "continuous variable approach" mentioned in the question. Nonetheless, as the OP suggests it is very likely that neither (Fock state) Boson Sampling nor Gaussian Boson Sampling are universal in the sense of being able to perform arbitrary functions. Indeed, quantum machines that perform Boson Sampling may not even be classically universal, much less capable of performing arbitrary quantum computations.

+",2927,,2927,,12/20/2020 16:00,12/20/2020 16:00,,,,0,,,,CC BY-SA 4.0 +15166,1,15167,,12/16/2020 21:33,,3,249,"

I tried to save all the intermediate values of the parameters when running the built-in VQE in qiskit. The callback function can save the mean values and counts, however it seems only save the very last set of parameters. Please see the codes below, which is really taken from the link here https://github.com/qiskit-community/qiskit-community-tutorials/blob/master/aqua/vqe_convergence.ipynb.

+
import numpy as np
+import pylab
+
+from qiskit import BasicAer
+from qiskit.aqua.operators import WeightedPauliOperator
+from qiskit.aqua import QuantumInstance, aqua_globals
+from qiskit.aqua.algorithms import VQE, NumPyMinimumEigensolver
+from qiskit.aqua.components.initial_states import Zero
+from qiskit.aqua.components.optimizers import COBYLA, L_BFGS_B, SLSQP
+from qiskit.circuit.library import TwoLocal
+
+pauli_dict = {
+    'paulis': [{"coeff": {"imag": 0.0, "real": -1.052373245772859}, "label": "II"},
+              {"coeff": {"imag": 0.0, "real": 0.39793742484318045}, "label": "ZI"},
+              {"coeff": {"imag": 0.0, "real": -0.39793742484318045}, "label": "IZ"},
+              {"coeff": {"imag": 0.0, "real": -0.01128010425623538}, "label": "ZZ"},
+              {"coeff": {"imag": 0.0, "real": 0.18093119978423156}, "label": "XX"}
+              ]
+}
+
+qubit_op = WeightedPauliOperator.from_dict(pauli_dict)
+
+
+num_qubits = qubit_op.num_qubits
+init_state = Zero(num_qubits)
+var_form = TwoLocal(num_qubits, 'ry', 'cz', initial_state=init_state)
+
+counts = []
+values = []
+para = []
+def store_intermediate_result(eval_count, parameters, mean, std):
+    counts.append(eval_count)
+    values.append(mean)
+    para.append( parameters )
+
+algo = VQE(qubit_op, var_form, COBYLA(), callback=store_intermediate_result)
+backend = BasicAer.get_backend('statevector_simulator')
+quantum_instance = QuantumInstance(backend=backend)  
+algo_result = algo.run(quantum_instance)
+
+counts = np.asarray(counts)
+values = np.asarray(values)
+para = np.asarray( para )
+
+# print( 'counts' , counts )
+# print( 'values' , values )
+print( para) 
+
+

This is in fact exactly the same code as in this answer VQE restart from a previous computation (I have also browsed other answers with keyword "callback"), and I can get the intermediate values of the cost function. However, for the parameters, what I got is the following (just copy the first few lines), which seems to be the very last set of parameters. Any ideas which part went wrong here?

+
[[ 1.82181708 -4.4450779   6.76132624  2.43831885  1.15624184  7.51034512
+   6.81040957  3.23410408]
+ [ 1.82181708 -4.4450779   6.76132624  2.43831885  1.15624184  7.51034512
+   6.81040957  3.23410408]
+ [ 1.82181708 -4.4450779   6.76132624  2.43831885  1.15624184  7.51034512
+   6.81040957  3.23410408]
+ [ 1.82181708 -4.4450779   6.76132624  2.43831885  1.15624184  7.51034512
+   6.81040957  3.23410408]
+ [ 1.82181708 -4.4450779   6.76132624  2.43831885  1.15624184  7.51034512
+   6.81040957  3.23410408] ...
+
+",9816,,9006,,12/17/2020 7:29,12/19/2020 19:05,Callback function in VQE do not return the intermediate values of the parameters,,2,0,,,,CC BY-SA 4.0 +15167,2,,15166,12/16/2020 22:49,,1,,"

Not an answer to your issue but it is too long for comment so I put it here.

+
+

Very interesting. One thing for sure, if you print out the parameters at each optimization step, then you can see it.

+

You can do this by adding a an extra line to the store_intermediate_result function definition.

+
def store_intermediate_result(eval_count, parameters, mean, std):
+    counts.append(eval_count)
+    values.append(mean)
+    para.append( parameters )
+    print(parameters) 
+
+

If I do this then I can see the changes in the parameters. For example, with two iterations:

+
[-4.59856165  5.39733825  0.30296211  5.05318614  5.98066982 -4.51917001
+  4.19536837  4.18612614]
+[-3.59856165  5.39733825  0.30296211  5.05318614  5.98066982 -4.51917001
+  4.19536837  4.18612614]
+
+

But if I print-out the para variable then I get the same thing you got:

+
[[-3.59856165  5.39733825  0.30296211  5.05318614  5.98066982 -4.51917001
+   4.19536837  4.18612614]
+ [-3.59856165  5.39733825  0.30296211  5.05318614  5.98066982 -4.51917001
+   4.19536837  4.18612614]]
+
+",9858,,,,,12/16/2020 22:49,,,,4,,,,CC BY-SA 4.0 +15168,1,15176,,12/16/2020 23:12,,5,236,"

Let $\rho_{XA}$ be a classical-quantum state, i.e., $\rho_{XA} = \sum_{x} p(x) |x\rangle \langle x| \otimes \rho_A^x$.

+

How to prove that the conditional von Neumann entropy $S(X|A) = S(\rho_{XA}) - S(\rho_A)$ is non-negative?

+",13709,,55,,12/21/2020 23:37,12/21/2020 23:37,Prove that the conditional entropy of a classical-quantum state is non-negative,,1,0,,,,CC BY-SA 4.0 +15169,1,15171,,12/16/2020 23:47,,4,253,"

Suppose I have an $n$-qubit Hermitian operator $U$ such that $U^2=I$.

+

The projection operators with eigenvalue $+1$ and $−1$ are $P_+$ and $P_-$.

+

How can I prove that $P_+=\frac{1}{2}(1+U)$ and $P_-=\frac{1}{2}(1-U)$?

+

I think $\sum P=1$ but I have no idea to get this conclusion.

+",,user13341,55,,12/19/2020 19:37,12/19/2020 19:37,How do I prove that $P_\pm=\frac12(1\pm U)$ if $U^2=I$?,,1,0,,,,CC BY-SA 4.0 +15170,1,,,12/17/2020 0:25,,3,89,"

When I specify the RX or RY gate to rotate by say $\pi/4$ in the circuit composer, the gate disappears off the circuit. Is there any reason why if I leave it with $\pi/2$ default then it stays?

+

If I edit theta the gate disappears.

+

Here's some screenshots to show what happens:

+

+ +

+

Ok solution is to erase the whole field $\pi/2$ and reenter $\pi/4$ but leaving $\pi/$ and then denominator $4$ will not work. Also the denominator is bounded between 1 and 9.

+

+",14191,,14209,,12/20/2020 14:02,12/20/2020 14:02,Circuit composer RX or RY gate disappears,,1,3,,,,CC BY-SA 4.0 +15171,2,,15169,12/17/2020 0:28,,6,,"

First, we can start with $U = P_+ - P_-$, since the Hermitian is the sum of the projection operators of the eigenspaces scaled by their eigenvalues. If $U^2 = I$, that means $I = (P_+ - P_-)(P_+ - P_-) = P_+P_+ - P_+P_- - P_-P_+ + P_-P_-$. Since the two projectors correspond to orthogonal eigenspaces, operating on themselves doesn't change them and one operating on the other gets a zero, so we get $P_+ + P_- = I$. With $P_+ + P_- = I$ and $P_+ - P_- = U$, we can add the two equations to get $P_+ = \frac{1}{2}(I + U)$ or subtract the $U$ from the $I$ to get $P_- = \frac{1}{2}(I - U)$.

+",7680,,7680,,12/17/2020 13:52,12/17/2020 13:52,,,,3,,,,CC BY-SA 4.0 +15172,2,,15142,12/17/2020 0:28,,5,,"

The picture has two parts: The first goes until the dots. It is simply three $|0\rangle$ states. (The ground state.)

+

You will recognize that the same picture -- but only until the dot -- is used in panel b) and c) of the same figure.

+

After the dot, there is a second part of the circuit -- starting with the open half-circles -- which describes the measurement/tomography of those three states. This is the second half of the experiment.

+

At first, this was just my interpretation of the pictures, but then I re-read the caption carefully, and indeed, later it says: "The state tomography sequence shown in a is also applied in b and c."

+

As to the symbol, this is simply the "connection" between the preparation and the measurement part, i.e., feeding the result of the preparation into the measurement device.

+",491,,,,,12/17/2020 0:28,,,,0,,,,CC BY-SA 4.0 +15173,1,,,12/17/2020 1:05,,3,316,"

Can QAOA solve a constraint binary optimization problem? QAOA is short for Quantum Approximate Optimization Algorithm. I read the information https://qiskit.org/textbook/ch-applications/qaoa.html.

+

But I'm not sure whether it can solve a constraint binary optimization problem.

+",14153,,9006,,12/17/2020 7:28,12/17/2020 7:28,Can QAOA solve a constraint optimization problem?,,1,0,,,,CC BY-SA 4.0 +15176,2,,15168,12/17/2020 6:07,,3,,"

We will use the upper bound on the entropy of a mixture (for proof see for example theorem 11.10 on p.518 in Nielsen & Chuang)

+

$$ +S\left(\sum_k p_k \rho_k\right) \leq H(p) + \sum_k p_k S(\rho_k)\tag1 +$$

+

where $H(p) = -\sum_k p_k \log p_k$.

+
+

Set $p_x := p(x)$. Note that if $|\psi_y^x\rangle$ is an eigenvector of $\rho_A^x$ associated to eigenvalue $q_y^x$ then $|x\rangle\otimes|\psi_y^x\rangle$ is an eigenvector of $\rho_{XA}$ associated to eigenvalue $p_x q_y^x$. Therefore

+

$$ +\begin{align} +S(\rho_{XA}) &= -\sum_x \sum_y p_x q_y^x \log(p_x q_y^x) \\ +&= -\sum_x p_x \log p_x - \sum_x p_x \sum_y q_y^x \log q_y^x \\ +&= H(p) + \sum_x p_x S(\rho_A^x)\tag2. +\end{align} +$$

+

Next, compute $\rho_A$

+

$$ +\rho_A = {\rm tr}_X \rho_{XA} = \sum_x p_x \rho_A^x +$$

+

and so

+

$$ +S(\rho_A) = S\left(\sum_x p_x \rho_A^x\right)\tag3. +$$

+

Finally, recognize $(3)$ and $(2)$ as the left and right hand sides of $(1)$ with the appropriate substitution to get

+

$$ +S(\rho_A) \leq H(p) + \sum_x p_x S(\rho_A^x) \\ +0 \leq S(\rho_{XA}) - S(\rho_A) +$$

+

which is the desired inequality.

+",10480,,10480,,12/17/2020 15:19,12/17/2020 15:19,,,,2,,,,CC BY-SA 4.0 +15177,2,,15173,12/17/2020 6:52,,3,,"

It can actually and this is done by adding penalties to include the constraints in the cost function. See this article on formulations of different problems.

+

There also exist an adaptation for constrained problems. See this articla on the Quantum Alternating Operator Ansatz.

+",4127,,,,,12/17/2020 6:52,,,,3,,,,CC BY-SA 4.0 +15178,1,,,12/13/2020 9:09,,2,584,"

I am trying to understand the quantum key distribution and Quantum Bit Error Rate (QBER). I have question: Why is the QBER given by the average of the diagonals of the crosstalk matrix? Why the need to calculate the value using the diagonals?

+",,Rasha rashed,23,,12/21/2020 17:41,1/7/2021 10:13,Quantum bit error rate,,1,5,,,,CC BY-SA 4.0 +15179,1,15182,,12/17/2020 12:16,,2,407,"

I want to load a lognormal distribution and then use an IntegerComparator to flip a qubit ($|0\rangle$ to $|1\rangle$) if its value is less than a threshold. Then I want to use an Quantum Amplitude Estimation algorithm to calculate the probability of measuring $|1\rangle$.

+

My code so far is:

+
import matplotlib.pyplot as plt
+import numpy as np
+
+from qiskit import Aer, QuantumCircuit, QuantumRegister, execute
+from qiskit.aqua.algorithms import IterativeAmplitudeEstimation
+from qiskit.circuit.library import LogNormalDistribution, IntegerComparator
+
+
+
+num_uncertainty_qubits = 3
+
+S = 100
+vol = 0.4
+r = 0.04
+T = 3*(30/365)
+
+
+mu = np.log(S) + (r-0.5*vol**2)*T
+sigma = vol*np.sqrt(T)
+
+mean = np.exp(mu - 0.5*sigma**2)
+variance = (np.exp(sigma**2)-1)*np.exp(2*mu + sigma**2)
+stddev = np.sqrt(variance)
+
+low = np.maximum(0, mean-3*stddev)
+high = mean + 3*stddev
+
+uncertainty_model = LogNormalDistribution(num_uncertainty_qubits, mu=mu, sigma=sigma**2, bounds=(low, high))
+
+# 3 qubit LogNormalDistribution model
+uncertainty_model = LogNormalDistribution(3, mu=mu, sigma=sigma, bounds=(low, high))
+
+# function to create the quantum circuit of the IntegerComparator and the uncertainty model
+# x_eval is the threshold below which the qubit should be flipped
+def get_cdf_circuit(x_eval):
+    qr_state = QuantumRegister(uncertainty_model.num_qubits, 'state')
+    qr_obj = QuantumRegister(1, 'obj')
+    qr_comp = QuantumRegister(2, 'compare')
+    state_preparation = QuantumCircuit(qr_state, qr_obj, qr_comp)
+    
+    state_preparation.append(uncertainty_model, qr_state)
+    comparator = IntegerComparator(uncertainty_model.num_qubits, x_eval, geq=False)
+    
+    state_preparation.append(comparator, qr_state[:]+qr_obj[:]+qr_comp[:])
+    
+    return state_preparation
+
+# Function to implement the Amplitude Estimation algorithm
+
+def run_ae_for_cdf(x_eval, epsilon=0.01, alpha=0.05, simulator='qasm_simulator'):
+
+    state_preparation = get_cdf_circuit(x_eval)
+
+    ae_var = IterativeAmplitudeEstimation(state_preparation=state_preparation,
+                                          epsilon=epsilon, alpha=alpha,
+                                          objective_qubits=[len(qr_state)]) 
+    result_var = ae_var.run(quantum_instance=Aer.get_backend(simulator), shots=100)
+    
+    return result_var['estimation']
+
+

Broadly speaking, I want to flip the objective qubit to $|1\rangle$ if the state is less than or equal to x_eval.

+

On running this, I'm getting the same amplitude estimation every time, even when I use different threshold values.

+

I'm missing something. Please help me out.

+

PS: https://imgur.com/a/qAjzzEz This is the link to the QuantumCircuit. P(X) is the LogNormalDistribution and Cmp is the comparator.

+

PPS: Using LinearAmplitudeFunction to compare floating numbers:

+
def get_comparator(threshold, num_qubits, low, high):
+    breakpoints = [low, threshold]
+    offsets = [0,0]
+    slopes = [0,0]
+    f_min = 1
+    f_max = 0
+    objective = LinearAmplitudeFunction(
+        num_qubits,
+        slopes,
+        offsets,
+        domain=(low, high),
+        image=(f_min, f_max),
+        breakpoints=breakpoints
+    )
+    return objective
+
+",14198,,55,,12/21/2020 23:38,12/21/2020 23:38,Computing the CDF with QAE in Qiskit,,3,4,,,,CC BY-SA 4.0 +15180,1,,,12/17/2020 13:56,,1,69,"

So usually when you talk to physicists who accept the multi-world interpretation of quantum mechanics they claim that the measurement is reversible if you take into account the worlds we don't observe. Driven by this line of thought I think I can show if one alternates between measurements of $2$ different observables say $A$ and $B$ and do $2N$ (where $N$ is a large number) such measurements in time $T$. One is also allowed to assume the underlying dynamics, i.e. some Hamiltonian under which the system evolves. Then I claim it is impossible to reconstruct the original density matrix unless one knows when the measurements took place to an accuracy of $(\frac{T}{2N})^2$. Is there something like this in the literature?

+",5045,,5045,,12/20/2020 10:22,12/20/2020 10:22,Time accuracy required to reconstruct the density matrix?,,0,9,,,,CC BY-SA 4.0 +15181,2,,15179,12/17/2020 20:09,,1,,"

I am also working with IterativeAmplitudeEstimation in qiskit. I was able to run QAE for 'Credit Analysis with Quantum Computing' as described in

+

https://qiskit.org/documentation/tutorials/finance/09_credit_risk_analysis.html

+

by preparing the quantum circuits from scratch. But when using the libraries as described on the page I got many errors (see below). I guess some of the libraries have simply just moved?

+

From which library are you loading LogNormalDistribution? I use

+
from qiskit.circuit.library import IntegerComparator
+from qiskit.aqua.algorithms.amplitude_estimators.iqae import IterativeAmplitudeEstimation
+from qiskit.aqua.components.uncertainty_models import NormalDistribution
+from qiskit.aqua.components.uncertainty_models import LogNormalDistribution
+
+

I for example get the following error for LogNormalDistribution when I load the model from qiskit.aqua.components.uncertainty_models

+
__init__() got an unexpected keyword argument 'bounds'
+
+

or 'LogNormalDistribution' object has no attribute 'num_qubits'

+

I hope to get the libraries running to help you dig into your question.

+",14130,,,,,12/17/2020 20:09,,,,2,,,,CC BY-SA 4.0 +15182,2,,15179,12/17/2020 20:12,,1,,"

I think it would be also useful to see your Quantum Circuit using %matplotlib inline
+and qc.draw('mpl') to see whether all gates are correctly connected. I had a similar problem with QAE and figured out by using this method that the order of qubits I tried to append the IntegerComparator onto was wrong. Cheers

+",14130,,,,,12/17/2020 20:12,,,,5,,,,CC BY-SA 4.0 +15184,1,15188,,12/17/2020 20:50,,2,151,"

When I read documentations about quantum error correction, it generally speak about bit flip error, and phase flip on $|1\rangle$ state, so for example, let's say my initial state is $|\psi\rangle = a|0\rangle+b|1\rangle$, bit flip error correction $|\psi'\rangle = b|0\rangle+a|1\rangle$ or phase flip error correction $|\psi'\rangle = a|0\rangle-b|1\rangle$.

+

I'm wondering why the phase flip error correction $|\psi'\rangle = -a|0\rangle+b|1\rangle$ is never discussed? And why error correction codes don't correct this phase flip (at least these I have tested)? Is there a reason I'm not aware about ? Maybe this error never happens "in real life"?

+",12910,,2879,,12/18/2020 19:28,12/18/2020 19:28,Phase flip error correction on state $|0\rangle$,,3,0,,,,CC BY-SA 4.0 +15185,2,,15184,12/17/2020 21:31,,3,,"

An error that negates the amplitude of $|0\rangle$ is observationally indistinguishable from an error that negates the $|1\rangle$ state, so there's no need to consider both. By arbitrary historical convention the Z gate negates the $|1\rangle$ state and so things are done in those terms.

+",119,,,,,12/17/2020 21:31,,,,0,,,,CC BY-SA 4.0 +15186,2,,15184,12/18/2020 7:47,,3,,"

The difference between $a|0\rangle-b|1\rangle$ and $-a|0\rangle+b|1\rangle$ is a global phase which has no observational consequences. In other words, to all intents and purposes, those two errors $Z$ and $-Z$ are the same. An error correcting code that corrects for one also corrects for the other (although the global phase may remain).

+",1837,,,,,12/18/2020 7:47,,,,0,,,,CC BY-SA 4.0 +15187,1,15228,,12/18/2020 10:31,,4,52,"

The documentation for Cirq mentions the possibility to step through a circuit's moments, and access the exact wavefunction via step.state_vector(), and edit set it via step.set_state(). In the API documentation, neither function is documented. While the former seems to work anyway, the latter (setting the state) gives an AttributeError. I am using Cirq 0.9.1.

+

How can I change the wavefunction used for the next moment simulation?

+",14208,,55,,12/21/2020 23:39,12/21/2020 23:39,Access and set_state during quantum computation simulation in cirq,,1,0,,,,CC BY-SA 4.0 +15188,2,,15184,12/18/2020 11:49,,1,,"

The bit- and phase-flip error you are asking for, i.e. $|\psi'\rangle = b|0\rangle-a|1\rangle$ does indeed exist, and error correction for them have been constructed. The phase flip is associated to the $Z$ Pauli matrix and the bit flip to the $X$ pauli matrix. The error you are asking for is associated to the $Y$ pauli matrix. Not that its action is $Y|\psi\rangle=-i(b|0\rangle-a|1\rangle)$, but as it has been stated in the other answers, the global phase has not observational consequences, and such error would be the one you are aksing for.

+

I recommend this article for a better understanding of the decoherence models. In such you can see discussions about the Pauli channel (a channel with errors $X,Y,Z$) and also an example of a QECC that does indeed correct all of those kinds of errors with weight one.

+",2371,,,,,12/18/2020 11:49,,,,0,,,,CC BY-SA 4.0 +15189,1,15191,,12/18/2020 18:17,,3,426,"

I've been trying to implement the 1D Heisenberg chain (i.e. the XXZ model) on Qiskit but have been having trouble. To recap, the Heisenberg hamiltonian is as follows: +$$H_{XXZ} = \sum^{N}_{i = 1} [J(S^{x}_{i}S^{x}_{i+1} + S^{y}_{i}S^{y}_{i+1} + \Delta S^{z}_{i}S^{z}_{i+1})] $$ +and we can take the XY hamiltonian to be +$$H_{XY} = \sum^{N}_{i = 1} [J(S^{x}_{i}S^{x}_{i+1} + S^{y}_{i}S^{y}_{i+1})]$$ +as I understand. I know that the matrix representation of this hamiltonian's time evolution takes the form +$$XY(\theta) = \begin{pmatrix} +1 & 0 & 0 & 0\\ +0 & \cos[{\theta}/2] & i\sin[{\theta}/2] & 0\\ +0 & i\sin[{\theta}/2] & \cos[{\theta}/2] & 0\\ +0 & 0 & 0 & 1 +\end{pmatrix}$$ +however, I'm not exactly sure how to implement it on Qiskit with the available Quantum logic gates. I do know that a special case to this problem is the iSwapGate, where it is equal to $XY(\theta = \pi)$, but is there a way to implement $XY(\theta)$ for arbitrary angles?

+",13364,,55,,12/21/2020 23:39,12/21/2020 23:39,XY Hamiltonian in a 1D Heisenberg Chain,,1,2,,,,CC BY-SA 4.0 +15190,1,15192,,12/18/2020 18:41,,2,608,"

For a quantum channel $\mathcal{E}$, the Choi state is defined by the action of the channel on one half of an unnormalized maximally entangled state as below:

+

$$J(\mathcal{E}) = (\mathcal{E}\otimes I)\sum_{ij}\vert i\rangle\langle j\vert\otimes \vert i\rangle\langle j\vert$$

+

For isometric channels, the Choi state is also a pure state. What about the converse statement? Does the Choi state being pure give us any information about the properties of the channel?

+",4831,,,,,12/21/2020 23:46,When is the Choi matrix of a channel pure?,,2,0,,,,CC BY-SA 4.0 +15191,2,,15189,12/18/2020 19:51,,3,,"

Here is an implementation

+
from qiskit.circuit import QuantumCircuit, Parameter
+
+theta = Parameter('θ')
+
+qc = QuantumCircuit(2)
+qc.cx(0, 1)
+qc.crx(-1 * theta, 1, 0)
+qc.cx(0, 1)
+
+print(qc)
+---
+          ┌────────┐     
+q_0: ──■──┤ RX(-θ) ├──■──
+     ┌─┴─┐└───┬────┘┌─┴─┐
+q_1: ┤ X ├────■─────┤ X ├
+     └───┘          └───┘
+
+

and to evaluate that it works:

+
from qiskit.quantum_info import Operator
+
+def XY(theta):
+    c = np.cos(theta / 2)
+    s = 1j * np.sin(theta / 2)
+    
+    return np.array([[1, 0, 0, 0], 
+                     [0, c, s, 0], 
+                     [0, s, c, 0], 
+                     [0, 0, 0, 1]])
+
+val = pi / 14
+circ = qc.bind_parameters({theta: val})
+np.allclose(Operator(circ).data, 
+            XY(val))
+---
+True
+
+",13109,,,,,12/18/2020 19:51,,,,1,,,,CC BY-SA 4.0 +15192,2,,15190,12/18/2020 20:02,,2,,"

It works the other way around too. A pure state is rank $1$, and any channel with more than one Kraus operator will give a higher-rank Choi matrix, which can be easily seen from the definition.

+

You can also work it out on a different condition for pure states:

+

For any pure state $\rho$ we have $\rho^{2} = \rho.$

+

$$ +(J(\mathcal{E}))^{2} = \sum_{ij}\sum_{kl} \mathcal{E}(|i\rangle \langle j|)\mathcal{E}(|k\rangle \langle l|) \otimes |i\rangle \langle j|k\rangle\langle l| = \sum_{ijl}\mathcal{E}(|i\rangle \langle j|)\mathcal{E}(|j\rangle \langle l|) \otimes |i\rangle \langle l| +$$

+

so if $J(\mathcal{E})$ is pure then:

+

$$ +\sum_{ij}\mathcal{E}(|i\rangle \langle j|) \otimes |i\rangle \langle j| = \sum_{ijl}\mathcal{E}(|i\rangle \langle j|)\mathcal{E}(|j\rangle \langle l|) \otimes |i\rangle \langle l| +$$ +which, when relabeling $j <-> l$ on the right hand side, leads to: +$$ +\sum_{ij}\mathcal{E}(|i\rangle \langle j|) \otimes |i\rangle \langle j| = \sum_{l}\sum_{ij}\mathcal{E}(|i\rangle \langle l|)\mathcal{E}(|l\rangle \langle j|) \otimes |i\rangle \langle j| +$$ +Since all different $|i\rangle\langle j |$ are orthogonal, this needs to hold term-by-term:

+

$$ +\mathcal{E}(|i\rangle \langle j|) = \sum_{l}\mathcal{E}(|i\rangle \langle l|)\mathcal{E}(|l\rangle \langle j|). +$$

+

Writing $\mathcal{E}$ in it's Kraus decomposition $\{A_{k}\}$ sheds some extra light:

+

$$ +\sum_{k} A_{k}|i\rangle \langle j | A_{k}^{\dagger} = \sum_{l} \sum_{k'}\sum_{k''} A_{k'}|i\rangle \langle l | A_{k'}^{\dagger} A_{k''}|l\rangle \langle j | A_{k''}^{\dagger} +$$

+

noting that $\sum_{l} \langle l| A^{\dagger}_{k'} A_{k''}|l\rangle = \mathrm{tr}[A^{\dagger}_{k'} A_{k''}]$, we get:

+

$$ +\sum_{k} A_{k}|i\rangle \langle j | A_{k}^{\dagger} = \sum_{k'}\sum_{k''}\mathrm{tr}[A^{\dagger}_{k'} A_{k''}] A_{k'}|i\rangle \langle j | A_{k''}^{\dagger} +$$

+

and taking the trace and using its cyclic property on either side we get: +$$ +\sum_{k'k''}\delta_{k'k''} \langle j | A_{k''}^{\dagger}A_{k'}|i\rangle = \sum_{k'}\sum_{k''}\mathrm{tr}[A^{\dagger}_{k'} A_{k''}] \langle j | A_{k''}^{\dagger}A_{k'}|i\rangle +$$

+

Importantly, this works for every $|i\rangle, | j \rangle$, so the above equation can only hold if $\delta_{k'k''} = \mathrm{tr}[A^{\dagger}_{k'} A_{k''}]$, which is evidently only true if the Kraus operators are orthogonal and of unit length. But then they are unitary, which means there is only a single Kraus operator, necessarily unitary.

+",8141,,,,,12/18/2020 20:02,,,,0,,,,CC BY-SA 4.0 +15193,1,15195,,12/19/2020 13:49,,3,271,"

I've read that under current technology we would need around 20 million qubits to crack the RSA-2048 protocol. How would one prove this?

+",13030,,8141,,12/19/2020 16:19,11/17/2021 8:57,How to show that amount of qubits needed to crack the RSA-2048 protocol using Shor's algorithm?,,1,0,,,,CC BY-SA 4.0 +15194,1,,,12/19/2020 14:40,,4,73,"

Let $\rho, \sigma \in \mathfrak{D}(A)$ with $\operatorname{supp}(\rho) \subseteq \operatorname{supp}(\sigma),$ and spectral decomposition +$$ +\rho=\sum_{x} p_{x}\left|\psi_{x}\right\rangle\left\langle\psi_{x}\right| \quad \text { and } \quad \sigma=\sum_{y} q_{y}\left|\phi_{y}\right\rangle\left\langle\phi_{y}\right| +$$ +For any integer $n$ denote by $y^{n}:=\left(y_{1}, \ldots, y_{n}\right), q_{y^{n}}:=q_{y_{1}} \cdots q_{y_{n}},\left|\phi_{y^{n}}\right\rangle:=\left|\phi_{y_{1}}\right\rangle \otimes \cdots \otimes\left|\phi_{y_{n}}\right\rangle,$ and for any $\epsilon>0$ +the subspace $\mathfrak{T}_{n, \epsilon} \subset A^{n}$ is defined as +$$ +T_{n, \epsilon}:=\operatorname{span}\left\{\left|\phi_{y^{n}}\right\rangle \in A^{n}:\left|\operatorname{Tr}[\rho \log \sigma]-\frac{1}{n} \log \left(q_{y^{n}}\right)\right| \leqslant \epsilon\right\} +$$ +Finally, denote by $\Pi_{n, \epsilon}$ the projection onto the subspace $\mathfrak{T}_{n, \epsilon}$ in $A^{n}$

+

Now, I want to show two things. First, I want to show that +$$ +2^{n(\operatorname{Tr}[\rho \log \sigma]-\epsilon)} \Pi_{n, \epsilon} \leqslant \sigma^{\otimes n} \leqslant 2^{n(\operatorname{Tr}[\rho \log \sigma]+\epsilon)} \Pi_{n, \epsilon} +$$ +And I also want to show that for any $\epsilon>0$ +$$ +\lim _{n \rightarrow \infty} \operatorname{Tr}\left[\rho^{\otimes n} \Pi_{n, \epsilon}\right]=1 +$$

+

$\textbf{ATTEMPT}$: +I think I should start as follows. I denoted $r_{y}:=\left\langle\phi_{y}|\rho| \phi_{y}\right\rangle,$ and by $\tilde{Y}$ the random variable whose alphabet is the same as that of $Y,$ but his corresponding distribution is $\left\{r_{y}\right\} .$ Then, I want to show that +$$ +\operatorname{Tr}[\rho \log \sigma]=\mathbb{E}\left(\log q_{\tilde{Y}}\right) +$$

+

I'm really confused and struggling with this problem. Could you please help me?

+",13403,,55,,12/20/2020 15:16,12/20/2020 15:16,A question in classical and quantum information,,0,0,,,,CC BY-SA 4.0 +15195,2,,15193,12/19/2020 15:28,,9,,"

I assume you mean the result from this paper, where the authors (including 'our very own' Craig Gidney) have estimated that if you have $\sim20$ million noisy qubits it would take you around $8$ hours to 'run' Shor's algorithm for a $2048$ bit key.

+

For a 'proof' you can read the paper, but there are a few important things to realize here:

+
    +
  • This is an estimate
  • +
  • This number is for physical qubits, that are noisy, and that are therefore combined into logical qubits using QECC
  • +
  • The estimate depends on (what where then) current noise levels - lower noise levels means less need for error correction, which means less overhead
  • +
  • There is no definite number of (logical) qubits, it's always a trade-off between the number of qubits needed and the number of gates needed. This is why the time that it takes to run the algorithm is included in the title of the above paper, because implementing gates takes time, and therefore it is of vital importance
  • +
+

If you care only about logical qubits, this question & answer might be what you are looking for. However, remember, that there is no definite single answer to this question.

+",8141,,8141,,11/17/2021 8:57,11/17/2021 8:57,,,,2,,,,CC BY-SA 4.0 +15196,2,,15166,12/19/2020 19:05,,1,,"

In case someone sees this, and would like to have a workaround, the following code is inspired by the answer due to @KAJ226. Essentially, instead of saving the parameters into a list, we print them into a file so that we can extract them if needed. I compare the following three energies, the values saved by the call-back, the values recalculated with the parameters printed out to the file, and the values recalculated with the parameters saved by the call-back. It is shown that the first and the second values agree with each other. I attached the figure below.

+
import numpy as np
+import pylab
+
+from qiskit import BasicAer
+from qiskit.aqua.operators import WeightedPauliOperator
+from qiskit.aqua import QuantumInstance, aqua_globals
+from qiskit.aqua.algorithms import VQE, NumPyMinimumEigensolver
+from qiskit.aqua.components.initial_states import Zero
+from qiskit.aqua.components.optimizers import COBYLA, L_BFGS_B, SLSQP
+from qiskit.circuit.library import TwoLocal
+
+pauli_dict = {
+    'paulis': [{"coeff": {"imag": 0.0, "real": -1.052373245772859}, "label": "II"},
+              {"coeff": {"imag": 0.0, "real": 0.39793742484318045}, "label": "ZI"},
+              {"coeff": {"imag": 0.0, "real": -0.39793742484318045}, "label": "IZ"},
+              {"coeff": {"imag": 0.0, "real": -0.01128010425623538}, "label": "ZZ"},
+              {"coeff": {"imag": 0.0, "real": 0.18093119978423156}, "label": "XX"}
+              ]
+}
+
+qubit_op = WeightedPauliOperator.from_dict(pauli_dict)
+
+
+num_qubits = qubit_op.num_qubits
+init_state = Zero(num_qubits)
+var_form = TwoLocal(num_qubits, 'ry', 'cz', initial_state=init_state)
+
+counts = []
+values = []
+para3 = []
+with open('out.txt', 'w') as f: 
+    pass
+def store_intermediate_result(eval_count, parameters, mean, std):
+    counts.append(eval_count)
+    values.append(mean)
+    para3.append( parameters ) 
+#     print( parameters )
+    with open('out.txt', 'a') as f:
+        for item in parameters:
+            f.write( "%f " % item )
+        f.write( "\n" )
+    
+
+algo = VQE(qubit_op, var_form, COBYLA(), include_custom=True , callback=store_intermediate_result)
+backend = Aer.get_backend('qasm_simulator')
+algo_result = algo.run(backend)
+
+with open('out.txt' ) as f:
+    para2 = [line.split() for line in f]        
+
+para = []
+for x in para2:
+    para.append( [float(y) for y in x ] )
+
+
+counts = np.asarray(counts)
+values = np.asarray(values)
+
+values2 = []
+for x in counts:
+    algo = VQE(qubit_op, var_form, COBYLA(maxiter= 0), include_custom=True , initial_point = para[x-1])
+    backend = Aer.get_backend('qasm_simulator')
+    algo_result = algo.run(backend)
+
+    values2.append( algo_result['eigenvalue'] )
+
+values3 = []    
+for x in para3:
+    algo = VQE(qubit_op, var_form, COBYLA(maxiter= 0), include_custom=True , initial_point = x )
+    backend = Aer.get_backend('qasm_simulator')
+    algo_result = algo.run(backend)
+
+    values3.append( algo_result['eigenvalue'] )
+    
+fig,ax = pylab.subplots()
+Numval = 60
+ax.plot( counts[:Numval]  , values[:Numval] , 'ro' , label ='energy output by call-back')
+ax.plot( counts[:Numval]  , values2[:Numval] , 'bx' , label = 'energy recalculated with para print-out (correct)')
+ax.plot( counts[:Numval]  , values3[:Numval] , 'k*' , label = 'energy recalculated with para by the calle-back (wrong)')
+pylab.legend(loc='upper right')
+
+

+",9816,,,,,12/19/2020 19:05,,,,0,,,,CC BY-SA 4.0 +15197,1,,,12/19/2020 19:15,,2,157,"

Problem:

+

I'm having trouble seeing how this paper claims the following identity to be true for a three qubit system (labelled by $A$, $B$, and $C$) under a pure state $|\psi \rangle$ with real coefficients

+

$$\langle X_{A} X_{B}\rangle ^2 + \langle Z_{A} Z_{B}\rangle ^2 + \langle Z_{A} X_{B}\rangle ^2 + \langle X_{A} Z_{B}\rangle ^2 = 1 + \langle Y_{A} Y_{B}\rangle ^2 - \langle Y_{A} Y_{C}\rangle ^2 - \langle Y_{B} Y_{C}\rangle ^2$$

+

where $X$, $Y$, and $Z$ are the three Pauli matrices and the subscript is the qubit label. The expectation values have the usual meaning $\langle X_A X_B \rangle \equiv \text{tr} \rho X_A \otimes X_B \otimes 1$ where $\rho \equiv \text{tr}_C |\psi \rangle \langle \psi |$.

+

My Guess:

+

I'm thinking that this identity arises out of something like $X^2 + Y^2 + Z^2=3$ but that approach leads me nowhere since the square is outside the expectation brackets. Another problem is that while on the LHS the $C$ space is being traced over, on the RHS it's either $A$ or $B$ that's being traced over, and the square on top of everything just makes it worse. I suspect this is a well known but tediously derived identity, in which case I'll be happy to be pointed to some source material which grinds this out.

+

Thanks in advance. Cheers.

+",14177,,14177,,12/20/2020 6:00,12/20/2020 6:00,Three qubit identity,,0,4,,,,CC BY-SA 4.0 +15198,1,15202,,12/19/2020 20:14,,4,101,"

Consider a bipartite quantum state $\rho_{AB}$ over a product of finite-dimensional Hilbert spaces $\mathcal{H}_A \otimes \mathcal{H}_B$. Does there exists a unitary $U$ over $\mathcal{H}_A \otimes \mathcal{H}_B$ such that:

+
    +
  • For any bipartite $\rho_{AB}$, the reduced density matrix over $A$ is preserved $\mathrm{tr}_B{[U(\rho_{AB})U^*]} = \rho_A$.
  • +
  • For some a priori given $\sigma_{AB}$, the output is a product state: $U(\sigma_{AB})U^* = \sigma_A \otimes \omega_B$ (where $\omega_B$ can be anything).
  • +
+

I'm also interested in the case where such properties might only hold up to some arbitrary $\epsilon >0$ accuracy.

+",9900,,9900,,12/20/2020 17:09,12/20/2020 17:09,Unitary over bipartite states that can turn a non-product state into a product state,,1,2,0,,,CC BY-SA 4.0 +15199,1,15267,,12/19/2020 20:18,,2,255,"

I'm trying to apply the diffusion operator to this state (normalization factors excluded): +$|000\rangle + |001\rangle - |010\rangle - |011\rangle - |100\rangle - |101\rangle - |110\rangle -|111\rangle$

+

However, I get the resulting state: +$|001\rangle+|001\rangle$

+

This is the opposite of what I want. Is there a solution? I know that my oracle is correct since I can view the phases of $\pi$:

+

.

+

And my implementation of the diffusion operator is the same one as for all 3 qubit states - yet I still get a resulting state of:

+

+",9633,,,,,12/24/2020 20:18,Grover's algorithm for finding 6/8 states,,3,0,,,,CC BY-SA 4.0